import { Balance, CheckoutResult, Identity, PaywallBootstrap, PaywallPrice, PaywallPurchaseDetailed, PaywallUser, TrialConfig, TrialStatus } from '@monetize.software/sdk'; import { AuthChangeEvent, AuthSession, LastLogin, OAuthProvider, OAuthResumeCheckout, OtpVerifyType, SignUpResult } from '@monetize.software/sdk'; declare module './protocol' { interface RequestParamsMap { handshake: { protocolVersion: number; clientId: string; }; subscribe: { events: ReadonlyArray<'userChange' | 'authChange' | 'balancesChange'>; }; unsubscribe: { events: ReadonlyArray<'userChange' | 'authChange' | 'balancesChange'>; }; 'billing.bootstrap': { force?: boolean; }; 'billing.getCachedBootstrap': void; 'billing.getUser': { force?: boolean; }; 'billing.getCachedUser': void; 'billing.getSettledUser': void; 'billing.getBalances': { force?: boolean; }; 'billing.getCachedBalances': void; 'billing.createCheckout': { priceId: string; successUrl?: string; errorUrl?: string; shopUrl?: string; trialDays?: number; idempotencyKey?: string; ignoreActivePurchase?: boolean; }; 'billing.listPurchases': void; 'billing.cancelSubscription': { subscriptionId: string; reason: string; }; 'billing.getCustomerPortalUrl': { returnUrl?: string; }; 'billing.getIdentity': void; 'billing.setIdentity': { identity: Identity | null; }; 'billing.getVisitorId': void; /** File objects do NOT survive chrome.runtime ports — messages are * JSON-serialized (crbug.com/248548), a File degrades to `{}` silently. * Attachments therefore travel as base64: content stages each file with * `billing.stageSupportFile` (one request per file, so a 5-file ticket * never approaches the ~64MB port message cap), then references the * returned ids here. Size limits (5MB/file, 5 files) are validated by the * RemoteBillingClient before staging and by the backend again. */ 'billing.stageSupportFile': { name: string; type: string; /** base64 of the file bytes (see shared/base64.ts). */ dataBase64: string; }; 'billing.createSupportTicket': { subject: string; content: string; email?: string; /** Ids returned by `billing.stageSupportFile`, in attachment order. */ fileIds?: string[]; }; 'auth.signInWithEmail': { email: string; password: string; }; 'auth.signUp': { email: string; password: string; userMeta?: Record; }; 'auth.signOut': void; 'auth.getCachedSession': void; 'auth.refresh': void; 'auth.requestPasswordReset': { email: string; }; 'auth.updatePassword': { password: string; }; 'auth.sendOtp': { email: string; createUser?: boolean; userMeta?: Record; }; 'auth.verifyOtp': { email: string; token: string; type: OtpVerifyType; }; 'auth.resendConfirmation': { email: string; }; 'auth.revokeAllSessions': void; /** OAuth split: content does /init through offscreen, gets the * authorize_url and state. The state (together with the PKCE verifier) * lives in offscreen until the second request. */ 'auth.oauthStart': { provider: OAuthProvider; scopes?: string; userMeta?: Record; /** Skip the anon-upgrade linkIdentity path (no Bearer) → plain signin into * the account that owns the identity. Set by the "sign in with that * account" button shown after an oauth_identity_already_linked error. */ switchAccount?: boolean; /** The purchase to continue with once the code comes back. Held in * offscreen for the lifetime of the flow so it survives the calling * surface being destroyed — see the adopt handler. */ resumeCheckout?: OAuthResumeCheckout; }; /** Exchange the code for a session. The state from the oauthStart resolution * comes here — offscreen looks up the stored verifier by state. */ 'auth.oauthExchange': { state: string; code: string; }; /** Finish an OAuth flow whose originating surface is gone. The service * worker sees the provider's redirect land on our callback URL and reads * the code straight out of it; the state travels in `window.name`, which a * worker cannot read, so offscreen resolves the flow itself (it handed the * state out in oauthStart). Never throws — the SW only needs to know * whether it may close the tab. */ 'auth.oauthAdopt': { code: string; }; /** The current access token (lazy-refreshable). content/popup calls this to * pass the Bearer into external fetches (for example, ApiGatewayClient in * the content-script). Returns null if logged out or the refresh failed. */ 'auth.getAccessToken': void; /** Anonymous sign-in through the offscreen AuthClient. `captchaToken` is * optional — bootloaded for the future (when the server returns * challenge_required and demands proof-of-something). The server doesn't * check it yet, the field is reserved for forward-compat. `forceNewAnon` * skips the idempotent + resume steps and goes straight to /signin (creates * a new anon user — needed in the switch-account flow). */ 'auth.signInAnonymously': { captchaToken?: string; userMeta?: Record; forceNewAnon?: boolean; }; /** Last-used auth method + email per-paywall — for the "Last used" UI badge * in AuthPanel. Storage lives in offscreen, read through transport. */ 'auth.getLastLogin': void; 'tracker.track': { name: string; props?: Record; }; 'storage.get': { key: string; }; 'storage.set': { key: string; value: string; }; 'storage.remove': { key: string; }; 'trial.check': { paywallId: string; config: TrialConfig; }; 'trial.recordBlock': { paywallId: string; config: TrialConfig; }; 'trial.reset': { paywallId: string; config: TrialConfig; }; } interface RequestResultMap { handshake: { protocolVersion: number; offscreenReady: boolean; }; subscribe: void; unsubscribe: void; 'billing.bootstrap': PaywallBootstrap; 'billing.getCachedBootstrap': PaywallBootstrap | null; 'billing.getUser': PaywallUser; 'billing.getCachedUser': PaywallUser | null; 'billing.getSettledUser': PaywallUser | null; 'billing.getBalances': ReadonlyArray; 'billing.getCachedBalances': ReadonlyArray | null; 'billing.createCheckout': CheckoutResult; 'billing.listPurchases': ReadonlyArray; 'billing.cancelSubscription': { subscription: { status: string | null; canceled_at: string | null; cancel_at: string | null; cancel_at_period_end: boolean | null; }; }; 'billing.getCustomerPortalUrl': { url: string; }; 'billing.getIdentity': Identity | null; 'billing.setIdentity': void; 'billing.getVisitorId': string; 'billing.stageSupportFile': { fileId: string; }; 'billing.createSupportTicket': { ticket: { id: number; status: string; }; }; 'auth.signInWithEmail': AuthSession; 'auth.signUp': SignUpResult; 'auth.signOut': void; 'auth.getCachedSession': AuthSession | null; 'auth.refresh': AuthSession | null; 'auth.requestPasswordReset': void; 'auth.updatePassword': void; 'auth.sendOtp': void; 'auth.verifyOtp': AuthSession; 'auth.resendConfirmation': void; 'auth.revokeAllSessions': void; 'auth.oauthStart': { authorizeUrl: string; state: string; }; 'auth.oauthExchange': AuthSession; 'auth.oauthAdopt': { /** true — the session is live and broadcast; the SW may close the tab. */ adopted: boolean; /** Why not, for diagnostics: `no_pending_flow` (offscreen restarted, or * the originating surface already finished) or the exchange error code. */ reason?: string; /** Present when the flow carried a `resumeCheckout` and the checkout was * created: the SW sends the tab here instead of closing it, so the user * goes straight from signing in to paying. Absent when there was no * pending purchase, or creating it failed (including the 409 for a user * who already owns the subscription). */ checkoutUrl?: string; }; 'auth.getAccessToken': string | null; 'auth.signInAnonymously': AuthSession; 'auth.getLastLogin': LastLogin | null; 'tracker.track': void; 'storage.get': string | null; 'storage.set': void; 'storage.remove': void; 'trial.check': TrialStatus; 'trial.recordBlock': TrialStatus; 'trial.reset': void; } } declare module './protocol' { interface EventPayloadMap { userChange: PaywallUser; authChange: { event: AuthChangeEvent; session: AuthSession | null; }; balancesChange: ReadonlyArray; } } export type _PriceUnused = PaywallPrice; //# sourceMappingURL=messages.d.ts.map