@moonpay/platform-sdk-react-native 1.15.0 → 1.15.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +5 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/frame-specs.ts","../src/frame-view.tsx","../src/frame-component.tsx","../src/frame-engine.ts","../src/webview-transport.ts","../src/provider.tsx","../src/methods/add-card.ts","../src/methods/apple-pay.ts","../src/methods/auth.ts","../src/methods/buy.ts","../src/methods/buy-button.ts","../src/methods/challenge.ts","../src/methods/connect.ts","../src/methods/connection-check.ts","../src/methods/connection-reset.ts","../src/methods/customer-export.ts","../src/methods/google-pay.ts","../src/methods/widget.ts","../src/client.ts","../src/methods/mount-session.ts","../src/VisibleFrameSlotSheet.tsx","../src/sheet-presentation.ts","../src/components/add-card.tsx","../src/components/apple-pay-button.tsx","../src/components/auth.tsx","../src/components/buy-button.tsx","../src/components/buy-frame.tsx","../src/components/challenge.tsx","../src/components/connect.tsx","../src/components/connection-check.tsx","../src/components/connection-reset.tsx","../src/components/customer-export.tsx","../src/components/google-pay-button.tsx","../src/components/widget.tsx"],"sourcesContent":["// Re-export commonly used protocol types for convenience\n\nexport type {\n AssetStatus,\n GetQuoteParams,\n ListAssetsResponse,\n ListPaymentMethodsResponse,\n PaginationInfo,\n PaymentMethodConfig,\n PaymentMethodType,\n PlatformAsset,\n Quote,\n SimulateBankTransferOutcome,\n SimulateBankTransferParams,\n SimulateSenderBankAccount,\n StoredCardPaymentMethod,\n StoredPaymentMethod,\n Transaction,\n TransactionWithStages,\n} from '@moonpay/platform-protocol/api';\nexport type { Customer } from '@moonpay/platform-protocol/api/customer';\n// Frame-level types used in event payloads\nexport type { CardResponse } from '@moonpay/platform-protocol/frames/add-card';\nexport type {\n Cancellation as ChallengeCancellation,\n CompleteResult as ChallengeCompleteResult,\n} from '@moonpay/platform-protocol/frames/challenge';\nexport type { Connection } from '@moonpay/platform-protocol/models/connection';\nexport { ConnectionStatus } from '@moonpay/platform-protocol/models/connection';\nexport type { Result } from '@moonpay/platform-protocol/result';\n// SDK-facing event types — re-exported under their partner-facing names\nexport type {\n Event as AddCardEvent,\n SetupError as SetupAddCardError,\n} from '@moonpay/platform-protocol/sdks/add-card';\nexport type {\n Event as ApplePayEvent,\n SetupError as SetupApplePayError,\n} from '@moonpay/platform-protocol/sdks/apple-pay';\nexport type {\n Event as AuthEvent,\n SetupError as SetupAuthError,\n} from '@moonpay/platform-protocol/sdks/auth';\nexport type {\n Event as BuyEvent,\n SetupError as SetupBuyError,\n} from '@moonpay/platform-protocol/sdks/buy';\nexport type {\n Event as BuyButtonEvent,\n SetupError as SetupBuyButtonError,\n} from '@moonpay/platform-protocol/sdks/buy-button';\nexport type {\n Event as ChallengeEvent,\n SetupError as SetupChallengeError,\n} from '@moonpay/platform-protocol/sdks/challenge';\nexport type { Event as ConnectEvent } from '@moonpay/platform-protocol/sdks/connect';\nexport type {\n Event as CustomerExportEvent,\n SetupError as SetupCustomerExportError,\n} from '@moonpay/platform-protocol/sdks/customer-export';\nexport type {\n Event as GooglePayEvent,\n SetupError as SetupGooglePayError,\n} from '@moonpay/platform-protocol/sdks/google-pay';\nexport type {\n Event as WidgetEvent,\n SetupError as SetupWidgetError,\n} from '@moonpay/platform-protocol/sdks/widget';\nexport type { ListAssetsParams, ThemeOptions } from '@moonpay/platform-sdk-core';\nexport type { RNClient } from './client.js';\n// Inline frame components — render frames wherever you place them\nexport { MoonPayAddCard, type MoonPayAddCardProps } from './components/add-card.js';\nexport {\n MoonPayApplePayButton,\n type MoonPayApplePayButtonProps,\n} from './components/apple-pay-button.js';\nexport { MoonPayAuth, type MoonPayAuthProps } from './components/auth.js';\nexport { MoonPayBuyButton, type MoonPayBuyButtonProps } from './components/buy-button.js';\nexport { MoonPayBuyFrame, type MoonPayBuyFrameProps } from './components/buy-frame.js';\nexport { MoonPayChallenge, type MoonPayChallengeProps } from './components/challenge.js';\nexport { MoonPayConnect, type MoonPayConnectProps } from './components/connect.js';\nexport {\n MoonPayConnectionCheck,\n type MoonPayConnectionCheckProps,\n} from './components/connection-check.js';\nexport {\n MoonPayConnectionReset,\n type MoonPayConnectionResetProps,\n} from './components/connection-reset.js';\nexport {\n MoonPayCustomerExport,\n type MoonPayCustomerExportProps,\n} from './components/customer-export.js';\nexport {\n MoonPayGooglePayButton,\n type MoonPayGooglePayButtonProps,\n} from './components/google-pay-button.js';\nexport { MoonPayWidget, type MoonPayWidgetProps } from './components/widget.js';\nexport {\n MoonPayFrame,\n type MoonPayFrameProps,\n} from './frame-component.js';\nexport type { ConnectionCheckEvent, ConnectionResetEvent } from './frame-specs.js';\nexport type { AddCardFrame, SetupAddCardOptions } from './methods/add-card.js';\nexport type { ApplePayFrame, SetupApplePayOptions } from './methods/apple-pay.js';\nexport type { AuthFrame, SetupAuthOptions } from './methods/auth.js';\nexport type { BuyFrame, SetupBuyOptions } from './methods/buy.js';\nexport type { BuyButtonFrame, SetupBuyButtonOptions } from './methods/buy-button.js';\nexport type { ChallengeFrame, SetupChallengeOptions } from './methods/challenge.js';\nexport type { ConnectFrame, ConnectOptions } from './methods/connect.js';\nexport type { GetConnectionOptions } from './methods/connection-check.js';\nexport type {\n CustomerExportFrame,\n SetupCustomerExportOptions,\n} from './methods/customer-export.js';\nexport type { GooglePayFrame, SetupGooglePayOptions } from './methods/google-pay.js';\nexport type { SetupWidgetOptions, WidgetFrame } from './methods/widget.js';\nexport { MoonPayProvider, type MoonPayProviderProps, useMoonPay } from './provider.js';\nexport { WebViewTransport } from './webview-transport.js';\n","import type * as AddCardFrame from '@moonpay/platform-protocol/frames/add-card';\nimport type * as ApplePayFrame from '@moonpay/platform-protocol/frames/apple-pay';\nimport type * as AuthFrame from '@moonpay/platform-protocol/frames/auth';\nimport type * as BuyFrame from '@moonpay/platform-protocol/frames/buy';\nimport type * as BuyButtonFrame from '@moonpay/platform-protocol/frames/buy-button';\nimport type * as ChallengeFrame from '@moonpay/platform-protocol/frames/challenge';\nimport type * as ConnectFrame from '@moonpay/platform-protocol/frames/connect';\nimport type * as CustomerExportFrame from '@moonpay/platform-protocol/frames/customer-export';\nimport type * as GooglePayFrame from '@moonpay/platform-protocol/frames/google-pay';\nimport type * as WidgetFrame from '@moonpay/platform-protocol/frames/widget';\nimport type { Connection } from '@moonpay/platform-protocol/models/connection';\nimport {\n ConnectionErrorCode,\n ConnectionStatus,\n} from '@moonpay/platform-protocol/models/connection';\nimport type { FrameTransaction } from '@moonpay/platform-protocol/models/transaction';\nimport type { ProtocolMessage } from '@moonpay/platform-protocol/protocol';\nimport type * as AddCardSdk from '@moonpay/platform-protocol/sdks/add-card';\nimport type * as ApplePaySdk from '@moonpay/platform-protocol/sdks/apple-pay';\nimport type * as AuthSdk from '@moonpay/platform-protocol/sdks/auth';\nimport type * as BuySdk from '@moonpay/platform-protocol/sdks/buy';\nimport type * as BuyButtonSdk from '@moonpay/platform-protocol/sdks/buy-button';\nimport type * as ChallengeSdk from '@moonpay/platform-protocol/sdks/challenge';\nimport type * as ConnectSdk from '@moonpay/platform-protocol/sdks/connect';\nimport type * as CustomerExportSdk from '@moonpay/platform-protocol/sdks/customer-export';\nimport type * as GooglePaySdk from '@moonpay/platform-protocol/sdks/google-pay';\nimport type * as WidgetSdk from '@moonpay/platform-protocol/sdks/widget';\nimport {\n applyPresentationParam,\n decryptCredentials,\n FRAME_PATHS,\n type PresentationMode,\n presentationParams,\n type ThemeOptions,\n themeParams,\n} from '@moonpay/platform-sdk-core';\nimport type { EffectContext, FrameSpec, SpecContext } from './frame-engine.js';\n\n// ---------------------------------------------------------------------------\n// Shared commands\n// ---------------------------------------------------------------------------\n\nexport interface QuoteCommands {\n /** Push a fresh quote signature into the frame (e.g. after expiry). */\n setQuote(signature: string): void;\n}\n\nexport function createQuoteCommands(\n send: (msg: ProtocolMessage) => void,\n channelId: string,\n): QuoteCommands {\n return {\n setQuote: (signature) =>\n send({\n version: 2,\n meta: { channelId },\n kind: 'setQuote',\n payload: { quote: { signature } },\n }),\n };\n}\n\n// ---------------------------------------------------------------------------\n// Apple Pay button\n// ---------------------------------------------------------------------------\n\nexport interface ApplePayProps {\n quote: string;\n externalTransactionId?: string;\n presentation?: PresentationMode;\n}\n\nexport const applePaySpec: FrameSpec<ApplePaySdk.Event, ApplePayProps, QuoteCommands> = {\n channelPrefix: 'applepay',\n path: FRAME_PATHS.applePay,\n hidden: false,\n buildParams: (ctx, props) => ({\n clientToken: ctx.core.context.clientToken,\n signature: props.quote,\n ...(props.externalTransactionId && { externalTransactionId: props.externalTransactionId }),\n ...presentationParams(props.presentation),\n }),\n createCommands: createQuoteCommands,\n reactiveProps: {\n quote: (commands, quote) => commands.setQuote(quote),\n },\n mapMessage: (msg, commands) => {\n switch (msg.kind) {\n case 'ready':\n return { kind: 'ready' };\n case 'buttonPressed':\n return { kind: 'buttonPressed' };\n case 'complete':\n return { kind: 'complete', payload: msg.payload as { transaction: FrameTransaction } };\n case 'challenge':\n return {\n kind: 'challenge',\n payload: msg.payload as ApplePayFrame.InboundMessageMap['challenge'],\n };\n case 'error': {\n const payload = msg.payload as ApplePayFrame.InboundMessageMap['error'];\n if (payload.code === 'quoteExpired') {\n return { kind: 'quoteExpired', payload: { setQuote: commands.setQuote } };\n }\n if (payload.code === 'applePayUnavailable') {\n return { kind: 'unsupported' };\n }\n const kind = payload.code === 'generic' ? 'genericError' : payload.code;\n return { kind: 'error', payload: { kind, message: payload.message } };\n }\n default:\n return null;\n }\n },\n errorEvent: (message) => ({ kind: 'error', payload: { kind: 'genericError', message } }),\n};\n\n// ---------------------------------------------------------------------------\n// Google Pay button\n// ---------------------------------------------------------------------------\n\nexport interface GooglePayProps {\n quote: string;\n externalTransactionId?: string;\n presentation?: PresentationMode;\n}\n\nexport const googlePaySpec: FrameSpec<GooglePaySdk.Event, GooglePayProps, QuoteCommands> = {\n channelPrefix: 'googlepay',\n path: FRAME_PATHS.googlePay,\n hidden: false,\n buildParams: (ctx, props) => ({\n clientToken: ctx.core.context.clientToken,\n signature: props.quote,\n ...(props.externalTransactionId && { externalTransactionId: props.externalTransactionId }),\n ...presentationParams(props.presentation),\n }),\n createCommands: createQuoteCommands,\n reactiveProps: {\n quote: (commands, quote) => commands.setQuote(quote),\n },\n mapMessage: (msg, commands) => {\n switch (msg.kind) {\n case 'ready':\n return { kind: 'ready' };\n case 'buttonPressed':\n return { kind: 'buttonPressed' };\n case 'complete':\n return { kind: 'complete', payload: msg.payload as { transaction: FrameTransaction } };\n case 'challenge':\n return {\n kind: 'challenge',\n payload: msg.payload as GooglePayFrame.InboundMessageMap['challenge'],\n };\n case 'error': {\n const payload = msg.payload as GooglePayFrame.InboundMessageMap['error'];\n if (payload.code === 'quoteExpired') {\n return { kind: 'quoteExpired', payload: { setQuote: commands.setQuote } };\n }\n if (payload.code === 'googlePayUnavailable') {\n return { kind: 'unsupported' };\n }\n const kind = payload.code === 'generic' ? 'genericError' : payload.code;\n return { kind: 'error', payload: { kind, message: payload.message } };\n }\n default:\n return null;\n }\n },\n errorEvent: (message) => ({ kind: 'error', payload: { kind: 'genericError', message } }),\n};\n\n// ---------------------------------------------------------------------------\n// Buy button\n// ---------------------------------------------------------------------------\n\nexport interface BuyButtonProps {\n quote: string;\n externalTransactionId?: string;\n presentation?: PresentationMode;\n}\n\nexport const buyButtonSpec: FrameSpec<BuyButtonSdk.Event, BuyButtonProps, QuoteCommands> = {\n channelPrefix: 'buy-button',\n path: FRAME_PATHS.buyButton,\n hidden: false,\n buildParams: (ctx, props) => ({\n clientToken: ctx.core.context.clientToken,\n signature: props.quote,\n ...(props.externalTransactionId && { externalTransactionId: props.externalTransactionId }),\n ...presentationParams(props.presentation),\n }),\n createCommands: createQuoteCommands,\n reactiveProps: {\n quote: (commands, quote) => commands.setQuote(quote),\n },\n mapMessage: (msg) => {\n switch (msg.kind) {\n case 'ready':\n return { kind: 'ready' };\n case 'buttonPressed':\n return { kind: 'buttonPressed' };\n case 'complete':\n return { kind: 'complete', payload: msg.payload as BuyButtonFrame.MessageMap['complete'] };\n case 'challenge':\n return {\n kind: 'challenge',\n payload: msg.payload as BuyButtonFrame.MessageMap['challenge'],\n };\n case 'error':\n return { kind: 'error', payload: msg.payload as BuyButtonFrame.MessageMap['error'] };\n default:\n return null;\n }\n },\n errorEvent: (message) => ({\n kind: 'error',\n payload: { code: 'generic', message } as BuyButtonFrame.MessageMap['error'],\n }),\n};\n\n// ---------------------------------------------------------------------------\n// Credential side-effect (connect / auth / check-connection)\n// ---------------------------------------------------------------------------\n\n/**\n * On a credential-bearing `complete`, decrypt the delivered credentials with\n * the session's private key and store them on the shared client context.\n * Runs before event fan-out so partners see tokens already applied.\n *\n * `connectionRequired` carries encrypted anonymous tokens — storing the\n * `clientToken` is what makes `setupAuth()` / `<MoonPayAuth>` and other\n * pre-connect flows possible without a full connect flow (mirrors the web SDK).\n */\nexport function applyCredentialsOnComplete(msg: ProtocolMessage, ctx: EffectContext): void {\n if (msg.kind !== 'complete' || !ctx.privateKey) return;\n const connection = msg.payload as Connection;\n if (\n connection.status !== ConnectionStatus.active &&\n connection.status !== ConnectionStatus.connectionRequired\n ) {\n return;\n }\n // The type declares `credentials` as required, but the payload arrives over\n // postMessage — guard so a frame that omits it (e.g. anonymous tokens not\n // issued for this partner) degrades to \"no tokens stored\" instead of a\n // throw that would swallow the `complete` event entirely.\n if (!connection.credentials) return;\n const creds = decryptCredentials(connection.credentials, ctx.privateKey);\n ctx.core.context.setAccessToken(creds.accessToken);\n ctx.core.context.setClientToken(creds.clientToken);\n}\n\n// ---------------------------------------------------------------------------\n// Session-token guard\n// ---------------------------------------------------------------------------\n\n/**\n * Check-connection and reset are the only frames that take the raw\n * `sessionToken`. When the provider was mounted without one (and `initialize()`\n * hasn't run yet), fail with a clear, actionable message instead of building a\n * frame URL with `sessionToken=undefined`. Mirrors how `authSpec` guards\n * `clientToken`.\n */\nfunction requireSessionToken(ctx: SpecContext): string {\n if (!ctx.sessionToken) {\n throw new Error(\n 'No session token — pass sessionToken to <MoonPayProvider> or call initialize() from useMoonPay() before starting a connection.',\n );\n }\n return ctx.sessionToken;\n}\n\n// ---------------------------------------------------------------------------\n// Check-connection (hidden)\n// ---------------------------------------------------------------------------\n\nexport interface ConnectionCheckProps {\n skipKyc?: boolean;\n}\n\nexport type ConnectionCheckEvent =\n | { kind: 'complete'; payload: Connection }\n | { kind: 'error'; payload: { message: string } };\n\nexport const connectionCheckSpec: FrameSpec<ConnectionCheckEvent, ConnectionCheckProps> = {\n channelPrefix: 'check',\n path: FRAME_PATHS.checkConnection,\n hidden: true,\n needsKeyPair: true,\n handshakeTimeout: 10_000,\n buildParams: (ctx, props, publicKey) => ({\n sessionToken: requireSessionToken(ctx),\n publicKey,\n ...(props.skipKyc && { skipKyc: true }),\n }),\n onMessageEffect: applyCredentialsOnComplete,\n mapMessage: (msg) => {\n if (msg.kind === 'complete') {\n return { kind: 'complete', payload: msg.payload as Connection };\n }\n if (msg.kind === 'error') {\n return { kind: 'error', payload: msg.payload as { message: string } };\n }\n return null;\n },\n errorEvent: (message) => ({ kind: 'error', payload: { message } }),\n};\n\n// ---------------------------------------------------------------------------\n// Connect (visible)\n// ---------------------------------------------------------------------------\n\nexport interface ConnectProps {\n theme?: ThemeOptions;\n presentation?: PresentationMode;\n}\n\nexport const connectSpec: FrameSpec<ConnectSdk.Event, ConnectProps> = {\n channelPrefix: 'connect',\n path: FRAME_PATHS.connect,\n hidden: false,\n needsKeyPair: true,\n buildParams: (ctx, props, publicKey) => {\n const clientToken = ctx.core.context.clientToken;\n if (!clientToken) {\n throw new Error(\n 'No clientToken in context — call getConnection() first and ensure it resolved with status \"connectionRequired\".',\n );\n }\n return {\n clientToken,\n publicKey,\n // Per-call override; `applyThemeParam` in the engine fills the client\n // default for connect (and every other visible frame) when this is absent.\n ...themeParams(props.theme),\n ...presentationParams(props.presentation),\n };\n },\n onMessageEffect: applyCredentialsOnComplete,\n mapMessage: (msg) => {\n switch (msg.kind) {\n case 'ready':\n return { kind: 'ready' };\n case 'error':\n return { kind: 'error', payload: msg.payload as ConnectFrame.MessageMap['error'] };\n case 'complete':\n return { kind: 'complete', payload: msg.payload as ConnectFrame.MessageMap['complete'] };\n default:\n return null;\n }\n },\n errorEvent: (message) => ({\n kind: 'error',\n payload: { code: ConnectionErrorCode.connectionFailedGeneric, message },\n }),\n};\n\n// ---------------------------------------------------------------------------\n// Auth (visible)\n// ---------------------------------------------------------------------------\n\nexport interface AuthProps {\n presentation?: PresentationMode;\n}\n\nexport const authSpec: FrameSpec<AuthSdk.Event, AuthProps> = {\n channelPrefix: 'auth',\n path: FRAME_PATHS.auth,\n hidden: false,\n needsKeyPair: true,\n buildParams: (ctx, props, publicKey) => {\n const clientToken = ctx.core.context.clientToken;\n if (!clientToken) {\n throw new Error(\n 'No clientToken in context — call getConnection() first and ensure it resolved with status \"connectionRequired\".',\n );\n }\n return { clientToken, publicKey, ...presentationParams(props.presentation) };\n },\n onMessageEffect: applyCredentialsOnComplete,\n mapMessage: (msg) => {\n switch (msg.kind) {\n case 'ready':\n return { kind: 'ready' };\n case 'error':\n return { kind: 'error', payload: msg.payload as AuthFrame.MessageMap['error'] };\n case 'complete': {\n const connection = msg.payload as Connection;\n if (\n connection.status === ConnectionStatus.active ||\n connection.status === ConnectionStatus.termsAcceptanceRequired\n ) {\n return { kind: 'complete', payload: msg.payload as AuthFrame.MessageMap['complete'] };\n }\n return null;\n }\n default:\n return null;\n }\n },\n errorEvent: (message) => ({\n kind: 'error',\n payload: { code: ConnectionErrorCode.connectionFailedGeneric, message },\n }),\n};\n\n// ---------------------------------------------------------------------------\n// Widget (visible)\n// ---------------------------------------------------------------------------\n\nexport interface WidgetProps {\n quote: string;\n externalTransactionId?: string;\n presentation?: PresentationMode;\n}\n\nexport const widgetSpec: FrameSpec<WidgetSdk.Event, WidgetProps> = {\n channelPrefix: 'widget',\n path: FRAME_PATHS.widget,\n hidden: false,\n buildParams: (ctx, props) => ({\n flow: 'buy',\n clientToken: ctx.core.context.clientToken,\n quoteSignature: props.quote,\n ...(props.externalTransactionId && { externalTransactionId: props.externalTransactionId }),\n ...presentationParams(props.presentation),\n }),\n mapMessage: (msg) => {\n switch (msg.kind) {\n case 'ready':\n return { kind: 'ready' };\n case 'transactionCreated':\n return {\n kind: 'transactionCreated',\n payload: msg.payload as WidgetFrame.MessageMap['transactionCreated'],\n };\n case 'complete':\n return { kind: 'complete', payload: msg.payload as { transaction: FrameTransaction } };\n case 'error':\n return { kind: 'error', payload: msg.payload as WidgetFrame.MessageMap['error'] };\n case 'close':\n return { kind: 'close' };\n default:\n return null;\n }\n },\n errorEvent: (message) => ({\n kind: 'error',\n payload: { code: 'generic', message } as WidgetFrame.MessageMap['error'],\n }),\n};\n\n// ---------------------------------------------------------------------------\n// Buy (hidden, headless)\n// ---------------------------------------------------------------------------\n\nexport interface BuyProps {\n quote: string;\n externalTransactionId?: string;\n}\n\nexport const buySpec: FrameSpec<BuySdk.Event, BuyProps, QuoteCommands> = {\n channelPrefix: 'buy',\n path: FRAME_PATHS.buy,\n hidden: true,\n buildParams: (ctx, props) => ({\n clientToken: ctx.core.context.clientToken,\n signature: props.quote,\n ...(props.externalTransactionId && { externalTransactionId: props.externalTransactionId }),\n }),\n createCommands: createQuoteCommands,\n reactiveProps: {\n quote: (commands, quote) => commands.setQuote(quote),\n },\n mapMessage: (msg) => {\n switch (msg.kind) {\n case 'ready':\n return { kind: 'ready' };\n case 'complete':\n return { kind: 'complete', payload: msg.payload as BuyFrame.MessageMap['complete'] };\n case 'challenge':\n return { kind: 'challenge', payload: msg.payload as BuyFrame.MessageMap['challenge'] };\n case 'error':\n return { kind: 'error', payload: msg.payload as BuyFrame.MessageMap['error'] };\n default:\n return null;\n }\n },\n errorEvent: (message) => ({\n kind: 'error',\n payload: { code: 'generic', message } as BuyFrame.MessageMap['error'],\n }),\n};\n\n// ---------------------------------------------------------------------------\n// Add card (visible)\n// ---------------------------------------------------------------------------\n\nexport interface AddCardProps {\n presentation?: PresentationMode;\n}\n\nexport const addCardSpec: FrameSpec<AddCardSdk.Event, AddCardProps> = {\n channelPrefix: 'add-card',\n path: FRAME_PATHS.addCard,\n hidden: false,\n buildParams: (ctx, props) => ({\n clientToken: ctx.core.context.clientToken,\n ...presentationParams(props.presentation),\n }),\n mapMessage: (msg) => {\n switch (msg.kind) {\n case 'ready':\n return { kind: 'ready' };\n case 'complete':\n return {\n kind: 'complete',\n payload: msg.payload as { card: AddCardFrame.CardResponse },\n };\n case 'error':\n return { kind: 'error', payload: msg.payload as AddCardFrame.MessageMap['error'] };\n default:\n return null;\n }\n },\n errorEvent: (message) => ({\n kind: 'error',\n payload: { code: 'generic', message } as AddCardFrame.MessageMap['error'],\n }),\n};\n\n// ---------------------------------------------------------------------------\n// Customer export (visible)\n// ---------------------------------------------------------------------------\n\nexport interface CustomerExportProps {\n presentation?: PresentationMode;\n}\n\nexport const customerExportSpec: FrameSpec<CustomerExportSdk.Event, CustomerExportProps> = {\n channelPrefix: 'customer-export',\n path: FRAME_PATHS.customerExport,\n hidden: false,\n buildParams: (ctx, props) => ({\n clientToken: ctx.core.context.clientToken,\n ...presentationParams(props.presentation),\n }),\n mapMessage: (msg) => {\n switch (msg.kind) {\n case 'ready':\n return { kind: 'ready' };\n case 'complete':\n return {\n kind: 'complete',\n payload: msg.payload as CustomerExportFrame.MessageMap['complete'],\n };\n case 'error':\n return { kind: 'error', payload: msg.payload as CustomerExportFrame.MessageMap['error'] };\n case 'close':\n return { kind: 'close' };\n default:\n return null;\n }\n },\n errorEvent: (message) => ({\n kind: 'error',\n payload: { code: ConnectionErrorCode.connectionFailedGeneric, message },\n }),\n};\n\n// ---------------------------------------------------------------------------\n// Challenge (visible; URL comes from a frame's `challenge` event)\n// ---------------------------------------------------------------------------\n\nexport interface ChallengeProps {\n url: string;\n presentation?: PresentationMode;\n}\n\nexport const challengeSpec: FrameSpec<ChallengeSdk.Event, ChallengeProps> = {\n channelPrefix: 'challenge',\n path: FRAME_PATHS.challenge, // documentation only — buildUrl below wins\n hidden: false,\n resolveChannelId: (props, generated) =>\n new URL(props.url).searchParams.get('channelId') || generated,\n buildUrl: (_ctx, props, channelId) => {\n const url = new URL(props.url);\n url.searchParams.set('channelId', channelId);\n return applyPresentationParam(url.toString(), props.presentation);\n },\n mapMessage: (msg) => {\n switch (msg.kind) {\n case 'ready':\n return { kind: 'ready' };\n case 'complete':\n return { kind: 'complete', payload: msg.payload as ChallengeFrame.CompleteResult };\n case 'cancelled':\n return { kind: 'cancelled', payload: msg.payload as ChallengeFrame.Cancellation };\n case 'error':\n return { kind: 'error', payload: msg.payload as ChallengeFrame.MessageMap['error'] };\n default:\n return null;\n }\n },\n errorEvent: (message) => ({\n kind: 'error',\n payload: { code: 'generic', message } as ChallengeFrame.MessageMap['error'],\n }),\n};\n\n// ---------------------------------------------------------------------------\n// Reset connection (hidden, headless)\n// ---------------------------------------------------------------------------\n\nexport type ConnectionResetProps = Record<string, never>;\n\nexport type ConnectionResetEvent =\n | { kind: 'complete' }\n | { kind: 'error'; payload: { message: string } };\n\nexport const connectionResetSpec: FrameSpec<ConnectionResetEvent, ConnectionResetProps> = {\n channelPrefix: 'reset',\n path: FRAME_PATHS.reset,\n hidden: true,\n handshakeTimeout: 5_000,\n buildParams: (ctx) => ({ sessionToken: requireSessionToken(ctx) }),\n mapMessage: (msg) => {\n if (msg.kind === 'complete') return { kind: 'complete' };\n if (msg.kind === 'error') {\n const payload = msg.payload as { message?: string };\n return { kind: 'error', payload: { message: payload?.message ?? 'Reset failed' } };\n }\n return null;\n },\n errorEvent: (message) => ({ kind: 'error', payload: { message } }),\n};\n","import { useEffect, useRef, useState } from 'react';\nimport { View, type ViewStyle } from 'react-native';\nimport { MoonPayFrame } from './frame-component.js';\nimport {\n createFrameSession,\n type FrameSession,\n type FrameSessionHandle,\n type FrameSpec,\n} from './frame-engine.js';\nimport { useMoonPayContext } from './provider.js';\nimport type { RNFrameTransport } from './webview-transport.js';\n\nexport interface MoonPayFrameViewProps<E, P, C> {\n spec: FrameSpec<E, P, C>;\n /** Frame props. Keys declared in the spec's `reactiveProps` update the live frame via commands; all other keys remount the frame on change. */\n props: P;\n style?: ViewStyle;\n defaultStyle: ViewStyle;\n onEvent?: (event: E) => void;\n}\n\n/**\n * Push the latest value of each changed reactive prop into the live session,\n * recording what was applied so unchanged values never re-send commands.\n */\nfunction applyReactiveProps<E, P, C>(\n spec: FrameSpec<E, P, C>,\n keys: (keyof P)[],\n props: P,\n applied: Partial<P>,\n handle: FrameSessionHandle<E, C>,\n): void {\n for (const key of keys) {\n const next = props[key];\n if (next !== undefined && next !== applied[key]) {\n spec.reactiveProps?.[key]?.(handle.commands, next as NonNullable<P[typeof key]>);\n applied[key] = next;\n }\n }\n}\n\n/**\n * Shared inline mount target for frame sessions. Renders the WebView exactly\n * where the partner places this component; the engine handles everything else.\n */\nexport function MoonPayFrameView<E, P, C>({\n spec,\n props,\n style,\n defaultStyle,\n onEvent,\n}: MoonPayFrameViewProps<E, P, C>): JSX.Element | null {\n const { sessionToken, core, frameBaseUrl, theme } = useMoonPayContext();\n const [transport, setTransport] = useState<RNFrameTransport | null>(null);\n const handleRef = useRef<FrameSessionHandle<E, C> | null>(null);\n const onEventRef = useRef(onEvent);\n onEventRef.current = onEvent;\n const propsRef = useRef(props);\n propsRef.current = props;\n\n // Split props by the spec's reactiveProps declaration: reactive keys update\n // the live session via commands; everything else remounts the frame.\n const reactiveKeys = Object.keys(spec.reactiveProps ?? {}) as (keyof P)[];\n const mountProps: Partial<P> = {};\n const liveProps: Partial<P> = {};\n for (const [key, value] of Object.entries(props as Record<string, unknown>)) {\n const k = key as keyof P;\n (reactiveKeys.includes(k) ? liveProps : mountProps)[k] = value as P[keyof P];\n }\n const mountKey = JSON.stringify(mountProps);\n const liveKey = JSON.stringify(liveProps);\n\n // Tracks the last applied reactive values, seeded at mount.\n const appliedRef = useRef<Partial<P>>({});\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: mountKey encodes the props that should remount\n useEffect(() => {\n let disposed = false;\n let session: FrameSession<E, C>;\n // Snapshot the reactive values the session is created with.\n const applied: Partial<P> = {};\n for (const key of reactiveKeys) {\n applied[key] = propsRef.current[key];\n }\n appliedRef.current = applied;\n\n try {\n session = createFrameSession(\n spec,\n { sessionToken, core, frameBaseUrl, theme },\n propsRef.current,\n );\n } catch (e) {\n onEventRef.current?.(\n spec.errorEvent(e instanceof Error ? e.message : 'Failed to create frame'),\n );\n return;\n }\n\n setTransport(session.transport);\n\n session.ready\n .then((handle) => {\n if (disposed) {\n handle.dispose();\n return;\n }\n handleRef.current = handle;\n handle.onEvent((event) => onEventRef.current?.(event));\n // Apply reactive props that changed while the handshake was in flight\n applyReactiveProps(spec, reactiveKeys, propsRef.current, appliedRef.current, handle);\n })\n .catch((e: unknown) => {\n if (!disposed) {\n onEventRef.current?.(\n spec.errorEvent(e instanceof Error ? e.message : 'Frame handshake failed'),\n );\n }\n });\n\n return () => {\n disposed = true;\n handleRef.current = null;\n session.dispose();\n setTransport(null);\n };\n }, [mountKey, spec, sessionToken, core, frameBaseUrl]);\n\n // Reactive props → commands (no remount). Skipped while the handshake is\n // pending; the ready handler above applies the latest values.\n // biome-ignore lint/correctness/useExhaustiveDependencies: liveKey encodes the reactive prop values\n useEffect(() => {\n const handle = handleRef.current;\n if (!handle) return;\n applyReactiveProps(spec, reactiveKeys, propsRef.current, appliedRef.current, handle);\n }, [liveKey]);\n\n if (spec.hidden) {\n return transport ? <MoonPayFrame transport={transport} hidden /> : null;\n }\n\n const resolvedStyle: ViewStyle = { ...defaultStyle, ...style };\n return (\n <View style={resolvedStyle}>{transport ? <MoonPayFrame transport={transport} /> : null}</View>\n );\n}\n","import { useEffect, useRef } from 'react';\nimport { View, type ViewStyle } from 'react-native';\nimport WebView, { type WebViewMessageEvent } from 'react-native-webview';\nimport type { RNFrameTransport } from './webview-transport.js';\n\nexport interface MoonPayFrameProps {\n /** The transport instance managing this frame's communication. */\n transport: RNFrameTransport;\n /** Whether this is a hidden utility frame (zero height). */\n hidden?: boolean;\n /** Optional style overrides for the container view. */\n style?: ViewStyle;\n}\n\n/**\n * Reusable React Native component that renders a MoonPay frame as a WebView.\n * Bridges the WebViewTransport to the actual WebView instance.\n */\nexport function MoonPayFrame({ transport, hidden, style }: MoonPayFrameProps): JSX.Element | null {\n const webViewRef = useRef<WebView>(null);\n\n useEffect(() => {\n transport.attachWebView(webViewRef);\n return () => {\n // Don't dispose — the orchestrator manages lifecycle\n };\n }, [transport]);\n\n const url = transport.url;\n if (!url) return null;\n\n const handleMessage = (event: WebViewMessageEvent) => {\n transport.handleWebViewMessage(event.nativeEvent.data);\n };\n\n const containerStyle: ViewStyle = hidden\n ? { width: 0, height: 0, overflow: 'hidden' }\n : { flex: 1, ...style };\n\n return (\n <View style={containerStyle}>\n <WebView\n ref={webViewRef}\n source={{ uri: url }}\n onMessage={handleMessage}\n allowsInlineMediaPlayback\n javaScriptEnabled\n domStorageEnabled\n style={{ flex: 1 }}\n />\n </View>\n );\n}\n","import type { ProtocolMessage } from '@moonpay/platform-protocol/protocol';\nimport {\n applyThemeParam,\n buildFrameUrl,\n type CoreClient,\n createFrameOrchestrator,\n generateKeyPair,\n type ThemeOptions,\n} from '@moonpay/platform-sdk-core';\nimport { type RNFrameTransport, WebViewTransport } from './webview-transport.js';\n\n/** Shared dependencies every frame needs to build its URL and apply effects. */\nexport interface SpecContext {\n /**\n * Session token from the partner's server. Optional because the provider can\n * be mounted before one is available (see `initialize()` in the provider);\n * only the check-connection, connect, and reset frames consume it, and they\n * guard for its absence via `requireSessionToken`.\n */\n sessionToken?: string;\n core: CoreClient;\n frameBaseUrl?: string;\n /** Client-level theme applied to every visible frame (provider-wide default). */\n theme?: ThemeOptions;\n}\n\n/** Context passed to `onMessageEffect`; includes the session's private key when one was generated. */\nexport interface EffectContext extends SpecContext {\n privateKey?: string;\n}\n\n/**\n * Declarative description of a frame type. Everything that differs between\n * frames lives here; `createFrameSession` provides everything that doesn't.\n */\nexport interface FrameSpec<E, P, C = undefined> {\n /** Channel id prefix, e.g. 'applepay' → 'applepay-<timestamp>'. */\n channelPrefix: string;\n /** FRAME_PATHS entry. Ignored when `buildUrl` is provided. */\n path: string;\n /** Render hidden (0×0 utility frame)? */\n hidden: boolean;\n /** Generate an X25519 key pair for encrypted credential delivery. */\n needsKeyPair?: boolean;\n /** Handshake timeout override in ms (orchestrator default: 15_000). */\n handshakeTimeout?: number;\n /** Query params for the frame URL (channelId is added automatically). */\n buildParams?(ctx: SpecContext, props: P, publicKey?: string): Record<string, unknown>;\n /** Derive the channel id from props (challenge reads it from the partner URL). May throw. */\n resolveChannelId?(props: P, generated: string): string;\n /** Full URL override (challenge). May throw on invalid input. */\n buildUrl?(ctx: SpecContext, props: P, channelId: string, publicKey?: string): string;\n /** Map a protocol message to an SDK event, or null to ignore it. */\n mapMessage(msg: ProtocolMessage, commands: C): E | null;\n /** Side effect on incoming messages (e.g. credential decryption). Runs before event fan-out. */\n onMessageEffect?(msg: ProtocolMessage, ctx: EffectContext): void;\n /** Outbound commands exposed on the session handle (e.g. setQuote). */\n createCommands?(send: (msg: ProtocolMessage) => void, channelId: string): C;\n /** Wrap a failure (handshake timeout, invalid props) as this frame's error event. */\n errorEvent(message: string): E;\n /**\n * Props that update a live session through commands instead of remounting\n * the frame. Each entry maps a prop key to the command invocation that\n * applies its new value. Props not listed here remount the frame on change.\n */\n reactiveProps?: { [K in keyof P]?: (commands: C, value: NonNullable<P[K]>) => void };\n}\n\nexport interface FrameSessionHandle<E, C = undefined> {\n /** Subscribe to mapped SDK events. Returns an unsubscribe function. */\n onEvent(handler: (event: E) => void): () => void;\n /** Subscribe to raw post-handshake protocol messages. */\n onMessage(handler: (msg: ProtocolMessage) => void): () => void;\n /**\n * Subscribe to session teardown. Fires exactly once, from any dispose path\n * (the handle's own `dispose()` or the session-level one — e.g. the user\n * dismissing an SDK-presented frame). Returns an unsubscribe function.\n */\n onDispose(handler: () => void): () => void;\n sendMessage(msg: ProtocolMessage): void;\n commands: C;\n dispose(): void;\n}\n\nexport interface FrameSession<E, C = undefined> {\n transport: RNFrameTransport;\n channelId: string;\n url: string;\n hidden: boolean;\n /** Resolves after the handshake; rejects on timeout. */\n ready: Promise<FrameSessionHandle<E, C>>;\n /** Tear down the session at any point — safe to call before the handshake completes. */\n dispose(): void;\n}\n\nexport interface CreateFrameSessionOverrides {\n createTransport?: () => RNFrameTransport;\n handshakeTimeout?: number;\n}\n\n/**\n * Rejection reason for `FrameSession.ready` when the session is disposed\n * before the handshake completes (e.g. the user dismisses an SDK-presented\n * frame while it is still loading). Callers awaiting `ready` can distinguish\n * this from a handshake timeout or setup failure.\n */\nexport class FrameSessionDisposedError extends Error {\n constructor() {\n super('Frame session disposed');\n this.name = 'FrameSessionDisposedError';\n }\n}\n\n/**\n * Create a frame session: URL, transport, handshake, typed events, commands.\n * Does NOT decide where the WebView renders — the caller mounts\n * `session.transport` in a provider slot or an inline component.\n *\n * May throw synchronously if the spec's `resolveChannelId`/`buildUrl`\n * rejects the props (e.g. an invalid challenge URL).\n */\nexport function createFrameSession<E, P, C = undefined>(\n spec: FrameSpec<E, P, C>,\n ctx: SpecContext,\n props: P,\n overrides: CreateFrameSessionOverrides = {},\n): FrameSession<E, C> {\n const generated = `${spec.channelPrefix}-${Date.now()}`;\n const channelId = spec.resolveChannelId ? spec.resolveChannelId(props, generated) : generated;\n const keyPair = spec.needsKeyPair ? generateKeyPair() : undefined;\n\n const builtUrl = spec.buildUrl\n ? spec.buildUrl(ctx, props, channelId, keyPair?.publicKey)\n : buildFrameUrl(\n spec.path,\n { ...spec.buildParams?.(ctx, props, keyPair?.publicKey), channelId },\n { frameBaseUrl: ctx.frameBaseUrl },\n );\n // Inject the client-level theme into every visible frame. Hidden utility\n // frames have no UI, so they stay param-clean; `applyThemeParam` leaves a\n // per-frame theme (e.g. connect's own option) untouched if already present.\n const url = spec.hidden ? builtUrl : applyThemeParam(builtUrl, ctx.theme);\n\n const transport = (overrides.createTransport ?? (() => new WebViewTransport()))();\n\n let resolvedHandle: FrameSessionHandle<E, C> | null = null;\n\n // Settles `ready` immediately when the session is disposed pre-handshake —\n // without this, callers awaiting `ready` would only learn of the teardown\n // when the orchestrator's handshake timer fires (up to 15s later), and as\n // the wrong error.\n let rejectDisposed: ((error: Error) => void) | undefined;\n const disposedBeforeReady = new Promise<never>((_, reject) => {\n rejectDisposed = reject;\n });\n\n const handleReady = createFrameOrchestrator({\n transport,\n channelId,\n url,\n container: null,\n hidden: spec.hidden,\n handshakeTimeout: overrides.handshakeTimeout ?? spec.handshakeTimeout ?? 15_000,\n }).then((handle): FrameSessionHandle<E, C> => {\n const send = (msg: ProtocolMessage) => handle.sendMessage(msg);\n const commands = spec.createCommands?.(send, channelId) as C;\n const eventHandlers: Array<(event: E) => void> = [];\n const disposeHandlers: Array<() => void> = [];\n let disposeNotified = false;\n const notifyDisposed = () => {\n if (disposeNotified) return;\n disposeNotified = true;\n for (const handler of [...disposeHandlers]) {\n handler();\n }\n };\n\n handle.onMessage((msg) => {\n let event: E | null;\n try {\n spec.onMessageEffect?.(msg, { ...ctx, privateKey: keyPair?.privateKey });\n event = spec.mapMessage(msg, commands);\n } catch (e) {\n // A throwing effect or mapper (e.g. credential decryption on a\n // corrupt payload) would otherwise propagate into the transport's\n // catch-all and silently drop this message — the partner would see\n // nothing and request/response methods would only fail by timeout.\n // Surface it as the frame's error event instead.\n event = spec.errorEvent(e instanceof Error ? e.message : 'Failed to process frame message');\n }\n if (event !== null) {\n for (const handler of [...eventHandlers]) {\n handler(event);\n }\n }\n });\n\n const sessionHandle: FrameSessionHandle<E, C> = {\n onEvent(handler) {\n eventHandlers.push(handler);\n return () => {\n const idx = eventHandlers.indexOf(handler);\n if (idx >= 0) eventHandlers.splice(idx, 1);\n };\n },\n onMessage: (handler) => handle.onMessage(handler),\n onDispose(handler) {\n disposeHandlers.push(handler);\n return () => {\n const idx = disposeHandlers.indexOf(handler);\n if (idx >= 0) disposeHandlers.splice(idx, 1);\n };\n },\n sendMessage: send,\n commands,\n dispose: () => {\n handle.dispose();\n notifyDisposed();\n },\n };\n resolvedHandle = sessionHandle;\n return sessionHandle;\n });\n\n const ready = Promise.race([handleReady, disposedBeforeReady]);\n\n // Suppress unhandled-rejection for callers that abandon the promise (e.g. early dispose).\n ready.catch(() => {});\n\n return {\n transport,\n channelId,\n url,\n hidden: spec.hidden,\n ready,\n dispose: () => {\n if (resolvedHandle) {\n resolvedHandle.dispose();\n } else {\n // Pre-ready: reject `ready` now so awaiting callers settle immediately.\n // The orchestrator's handshake timer still fires later, harmlessly\n // re-disposing the transport; its rejection is already handled above.\n transport.dispose();\n rejectDisposed?.(new FrameSessionDisposedError());\n }\n },\n };\n}\n","import type { ProtocolMessage } from '@moonpay/platform-protocol/protocol';\nimport {\n type FrameOptions,\n type FrameTransport,\n isTrustedFrameUrl,\n} from '@moonpay/platform-sdk-core';\nimport type { RefObject } from 'react';\nimport type WebView from 'react-native-webview';\n\n/**\n * Transport surface the RN SDK passes around internally. `WebViewTransport`\n * is the production implementation; tests substitute fakes.\n */\nexport interface RNFrameTransport extends FrameTransport {\n readonly url: string;\n readonly options: FrameOptions | null;\n attachWebView(ref: RefObject<WebView | null>): void;\n handleWebViewMessage(data: string): void;\n}\n\n/**\n * FrameTransport implementation for React Native using react-native-webview.\n *\n * Unlike the web IframeTransport, the WebView is rendered declaratively via\n * React components. This transport bridges the imperative FrameTransport\n * interface to a WebView ref.\n */\nexport class WebViewTransport implements RNFrameTransport {\n private webViewRef: RefObject<WebView | null> | null = null;\n private handlers: Array<(msg: ProtocolMessage) => void> = [];\n private _url: string = '';\n private _options: FrameOptions | null = null;\n\n /** Called by the frame component when it mounts the WebView. */\n attachWebView(ref: RefObject<WebView | null>): void {\n this.webViewRef = ref;\n }\n\n /** Called by the WebView's onMessage prop to route incoming messages. */\n handleWebViewMessage(data: string): void {\n try {\n const msg: ProtocolMessage = JSON.parse(data);\n if (!msg.kind) return;\n for (const handler of this.handlers) {\n handler(msg);\n }\n } catch {\n // Ignore non-protocol messages\n }\n }\n\n get url(): string {\n return this._url;\n }\n\n get options(): FrameOptions | null {\n return this._options;\n }\n\n // FrameTransport interface\n\n create(url: string, options: FrameOptions): void {\n if (!isTrustedFrameUrl(url)) {\n throw new Error('Refusing to load frame: URL is not a trusted MoonPay origin');\n }\n\n this._url = url;\n this._options = options;\n // The actual WebView rendering is handled by React components.\n // This method stores the URL and options for the component to read.\n }\n\n sendMessage(message: ProtocolMessage): void {\n if (!this.webViewRef?.current) {\n throw new Error('Cannot send message: WebView not attached');\n }\n // Use the WebView ref's `postMessage` command rather than injecting\n // `window.postMessage`. The native command dispatches a MessageEvent with\n // `source === null` on `document` (Android) / `window` (iOS) — exactly what\n // the frame's receiver requires. An injected `window.postMessage` fires\n // only on `window` with a non-null `source`, so the frame drops it (missed\n // entirely on Android, rejected by the source guard on iOS).\n this.webViewRef.current.postMessage(JSON.stringify(message));\n }\n\n onMessage(handler: (msg: ProtocolMessage) => void): () => void {\n this.handlers.push(handler);\n return () => {\n const idx = this.handlers.indexOf(handler);\n if (idx >= 0) this.handlers.splice(idx, 1);\n };\n }\n\n dispose(): void {\n this.handlers.length = 0;\n this.webViewRef = null;\n this._url = '';\n this._options = null;\n }\n}\n","import { type CoreClient, createClientCore, type ThemeOptions } from '@moonpay/platform-sdk-core';\nimport {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { createRNClient, type RNClient } from './client.js';\nimport { MoonPayFrame } from './frame-component.js';\nimport type { SpecContext } from './frame-engine.js';\nimport { createMountSession, type FrameSlot } from './methods/mount-session.js';\nimport { VisibleFrameSlotSheet } from './VisibleFrameSlotSheet.js';\nimport { WebViewTransport } from './webview-transport.js';\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\ninterface MoonPayContextValue {\n client: RNClient;\n /** @internal Consumed by the frame components. Undefined until a token is set. */\n sessionToken: string | undefined;\n /** @internal */\n core: CoreClient;\n /** @internal */\n frameBaseUrl?: string;\n /** @internal Client-level theme applied to every visible frame. */\n theme?: ThemeOptions;\n /** Set or replace the session token after mount. */\n initialize: (sessionToken: string) => void;\n /** True once a session token (via prop or `initialize()`) is available. */\n isInitialized: boolean;\n}\n\nconst MoonPayContext = createContext<MoonPayContextValue | null>(null);\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\nexport interface MoonPayProviderProps {\n /**\n * Session token from your server (via `createSession`). Optional — omit it and\n * call `initialize(sessionToken)` from `useMoonPay()` once you've fetched it.\n * When provided, this prop takes precedence over an imperatively-set token.\n */\n sessionToken?: string;\n apiBaseUrl?: string;\n frameBaseUrl?: string;\n /** Theme applied to every visible MoonPay frame (connect, widget, Apple/Google Pay, …). */\n theme?: ThemeOptions;\n children: ReactNode;\n}\n\nexport function MoonPayProvider({\n sessionToken: sessionTokenProp,\n apiBaseUrl,\n frameBaseUrl,\n theme,\n children,\n}: MoonPayProviderProps): JSX.Element {\n const [frameSlots, setFrameSlots] = useState<FrameSlot[]>([]);\n\n // Token supplied imperatively via initialize(). The prop takes precedence\n // when set, so controlled-prop and imperative usage both work; the effective\n // token below is the single source of truth for the client and frames.\n const [internalToken, setInternalToken] = useState<string | undefined>(undefined);\n const sessionToken = sessionTokenProp ?? internalToken;\n\n // Stable refs for addSlot/removeSlot so client methods don't re-create\n const addSlot = useCallback((slot: FrameSlot) => {\n setFrameSlots((prev) => [...prev, slot]);\n }, []);\n\n const removeSlot = useCallback((id: string) => {\n setFrameSlots((prev) => prev.filter((s) => s.id !== id));\n }, []);\n\n // Keep a ref to core so it's stable across renders\n const coreRef = useRef<CoreClient | null>(null);\n if (!coreRef.current) {\n coreRef.current = createClientCore({\n apiBaseUrl,\n frameBaseUrl,\n createTransport: () => new WebViewTransport(),\n });\n }\n const core = coreRef.current;\n\n // Set (or replace) the session token after mount. Clearing any credentials\n // from a previous session prevents a token swap (e.g. account switch) from\n // reusing the prior customer's accessToken/clientToken before the next\n // getConnection() repopulates them.\n const initialize = useCallback(\n (token: string) => {\n core.context.setAccessToken('');\n core.context.setClientToken('');\n setInternalToken(token);\n },\n [core],\n );\n\n // Depend on theme.appearance (not the object) so an inline `{ appearance }`\n // prop doesn't re-create the client every render.\n // biome-ignore lint/correctness/useExhaustiveDependencies: theme is captured via theme?.appearance\n const client = useMemo<RNClient>(() => {\n const specCtx: SpecContext = { sessionToken, core, frameBaseUrl, theme };\n return createRNClient({\n mountSession: createMountSession(specCtx, { addSlot, removeSlot }),\n core,\n });\n }, [sessionToken, frameBaseUrl, core, addSlot, removeSlot, theme?.appearance]);\n\n const isInitialized = sessionToken !== undefined;\n\n return (\n <MoonPayContext.Provider\n value={{ client, sessionToken, core, frameBaseUrl, theme, initialize, isInitialized }}\n >\n {children}\n {/* Hidden utility frames (check, buy, reset) — zero layout impact. */}\n {frameSlots\n .filter((slot) => slot.hidden)\n .map((slot) => (\n <MoonPayFrame key={slot.id} transport={slot.transport} hidden />\n ))}\n {/* SDK-presented frames take over the screen as a bottom sheet. One per\n slot — later frames (e.g. a challenge over a widget) stack on top.\n Dismissal (Android back, tapping the dimmed backdrop) stops the\n method's pending events, mirroring a customer abandoning the flow. */}\n {frameSlots\n .filter((slot) => !slot.hidden)\n .map((slot) => (\n <VisibleFrameSlotSheet\n key={slot.id}\n slot={slot}\n onClose={() => {\n slot.dispose();\n removeSlot(slot.id);\n }}\n />\n ))}\n </MoonPayContext.Provider>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Hook\n// ---------------------------------------------------------------------------\n\n/** @internal Used by the inline frame components. Not part of the public API. */\nexport function useMoonPayContext(): MoonPayContextValue {\n const ctx = useContext(MoonPayContext);\n if (!ctx) {\n throw new Error('useMoonPay must be used within a <MoonPayProvider>');\n }\n return ctx;\n}\n\nexport function useMoonPay(): {\n client: RNClient;\n /** Set or replace the session token after mount. */\n initialize: (sessionToken: string) => void;\n /** True once a session token (via prop or `initialize()`) is available. */\n isInitialized: boolean;\n} {\n const { client, initialize, isInitialized } = useMoonPayContext();\n return { client, initialize, isInitialized };\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as AddCardSdk from '@moonpay/platform-protocol/sdks/add-card';\nimport type { PresentationMode } from '@moonpay/platform-sdk-core';\nimport { addCardSpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface SetupAddCardOptions {\n /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */\n presentation?: PresentationMode;\n /** Callback for add-card frame lifecycle events. */\n onEvent?: (event: AddCardSdk.Event) => void;\n}\n\nexport interface AddCardFrame {\n dispose(): void;\n}\n\n// ------- setupAddCard -------\nexport async function setupAddCard(\n deps: MethodDeps,\n opts: SetupAddCardOptions,\n): Promise<Result<AddCardFrame, AddCardSdk.SetupError>> {\n try {\n const { handle, dispose } = await deps.mountSession(addCardSpec, {\n presentation: opts.presentation,\n });\n handle.onEvent((event) => opts.onEvent?.(event));\n return ok({ dispose });\n } catch (e) {\n return err({\n kind: 'genericError',\n message: e instanceof Error ? e.message : 'Add card setup failed',\n });\n }\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as ApplePaySdk from '@moonpay/platform-protocol/sdks/apple-pay';\nimport type { PresentationMode } from '@moonpay/platform-sdk-core';\nimport { applePaySpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface SetupApplePayOptions {\n /** Quote signature from getQuote(). */\n quote: string;\n /** Partner-assigned identifier for this transaction attempt. */\n externalTransactionId?: string;\n /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */\n presentation?: PresentationMode;\n /** Callback for Apple Pay lifecycle events. */\n onEvent?: (event: ApplePaySdk.Event) => void;\n}\n\nexport interface ApplePayFrame {\n /** Update the quote (e.g., after expiry). */\n setQuote(signature: string): void;\n dispose(): void;\n}\n\n// ------- setupApplePay -------\nexport async function setupApplePay(\n deps: MethodDeps,\n opts: SetupApplePayOptions,\n): Promise<Result<ApplePayFrame, ApplePaySdk.SetupError>> {\n try {\n const { handle, dispose } = await deps.mountSession(applePaySpec, {\n quote: opts.quote,\n externalTransactionId: opts.externalTransactionId,\n presentation: opts.presentation,\n });\n handle.onEvent((event) => opts.onEvent?.(event));\n return ok({ setQuote: handle.commands.setQuote, dispose });\n } catch (e) {\n return err({\n kind: 'genericError',\n message: e instanceof Error ? e.message : 'Apple Pay setup failed',\n });\n }\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as AuthSdk from '@moonpay/platform-protocol/sdks/auth';\nimport type { PresentationMode } from '@moonpay/platform-sdk-core';\nimport { FrameSessionDisposedError } from '../frame-engine.js';\nimport { authSpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface SetupAuthOptions {\n /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */\n presentation?: PresentationMode;\n /** Callback for auth frame lifecycle events. */\n onEvent?: (event: AuthSdk.Event) => void;\n}\n\nexport interface AuthFrame {\n dispose(): void;\n}\n\n// ------- setupAuth (visible frame) -------\nexport async function setupAuth(\n deps: MethodDeps,\n opts: SetupAuthOptions,\n): Promise<Result<AuthFrame, AuthSdk.SetupError>> {\n if (!deps.core.context.clientToken) {\n return err({\n kind: 'configurationError',\n message:\n 'No clientToken in context — call getConnection() first and ensure it resolved with status \"connectionRequired\".',\n });\n }\n\n try {\n const { handle, dispose } = await deps.mountSession(authSpec, {\n presentation: opts.presentation,\n });\n\n return await new Promise<Result<AuthFrame, AuthSdk.SetupError>>((resolve) => {\n handle.onEvent((event) => {\n opts.onEvent?.(event);\n if (event.kind === 'error') {\n // Resolve before dispose so the teardown notification below\n // doesn't win the race with the real error result.\n resolve(err({ kind: 'genericError', message: 'Auth frame error' }));\n dispose();\n }\n });\n // The auth spec only surfaces `complete` events for terminal-success\n // statuses; resolution must fire on ANY complete, so use raw messages.\n handle.onMessage((msg) => {\n if (msg.kind === 'complete') {\n resolve(ok({ dispose }));\n }\n });\n // Settle if the session is torn down before completing — e.g. the user\n // dismissed the SDK-presented frame. No-op once already resolved.\n handle.onDispose(() => {\n resolve(err({ kind: 'genericError', message: 'Auth flow dismissed' }));\n });\n });\n } catch (e) {\n // Dismissed while the frame was still loading (pre-handshake teardown).\n if (e instanceof FrameSessionDisposedError) {\n return err({ kind: 'genericError', message: 'Auth flow dismissed' });\n }\n return err({\n kind: 'genericError',\n message: e instanceof Error ? e.message : 'Auth setup failed',\n });\n }\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as BuySdk from '@moonpay/platform-protocol/sdks/buy';\nimport { buySpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface SetupBuyOptions {\n /** Quote signature from getQuote(). */\n quote: string;\n /** Partner-assigned identifier for this transaction attempt. */\n externalTransactionId?: string;\n /** Callback for buy frame lifecycle events. */\n onEvent?: (event: BuySdk.Event) => void;\n}\n\nexport interface BuyFrame {\n /** Update the quote (e.g., after expiry). */\n setQuote(signature: string): void;\n dispose(): void;\n}\n\n// ------- setupBuy (hidden frame) -------\nexport async function setupBuy(\n deps: MethodDeps,\n opts: SetupBuyOptions,\n): Promise<Result<BuyFrame, BuySdk.SetupError>> {\n try {\n const { handle, dispose } = await deps.mountSession(buySpec, {\n quote: opts.quote,\n externalTransactionId: opts.externalTransactionId,\n });\n handle.onEvent((event) => opts.onEvent?.(event));\n return ok({ setQuote: handle.commands.setQuote, dispose });\n } catch (e) {\n return err({\n kind: 'genericError',\n message: e instanceof Error ? e.message : 'Buy setup failed',\n });\n }\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as BuyButtonSdk from '@moonpay/platform-protocol/sdks/buy-button';\nimport type { PresentationMode } from '@moonpay/platform-sdk-core';\nimport { buyButtonSpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface SetupBuyButtonOptions {\n /** Quote signature from getQuote(). */\n quote: string;\n /** Partner-assigned identifier for this transaction attempt. */\n externalTransactionId?: string;\n /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */\n presentation?: PresentationMode;\n /** Callback for buy-button frame lifecycle events. */\n onEvent?: (event: BuyButtonSdk.Event) => void;\n}\n\nexport interface BuyButtonFrame {\n /** Update the quote (e.g., after expiry). */\n setQuote(signature: string): void;\n dispose(): void;\n}\n\n// ------- setupBuyButton -------\nexport async function setupBuyButton(\n deps: MethodDeps,\n opts: SetupBuyButtonOptions,\n): Promise<Result<BuyButtonFrame, BuyButtonSdk.SetupError>> {\n try {\n const { handle, dispose } = await deps.mountSession(buyButtonSpec, {\n quote: opts.quote,\n externalTransactionId: opts.externalTransactionId,\n presentation: opts.presentation,\n });\n handle.onEvent((event) => opts.onEvent?.(event));\n return ok({ setQuote: handle.commands.setQuote, dispose });\n } catch (e) {\n return err({\n kind: 'genericError',\n message: e instanceof Error ? e.message : 'Buy button setup failed',\n });\n }\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as ChallengeSdk from '@moonpay/platform-protocol/sdks/challenge';\nimport { isTrustedFrameUrl, type PresentationMode } from '@moonpay/platform-sdk-core';\nimport { challengeSpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface SetupChallengeOptions {\n /** Full challenge URL received from a frame's `challenge` event. */\n url: string;\n /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */\n presentation?: PresentationMode;\n /** Callback for challenge frame lifecycle events. */\n onEvent?: (event: ChallengeSdk.Event) => void;\n}\n\nexport interface ChallengeFrame {\n dispose(): void;\n}\n\n// ------- setupChallenge -------\nexport async function setupChallenge(\n deps: MethodDeps,\n opts: SetupChallengeOptions,\n): Promise<Result<ChallengeFrame, ChallengeSdk.SetupError>> {\n if (!isTrustedFrameUrl(opts.url)) {\n return err({\n kind: 'configurationError',\n message: 'Challenge URL must be served from a trusted MoonPay origin',\n });\n }\n\n try {\n const { handle, dispose } = await deps.mountSession(challengeSpec, {\n url: opts.url,\n presentation: opts.presentation,\n });\n handle.onEvent((event) => opts.onEvent?.(event));\n return ok({ dispose });\n } catch (e) {\n return err({\n kind: 'genericError',\n message: e instanceof Error ? e.message : 'Challenge setup failed',\n });\n }\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as ConnectSdk from '@moonpay/platform-protocol/sdks/connect';\nimport type { PresentationMode, ThemeOptions } from '@moonpay/platform-sdk-core';\nimport { FrameSessionDisposedError } from '../frame-engine.js';\nimport { connectSpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface ConnectOptions {\n /** Theme for this connect frame. Overrides the provider-level `theme`. */\n theme?: ThemeOptions;\n /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */\n presentation?: PresentationMode;\n /** Callback for connect lifecycle events. */\n onEvent?: (event: ConnectSdk.Event) => void;\n}\n\nexport interface ConnectFrame {\n dispose(): void;\n}\n\n// ------- connect (visible frame) -------\nexport async function connect(\n deps: MethodDeps,\n opts: ConnectOptions,\n): Promise<Result<ConnectFrame, ConnectSdk.ConnectError>> {\n try {\n const { handle, dispose } = await deps.mountSession(connectSpec, {\n theme: opts.theme,\n presentation: opts.presentation,\n });\n\n return await new Promise<Result<ConnectFrame, ConnectSdk.ConnectError>>((resolve) => {\n handle.onEvent((event) => {\n opts.onEvent?.(event);\n if (event.kind === 'error') {\n // Resolve before dispose so the teardown notification below\n // doesn't win the race with the real error result.\n resolve(err({ message: 'Connection error' }));\n dispose();\n } else if (event.kind === 'complete') {\n resolve(ok({ dispose }));\n }\n });\n // Settle if the session is torn down before completing — e.g. the user\n // dismissed the SDK-presented frame. No-op once already resolved.\n handle.onDispose(() => {\n resolve(err({ message: 'Connect flow dismissed' }));\n });\n });\n } catch (e) {\n // Dismissed while the frame was still loading (pre-handshake teardown).\n if (e instanceof FrameSessionDisposedError) {\n return err({ message: 'Connect flow dismissed' });\n }\n return err({\n message: e instanceof Error ? e.message : 'Connect failed',\n });\n }\n}\n","import type { Connection } from '@moonpay/platform-protocol/models/connection';\nimport type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as ConnectSdk from '@moonpay/platform-protocol/sdks/connect';\nimport { connectionCheckSpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface GetConnectionOptions {\n /**\n * Pass `true` for headless / Identity-API integrations so the check\n * frame opts out of KYC-based statuses. Legal (`termsAcceptanceRequired`)\n * is always surfaced regardless. Defaults to `false`.\n */\n skipKyc?: boolean;\n}\n\n// ------- getConnection (hidden frame) -------\nexport async function getConnection(\n deps: MethodDeps,\n options: GetConnectionOptions = {},\n): Promise<Result<Connection, ConnectSdk.GetConnectionError>> {\n try {\n const { handle, dispose } = await deps.mountSession(connectionCheckSpec, options);\n\n return await new Promise<Result<Connection, ConnectSdk.GetConnectionError>>((resolve) => {\n const timeout = setTimeout(() => {\n dispose();\n resolve(err({ message: 'Get connection timed out' }));\n }, 10_000);\n\n handle.onEvent((event) => {\n clearTimeout(timeout);\n dispose();\n if (event.kind === 'error') {\n resolve(err({ message: event.payload.message }));\n } else {\n resolve(ok(event.payload));\n }\n });\n });\n } catch (e) {\n return err({\n message: e instanceof Error ? e.message : 'Failed to check connection',\n });\n }\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { ok } from '@moonpay/platform-protocol/result';\nimport type { ResetConnectionError } from '@moonpay/platform-protocol/sdks/reset';\nimport { connectionResetSpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\n// ------- resetConnection (hidden frame) -------\nexport async function resetConnection(\n deps: MethodDeps,\n): Promise<Result<void, ResetConnectionError>> {\n try {\n const { handle, dispose } = await deps.mountSession(connectionResetSpec, {});\n\n return await new Promise<Result<void, ResetConnectionError>>((resolve) => {\n const timeout = setTimeout(() => {\n dispose();\n resolve(ok(undefined));\n }, 5_000);\n\n handle.onEvent(() => {\n clearTimeout(timeout);\n dispose();\n resolve(ok(undefined));\n });\n });\n } catch {\n return ok(undefined);\n }\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as CustomerExportSdk from '@moonpay/platform-protocol/sdks/customer-export';\nimport type { PresentationMode } from '@moonpay/platform-sdk-core';\nimport { customerExportSpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface SetupCustomerExportOptions {\n /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */\n presentation?: PresentationMode;\n /** Callback for customer-export frame lifecycle events. */\n onEvent?: (event: CustomerExportSdk.Event) => void;\n}\n\nexport interface CustomerExportFrame {\n dispose(): void;\n}\n\n// ------- setupCustomerExport -------\nexport async function setupCustomerExport(\n deps: MethodDeps,\n opts: SetupCustomerExportOptions,\n): Promise<Result<CustomerExportFrame, CustomerExportSdk.SetupError>> {\n try {\n const { handle, dispose } = await deps.mountSession(customerExportSpec, {\n presentation: opts.presentation,\n });\n handle.onEvent((event) => opts.onEvent?.(event));\n return ok({ dispose });\n } catch (e) {\n return err({\n kind: 'genericError',\n message: e instanceof Error ? e.message : 'Customer export setup failed',\n });\n }\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as GooglePaySdk from '@moonpay/platform-protocol/sdks/google-pay';\nimport type { PresentationMode } from '@moonpay/platform-sdk-core';\nimport { googlePaySpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface SetupGooglePayOptions {\n /** Quote signature from getQuote(). */\n quote: string;\n /** Partner-assigned identifier for this transaction attempt. */\n externalTransactionId?: string;\n /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */\n presentation?: PresentationMode;\n /** Callback for Google Pay lifecycle events. */\n onEvent?: (event: GooglePaySdk.Event) => void;\n}\n\nexport interface GooglePayFrame {\n /** Update the quote (e.g., after expiry). */\n setQuote(signature: string): void;\n dispose(): void;\n}\n\n// ------- setupGooglePay -------\nexport async function setupGooglePay(\n deps: MethodDeps,\n opts: SetupGooglePayOptions,\n): Promise<Result<GooglePayFrame, GooglePaySdk.SetupError>> {\n try {\n const { handle, dispose } = await deps.mountSession(googlePaySpec, {\n quote: opts.quote,\n externalTransactionId: opts.externalTransactionId,\n presentation: opts.presentation,\n });\n handle.onEvent((event) => opts.onEvent?.(event));\n return ok({ setQuote: handle.commands.setQuote, dispose });\n } catch (e) {\n return err({\n kind: 'genericError',\n message: e instanceof Error ? e.message : 'Google Pay setup failed',\n });\n }\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as WidgetSdk from '@moonpay/platform-protocol/sdks/widget';\nimport type { PresentationMode } from '@moonpay/platform-sdk-core';\nimport { widgetSpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface SetupWidgetOptions {\n /** Quote signature from getQuote(). */\n quote: string;\n /** Partner-assigned identifier for this transaction attempt. */\n externalTransactionId?: string;\n /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */\n presentation?: PresentationMode;\n /** Callback for widget lifecycle events. */\n onEvent?: (event: WidgetSdk.Event) => void;\n}\n\nexport interface WidgetFrame {\n dispose(): void;\n}\n\n// ------- setupWidget -------\nexport async function setupWidget(\n deps: MethodDeps,\n opts: SetupWidgetOptions,\n): Promise<Result<WidgetFrame, WidgetSdk.SetupError>> {\n try {\n const { handle, dispose } = await deps.mountSession(widgetSpec, {\n quote: opts.quote,\n externalTransactionId: opts.externalTransactionId,\n presentation: opts.presentation,\n });\n handle.onEvent((event) => opts.onEvent?.(event));\n return ok({ dispose });\n } catch (e) {\n return err({\n kind: 'genericError',\n message: e instanceof Error ? e.message : 'Widget setup failed',\n });\n }\n}\n","import type {\n GetQuoteParams,\n ListAssetsResponse,\n ListPaymentMethodsResponse,\n PaginationInfo,\n Quote,\n SimulateBankTransferParams,\n Transaction,\n TransactionWithStages,\n} from '@moonpay/platform-protocol/api';\nimport type { Customer } from '@moonpay/platform-protocol/api/customer';\nimport type {\n CreateIdentityError,\n DevPlatformApiError,\n GetAssetsError,\n GetCustomerError,\n GetCustomerUploadUrlError,\n GetIdentityError,\n GetIdentityUploadUrlError,\n GetPaymentMethodsError,\n GetQuoteError,\n GetTransactionsError,\n SimulateBankTransferError,\n SubmitCustomerFilesError,\n SubmitCustomerKycError,\n SubmitIdentityFilesError,\n UpdateIdentityError,\n VerifyIdentityError,\n} from '@moonpay/platform-protocol/api/errors';\nimport type {\n CreateIdentityRequestBody,\n Identity,\n IdentityFileUploadUrl,\n IdentityFileUploadUrlRequestBody,\n IdentityVerificationResponse,\n SubmitIdentityFilesRequestBody,\n UpdateIdentityRequestBody,\n} from '@moonpay/platform-protocol/api/identity';\nimport type { Connection } from '@moonpay/platform-protocol/models/connection';\nimport type { Result } from '@moonpay/platform-protocol/result';\nimport type * as AddCardSdk from '@moonpay/platform-protocol/sdks/add-card';\nimport type * as ApplePaySdk from '@moonpay/platform-protocol/sdks/apple-pay';\nimport type * as AuthSdk from '@moonpay/platform-protocol/sdks/auth';\nimport type * as BuySdk from '@moonpay/platform-protocol/sdks/buy';\nimport type * as BuyButtonSdk from '@moonpay/platform-protocol/sdks/buy-button';\nimport type * as ChallengeSdk from '@moonpay/platform-protocol/sdks/challenge';\nimport type * as ConnectSdk from '@moonpay/platform-protocol/sdks/connect';\nimport type * as CustomerExportSdk from '@moonpay/platform-protocol/sdks/customer-export';\nimport type * as GooglePaySdk from '@moonpay/platform-protocol/sdks/google-pay';\nimport type { ResetConnectionError } from '@moonpay/platform-protocol/sdks/reset';\nimport type * as WidgetSdk from '@moonpay/platform-protocol/sdks/widget';\nimport type { ListAssetsParams, ListTransactionsParams } from '@moonpay/platform-sdk-core';\nimport type { AddCardFrame, SetupAddCardOptions } from './methods/add-card.js';\nimport { setupAddCard } from './methods/add-card.js';\nimport type { ApplePayFrame, SetupApplePayOptions } from './methods/apple-pay.js';\nimport { setupApplePay } from './methods/apple-pay.js';\nimport type { AuthFrame, SetupAuthOptions } from './methods/auth.js';\nimport { setupAuth } from './methods/auth.js';\nimport type { BuyFrame, SetupBuyOptions } from './methods/buy.js';\nimport { setupBuy } from './methods/buy.js';\nimport type { BuyButtonFrame, SetupBuyButtonOptions } from './methods/buy-button.js';\nimport { setupBuyButton } from './methods/buy-button.js';\nimport type { ChallengeFrame, SetupChallengeOptions } from './methods/challenge.js';\nimport { setupChallenge } from './methods/challenge.js';\nimport type { ConnectFrame, ConnectOptions } from './methods/connect.js';\nimport { connect } from './methods/connect.js';\nimport type { GetConnectionOptions } from './methods/connection-check.js';\nimport { getConnection } from './methods/connection-check.js';\nimport { resetConnection } from './methods/connection-reset.js';\nimport type { CustomerExportFrame, SetupCustomerExportOptions } from './methods/customer-export.js';\nimport { setupCustomerExport } from './methods/customer-export.js';\nimport type { GooglePayFrame, SetupGooglePayOptions } from './methods/google-pay.js';\nimport { setupGooglePay } from './methods/google-pay.js';\nimport type { MethodDeps } from './methods/mount-session.js';\nimport type { SetupWidgetOptions, WidgetFrame } from './methods/widget.js';\nimport { setupWidget } from './methods/widget.js';\n\nexport type {\n AddCardFrame,\n ApplePayFrame,\n AuthFrame,\n BuyButtonFrame,\n BuyFrame,\n ChallengeFrame,\n ConnectFrame,\n ConnectOptions,\n CustomerExportFrame,\n GetConnectionOptions,\n GooglePayFrame,\n SetupAddCardOptions,\n SetupApplePayOptions,\n SetupAuthOptions,\n SetupBuyButtonOptions,\n SetupBuyOptions,\n SetupChallengeOptions,\n SetupCustomerExportOptions,\n SetupGooglePayOptions,\n SetupWidgetOptions,\n WidgetFrame,\n};\n\nexport interface RNClient {\n /**\n * Probe the customer's connection state via the headless check-connection\n * frame. Returns the `Connection` discriminated union and populates the\n * internal context with bootstrap `accessToken` / `clientToken` for any\n * status that carries credentials (`active`, `connectionRequired`).\n *\n * A `connectionRequired` result may carry `mismatch: true` when the\n * session's email and phone number resolve to different MoonPay\n * customers — partners can branch on it to route the customer through\n * Connect proactively, before rendering payment UI.\n */\n getConnection(\n options?: GetConnectionOptions,\n ): Promise<Result<Connection, ConnectSdk.GetConnectionError>>;\n connect(options: ConnectOptions): Promise<Result<ConnectFrame, ConnectSdk.ConnectError>>;\n /**\n * Launch the auth frame — the lighter-weight counterpart to `connect()`\n * for headless / Identity-API partners. Requires a `clientToken` to be\n * present in the client's context, which is populated automatically by a\n * prior `getConnection()` call that returned `connectionRequired`.\n * Call `getConnection()` first; if its status is `connectionRequired`,\n * call `setupAuth()` to drive the customer through email/OTP.\n */\n setupAuth(options: SetupAuthOptions): Promise<Result<AuthFrame, AuthSdk.SetupError>>;\n getPaymentMethods(): Promise<\n Result<{ data: ListPaymentMethodsResponse }, GetPaymentMethodsError>\n >;\n getQuote(params: GetQuoteParams): Promise<Result<{ data: Quote }, GetQuoteError>>;\n /**\n * Lists crypto assets (CeFi and DeFi) available for purchase. DeFi tokens are\n * returned with `status.verified: false`; quote them by `caip19` rather than `code`.\n */\n getAssets(params?: ListAssetsParams): Promise<Result<ListAssetsResponse, GetAssetsError>>;\n listTransactions(\n params?: ListTransactionsParams,\n ): Promise<Result<{ data: Transaction[]; pageInfo: PaginationInfo }, GetTransactionsError>>;\n getTransaction(\n id: string,\n ): Promise<Result<{ data: TransactionWithStages }, GetTransactionsError>>;\n /** Simulate bank-transfer settlement for a test-mode transaction (sandbox only). */\n simulateBankTransfer(\n id: string,\n params: SimulateBankTransferParams,\n ): Promise<Result<{ data: TransactionWithStages }, SimulateBankTransferError>>;\n setupWidget(options: SetupWidgetOptions): Promise<Result<WidgetFrame, WidgetSdk.SetupError>>;\n /** @deprecated Render <MoonPayApplePayButton> instead — it mounts inline where you place it. */\n setupApplePay(\n options: SetupApplePayOptions,\n ): Promise<Result<ApplePayFrame, ApplePaySdk.SetupError>>;\n setupBuy(options: SetupBuyOptions): Promise<Result<BuyFrame, BuySdk.SetupError>>;\n /** @deprecated Render <MoonPayBuyButton> instead — it mounts inline where you place it. */\n setupBuyButton(\n options: SetupBuyButtonOptions,\n ): Promise<Result<BuyButtonFrame, BuyButtonSdk.SetupError>>;\n /** @deprecated Render <MoonPayGooglePayButton> instead — it mounts inline where you place it. */\n setupGooglePay(\n options: SetupGooglePayOptions,\n ): Promise<Result<GooglePayFrame, GooglePaySdk.SetupError>>;\n deletePaymentMethod(id: string): Promise<Result<void, DevPlatformApiError>>;\n /**\n * Clears the customer's MoonPay connection for this partner by running the\n * reset frame. Resolves when the reset completes or times out (5s).\n * Call this after clearing your own local auth state (the client reference\n * can be captured before disposal since the session token is baked in).\n */\n resetConnection(): Promise<Result<void, ResetConnectionError>>;\n setupChallenge(\n options: SetupChallengeOptions,\n ): Promise<Result<ChallengeFrame, ChallengeSdk.SetupError>>;\n setupAddCard(options: SetupAddCardOptions): Promise<Result<AddCardFrame, AddCardSdk.SetupError>>;\n setupCustomerExport(\n options: SetupCustomerExportOptions,\n ): Promise<Result<CustomerExportFrame, CustomerExportSdk.SetupError>>;\n\n // Customer API\n getCustomer(id: string): Promise<Result<{ data: Customer }, GetCustomerError>>;\n submitCustomerKyc(\n id: string,\n body: UpdateIdentityRequestBody,\n ): Promise<Result<{ data: Customer }, SubmitCustomerKycError>>;\n getCustomerUploadUrl(\n id: string,\n body: IdentityFileUploadUrlRequestBody,\n ): Promise<Result<{ data: IdentityFileUploadUrl }, GetCustomerUploadUrlError>>;\n submitCustomerFiles(\n id: string,\n body: SubmitIdentityFilesRequestBody,\n ): Promise<Result<{ data: Customer }, SubmitCustomerFilesError>>;\n\n // Identity API — deprecated (DEVXP-1454), use the Customer API above instead\n /** @deprecated Customers are created automatically now — call `getCustomer` directly instead. */\n createIdentity(\n body: CreateIdentityRequestBody,\n ): Promise<Result<{ data: Identity | null }, CreateIdentityError>>;\n /** @deprecated Use `getCustomer` instead. */\n getIdentity(id: string): Promise<Result<{ data: Identity }, GetIdentityError>>;\n /** @deprecated Use `submitCustomerKyc` instead. */\n updateIdentity(\n id: string,\n body: UpdateIdentityRequestBody,\n ): Promise<Result<{ data: Identity }, UpdateIdentityError>>;\n /** @deprecated No longer needed — Customer API verification has no direct replacement call. */\n verifyIdentity(\n id: string,\n ): Promise<Result<{ data: IdentityVerificationResponse }, VerifyIdentityError>>;\n /** @deprecated Use `getCustomerUploadUrl` instead. */\n getIdentityUploadUrl(\n id: string,\n body: IdentityFileUploadUrlRequestBody,\n ): Promise<Result<{ data: IdentityFileUploadUrl }, GetIdentityUploadUrlError>>;\n /** @deprecated Use `submitCustomerFiles` instead. */\n submitIdentityFiles(\n id: string,\n body: SubmitIdentityFilesRequestBody,\n ): Promise<Result<{ data: Identity }, SubmitIdentityFilesError>>;\n}\n\nexport function createRNClient(deps: MethodDeps): RNClient {\n const { core } = deps;\n return {\n getConnection: (options) => getConnection(deps, options ?? {}),\n connect: (opts) => connect(deps, opts),\n setupAuth: (opts) => setupAuth(deps, opts),\n getPaymentMethods: () => core.getPaymentMethods(),\n getQuote: (params) => core.getQuote(params),\n getAssets: (params) => core.getAssets(params),\n listTransactions: (params) => core.listTransactions(params),\n getTransaction: (id) => core.getTransaction(id),\n simulateBankTransfer: (id, params) => core.simulateBankTransfer(id, params),\n setupWidget: (opts) => setupWidget(deps, opts),\n setupApplePay: (opts) => setupApplePay(deps, opts),\n setupBuy: (opts) => setupBuy(deps, opts),\n setupBuyButton: (opts) => setupBuyButton(deps, opts),\n setupGooglePay: (opts) => setupGooglePay(deps, opts),\n deletePaymentMethod: (id) => core.deletePaymentMethod(id),\n resetConnection: () => resetConnection(deps),\n setupChallenge: (opts) => setupChallenge(deps, opts),\n setupAddCard: (opts) => setupAddCard(deps, opts),\n setupCustomerExport: (opts) => setupCustomerExport(deps, opts),\n\n getCustomer: (id) => core.getCustomer(id),\n submitCustomerKyc: (id, body) => core.submitCustomerKyc(id, body),\n getCustomerUploadUrl: (id, body) => core.getCustomerUploadUrl(id, body),\n submitCustomerFiles: (id, body) => core.submitCustomerFiles(id, body),\n\n createIdentity: (body) => core.createIdentity(body),\n getIdentity: (id) => core.getIdentity(id),\n updateIdentity: (id, body) => core.updateIdentity(id, body),\n verifyIdentity: (id) => core.verifyIdentity(id),\n getIdentityUploadUrl: (id, body) => core.getIdentityUploadUrl(id, body),\n submitIdentityFiles: (id, body) => core.submitIdentityFiles(id, body),\n };\n}\n","import type { CoreClient } from '@moonpay/platform-sdk-core';\nimport {\n createFrameSession,\n type FrameSessionHandle,\n type FrameSpec,\n type SpecContext,\n} from '../frame-engine.js';\nimport type { RNFrameTransport } from '../webview-transport.js';\n\n// ---------------------------------------------------------------------------\n// Frame slot — represents a frame the provider needs to render\n// ---------------------------------------------------------------------------\n\nexport interface FrameSlot {\n id: string;\n transport: RNFrameTransport;\n hidden: boolean;\n /** Tear down the slot's frame session — safe to call before the handshake completes. */\n dispose(): void;\n}\n\nexport interface SlotHost {\n addSlot(slot: FrameSlot): void;\n removeSlot(id: string): void;\n}\n\nexport type MountSession = <E, P, C>(\n spec: FrameSpec<E, P, C>,\n props: P,\n) => Promise<{ handle: FrameSessionHandle<E, C>; dispose: () => void }>;\n\nexport interface MethodDeps {\n mountSession: MountSession;\n core: CoreClient;\n}\n\nlet slotCounter = 0;\n\nexport function createMountSession(specCtx: SpecContext, host: SlotHost): MountSession {\n return async function mountSession<E, P, C>(\n spec: FrameSpec<E, P, C>,\n props: P,\n ): Promise<{ handle: FrameSessionHandle<E, C>; dispose: () => void }> {\n const session = createFrameSession(spec, specCtx, props);\n const slotId = `slot-${++slotCounter}`;\n host.addSlot({\n id: slotId,\n transport: session.transport,\n hidden: session.hidden,\n dispose: () => session.dispose(),\n });\n try {\n const handle = await session.ready;\n return {\n handle,\n dispose: () => {\n handle.dispose();\n host.removeSlot(slotId);\n },\n };\n } catch (e) {\n host.removeSlot(slotId);\n throw e;\n }\n };\n}\n","import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n ActivityIndicator,\n Animated,\n Easing,\n Modal,\n PanResponder,\n Platform,\n Pressable,\n StyleSheet,\n useWindowDimensions,\n View,\n} from 'react-native';\nimport { MoonPayFrame } from './frame-component.js';\nimport type { FrameSlot } from './methods/mount-session.js';\nimport { resolvePresentation, type SheetPhase } from './sheet-presentation.js';\n\n/**\n * How long to wait for the frame's `ready` before presenting the sheet anyway\n * (with a spinner). Wide enough that a frame which finishes without UI — e.g. a\n * frictionless challenge — completes inside the window and is dismissed before\n * the sheet is ever shown, avoiding a slide-up-then-down flash.\n */\nconst PRESENT_GRACE_MS = 3000;\n\n/**\n * Drives a sheet's translateY to `toValue`, mirroring the default animation of\n * @gorhom/react-native-bottom-sheet so the feel matches without taking the\n * dependency: an overdamped spring on iOS, and a 250ms Easing.out(Easing.exp)\n * timing on Android. (Those are gorhom's exact default configs.)\n */\nfunction animateSheet(value: Animated.Value, toValue: number, onDone?: Animated.EndCallback): void {\n const animation =\n Platform.OS === 'android'\n ? Animated.timing(value, {\n toValue,\n duration: 250,\n easing: Easing.out(Easing.exp),\n useNativeDriver: true,\n })\n : Animated.spring(value, {\n toValue,\n damping: 500,\n stiffness: 1000,\n mass: 3,\n overshootClamping: true,\n restDisplacementThreshold: 10,\n restSpeedThreshold: 10,\n useNativeDriver: true,\n });\n animation.start(onDone);\n}\n\n/**\n * Renders one SDK-presented frame as a dimmed bottom sheet that slides up\n * (and back down on dismiss) with a gorhom-matched animation, plus a backdrop\n * that fades in lockstep with the sheet position. Built on the Animated API\n * and a transparent <Modal> — no extra dependencies.\n *\n * NOTE: a React Native <Modal> is presented from the app-root view controller\n * and cannot appear above a react-native-screens native-stack modal. Launch\n * imperative frames from a non-modal screen (or use the declarative\n * <MoonPayConnect>/<MoonPayWidget> components, which render inline).\n */\nexport function VisibleFrameSlotSheet({\n slot,\n onClose,\n}: {\n slot: FrameSlot;\n onClose: () => void;\n}): JSX.Element {\n const { height } = useWindowDimensions();\n const sheetHeight = Math.round(height * 0.9);\n // Sheet offset from its resting position: starts fully off-screen (hidden).\n const translateY = useRef(new Animated.Value(sheetHeight)).current;\n // The frame's WebView stays mounted (it must load to emit `ready`), but is\n // covered by a spinner until the frame reports its UI is ready to show.\n const [frameReady, setFrameReady] = useState(false);\n // Drives the backdrop's pointerEvents: while hidden the (transparent) modal\n // must not intercept taps meant for the app underneath.\n const [presented, setPresented] = useState(false);\n // Single source of truth for the present/dismiss decision (see sheet-presentation).\n const phaseRef = useRef<SheetPhase>('hidden');\n // Latest onClose, read through a ref so `close` stays referentially stable.\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n const closingRef = useRef(false);\n\n // Slide down, then tear the slot down once the exit animation settles.\n // Guarded so a `complete` auto-dismiss and a manual dismiss can't double-fire.\n const close = useCallback(() => {\n if (closingRef.current) return;\n closingRef.current = true;\n // Mark closed so a racing `terminal` signal can't re-trigger teardown.\n phaseRef.current = 'closed';\n animateSheet(translateY, sheetHeight, ({ finished }) => {\n if (finished) onCloseRef.current();\n });\n }, [translateY, sheetHeight]);\n\n // Drag-to-dismiss, attached only to the handle (see `panHandlers` below) so\n // the frame's own content stays scrollable/tappable. Drives the SAME\n // `translateY` as the open/close animation, so there's one source of truth.\n const panResponder = useMemo(\n () =>\n PanResponder.create({\n // Claim the gesture only for a clearly downward drag — never on a tap\n // (so the handle's onPress still fires) or a mostly-horizontal swipe.\n onMoveShouldSetPanResponder: (_evt, { dy, dx }) => dy > 5 && dy > Math.abs(dx),\n onPanResponderGrant: () => {\n // The sheet may be mid open/close animation. `stopAnimation` halts it\n // AND flushes the native-driven value back to JS; folding that into\n // the offset means the drag is relative to where the sheet actually\n // sits right now, so re-grabbing never makes it jump.\n translateY.stopAnimation(() => {\n translateY.extractOffset();\n });\n },\n // Track the finger downward; clamp upward travel to the open position.\n onPanResponderMove: (_evt, { dy }) => {\n translateY.setValue(Math.max(0, dy));\n },\n onPanResponderRelease: (_evt, { dy, vy }) => {\n // Re-flatten so `translateY` is a single absolute value again before\n // we hand it back to the spring/timing animation.\n translateY.flattenOffset();\n const draggedPastThreshold = dy > sheetHeight * 0.35;\n const flungDownFast = vy > 0.5;\n if (draggedPastThreshold || flungDownFast) {\n close();\n } else {\n animateSheet(translateY, 0);\n }\n },\n // Another responder stole the gesture: settle to a known state.\n onPanResponderTerminate: () => {\n translateY.flattenOffset();\n animateSheet(translateY, 0);\n },\n }),\n [translateY, sheetHeight, close],\n );\n\n // Apply a presentation signal: slide up, lift the spinner, dismiss silently,\n // or animate closed — per the pure decision in resolvePresentation.\n const dispatch = useCallback(\n (signal: 'ready' | 'grace' | 'terminal') => {\n const result = resolvePresentation(phaseRef.current, signal);\n phaseRef.current = result.phase;\n if (result.present) {\n setPresented(true);\n animateSheet(translateY, 0);\n }\n if (result.liftSpinner) setFrameReady(true);\n if (result.dismissSilent) onCloseRef.current();\n if (result.close) close();\n },\n [translateY, close],\n );\n\n // Present anyway once the grace window elapses, so a slow-loading frame (or\n // one that never sends `ready`) is never stranded off-screen.\n useEffect(() => {\n const timer = setTimeout(() => dispatch('grace'), PRESENT_GRACE_MS);\n return () => clearTimeout(timer);\n }, [dispatch]);\n\n // `ready` reveals the frame; a terminal message (`complete`/`error`) either\n // dismisses silently (if we never presented) or animates the sheet closed —\n // both without the partner having to call dispose.\n useEffect(() => {\n const unsubscribe = slot.transport.onMessage((msg) => {\n if (msg.kind === 'ready') dispatch('ready');\n else if (msg.kind === 'complete' || msg.kind === 'error') dispatch('terminal');\n });\n return unsubscribe;\n }, [slot.transport, dispatch]);\n\n // Backdrop dims in step with the sheet position.\n const backdropOpacity = translateY.interpolate({\n inputRange: [0, sheetHeight],\n outputRange: [1, 0],\n extrapolate: 'clamp',\n });\n\n return (\n <Modal visible transparent animationType=\"none\" onRequestClose={close}>\n {/* Until presented the sheet is off-screen and the backdrop transparent;\n pass taps through so the ~grace window doesn't freeze the app. */}\n <View style={styles.root} pointerEvents={presented ? 'auto' : 'none'}>\n <Animated.View style={[styles.backdrop, { opacity: backdropOpacity }]}>\n {/* Tap outside the sheet to dismiss. */}\n <Pressable\n style={StyleSheet.absoluteFill}\n accessibilityRole=\"button\"\n accessibilityLabel=\"Close\"\n onPress={close}\n />\n </Animated.View>\n <Animated.View style={[styles.sheet, { height: sheetHeight, transform: [{ translateY }] }]}>\n <MoonPayFrame transport={slot.transport} />\n {!frameReady && (\n <View style={styles.loading}>\n <ActivityIndicator size=\"large\" color=\"#000\" />\n </View>\n )}\n {/* Drag bar: pull down to dismiss. PanResponder lives on this strip\n only, so the frame below stays scrollable/tappable. A nested\n Pressable keeps a tap-to-close (and screen-reader) affordance. */}\n <View style={styles.handleArea} {...panResponder.panHandlers}>\n <Pressable\n onPress={close}\n accessibilityRole=\"button\"\n accessibilityLabel=\"Close\"\n hitSlop={12}\n >\n <View style={styles.handleBar} />\n </Pressable>\n </View>\n </Animated.View>\n </View>\n </Modal>\n );\n}\n\nconst styles = StyleSheet.create({\n root: {\n flex: 1,\n justifyContent: 'flex-end',\n },\n // Dimmed backdrop covering the whole screen; fades with the sheet position.\n backdrop: {\n ...StyleSheet.absoluteFillObject,\n backgroundColor: 'rgba(0, 0, 0, 0.5)',\n },\n // Bottom sheet: ~90% of the screen (height applied inline), rounded top\n // corners. The 10% gap keeps the frame clear of the status bar / notch\n // without depending on react-native-safe-area-context.\n sheet: {\n backgroundColor: '#fff',\n borderTopLeftRadius: 24,\n borderTopRightRadius: 24,\n overflow: 'hidden',\n },\n // Opaque cover with a centered spinner, shown until the frame is ready.\n loading: {\n ...StyleSheet.absoluteFillObject,\n backgroundColor: '#fff',\n alignItems: 'center',\n justifyContent: 'center',\n },\n // Drag-to-dismiss strip pinned across the top of the sheet, floating over the\n // frame. Tall enough to be an easy grab target without eating much of the UI.\n handleArea: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n height: 28,\n alignItems: 'center',\n justifyContent: 'center',\n zIndex: 1,\n elevation: 2,\n },\n // The visible pill.\n handleBar: {\n width: 36,\n height: 5,\n borderRadius: 3,\n backgroundColor: 'rgba(0, 0, 0, 0.2)',\n },\n});\n","/**\n * Pure decision logic for when an SDK-presented frame's bottom sheet should\n * slide up, lift its loading spinner, or tear down — kept out of the component\n * so it can be unit-tested without a render harness.\n *\n * The sheet races three signals to decide whether to present at all:\n * - `ready` — the frame reported its UI is painted; reveal it.\n * - `grace` — a fallback timer fired; present with the spinner so a frame\n * that loads slowly (or never sends `ready`) is never stuck\n * invisible.\n * - `terminal` — the frame emitted `complete`/`error`. If this arrives BEFORE\n * the sheet was ever presented, the flow finished without\n * needing UI (e.g. a frictionless challenge), so we dismiss\n * silently instead of flashing the sheet up and back down.\n */\nexport type SheetPhase = 'hidden' | 'presented' | 'closed';\nexport type PresentationSignal = 'ready' | 'grace' | 'terminal';\n\nexport interface PresentationResult {\n /** Phase after applying the signal. */\n phase: SheetPhase;\n /** Slide the sheet up. Only set on the hidden → presented edge. */\n present: boolean;\n /** Hide the loading spinner cover (the frame's own UI is ready). */\n liftSpinner: boolean;\n /** Tear down without animation — the frame finished before it was ever shown. */\n dismissSilent: boolean;\n /** Animate the sheet down, then tear down. */\n close: boolean;\n}\n\nconst NOOP = {\n present: false,\n liftSpinner: false,\n dismissSilent: false,\n close: false,\n} as const;\n\nexport function resolvePresentation(\n phase: SheetPhase,\n signal: PresentationSignal,\n): PresentationResult {\n if (phase === 'closed') return { phase: 'closed', ...NOOP };\n\n switch (signal) {\n case 'ready':\n // Reveal the frame; also present it if the grace timer hadn't yet.\n return { ...NOOP, phase: 'presented', present: phase === 'hidden', liftSpinner: true };\n case 'grace':\n if (phase === 'presented') return { phase: 'presented', ...NOOP };\n return { ...NOOP, phase: 'presented', present: true };\n case 'terminal':\n if (phase === 'hidden') return { ...NOOP, phase: 'closed', dismissSilent: true };\n return { ...NOOP, phase: 'closed', close: true };\n }\n}\n","import type * as AddCardSdk from '@moonpay/platform-protocol/sdks/add-card';\nimport type { ViewStyle } from 'react-native';\nimport { addCardSpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayAddCardProps {\n /** Callback for add-card lifecycle events. */\n onEvent?: (event: AddCardSdk.Event) => void;\n /** Container style. Defaults to flex: 1. */\n style?: ViewStyle;\n}\n\n/** Inline add-card frame — embed card entry in your own layout/animation. */\nexport function MoonPayAddCard({ onEvent, style }: MoonPayAddCardProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={addCardSpec}\n props={{}}\n style={style}\n defaultStyle={{ flex: 1 }}\n onEvent={onEvent}\n />\n );\n}\n","import type * as ApplePaySdk from '@moonpay/platform-protocol/sdks/apple-pay';\nimport type { ViewStyle } from 'react-native';\nimport { applePaySpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayApplePayButtonProps {\n /** Quote signature from getQuote(). Reactive — updates are pushed via setQuote without remounting. */\n quote: string;\n /** Partner-assigned identifier for this transaction attempt. Mount-time only. */\n externalTransactionId?: string;\n /** Callback for Apple Pay lifecycle events. */\n onEvent?: (event: ApplePaySdk.Event) => void;\n /** Container style. Defaults to height 48. */\n style?: ViewStyle;\n}\n\n/** Inline Apple Pay button. Render it wherever it should appear in your layout. */\nexport function MoonPayApplePayButton({\n quote,\n externalTransactionId,\n onEvent,\n style,\n}: MoonPayApplePayButtonProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={applePaySpec}\n props={{ quote, externalTransactionId }}\n style={style}\n defaultStyle={{ height: 48 }}\n onEvent={onEvent}\n />\n );\n}\n","import type * as AuthSdk from '@moonpay/platform-protocol/sdks/auth';\nimport type { ViewStyle } from 'react-native';\nimport { authSpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayAuthProps {\n /** Callback for auth lifecycle events. */\n onEvent?: (event: AuthSdk.Event) => void;\n /** Container style. Defaults to flex: 1. */\n style?: ViewStyle;\n}\n\n/**\n * Inline auth frame for headless / Identity-API integrations. Requires a clientToken in context —\n * call getConnection() (or render <MoonPayConnectionCheck>) first; if it resolves with\n * `connectionRequired`, mount this component. Emits an error event otherwise.\n */\nexport function MoonPayAuth({ onEvent, style }: MoonPayAuthProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={authSpec}\n props={{}}\n style={style}\n defaultStyle={{ flex: 1 }}\n onEvent={onEvent}\n />\n );\n}\n","import type * as BuyButtonSdk from '@moonpay/platform-protocol/sdks/buy-button';\nimport type { ViewStyle } from 'react-native';\nimport { buyButtonSpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayBuyButtonProps {\n /** Quote signature from getQuote(). Reactive — updates are pushed via setQuote without remounting. */\n quote: string;\n /** Partner-assigned identifier for this transaction attempt. Mount-time only. */\n externalTransactionId?: string;\n /** Callback for buy button lifecycle events. */\n onEvent?: (event: BuyButtonSdk.Event) => void;\n /** Container style. Defaults to height 48. */\n style?: ViewStyle;\n}\n\n/** Inline card/buy button. Render it wherever it should appear in your layout. */\nexport function MoonPayBuyButton({\n quote,\n externalTransactionId,\n onEvent,\n style,\n}: MoonPayBuyButtonProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={buyButtonSpec}\n props={{ quote, externalTransactionId }}\n style={style}\n defaultStyle={{ height: 48 }}\n onEvent={onEvent}\n />\n );\n}\n","import type * as BuySdk from '@moonpay/platform-protocol/sdks/buy';\nimport { buySpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayBuyFrameProps {\n /** Quote signature from getQuote(). Reactive — updates are pushed via setQuote without remounting. */\n quote: string;\n /** Partner-assigned identifier for this transaction attempt. Mount-time only. */\n externalTransactionId?: string;\n /** Callback for buy frame lifecycle events. */\n onEvent?: (event: BuySdk.Event) => void;\n}\n\n/** Headless buy frame (renders nothing visible). The declarative alternative to client.setupBuy(). */\nexport function MoonPayBuyFrame({\n quote,\n externalTransactionId,\n onEvent,\n}: MoonPayBuyFrameProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={buySpec}\n props={{ quote, externalTransactionId }}\n defaultStyle={{}}\n onEvent={onEvent}\n />\n );\n}\n","import type * as ChallengeSdk from '@moonpay/platform-protocol/sdks/challenge';\nimport type { ViewStyle } from 'react-native';\nimport { challengeSpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayChallengeProps {\n /** Full challenge URL received from a frame's `challenge` event. Mount-time only. */\n url: string;\n /** Callback for challenge lifecycle events. */\n onEvent?: (event: ChallengeSdk.Event) => void;\n /** Container style. Defaults to flex: 1. */\n style?: ViewStyle;\n}\n\n/** Inline 3DS/challenge frame. Mount it when a payment frame emits a `challenge` event. */\nexport function MoonPayChallenge({ url, onEvent, style }: MoonPayChallengeProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={challengeSpec}\n props={{ url }}\n style={style}\n defaultStyle={{ flex: 1 }}\n onEvent={onEvent}\n />\n );\n}\n","import type * as ConnectSdk from '@moonpay/platform-protocol/sdks/connect';\nimport type { ThemeOptions } from '@moonpay/platform-sdk-core';\nimport type { ViewStyle } from 'react-native';\nimport { connectSpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayConnectProps {\n /** Theme for this connect frame. Overrides the provider-level `theme`. Mount-time only. */\n theme?: ThemeOptions;\n /** Callback for connect lifecycle events. */\n onEvent?: (event: ConnectSdk.Event) => void;\n /** Container style. Defaults to flex: 1. */\n style?: ViewStyle;\n}\n\n/** Inline connect frame. On an active completion, credentials are applied to the shared client automatically. */\nexport function MoonPayConnect({ theme, onEvent, style }: MoonPayConnectProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={connectSpec}\n props={{ theme }}\n style={style}\n defaultStyle={{ flex: 1 }}\n onEvent={onEvent}\n />\n );\n}\n","import type { ConnectionCheckEvent } from '../frame-specs.js';\nimport { connectionCheckSpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayConnectionCheckProps {\n /** Pass `true` for headless / Identity-API integrations. Mount-time only. */\n skipKyc?: boolean;\n /** Emits `complete` with the Connection, or `error`. */\n onEvent?: (event: ConnectionCheckEvent) => void;\n}\n\n/**\n * Headless connection check (renders nothing visible). The declarative\n * alternative to client.getConnection() — on an active connection,\n * credentials are applied to the shared client automatically.\n */\nexport function MoonPayConnectionCheck({\n skipKyc,\n onEvent,\n}: MoonPayConnectionCheckProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={connectionCheckSpec}\n props={{ skipKyc }}\n defaultStyle={{}}\n onEvent={onEvent}\n />\n );\n}\n","import type { ConnectionResetEvent } from '../frame-specs.js';\nimport { connectionResetSpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayConnectionResetProps {\n /** Callback for connection reset lifecycle events. */\n onEvent?: (event: ConnectionResetEvent) => void;\n}\n\n/** Headless reset frame (renders nothing visible). The declarative alternative to client.resetConnection(). */\nexport function MoonPayConnectionReset({ onEvent }: MoonPayConnectionResetProps): JSX.Element {\n return (\n <MoonPayFrameView spec={connectionResetSpec} props={{}} defaultStyle={{}} onEvent={onEvent} />\n );\n}\n","import type * as CustomerExportSdk from '@moonpay/platform-protocol/sdks/customer-export';\nimport type { ViewStyle } from 'react-native';\nimport { customerExportSpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayCustomerExportProps {\n /** Callback for customer-export lifecycle events. */\n onEvent?: (event: CustomerExportSdk.Event) => void;\n /** Container style. Defaults to flex: 1. */\n style?: ViewStyle;\n}\n\n/** Inline customer-export consent frame — embed export consent capture in your own layout. */\nexport function MoonPayCustomerExport({ onEvent, style }: MoonPayCustomerExportProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={customerExportSpec}\n props={{}}\n style={style}\n defaultStyle={{ flex: 1 }}\n onEvent={onEvent}\n />\n );\n}\n","import type * as GooglePaySdk from '@moonpay/platform-protocol/sdks/google-pay';\nimport type { ViewStyle } from 'react-native';\nimport { googlePaySpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayGooglePayButtonProps {\n /** Quote signature from getQuote(). Reactive — updates are pushed via setQuote without remounting. */\n quote: string;\n /** Partner-assigned identifier for this transaction attempt. Mount-time only. */\n externalTransactionId?: string;\n /** Callback for Google Pay lifecycle events. */\n onEvent?: (event: GooglePaySdk.Event) => void;\n /** Container style. Defaults to height 48. */\n style?: ViewStyle;\n}\n\n/** Inline Google Pay button. Render it wherever it should appear in your layout. */\nexport function MoonPayGooglePayButton({\n quote,\n externalTransactionId,\n onEvent,\n style,\n}: MoonPayGooglePayButtonProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={googlePaySpec}\n props={{ quote, externalTransactionId }}\n style={style}\n defaultStyle={{ height: 48 }}\n onEvent={onEvent}\n />\n );\n}\n","import type * as WidgetSdk from '@moonpay/platform-protocol/sdks/widget';\nimport type { ViewStyle } from 'react-native';\nimport { widgetSpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayWidgetProps {\n /** Quote signature from getQuote(). Mount-time only — changing it reloads the widget. */\n quote: string;\n /** Partner-assigned identifier for this transaction attempt. Mount-time only. */\n externalTransactionId?: string;\n /** Callback for widget lifecycle events. */\n onEvent?: (event: WidgetSdk.Event) => void;\n /** Container style. Defaults to flex: 1. */\n style?: ViewStyle;\n}\n\n/** Inline widget frame. Render it wherever it should appear in your layout. */\nexport function MoonPayWidget({\n quote,\n externalTransactionId,\n onEvent,\n style,\n}: MoonPayWidgetProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={widgetSpec}\n props={{ quote, externalTransactionId }}\n style={style}\n defaultStyle={{ flex: 1 }}\n onEvent={onEvent}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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C,GAAG,SAAkB;AAEhG;;;ACCI,IAAAC,uBAAA;AAFG,SAAS,sBAAsB,EAAE,SAAS,MAAM,GAA4C;AACjG,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN,OAAO,CAAC;AAAA,MACR;AAAA,MACA,cAAc,EAAE,MAAM,EAAE;AAAA,MACxB;AAAA;AAAA,EACF;AAEJ;;;ACCI,IAAAC,uBAAA;AAPG,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA6C;AAC3C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN,OAAO,EAAE,OAAO,sBAAsB;AAAA,MACtC;AAAA,MACA,cAAc,EAAE,QAAQ,GAAG;AAAA,MAC3B;AAAA;AAAA,EACF;AAEJ;;;ACRI,IAAAC,uBAAA;AAPG,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAoC;AAClC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN,OAAO,EAAE,OAAO,sBAAsB;AAAA,MACtC;AAAA,MACA,cAAc,EAAE,MAAM,EAAE;AAAA,MACxB;AAAA;AAAA,EACF;AAEJ;","names":["import_connection","import_react","import_react_native","WebView","import_platform_sdk_core","import_platform_sdk_core","import_platform_sdk_core","import_react","import_result","import_result","import_result","import_result","import_result","import_platform_sdk_core","import_result","import_result","import_result","import_result","import_result","import_result","import_react","import_react_native","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/frame-specs.ts","../src/frame-view.tsx","../src/frame-component.tsx","../src/frame-engine.ts","../src/webview-transport.ts","../src/provider.tsx","../src/methods/add-card.ts","../src/methods/apple-pay.ts","../src/methods/auth.ts","../src/methods/buy.ts","../src/methods/buy-button.ts","../src/methods/challenge.ts","../src/methods/connect.ts","../src/methods/connection-check.ts","../src/methods/connection-reset.ts","../src/methods/customer-export.ts","../src/methods/google-pay.ts","../src/methods/widget.ts","../src/client.ts","../src/methods/mount-session.ts","../src/VisibleFrameSlotSheet.tsx","../src/sheet-presentation.ts","../src/components/add-card.tsx","../src/components/apple-pay-button.tsx","../src/components/auth.tsx","../src/components/buy-button.tsx","../src/components/buy-frame.tsx","../src/components/challenge.tsx","../src/components/connect.tsx","../src/components/connection-check.tsx","../src/components/connection-reset.tsx","../src/components/customer-export.tsx","../src/components/google-pay-button.tsx","../src/components/widget.tsx"],"sourcesContent":["// Re-export commonly used protocol types for convenience\n\nexport type {\n AssetStatus,\n GetQuoteParams,\n ListAssetsResponse,\n ListPaymentMethodsResponse,\n PaginationInfo,\n PaymentMethodConfig,\n PaymentMethodType,\n PlatformAsset,\n Quote,\n SimulateBankTransferOutcome,\n SimulateBankTransferParams,\n SimulateSenderBankAccount,\n StoredCardPaymentMethod,\n StoredPaymentMethod,\n Transaction,\n TransactionWithStages,\n} from '@moonpay/platform-protocol/api';\nexport type { Customer } from '@moonpay/platform-protocol/api/customer';\n// Frame-level types used in event payloads\nexport type { CardResponse } from '@moonpay/platform-protocol/frames/add-card';\nexport type {\n Cancellation as ChallengeCancellation,\n CompleteResult as ChallengeCompleteResult,\n} from '@moonpay/platform-protocol/frames/challenge';\nexport type { Connection } from '@moonpay/platform-protocol/models/connection';\nexport { ConnectionStatus } from '@moonpay/platform-protocol/models/connection';\nexport type { Result } from '@moonpay/platform-protocol/result';\n// SDK-facing event types — re-exported under their partner-facing names\nexport type {\n Event as AddCardEvent,\n SetupError as SetupAddCardError,\n} from '@moonpay/platform-protocol/sdks/add-card';\nexport type {\n Event as ApplePayEvent,\n SetupError as SetupApplePayError,\n} from '@moonpay/platform-protocol/sdks/apple-pay';\nexport type {\n Event as AuthEvent,\n SetupError as SetupAuthError,\n} from '@moonpay/platform-protocol/sdks/auth';\nexport type {\n Event as BuyEvent,\n SetupError as SetupBuyError,\n} from '@moonpay/platform-protocol/sdks/buy';\nexport type {\n Event as BuyButtonEvent,\n SetupError as SetupBuyButtonError,\n} from '@moonpay/platform-protocol/sdks/buy-button';\nexport type {\n Event as ChallengeEvent,\n SetupError as SetupChallengeError,\n} from '@moonpay/platform-protocol/sdks/challenge';\nexport type { Event as ConnectEvent } from '@moonpay/platform-protocol/sdks/connect';\nexport type {\n Event as CustomerExportEvent,\n SetupError as SetupCustomerExportError,\n} from '@moonpay/platform-protocol/sdks/customer-export';\nexport type {\n Event as GooglePayEvent,\n SetupError as SetupGooglePayError,\n} from '@moonpay/platform-protocol/sdks/google-pay';\nexport type {\n Event as WidgetEvent,\n SetupError as SetupWidgetError,\n} from '@moonpay/platform-protocol/sdks/widget';\nexport type { ListAssetsParams, ThemeOptions } from '@moonpay/platform-sdk-core';\nexport type { RNClient } from './client.js';\n// Inline frame components — render frames wherever you place them\nexport { MoonPayAddCard, type MoonPayAddCardProps } from './components/add-card.js';\nexport {\n MoonPayApplePayButton,\n type MoonPayApplePayButtonProps,\n} from './components/apple-pay-button.js';\nexport { MoonPayAuth, type MoonPayAuthProps } from './components/auth.js';\nexport { MoonPayBuyButton, type MoonPayBuyButtonProps } from './components/buy-button.js';\nexport { MoonPayBuyFrame, type MoonPayBuyFrameProps } from './components/buy-frame.js';\nexport { MoonPayChallenge, type MoonPayChallengeProps } from './components/challenge.js';\nexport { MoonPayConnect, type MoonPayConnectProps } from './components/connect.js';\nexport {\n MoonPayConnectionCheck,\n type MoonPayConnectionCheckProps,\n} from './components/connection-check.js';\nexport {\n MoonPayConnectionReset,\n type MoonPayConnectionResetProps,\n} from './components/connection-reset.js';\nexport {\n MoonPayCustomerExport,\n type MoonPayCustomerExportProps,\n} from './components/customer-export.js';\nexport {\n MoonPayGooglePayButton,\n type MoonPayGooglePayButtonProps,\n} from './components/google-pay-button.js';\nexport { MoonPayWidget, type MoonPayWidgetProps } from './components/widget.js';\nexport {\n MoonPayFrame,\n type MoonPayFrameProps,\n} from './frame-component.js';\nexport type { ConnectionCheckEvent, ConnectionResetEvent } from './frame-specs.js';\nexport type { AddCardFrame, SetupAddCardOptions } from './methods/add-card.js';\nexport type { ApplePayFrame, SetupApplePayOptions } from './methods/apple-pay.js';\nexport type { AuthFrame, SetupAuthOptions } from './methods/auth.js';\nexport type { BuyFrame, SetupBuyOptions } from './methods/buy.js';\nexport type { BuyButtonFrame, SetupBuyButtonOptions } from './methods/buy-button.js';\nexport type { ChallengeFrame, SetupChallengeOptions } from './methods/challenge.js';\nexport type { ConnectFrame, ConnectOptions } from './methods/connect.js';\nexport type { GetConnectionOptions } from './methods/connection-check.js';\nexport type {\n CustomerExportFrame,\n SetupCustomerExportOptions,\n} from './methods/customer-export.js';\nexport type { GooglePayFrame, SetupGooglePayOptions } from './methods/google-pay.js';\nexport type { SetupWidgetOptions, WidgetFrame } from './methods/widget.js';\nexport { MoonPayProvider, type MoonPayProviderProps, useMoonPay } from './provider.js';\nexport { WebViewTransport } from './webview-transport.js';\n","import type * as AddCardFrame from '@moonpay/platform-protocol/frames/add-card';\nimport type * as ApplePayFrame from '@moonpay/platform-protocol/frames/apple-pay';\nimport type * as AuthFrame from '@moonpay/platform-protocol/frames/auth';\nimport type * as BuyFrame from '@moonpay/platform-protocol/frames/buy';\nimport type * as BuyButtonFrame from '@moonpay/platform-protocol/frames/buy-button';\nimport type * as ChallengeFrame from '@moonpay/platform-protocol/frames/challenge';\nimport type * as ConnectFrame from '@moonpay/platform-protocol/frames/connect';\nimport type * as CustomerExportFrame from '@moonpay/platform-protocol/frames/customer-export';\nimport type * as GooglePayFrame from '@moonpay/platform-protocol/frames/google-pay';\nimport type * as WidgetFrame from '@moonpay/platform-protocol/frames/widget';\nimport type { Connection } from '@moonpay/platform-protocol/models/connection';\nimport {\n ConnectionErrorCode,\n ConnectionStatus,\n} from '@moonpay/platform-protocol/models/connection';\nimport type { FrameTransaction } from '@moonpay/platform-protocol/models/transaction';\nimport type { ProtocolMessage } from '@moonpay/platform-protocol/protocol';\nimport type * as AddCardSdk from '@moonpay/platform-protocol/sdks/add-card';\nimport type * as ApplePaySdk from '@moonpay/platform-protocol/sdks/apple-pay';\nimport type * as AuthSdk from '@moonpay/platform-protocol/sdks/auth';\nimport type * as BuySdk from '@moonpay/platform-protocol/sdks/buy';\nimport type * as BuyButtonSdk from '@moonpay/platform-protocol/sdks/buy-button';\nimport type * as ChallengeSdk from '@moonpay/platform-protocol/sdks/challenge';\nimport type * as ConnectSdk from '@moonpay/platform-protocol/sdks/connect';\nimport type * as CustomerExportSdk from '@moonpay/platform-protocol/sdks/customer-export';\nimport type * as GooglePaySdk from '@moonpay/platform-protocol/sdks/google-pay';\nimport type * as WidgetSdk from '@moonpay/platform-protocol/sdks/widget';\nimport {\n applyClientTokenParam,\n applyPresentationParam,\n decryptCredentials,\n FRAME_PATHS,\n type PresentationMode,\n presentationParams,\n type ThemeOptions,\n themeParams,\n} from '@moonpay/platform-sdk-core';\nimport type { EffectContext, FrameSpec, SpecContext } from './frame-engine.js';\n\n// ---------------------------------------------------------------------------\n// Shared commands\n// ---------------------------------------------------------------------------\n\nexport interface QuoteCommands {\n /** Push a fresh quote signature into the frame (e.g. after expiry). */\n setQuote(signature: string): void;\n}\n\nexport function createQuoteCommands(\n send: (msg: ProtocolMessage) => void,\n channelId: string,\n): QuoteCommands {\n return {\n setQuote: (signature) =>\n send({\n version: 2,\n meta: { channelId },\n kind: 'setQuote',\n payload: { quote: { signature } },\n }),\n };\n}\n\n// ---------------------------------------------------------------------------\n// Apple Pay button\n// ---------------------------------------------------------------------------\n\nexport interface ApplePayProps {\n quote: string;\n externalTransactionId?: string;\n presentation?: PresentationMode;\n}\n\nexport const applePaySpec: FrameSpec<ApplePaySdk.Event, ApplePayProps, QuoteCommands> = {\n channelPrefix: 'applepay',\n path: FRAME_PATHS.applePay,\n hidden: false,\n buildParams: (ctx, props) => ({\n clientToken: ctx.core.context.clientToken,\n signature: props.quote,\n ...(props.externalTransactionId && { externalTransactionId: props.externalTransactionId }),\n ...presentationParams(props.presentation),\n }),\n createCommands: createQuoteCommands,\n reactiveProps: {\n quote: (commands, quote) => commands.setQuote(quote),\n },\n mapMessage: (msg, commands) => {\n switch (msg.kind) {\n case 'ready':\n return { kind: 'ready' };\n case 'buttonPressed':\n return { kind: 'buttonPressed' };\n case 'complete':\n return { kind: 'complete', payload: msg.payload as { transaction: FrameTransaction } };\n case 'challenge':\n return {\n kind: 'challenge',\n payload: msg.payload as ApplePayFrame.InboundMessageMap['challenge'],\n };\n case 'error': {\n const payload = msg.payload as ApplePayFrame.InboundMessageMap['error'];\n if (payload.code === 'quoteExpired') {\n return { kind: 'quoteExpired', payload: { setQuote: commands.setQuote } };\n }\n if (payload.code === 'applePayUnavailable') {\n return { kind: 'unsupported' };\n }\n const kind = payload.code === 'generic' ? 'genericError' : payload.code;\n return { kind: 'error', payload: { kind, message: payload.message } };\n }\n default:\n return null;\n }\n },\n errorEvent: (message) => ({ kind: 'error', payload: { kind: 'genericError', message } }),\n};\n\n// ---------------------------------------------------------------------------\n// Google Pay button\n// ---------------------------------------------------------------------------\n\nexport interface GooglePayProps {\n quote: string;\n externalTransactionId?: string;\n presentation?: PresentationMode;\n}\n\nexport const googlePaySpec: FrameSpec<GooglePaySdk.Event, GooglePayProps, QuoteCommands> = {\n channelPrefix: 'googlepay',\n path: FRAME_PATHS.googlePay,\n hidden: false,\n buildParams: (ctx, props) => ({\n clientToken: ctx.core.context.clientToken,\n signature: props.quote,\n ...(props.externalTransactionId && { externalTransactionId: props.externalTransactionId }),\n ...presentationParams(props.presentation),\n }),\n createCommands: createQuoteCommands,\n reactiveProps: {\n quote: (commands, quote) => commands.setQuote(quote),\n },\n mapMessage: (msg, commands) => {\n switch (msg.kind) {\n case 'ready':\n return { kind: 'ready' };\n case 'buttonPressed':\n return { kind: 'buttonPressed' };\n case 'complete':\n return { kind: 'complete', payload: msg.payload as { transaction: FrameTransaction } };\n case 'challenge':\n return {\n kind: 'challenge',\n payload: msg.payload as GooglePayFrame.InboundMessageMap['challenge'],\n };\n case 'error': {\n const payload = msg.payload as GooglePayFrame.InboundMessageMap['error'];\n if (payload.code === 'quoteExpired') {\n return { kind: 'quoteExpired', payload: { setQuote: commands.setQuote } };\n }\n if (payload.code === 'googlePayUnavailable') {\n return { kind: 'unsupported' };\n }\n const kind = payload.code === 'generic' ? 'genericError' : payload.code;\n return { kind: 'error', payload: { kind, message: payload.message } };\n }\n default:\n return null;\n }\n },\n errorEvent: (message) => ({ kind: 'error', payload: { kind: 'genericError', message } }),\n};\n\n// ---------------------------------------------------------------------------\n// Buy button\n// ---------------------------------------------------------------------------\n\nexport interface BuyButtonProps {\n quote: string;\n externalTransactionId?: string;\n presentation?: PresentationMode;\n}\n\nexport const buyButtonSpec: FrameSpec<BuyButtonSdk.Event, BuyButtonProps, QuoteCommands> = {\n channelPrefix: 'buy-button',\n path: FRAME_PATHS.buyButton,\n hidden: false,\n buildParams: (ctx, props) => ({\n clientToken: ctx.core.context.clientToken,\n signature: props.quote,\n ...(props.externalTransactionId && { externalTransactionId: props.externalTransactionId }),\n ...presentationParams(props.presentation),\n }),\n createCommands: createQuoteCommands,\n reactiveProps: {\n quote: (commands, quote) => commands.setQuote(quote),\n },\n mapMessage: (msg) => {\n switch (msg.kind) {\n case 'ready':\n return { kind: 'ready' };\n case 'buttonPressed':\n return { kind: 'buttonPressed' };\n case 'complete':\n return { kind: 'complete', payload: msg.payload as BuyButtonFrame.MessageMap['complete'] };\n case 'challenge':\n return {\n kind: 'challenge',\n payload: msg.payload as BuyButtonFrame.MessageMap['challenge'],\n };\n case 'error':\n return { kind: 'error', payload: msg.payload as BuyButtonFrame.MessageMap['error'] };\n default:\n return null;\n }\n },\n errorEvent: (message) => ({\n kind: 'error',\n payload: { code: 'generic', message } as BuyButtonFrame.MessageMap['error'],\n }),\n};\n\n// ---------------------------------------------------------------------------\n// Credential side-effect (connect / auth / check-connection)\n// ---------------------------------------------------------------------------\n\n/**\n * On a credential-bearing `complete`, decrypt the delivered credentials with\n * the session's private key and store them on the shared client context.\n * Runs before event fan-out so partners see tokens already applied.\n *\n * `connectionRequired` carries encrypted anonymous tokens — storing the\n * `clientToken` is what makes `setupAuth()` / `<MoonPayAuth>` and other\n * pre-connect flows possible without a full connect flow (mirrors the web SDK).\n */\nexport function applyCredentialsOnComplete(msg: ProtocolMessage, ctx: EffectContext): void {\n if (msg.kind !== 'complete' || !ctx.privateKey) return;\n const connection = msg.payload as Connection;\n if (\n connection.status !== ConnectionStatus.active &&\n connection.status !== ConnectionStatus.connectionRequired\n ) {\n return;\n }\n // The type declares `credentials` as required, but the payload arrives over\n // postMessage — guard so a frame that omits it (e.g. anonymous tokens not\n // issued for this partner) degrades to \"no tokens stored\" instead of a\n // throw that would swallow the `complete` event entirely.\n if (!connection.credentials) return;\n const creds = decryptCredentials(connection.credentials, ctx.privateKey);\n ctx.core.context.setAccessToken(creds.accessToken);\n ctx.core.context.setClientToken(creds.clientToken);\n}\n\n// ---------------------------------------------------------------------------\n// Session-token guard\n// ---------------------------------------------------------------------------\n\n/**\n * Check-connection and reset are the only frames that take the raw\n * `sessionToken`. When the provider was mounted without one (and `initialize()`\n * hasn't run yet), fail with a clear, actionable message instead of building a\n * frame URL with `sessionToken=undefined`. Mirrors how `authSpec` guards\n * `clientToken`.\n */\nfunction requireSessionToken(ctx: SpecContext): string {\n if (!ctx.sessionToken) {\n throw new Error(\n 'No session token — pass sessionToken to <MoonPayProvider> or call initialize() from useMoonPay() before starting a connection.',\n );\n }\n return ctx.sessionToken;\n}\n\n// ---------------------------------------------------------------------------\n// Check-connection (hidden)\n// ---------------------------------------------------------------------------\n\nexport interface ConnectionCheckProps {\n skipKyc?: boolean;\n}\n\nexport type ConnectionCheckEvent =\n | { kind: 'complete'; payload: Connection }\n | { kind: 'error'; payload: { message: string } };\n\nexport const connectionCheckSpec: FrameSpec<ConnectionCheckEvent, ConnectionCheckProps> = {\n channelPrefix: 'check',\n path: FRAME_PATHS.checkConnection,\n hidden: true,\n needsKeyPair: true,\n handshakeTimeout: 10_000,\n buildParams: (ctx, props, publicKey) => ({\n sessionToken: requireSessionToken(ctx),\n publicKey,\n ...(props.skipKyc && { skipKyc: true }),\n }),\n onMessageEffect: applyCredentialsOnComplete,\n mapMessage: (msg) => {\n if (msg.kind === 'complete') {\n return { kind: 'complete', payload: msg.payload as Connection };\n }\n if (msg.kind === 'error') {\n return { kind: 'error', payload: msg.payload as { message: string } };\n }\n return null;\n },\n errorEvent: (message) => ({ kind: 'error', payload: { message } }),\n};\n\n// ---------------------------------------------------------------------------\n// Connect (visible)\n// ---------------------------------------------------------------------------\n\nexport interface ConnectProps {\n theme?: ThemeOptions;\n presentation?: PresentationMode;\n}\n\nexport const connectSpec: FrameSpec<ConnectSdk.Event, ConnectProps> = {\n channelPrefix: 'connect',\n path: FRAME_PATHS.connect,\n hidden: false,\n needsKeyPair: true,\n buildParams: (ctx, props, publicKey) => {\n const clientToken = ctx.core.context.clientToken;\n if (!clientToken) {\n throw new Error(\n 'No clientToken in context — call getConnection() first and ensure it resolved with status \"connectionRequired\".',\n );\n }\n return {\n clientToken,\n publicKey,\n // Per-call override; `applyThemeParam` in the engine fills the client\n // default for connect (and every other visible frame) when this is absent.\n ...themeParams(props.theme),\n ...presentationParams(props.presentation),\n };\n },\n onMessageEffect: applyCredentialsOnComplete,\n mapMessage: (msg) => {\n switch (msg.kind) {\n case 'ready':\n return { kind: 'ready' };\n case 'error':\n return { kind: 'error', payload: msg.payload as ConnectFrame.MessageMap['error'] };\n case 'complete':\n return { kind: 'complete', payload: msg.payload as ConnectFrame.MessageMap['complete'] };\n default:\n return null;\n }\n },\n errorEvent: (message) => ({\n kind: 'error',\n payload: { code: ConnectionErrorCode.connectionFailedGeneric, message },\n }),\n};\n\n// ---------------------------------------------------------------------------\n// Auth (visible)\n// ---------------------------------------------------------------------------\n\nexport interface AuthProps {\n presentation?: PresentationMode;\n}\n\nexport const authSpec: FrameSpec<AuthSdk.Event, AuthProps> = {\n channelPrefix: 'auth',\n path: FRAME_PATHS.auth,\n hidden: false,\n needsKeyPair: true,\n buildParams: (ctx, props, publicKey) => {\n const clientToken = ctx.core.context.clientToken;\n if (!clientToken) {\n throw new Error(\n 'No clientToken in context — call getConnection() first and ensure it resolved with status \"connectionRequired\".',\n );\n }\n return { clientToken, publicKey, ...presentationParams(props.presentation) };\n },\n onMessageEffect: applyCredentialsOnComplete,\n mapMessage: (msg) => {\n switch (msg.kind) {\n case 'ready':\n return { kind: 'ready' };\n case 'error':\n return { kind: 'error', payload: msg.payload as AuthFrame.MessageMap['error'] };\n case 'complete': {\n const connection = msg.payload as Connection;\n if (\n connection.status === ConnectionStatus.active ||\n connection.status === ConnectionStatus.termsAcceptanceRequired\n ) {\n return { kind: 'complete', payload: msg.payload as AuthFrame.MessageMap['complete'] };\n }\n return null;\n }\n default:\n return null;\n }\n },\n errorEvent: (message) => ({\n kind: 'error',\n payload: { code: ConnectionErrorCode.connectionFailedGeneric, message },\n }),\n};\n\n// ---------------------------------------------------------------------------\n// Widget (visible)\n// ---------------------------------------------------------------------------\n\nexport interface WidgetProps {\n quote: string;\n externalTransactionId?: string;\n presentation?: PresentationMode;\n}\n\nexport const widgetSpec: FrameSpec<WidgetSdk.Event, WidgetProps> = {\n channelPrefix: 'widget',\n path: FRAME_PATHS.widget,\n hidden: false,\n buildParams: (ctx, props) => ({\n flow: 'buy',\n clientToken: ctx.core.context.clientToken,\n quoteSignature: props.quote,\n ...(props.externalTransactionId && { externalTransactionId: props.externalTransactionId }),\n ...presentationParams(props.presentation),\n }),\n mapMessage: (msg) => {\n switch (msg.kind) {\n case 'ready':\n return { kind: 'ready' };\n case 'transactionCreated':\n return {\n kind: 'transactionCreated',\n payload: msg.payload as WidgetFrame.MessageMap['transactionCreated'],\n };\n case 'complete':\n return { kind: 'complete', payload: msg.payload as { transaction: FrameTransaction } };\n case 'error':\n return { kind: 'error', payload: msg.payload as WidgetFrame.MessageMap['error'] };\n case 'close':\n return { kind: 'close' };\n default:\n return null;\n }\n },\n errorEvent: (message) => ({\n kind: 'error',\n payload: { code: 'generic', message } as WidgetFrame.MessageMap['error'],\n }),\n};\n\n// ---------------------------------------------------------------------------\n// Buy (hidden, headless)\n// ---------------------------------------------------------------------------\n\nexport interface BuyProps {\n quote: string;\n externalTransactionId?: string;\n}\n\nexport const buySpec: FrameSpec<BuySdk.Event, BuyProps, QuoteCommands> = {\n channelPrefix: 'buy',\n path: FRAME_PATHS.buy,\n hidden: true,\n buildParams: (ctx, props) => ({\n clientToken: ctx.core.context.clientToken,\n signature: props.quote,\n ...(props.externalTransactionId && { externalTransactionId: props.externalTransactionId }),\n }),\n createCommands: createQuoteCommands,\n reactiveProps: {\n quote: (commands, quote) => commands.setQuote(quote),\n },\n mapMessage: (msg) => {\n switch (msg.kind) {\n case 'ready':\n return { kind: 'ready' };\n case 'complete':\n return { kind: 'complete', payload: msg.payload as BuyFrame.MessageMap['complete'] };\n case 'challenge':\n return { kind: 'challenge', payload: msg.payload as BuyFrame.MessageMap['challenge'] };\n case 'error':\n return { kind: 'error', payload: msg.payload as BuyFrame.MessageMap['error'] };\n default:\n return null;\n }\n },\n errorEvent: (message) => ({\n kind: 'error',\n payload: { code: 'generic', message } as BuyFrame.MessageMap['error'],\n }),\n};\n\n// ---------------------------------------------------------------------------\n// Add card (visible)\n// ---------------------------------------------------------------------------\n\nexport interface AddCardProps {\n presentation?: PresentationMode;\n}\n\nexport const addCardSpec: FrameSpec<AddCardSdk.Event, AddCardProps> = {\n channelPrefix: 'add-card',\n path: FRAME_PATHS.addCard,\n hidden: false,\n buildParams: (ctx, props) => ({\n clientToken: ctx.core.context.clientToken,\n ...presentationParams(props.presentation),\n }),\n mapMessage: (msg) => {\n switch (msg.kind) {\n case 'ready':\n return { kind: 'ready' };\n case 'complete':\n return {\n kind: 'complete',\n payload: msg.payload as { card: AddCardFrame.CardResponse },\n };\n case 'error':\n return { kind: 'error', payload: msg.payload as AddCardFrame.MessageMap['error'] };\n default:\n return null;\n }\n },\n errorEvent: (message) => ({\n kind: 'error',\n payload: { code: 'generic', message } as AddCardFrame.MessageMap['error'],\n }),\n};\n\n// ---------------------------------------------------------------------------\n// Customer export (visible)\n// ---------------------------------------------------------------------------\n\nexport interface CustomerExportProps {\n presentation?: PresentationMode;\n}\n\nexport const customerExportSpec: FrameSpec<CustomerExportSdk.Event, CustomerExportProps> = {\n channelPrefix: 'customer-export',\n path: FRAME_PATHS.customerExport,\n hidden: false,\n buildParams: (ctx, props) => ({\n clientToken: ctx.core.context.clientToken,\n ...presentationParams(props.presentation),\n }),\n mapMessage: (msg) => {\n switch (msg.kind) {\n case 'ready':\n return { kind: 'ready' };\n case 'complete':\n return {\n kind: 'complete',\n payload: msg.payload as CustomerExportFrame.MessageMap['complete'],\n };\n case 'error':\n return { kind: 'error', payload: msg.payload as CustomerExportFrame.MessageMap['error'] };\n case 'close':\n return { kind: 'close' };\n default:\n return null;\n }\n },\n errorEvent: (message) => ({\n kind: 'error',\n payload: { code: ConnectionErrorCode.connectionFailedGeneric, message },\n }),\n};\n\n// ---------------------------------------------------------------------------\n// Challenge (visible; URL comes from a frame's `challenge` event, or a\n// quote's `challenge` field for guest-checkout limit upgrade)\n// ---------------------------------------------------------------------------\n\nexport interface ChallengeProps {\n /** `clientToken` is attached automatically when the client holds one — do not add it yourself. */\n url: string;\n presentation?: PresentationMode;\n}\n\nexport const challengeSpec: FrameSpec<ChallengeSdk.Event, ChallengeProps> = {\n channelPrefix: 'challenge',\n path: FRAME_PATHS.challenge, // documentation only — buildUrl below wins\n hidden: false,\n resolveChannelId: (props, generated) =>\n new URL(props.url).searchParams.get('channelId') || generated,\n buildUrl: (ctx, props, channelId) => {\n const url = new URL(props.url);\n url.searchParams.set('channelId', channelId);\n return applyClientTokenParam(\n applyPresentationParam(url.toString(), props.presentation),\n ctx.core.context.clientToken,\n );\n },\n mapMessage: (msg) => {\n switch (msg.kind) {\n case 'ready':\n return { kind: 'ready' };\n case 'complete':\n return { kind: 'complete', payload: msg.payload as ChallengeFrame.CompleteResult };\n case 'cancelled':\n return { kind: 'cancelled', payload: msg.payload as ChallengeFrame.Cancellation };\n case 'error':\n return { kind: 'error', payload: msg.payload as ChallengeFrame.MessageMap['error'] };\n default:\n return null;\n }\n },\n errorEvent: (message) => ({\n kind: 'error',\n payload: { code: 'generic', message } as ChallengeFrame.MessageMap['error'],\n }),\n};\n\n// ---------------------------------------------------------------------------\n// Reset connection (hidden, headless)\n// ---------------------------------------------------------------------------\n\nexport type ConnectionResetProps = Record<string, never>;\n\nexport type ConnectionResetEvent =\n | { kind: 'complete' }\n | { kind: 'error'; payload: { message: string } };\n\nexport const connectionResetSpec: FrameSpec<ConnectionResetEvent, ConnectionResetProps> = {\n channelPrefix: 'reset',\n path: FRAME_PATHS.reset,\n hidden: true,\n handshakeTimeout: 5_000,\n buildParams: (ctx) => ({ sessionToken: requireSessionToken(ctx) }),\n mapMessage: (msg) => {\n if (msg.kind === 'complete') return { kind: 'complete' };\n if (msg.kind === 'error') {\n const payload = msg.payload as { message?: string };\n return { kind: 'error', payload: { message: payload?.message ?? 'Reset failed' } };\n }\n return null;\n },\n errorEvent: (message) => ({ kind: 'error', payload: { message } }),\n};\n","import { useEffect, useRef, useState } from 'react';\nimport { View, type ViewStyle } from 'react-native';\nimport { MoonPayFrame } from './frame-component.js';\nimport {\n createFrameSession,\n type FrameSession,\n type FrameSessionHandle,\n type FrameSpec,\n} from './frame-engine.js';\nimport { useMoonPayContext } from './provider.js';\nimport type { RNFrameTransport } from './webview-transport.js';\n\nexport interface MoonPayFrameViewProps<E, P, C> {\n spec: FrameSpec<E, P, C>;\n /** Frame props. Keys declared in the spec's `reactiveProps` update the live frame via commands; all other keys remount the frame on change. */\n props: P;\n style?: ViewStyle;\n defaultStyle: ViewStyle;\n onEvent?: (event: E) => void;\n}\n\n/**\n * Push the latest value of each changed reactive prop into the live session,\n * recording what was applied so unchanged values never re-send commands.\n */\nfunction applyReactiveProps<E, P, C>(\n spec: FrameSpec<E, P, C>,\n keys: (keyof P)[],\n props: P,\n applied: Partial<P>,\n handle: FrameSessionHandle<E, C>,\n): void {\n for (const key of keys) {\n const next = props[key];\n if (next !== undefined && next !== applied[key]) {\n spec.reactiveProps?.[key]?.(handle.commands, next as NonNullable<P[typeof key]>);\n applied[key] = next;\n }\n }\n}\n\n/**\n * Shared inline mount target for frame sessions. Renders the WebView exactly\n * where the partner places this component; the engine handles everything else.\n */\nexport function MoonPayFrameView<E, P, C>({\n spec,\n props,\n style,\n defaultStyle,\n onEvent,\n}: MoonPayFrameViewProps<E, P, C>): JSX.Element | null {\n const { sessionToken, core, frameBaseUrl, theme } = useMoonPayContext();\n const [transport, setTransport] = useState<RNFrameTransport | null>(null);\n const handleRef = useRef<FrameSessionHandle<E, C> | null>(null);\n const onEventRef = useRef(onEvent);\n onEventRef.current = onEvent;\n const propsRef = useRef(props);\n propsRef.current = props;\n\n // Split props by the spec's reactiveProps declaration: reactive keys update\n // the live session via commands; everything else remounts the frame.\n const reactiveKeys = Object.keys(spec.reactiveProps ?? {}) as (keyof P)[];\n const mountProps: Partial<P> = {};\n const liveProps: Partial<P> = {};\n for (const [key, value] of Object.entries(props as Record<string, unknown>)) {\n const k = key as keyof P;\n (reactiveKeys.includes(k) ? liveProps : mountProps)[k] = value as P[keyof P];\n }\n const mountKey = JSON.stringify(mountProps);\n const liveKey = JSON.stringify(liveProps);\n\n // Tracks the last applied reactive values, seeded at mount.\n const appliedRef = useRef<Partial<P>>({});\n\n // biome-ignore lint/correctness/useExhaustiveDependencies: mountKey encodes the props that should remount\n useEffect(() => {\n let disposed = false;\n let session: FrameSession<E, C>;\n // Snapshot the reactive values the session is created with.\n const applied: Partial<P> = {};\n for (const key of reactiveKeys) {\n applied[key] = propsRef.current[key];\n }\n appliedRef.current = applied;\n\n try {\n session = createFrameSession(\n spec,\n { sessionToken, core, frameBaseUrl, theme },\n propsRef.current,\n );\n } catch (e) {\n onEventRef.current?.(\n spec.errorEvent(e instanceof Error ? e.message : 'Failed to create frame'),\n );\n return;\n }\n\n setTransport(session.transport);\n\n session.ready\n .then((handle) => {\n if (disposed) {\n handle.dispose();\n return;\n }\n handleRef.current = handle;\n handle.onEvent((event) => onEventRef.current?.(event));\n // Apply reactive props that changed while the handshake was in flight\n applyReactiveProps(spec, reactiveKeys, propsRef.current, appliedRef.current, handle);\n })\n .catch((e: unknown) => {\n if (!disposed) {\n onEventRef.current?.(\n spec.errorEvent(e instanceof Error ? e.message : 'Frame handshake failed'),\n );\n }\n });\n\n return () => {\n disposed = true;\n handleRef.current = null;\n session.dispose();\n setTransport(null);\n };\n }, [mountKey, spec, sessionToken, core, frameBaseUrl]);\n\n // Reactive props → commands (no remount). Skipped while the handshake is\n // pending; the ready handler above applies the latest values.\n // biome-ignore lint/correctness/useExhaustiveDependencies: liveKey encodes the reactive prop values\n useEffect(() => {\n const handle = handleRef.current;\n if (!handle) return;\n applyReactiveProps(spec, reactiveKeys, propsRef.current, appliedRef.current, handle);\n }, [liveKey]);\n\n if (spec.hidden) {\n return transport ? <MoonPayFrame transport={transport} hidden /> : null;\n }\n\n const resolvedStyle: ViewStyle = { ...defaultStyle, ...style };\n return (\n <View style={resolvedStyle}>{transport ? <MoonPayFrame transport={transport} /> : null}</View>\n );\n}\n","import { useEffect, useRef } from 'react';\nimport { View, type ViewStyle } from 'react-native';\nimport WebView, { type WebViewMessageEvent } from 'react-native-webview';\nimport type { RNFrameTransport } from './webview-transport.js';\n\nexport interface MoonPayFrameProps {\n /** The transport instance managing this frame's communication. */\n transport: RNFrameTransport;\n /** Whether this is a hidden utility frame (zero height). */\n hidden?: boolean;\n /** Optional style overrides for the container view. */\n style?: ViewStyle;\n}\n\n/**\n * Reusable React Native component that renders a MoonPay frame as a WebView.\n * Bridges the WebViewTransport to the actual WebView instance.\n */\nexport function MoonPayFrame({ transport, hidden, style }: MoonPayFrameProps): JSX.Element | null {\n const webViewRef = useRef<WebView>(null);\n\n useEffect(() => {\n transport.attachWebView(webViewRef);\n return () => {\n // Don't dispose — the orchestrator manages lifecycle\n };\n }, [transport]);\n\n const url = transport.url;\n if (!url) return null;\n\n const handleMessage = (event: WebViewMessageEvent) => {\n transport.handleWebViewMessage(event.nativeEvent.data);\n };\n\n const containerStyle: ViewStyle = hidden\n ? { width: 0, height: 0, overflow: 'hidden' }\n : { flex: 1, ...style };\n\n return (\n <View style={containerStyle}>\n <WebView\n ref={webViewRef}\n source={{ uri: url }}\n onMessage={handleMessage}\n allowsInlineMediaPlayback\n javaScriptEnabled\n domStorageEnabled\n style={{ flex: 1 }}\n />\n </View>\n );\n}\n","import type { ProtocolMessage } from '@moonpay/platform-protocol/protocol';\nimport {\n applyThemeParam,\n buildFrameUrl,\n type CoreClient,\n createFrameOrchestrator,\n generateKeyPair,\n type ThemeOptions,\n} from '@moonpay/platform-sdk-core';\nimport { type RNFrameTransport, WebViewTransport } from './webview-transport.js';\n\n/** Shared dependencies every frame needs to build its URL and apply effects. */\nexport interface SpecContext {\n /**\n * Session token from the partner's server. Optional because the provider can\n * be mounted before one is available (see `initialize()` in the provider);\n * only the check-connection, connect, and reset frames consume it, and they\n * guard for its absence via `requireSessionToken`.\n */\n sessionToken?: string;\n core: CoreClient;\n frameBaseUrl?: string;\n /** Client-level theme applied to every visible frame (provider-wide default). */\n theme?: ThemeOptions;\n}\n\n/** Context passed to `onMessageEffect`; includes the session's private key when one was generated. */\nexport interface EffectContext extends SpecContext {\n privateKey?: string;\n}\n\n/**\n * Declarative description of a frame type. Everything that differs between\n * frames lives here; `createFrameSession` provides everything that doesn't.\n */\nexport interface FrameSpec<E, P, C = undefined> {\n /** Channel id prefix, e.g. 'applepay' → 'applepay-<timestamp>'. */\n channelPrefix: string;\n /** FRAME_PATHS entry. Ignored when `buildUrl` is provided. */\n path: string;\n /** Render hidden (0×0 utility frame)? */\n hidden: boolean;\n /** Generate an X25519 key pair for encrypted credential delivery. */\n needsKeyPair?: boolean;\n /** Handshake timeout override in ms (orchestrator default: 15_000). */\n handshakeTimeout?: number;\n /** Query params for the frame URL (channelId is added automatically). */\n buildParams?(ctx: SpecContext, props: P, publicKey?: string): Record<string, unknown>;\n /** Derive the channel id from props (challenge reads it from the partner URL). May throw. */\n resolveChannelId?(props: P, generated: string): string;\n /** Full URL override (challenge). May throw on invalid input. */\n buildUrl?(ctx: SpecContext, props: P, channelId: string, publicKey?: string): string;\n /** Map a protocol message to an SDK event, or null to ignore it. */\n mapMessage(msg: ProtocolMessage, commands: C): E | null;\n /** Side effect on incoming messages (e.g. credential decryption). Runs before event fan-out. */\n onMessageEffect?(msg: ProtocolMessage, ctx: EffectContext): void;\n /** Outbound commands exposed on the session handle (e.g. setQuote). */\n createCommands?(send: (msg: ProtocolMessage) => void, channelId: string): C;\n /** Wrap a failure (handshake timeout, invalid props) as this frame's error event. */\n errorEvent(message: string): E;\n /**\n * Props that update a live session through commands instead of remounting\n * the frame. Each entry maps a prop key to the command invocation that\n * applies its new value. Props not listed here remount the frame on change.\n */\n reactiveProps?: { [K in keyof P]?: (commands: C, value: NonNullable<P[K]>) => void };\n}\n\nexport interface FrameSessionHandle<E, C = undefined> {\n /** Subscribe to mapped SDK events. Returns an unsubscribe function. */\n onEvent(handler: (event: E) => void): () => void;\n /** Subscribe to raw post-handshake protocol messages. */\n onMessage(handler: (msg: ProtocolMessage) => void): () => void;\n /**\n * Subscribe to session teardown. Fires exactly once, from any dispose path\n * (the handle's own `dispose()` or the session-level one — e.g. the user\n * dismissing an SDK-presented frame). Returns an unsubscribe function.\n */\n onDispose(handler: () => void): () => void;\n sendMessage(msg: ProtocolMessage): void;\n commands: C;\n dispose(): void;\n}\n\nexport interface FrameSession<E, C = undefined> {\n transport: RNFrameTransport;\n channelId: string;\n url: string;\n hidden: boolean;\n /** Resolves after the handshake; rejects on timeout. */\n ready: Promise<FrameSessionHandle<E, C>>;\n /** Tear down the session at any point — safe to call before the handshake completes. */\n dispose(): void;\n}\n\nexport interface CreateFrameSessionOverrides {\n createTransport?: () => RNFrameTransport;\n handshakeTimeout?: number;\n}\n\n/**\n * Rejection reason for `FrameSession.ready` when the session is disposed\n * before the handshake completes (e.g. the user dismisses an SDK-presented\n * frame while it is still loading). Callers awaiting `ready` can distinguish\n * this from a handshake timeout or setup failure.\n */\nexport class FrameSessionDisposedError extends Error {\n constructor() {\n super('Frame session disposed');\n this.name = 'FrameSessionDisposedError';\n }\n}\n\n/**\n * Create a frame session: URL, transport, handshake, typed events, commands.\n * Does NOT decide where the WebView renders — the caller mounts\n * `session.transport` in a provider slot or an inline component.\n *\n * May throw synchronously if the spec's `resolveChannelId`/`buildUrl`\n * rejects the props (e.g. an invalid challenge URL).\n */\nexport function createFrameSession<E, P, C = undefined>(\n spec: FrameSpec<E, P, C>,\n ctx: SpecContext,\n props: P,\n overrides: CreateFrameSessionOverrides = {},\n): FrameSession<E, C> {\n const generated = `${spec.channelPrefix}-${Date.now()}`;\n const channelId = spec.resolveChannelId ? spec.resolveChannelId(props, generated) : generated;\n const keyPair = spec.needsKeyPair ? generateKeyPair() : undefined;\n\n const builtUrl = spec.buildUrl\n ? spec.buildUrl(ctx, props, channelId, keyPair?.publicKey)\n : buildFrameUrl(\n spec.path,\n { ...spec.buildParams?.(ctx, props, keyPair?.publicKey), channelId },\n { frameBaseUrl: ctx.frameBaseUrl },\n );\n // Inject the client-level theme into every visible frame. Hidden utility\n // frames have no UI, so they stay param-clean; `applyThemeParam` leaves a\n // per-frame theme (e.g. connect's own option) untouched if already present.\n const url = spec.hidden ? builtUrl : applyThemeParam(builtUrl, ctx.theme);\n\n const transport = (overrides.createTransport ?? (() => new WebViewTransport()))();\n\n let resolvedHandle: FrameSessionHandle<E, C> | null = null;\n\n // Settles `ready` immediately when the session is disposed pre-handshake —\n // without this, callers awaiting `ready` would only learn of the teardown\n // when the orchestrator's handshake timer fires (up to 15s later), and as\n // the wrong error.\n let rejectDisposed: ((error: Error) => void) | undefined;\n const disposedBeforeReady = new Promise<never>((_, reject) => {\n rejectDisposed = reject;\n });\n\n const handleReady = createFrameOrchestrator({\n transport,\n channelId,\n url,\n container: null,\n hidden: spec.hidden,\n handshakeTimeout: overrides.handshakeTimeout ?? spec.handshakeTimeout ?? 15_000,\n }).then((handle): FrameSessionHandle<E, C> => {\n const send = (msg: ProtocolMessage) => handle.sendMessage(msg);\n const commands = spec.createCommands?.(send, channelId) as C;\n const eventHandlers: Array<(event: E) => void> = [];\n const disposeHandlers: Array<() => void> = [];\n let disposeNotified = false;\n const notifyDisposed = () => {\n if (disposeNotified) return;\n disposeNotified = true;\n for (const handler of [...disposeHandlers]) {\n handler();\n }\n };\n\n handle.onMessage((msg) => {\n let event: E | null;\n try {\n spec.onMessageEffect?.(msg, { ...ctx, privateKey: keyPair?.privateKey });\n event = spec.mapMessage(msg, commands);\n } catch (e) {\n // A throwing effect or mapper (e.g. credential decryption on a\n // corrupt payload) would otherwise propagate into the transport's\n // catch-all and silently drop this message — the partner would see\n // nothing and request/response methods would only fail by timeout.\n // Surface it as the frame's error event instead.\n event = spec.errorEvent(e instanceof Error ? e.message : 'Failed to process frame message');\n }\n if (event !== null) {\n for (const handler of [...eventHandlers]) {\n handler(event);\n }\n }\n });\n\n const sessionHandle: FrameSessionHandle<E, C> = {\n onEvent(handler) {\n eventHandlers.push(handler);\n return () => {\n const idx = eventHandlers.indexOf(handler);\n if (idx >= 0) eventHandlers.splice(idx, 1);\n };\n },\n onMessage: (handler) => handle.onMessage(handler),\n onDispose(handler) {\n disposeHandlers.push(handler);\n return () => {\n const idx = disposeHandlers.indexOf(handler);\n if (idx >= 0) disposeHandlers.splice(idx, 1);\n };\n },\n sendMessage: send,\n commands,\n dispose: () => {\n handle.dispose();\n notifyDisposed();\n },\n };\n resolvedHandle = sessionHandle;\n return sessionHandle;\n });\n\n const ready = Promise.race([handleReady, disposedBeforeReady]);\n\n // Suppress unhandled-rejection for callers that abandon the promise (e.g. early dispose).\n ready.catch(() => {});\n\n return {\n transport,\n channelId,\n url,\n hidden: spec.hidden,\n ready,\n dispose: () => {\n if (resolvedHandle) {\n resolvedHandle.dispose();\n } else {\n // Pre-ready: reject `ready` now so awaiting callers settle immediately.\n // The orchestrator's handshake timer still fires later, harmlessly\n // re-disposing the transport; its rejection is already handled above.\n transport.dispose();\n rejectDisposed?.(new FrameSessionDisposedError());\n }\n },\n };\n}\n","import type { ProtocolMessage } from '@moonpay/platform-protocol/protocol';\nimport {\n type FrameOptions,\n type FrameTransport,\n isTrustedFrameUrl,\n} from '@moonpay/platform-sdk-core';\nimport type { RefObject } from 'react';\nimport type WebView from 'react-native-webview';\n\n/**\n * Transport surface the RN SDK passes around internally. `WebViewTransport`\n * is the production implementation; tests substitute fakes.\n */\nexport interface RNFrameTransport extends FrameTransport {\n readonly url: string;\n readonly options: FrameOptions | null;\n attachWebView(ref: RefObject<WebView | null>): void;\n handleWebViewMessage(data: string): void;\n}\n\n/**\n * FrameTransport implementation for React Native using react-native-webview.\n *\n * Unlike the web IframeTransport, the WebView is rendered declaratively via\n * React components. This transport bridges the imperative FrameTransport\n * interface to a WebView ref.\n */\nexport class WebViewTransport implements RNFrameTransport {\n private webViewRef: RefObject<WebView | null> | null = null;\n private handlers: Array<(msg: ProtocolMessage) => void> = [];\n private _url: string = '';\n private _options: FrameOptions | null = null;\n\n /** Called by the frame component when it mounts the WebView. */\n attachWebView(ref: RefObject<WebView | null>): void {\n this.webViewRef = ref;\n }\n\n /** Called by the WebView's onMessage prop to route incoming messages. */\n handleWebViewMessage(data: string): void {\n try {\n const msg: ProtocolMessage = JSON.parse(data);\n if (!msg.kind) return;\n for (const handler of this.handlers) {\n handler(msg);\n }\n } catch {\n // Ignore non-protocol messages\n }\n }\n\n get url(): string {\n return this._url;\n }\n\n get options(): FrameOptions | null {\n return this._options;\n }\n\n // FrameTransport interface\n\n create(url: string, options: FrameOptions): void {\n if (!isTrustedFrameUrl(url)) {\n throw new Error('Refusing to load frame: URL is not a trusted MoonPay origin');\n }\n\n this._url = url;\n this._options = options;\n // The actual WebView rendering is handled by React components.\n // This method stores the URL and options for the component to read.\n }\n\n sendMessage(message: ProtocolMessage): void {\n if (!this.webViewRef?.current) {\n throw new Error('Cannot send message: WebView not attached');\n }\n // Use the WebView ref's `postMessage` command rather than injecting\n // `window.postMessage`. The native command dispatches a MessageEvent with\n // `source === null` on `document` (Android) / `window` (iOS) — exactly what\n // the frame's receiver requires. An injected `window.postMessage` fires\n // only on `window` with a non-null `source`, so the frame drops it (missed\n // entirely on Android, rejected by the source guard on iOS).\n this.webViewRef.current.postMessage(JSON.stringify(message));\n }\n\n onMessage(handler: (msg: ProtocolMessage) => void): () => void {\n this.handlers.push(handler);\n return () => {\n const idx = this.handlers.indexOf(handler);\n if (idx >= 0) this.handlers.splice(idx, 1);\n };\n }\n\n dispose(): void {\n this.handlers.length = 0;\n this.webViewRef = null;\n this._url = '';\n this._options = null;\n }\n}\n","import { type CoreClient, createClientCore, type ThemeOptions } from '@moonpay/platform-sdk-core';\nimport {\n createContext,\n type ReactNode,\n useCallback,\n useContext,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { createRNClient, type RNClient } from './client.js';\nimport { MoonPayFrame } from './frame-component.js';\nimport type { SpecContext } from './frame-engine.js';\nimport { createMountSession, type FrameSlot } from './methods/mount-session.js';\nimport { VisibleFrameSlotSheet } from './VisibleFrameSlotSheet.js';\nimport { WebViewTransport } from './webview-transport.js';\n\n// ---------------------------------------------------------------------------\n// Context\n// ---------------------------------------------------------------------------\n\ninterface MoonPayContextValue {\n client: RNClient;\n /** @internal Consumed by the frame components. Undefined until a token is set. */\n sessionToken: string | undefined;\n /** @internal */\n core: CoreClient;\n /** @internal */\n frameBaseUrl?: string;\n /** @internal Client-level theme applied to every visible frame. */\n theme?: ThemeOptions;\n /** Set or replace the session token after mount. */\n initialize: (sessionToken: string) => void;\n /** True once a session token (via prop or `initialize()`) is available. */\n isInitialized: boolean;\n}\n\nconst MoonPayContext = createContext<MoonPayContextValue | null>(null);\n\n// ---------------------------------------------------------------------------\n// Provider\n// ---------------------------------------------------------------------------\n\nexport interface MoonPayProviderProps {\n /**\n * Session token from your server (via `createSession`). Optional — omit it and\n * call `initialize(sessionToken)` from `useMoonPay()` once you've fetched it.\n * When provided, this prop takes precedence over an imperatively-set token.\n */\n sessionToken?: string;\n apiBaseUrl?: string;\n frameBaseUrl?: string;\n /** Theme applied to every visible MoonPay frame (connect, widget, Apple/Google Pay, …). */\n theme?: ThemeOptions;\n children: ReactNode;\n}\n\nexport function MoonPayProvider({\n sessionToken: sessionTokenProp,\n apiBaseUrl,\n frameBaseUrl,\n theme,\n children,\n}: MoonPayProviderProps): JSX.Element {\n const [frameSlots, setFrameSlots] = useState<FrameSlot[]>([]);\n\n // Token supplied imperatively via initialize(). The prop takes precedence\n // when set, so controlled-prop and imperative usage both work; the effective\n // token below is the single source of truth for the client and frames.\n const [internalToken, setInternalToken] = useState<string | undefined>(undefined);\n const sessionToken = sessionTokenProp ?? internalToken;\n\n // Stable refs for addSlot/removeSlot so client methods don't re-create\n const addSlot = useCallback((slot: FrameSlot) => {\n setFrameSlots((prev) => [...prev, slot]);\n }, []);\n\n const removeSlot = useCallback((id: string) => {\n setFrameSlots((prev) => prev.filter((s) => s.id !== id));\n }, []);\n\n // Keep a ref to core so it's stable across renders\n const coreRef = useRef<CoreClient | null>(null);\n if (!coreRef.current) {\n coreRef.current = createClientCore({\n apiBaseUrl,\n frameBaseUrl,\n createTransport: () => new WebViewTransport(),\n });\n }\n const core = coreRef.current;\n\n // Set (or replace) the session token after mount. Clearing any credentials\n // from a previous session prevents a token swap (e.g. account switch) from\n // reusing the prior customer's accessToken/clientToken before the next\n // getConnection() repopulates them.\n const initialize = useCallback(\n (token: string) => {\n core.context.setAccessToken('');\n core.context.setClientToken('');\n setInternalToken(token);\n },\n [core],\n );\n\n // Depend on theme.appearance (not the object) so an inline `{ appearance }`\n // prop doesn't re-create the client every render.\n // biome-ignore lint/correctness/useExhaustiveDependencies: theme is captured via theme?.appearance\n const client = useMemo<RNClient>(() => {\n const specCtx: SpecContext = { sessionToken, core, frameBaseUrl, theme };\n return createRNClient({\n mountSession: createMountSession(specCtx, { addSlot, removeSlot }),\n core,\n });\n }, [sessionToken, frameBaseUrl, core, addSlot, removeSlot, theme?.appearance]);\n\n const isInitialized = sessionToken !== undefined;\n\n return (\n <MoonPayContext.Provider\n value={{ client, sessionToken, core, frameBaseUrl, theme, initialize, isInitialized }}\n >\n {children}\n {/* Hidden utility frames (check, buy, reset) — zero layout impact. */}\n {frameSlots\n .filter((slot) => slot.hidden)\n .map((slot) => (\n <MoonPayFrame key={slot.id} transport={slot.transport} hidden />\n ))}\n {/* SDK-presented frames take over the screen as a bottom sheet. One per\n slot — later frames (e.g. a challenge over a widget) stack on top.\n Dismissal (Android back, tapping the dimmed backdrop) stops the\n method's pending events, mirroring a customer abandoning the flow. */}\n {frameSlots\n .filter((slot) => !slot.hidden)\n .map((slot) => (\n <VisibleFrameSlotSheet\n key={slot.id}\n slot={slot}\n onClose={() => {\n slot.dispose();\n removeSlot(slot.id);\n }}\n />\n ))}\n </MoonPayContext.Provider>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Hook\n// ---------------------------------------------------------------------------\n\n/** @internal Used by the inline frame components. Not part of the public API. */\nexport function useMoonPayContext(): MoonPayContextValue {\n const ctx = useContext(MoonPayContext);\n if (!ctx) {\n throw new Error('useMoonPay must be used within a <MoonPayProvider>');\n }\n return ctx;\n}\n\nexport function useMoonPay(): {\n client: RNClient;\n /** Set or replace the session token after mount. */\n initialize: (sessionToken: string) => void;\n /** True once a session token (via prop or `initialize()`) is available. */\n isInitialized: boolean;\n} {\n const { client, initialize, isInitialized } = useMoonPayContext();\n return { client, initialize, isInitialized };\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as AddCardSdk from '@moonpay/platform-protocol/sdks/add-card';\nimport type { PresentationMode } from '@moonpay/platform-sdk-core';\nimport { addCardSpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface SetupAddCardOptions {\n /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */\n presentation?: PresentationMode;\n /** Callback for add-card frame lifecycle events. */\n onEvent?: (event: AddCardSdk.Event) => void;\n}\n\nexport interface AddCardFrame {\n dispose(): void;\n}\n\n// ------- setupAddCard -------\nexport async function setupAddCard(\n deps: MethodDeps,\n opts: SetupAddCardOptions,\n): Promise<Result<AddCardFrame, AddCardSdk.SetupError>> {\n try {\n const { handle, dispose } = await deps.mountSession(addCardSpec, {\n presentation: opts.presentation,\n });\n handle.onEvent((event) => opts.onEvent?.(event));\n return ok({ dispose });\n } catch (e) {\n return err({\n kind: 'genericError',\n message: e instanceof Error ? e.message : 'Add card setup failed',\n });\n }\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as ApplePaySdk from '@moonpay/platform-protocol/sdks/apple-pay';\nimport type { PresentationMode } from '@moonpay/platform-sdk-core';\nimport { applePaySpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface SetupApplePayOptions {\n /** Quote signature from getQuote(). */\n quote: string;\n /** Partner-assigned identifier for this transaction attempt. */\n externalTransactionId?: string;\n /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */\n presentation?: PresentationMode;\n /** Callback for Apple Pay lifecycle events. */\n onEvent?: (event: ApplePaySdk.Event) => void;\n}\n\nexport interface ApplePayFrame {\n /** Update the quote (e.g., after expiry). */\n setQuote(signature: string): void;\n dispose(): void;\n}\n\n// ------- setupApplePay -------\nexport async function setupApplePay(\n deps: MethodDeps,\n opts: SetupApplePayOptions,\n): Promise<Result<ApplePayFrame, ApplePaySdk.SetupError>> {\n try {\n const { handle, dispose } = await deps.mountSession(applePaySpec, {\n quote: opts.quote,\n externalTransactionId: opts.externalTransactionId,\n presentation: opts.presentation,\n });\n handle.onEvent((event) => opts.onEvent?.(event));\n return ok({ setQuote: handle.commands.setQuote, dispose });\n } catch (e) {\n return err({\n kind: 'genericError',\n message: e instanceof Error ? e.message : 'Apple Pay setup failed',\n });\n }\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as AuthSdk from '@moonpay/platform-protocol/sdks/auth';\nimport type { PresentationMode } from '@moonpay/platform-sdk-core';\nimport { FrameSessionDisposedError } from '../frame-engine.js';\nimport { authSpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface SetupAuthOptions {\n /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */\n presentation?: PresentationMode;\n /** Callback for auth frame lifecycle events. */\n onEvent?: (event: AuthSdk.Event) => void;\n}\n\nexport interface AuthFrame {\n dispose(): void;\n}\n\n// ------- setupAuth (visible frame) -------\nexport async function setupAuth(\n deps: MethodDeps,\n opts: SetupAuthOptions,\n): Promise<Result<AuthFrame, AuthSdk.SetupError>> {\n if (!deps.core.context.clientToken) {\n return err({\n kind: 'configurationError',\n message:\n 'No clientToken in context — call getConnection() first and ensure it resolved with status \"connectionRequired\".',\n });\n }\n\n try {\n const { handle, dispose } = await deps.mountSession(authSpec, {\n presentation: opts.presentation,\n });\n\n return await new Promise<Result<AuthFrame, AuthSdk.SetupError>>((resolve) => {\n handle.onEvent((event) => {\n opts.onEvent?.(event);\n if (event.kind === 'error') {\n // Resolve before dispose so the teardown notification below\n // doesn't win the race with the real error result.\n resolve(err({ kind: 'genericError', message: 'Auth frame error' }));\n dispose();\n }\n });\n // The auth spec only surfaces `complete` events for terminal-success\n // statuses; resolution must fire on ANY complete, so use raw messages.\n handle.onMessage((msg) => {\n if (msg.kind === 'complete') {\n resolve(ok({ dispose }));\n }\n });\n // Settle if the session is torn down before completing — e.g. the user\n // dismissed the SDK-presented frame. No-op once already resolved.\n handle.onDispose(() => {\n resolve(err({ kind: 'genericError', message: 'Auth flow dismissed' }));\n });\n });\n } catch (e) {\n // Dismissed while the frame was still loading (pre-handshake teardown).\n if (e instanceof FrameSessionDisposedError) {\n return err({ kind: 'genericError', message: 'Auth flow dismissed' });\n }\n return err({\n kind: 'genericError',\n message: e instanceof Error ? e.message : 'Auth setup failed',\n });\n }\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as BuySdk from '@moonpay/platform-protocol/sdks/buy';\nimport { buySpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface SetupBuyOptions {\n /** Quote signature from getQuote(). */\n quote: string;\n /** Partner-assigned identifier for this transaction attempt. */\n externalTransactionId?: string;\n /** Callback for buy frame lifecycle events. */\n onEvent?: (event: BuySdk.Event) => void;\n}\n\nexport interface BuyFrame {\n /** Update the quote (e.g., after expiry). */\n setQuote(signature: string): void;\n dispose(): void;\n}\n\n// ------- setupBuy (hidden frame) -------\nexport async function setupBuy(\n deps: MethodDeps,\n opts: SetupBuyOptions,\n): Promise<Result<BuyFrame, BuySdk.SetupError>> {\n try {\n const { handle, dispose } = await deps.mountSession(buySpec, {\n quote: opts.quote,\n externalTransactionId: opts.externalTransactionId,\n });\n handle.onEvent((event) => opts.onEvent?.(event));\n return ok({ setQuote: handle.commands.setQuote, dispose });\n } catch (e) {\n return err({\n kind: 'genericError',\n message: e instanceof Error ? e.message : 'Buy setup failed',\n });\n }\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as BuyButtonSdk from '@moonpay/platform-protocol/sdks/buy-button';\nimport type { PresentationMode } from '@moonpay/platform-sdk-core';\nimport { buyButtonSpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface SetupBuyButtonOptions {\n /** Quote signature from getQuote(). */\n quote: string;\n /** Partner-assigned identifier for this transaction attempt. */\n externalTransactionId?: string;\n /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */\n presentation?: PresentationMode;\n /** Callback for buy-button frame lifecycle events. */\n onEvent?: (event: BuyButtonSdk.Event) => void;\n}\n\nexport interface BuyButtonFrame {\n /** Update the quote (e.g., after expiry). */\n setQuote(signature: string): void;\n dispose(): void;\n}\n\n// ------- setupBuyButton -------\nexport async function setupBuyButton(\n deps: MethodDeps,\n opts: SetupBuyButtonOptions,\n): Promise<Result<BuyButtonFrame, BuyButtonSdk.SetupError>> {\n try {\n const { handle, dispose } = await deps.mountSession(buyButtonSpec, {\n quote: opts.quote,\n externalTransactionId: opts.externalTransactionId,\n presentation: opts.presentation,\n });\n handle.onEvent((event) => opts.onEvent?.(event));\n return ok({ setQuote: handle.commands.setQuote, dispose });\n } catch (e) {\n return err({\n kind: 'genericError',\n message: e instanceof Error ? e.message : 'Buy button setup failed',\n });\n }\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as ChallengeSdk from '@moonpay/platform-protocol/sdks/challenge';\nimport { isTrustedFrameUrl, type PresentationMode } from '@moonpay/platform-sdk-core';\nimport { challengeSpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface SetupChallengeOptions {\n /** Full challenge URL received from a frame's `challenge` event. */\n url: string;\n /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */\n presentation?: PresentationMode;\n /** Callback for challenge frame lifecycle events. */\n onEvent?: (event: ChallengeSdk.Event) => void;\n}\n\nexport interface ChallengeFrame {\n dispose(): void;\n}\n\n// ------- setupChallenge -------\nexport async function setupChallenge(\n deps: MethodDeps,\n opts: SetupChallengeOptions,\n): Promise<Result<ChallengeFrame, ChallengeSdk.SetupError>> {\n if (!isTrustedFrameUrl(opts.url)) {\n return err({\n kind: 'configurationError',\n message: 'Challenge URL must be served from a trusted MoonPay origin',\n });\n }\n\n try {\n const { handle, dispose } = await deps.mountSession(challengeSpec, {\n url: opts.url,\n presentation: opts.presentation,\n });\n handle.onEvent((event) => opts.onEvent?.(event));\n return ok({ dispose });\n } catch (e) {\n return err({\n kind: 'genericError',\n message: e instanceof Error ? e.message : 'Challenge setup failed',\n });\n }\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as ConnectSdk from '@moonpay/platform-protocol/sdks/connect';\nimport type { PresentationMode, ThemeOptions } from '@moonpay/platform-sdk-core';\nimport { FrameSessionDisposedError } from '../frame-engine.js';\nimport { connectSpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface ConnectOptions {\n /** Theme for this connect frame. Overrides the provider-level `theme`. */\n theme?: ThemeOptions;\n /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */\n presentation?: PresentationMode;\n /** Callback for connect lifecycle events. */\n onEvent?: (event: ConnectSdk.Event) => void;\n}\n\nexport interface ConnectFrame {\n dispose(): void;\n}\n\n// ------- connect (visible frame) -------\nexport async function connect(\n deps: MethodDeps,\n opts: ConnectOptions,\n): Promise<Result<ConnectFrame, ConnectSdk.ConnectError>> {\n try {\n const { handle, dispose } = await deps.mountSession(connectSpec, {\n theme: opts.theme,\n presentation: opts.presentation,\n });\n\n return await new Promise<Result<ConnectFrame, ConnectSdk.ConnectError>>((resolve) => {\n handle.onEvent((event) => {\n opts.onEvent?.(event);\n if (event.kind === 'error') {\n // Resolve before dispose so the teardown notification below\n // doesn't win the race with the real error result.\n resolve(err({ message: 'Connection error' }));\n dispose();\n } else if (event.kind === 'complete') {\n resolve(ok({ dispose }));\n }\n });\n // Settle if the session is torn down before completing — e.g. the user\n // dismissed the SDK-presented frame. No-op once already resolved.\n handle.onDispose(() => {\n resolve(err({ message: 'Connect flow dismissed' }));\n });\n });\n } catch (e) {\n // Dismissed while the frame was still loading (pre-handshake teardown).\n if (e instanceof FrameSessionDisposedError) {\n return err({ message: 'Connect flow dismissed' });\n }\n return err({\n message: e instanceof Error ? e.message : 'Connect failed',\n });\n }\n}\n","import type { Connection } from '@moonpay/platform-protocol/models/connection';\nimport type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as ConnectSdk from '@moonpay/platform-protocol/sdks/connect';\nimport { connectionCheckSpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface GetConnectionOptions {\n /**\n * Pass `true` for headless / Identity-API integrations so the check\n * frame opts out of KYC-based statuses. Legal (`termsAcceptanceRequired`)\n * is always surfaced regardless. Defaults to `false`.\n */\n skipKyc?: boolean;\n}\n\n// ------- getConnection (hidden frame) -------\nexport async function getConnection(\n deps: MethodDeps,\n options: GetConnectionOptions = {},\n): Promise<Result<Connection, ConnectSdk.GetConnectionError>> {\n try {\n const { handle, dispose } = await deps.mountSession(connectionCheckSpec, options);\n\n return await new Promise<Result<Connection, ConnectSdk.GetConnectionError>>((resolve) => {\n const timeout = setTimeout(() => {\n dispose();\n resolve(err({ message: 'Get connection timed out' }));\n }, 10_000);\n\n handle.onEvent((event) => {\n clearTimeout(timeout);\n dispose();\n if (event.kind === 'error') {\n resolve(err({ message: event.payload.message }));\n } else {\n resolve(ok(event.payload));\n }\n });\n });\n } catch (e) {\n return err({\n message: e instanceof Error ? e.message : 'Failed to check connection',\n });\n }\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { ok } from '@moonpay/platform-protocol/result';\nimport type { ResetConnectionError } from '@moonpay/platform-protocol/sdks/reset';\nimport { connectionResetSpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\n// ------- resetConnection (hidden frame) -------\nexport async function resetConnection(\n deps: MethodDeps,\n): Promise<Result<void, ResetConnectionError>> {\n try {\n const { handle, dispose } = await deps.mountSession(connectionResetSpec, {});\n\n return await new Promise<Result<void, ResetConnectionError>>((resolve) => {\n const timeout = setTimeout(() => {\n dispose();\n resolve(ok(undefined));\n }, 5_000);\n\n handle.onEvent(() => {\n clearTimeout(timeout);\n dispose();\n resolve(ok(undefined));\n });\n });\n } catch {\n return ok(undefined);\n }\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as CustomerExportSdk from '@moonpay/platform-protocol/sdks/customer-export';\nimport type { PresentationMode } from '@moonpay/platform-sdk-core';\nimport { customerExportSpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface SetupCustomerExportOptions {\n /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */\n presentation?: PresentationMode;\n /** Callback for customer-export frame lifecycle events. */\n onEvent?: (event: CustomerExportSdk.Event) => void;\n}\n\nexport interface CustomerExportFrame {\n dispose(): void;\n}\n\n// ------- setupCustomerExport -------\nexport async function setupCustomerExport(\n deps: MethodDeps,\n opts: SetupCustomerExportOptions,\n): Promise<Result<CustomerExportFrame, CustomerExportSdk.SetupError>> {\n try {\n const { handle, dispose } = await deps.mountSession(customerExportSpec, {\n presentation: opts.presentation,\n });\n handle.onEvent((event) => opts.onEvent?.(event));\n return ok({ dispose });\n } catch (e) {\n return err({\n kind: 'genericError',\n message: e instanceof Error ? e.message : 'Customer export setup failed',\n });\n }\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as GooglePaySdk from '@moonpay/platform-protocol/sdks/google-pay';\nimport type { PresentationMode } from '@moonpay/platform-sdk-core';\nimport { googlePaySpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface SetupGooglePayOptions {\n /** Quote signature from getQuote(). */\n quote: string;\n /** Partner-assigned identifier for this transaction attempt. */\n externalTransactionId?: string;\n /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */\n presentation?: PresentationMode;\n /** Callback for Google Pay lifecycle events. */\n onEvent?: (event: GooglePaySdk.Event) => void;\n}\n\nexport interface GooglePayFrame {\n /** Update the quote (e.g., after expiry). */\n setQuote(signature: string): void;\n dispose(): void;\n}\n\n// ------- setupGooglePay -------\nexport async function setupGooglePay(\n deps: MethodDeps,\n opts: SetupGooglePayOptions,\n): Promise<Result<GooglePayFrame, GooglePaySdk.SetupError>> {\n try {\n const { handle, dispose } = await deps.mountSession(googlePaySpec, {\n quote: opts.quote,\n externalTransactionId: opts.externalTransactionId,\n presentation: opts.presentation,\n });\n handle.onEvent((event) => opts.onEvent?.(event));\n return ok({ setQuote: handle.commands.setQuote, dispose });\n } catch (e) {\n return err({\n kind: 'genericError',\n message: e instanceof Error ? e.message : 'Google Pay setup failed',\n });\n }\n}\n","import type { Result } from '@moonpay/platform-protocol/result';\nimport { err, ok } from '@moonpay/platform-protocol/result';\nimport type * as WidgetSdk from '@moonpay/platform-protocol/sdks/widget';\nimport type { PresentationMode } from '@moonpay/platform-sdk-core';\nimport { widgetSpec } from '../frame-specs.js';\nimport type { MethodDeps } from './mount-session.js';\n\nexport interface SetupWidgetOptions {\n /** Quote signature from getQuote(). */\n quote: string;\n /** Partner-assigned identifier for this transaction attempt. */\n externalTransactionId?: string;\n /** Frame chrome. Defaults to the frame's own default (bare) when omitted. */\n presentation?: PresentationMode;\n /** Callback for widget lifecycle events. */\n onEvent?: (event: WidgetSdk.Event) => void;\n}\n\nexport interface WidgetFrame {\n dispose(): void;\n}\n\n// ------- setupWidget -------\nexport async function setupWidget(\n deps: MethodDeps,\n opts: SetupWidgetOptions,\n): Promise<Result<WidgetFrame, WidgetSdk.SetupError>> {\n try {\n const { handle, dispose } = await deps.mountSession(widgetSpec, {\n quote: opts.quote,\n externalTransactionId: opts.externalTransactionId,\n presentation: opts.presentation,\n });\n handle.onEvent((event) => opts.onEvent?.(event));\n return ok({ dispose });\n } catch (e) {\n return err({\n kind: 'genericError',\n message: e instanceof Error ? e.message : 'Widget setup failed',\n });\n }\n}\n","import type {\n GetQuoteParams,\n ListAssetsResponse,\n ListPaymentMethodsResponse,\n PaginationInfo,\n Quote,\n SimulateBankTransferParams,\n Transaction,\n TransactionWithStages,\n} from '@moonpay/platform-protocol/api';\nimport type { Customer } from '@moonpay/platform-protocol/api/customer';\nimport type {\n CreateIdentityError,\n DevPlatformApiError,\n GetAssetsError,\n GetCustomerError,\n GetCustomerUploadUrlError,\n GetIdentityError,\n GetIdentityUploadUrlError,\n GetPaymentMethodsError,\n GetQuoteError,\n GetTransactionsError,\n SimulateBankTransferError,\n SubmitCustomerFilesError,\n SubmitCustomerKycError,\n SubmitIdentityFilesError,\n UpdateIdentityError,\n VerifyIdentityError,\n} from '@moonpay/platform-protocol/api/errors';\nimport type {\n CreateIdentityRequestBody,\n Identity,\n IdentityFileUploadUrl,\n IdentityFileUploadUrlRequestBody,\n IdentityVerificationResponse,\n SubmitIdentityFilesRequestBody,\n UpdateIdentityRequestBody,\n} from '@moonpay/platform-protocol/api/identity';\nimport type { Connection } from '@moonpay/platform-protocol/models/connection';\nimport type { Result } from '@moonpay/platform-protocol/result';\nimport type * as AddCardSdk from '@moonpay/platform-protocol/sdks/add-card';\nimport type * as ApplePaySdk from '@moonpay/platform-protocol/sdks/apple-pay';\nimport type * as AuthSdk from '@moonpay/platform-protocol/sdks/auth';\nimport type * as BuySdk from '@moonpay/platform-protocol/sdks/buy';\nimport type * as BuyButtonSdk from '@moonpay/platform-protocol/sdks/buy-button';\nimport type * as ChallengeSdk from '@moonpay/platform-protocol/sdks/challenge';\nimport type * as ConnectSdk from '@moonpay/platform-protocol/sdks/connect';\nimport type * as CustomerExportSdk from '@moonpay/platform-protocol/sdks/customer-export';\nimport type * as GooglePaySdk from '@moonpay/platform-protocol/sdks/google-pay';\nimport type { ResetConnectionError } from '@moonpay/platform-protocol/sdks/reset';\nimport type * as WidgetSdk from '@moonpay/platform-protocol/sdks/widget';\nimport type { ListAssetsParams, ListTransactionsParams } from '@moonpay/platform-sdk-core';\nimport type { AddCardFrame, SetupAddCardOptions } from './methods/add-card.js';\nimport { setupAddCard } from './methods/add-card.js';\nimport type { ApplePayFrame, SetupApplePayOptions } from './methods/apple-pay.js';\nimport { setupApplePay } from './methods/apple-pay.js';\nimport type { AuthFrame, SetupAuthOptions } from './methods/auth.js';\nimport { setupAuth } from './methods/auth.js';\nimport type { BuyFrame, SetupBuyOptions } from './methods/buy.js';\nimport { setupBuy } from './methods/buy.js';\nimport type { BuyButtonFrame, SetupBuyButtonOptions } from './methods/buy-button.js';\nimport { setupBuyButton } from './methods/buy-button.js';\nimport type { ChallengeFrame, SetupChallengeOptions } from './methods/challenge.js';\nimport { setupChallenge } from './methods/challenge.js';\nimport type { ConnectFrame, ConnectOptions } from './methods/connect.js';\nimport { connect } from './methods/connect.js';\nimport type { GetConnectionOptions } from './methods/connection-check.js';\nimport { getConnection } from './methods/connection-check.js';\nimport { resetConnection } from './methods/connection-reset.js';\nimport type { CustomerExportFrame, SetupCustomerExportOptions } from './methods/customer-export.js';\nimport { setupCustomerExport } from './methods/customer-export.js';\nimport type { GooglePayFrame, SetupGooglePayOptions } from './methods/google-pay.js';\nimport { setupGooglePay } from './methods/google-pay.js';\nimport type { MethodDeps } from './methods/mount-session.js';\nimport type { SetupWidgetOptions, WidgetFrame } from './methods/widget.js';\nimport { setupWidget } from './methods/widget.js';\n\nexport type {\n AddCardFrame,\n ApplePayFrame,\n AuthFrame,\n BuyButtonFrame,\n BuyFrame,\n ChallengeFrame,\n ConnectFrame,\n ConnectOptions,\n CustomerExportFrame,\n GetConnectionOptions,\n GooglePayFrame,\n SetupAddCardOptions,\n SetupApplePayOptions,\n SetupAuthOptions,\n SetupBuyButtonOptions,\n SetupBuyOptions,\n SetupChallengeOptions,\n SetupCustomerExportOptions,\n SetupGooglePayOptions,\n SetupWidgetOptions,\n WidgetFrame,\n};\n\nexport interface RNClient {\n /**\n * Probe the customer's connection state via the headless check-connection\n * frame. Returns the `Connection` discriminated union and populates the\n * internal context with bootstrap `accessToken` / `clientToken` for any\n * status that carries credentials (`active`, `connectionRequired`).\n *\n * A `connectionRequired` result may carry `mismatch: true` when the\n * session's email and phone number resolve to different MoonPay\n * customers — partners can branch on it to route the customer through\n * Connect proactively, before rendering payment UI.\n */\n getConnection(\n options?: GetConnectionOptions,\n ): Promise<Result<Connection, ConnectSdk.GetConnectionError>>;\n connect(options: ConnectOptions): Promise<Result<ConnectFrame, ConnectSdk.ConnectError>>;\n /**\n * Launch the auth frame — the lighter-weight counterpart to `connect()`\n * for headless / Identity-API partners. Requires a `clientToken` to be\n * present in the client's context, which is populated automatically by a\n * prior `getConnection()` call that returned `connectionRequired`.\n * Call `getConnection()` first; if its status is `connectionRequired`,\n * call `setupAuth()` to drive the customer through email/OTP.\n */\n setupAuth(options: SetupAuthOptions): Promise<Result<AuthFrame, AuthSdk.SetupError>>;\n getPaymentMethods(): Promise<\n Result<{ data: ListPaymentMethodsResponse }, GetPaymentMethodsError>\n >;\n getQuote(params: GetQuoteParams): Promise<Result<{ data: Quote }, GetQuoteError>>;\n /**\n * Lists crypto assets (CeFi and DeFi) available for purchase. DeFi tokens are\n * returned with `status.verified: false`; quote them by `caip19` rather than `code`.\n */\n getAssets(params?: ListAssetsParams): Promise<Result<ListAssetsResponse, GetAssetsError>>;\n listTransactions(\n params?: ListTransactionsParams,\n ): Promise<Result<{ data: Transaction[]; pageInfo: PaginationInfo }, GetTransactionsError>>;\n getTransaction(\n id: string,\n ): Promise<Result<{ data: TransactionWithStages }, GetTransactionsError>>;\n /** Simulate bank-transfer settlement for a test-mode transaction (sandbox only). */\n simulateBankTransfer(\n id: string,\n params: SimulateBankTransferParams,\n ): Promise<Result<{ data: TransactionWithStages }, SimulateBankTransferError>>;\n setupWidget(options: SetupWidgetOptions): Promise<Result<WidgetFrame, WidgetSdk.SetupError>>;\n /** @deprecated Render <MoonPayApplePayButton> instead — it mounts inline where you place it. */\n setupApplePay(\n options: SetupApplePayOptions,\n ): Promise<Result<ApplePayFrame, ApplePaySdk.SetupError>>;\n setupBuy(options: SetupBuyOptions): Promise<Result<BuyFrame, BuySdk.SetupError>>;\n /** @deprecated Render <MoonPayBuyButton> instead — it mounts inline where you place it. */\n setupBuyButton(\n options: SetupBuyButtonOptions,\n ): Promise<Result<BuyButtonFrame, BuyButtonSdk.SetupError>>;\n /** @deprecated Render <MoonPayGooglePayButton> instead — it mounts inline where you place it. */\n setupGooglePay(\n options: SetupGooglePayOptions,\n ): Promise<Result<GooglePayFrame, GooglePaySdk.SetupError>>;\n deletePaymentMethod(id: string): Promise<Result<void, DevPlatformApiError>>;\n /**\n * Clears the customer's MoonPay connection for this partner by running the\n * reset frame. Resolves when the reset completes or times out (5s).\n * Call this after clearing your own local auth state (the client reference\n * can be captured before disposal since the session token is baked in).\n */\n resetConnection(): Promise<Result<void, ResetConnectionError>>;\n setupChallenge(\n options: SetupChallengeOptions,\n ): Promise<Result<ChallengeFrame, ChallengeSdk.SetupError>>;\n setupAddCard(options: SetupAddCardOptions): Promise<Result<AddCardFrame, AddCardSdk.SetupError>>;\n setupCustomerExport(\n options: SetupCustomerExportOptions,\n ): Promise<Result<CustomerExportFrame, CustomerExportSdk.SetupError>>;\n\n // Customer API\n getCustomer(id: string): Promise<Result<{ data: Customer }, GetCustomerError>>;\n submitCustomerKyc(\n id: string,\n body: UpdateIdentityRequestBody,\n ): Promise<Result<{ data: Customer }, SubmitCustomerKycError>>;\n getCustomerUploadUrl(\n id: string,\n body: IdentityFileUploadUrlRequestBody,\n ): Promise<Result<{ data: IdentityFileUploadUrl }, GetCustomerUploadUrlError>>;\n submitCustomerFiles(\n id: string,\n body: SubmitIdentityFilesRequestBody,\n ): Promise<Result<{ data: Customer }, SubmitCustomerFilesError>>;\n\n // Identity API — deprecated (DEVXP-1454), use the Customer API above instead\n /** @deprecated Customers are created automatically now — call `getCustomer` directly instead. */\n createIdentity(\n body: CreateIdentityRequestBody,\n ): Promise<Result<{ data: Identity | null }, CreateIdentityError>>;\n /** @deprecated Use `getCustomer` instead. */\n getIdentity(id: string): Promise<Result<{ data: Identity }, GetIdentityError>>;\n /** @deprecated Use `submitCustomerKyc` instead. */\n updateIdentity(\n id: string,\n body: UpdateIdentityRequestBody,\n ): Promise<Result<{ data: Identity }, UpdateIdentityError>>;\n /** @deprecated No longer needed — Customer API verification has no direct replacement call. */\n verifyIdentity(\n id: string,\n ): Promise<Result<{ data: IdentityVerificationResponse }, VerifyIdentityError>>;\n /** @deprecated Use `getCustomerUploadUrl` instead. */\n getIdentityUploadUrl(\n id: string,\n body: IdentityFileUploadUrlRequestBody,\n ): Promise<Result<{ data: IdentityFileUploadUrl }, GetIdentityUploadUrlError>>;\n /** @deprecated Use `submitCustomerFiles` instead. */\n submitIdentityFiles(\n id: string,\n body: SubmitIdentityFilesRequestBody,\n ): Promise<Result<{ data: Identity }, SubmitIdentityFilesError>>;\n}\n\nexport function createRNClient(deps: MethodDeps): RNClient {\n const { core } = deps;\n return {\n getConnection: (options) => getConnection(deps, options ?? {}),\n connect: (opts) => connect(deps, opts),\n setupAuth: (opts) => setupAuth(deps, opts),\n getPaymentMethods: () => core.getPaymentMethods(),\n getQuote: (params) => core.getQuote(params),\n getAssets: (params) => core.getAssets(params),\n listTransactions: (params) => core.listTransactions(params),\n getTransaction: (id) => core.getTransaction(id),\n simulateBankTransfer: (id, params) => core.simulateBankTransfer(id, params),\n setupWidget: (opts) => setupWidget(deps, opts),\n setupApplePay: (opts) => setupApplePay(deps, opts),\n setupBuy: (opts) => setupBuy(deps, opts),\n setupBuyButton: (opts) => setupBuyButton(deps, opts),\n setupGooglePay: (opts) => setupGooglePay(deps, opts),\n deletePaymentMethod: (id) => core.deletePaymentMethod(id),\n resetConnection: () => resetConnection(deps),\n setupChallenge: (opts) => setupChallenge(deps, opts),\n setupAddCard: (opts) => setupAddCard(deps, opts),\n setupCustomerExport: (opts) => setupCustomerExport(deps, opts),\n\n getCustomer: (id) => core.getCustomer(id),\n submitCustomerKyc: (id, body) => core.submitCustomerKyc(id, body),\n getCustomerUploadUrl: (id, body) => core.getCustomerUploadUrl(id, body),\n submitCustomerFiles: (id, body) => core.submitCustomerFiles(id, body),\n\n createIdentity: (body) => core.createIdentity(body),\n getIdentity: (id) => core.getIdentity(id),\n updateIdentity: (id, body) => core.updateIdentity(id, body),\n verifyIdentity: (id) => core.verifyIdentity(id),\n getIdentityUploadUrl: (id, body) => core.getIdentityUploadUrl(id, body),\n submitIdentityFiles: (id, body) => core.submitIdentityFiles(id, body),\n };\n}\n","import type { CoreClient } from '@moonpay/platform-sdk-core';\nimport {\n createFrameSession,\n type FrameSessionHandle,\n type FrameSpec,\n type SpecContext,\n} from '../frame-engine.js';\nimport type { RNFrameTransport } from '../webview-transport.js';\n\n// ---------------------------------------------------------------------------\n// Frame slot — represents a frame the provider needs to render\n// ---------------------------------------------------------------------------\n\nexport interface FrameSlot {\n id: string;\n transport: RNFrameTransport;\n hidden: boolean;\n /** Tear down the slot's frame session — safe to call before the handshake completes. */\n dispose(): void;\n}\n\nexport interface SlotHost {\n addSlot(slot: FrameSlot): void;\n removeSlot(id: string): void;\n}\n\nexport type MountSession = <E, P, C>(\n spec: FrameSpec<E, P, C>,\n props: P,\n) => Promise<{ handle: FrameSessionHandle<E, C>; dispose: () => void }>;\n\nexport interface MethodDeps {\n mountSession: MountSession;\n core: CoreClient;\n}\n\nlet slotCounter = 0;\n\nexport function createMountSession(specCtx: SpecContext, host: SlotHost): MountSession {\n return async function mountSession<E, P, C>(\n spec: FrameSpec<E, P, C>,\n props: P,\n ): Promise<{ handle: FrameSessionHandle<E, C>; dispose: () => void }> {\n const session = createFrameSession(spec, specCtx, props);\n const slotId = `slot-${++slotCounter}`;\n host.addSlot({\n id: slotId,\n transport: session.transport,\n hidden: session.hidden,\n dispose: () => session.dispose(),\n });\n try {\n const handle = await session.ready;\n return {\n handle,\n dispose: () => {\n handle.dispose();\n host.removeSlot(slotId);\n },\n };\n } catch (e) {\n host.removeSlot(slotId);\n throw e;\n }\n };\n}\n","import { useCallback, useEffect, useMemo, useRef, useState } from 'react';\nimport {\n ActivityIndicator,\n Animated,\n Easing,\n Modal,\n PanResponder,\n Platform,\n Pressable,\n StyleSheet,\n useWindowDimensions,\n View,\n} from 'react-native';\nimport { MoonPayFrame } from './frame-component.js';\nimport type { FrameSlot } from './methods/mount-session.js';\nimport { resolvePresentation, type SheetPhase } from './sheet-presentation.js';\n\n/**\n * How long to wait for the frame's `ready` before presenting the sheet anyway\n * (with a spinner). Wide enough that a frame which finishes without UI — e.g. a\n * frictionless challenge — completes inside the window and is dismissed before\n * the sheet is ever shown, avoiding a slide-up-then-down flash.\n */\nconst PRESENT_GRACE_MS = 3000;\n\n/**\n * Drives a sheet's translateY to `toValue`, mirroring the default animation of\n * @gorhom/react-native-bottom-sheet so the feel matches without taking the\n * dependency: an overdamped spring on iOS, and a 250ms Easing.out(Easing.exp)\n * timing on Android. (Those are gorhom's exact default configs.)\n */\nfunction animateSheet(value: Animated.Value, toValue: number, onDone?: Animated.EndCallback): void {\n const animation =\n Platform.OS === 'android'\n ? Animated.timing(value, {\n toValue,\n duration: 250,\n easing: Easing.out(Easing.exp),\n useNativeDriver: true,\n })\n : Animated.spring(value, {\n toValue,\n damping: 500,\n stiffness: 1000,\n mass: 3,\n overshootClamping: true,\n restDisplacementThreshold: 10,\n restSpeedThreshold: 10,\n useNativeDriver: true,\n });\n animation.start(onDone);\n}\n\n/**\n * Renders one SDK-presented frame as a dimmed bottom sheet that slides up\n * (and back down on dismiss) with a gorhom-matched animation, plus a backdrop\n * that fades in lockstep with the sheet position. Built on the Animated API\n * and a transparent <Modal> — no extra dependencies.\n *\n * NOTE: a React Native <Modal> is presented from the app-root view controller\n * and cannot appear above a react-native-screens native-stack modal. Launch\n * imperative frames from a non-modal screen (or use the declarative\n * <MoonPayConnect>/<MoonPayWidget> components, which render inline).\n */\nexport function VisibleFrameSlotSheet({\n slot,\n onClose,\n}: {\n slot: FrameSlot;\n onClose: () => void;\n}): JSX.Element {\n const { height } = useWindowDimensions();\n const sheetHeight = Math.round(height * 0.9);\n // Sheet offset from its resting position: starts fully off-screen (hidden).\n const translateY = useRef(new Animated.Value(sheetHeight)).current;\n // The frame's WebView stays mounted (it must load to emit `ready`), but is\n // covered by a spinner until the frame reports its UI is ready to show.\n const [frameReady, setFrameReady] = useState(false);\n // Drives the backdrop's pointerEvents: while hidden the (transparent) modal\n // must not intercept taps meant for the app underneath.\n const [presented, setPresented] = useState(false);\n // Single source of truth for the present/dismiss decision (see sheet-presentation).\n const phaseRef = useRef<SheetPhase>('hidden');\n // Latest onClose, read through a ref so `close` stays referentially stable.\n const onCloseRef = useRef(onClose);\n onCloseRef.current = onClose;\n const closingRef = useRef(false);\n\n // Slide down, then tear the slot down once the exit animation settles.\n // Guarded so a `complete` auto-dismiss and a manual dismiss can't double-fire.\n const close = useCallback(() => {\n if (closingRef.current) return;\n closingRef.current = true;\n // Mark closed so a racing `terminal` signal can't re-trigger teardown.\n phaseRef.current = 'closed';\n animateSheet(translateY, sheetHeight, ({ finished }) => {\n if (finished) onCloseRef.current();\n });\n }, [translateY, sheetHeight]);\n\n // Drag-to-dismiss, attached only to the handle (see `panHandlers` below) so\n // the frame's own content stays scrollable/tappable. Drives the SAME\n // `translateY` as the open/close animation, so there's one source of truth.\n const panResponder = useMemo(\n () =>\n PanResponder.create({\n // Claim the gesture only for a clearly downward drag — never on a tap\n // (so the handle's onPress still fires) or a mostly-horizontal swipe.\n onMoveShouldSetPanResponder: (_evt, { dy, dx }) => dy > 5 && dy > Math.abs(dx),\n onPanResponderGrant: () => {\n // The sheet may be mid open/close animation. `stopAnimation` halts it\n // AND flushes the native-driven value back to JS; folding that into\n // the offset means the drag is relative to where the sheet actually\n // sits right now, so re-grabbing never makes it jump.\n translateY.stopAnimation(() => {\n translateY.extractOffset();\n });\n },\n // Track the finger downward; clamp upward travel to the open position.\n onPanResponderMove: (_evt, { dy }) => {\n translateY.setValue(Math.max(0, dy));\n },\n onPanResponderRelease: (_evt, { dy, vy }) => {\n // Re-flatten so `translateY` is a single absolute value again before\n // we hand it back to the spring/timing animation.\n translateY.flattenOffset();\n const draggedPastThreshold = dy > sheetHeight * 0.35;\n const flungDownFast = vy > 0.5;\n if (draggedPastThreshold || flungDownFast) {\n close();\n } else {\n animateSheet(translateY, 0);\n }\n },\n // Another responder stole the gesture: settle to a known state.\n onPanResponderTerminate: () => {\n translateY.flattenOffset();\n animateSheet(translateY, 0);\n },\n }),\n [translateY, sheetHeight, close],\n );\n\n // Apply a presentation signal: slide up, lift the spinner, dismiss silently,\n // or animate closed — per the pure decision in resolvePresentation.\n const dispatch = useCallback(\n (signal: 'ready' | 'grace' | 'terminal') => {\n const result = resolvePresentation(phaseRef.current, signal);\n phaseRef.current = result.phase;\n if (result.present) {\n setPresented(true);\n animateSheet(translateY, 0);\n }\n if (result.liftSpinner) setFrameReady(true);\n if (result.dismissSilent) onCloseRef.current();\n if (result.close) close();\n },\n [translateY, close],\n );\n\n // Present anyway once the grace window elapses, so a slow-loading frame (or\n // one that never sends `ready`) is never stranded off-screen.\n useEffect(() => {\n const timer = setTimeout(() => dispatch('grace'), PRESENT_GRACE_MS);\n return () => clearTimeout(timer);\n }, [dispatch]);\n\n // `ready` reveals the frame; a terminal message (`complete`/`error`) either\n // dismisses silently (if we never presented) or animates the sheet closed —\n // both without the partner having to call dispose.\n useEffect(() => {\n const unsubscribe = slot.transport.onMessage((msg) => {\n if (msg.kind === 'ready') dispatch('ready');\n else if (msg.kind === 'complete' || msg.kind === 'error') dispatch('terminal');\n });\n return unsubscribe;\n }, [slot.transport, dispatch]);\n\n // Backdrop dims in step with the sheet position.\n const backdropOpacity = translateY.interpolate({\n inputRange: [0, sheetHeight],\n outputRange: [1, 0],\n extrapolate: 'clamp',\n });\n\n return (\n <Modal visible transparent animationType=\"none\" onRequestClose={close}>\n {/* Until presented the sheet is off-screen and the backdrop transparent;\n pass taps through so the ~grace window doesn't freeze the app. */}\n <View style={styles.root} pointerEvents={presented ? 'auto' : 'none'}>\n <Animated.View style={[styles.backdrop, { opacity: backdropOpacity }]}>\n {/* Tap outside the sheet to dismiss. */}\n <Pressable\n style={StyleSheet.absoluteFill}\n accessibilityRole=\"button\"\n accessibilityLabel=\"Close\"\n onPress={close}\n />\n </Animated.View>\n <Animated.View style={[styles.sheet, { height: sheetHeight, transform: [{ translateY }] }]}>\n <MoonPayFrame transport={slot.transport} />\n {!frameReady && (\n <View style={styles.loading}>\n <ActivityIndicator size=\"large\" color=\"#000\" />\n </View>\n )}\n {/* Drag bar: pull down to dismiss. PanResponder lives on this strip\n only, so the frame below stays scrollable/tappable. A nested\n Pressable keeps a tap-to-close (and screen-reader) affordance. */}\n <View style={styles.handleArea} {...panResponder.panHandlers}>\n <Pressable\n onPress={close}\n accessibilityRole=\"button\"\n accessibilityLabel=\"Close\"\n hitSlop={12}\n >\n <View style={styles.handleBar} />\n </Pressable>\n </View>\n </Animated.View>\n </View>\n </Modal>\n );\n}\n\nconst styles = StyleSheet.create({\n root: {\n flex: 1,\n justifyContent: 'flex-end',\n },\n // Dimmed backdrop covering the whole screen; fades with the sheet position.\n backdrop: {\n ...StyleSheet.absoluteFillObject,\n backgroundColor: 'rgba(0, 0, 0, 0.5)',\n },\n // Bottom sheet: ~90% of the screen (height applied inline), rounded top\n // corners. The 10% gap keeps the frame clear of the status bar / notch\n // without depending on react-native-safe-area-context.\n sheet: {\n backgroundColor: '#fff',\n borderTopLeftRadius: 24,\n borderTopRightRadius: 24,\n overflow: 'hidden',\n },\n // Opaque cover with a centered spinner, shown until the frame is ready.\n loading: {\n ...StyleSheet.absoluteFillObject,\n backgroundColor: '#fff',\n alignItems: 'center',\n justifyContent: 'center',\n },\n // Drag-to-dismiss strip pinned across the top of the sheet, floating over the\n // frame. Tall enough to be an easy grab target without eating much of the UI.\n handleArea: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n height: 28,\n alignItems: 'center',\n justifyContent: 'center',\n zIndex: 1,\n elevation: 2,\n },\n // The visible pill.\n handleBar: {\n width: 36,\n height: 5,\n borderRadius: 3,\n backgroundColor: 'rgba(0, 0, 0, 0.2)',\n },\n});\n","/**\n * Pure decision logic for when an SDK-presented frame's bottom sheet should\n * slide up, lift its loading spinner, or tear down — kept out of the component\n * so it can be unit-tested without a render harness.\n *\n * The sheet races three signals to decide whether to present at all:\n * - `ready` — the frame reported its UI is painted; reveal it.\n * - `grace` — a fallback timer fired; present with the spinner so a frame\n * that loads slowly (or never sends `ready`) is never stuck\n * invisible.\n * - `terminal` — the frame emitted `complete`/`error`. If this arrives BEFORE\n * the sheet was ever presented, the flow finished without\n * needing UI (e.g. a frictionless challenge), so we dismiss\n * silently instead of flashing the sheet up and back down.\n */\nexport type SheetPhase = 'hidden' | 'presented' | 'closed';\nexport type PresentationSignal = 'ready' | 'grace' | 'terminal';\n\nexport interface PresentationResult {\n /** Phase after applying the signal. */\n phase: SheetPhase;\n /** Slide the sheet up. Only set on the hidden → presented edge. */\n present: boolean;\n /** Hide the loading spinner cover (the frame's own UI is ready). */\n liftSpinner: boolean;\n /** Tear down without animation — the frame finished before it was ever shown. */\n dismissSilent: boolean;\n /** Animate the sheet down, then tear down. */\n close: boolean;\n}\n\nconst NOOP = {\n present: false,\n liftSpinner: false,\n dismissSilent: false,\n close: false,\n} as const;\n\nexport function resolvePresentation(\n phase: SheetPhase,\n signal: PresentationSignal,\n): PresentationResult {\n if (phase === 'closed') return { phase: 'closed', ...NOOP };\n\n switch (signal) {\n case 'ready':\n // Reveal the frame; also present it if the grace timer hadn't yet.\n return { ...NOOP, phase: 'presented', present: phase === 'hidden', liftSpinner: true };\n case 'grace':\n if (phase === 'presented') return { phase: 'presented', ...NOOP };\n return { ...NOOP, phase: 'presented', present: true };\n case 'terminal':\n if (phase === 'hidden') return { ...NOOP, phase: 'closed', dismissSilent: true };\n return { ...NOOP, phase: 'closed', close: true };\n }\n}\n","import type * as AddCardSdk from '@moonpay/platform-protocol/sdks/add-card';\nimport type { ViewStyle } from 'react-native';\nimport { addCardSpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayAddCardProps {\n /** Callback for add-card lifecycle events. */\n onEvent?: (event: AddCardSdk.Event) => void;\n /** Container style. Defaults to flex: 1. */\n style?: ViewStyle;\n}\n\n/** Inline add-card frame — embed card entry in your own layout/animation. */\nexport function MoonPayAddCard({ onEvent, style }: MoonPayAddCardProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={addCardSpec}\n props={{}}\n style={style}\n defaultStyle={{ flex: 1 }}\n onEvent={onEvent}\n />\n );\n}\n","import type * as ApplePaySdk from '@moonpay/platform-protocol/sdks/apple-pay';\nimport type { ViewStyle } from 'react-native';\nimport { applePaySpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayApplePayButtonProps {\n /** Quote signature from getQuote(). Reactive — updates are pushed via setQuote without remounting. */\n quote: string;\n /** Partner-assigned identifier for this transaction attempt. Mount-time only. */\n externalTransactionId?: string;\n /** Callback for Apple Pay lifecycle events. */\n onEvent?: (event: ApplePaySdk.Event) => void;\n /** Container style. Defaults to height 48. */\n style?: ViewStyle;\n}\n\n/** Inline Apple Pay button. Render it wherever it should appear in your layout. */\nexport function MoonPayApplePayButton({\n quote,\n externalTransactionId,\n onEvent,\n style,\n}: MoonPayApplePayButtonProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={applePaySpec}\n props={{ quote, externalTransactionId }}\n style={style}\n defaultStyle={{ height: 48 }}\n onEvent={onEvent}\n />\n );\n}\n","import type * as AuthSdk from '@moonpay/platform-protocol/sdks/auth';\nimport type { ViewStyle } from 'react-native';\nimport { authSpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayAuthProps {\n /** Callback for auth lifecycle events. */\n onEvent?: (event: AuthSdk.Event) => void;\n /** Container style. Defaults to flex: 1. */\n style?: ViewStyle;\n}\n\n/**\n * Inline auth frame for headless / Identity-API integrations. Requires a clientToken in context —\n * call getConnection() (or render <MoonPayConnectionCheck>) first; if it resolves with\n * `connectionRequired`, mount this component. Emits an error event otherwise.\n */\nexport function MoonPayAuth({ onEvent, style }: MoonPayAuthProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={authSpec}\n props={{}}\n style={style}\n defaultStyle={{ flex: 1 }}\n onEvent={onEvent}\n />\n );\n}\n","import type * as BuyButtonSdk from '@moonpay/platform-protocol/sdks/buy-button';\nimport type { ViewStyle } from 'react-native';\nimport { buyButtonSpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayBuyButtonProps {\n /** Quote signature from getQuote(). Reactive — updates are pushed via setQuote without remounting. */\n quote: string;\n /** Partner-assigned identifier for this transaction attempt. Mount-time only. */\n externalTransactionId?: string;\n /** Callback for buy button lifecycle events. */\n onEvent?: (event: BuyButtonSdk.Event) => void;\n /** Container style. Defaults to height 48. */\n style?: ViewStyle;\n}\n\n/** Inline card/buy button. Render it wherever it should appear in your layout. */\nexport function MoonPayBuyButton({\n quote,\n externalTransactionId,\n onEvent,\n style,\n}: MoonPayBuyButtonProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={buyButtonSpec}\n props={{ quote, externalTransactionId }}\n style={style}\n defaultStyle={{ height: 48 }}\n onEvent={onEvent}\n />\n );\n}\n","import type * as BuySdk from '@moonpay/platform-protocol/sdks/buy';\nimport { buySpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayBuyFrameProps {\n /** Quote signature from getQuote(). Reactive — updates are pushed via setQuote without remounting. */\n quote: string;\n /** Partner-assigned identifier for this transaction attempt. Mount-time only. */\n externalTransactionId?: string;\n /** Callback for buy frame lifecycle events. */\n onEvent?: (event: BuySdk.Event) => void;\n}\n\n/** Headless buy frame (renders nothing visible). The declarative alternative to client.setupBuy(). */\nexport function MoonPayBuyFrame({\n quote,\n externalTransactionId,\n onEvent,\n}: MoonPayBuyFrameProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={buySpec}\n props={{ quote, externalTransactionId }}\n defaultStyle={{}}\n onEvent={onEvent}\n />\n );\n}\n","import type * as ChallengeSdk from '@moonpay/platform-protocol/sdks/challenge';\nimport type { ViewStyle } from 'react-native';\nimport { challengeSpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayChallengeProps {\n /** Full challenge URL received from a frame's `challenge` event. Mount-time only. */\n url: string;\n /** Callback for challenge lifecycle events. */\n onEvent?: (event: ChallengeSdk.Event) => void;\n /** Container style. Defaults to flex: 1. */\n style?: ViewStyle;\n}\n\n/** Inline 3DS/challenge frame. Mount it when a payment frame emits a `challenge` event. */\nexport function MoonPayChallenge({ url, onEvent, style }: MoonPayChallengeProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={challengeSpec}\n props={{ url }}\n style={style}\n defaultStyle={{ flex: 1 }}\n onEvent={onEvent}\n />\n );\n}\n","import type * as ConnectSdk from '@moonpay/platform-protocol/sdks/connect';\nimport type { ThemeOptions } from '@moonpay/platform-sdk-core';\nimport type { ViewStyle } from 'react-native';\nimport { connectSpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayConnectProps {\n /** Theme for this connect frame. Overrides the provider-level `theme`. Mount-time only. */\n theme?: ThemeOptions;\n /** Callback for connect lifecycle events. */\n onEvent?: (event: ConnectSdk.Event) => void;\n /** Container style. Defaults to flex: 1. */\n style?: ViewStyle;\n}\n\n/** Inline connect frame. On an active completion, credentials are applied to the shared client automatically. */\nexport function MoonPayConnect({ theme, onEvent, style }: MoonPayConnectProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={connectSpec}\n props={{ theme }}\n style={style}\n defaultStyle={{ flex: 1 }}\n onEvent={onEvent}\n />\n );\n}\n","import type { ConnectionCheckEvent } from '../frame-specs.js';\nimport { connectionCheckSpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayConnectionCheckProps {\n /** Pass `true` for headless / Identity-API integrations. Mount-time only. */\n skipKyc?: boolean;\n /** Emits `complete` with the Connection, or `error`. */\n onEvent?: (event: ConnectionCheckEvent) => void;\n}\n\n/**\n * Headless connection check (renders nothing visible). The declarative\n * alternative to client.getConnection() — on an active connection,\n * credentials are applied to the shared client automatically.\n */\nexport function MoonPayConnectionCheck({\n skipKyc,\n onEvent,\n}: MoonPayConnectionCheckProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={connectionCheckSpec}\n props={{ skipKyc }}\n defaultStyle={{}}\n onEvent={onEvent}\n />\n );\n}\n","import type { ConnectionResetEvent } from '../frame-specs.js';\nimport { connectionResetSpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayConnectionResetProps {\n /** Callback for connection reset lifecycle events. */\n onEvent?: (event: ConnectionResetEvent) => void;\n}\n\n/** Headless reset frame (renders nothing visible). The declarative alternative to client.resetConnection(). */\nexport function MoonPayConnectionReset({ onEvent }: MoonPayConnectionResetProps): JSX.Element {\n return (\n <MoonPayFrameView spec={connectionResetSpec} props={{}} defaultStyle={{}} onEvent={onEvent} />\n );\n}\n","import type * as CustomerExportSdk from '@moonpay/platform-protocol/sdks/customer-export';\nimport type { ViewStyle } from 'react-native';\nimport { customerExportSpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayCustomerExportProps {\n /** Callback for customer-export lifecycle events. */\n onEvent?: (event: CustomerExportSdk.Event) => void;\n /** Container style. Defaults to flex: 1. */\n style?: ViewStyle;\n}\n\n/** Inline customer-export consent frame — embed export consent capture in your own layout. */\nexport function MoonPayCustomerExport({ onEvent, style }: MoonPayCustomerExportProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={customerExportSpec}\n props={{}}\n style={style}\n defaultStyle={{ flex: 1 }}\n onEvent={onEvent}\n />\n );\n}\n","import type * as GooglePaySdk from '@moonpay/platform-protocol/sdks/google-pay';\nimport type { ViewStyle } from 'react-native';\nimport { googlePaySpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayGooglePayButtonProps {\n /** Quote signature from getQuote(). Reactive — updates are pushed via setQuote without remounting. */\n quote: string;\n /** Partner-assigned identifier for this transaction attempt. Mount-time only. */\n externalTransactionId?: string;\n /** Callback for Google Pay lifecycle events. */\n onEvent?: (event: GooglePaySdk.Event) => void;\n /** Container style. Defaults to height 48. */\n style?: ViewStyle;\n}\n\n/** Inline Google Pay button. Render it wherever it should appear in your layout. */\nexport function MoonPayGooglePayButton({\n quote,\n externalTransactionId,\n onEvent,\n style,\n}: MoonPayGooglePayButtonProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={googlePaySpec}\n props={{ quote, externalTransactionId }}\n style={style}\n defaultStyle={{ height: 48 }}\n onEvent={onEvent}\n />\n );\n}\n","import type * as WidgetSdk from '@moonpay/platform-protocol/sdks/widget';\nimport type { ViewStyle } from 'react-native';\nimport { widgetSpec } from '../frame-specs.js';\nimport { MoonPayFrameView } from '../frame-view.js';\n\nexport interface MoonPayWidgetProps {\n /** Quote signature from getQuote(). Mount-time only — changing it reloads the widget. */\n quote: string;\n /** Partner-assigned identifier for this transaction attempt. Mount-time only. */\n externalTransactionId?: string;\n /** Callback for widget lifecycle events. */\n onEvent?: (event: WidgetSdk.Event) => void;\n /** Container style. Defaults to flex: 1. */\n style?: ViewStyle;\n}\n\n/** Inline widget frame. Render it wherever it should appear in your layout. */\nexport function MoonPayWidget({\n quote,\n externalTransactionId,\n onEvent,\n style,\n}: MoonPayWidgetProps): JSX.Element {\n return (\n <MoonPayFrameView\n spec={widgetSpec}\n props={{ quote, externalTransactionId }}\n style={style}\n defaultStyle={{ flex: 1 }}\n onEvent={onEvent}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA4BA,IAAAA,qBAAiC;;;ACjBjC,wBAGO;AAaP,+BASO;AAYA,SAAS,oBACd,MACA,WACe;AACf,SAAO;AAAA,IACL,UAAU,CAAC,cACT,KAAK;AAAA,MACH,SAAS;AAAA,MACT,MAAM,EAAE,UAAU;AAAA,MAClB,MAAM;AAAA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AA,MACxB;AAAA;AAAA,EACF;AAEJ;;;ACCI,IAAAC,uBAAA;AAPG,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAA6C;AAC3C,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN,OAAO,EAAE,OAAO,sBAAsB;AAAA,MACtC;AAAA,MACA,cAAc,EAAE,QAAQ,GAAG;AAAA,MAC3B;AAAA;AAAA,EACF;AAEJ;;;ACRI,IAAAC,uBAAA;AAPG,SAAS,cAAc;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAoC;AAClC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM;AAAA,MACN,OAAO,EAAE,OAAO,sBAAsB;AAAA,MACtC;AAAA,MACA,cAAc,EAAE,MAAM,EAAE;AAAA,MACxB;AAAA;AAAA,EACF;AAEJ;","names":["import_connection","import_react","import_react_native","WebView","import_platform_sdk_core","import_platform_sdk_core","import_platform_sdk_core","import_react","import_result","import_result","import_result","import_result","import_result","import_platform_sdk_core","import_result","import_result","import_result","import_result","import_result","import_result","import_react","import_react_native","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime","import_jsx_runtime"]}
|