/** Protocol version — bumped on breaking changes to the wire format. The SW * compares versions during the handshake and refuses to route if they diverge * (the extension and SDK weren't updated at the same time). */ export declare const PROTOCOL_VERSION: 1; /** Cancel message: the client sent cancel(id), the server looks up the matching * AbortController among the active requests and aborts it. Has no response — * fire-and-forget. */ export interface CancelEnvelope { type: 'cancel'; id: string; } export type RequestKind = 'billing.bootstrap' | 'billing.getCachedBootstrap' | 'billing.getUser' | 'billing.getCachedUser' | 'billing.getSettledUser' | 'billing.getBalances' | 'billing.getCachedBalances' | 'billing.createCheckout' | 'billing.listPurchases' | 'billing.cancelSubscription' | 'billing.getCustomerPortalUrl' | 'billing.getIdentity' | 'billing.setIdentity' | 'billing.getVisitorId' | 'billing.stageSupportFile' | 'billing.createSupportTicket' | 'auth.signInWithEmail' | 'auth.signUp' | 'auth.signOut' | 'auth.getCachedSession' | 'auth.refresh' | 'auth.requestPasswordReset' | 'auth.updatePassword' | 'auth.sendOtp' | 'auth.verifyOtp' | 'auth.resendConfirmation' | 'auth.revokeAllSessions' | 'auth.oauthStart' | 'auth.oauthExchange' | 'auth.oauthAdopt' | 'auth.getAccessToken' | 'auth.signInAnonymously' | 'auth.getLastLogin' | 'tracker.track' | 'storage.get' | 'storage.set' | 'storage.remove' | 'trial.check' | 'trial.recordBlock' | 'trial.reset' | 'handshake' | 'subscribe' | 'unsubscribe'; export interface RequestEnvelope
{
type: 'request';
id: string;
kind: RequestKind;
params: P;
}
export interface ResponseOk {
type: 'event';
kind: EventKind;
payload: P;
}
/** A flat snapshot of PaywallError that survives structured cloning. The
* reconstruct happens in RemoteBillingClient via `new PaywallError(...)` — so
* that the host's `error instanceof PaywallError` works as usual. */
export interface SerializedError {
name: string;
code: string;
message: string;
status?: number;
/** Stack from offscreen — for debugging in the content-script's DevTools. */
stack?: string;
}
export type Envelope = RequestEnvelope | ResponseEnvelope | EventEnvelope | CancelEnvelope;
export type RequestParams