@funkit/connect-rn 11.2.0 → 11.3.0

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.
Files changed (98) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/dist/index.js +24464 -19856
  3. package/dist/index.js.map +4 -4
  4. package/dist/preview.js +4 -4
  5. package/dist/preview.js.map +1 -1
  6. package/dist/src/fiat/kyc/kycForm.d.ts +1 -0
  7. package/dist/src/fiat/kyc/kycForm.d.ts.map +1 -1
  8. package/dist/src/fiat/kyc/useKycScreens.d.ts +1 -0
  9. package/dist/src/fiat/kyc/useKycScreens.d.ts.map +1 -1
  10. package/dist/src/fiat/providerFlow.d.ts +5 -1
  11. package/dist/src/fiat/providerFlow.d.ts.map +1 -1
  12. package/dist/src/fiat/providerFlows.d.ts.map +1 -1
  13. package/dist/src/fiat/providerHandoff.d.ts +4 -1
  14. package/dist/src/fiat/providerHandoff.d.ts.map +1 -1
  15. package/dist/src/fiat/providers/adapter.d.ts +2 -0
  16. package/dist/src/fiat/providers/adapter.d.ts.map +1 -1
  17. package/dist/src/fiat/providers/applePayPaintGate.d.ts +4 -0
  18. package/dist/src/fiat/providers/applePayPaintGate.d.ts.map +1 -1
  19. package/dist/src/fiat/providers/checkout/useFiatNextApi.d.ts +4 -2
  20. package/dist/src/fiat/providers/checkout/useFiatNextApi.d.ts.map +1 -1
  21. package/dist/src/fiat/providers/coinbase/next/useCoinbaseCheckout.d.ts +1 -1
  22. package/dist/src/fiat/providers/coinbase/next/useCoinbaseCheckout.d.ts.map +1 -1
  23. package/dist/src/fiat/providers/moonpay/errors.d.ts +2 -1
  24. package/dist/src/fiat/providers/moonpay/errors.d.ts.map +1 -1
  25. package/dist/src/fiat/providers/moonpay/events.d.ts +4 -0
  26. package/dist/src/fiat/providers/moonpay/events.d.ts.map +1 -1
  27. package/dist/src/fiat/providers/moonpay/fullCheckout/Checkout.d.ts +4 -0
  28. package/dist/src/fiat/providers/moonpay/fullCheckout/Checkout.d.ts.map +1 -0
  29. package/dist/src/fiat/providers/moonpay/fullCheckout/checkoutScreens.d.ts +12 -0
  30. package/dist/src/fiat/providers/moonpay/fullCheckout/checkoutScreens.d.ts.map +1 -0
  31. package/dist/src/fiat/providers/moonpay/fullCheckout/connection.d.ts.map +1 -0
  32. package/dist/src/fiat/providers/moonpay/fullCheckout/useCheckoutCalls.d.ts.map +1 -0
  33. package/dist/src/fiat/providers/moonpay/{useCheckoutModel.d.ts → fullCheckout/useCheckoutModel.d.ts} +11 -9
  34. package/dist/src/fiat/providers/moonpay/fullCheckout/useCheckoutModel.d.ts.map +1 -0
  35. package/dist/src/fiat/providers/moonpay/guestCheckout/Checkout.d.ts +4 -0
  36. package/dist/src/fiat/providers/moonpay/guestCheckout/Checkout.d.ts.map +1 -0
  37. package/dist/src/fiat/providers/moonpay/guestCheckout/GuestPhone.d.ts +24 -0
  38. package/dist/src/fiat/providers/moonpay/guestCheckout/GuestPhone.d.ts.map +1 -0
  39. package/dist/src/fiat/providers/moonpay/guestCheckout/checkoutScreens.d.ts +7 -0
  40. package/dist/src/fiat/providers/moonpay/guestCheckout/checkoutScreens.d.ts.map +1 -0
  41. package/dist/src/fiat/providers/moonpay/guestCheckout/connection.d.ts +18 -0
  42. package/dist/src/fiat/providers/moonpay/guestCheckout/connection.d.ts.map +1 -0
  43. package/dist/src/fiat/providers/moonpay/guestCheckout/useCheckoutCalls.d.ts +13 -0
  44. package/dist/src/fiat/providers/moonpay/guestCheckout/useCheckoutCalls.d.ts.map +1 -0
  45. package/dist/src/fiat/providers/moonpay/guestCheckout/useGuestCheck.d.ts +34 -0
  46. package/dist/src/fiat/providers/moonpay/guestCheckout/useGuestCheck.d.ts.map +1 -0
  47. package/dist/src/fiat/providers/moonpay/guestCheckout/useGuestCheckoutModel.d.ts +66 -0
  48. package/dist/src/fiat/providers/moonpay/guestCheckout/useGuestCheckoutModel.d.ts.map +1 -0
  49. package/dist/src/fiat/providers/moonpay/index.d.ts +2 -0
  50. package/dist/src/fiat/providers/moonpay/index.d.ts.map +1 -1
  51. package/dist/src/fiat/providers/moonpay/moonpayPaymentDisclosures.d.ts +18 -4
  52. package/dist/src/fiat/providers/moonpay/moonpayPaymentDisclosures.d.ts.map +1 -1
  53. package/dist/src/fiat/providers/moonpay/sdk/deviceQuote.d.ts.map +1 -1
  54. package/dist/src/fiat/providers/moonpay/useReadiness.d.ts.map +1 -1
  55. package/dist/src/fiat/providers/stripe/next/Checkout.d.ts +1 -1
  56. package/dist/src/fiat/providers/stripe/next/Checkout.d.ts.map +1 -1
  57. package/dist/src/fiat/providers/stripe/next/useStripeCheckout.d.ts +14 -5
  58. package/dist/src/fiat/providers/stripe/next/useStripeCheckout.d.ts.map +1 -1
  59. package/dist/src/fiat/providers/stripe/next/useStripeCheckoutCalls.d.ts.map +1 -1
  60. package/dist/src/fiat/providers/stripe/next/useStripeKycForm.d.ts +23 -4
  61. package/dist/src/fiat/providers/stripe/next/useStripeKycForm.d.ts.map +1 -1
  62. package/dist/src/fiat/providers/stripe/next/useStripeOrderSlot.d.ts +3 -1
  63. package/dist/src/fiat/providers/stripe/next/useStripeOrderSlot.d.ts.map +1 -1
  64. package/dist/src/fiat/providers/stripe/next/useStripePayment.d.ts +5 -1
  65. package/dist/src/fiat/providers/stripe/next/useStripePayment.d.ts.map +1 -1
  66. package/dist/src/fiat/providers/stripe/stripeAccountCreation.d.ts +16 -0
  67. package/dist/src/fiat/providers/stripe/stripeAccountCreation.d.ts.map +1 -1
  68. package/dist/src/fiat/providers/stripe/stripeApplePaySelection.d.ts +34 -15
  69. package/dist/src/fiat/providers/stripe/stripeApplePaySelection.d.ts.map +1 -1
  70. package/dist/src/fiat/providers/stripe/stripePayment.d.ts +6 -2
  71. package/dist/src/fiat/providers/stripe/stripePayment.d.ts.map +1 -1
  72. package/dist/src/fiat/providers/stripe/useApplePayFirst.d.ts +17 -6
  73. package/dist/src/fiat/providers/stripe/useApplePayFirst.d.ts.map +1 -1
  74. package/dist/src/fiat/providers/stripe/useStripeState.d.ts.map +1 -1
  75. package/dist/src/fiat/useProviderCheckout.d.ts.map +1 -1
  76. package/dist/src/flow/DepositFlowContent.d.ts.map +1 -1
  77. package/dist/src/flow/Drawer.d.ts.map +1 -1
  78. package/dist/src/flow/FiatDepositAmountStep.d.ts.map +1 -1
  79. package/dist/src/flow/FlowSheet.d.ts.map +1 -1
  80. package/dist/src/flow/FunkitFlowProvider.d.ts.map +1 -1
  81. package/dist/src/flow/sheetAccessibility.d.ts +21 -0
  82. package/dist/src/flow/sheetAccessibility.d.ts.map +1 -0
  83. package/dist/src/hooks/track/events.d.ts +1 -0
  84. package/dist/src/hooks/track/events.d.ts.map +1 -1
  85. package/dist/src/preview/scenarioCatalog.d.ts +2 -2
  86. package/dist/src/providers/FunkitProvider.d.ts.map +1 -1
  87. package/dist/src/screens/TokenAndChainPickerScreen.d.ts.map +1 -1
  88. package/dist/src/screens/WithdrawCryptoSteps.d.ts.map +1 -1
  89. package/package.json +4 -4
  90. package/dist/src/fiat/providers/moonpay/Checkout.d.ts +0 -4
  91. package/dist/src/fiat/providers/moonpay/Checkout.d.ts.map +0 -1
  92. package/dist/src/fiat/providers/moonpay/checkoutScreens.d.ts +0 -7
  93. package/dist/src/fiat/providers/moonpay/checkoutScreens.d.ts.map +0 -1
  94. package/dist/src/fiat/providers/moonpay/sdk/connection.d.ts.map +0 -1
  95. package/dist/src/fiat/providers/moonpay/useCheckoutCalls.d.ts.map +0 -1
  96. package/dist/src/fiat/providers/moonpay/useCheckoutModel.d.ts.map +0 -1
  97. /package/dist/src/fiat/providers/moonpay/{sdk → fullCheckout}/connection.d.ts +0 -0
  98. /package/dist/src/fiat/providers/moonpay/{useCheckoutCalls.d.ts → fullCheckout/useCheckoutCalls.d.ts} +0 -0
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/preview/scenarioCatalog.ts", "../src/preview/scenarios.ts", "../src/preview/fixtures/kycForms.ts", "../src/preview/fixtures/moonPayChallenge.ts", "../src/preview/previewFetch.ts", "../src/preview/replay/replayFetch.ts"],
4
- "sourcesContent": ["// Every SDK state a hosted preview can open at. Pure data with no imports, so tooling outside the\n// bundle (the Appetize PR comment) can read it with plain Node.\n\nexport type PreviewFlow = 'deposit' | 'withdrawal'\n\n/**\n * What the host's flow config must offer for the scenario to open.\n * - `fiatRail`: an amount-first deposit with a fiat rail (Fomo, Pump.fun).\n * - `cryptoDeposit`: the Add money deposit (Betty, Mallard, Ulys, \u2026).\n * - `cryptoDepositLocked`: a crypto deposit of a locked amount (Betty).\n * - `cryptoDepositV2`: an amount-first deposit that also offers Crypto, the\n * V2 crypto pages (Fomo).\n * - `cryptoWithdrawal`: a crypto withdrawal config (Mallard, Ulys).\n * - `omnibusWithdrawFlow`: a withdrawal in the client the\n * `enable-omnibus-withdraw-flow` gate targets (Betty), which passes no\n * wallet and pays Swapped orders from its own account.\n * - `stripeRail`: a fiat rail on a host with a Stripe onramp client, which\n * routing needs before it quotes Stripe at all (Pump.fun).\n */\nexport type PreviewRequirement =\n | 'fiatRail'\n | 'cryptoDeposit'\n | 'cryptoDepositLocked'\n | 'cryptoDepositV2'\n | 'cryptoWithdrawal'\n | 'omnibusWithdrawFlow'\n | 'stripeRail'\n\nexport interface PreviewScenarioEntry {\n title: string\n flow: PreviewFlow\n requires: PreviewRequirement\n /** Source files, relative to `src/`, whose change makes this state worth a link. */\n touches: readonly string[]\n}\n\nconst AMOUNT = [\n 'flow/FiatDepositAmountStep.tsx',\n 'screens/DepositAmountScreen.tsx',\n]\nconst FORM = [\n 'fiat/kyc/FiatIdentityStep.tsx',\n 'fiat/form/FiatFormScreen.tsx',\n 'fiat/form/formLayout.ts',\n 'fiat/kyc/FiatKycFieldControl.tsx',\n]\nconst INTRO = [\n 'fiat/kyc/FiatIdentityStep.tsx',\n 'fiat/kyc/FiatKycIntroScreen.tsx',\n]\nconst STATUS = [\n 'fiat/common/FiatStatusScreen.tsx',\n 'fiat/settlement/depositOutcome.ts',\n]\nconst CRYPTO_V2 = [\n 'flow/CryptoAddressPage.tsx',\n 'flow/CryptoDepositStep.tsx',\n 'flow/CryptoLearnMorePage.tsx',\n 'flow/CryptoListPage.tsx',\n 'flow/CryptoNetworkPage.tsx',\n 'flow/CryptoTokenPage.tsx',\n 'flow/cryptoDepositFlow.ts',\n 'flow/cryptoTokenList.ts',\n 'components/v2/ListRow.tsx',\n]\nconst PROCESSING = [\n 'fiat/processing/DepositProcessingCard.tsx',\n 'fiat/processing/CompletionWave.tsx',\n 'fiat/processing/ProcessingAurora.tsx',\n 'fiat/processing/gradientPuff.ts',\n 'fiat/processing/pressureWave.ts',\n 'fiat/processing/depositProcessing.ts',\n 'screens/DepositAmountScreen.tsx',\n 'flow/FiatDepositAmountStep.tsx',\n]\nconst WITHDRAW = [\n 'flow/WithdrawalFlowContent.tsx',\n 'screens/WithdrawCryptoSteps.tsx',\n]\n\nexport const PREVIEW_SCENARIO_CATALOG = {\n // Fiat rail \u2014 amount entry and sign-in.\n 'fiat.amount': {\n title: 'Amount entry, priced',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.depositMatch': {\n title: 'Amount entry, deposit match with a fee subsidy (internal flag)',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...AMOUNT,\n 'fiat/entry/depositMatch.ts',\n 'flow/DepositMatchSheet.tsx',\n 'screens/DepositMatchScreen.tsx',\n ],\n },\n 'fiat.amount.subsidized': {\n title: 'Amount entry, fee subsidy without the deposit match',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...AMOUNT,\n 'fiat/common/stepDetails.ts',\n 'screens/FeeDetailsScreen.tsx',\n ],\n },\n 'fiat.amount.depositMatch.unsubsidized': {\n title: 'Amount entry, deposit match without a fee subsidy (internal flag)',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...AMOUNT,\n 'fiat/entry/depositMatch.ts',\n 'flow/DepositMatchSheet.tsx',\n 'screens/DepositMatchScreen.tsx',\n ],\n },\n 'fiat.amount.paymentMethodPicker': {\n title: \"Amount entry, the host's payment-method picker open\",\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...AMOUNT,\n 'flow/PaymentMethodPickerSheet.tsx',\n 'flow/PaymentMethodRows.tsx',\n 'preview/PreviewPaymentMethodPicker.tsx',\n ],\n },\n 'fiat.amount.paymentMethodPicker.content': {\n title: 'Payment options, embedded host content',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...AMOUNT,\n 'flow/PaymentMethodPickerSheet.tsx',\n 'preview/PreviewPaymentMethodPicker.tsx',\n ],\n },\n 'fiat.amount.paymentMethodPicker.swapped': {\n title:\n \"Payment options, Swapped's long-tail methods in the host's crypto card\",\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...AMOUNT,\n 'flow/PaymentMethodPickerSheet.tsx',\n 'flow/swappedMethodRows.tsx',\n 'preview/PreviewPaymentMethodPicker.tsx',\n ],\n },\n 'fiat.amount.paymentMethodPicker.swappedPending': {\n title: \"Payment options, Swapped's long tail still being fetched\",\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...AMOUNT,\n 'flow/PaymentMethodPickerSheet.tsx',\n 'flow/PaymentMethodRows.tsx',\n 'flow/swappedMethodRows.tsx',\n ],\n },\n 'fiat.amount.paymentMethodPicker.cryptoToken': {\n title: 'Payment options, embedded crypto currency selection',\n flow: 'deposit',\n requires: 'cryptoDepositV2',\n touches: [...AMOUNT, ...CRYPTO_V2, 'flow/PaymentMethodPickerSheet.tsx'],\n },\n 'fiat.amount.paymentMethodPicker.cryptoNetwork': {\n title: 'Payment options, embedded crypto network selection',\n flow: 'deposit',\n requires: 'cryptoDepositV2',\n touches: [...AMOUNT, ...CRYPTO_V2, 'flow/PaymentMethodPickerSheet.tsx'],\n },\n 'fiat.amount.paymentMethodPicker.cryptoAddress': {\n title: 'Payment options, embedded crypto address',\n flow: 'deposit',\n requires: 'cryptoDepositV2',\n touches: [...AMOUNT, ...CRYPTO_V2, 'flow/PaymentMethodPickerSheet.tsx'],\n },\n 'fiat.amount.paymentMethodPicker.cryptoLearnMore': {\n title: 'Payment options, embedded crypto explainer',\n flow: 'deposit',\n requires: 'cryptoDepositV2',\n touches: [...AMOUNT, ...CRYPTO_V2, 'flow/PaymentMethodPickerSheet.tsx'],\n },\n 'fiat.amount.empty': {\n title: 'Amount entry, empty',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.belowMinimum': {\n title: 'Amount entry, below the provider minimum',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.otpThrottled': {\n title: 'Amount entry, the provider will not send another code',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.noProvider': {\n title: 'Amount entry, no provider serves this buyer (fun-backend #4936)',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.kycUnservable': {\n title: 'Amount entry, identity no provider can take (fun-backend #4875)',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.userLimit': {\n title: \"Amount entry, over the buyer's provider limit (fun-backend #4936)\",\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.kycThreshold': {\n title: 'Amount entry, the daily limit sheet over the amount',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...AMOUNT,\n 'fiat/kyc/useKycLimitSheet.ts',\n 'fiat/processing/FailoverPrompt.tsx',\n ],\n },\n 'fiat.amount.providerOutage': {\n title: 'Amount entry, providers down (fun-backend #4936)',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.noRouteToday': {\n title: \"Amount entry, today's no-route refusal (still Try again)\",\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.providerCeiling': {\n title:\n \"Amount entry, $1,000 priced under one provider's cap; type $10,000 for MoonPay KYC\",\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.gap': {\n title: \"Amount entry, between two providers' ranges (Deposit Minimum)\",\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.currencyLookupFailed': {\n title: \"Amount entry, the buyer's currency lookup failed\",\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.contact.email': {\n title: 'Contact: email',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/contact/FiatContactScreen.tsx',\n 'fiat/contact/sessionContact.ts',\n ],\n },\n 'fiat.contact.phone': {\n title: 'Contact: phone',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/contact/FiatContactScreen.tsx',\n 'fiat/contact/FiatPhoneField.tsx',\n 'fiat/contact/useContactAutoSubmit.ts',\n ],\n },\n 'fiat.contact.redirected': {\n title: 'Contact: non-US number held for MoonPay',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/contact/useRedirectHold.tsx',\n 'fiat/contact/phoneRegionRedirect.ts',\n ],\n },\n 'fiat.otp.email': {\n title: 'OTP: email code',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['fiat/otp/FiatOtpScreen.tsx'],\n },\n 'fiat.otp.sms': {\n title: 'OTP: SMS code',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['fiat/otp/FiatOtpScreen.tsx'],\n },\n 'fiat.funauth.email': {\n title: 'Fun login: email',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/contact/FiatContactScreen.tsx',\n 'fiat/contact/contactRound.ts',\n ],\n },\n 'fiat.funauth.code': {\n title: 'Fun login: email code',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/otp/FiatOtpScreen.tsx',\n 'fiat/otp/otpScreenProps.ts',\n 'fiat/otp/useResendCooldown.ts',\n ],\n },\n 'fiat.funauth.code.tooMany': {\n title: 'Fun login: too many attempts',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['fiat/otp/FiatOtpScreen.tsx', 'fiat/otp/otpScreenProps.ts'],\n },\n 'fiat.funauth.reauth': {\n title: 'Fun login: sign in again over a paid order',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/otp/FunReauthStep.tsx',\n 'fiat/otp/useFunSession.ts',\n 'flow/FiatDepositAmountStep.tsx',\n ],\n },\n 'fiat.funauth.verified': {\n title: 'Fun login: email verified',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['fiat/otp/FiatOtpScreen.tsx', 'fiat/otp/useOtpReceipt.ts'],\n },\n // KYC \u2014 identity rounds.\n 'kyc.l1.intro': {\n title: 'KYC L1: consent faceplate',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: INTRO,\n },\n 'kyc.l1.name': {\n title: 'KYC L1: name',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: FORM,\n },\n 'kyc.l1.dob': {\n title: 'KYC L1: date of birth',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/form/FiatBirthDateField.tsx'],\n },\n 'kyc.l1.address': {\n title: 'KYC L1: address',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/country/subdivisions.ts'],\n },\n 'kyc.l1.ssn': {\n title: 'KYC L1: SSN',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/form/FiatSsnField.tsx'],\n },\n 'kyc.nationality': {\n title: 'KYC: nationality',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/country/FiatCountrySheet.tsx'],\n },\n 'kyc.country': {\n title: 'KYC: country of residence',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/country/FiatCountrySheet.tsx'],\n },\n 'kyc.ssnLastFour': {\n title: 'KYC: SSN last four',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/form/FiatSsnField.tsx'],\n },\n 'kyc.l2.intro': {\n title: 'KYC L2: additional-information faceplate',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: INTRO,\n },\n 'kyc.stripe.l1.intro': {\n title: 'KYC Stripe L1: step-up faceplate',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...INTRO,\n 'fiat/providers/kycIntro.ts',\n 'fiat/providers/stripe/stripeKycIntro.ts',\n ],\n },\n 'kyc.l2.moonpay-consent': {\n title: 'KYC L2: MoonPay sharing consent',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...INTRO,\n 'fiat/providers/kycIntro.ts',\n 'fiat/kyc/FiatSharingConsentNotice.tsx',\n 'fiat/kyc/useSharingConsent.ts',\n ],\n },\n 'kyc.l2.dob': {\n title: 'KYC L2: age',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: FORM,\n },\n 'kyc.l2.occupation': {\n title: 'KYC L2: occupation',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/form/FiatChoiceList.tsx'],\n },\n 'kyc.l2.purpose': {\n title: 'KYC L2: purpose',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/form/FiatChoiceList.tsx'],\n },\n 'kyc.dueDiligence': {\n title: 'KYC: due diligence',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: FORM,\n },\n 'kyc.dueDiligence.phoneRefused': {\n title: 'KYC: due diligence, phone number refused',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...FORM,\n 'fiat/form/refusedFields.ts',\n 'fiat/form/shownFieldIssues.ts',\n ],\n },\n 'kyc.dueDiligence.income': {\n title: 'KYC: due diligence figures',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: FORM,\n },\n 'kyc.edd.profession': {\n title: 'KYC: enhanced due diligence profession',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/form/FiatChoiceList.tsx'],\n },\n 'kyc.edd.netWorth': {\n title: 'KYC: enhanced due diligence net worth',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: FORM,\n },\n 'kyc.form.unsupported': {\n title: 'KYC: form this build cannot draw',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, ...STATUS],\n },\n 'kyc.stepUp.afterReview': {\n title: 'KYC: a second round after review',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/pageTurn.ts', 'fiat/kyc/FiatKycOutcomeScreen.tsx'],\n },\n 'kyc.form.retry': {\n title: 'KYC: form send failed',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/common/FiatErrorNotice.tsx'],\n },\n 'kyc.form.rateLimited': {\n title: 'KYC: form send rate-limited',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/common/FiatErrorNotice.tsx', ...AMOUNT],\n },\n // KYC \u2014 capture and verdicts.\n 'kyc.capture.intro': {\n title: 'KYC: document-capture intro',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/kyc/FiatDocumentCaptureStep.tsx',\n 'fiat/kyc/FiatKycIntroScreen.tsx',\n ],\n },\n 'kyc.capture.moonpay-handoff': {\n title: 'KYC: MoonPay asks for more of its hosted check',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/providers/moonpay/moonpayHandoffCard.tsx',\n 'fiat/kyc/useKycCaptureRound.ts',\n ],\n },\n 'kyc.moonpay-check.intro': {\n title: \"KYC: MoonPay checkout's intro to MoonPay's own check\",\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/providers/moonpay/checkoutScreens.tsx',\n 'fiat/providers/moonpay/useCheckoutModel.ts',\n 'fiat/kyc/FiatKycIntroScreen.tsx',\n ],\n },\n 'kyc.moonpay-check.again': {\n title: 'KYC: MoonPay checkout asks for additional verification',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/providers/moonpay/checkoutScreens.tsx',\n 'fiat/providers/moonpay/useCheckoutModel.ts',\n 'fiat/providers/moonpay/moonpayHandoffCard.tsx',\n ],\n },\n 'kyc.completion.review': {\n title: 'KYC completion: in review',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/kyc/FiatKycOutcomeScreen.tsx',\n 'fiat/kyc/useKycCompletion.ts',\n ],\n },\n 'kyc.review.extended': {\n title: 'KYC: an extended review opens the pending card',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['fiat/kyc/useKycCompletion.ts', 'fiat/kyc/kycOptionRows.ts'],\n },\n 'kyc.review.brief': {\n title: 'KYC: a brief review waited out, then priced',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/kyc/useKycCompletion.ts',\n 'fiat/kyc/FiatKycOutcomeScreen.tsx',\n ],\n },\n 'kyc.completion.hold': {\n title: 'KYC completion: on hold',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/kyc/FiatKycOutcomeScreen.tsx',\n 'fiat/kyc/useKycCompletion.ts',\n ],\n },\n 'kyc.completion.restricted': {\n title: 'KYC completion: rejected',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/kyc/FiatKycOutcomeScreen.tsx',\n 'fiat/kyc/useKycCompletion.ts',\n ],\n },\n 'kyc.required': {\n title: 'Amount entry, identity asked before a first deposit',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'kyc.verdict.review': {\n title: 'Amount entry after KYC: in review',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...AMOUNT, 'fiat/kyc/FiatKycNotice.tsx'],\n },\n 'kyc.verdict.hold': {\n title: 'Amount entry after KYC: on hold',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...AMOUNT, 'fiat/kyc/FiatKycNotice.tsx'],\n },\n 'kyc.verdict.rejected': {\n title: 'Amount entry after KYC: rejected',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...AMOUNT, 'fiat/kyc/FiatKycNotice.tsx'],\n },\n 'kyc.options.review': {\n title: 'KYC options card: in review',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/kyc/FiatKycOptionsScreen.tsx',\n 'fiat/kyc/FiatKycOptionRow.tsx',\n ],\n },\n 'kyc.options.hold': {\n title: 'KYC options card: on hold',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/kyc/FiatKycOptionsScreen.tsx',\n 'fiat/kyc/FiatKycOptionRow.tsx',\n ],\n },\n 'kyc.options.rejected': {\n title: 'KYC options card: rejected',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/kyc/FiatKycOptionsScreen.tsx',\n 'fiat/kyc/FiatKycOptionRow.tsx',\n ],\n },\n // Orders.\n 'order.review': {\n title: 'Order review',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: STATUS,\n },\n 'order.bankInstructions': {\n title: 'Bank transfer instructions (not drawn on RN yet)',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: STATUS,\n },\n 'order.pending': {\n title: 'Pending order: resume or cancel',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['fiat/settlement/FiatPendingOrderScreen.tsx'],\n },\n 'order.tracking': {\n title: 'Order processing',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: STATUS,\n },\n 'order.processing': {\n title: 'Paid, the order still settling: the processing card',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: PROCESSING,\n },\n 'order.processing.lands': {\n title: 'Paid, then the order settles: the processing card lands',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...PROCESSING, 'fiat/processing/CompletionCheck.tsx'],\n },\n 'order.processing.fails': {\n title:\n 'Paid, then the order fails: the processing card gives way to the failed sheet',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...PROCESSING,\n 'fiat/processing/DepositCardSheet.tsx',\n 'fiat/processing/ProcessingFailure.tsx',\n 'fiat/processing/cardSurface.tsx',\n ],\n },\n 'order.success': {\n title: 'Order settled (closes into the deposit toast)',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...STATUS, 'fiat/settlement/FiatReceipt.tsx'],\n },\n 'order.failed': {\n title: 'Order failed',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: STATUS,\n },\n 'order.deliveryFailed': {\n title: 'Paid, but the token purchase failed',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...STATUS, 'flow/renderFiatFlowScreen.tsx'],\n },\n 'order.cancelled': {\n title: 'Order cancelled',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: STATUS,\n },\n 'order.refunded': {\n title: 'Order refunded',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: STATUS,\n },\n 'fiat.blocked': {\n title: 'Blocked by the rail',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: STATUS,\n },\n 'fiat.blocked.later': {\n title: 'Blocked by the rail: region, with a comeback date',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['fiat/common/FiatRegionUnsupportedScreen.tsx'],\n },\n 'fiat.blocked.unservable': {\n title: 'Blocked by the rail: nothing can serve this deposit',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['fiat/common/FiatUnavailableScreen.tsx'],\n },\n 'fiat.accountIneligible': {\n title: \"The host's minter refused this account\",\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/common/FiatUnavailableScreen.tsx',\n 'fiat/kyc/useIdentityAssertion.ts',\n ],\n },\n 'fiat.unsupported': {\n title: 'State this build predates',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: STATUS,\n },\n 'fiat.surfaceFailed': {\n title: 'Provider surface failed',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: STATUS,\n },\n 'fiat.paymentFailed': {\n title: 'Apple Pay payment failed',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/processing/DepositProcessingCard.tsx',\n 'fiat/processing/DepositCardSheet.tsx',\n 'fiat/processing/ProcessingFailure.tsx',\n 'fiat/payment/usePaymentFailureAnswer.ts',\n ],\n },\n 'fiat.paymentDismissed': {\n title: 'Coinbase Apple Pay sheet closed',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/processing/FailoverPrompt.tsx',\n 'fiat/payment/usePaymentFailureAnswer.ts',\n 'fiat/payment/failoverPrompt.ts',\n 'fiat/providers/coinbase/coinbaseApplePay.tsx',\n ],\n },\n 'fiat.insufficientFunds': {\n title: 'Card without the funds at Coinbase, amount lowered',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/processing/FailoverPrompt.tsx',\n 'fiat/payment/failoverKind.ts',\n 'fiat/payment/insufficientFundsAmount.ts',\n ],\n },\n 'fiat.insufficientFundsAtMinimum': {\n title: 'Card without the funds at Coinbase, at the minimum',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/processing/FailoverPrompt.tsx',\n 'fiat/payment/failoverKind.ts',\n 'fiat/payment/failoverPrompt.ts',\n ],\n },\n 'fiat.stripeDeclined': {\n title: 'Card declined at Stripe, no reason given',\n flow: 'deposit',\n requires: 'stripeRail',\n touches: [\n 'fiat/processing/FailoverPrompt.tsx',\n 'fiat/payment/failoverKind.ts',\n 'fiat/providers/stripe/stripeCardRefusal.ts',\n ],\n },\n 'fiat.softDeclined': {\n title: 'Card bank holds the charge for approval at Coinbase',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/processing/FailoverPrompt.tsx',\n 'fiat/payment/failoverKind.ts',\n 'fiat/payment/failoverPrompt.ts',\n ],\n },\n 'fiat.failoverVerified': {\n title: 'Verified after a failover, payment held',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/entry/useCaptureHold.ts',\n 'fiat/payment/failoverPrompt.ts',\n 'fiat/processing/FailoverPrompt.tsx',\n ],\n },\n 'fiat.prepaidDeclined': {\n title: 'Prepaid card declined at Coinbase',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/processing/FailoverPrompt.tsx',\n 'fiat/payment/usePaymentFailureAnswer.ts',\n 'fiat/payment/failoverPrompt.ts',\n 'fiat/payment/failoverKind.ts',\n ],\n },\n 'fiat.prepaidDeclinedAlone': {\n title: 'Prepaid card declined, no other partner',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/processing/FailoverPrompt.tsx',\n 'fiat/payment/failoverKind.ts',\n 'fiat/payment/failoverPrompt.ts',\n ],\n },\n 'fiat.retryable': {\n title: 'Submission failed, retryable',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: STATUS,\n },\n 'fiat.rateLimited': {\n title: 'Submission rate-limited, seconds to wait',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...STATUS, ...AMOUNT],\n },\n 'fiat.rateLimited.retryAfter': {\n title: 'Submission rate-limited, minutes to wait',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...STATUS, ...AMOUNT],\n },\n // Crypto deposit.\n 'deposit.wallet.connecting': {\n title: 'Wallet deposit: connecting to Phantom',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'flow/WalletConnectingAction.tsx',\n 'flow/WalletDepositStep.tsx',\n 'flow/useWalletDeposit.ts',\n ],\n },\n 'deposit.wallet.connectFailed': {\n title: 'Wallet deposit: connection failed',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'flow/WalletConnectingAction.tsx',\n 'flow/WalletDepositStep.tsx',\n 'flow/useWalletDeposit.ts',\n ],\n },\n 'deposit.wallet.amount': {\n title: 'Wallet deposit: amount and held token',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'flow/WalletDepositStep.tsx',\n 'flow/useWalletDeposit.ts',\n 'screens/DepositAmountScreen.tsx',\n ],\n },\n 'deposit.wallet.assets': {\n title: 'Wallet deposit: long asset list and low balances',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/WalletDepositStep.tsx', 'flow/useWalletDeposit.ts'],\n },\n 'deposit.wallet.insufficient': {\n title: 'Wallet deposit: insufficient balance',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/WalletDepositStep.tsx', 'flow/useWalletDeposit.ts'],\n },\n 'deposit.wallet.empty': {\n title: 'Wallet deposit: no supported balance',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/WalletDepositStep.tsx', 'flow/useWalletDeposit.ts'],\n },\n 'deposit.wallet.emptyAssets': {\n title: 'Wallet deposit: empty asset list',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/WalletDepositStep.tsx', 'flow/useWalletDeposit.ts'],\n },\n 'deposit.wallet.unlink': {\n title: 'Wallet deposit: unlink menu',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/WalletDepositStep.tsx', 'flow/useWalletDeposit.ts'],\n },\n 'deposit.wallet.unlinkFailed': {\n title: 'Wallet deposit: unlink failed',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/WalletDepositStep.tsx', 'flow/useWalletDeposit.ts'],\n },\n 'deposit.wallet.confirm': {\n title: 'Wallet deposit: confirmation',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/WalletDepositStep.tsx', 'screens/PaymentConfirmScreen.tsx'],\n },\n 'deposit.wallet.sent': {\n title: 'Wallet deposit: submitted successfully',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/WalletDepositStep.tsx', 'flow/useWalletDeposit.ts'],\n },\n 'deposit.wallet.failed': {\n title: 'Wallet deposit: transfer failed',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/WalletDepositStep.tsx', 'flow/useWalletDeposit.ts'],\n },\n 'deposit.wallet.pending': {\n title: 'Wallet deposit: unresolved transfer',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/WalletDepositStep.tsx', 'flow/useWalletDeposit.ts'],\n },\n 'deposit.addMoney': {\n title: 'Add money: method list',\n flow: 'deposit',\n requires: 'cryptoDeposit',\n touches: ['screens/SelectMethodScreen.tsx'],\n },\n 'deposit.transfer': {\n title: 'Transfer crypto: deposit address',\n flow: 'deposit',\n requires: 'cryptoDeposit',\n touches: ['screens/TransferCryptoScreen.tsx'],\n },\n 'deposit.lockedTransfer': {\n title: 'Locked deposit: token and chain dropdowns over the QR card',\n flow: 'deposit',\n requires: 'cryptoDepositLocked',\n touches: [\n 'screens/LockedTransferCryptoScreen.tsx',\n 'components/DepositQrCard.tsx',\n 'components/TokenChainSelector.tsx',\n 'flow/useDepositSelection.ts',\n 'screens/SelectReceiveTokenScreen.tsx',\n 'screens/SelectAvailableChainScreen.tsx',\n ],\n },\n // V2 crypto deposit: one inset modal, resized per page.\n 'deposit.crypto.token': {\n title: 'V2 crypto: token page, peek height',\n flow: 'deposit',\n requires: 'cryptoDepositV2',\n touches: CRYPTO_V2,\n },\n 'deposit.crypto.token.search': {\n title: 'V2 crypto: token page, searching at max height',\n flow: 'deposit',\n requires: 'cryptoDepositV2',\n touches: CRYPTO_V2,\n },\n 'deposit.crypto.network': {\n title: 'V2 crypto: network page',\n flow: 'deposit',\n requires: 'cryptoDepositV2',\n touches: CRYPTO_V2,\n },\n 'deposit.crypto.address': {\n title: 'V2 crypto: deposit address page',\n flow: 'deposit',\n requires: 'cryptoDepositV2',\n touches: CRYPTO_V2,\n },\n 'deposit.crypto.address.expanded': {\n title: 'V2 crypto: deposit address, tapped open in full',\n flow: 'deposit',\n requires: 'cryptoDepositV2',\n touches: CRYPTO_V2,\n },\n 'deposit.crypto.learnMore': {\n title: 'V2 crypto: learn more, max height',\n flow: 'deposit',\n requires: 'cryptoDepositV2',\n touches: CRYPTO_V2,\n },\n // Crypto withdrawal.\n 'withdraw.method': {\n title: 'Withdraw: payout methods',\n flow: 'withdrawal',\n requires: 'cryptoWithdrawal',\n touches: [\n 'flow/WithdrawalFlowContent.tsx',\n 'screens/WithdrawMethodScreen.tsx',\n ],\n },\n 'withdraw.method.venuePayout': {\n title: 'Withdraw: payout methods, cash paid by the venue (no wallet)',\n flow: 'withdrawal',\n requires: 'omnibusWithdrawFlow',\n touches: [\n 'flow/WithdrawalFlowContent.tsx',\n 'flow/withdrawalMethods.ts',\n 'screens/WithdrawMethodScreen.tsx',\n 'transfer/hooks/useWithdrawalFops.ts',\n 'withdrawal/withdrawalPayer.ts',\n 'withdrawal/useWithdrawalExecution.ts',\n ],\n },\n 'withdraw.amount': {\n title: 'Withdraw: amount',\n flow: 'withdrawal',\n requires: 'cryptoWithdrawal',\n touches: [...WITHDRAW, 'screens/WithdrawAmountScreen.tsx'],\n },\n 'withdraw.address': {\n title: 'Withdraw: recipient address',\n flow: 'withdrawal',\n requires: 'cryptoWithdrawal',\n touches: [...WITHDRAW, 'screens/WithdrawAddressScreen.tsx'],\n },\n 'withdraw.address.pastePanel': {\n title: 'Withdraw: recipient address, paste panel',\n flow: 'withdrawal',\n requires: 'omnibusWithdrawFlow',\n touches: [\n ...WITHDRAW,\n 'screens/WithdrawAddressScreen.tsx',\n 'components/PasteAddressPanel.tsx',\n 'components/WalletAddressInput.tsx',\n ],\n },\n 'withdraw.address.pastePanel.editing': {\n title: 'Withdraw: recipient address, paste panel editing',\n flow: 'withdrawal',\n requires: 'omnibusWithdrawFlow',\n touches: [\n ...WITHDRAW,\n 'screens/WithdrawAddressScreen.tsx',\n 'components/WalletAddressInput.tsx',\n ],\n },\n 'withdraw.receiveToken': {\n title: 'Withdraw: receive token and chain',\n flow: 'withdrawal',\n requires: 'cryptoWithdrawal',\n touches: [...WITHDRAW, 'screens/SelectReceiveTokenAndChainScreen.tsx'],\n },\n 'withdraw.complete': {\n title: 'Withdraw: submitted',\n flow: 'withdrawal',\n requires: 'cryptoWithdrawal',\n touches: [\n 'screens/WithdrawCryptoComplete.tsx',\n 'screens/WithdrawCompleteScreen.tsx',\n ],\n },\n 'withdraw.error': {\n title: 'Withdraw: execution failed',\n flow: 'withdrawal',\n requires: 'cryptoWithdrawal',\n touches: [\n 'flow/WithdrawalFlowContent.tsx',\n 'screens/WithdrawMethodScreen.tsx',\n ],\n },\n} as const satisfies Record<string, PreviewScenarioEntry>\n\nexport type PreviewScenarioId = keyof typeof PREVIEW_SCENARIO_CATALOG\n\nexport const PREVIEW_SCENARIO_IDS = Object.keys(\n PREVIEW_SCENARIO_CATALOG,\n) as PreviewScenarioId[]\n", "import type {\n FailureReason,\n FiatProvider,\n FiatStepResponse,\n FormDescriptor,\n Quote,\n} from '@funkit/connect-core'\nimport { MOONPAY_SHARING_CONSENT_VERSION } from '@funkit/connect-core'\n\nimport { PERSONA_PRIVACY_POLICY_URL } from '../fiat/kyc/legalLinks'\nimport type { CryptoFlowScreen } from '../flow/cryptoDepositFlow'\n\nimport { type FlowPreviewSeed, openingStep } from './flowPreview'\nimport {\n COUNTRY_FORM,\n DUE_DILIGENCE_FORM,\n ENHANCED_DUE_DILIGENCE_FORM,\n L2_FORM,\n LAST_FOUR_FORM,\n NATIONALITY_FORM,\n UNSUPPORTED_FORM,\n US_QUOTE,\n US_ROUND,\n} from './fixtures/kycForms'\nimport { moonPayChallengeState } from './fixtures/moonPayChallenge'\nimport {\n PREVIEW_SCENARIO_CATALOG,\n type PreviewScenarioEntry,\n type PreviewScenarioId,\n} from './scenarioCatalog'\n\n/**\n * A canned `/fiat/*` answer: a step response, or an HTTP failure to provoke a retry.\n * - `retryAfterSeconds` rides a 429's body, as fun-backend's rate limiter sends it.\n */\nexport type PreviewResponse =\n | FiatStepResponse\n | { status: number; retryAfterSeconds?: number }\n /**\n * Built per request, for a step whose times count from when it is asked for,\n * or that answers the quote the request names.\n */\n | ((request: { quoteRef?: string }) => FiatStepResponse)\n\n/**\n * The fiat backend a scenario runs against, so a seeded screen stays put and its CTAs answer.\n * - `quote` answers `POST /fiat/quote`; unset keeps the priced quote every rail starts from.\n * - `responses` answer other endpoints by path; anything unlisted re-sends the step on screen.\n */\n/**\n * The `reason` a scenario's quote is refused with, as fun-backend's `FiatNoRouteError` sends it.\n * - All but `NO_CANDIDATE_LEGACY` follow fun-backend #4936 / #4875, which are not deployed yet.\n */\nexport type PreviewNoRouteReason =\n | 'NO_CANDIDATE_LEGACY'\n | 'NO_CANDIDATE'\n | 'KYC_INSUFFICIENT'\n | 'USER_LIMIT'\n | 'PROVIDER_OUTAGE'\n\nexport type PreviewRange = readonly [\n min: string,\n max: string,\n userMax: string | null,\n]\n\n/** One provider's span of the table, and what its quote answers at an amount inside it. */\nexport interface PreviewProviderRoute {\n provider: FiatProvider\n min: string\n max: string\n /** How much of its requirements the table can see; every entry still needs a sign-in. */\n visibility: 'AUTH_GATED' | 'PARTIAL' | 'COMPLETE'\n answer: (amount: string) => FiatStepResponse\n}\n\nexport interface PreviewBackend {\n quote?: FiatStepResponse\n minimum?: string\n /** Every quote is refused with this no-route reason. */\n noRoute?: PreviewNoRouteReason\n /**\n * The only amounts served, as `[min, max, userMax]`: the routing table lists\n * them, and a quote outside all of them is refused with them as\n * `serviceableRanges`, the way fun-backend #5119 keeps a buyer cap's gap.\n */\n ranges?: readonly PreviewRange[]\n /**\n * Several providers, preferred first: the table splits wherever one starts or stops, a routed\n * quote is answered by the provider it names, and `POST /fiat/quote` by the first one (inside\n * the host's pinned list) that serves the amount.\n */\n providers?: readonly PreviewProviderRoute[]\n /** The routing table's `currentLimit` for the scenario's provider: what it serves now without another check. */\n currentLimit?: string\n /** The routing table predicts the fee is reimbursed, so an empty amount reads \"No fees with debit cards\". */\n feeSubsidized?: true\n /** The country \u2192 currency lookup fails, so no quote is ever asked for. */\n currencyLookupFails?: boolean\n responses?: Readonly<Record<string, PreviewResponse>>\n /** `endpoint` answers `step` once `afterMs` has passed since it was first asked: an order that settles while watched. */\n settles?: { endpoint: string; afterMs: number; step: FiatStepResponse }\n}\n\nexport interface PreviewScenario extends PreviewScenarioEntry {\n id: PreviewScenarioId\n seed: FlowPreviewSeed\n backend: PreviewBackend\n}\n\nconst PROVIDER = 'MOONPAY' as const\nconst { quoteRef } = US_QUOTE\nconst AMOUNT = '105'\nconst CREATED_AT = '2026-09-01T12:00:00Z'\nconst TX_HASH =\n '0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060' as const\n\nconst WALLET: NonNullable<NonNullable<FlowPreviewSeed['deposit']>['wallet']> = {\n app: {\n name: 'Phantom',\n iconUrl: 'https://sdk-cdn.fun.xyz/images/wallets/phantom.svg',\n connect: async () => 'preview-wallet',\n disconnect: () => {},\n supportsAsset: () => true,\n transfer: async () => 'preview-signature',\n },\n from: 'preview-wallet',\n to: 'preview-deposit',\n amount: '25',\n status: 'idle',\n tokens: [\n {\n chainId: '1151111081099710',\n contractAddress: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',\n symbol: 'USDC',\n name: 'USD Coin',\n decimals: 6,\n tokenBalance: '40000000',\n price: 1,\n totalUsdValue: 40,\n },\n ],\n}\n\nconst pricedQuote = (inputs?: Record<string, { type: 'TEXT' }>) =>\n ({\n state: {\n kind: 'QUOTE',\n quote: US_QUOTE,\n limits: { min: '20.00', max: '2000.00' },\n },\n provider: PROVIDER,\n transitions: [\n {\n id: 'continue',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/session',\n params: { quoteRef },\n ...(inputs === undefined ? {} : { inputs }),\n },\n ],\n }) satisfies FiatStepResponse\n\nconst PRICED = pricedQuote()\n\n/** Pump's match: the whole amount, up to $50. */\nconst PREVIEW_MATCH = { rate: 1, max: { currency: 'USD', amount: 50 } }\n\n/** The quote re-presented after too many code sends; its Continue retries. */\nconst otpThrottled: FiatStepResponse = {\n ...pricedQuote({ phone: { type: 'TEXT' } }),\n state: {\n ...PRICED.state,\n error: {\n category: 'USER_ERROR',\n code: 'OTP_DISPATCH_THROTTLED',\n retryable: true,\n recovery: 'NONE',\n },\n },\n}\n\nconst otp = (channel: 'EMAIL_OTP' | 'SMS_OTP'): FiatStepResponse => ({\n state: { kind: 'SESSION_AUTH', channel },\n provider: PROVIDER,\n transitions: [\n {\n id: 'verify',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/session/verify',\n params: { quoteRef },\n inputs: { code: { type: 'TEXT', length: 6 } },\n },\n {\n id: 'resend',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/session',\n params: { quoteRef },\n },\n ],\n})\n\n/** A Fun-run login's entry quote, sent with no session: it asks for the email. */\nconst FUN_AUTH_EMAIL: FiatStepResponse = {\n state: { kind: 'FUN_AUTH', channel: 'EMAIL_OTP', phase: 'IDENTIFIER' },\n transitions: [\n {\n id: 'start',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/auth',\n inputs: { email: { type: 'TEXT' } },\n },\n ],\n}\n\nconst FUN_AUTH_RESEND = {\n id: 'resend',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/auth',\n params: { verificationRef: 'vr_preview' },\n} as const\n\n// Built per call, so each code's countdown starts when it is sent.\nconst funAuthCode = (): FiatStepResponse => ({\n state: {\n kind: 'FUN_AUTH',\n channel: 'EMAIL_OTP',\n phase: 'CODE',\n expiresAtMs: Date.now() + 10 * 60_000,\n resendAvailableAtMs: Date.now() + 30_000,\n attemptsRemaining: 3,\n },\n transitions: [\n {\n id: 'verify',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/auth/verify',\n params: { verificationRef: 'vr_preview' },\n inputs: { otpCode: { type: 'TEXT', length: 6, regex: '^\\\\d{6}$' } },\n },\n FUN_AUTH_RESEND,\n ],\n})\n\n/** The challenge is dropped: only a fresh code moves on. */\nconst FUN_AUTH_TOO_MANY: FiatStepResponse = {\n state: {\n kind: 'FUN_AUTH',\n channel: 'EMAIL_OTP',\n phase: 'CODE',\n attemptsRemaining: 0,\n error: {\n category: 'USER_ERROR',\n code: 'TOO_MANY_ATTEMPTS',\n retryable: true,\n recovery: 'NONE',\n },\n },\n transitions: [FUN_AUTH_RESEND],\n}\n\nconst FUN_AUTH_VERIFIED: FiatStepResponse = {\n state: { kind: 'FUN_AUTH', channel: 'EMAIL_OTP', phase: 'VERIFIED' },\n transitions: [],\n session: {\n accessToken: 'preview-access-token',\n refreshHandle: 'preview-refresh-handle',\n expiresAtMs: Date.now() + 60 * 60_000,\n },\n}\n\nconst kycForm = (\n form: FormDescriptor,\n stripeTier?: 'l0' | 'l1',\n error?: FailureReason,\n): FiatStepResponse => ({\n state: {\n kind: 'KYC',\n phase: 'INPUT_REQUIRED',\n quote: US_QUOTE,\n form,\n ...(error === undefined ? {} : { error }),\n },\n provider: stripeTier === undefined ? PROVIDER : 'STRIPE',\n transitions: [\n {\n id: 'submit_round',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/kyc/form',\n params: {\n quoteRef,\n formId: form.formId,\n ...(stripeTier === undefined ? {} : { kycTier: stripeTier }),\n },\n inputs: { values: { type: 'FORM_VALUES' } },\n },\n ],\n})\n\n/** Each provider's testing quote as Datadog logged it on 2026-10-04/05: rate and fee label. */\nconst PROVIDER_PRICING: Partial<\n Record<FiatProvider, { rate: number; feeLabel: string }>\n> = {\n COINBASE: { rate: 0.9804, feeLabel: 'Coinbase fee' },\n STRIPE: { rate: 0.961169, feeLabel: 'Stripe fee' },\n MOONPAY: { rate: 0.956546, feeLabel: 'MoonPay fee' },\n}\n\nconst quoteAt = (provider: FiatProvider, amount: string): Quote => {\n const { rate, feeLabel } = PROVIDER_PRICING[provider] ?? {\n rate: 0.995,\n feeLabel: 'Fee',\n }\n const fee = (Number(amount) * (1 - rate)).toFixed(2)\n return {\n ...US_QUOTE,\n quoteRef: `qr_${provider.toLowerCase()}_${amount}`,\n fiat: { ...US_QUOTE.fiat, amount },\n crypto: { ...US_QUOTE.crypto, amount: (Number(amount) * rate).toFixed(2) },\n rate: rate.toFixed(6),\n totalFee: fee,\n feeBreakdown: [\n { id: 'provider_fee', labelFallback: feeLabel, amount: fee },\n ],\n }\n}\n\n/**\n * A signed-in buyer's price as the testing backend sends it: `open_session` to\n * `POST /fiat/payment-session`.\n * - Without Coinbase's `preparedPayment` and Stripe's Link token: neither is real outside a\n * provider session.\n */\nconst pricedAt =\n (provider: FiatProvider, max: string, min = '5') =>\n (amount: string): FiatStepResponse => {\n const quote = quoteAt(provider, amount)\n return {\n provider,\n state: { kind: 'QUOTE', quote, limits: { min, max } },\n transitions: [\n {\n id: 'open_session',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/payment-session',\n params: { provider, quoteRef: quote.quoteRef },\n labelFallback: 'Continue',\n },\n ],\n }\n }\n\n/**\n * Stripe's price holds nothing until the tap opens its pay sheet; MoonPay and Coinbase prepare\n * checkout on arrival, and typing over that round remounts the step and drops its ceiling. A\n * preview has no Stripe SDK, so MoonPay's tier stands in for Stripe with a CTA nothing prepares.\n */\nconst payableOnTap = (step: FiatStepResponse): FiatStepResponse => ({\n ...step,\n transitions: [\n {\n id: 'continue',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/orders',\n params: {\n quoteRef:\n step.state.kind === 'QUOTE' ? step.state.quote.quoteRef : quoteRef,\n },\n },\n ],\n})\n\n/**\n * MoonPay prices this buyer's $5,000 tier now, and holds more on identity with the quote attached.\n * - The testing backend answers with Sumsub capture after the MoonPay sign-in; neither draws in a\n * preview, so the identity form stands in for it.\n */\nconst moonPayAt = (amount: string): FiatStepResponse => {\n if (Number(amount) <= 5000) {\n return payableOnTap(pricedAt('MOONPAY', '5000.00')(amount))\n }\n const round = kycForm(US_ROUND)\n return round.state.kind === 'KYC' && round.state.phase === 'INPUT_REQUIRED'\n ? {\n ...round,\n provider: 'MOONPAY',\n refreshLimits: true,\n state: { ...round.state, quote: quoteAt('MOONPAY', amount) },\n }\n : round\n}\n\n/** Transak's covered price, payable up to `limit` and held on identity above it. Transak sends\n * nothing ahead of the tap, so the held entry stays on screen. */\nconst kycAbove =\n (limit: string) =>\n (amount: string): FiatStepResponse => {\n const priced = quoteAt('TRANSAK', amount)\n const quote: Quote = {\n ...priced,\n feeSubsidy: { currency: 'USD', amount: priced.totalFee },\n }\n const payable = Number(amount) <= Number(limit)\n return {\n provider: 'TRANSAK',\n state: { kind: 'QUOTE', quote, limits: { min: '5', max: '5000.00' } },\n transitions: [\n payable\n ? {\n id: 'continue',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/orders',\n params: { quoteRef: quote.quoteRef },\n }\n : {\n id: 'kyc_required',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/session',\n params: { quoteRef: quote.quoteRef },\n labelFallback: 'KYC required',\n },\n ],\n }\n }\n\n// fun-backend #5120 sends the field-group code; until it deploys the round carries `INVALID_VALUE`.\nconst PHONE_REFUSAL: FailureReason = {\n category: 'USER_ERROR',\n retryable: true,\n recovery: 'NONE',\n code: 'PHONE_INVALID',\n}\n\nconst IN_REVIEW: FiatStepResponse = {\n state: {\n kind: 'KYC',\n phase: 'NO_ACTION_REQUIRED',\n reason: 'IN_REVIEW',\n quote: US_QUOTE,\n },\n provider: PROVIDER,\n transitions: [\n {\n id: 'poll',\n mode: 'AWAIT',\n poll: {\n endpoint: `GET /fiat/quotes/${quoteRef}`,\n intervalMs: 3000,\n backoffFactor: 1.5,\n maxIntervalMs: 10000,\n giveUpAfterMs: 90000,\n },\n },\n ],\n}\n\n/** An in-review answer naming how long the review is expected to take. */\ntype ReviewDuration = NonNullable<\n Extract<FiatStepResponse['state'], { phase: 'NO_ACTION_REQUIRED' }>['review']\n>\nconst reviewFor = (review: ReviewDuration): FiatStepResponse =>\n ({\n ...IN_REVIEW,\n state: { ...IN_REVIEW.state, review },\n }) as FiatStepResponse\n\n/**\n * Opens on the amount screen, so the routing table (and its `currentLimit`) is fetched before the\n * check: a seeded round turns the table off. Fill in the form; it sends into `review`, and each\n * poll then answers `polled`.\n */\nconst submittedInto = (review: FiatStepResponse, polled: FiatStepResponse) =>\n fiat(\n { pressEntry: true },\n {\n quote: kycForm(US_ROUND),\n currentLimit: '500.00',\n responses: {\n '/fiat/kyc/form': review,\n [`/fiat/quotes/${quoteRef}`]: polled,\n },\n },\n )\n\nconst ON_HOLD: FiatStepResponse = {\n state: {\n kind: 'KYC',\n phase: 'NO_ACTION_REQUIRED',\n reason: 'ON_HOLD',\n retryAfter: '2026-12-01T09:00:00Z',\n quote: US_QUOTE,\n },\n provider: PROVIDER,\n transitions: [],\n}\n\nconst REJECTED: FiatStepResponse = {\n state: {\n kind: 'KYC',\n phase: 'NO_ACTION_REQUIRED',\n reason: 'REJECTED',\n quote: US_QUOTE,\n failureReason: {\n category: 'KYC_REJECTED',\n retryable: false,\n recovery: 'CONTACT_SUPPORT',\n },\n },\n provider: PROVIDER,\n transitions: [],\n}\n\nconst KYC_CAPTURE: FiatStepResponse = {\n state: {\n kind: 'KYC',\n phase: 'CAPTURE',\n quote: US_QUOTE,\n surface: {\n kind: 'KYC_SDK',\n provider: 'SUMSUB',\n params: { accessToken: 'preview-token' },\n expiresAt: '2027-01-01T00:00:00Z',\n },\n },\n provider: PROVIDER,\n transitions: [\n {\n id: 'capture',\n mode: 'CLIENT_SURFACE',\n report: {\n endpoint: 'POST /fiat/kyc/capture',\n params: { quoteRef },\n result: { type: 'KYC_SDK_RESULT', bodyKey: 'result' },\n },\n },\n ],\n}\n\n/** A MoonPay quote its own checkout takes over, as `POST /fiat/quote` hands it off. */\nconst MOONPAY_HANDOFF: FiatStepResponse = {\n ...pricedAt('MOONPAY', '5000')(AMOUNT),\n transitions: [],\n handoff: { provider: 'MOONPAY' as const },\n}\n\nconst MOONPAY_HOSTED_CHECK: FiatStepResponse = {\n state: {\n kind: 'KYC',\n phase: 'CAPTURE',\n quote: US_QUOTE,\n surface: {\n kind: 'URL_REDIRECT',\n provider: 'MOONPAY',\n params: { url: 'https://buy-sandbox.moonpay.com/challenge' },\n },\n },\n provider: PROVIDER,\n transitions: [\n {\n id: 'capture',\n mode: 'CLIENT_SURFACE',\n report: {\n endpoint: 'POST /fiat/kyc/capture',\n params: { quoteRef, provider: PROVIDER },\n expects: ['result'],\n },\n },\n ],\n}\n\nconst MOONPAY_SHARING_CONSENT: FiatStepResponse = {\n state: { kind: 'SESSION_AUTH', channel: 'PROVIDER_RENDERED' },\n provider: PROVIDER,\n transitions: [\n {\n id: 'start',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/session',\n params: { quoteRef, provider: PROVIDER },\n inputs: {\n termsAcceptance: {\n type: 'TERMS_ACCEPTANCE',\n version: MOONPAY_SHARING_CONSENT_VERSION,\n documentUrl: PERSONA_PRIVACY_POLICY_URL,\n labelFallback: 'Accept the terms',\n },\n },\n labelFallback: 'Continue',\n },\n ],\n}\n\nconst ORDER_REVIEW: FiatStepResponse = {\n state: { kind: 'ORDER', phase: 'AWAITING_CONFIRMATION', quote: US_QUOTE },\n provider: PROVIDER,\n transitions: [\n {\n id: 'confirm',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/orders',\n params: { quoteRef },\n },\n ],\n}\n\nconst ORDER = {\n orderId: 'o_preview',\n fiat: US_QUOTE.fiat,\n crypto: US_QUOTE.crypto,\n method: 'apple_pay',\n createdAt: CREATED_AT,\n} as const\n\nconst orderCreated = (\n state: Omit<\n Extract<FiatStepResponse['state'], { kind: 'ORDER'; phase: 'CREATED' }>,\n 'kind' | 'phase' | 'order'\n >,\n): FiatStepResponse => ({\n state: { kind: 'ORDER', phase: 'CREATED', order: ORDER, ...state },\n provider: PROVIDER,\n transitions: [],\n})\n\nconst SETTLED_ORDER = orderCreated({\n status: 'SETTLED',\n tx: { chainId: 1151111081099710, hash: TX_HASH },\n})\n\nconst FAILED_ORDER = orderCreated({\n status: 'FAILED',\n failureReason: {\n category: 'PAYMENT_DECLINED',\n retryable: true,\n recovery: 'RETRY_PAYMENT',\n },\n})\n\n/** An order the buyer just paid for, polled the way fun-backend sends it. */\nconst PROCESSING_ORDER: FiatStepResponse = {\n ...orderCreated({ status: 'PROCESSING' }),\n transitions: [\n {\n id: 'poll',\n mode: 'AWAIT',\n poll: {\n endpoint: `GET /fiat/orders/${ORDER.orderId}`,\n intervalMs: 2000,\n backoffFactor: 1,\n maxIntervalMs: 2000,\n // Long enough to read every line of the wait before the poll gives up.\n giveUpAfterMs: 600_000,\n },\n },\n ],\n}\n\n/**\n * The order a pay tap opens for the quote it named (`qr_<provider>_<amount>`), polled as\n * `PROCESSING_ORDER` is: a failover's lowered or switched quote, not the fixed MoonPay order.\n */\nconst processingOrderFor = ({ quoteRef }: { quoteRef?: string }) => {\n const [, provider, amount] = /^qr_([a-z]+)_(.+)$/.exec(quoteRef ?? '') ?? []\n if (provider === undefined || amount === undefined) {\n return PROCESSING_ORDER\n }\n const quote = quoteAt(provider.toUpperCase() as FiatProvider, amount)\n return {\n ...PROCESSING_ORDER,\n provider: provider.toUpperCase() as FiatProvider,\n state: {\n ...PROCESSING_ORDER.state,\n order: { ...ORDER, fiat: quote.fiat, crypto: quote.crypto },\n },\n } as FiatStepResponse\n}\n\nconst PENDING_ORDER: FiatStepResponse = {\n state: {\n kind: 'PENDING_ORDER',\n order: { ...ORDER, status: 'AWAITING_PAYMENT' },\n },\n provider: PROVIDER,\n transitions: [\n { id: 'resume', mode: 'SUBMIT', endpoint: 'GET /fiat/orders/o_preview' },\n {\n id: 'cancel',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/orders/o_preview/cancel',\n },\n ],\n}\n\n/** Transak's Apple Pay sheet, ready to open: a held capture never draws it. */\nconst TRANSAK_CAPTURE: FiatStepResponse = {\n state: {\n kind: 'PAYMENT',\n phase: 'CAPTURE',\n surface: {\n kind: 'PAY_SHEET',\n provider: 'TRANSAK',\n params: { sessionId: 'preview-session', environment: 'STAGING' },\n },\n },\n provider: 'TRANSAK',\n transitions: [\n {\n id: 'capture',\n mode: 'CLIENT_SURFACE',\n report: { endpoint: 'POST /fiat/orders', expects: ['requestId'] },\n },\n ],\n}\n\nconst BANK_INSTRUCTIONS: FiatStepResponse = {\n state: {\n kind: 'PAYMENT',\n phase: 'INSTRUCT',\n orderId: 'o_preview',\n instructions: {\n kind: 'BANK_FIELDS',\n fields: [\n { id: 'beneficiary', labelFallback: 'Beneficiary', value: 'MoonPay' },\n { id: 'routing', labelFallback: 'Routing number', value: '021000021' },\n { id: 'account', labelFallback: 'Account number', value: '12345678' },\n { id: 'reference', labelFallback: 'Reference', value: 'o_preview' },\n ],\n expiresAt: '2027-01-01T00:00:00Z',\n },\n },\n provider: PROVIDER,\n transitions: [\n {\n id: 'confirm_paid',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/orders/o_preview/confirm-payment',\n },\n ],\n}\n\n// A state the SDK has no screen for, the way a newer contract's would arrive.\nconst UNDRAWN = {\n state: { kind: 'WALLET_AUTH', challenge: { kind: 'SIWE', message: '\u2026' } },\n provider: PROVIDER,\n transitions: [],\n} as unknown as FiatStepResponse\n\nconst UNAVAILABLE = { status: 503 } as const\n// The login budget's 429 names what is left of its window; under a minute here.\nconst RATE_LIMITED = { status: 429, retryAfterSeconds: 45 } as const\n\n/**\n * What each CTA answers with unless a scenario says otherwise, so a preview keeps going past the\n * screen it opened on: sign-in, code, identity form, review, a settled order.\n */\nconst JOURNEY: Readonly<Record<string, PreviewResponse>> = {\n '/fiat/session': otp('EMAIL_OTP'),\n '/fiat/session/verify': kycForm(US_ROUND),\n '/fiat/auth': funAuthCode,\n '/fiat/auth/verify': FUN_AUTH_VERIFIED,\n '/fiat/kyc/form': ORDER_REVIEW,\n '/fiat/orders': SETTLED_ORDER,\n}\n\nconst fiat = (\n fiatSeed: NonNullable<FlowPreviewSeed['deposit']>['fiat'],\n backend: PreviewBackend = {},\n) => ({\n seed: { deposit: { fiat: { amount: AMOUNT, ...fiatSeed } } },\n backend: { ...backend, responses: { ...JOURNEY, ...backend.responses } },\n})\n\nconst paymentCrypto = (page: CryptoFlowScreen) => {\n const scenario = fiat(\n { paymentMethodPicker: true, paymentMethodCrypto: page },\n { quote: { ...PRICED, provider: 'TRANSAK' } },\n )\n return {\n ...scenario,\n seed: {\n deposit: {\n ...scenario.seed.deposit,\n chainId: '8453',\n sourceSymbol: 'USDC',\n },\n },\n }\n}\n\nconst form = (\n formDescriptor: FormDescriptor,\n identity: NonNullable<FiatSeed['identity']>,\n) => fiat({ step: kycForm(formDescriptor), identity })\n\ntype FiatSeed = NonNullable<NonNullable<FlowPreviewSeed['deposit']>['fiat']>\n\nconst DEMO_RECIPIENT = '0x2A8Bd916E85d98d8175258De99fc0ddbcC102eF6'\n\nconst DEFINITIONS: Record<\n PreviewScenarioId,\n { seed: FlowPreviewSeed; backend: PreviewBackend }\n> = {\n // Transak's entry isn't sent ahead of the tap, so the priced entry stays up until pressed.\n 'fiat.amount': fiat({}, { quote: { ...PRICED, provider: 'TRANSAK' } }),\n 'fiat.amount.depositMatch': fiat(\n { depositMatch: PREVIEW_MATCH },\n {\n feeSubsidized: true,\n quote: {\n ...PRICED,\n state: {\n ...PRICED.state,\n quote: {\n ...US_QUOTE,\n feeSubsidy: { currency: 'USD', amount: '0.50' },\n },\n },\n provider: 'TRANSAK',\n },\n },\n ),\n 'fiat.amount.subsidized': fiat(\n {},\n {\n feeSubsidized: true,\n quote: {\n ...PRICED,\n state: {\n ...PRICED.state,\n quote: {\n ...US_QUOTE,\n feeSubsidy: { currency: 'USD', amount: '0.50' },\n },\n },\n provider: 'TRANSAK',\n },\n },\n ),\n 'fiat.amount.depositMatch.unsubsidized': fiat(\n { depositMatch: PREVIEW_MATCH },\n { quote: { ...PRICED, provider: 'TRANSAK' } },\n ),\n 'fiat.amount.paymentMethodPicker': fiat(\n { paymentMethodPicker: true },\n { quote: { ...PRICED, provider: 'TRANSAK' } },\n ),\n 'fiat.amount.paymentMethodPicker.content': fiat(\n { paymentMethodPicker: true, paymentMethodContent: true },\n { quote: { ...PRICED, provider: 'TRANSAK' } },\n ),\n 'fiat.amount.paymentMethodPicker.swapped': fiat(\n { paymentMethodPicker: true, paymentMethodSwapped: true },\n { quote: { ...PRICED, provider: 'TRANSAK' } },\n ),\n 'fiat.amount.paymentMethodPicker.swappedPending': fiat(\n { paymentMethodPicker: true, paymentMethodSwappedPending: true },\n { quote: { ...PRICED, provider: 'TRANSAK' } },\n ),\n 'fiat.amount.paymentMethodPicker.cryptoToken': paymentCrypto('cryptoToken'),\n 'fiat.amount.paymentMethodPicker.cryptoNetwork':\n paymentCrypto('cryptoNetwork'),\n 'fiat.amount.paymentMethodPicker.cryptoAddress':\n paymentCrypto('cryptoAddress'),\n 'fiat.amount.paymentMethodPicker.cryptoLearnMore':\n paymentCrypto('cryptoLearnMore'),\n 'fiat.amount.empty': fiat(\n { amount: '' },\n { quote: { ...PRICED, provider: 'TRANSAK' } },\n ),\n 'fiat.amount.belowMinimum': fiat(\n { amount: '10' },\n { quote: PRICED, minimum: '20' },\n ),\n 'fiat.amount.otpThrottled': fiat(\n { step: otpThrottled },\n { responses: { '/fiat/session': otp('SMS_OTP') } },\n ),\n 'fiat.amount.noProvider': fiat({}, { noRoute: 'NO_CANDIDATE' }),\n 'fiat.amount.kycUnservable': fiat({}, { noRoute: 'KYC_INSUFFICIENT' }),\n 'fiat.amount.userLimit': fiat({}, { noRoute: 'USER_LIMIT' }),\n 'fiat.amount.providerOutage': fiat({}, { noRoute: 'PROVIDER_OUTAGE' }),\n 'fiat.amount.noRouteToday': fiat({}, { noRoute: 'NO_CANDIDATE_LEGACY' }),\n // alex_fine on 2026-10-04: $995 left on Coinbase, $7,285.96 on Stripe; MoonPay $5,000 now and\n // $20,000 after identity. The $1,000 price must not cap a $10,000 deposit MoonPay asks to\n // verify. A host with no Stripe SDK skips Stripe; MoonPay's $5,000 tier stands in for it.\n // Payable at the seeded amount; one more digit asks for identity, which the screen reads as a\n // crossed daily limit.\n 'fiat.amount.kycThreshold': fiat(\n { paymentMethodPicker: true },\n {\n feeSubsidized: true,\n providers: [\n {\n provider: 'TRANSAK',\n min: '5',\n max: '5000',\n visibility: 'AUTH_GATED',\n answer: kycAbove(AMOUNT),\n },\n ],\n },\n ),\n 'fiat.amount.providerCeiling': fiat(\n { amount: '1000' },\n {\n providers: [\n {\n provider: 'COINBASE',\n min: '5',\n max: '995',\n visibility: 'AUTH_GATED',\n answer: pricedAt('COINBASE', '995'),\n },\n {\n provider: 'STRIPE',\n min: '5',\n max: '7285.96',\n visibility: 'AUTH_GATED',\n answer: pricedAt('STRIPE', '7285.96'),\n },\n {\n provider: 'MOONPAY',\n min: '20',\n max: '20000',\n visibility: 'PARTIAL',\n answer: moonPayAt,\n },\n ],\n },\n ),\n // A New York buyer: no Stripe, $10 left on Coinbase, MoonPay from $20.\n 'fiat.amount.gap': fiat(\n { amount: '12' },\n {\n ranges: [\n ['5', '2500', '10'],\n ['20', '10000', null],\n ],\n },\n ),\n 'fiat.amount.currencyLookupFailed': fiat({}, { currencyLookupFails: true }),\n 'fiat.contact.email': fiat(\n { pressEntry: true },\n { quote: pricedQuote({ email: { type: 'TEXT' } }) },\n ),\n 'fiat.contact.phone': fiat(\n { pressEntry: true },\n { quote: pricedQuote({ phone: { type: 'TEXT' } }) },\n ),\n 'fiat.contact.redirected': fiat({\n redirectHold: {\n fields: [{ name: 'phoneNumber', kind: 'PHONE' }],\n contacts: { phone: '+33612345678' },\n },\n }),\n 'fiat.otp.email': fiat({ step: otp('EMAIL_OTP') }),\n 'fiat.otp.sms': fiat({ step: otp('SMS_OTP') }),\n 'fiat.funauth.email': fiat({ pressEntry: true }, { quote: FUN_AUTH_EMAIL }),\n // Built as the scenario opens, so its resend countdown starts then.\n 'fiat.funauth.code': fiat({ step: funAuthCode }),\n 'fiat.funauth.code.tooMany': fiat({ step: FUN_AUTH_TOO_MANY }),\n 'fiat.funauth.verified': fiat({ step: FUN_AUTH_VERIFIED }),\n 'fiat.funauth.reauth': fiat({\n step: PROCESSING_ORDER,\n paymentCaptured: true,\n funReauth: true,\n }),\n 'kyc.l1.intro': form(US_ROUND, { page: 'consent' }),\n 'kyc.l1.name': form(US_ROUND, { page: 'form', section: 'NAME' }),\n 'kyc.l1.dob': form(US_ROUND, { page: 'form', section: 'DOB' }),\n 'kyc.l1.address': form(US_ROUND, { page: 'form', section: 'ADDRESS' }),\n 'kyc.l1.ssn': form(US_ROUND, { page: 'form', section: 'SSN' }),\n 'kyc.nationality': form(NATIONALITY_FORM, { page: 'form' }),\n 'kyc.country': form(COUNTRY_FORM, { page: 'form' }),\n 'kyc.ssnLastFour': form(LAST_FOUR_FORM, { page: 'form' }),\n 'kyc.l2.intro': form(L2_FORM, { page: 'consent' }),\n 'kyc.stripe.l1.intro': fiat({\n step: kycForm(US_ROUND, 'l1'),\n identity: { page: 'consent' },\n }),\n 'kyc.l2.moonpay-consent': fiat(\n { step: MOONPAY_SHARING_CONSENT },\n { responses: { '/fiat/session': IN_REVIEW } },\n ),\n 'kyc.l2.dob': form(L2_FORM, { page: 'form', section: 'DOB' }),\n 'kyc.l2.occupation': form(L2_FORM, { page: 'form', section: 'OCCUPATION' }),\n 'kyc.l2.purpose': form(L2_FORM, { page: 'form', section: 'PURPOSE' }),\n 'kyc.dueDiligence': form(DUE_DILIGENCE_FORM, { page: 'form' }),\n 'kyc.dueDiligence.phoneRefused': fiat({\n step: kycForm(DUE_DILIGENCE_FORM, undefined, PHONE_REFUSAL),\n identity: { page: 'form' },\n }),\n 'kyc.dueDiligence.income': form(DUE_DILIGENCE_FORM, {\n page: 'form',\n section: 'INCOME',\n }),\n 'kyc.edd.profession': form(ENHANCED_DUE_DILIGENCE_FORM, {\n page: 'form',\n section: 'OCCUPATION',\n }),\n 'kyc.edd.netWorth': form(ENHANCED_DUE_DILIGENCE_FORM, {\n page: 'form',\n section: 'NET_WORTH',\n }),\n 'kyc.form.unsupported': form(UNSUPPORTED_FORM, { page: 'form' }),\n // The review's poll lands on a second round, so the round's screens are drawn again.\n 'kyc.stepUp.afterReview': fiat(\n { step: kycForm(LAST_FOUR_FORM), identity: { page: 'form' } },\n {\n responses: {\n '/fiat/kyc/form': IN_REVIEW,\n [`/fiat/quotes/${quoteRef}`]: kycForm(L2_FORM),\n },\n },\n ),\n 'kyc.form.retry': fiat(\n {\n step: kycForm(US_ROUND),\n identity: { page: 'form', section: 'SSN' },\n submitOnOpen: 'submit_round',\n },\n { responses: { '/fiat/kyc/form': UNAVAILABLE } },\n ),\n 'kyc.form.rateLimited': fiat(\n {\n step: kycForm(US_ROUND),\n identity: { page: 'form', section: 'SSN' },\n submitOnOpen: 'submit_round',\n },\n { responses: { '/fiat/kyc/form': RATE_LIMITED } },\n ),\n 'kyc.capture.intro': fiat({ step: KYC_CAPTURE }),\n 'kyc.capture.moonpay-handoff': fiat({\n step: MOONPAY_HOSTED_CHECK,\n captureReissued: true,\n moonPayCaptureRedoing: true,\n }),\n // The quote hands off to MoonPay's own checkout, seeded at MoonPay's extra check: the preview's\n // backend answers no `/fiat/next`.\n 'kyc.moonpay-check.intro': fiat(\n { moonPayChallenge: (start) => moonPayChallengeState(start, 'intro') },\n { quote: MOONPAY_HANDOFF },\n ),\n 'kyc.moonpay-check.again': fiat(\n { moonPayChallenge: (start) => moonPayChallengeState(start, 'again') },\n { quote: MOONPAY_HANDOFF },\n ),\n 'kyc.completion.review': fiat({ step: IN_REVIEW, kycCompletion: 'review' }),\n // The pending card at once, with \"Deposit max\" at the table's current limit.\n 'kyc.review.extended': submittedInto(\n reviewFor({ duration: 'EXTENDED' }),\n reviewFor({ duration: 'EXTENDED' }),\n ),\n // \"Authorizing your limits now\u2026\" while the poll runs, then the price it brings.\n 'kyc.review.brief': submittedInto(\n reviewFor({ duration: 'BRIEF', holdMs: 30_000 }),\n PRICED,\n ),\n 'kyc.completion.hold': fiat({ step: ON_HOLD, kycCompletion: 'hold' }),\n 'kyc.completion.restricted': fiat({\n step: REJECTED,\n kycCompletion: 'restricted',\n }),\n 'kyc.required': fiat({}, { quote: kycForm(US_ROUND) }),\n 'kyc.verdict.review': fiat({ step: IN_REVIEW }),\n 'kyc.verdict.hold': fiat({ step: ON_HOLD }),\n 'kyc.verdict.rejected': fiat({ step: REJECTED }),\n 'kyc.options.review': fiat({ step: IN_REVIEW, pressEntry: true }),\n 'kyc.options.hold': fiat({ step: ON_HOLD, pressEntry: true }),\n 'kyc.options.rejected': fiat({ step: REJECTED, pressEntry: true }),\n 'order.review': fiat({ step: ORDER_REVIEW }),\n 'order.bankInstructions': fiat({ step: BANK_INSTRUCTIONS }),\n 'order.pending': fiat({ step: PENDING_ORDER }),\n 'order.tracking': fiat({ step: orderCreated({ status: 'PROCESSING' }) }),\n 'order.success': fiat({ step: SETTLED_ORDER }),\n 'order.processing': fiat({ step: PROCESSING_ORDER, paymentCaptured: true }),\n // Lands after the first two lines of the wait have had their turn.\n 'order.processing.lands': fiat(\n { step: PROCESSING_ORDER, paymentCaptured: true },\n {\n settles: {\n endpoint: `/fiat/orders/${ORDER.orderId}`,\n afterMs: 11_000,\n step: SETTLED_ORDER,\n },\n },\n ),\n // Fails at the same point the landing would: the card gives way to the\n // payment-failed sheet.\n 'order.processing.fails': fiat(\n { step: PROCESSING_ORDER, paymentCaptured: true },\n {\n settles: {\n endpoint: `/fiat/orders/${ORDER.orderId}`,\n afterMs: 11_000,\n step: FAILED_ORDER,\n },\n },\n ),\n 'order.failed': fiat({ step: FAILED_ORDER }),\n 'order.deliveryFailed': fiat({\n step: {\n state: { kind: 'DELIVERY', state: 'FAILED' },\n orderId: ORDER.orderId,\n provider: PROVIDER,\n transitions: [],\n },\n }),\n 'order.cancelled': fiat({\n step: orderCreated({ status: 'CANCELLED' }),\n }),\n 'order.refunded': fiat({\n step: orderCreated({\n status: 'REFUNDED',\n refund: { ...US_QUOTE.fiat, expectedBy: '2026-09-08T12:00:00Z' },\n }),\n }),\n 'fiat.blocked': fiat({\n step: {\n state: {\n kind: 'BLOCKED',\n reason: 'REGION_UNSUPPORTED',\n retryAfter: null,\n },\n transitions: [],\n },\n }),\n 'fiat.blocked.later': fiat({\n step: {\n state: {\n kind: 'BLOCKED',\n reason: 'REGION_UNSUPPORTED',\n retryAfter: '2026-11-01T00:00:00Z',\n },\n transitions: [],\n },\n }),\n 'fiat.blocked.unservable': fiat({\n step: {\n state: { kind: 'BLOCKED', reason: 'ASSET_UNSUPPORTED', retryAfter: null },\n transitions: [],\n },\n }),\n 'fiat.accountIneligible': fiat({ accountIneligible: true }),\n 'fiat.unsupported': fiat({ step: UNDRAWN }),\n 'fiat.surfaceFailed': fiat({\n step: ORDER_REVIEW,\n surfaceFailure: {\n code: 'provider_error',\n detail: 'The provider could not start this payment.',\n },\n }),\n // The quote's own pay sheet failed: the processing card holds the ways on.\n // Transak, not MoonPay: MoonPay's entry starts its session ahead of the tap,\n // which would carry the page past the failure. Coinbase is left for the\n // reroute probe to find, so the card offers another provider.\n 'fiat.paymentFailed': fiat(\n { amount: AMOUNT, quoteSurfaceFailure: { code: 'provider_error' } },\n {\n providers: [\n {\n provider: 'TRANSAK',\n min: '5',\n max: '2000',\n visibility: 'AUTH_GATED',\n answer: pricedAt('TRANSAK', '2000'),\n },\n {\n provider: 'COINBASE',\n min: '5',\n max: '2000',\n visibility: 'AUTH_GATED',\n answer: pricedAt('COINBASE', '2000'),\n },\n ],\n },\n ),\n // Coinbase first: its sheet is the one closed, and Transak the provider offered instead.\n 'fiat.paymentDismissed': fiat(\n {\n amount: AMOUNT,\n quoteSurfaceFailure: { code: 'coinbase_apple_pay:dismissed' },\n },\n {\n responses: { '/fiat/orders': processingOrderFor },\n providers: [\n {\n provider: 'COINBASE',\n min: '5',\n max: '2000',\n visibility: 'AUTH_GATED',\n // Payable on tap: a prepared session would open a round, and the\n // closed sheet is the quote's own.\n answer: (amount) =>\n payableOnTap(pricedAt('COINBASE', '2000')(amount)),\n },\n {\n provider: 'TRANSAK',\n min: '5',\n max: '2000',\n visibility: 'AUTH_GATED',\n answer: pricedAt('TRANSAK', '2000'),\n },\n ],\n },\n ),\n // The card cannot cover the charge: the amount is halved and Coinbase paid again.\n 'fiat.insufficientFunds': fiat(\n {\n amount: AMOUNT,\n quoteSurfaceFailure: {\n code: 'ERROR_CODE_GUEST_CARD_INSUFFICIENT_BALANCE',\n },\n },\n {\n responses: { '/fiat/orders': processingOrderFor },\n providers: [\n {\n provider: 'COINBASE',\n min: '5',\n max: '2000',\n visibility: 'AUTH_GATED',\n // Payable on tap, as the declined sheet was the quote's own.\n answer: (amount) =>\n payableOnTap(pricedAt('COINBASE', '2000')(amount)),\n },\n ],\n },\n ),\n // The same decline at Coinbase's minimum: nothing halves, so another card is asked for.\n 'fiat.insufficientFundsAtMinimum': fiat(\n {\n amount: AMOUNT,\n quoteSurfaceFailure: {\n code: 'ERROR_CODE_GUEST_CARD_INSUFFICIENT_BALANCE',\n },\n },\n {\n responses: { '/fiat/orders': processingOrderFor },\n providers: [\n {\n provider: 'COINBASE',\n min: AMOUNT,\n max: '2000',\n visibility: 'AUTH_GATED',\n // Payable on tap, as the declined sheet was the quote's own. The\n // decline reads its floor off this quote's limits.\n answer: (amount) =>\n payableOnTap(pricedAt('COINBASE', '2000', AMOUNT)(amount)),\n },\n ],\n },\n ),\n // Stripe declined the card without a reason: Apple Pay opens at Stripe again.\n 'fiat.stripeDeclined': fiat(\n {\n amount: AMOUNT,\n quoteSurfaceFailure: { code: 'perform_checkout:card_declined' },\n },\n {\n responses: { '/fiat/orders': processingOrderFor },\n providers: [\n {\n provider: 'STRIPE',\n min: '5',\n max: '7285.96',\n visibility: 'AUTH_GATED',\n // Payable on tap, as the declined sheet was the quote's own.\n answer: (amount) =>\n payableOnTap(pricedAt('STRIPE', '7285.96')(amount)),\n },\n ],\n },\n ),\n // The card's bank holds the charge for approval: Coinbase is paid again at the same amount.\n 'fiat.softDeclined': fiat(\n {\n amount: AMOUNT,\n quoteSurfaceFailure: { code: 'ERROR_CODE_GUEST_CARD_SOFT_DECLINED' },\n },\n {\n responses: { '/fiat/orders': processingOrderFor },\n providers: [\n {\n provider: 'COINBASE',\n min: '5',\n max: '2000',\n visibility: 'AUTH_GATED',\n // Payable on tap, as the declined sheet was the quote's own.\n answer: (amount) =>\n payableOnTap(pricedAt('COINBASE', '2000')(amount)),\n },\n ],\n },\n ),\n // Signed in where a failover moved the deposit: the payment waits on the verified sheet.\n 'fiat.failoverVerified': fiat({\n step: TRANSAK_CAPTURE,\n failoverVerified: true,\n }),\n 'fiat.prepaidDeclined': fiat(\n {\n amount: AMOUNT,\n quoteSurfaceFailure: { code: 'ERROR_CODE_GUEST_CARD_PREPAID_DECLINED' },\n },\n {\n responses: { '/fiat/orders': processingOrderFor },\n providers: [\n {\n provider: 'COINBASE',\n min: '5',\n max: '2000',\n visibility: 'AUTH_GATED',\n // Payable on tap, so the decline lands on the quote's own sheet,\n // not a round.\n answer: (amount) =>\n payableOnTap(pricedAt('COINBASE', '2000')(amount)),\n },\n {\n provider: 'TRANSAK',\n min: '5',\n max: '2000',\n visibility: 'AUTH_GATED',\n answer: pricedAt('TRANSAK', '2000'),\n },\n ],\n },\n ),\n // A prepaid decline with nobody else to take it: Continue's switch lands back at Coinbase.\n 'fiat.prepaidDeclinedAlone': fiat(\n {\n amount: AMOUNT,\n quoteSurfaceFailure: { code: 'ERROR_CODE_GUEST_CARD_PREPAID_DECLINED' },\n },\n {\n responses: { '/fiat/orders': processingOrderFor },\n providers: [\n {\n provider: 'COINBASE',\n min: '5',\n max: '2000',\n visibility: 'AUTH_GATED',\n // Payable on tap, as the declined sheet was the quote's own.\n answer: (amount) =>\n payableOnTap(pricedAt('COINBASE', '2000')(amount)),\n },\n ],\n },\n ),\n 'fiat.retryable': fiat(\n { step: ORDER_REVIEW, submitOnOpen: 'confirm' },\n { responses: { '/fiat/orders': UNAVAILABLE } },\n ),\n 'fiat.rateLimited': fiat(\n { step: ORDER_REVIEW, submitOnOpen: 'confirm' },\n { responses: { '/fiat/orders': RATE_LIMITED } },\n ),\n 'fiat.rateLimited.retryAfter': fiat(\n { step: ORDER_REVIEW, submitOnOpen: 'confirm' },\n {\n responses: {\n '/fiat/orders': { ...RATE_LIMITED, retryAfterSeconds: 300 },\n },\n },\n ),\n 'deposit.addMoney': {\n seed: { deposit: { screen: 'addMoney' } },\n backend: {},\n },\n 'deposit.wallet.amount': {\n seed: { deposit: { screen: 'depositAmount', wallet: WALLET } },\n backend: {},\n },\n 'deposit.wallet.connecting': {\n seed: {\n deposit: {\n screen: 'depositAmount',\n wallet: { ...WALLET, amount: '', connection: 'connecting' },\n },\n },\n backend: {},\n },\n 'deposit.wallet.connectFailed': {\n seed: {\n deposit: {\n screen: 'depositAmount',\n wallet: { ...WALLET, amount: '', connection: 'failed' },\n },\n },\n backend: {},\n },\n 'deposit.wallet.assets': {\n seed: {\n deposit: {\n screen: 'depositAmount',\n wallet: {\n ...WALLET,\n assetListOpen: true,\n tokens: Array.from({ length: 14 }, (_, index) => ({\n ...WALLET.tokens[0],\n contractAddress: `preview-token-${index}`,\n name: `Token ${index + 1}`,\n symbol: `T${index + 1}`,\n tokenBalance:\n index < 10 ? String((40 - index) * 1_000_000) : '1000',\n totalUsdValue: index < 10 ? 40 - index : 0.001,\n })),\n },\n },\n },\n backend: {},\n },\n 'deposit.wallet.insufficient': {\n seed: {\n deposit: {\n screen: 'depositAmount',\n wallet: {\n ...WALLET,\n amount: '',\n tokens: [\n { ...WALLET.tokens[0], tokenBalance: '1000', totalUsdValue: 0.001 },\n ],\n },\n },\n },\n backend: {},\n },\n 'deposit.wallet.empty': {\n seed: {\n deposit: {\n screen: 'depositAmount',\n wallet: { ...WALLET, amount: '', tokens: [] },\n },\n },\n backend: {},\n },\n 'deposit.wallet.emptyAssets': {\n seed: {\n deposit: {\n screen: 'depositAmount',\n wallet: { ...WALLET, amount: '', tokens: [], assetListOpen: true },\n },\n },\n backend: {},\n },\n 'deposit.wallet.unlink': {\n seed: {\n deposit: {\n screen: 'depositAmount',\n wallet: { ...WALLET, menuOpen: true },\n },\n },\n backend: {},\n },\n 'deposit.wallet.unlinkFailed': {\n seed: {\n deposit: {\n screen: 'depositAmount',\n wallet: { ...WALLET, unlinkFailed: true },\n },\n },\n backend: {},\n },\n 'deposit.wallet.confirm': {\n seed: { deposit: { screen: 'walletConfirm', wallet: WALLET } },\n backend: {},\n },\n 'deposit.wallet.sent': {\n seed: {\n deposit: {\n screen: 'walletConfirm',\n wallet: { ...WALLET, status: 'sent' },\n },\n },\n backend: {},\n },\n 'deposit.wallet.failed': {\n seed: {\n deposit: {\n screen: 'walletConfirm',\n wallet: { ...WALLET, status: 'failed' },\n },\n },\n backend: {},\n },\n 'deposit.wallet.pending': {\n seed: {\n deposit: {\n screen: 'walletConfirm',\n wallet: { ...WALLET, status: 'pending' },\n },\n },\n backend: {},\n },\n 'deposit.transfer': {\n seed: { deposit: { screen: 'transfer', chainId: '8453' } },\n backend: {},\n },\n 'deposit.lockedTransfer': {\n seed: {\n deposit: { screen: 'transfer', chainId: '8453', sourceSymbol: 'USDC' },\n },\n backend: {},\n },\n 'deposit.crypto.token': {\n seed: { deposit: { screen: 'cryptoToken' } },\n backend: {},\n },\n 'deposit.crypto.token.search': {\n seed: { deposit: { screen: 'cryptoToken', tokenQuery: 'w' } },\n backend: {},\n },\n 'deposit.crypto.network': {\n seed: {\n deposit: {\n screen: 'cryptoNetwork',\n chainId: '8453',\n sourceSymbol: 'USDC',\n },\n },\n backend: {},\n },\n 'deposit.crypto.address': {\n seed: {\n deposit: {\n screen: 'cryptoAddress',\n chainId: '8453',\n sourceSymbol: 'USDC',\n },\n },\n backend: {},\n },\n 'deposit.crypto.address.expanded': {\n seed: {\n deposit: {\n screen: 'cryptoAddress',\n chainId: '8453',\n sourceSymbol: 'USDC',\n addressExpanded: true,\n },\n },\n backend: {},\n },\n 'deposit.crypto.learnMore': {\n seed: {\n deposit: {\n screen: 'cryptoLearnMore',\n chainId: '8453',\n sourceSymbol: 'USDC',\n },\n },\n backend: {},\n },\n 'withdraw.method': { seed: { withdrawal: {} }, backend: {} },\n // The list the venue's users see: cash rows offered with no wallet, because\n // `submitFiatWithdrawal` pays Swapped. Live /fops, so the rows depend on region.\n 'withdraw.method.venuePayout': {\n seed: { withdrawal: { stack: ['withdrawMethod'] } },\n backend: {},\n },\n 'withdraw.amount': {\n seed: {\n withdrawal: { stack: ['withdrawMethod', 'withdrawAmount'], amount: '25' },\n },\n backend: {},\n },\n 'withdraw.address': {\n seed: {\n withdrawal: {\n stack: ['withdrawMethod', 'withdrawAmount', 'withdrawAddress'],\n amount: '25',\n recipient: DEMO_RECIPIENT,\n },\n },\n backend: {},\n },\n // Empty, which is where the panel shows.\n 'withdraw.address.pastePanel': {\n seed: {\n withdrawal: {\n stack: ['withdrawMethod', 'withdrawAmount', 'withdrawAddress'],\n amount: '25',\n },\n },\n backend: {},\n },\n // Filled and open for editing: the field shows the address start, not its tail.\n 'withdraw.address.pastePanel.editing': {\n seed: {\n withdrawal: {\n stack: ['withdrawMethod', 'withdrawAmount', 'withdrawAddress'],\n amount: '25',\n recipient: DEMO_RECIPIENT,\n addressFocused: true,\n },\n },\n backend: {},\n },\n 'withdraw.receiveToken': {\n seed: {\n withdrawal: {\n stack: [\n 'withdrawMethod',\n 'withdrawAmount',\n 'withdrawAddress',\n 'withdrawReceiveToken',\n ],\n amount: '25',\n recipient: DEMO_RECIPIENT,\n },\n },\n backend: {},\n },\n 'withdraw.complete': {\n seed: {\n withdrawal: {\n stack: ['withdrawComplete'],\n complete: {\n txHash: TX_HASH,\n amountLabel: '25 USDG',\n usdLabel: '$25.00',\n },\n },\n },\n backend: {},\n },\n 'withdraw.error': {\n seed: { withdrawal: { executionError: true } },\n backend: {},\n },\n}\n\nexport const PREVIEW_SCENARIOS: Readonly<\n Record<PreviewScenarioId, PreviewScenario>\n> = Object.fromEntries(\n Object.entries(DEFINITIONS).map(([id, definition]) => [\n id,\n {\n id,\n ...PREVIEW_SCENARIO_CATALOG[id as PreviewScenarioId],\n ...definition,\n },\n ]),\n) as Record<PreviewScenarioId, PreviewScenario>\n\n/** The step a scenario's fiat session opens on: its seed, else the quote the entry prices. */\nexport function scenarioStartStep(\n scenario: PreviewScenario,\n): FiatStepResponse | undefined {\n return openingStep(scenario.seed.deposit?.fiat) ?? scenario.backend.quote\n}\n\nexport const DEFAULT_PREVIEW_QUOTE = PRICED\n", "// KYC round fixtures shared by the on-device stories and hosted-preview deep links, so a\n// state reachable in one is reachable in the other.\n\nimport type { FormDescriptor, FormField, Quote } from '@funkit/connect-core'\n\nimport {\n EXPECTED_AMOUNT_PER_MONTH,\n GROSS_ANNUAL_INCOME,\n NET_WORTH,\n TRANSACTIONS_PER_MONTH,\n} from '../../fiat/form/formLayout'\n\nconst text = (\n id: FormField['id'],\n label: string,\n required = true,\n): FormField => ({\n id,\n type: 'TEXT',\n labelFallback: label,\n required,\n})\n\n/** Every field the L1 frames draw, and nothing else. */\nexport const US_ROUND: FormDescriptor = {\n formId: 'us-v2:0',\n fields: [\n text('LEGAL_FIRST_NAME', 'First name'),\n text('LEGAL_LAST_NAME', 'Last Name'),\n {\n id: 'DATE_OF_BIRTH',\n type: 'DATE',\n labelFallback: 'Date of Birth',\n required: true,\n },\n text('RESIDENTIAL_ADDRESS_LINE_1', 'Address'),\n text('RESIDENTIAL_ADDRESS_LINE_2', 'Apartment, suite, etc.', false),\n text('RESIDENTIAL_ADDRESS_CITY', 'City'),\n {\n id: 'RESIDENTIAL_ADDRESS_REGION',\n type: 'SELECT',\n labelFallback: 'State',\n required: true,\n options: [\n { id: 'CA', labelFallback: 'California' },\n { id: 'NY', labelFallback: 'New York' },\n { id: 'TX', labelFallback: 'Texas' },\n ],\n },\n text('RESIDENTIAL_ADDRESS_POSTAL_CODE', 'ZIP code'),\n text('TAX_IDENTIFIER', 'SSN'),\n ],\n}\n\nexport const LAST_FOUR_FORM: FormDescriptor = {\n formId: 'last-four',\n fields: [\n {\n id: 'TAX_IDENTIFIER',\n type: 'TEXT',\n labelFallback: 'SSN',\n required: true,\n regex: '^\\\\d{4}$',\n },\n ],\n}\n\nexport const COUNTRY_FORM: FormDescriptor = {\n formId: 'country',\n fields: [\n {\n id: 'RESIDENTIAL_ADDRESS_COUNTRY',\n type: 'COUNTRY',\n labelFallback: 'Country',\n required: true,\n },\n ],\n}\n\n/** An address round as MoonPay words it, whose labels follow the country. */\nexport const ADDRESS_ROUND: FormDescriptor = {\n formId: 'address',\n fields: [\n ...COUNTRY_FORM.fields,\n text('RESIDENTIAL_ADDRESS_LINE_1', 'Address line 1'),\n text('RESIDENTIAL_ADDRESS_CITY', 'City'),\n text('RESIDENTIAL_ADDRESS_REGION', 'State, province, or region'),\n text('RESIDENTIAL_ADDRESS_POSTAL_CODE', 'Postal code'),\n ],\n}\n\n/** The round MoonPay closes with: one COUNTRY-typed field, asked alone. */\nexport const NATIONALITY_FORM: FormDescriptor = {\n formId: 'nationality',\n fields: [\n {\n id: 'NATIONALITY',\n type: 'COUNTRY',\n labelFallback: 'Nationality',\n required: true,\n },\n ],\n}\n\n/** A COUNTRY field no frame drew, so the catch-all page has to name it. */\nexport const DETAILS_COUNTRY_FORM: FormDescriptor = {\n formId: 'details-country',\n fields: [\n {\n id: 'COUNTRY_OF_BIRTH',\n type: 'COUNTRY',\n labelFallback: 'Country of birth',\n required: true,\n },\n ],\n}\n\nexport const OCCUPATION_FORM: FormDescriptor = {\n formId: 'kyc-r2-occupation',\n fields: [\n {\n id: 'OCCUPATION_TITLE',\n type: 'SELECT',\n labelFallback: 'Please select occupation',\n required: true,\n options: [\n 'Consulting, IT, or business services',\n 'Design, marketing or communication',\n 'Travel, accommodation, or transport',\n 'Entertainment, arts or photography',\n 'Health, sports or personal care',\n 'Food, beverages, or tobacco',\n 'Retail, eCommerce, wholesale or manufacturing',\n 'Dealers & Resellers',\n 'Financial services, products, or holding companies',\n ].map((labelFallback, index) => ({\n id: `occupation-${index}`,\n labelFallback,\n })),\n },\n ],\n}\n\nexport const PURPOSE_FORM: FormDescriptor = {\n formId: 'kyc-r2-purpose',\n fields: [\n {\n id: 'PURPOSE_OF_TRANSACTION',\n type: 'SELECT',\n labelFallback: 'Please select',\n required: true,\n options: [\n { id: 'investment', labelFallback: 'Investment' },\n { id: 'payments', labelFallback: 'Payments' },\n ],\n },\n ],\n}\n\nconst AMOUNT_REGEX = '^(?!0+(\\\\.0{1,2})?$)\\\\d{1,12}(\\\\.\\\\d{1,2})?$'\n\nconst pattern = (\n id: FormField['id'],\n label: string,\n regex: string,\n): FormField => ({\n id,\n type: 'TEXT',\n labelFallback: label,\n required: true,\n regex,\n})\n\nconst select = (\n id: FormField['id'],\n label: string,\n options: [string, string][],\n): FormField => ({\n id,\n type: 'SELECT',\n labelFallback: label,\n required: true,\n options: options.map(([optionId, labelFallback]) => ({\n id: optionId,\n labelFallback,\n })),\n})\n\n/**\n * MoonPay's customer due diligence round: the tax fields, the phone, and the\n * declarations and figures its questionnaire asks for, all in one form.\n */\nexport const DUE_DILIGENCE_FORM: FormDescriptor = {\n formId: 'moonpay-cdd',\n fields: [\n {\n id: 'TAX_RESIDENCE_COUNTRY',\n type: 'COUNTRY',\n labelFallback: 'Tax residence',\n required: true,\n },\n pattern('TAX_IDENTIFIER', 'SSN', '^\\\\d{9}$'),\n pattern('PHONE_NUMBER', 'Mobile phone number', '^\\\\+[1-9]\\\\d{1,14}$'),\n select('EMPLOYMENT_STATUS', 'Employment status', [\n ['employedOrSelfEmployed', 'Employed or self-employed'],\n ['retired', 'Retired'],\n ['student', 'Student'],\n ['unemployed', 'Unemployed'],\n ]),\n select('PURPOSE_OF_SERVICE', 'What will you use this for?', [\n ['investing', 'Investing'],\n ['payments', 'Payments'],\n ['purchasingDigitalAssets', 'Buying digital assets'],\n ['purchasingGoodsOrServices', 'Buying goods or services'],\n ['trading', 'Trading'],\n ]),\n select('SOURCE_OF_WEALTH_DECLARATION', 'Source of wealth', [\n ['salary', 'Salary'],\n ['savings', 'Savings'],\n ['investments', 'Investments'],\n ['cryptoTrading', 'Crypto trading'],\n ['other', 'Other'],\n ]),\n pattern(GROSS_ANNUAL_INCOME, 'Gross annual income', AMOUNT_REGEX),\n pattern(\n EXPECTED_AMOUNT_PER_MONTH,\n 'Expected amount per month',\n AMOUNT_REGEX,\n ),\n pattern(\n TRANSACTIONS_PER_MONTH,\n 'Transactions per month',\n '^[1-9]\\\\d{0,3}$',\n ),\n ],\n}\n\n/** MoonPay's enhanced due diligence round: the profession, then the net worth. */\nexport const ENHANCED_DUE_DILIGENCE_FORM: FormDescriptor = {\n formId: 'moonpay-edd',\n fields: [\n select('OCCUPATION_INDUSTRY', 'Profession', [\n ['agriculture', 'Agriculture'],\n ['artsAndEntertainment', 'Arts and entertainment'],\n ['businessOwner', 'Business owner'],\n ['education', 'Education'],\n ['financialServices', 'Financial services'],\n ['healthcare', 'Healthcare'],\n ['industrialTradesAndTransport', 'Industrial trades and transport'],\n ['informationAndTechnology', 'Information and technology'],\n ['legalAndProfessionalServices', 'Legal and professional services'],\n ['publicSector', 'Public sector'],\n ['realEstate', 'Real estate'],\n ['retail', 'Retail'],\n ['seniorManagement', 'Senior management'],\n ]),\n pattern(NET_WORTH, 'Net worth (USD)', AMOUNT_REGEX),\n ],\n}\n\n/** The additional-information round the L2 faceplate introduces. */\nexport const L2_FORM: FormDescriptor = {\n formId: 'kyc-r2-l2',\n fields: [\n {\n id: 'DATE_OF_BIRTH',\n type: 'DATE',\n labelFallback: 'Date of Birth',\n required: true,\n },\n ...OCCUPATION_FORM.fields,\n ...PURPOSE_FORM.fields,\n ],\n}\n\n/** A form the native renderer has no drawing for. */\nexport const UNSUPPORTED_FORM: FormDescriptor = {\n formId: 'unsupported',\n fields: [\n {\n id: 'QUESTIONNAIRE_RESPONSE:us-v2:passport',\n type: 'FILE',\n labelFallback: 'Passport',\n required: true,\n },\n ],\n}\n\n/**\n * The quote the round carries, so the price stays on screen through\n * verification. `$105` is the amount the frames are drawn with.\n */\nexport const US_QUOTE: Quote = {\n quoteRef: 'q_kyc_story',\n fiat: { currency: 'USD', amount: '105.00' },\n crypto: { currency: 'USDC', network: 'solana', amount: '104.50' },\n rate: '0.995238',\n totalFee: '0.50',\n feeBreakdown: [{ id: 'provider_fee', labelFallback: 'Fee', amount: '0.50' }],\n paymentMethod: 'apple_pay',\n expiresAt: '2027-01-01T00:00:00Z',\n}\n\nexport const VALID_VALUES = {\n LEGAL_FIRST_NAME: 'Jane',\n LEGAL_LAST_NAME: 'Doe',\n DATE_OF_BIRTH: '1990-06-15',\n RESIDENTIAL_ADDRESS_LINE_1: '123 Example Street',\n RESIDENTIAL_ADDRESS_CITY: 'New York',\n RESIDENTIAL_ADDRESS_REGION: 'NY',\n RESIDENTIAL_ADDRESS_POSTAL_CODE: '10001',\n TAX_IDENTIFIER: '123456789',\n}\n\n/** The Brooklyn address the KYC R2 address frames are drawn with. */\nexport const FRAME_ADDRESS = {\n RESIDENTIAL_ADDRESS_LINE_1: '482 Bedford Ave',\n RESIDENTIAL_ADDRESS_CITY: 'Brooklyn',\n RESIDENTIAL_ADDRESS_REGION: 'NY',\n RESIDENTIAL_ADDRESS_POSTAL_CODE: '10013',\n}\n", "import {\n type MoonPayCheckoutEvent,\n type MoonPayCheckoutState,\n type MoonPayQuoteInput,\n moonPayCheckoutReducer,\n} from '@funkit/connect-core'\n\n/** MoonPay's own extra check: its intro, or its \"additional verification\" card after one completed check. */\nexport type MoonPayChallengePreview = 'intro' | 'again'\n\nconst SESSION_TOKEN = 'preview_session'\n\n/**\n * The MoonPay checkout at its own extra check, for a preview. The preview's backend answers no\n * `POST /fiat/next` and no MoonPay SDK runs, so the reducer is fed the answers that lead there:\n * a returning buyer's `connect`, the `order` prompt, and a device quote that asks for the check.\n */\nexport function moonPayChallengeState(\n start: MoonPayCheckoutState,\n card: MoonPayChallengePreview,\n): MoonPayCheckoutState {\n const quoteInput = {\n source: { asset: { code: 'USD' }, amount: start.checkout.amount },\n destination: { asset: { code: 'usdc_sol' } },\n wallet: { address: 'preview' },\n paymentMethod: { type: 'apple_pay' },\n feeBehavior: 'inclusive',\n } as unknown as MoonPayQuoteInput\n const challenged: MoonPayCheckoutEvent = {\n type: 'DEVICE_QUOTE',\n input: quoteInput,\n quote: {\n signature: 'preview',\n executable: false,\n challengeUrl: 'https://buy-sandbox.moonpay.com/challenge',\n },\n }\n const events: ((state: MoonPayCheckoutState) => MoonPayCheckoutEvent)[] = [\n (state) => ({\n type: 'STEP',\n call: stepCall(state),\n response: { next: 'connect', sessionToken: SESSION_TOKEN, quoteInput },\n }),\n () => ({\n type: 'CONNECTED',\n sessionToken: SESSION_TOKEN,\n credentials: { customerId: 'preview', accessToken: 'preview' },\n }),\n (state) => ({\n type: 'STEP',\n call: stepCall(state),\n response: { next: 'order', orderId: 'ord_preview', quoteInput },\n }),\n () => challenged,\n ...(card === 'again'\n ? [\n (): MoonPayCheckoutEvent => ({ type: 'QUOTE_CHALLENGE_PASSED' }),\n () => challenged,\n ]\n : []),\n ]\n return events.reduce(\n (state, event) => moonPayCheckoutReducer(state, event(state)),\n start,\n )\n}\n\nfunction stepCall(\n state: MoonPayCheckoutState,\n): Extract<MoonPayCheckoutEvent, { type: 'STEP' }>['call'] {\n const { call } = state\n if (call === undefined || call.action === 'order') {\n throw new Error('preview: no step in flight')\n }\n return call\n}\n", "import { FROG_API_BASE_URL, getApiBaseUrl } from '@funkit/api-base'\nimport type { FiatStepResponse } from '@funkit/connect-core'\n\nimport { logger } from '../logging/logger'\nimport { openingStep } from './flowPreview'\nimport {\n DEFAULT_PREVIEW_QUOTE,\n type PreviewNoRouteReason,\n type PreviewProviderRoute,\n type PreviewRange,\n type PreviewResponse,\n type PreviewScenario,\n} from './scenarios'\n\ntype Fetch = typeof fetch\n\nconst json = (body: unknown, status = 200) =>\n new Response(JSON.stringify(body), {\n status,\n headers: { 'Content-Type': 'application/json' },\n })\n\nfunction requestedAmount(init: RequestInit | undefined): number | undefined {\n if (typeof init?.body !== 'string') {\n return undefined\n }\n try {\n const amount = Number(\n (JSON.parse(init.body) as { fiatAmount?: unknown }).fiatAmount,\n )\n return Number.isFinite(amount) ? amount : undefined\n } catch {\n return undefined\n }\n}\n\n/** The quote a CTA's body names, for a response built per request. */\nfunction requestedQuote(init: RequestInit | undefined): { quoteRef?: string } {\n if (typeof init?.body !== 'string') {\n return {}\n }\n try {\n const { quoteRef } = JSON.parse(init.body) as { quoteRef?: unknown }\n return typeof quoteRef === 'string' ? { quoteRef } : {}\n } catch {\n return {}\n }\n}\n\n/** A routed quote's one provider, or `POST /fiat/quote`'s pinned list; undefined for any. */\nexport function requestedProviders(\n init: RequestInit | undefined,\n): readonly string[] | undefined {\n if (typeof init?.body !== 'string') {\n return undefined\n }\n try {\n const body = JSON.parse(init.body) as {\n provider?: string\n routingOverrides?: { providers?: string[] }\n }\n return body.provider === undefined\n ? body.routingOverrides?.providers\n : [body.provider]\n } catch {\n return undefined\n }\n}\n\nconst toCents = (amount: string) => Math.round(Number(amount) * 100)\nconst fromCents = (cents: number) => (cents / 100).toFixed(2)\n\n/** Split wherever a provider starts or stops; each piece lists who serves it, in their order. */\nfunction providersTable(\n providers: readonly PreviewProviderRoute[],\n search: URLSearchParams,\n) {\n const edges = [\n ...new Set(\n providers.flatMap(({ min, max }) => [toCents(min), toCents(max) + 1]),\n ),\n ].sort((a, b) => a - b)\n const intervals = edges.slice(0, -1).flatMap((start, index) => {\n const end = (edges[index + 1] ?? start) - 1\n const serving = providers.filter(\n ({ min, max }) => toCents(min) <= start && toCents(max) >= end,\n )\n return serving.length === 0\n ? []\n : [\n {\n min: fromCents(start),\n max: fromCents(end),\n providers: serving.map(({ provider, visibility }) => ({\n provider,\n next: 'AUTH',\n visibility,\n })),\n },\n ]\n })\n const methods = (search.get('methods') ?? 'apple_pay').split(',')\n return {\n expiresAt: new Date(Date.now() + 60_000).toISOString(),\n methods: methods.map((method) => ({ method, intervals })),\n }\n}\n\n/** The methods a `POST /fiat/routing/table` body asks for. */\nexport function requestedMethods(\n init: RequestInit | undefined,\n): string | undefined {\n if (typeof init?.body !== 'string') {\n return undefined\n }\n try {\n const { methods } = JSON.parse(init.body) as { methods?: unknown }\n return Array.isArray(methods) ? methods.join(',') : undefined\n } catch {\n return undefined\n }\n}\n\nfunction belowMinimum(minimum: string): Response {\n return json(\n {\n errorCode: 'FiatAmountBelowMinimumError',\n errorMsg: `The minimum for this purchase is ${minimum} USD.`,\n minFiatAmount: minimum,\n fiatCurrencyCode: 'USD',\n },\n 400,\n )\n}\n\n/**\n * fun-backend's `FiatNoRouteError`: a 400 for the buyer's own limit, a 404 otherwise.\n * - `retryable` is what fun-backend #4936 adds; `NO_CANDIDATE_LEGACY` is today's bare body.\n */\nfunction noRoute(scenarioReason: PreviewNoRouteReason): Response {\n const legacy = scenarioReason === 'NO_CANDIDATE_LEGACY'\n const reason = legacy ? 'NO_CANDIDATE' : scenarioReason\n const retryable = legacy ? {} : { retryable: reason === 'PROVIDER_OUTAGE' }\n if (reason === 'USER_LIMIT') {\n return json(\n {\n serviceableRanges: [],\n reason,\n ...retryable,\n code: 'LIMITS_EXCEEDED',\n recovery: 'REQUOTE',\n errorCode: 'FiatNoRouteError',\n errorMsg: 'Your current provider limits do not allow this purchase.',\n },\n 400,\n )\n }\n return json(\n {\n serviceableRanges: [],\n reason,\n ...retryable,\n errorCode: 'FiatNoRouteError',\n errorMsg: 'No provider can price that purchase right now.',\n },\n 404,\n )\n}\n\n/** The amount sits in none of `ranges`, each read to the buyer's cap where it has one. */\nfunction isUnserved(ranges: readonly PreviewRange[], amount: number): boolean {\n return !ranges.some(\n ([min, max, userMax]) =>\n amount >= Number(min) && amount <= Number(userMax ?? max),\n )\n}\n\n/** A no-candidate refusal that names what is served, so a gap between ranges shows. */\nfunction unservedAmount(ranges: readonly PreviewRange[]): Response {\n const money = (amount: string) => ({ amount, currency: 'USD' })\n return json(\n {\n serviceableRanges: ranges.map(([min, max, userMax]) => ({\n min: money(min),\n max: money(max),\n userMax: userMax === null ? null : money(userMax),\n })),\n reason: 'NO_CANDIDATE',\n retryable: false,\n errorCode: 'FiatNoRouteError',\n errorMsg: 'No provider can price that purchase right now.',\n },\n 404,\n )\n}\n\nfunction isStepResponse(\n response: PreviewResponse,\n): response is FiatStepResponse {\n return 'state' in response\n}\n\n/**\n * One interval per requested method, served by the scenario quote's provider.\n * - Without it the routed flow cannot quote at all, so every re-quote lands on \"Try again\".\n */\nexport function routingTable(\n quote: FiatStepResponse,\n minimum: string | undefined,\n ranges: readonly PreviewRange[] | undefined,\n search: URLSearchParams,\n currentLimit: string | undefined,\n) {\n const limits = quote.state.kind === 'QUOTE' ? quote.state.limits : undefined\n const provider = 'provider' in quote ? quote.provider : 'MOONPAY'\n const spans =\n ranges?.map(([min, max, userMax]) => [min, userMax ?? max] as const) ??\n ([[minimum ?? limits?.min ?? 1, limits?.max ?? 1_000_000]] as const)\n const methods = (search.get('methods') ?? 'apple_pay').split(',')\n return {\n expiresAt: new Date(Date.now() + 60_000).toISOString(),\n methods: methods.map((method) => ({\n method,\n intervals: spans.map(([min, max]) => ({\n min: Number(min).toFixed(2),\n max: Number(max).toFixed(2),\n providers: [\n {\n provider,\n next: 'READY',\n visibility: 'COMPLETE',\n ...(currentLimit === undefined ? {} : { currentLimit }),\n },\n ],\n })),\n })),\n }\n}\n\n/**\n * A `fetch` that answers the fiat backend from a scenario and passes every other request through.\n * - The session stays on whatever step it was last sent: polls and unlisted CTAs re-send it.\n * - Install it as `globalThis.fetch` before the flow opens; `@funkit/api-base` reads it per call.\n * - `quoteDelayMs` holds each quote back, so a reviewer sees it load before a\n * seeded failure lands on it.\n */\nexport function createPreviewFetch(\n scenario: PreviewScenario,\n passThrough: Fetch,\n { quoteDelayMs = 0 }: { quoteDelayMs?: number } = {},\n): Fetch {\n let current = openingStep(scenario.seed.deposit?.fiat)\n const quote = scenario.backend.quote ?? DEFAULT_PREVIEW_QUOTE\n const {\n minimum,\n noRoute: noRouteReason,\n ranges,\n providers,\n currentLimit,\n feeSubsidized,\n settles,\n } = scenario.backend\n let settlesFrom: number | undefined\n\n const answer = (\n path: string,\n method: string,\n amount: number | undefined,\n search: URLSearchParams,\n asked: readonly string[] | undefined,\n requested: { quoteRef?: string },\n ): Response => {\n if (path.endsWith('/fiat/routing/table')) {\n const table =\n providers === undefined\n ? routingTable(quote, minimum, ranges, search, currentLimit)\n : providersTable(providers, search)\n return json(\n feeSubsidized === undefined\n ? table\n : { ...table, feeSubsidy: { subsidized: true } },\n )\n }\n const isQuote =\n method === 'POST' &&\n (path.endsWith('/fiat/quote') || path.endsWith('/fiat/routing/quote'))\n if (isQuote && providers !== undefined && amount !== undefined) {\n const route = providers.find(\n ({ provider, min, max }) =>\n (asked === undefined || asked.includes(provider)) &&\n amount >= Number(min) &&\n amount <= Number(max),\n )\n if (route === undefined) {\n return noRoute('NO_CANDIDATE')\n }\n current = route.answer(String(amount))\n return json(current)\n }\n if (isQuote) {\n if (\n minimum !== undefined &&\n amount !== undefined &&\n amount < Number(minimum)\n ) {\n return belowMinimum(minimum)\n }\n if (noRouteReason !== undefined) {\n return noRoute(noRouteReason)\n }\n if (\n ranges !== undefined &&\n amount !== undefined &&\n isUnserved(ranges, amount)\n ) {\n return unservedAmount(ranges)\n }\n current = quote\n return json(quote)\n }\n if (settles !== undefined && path.endsWith(settles.endpoint)) {\n settlesFrom ??= Date.now()\n if (Date.now() - settlesFrom >= settles.afterMs) {\n current = settles.step\n return json(current)\n }\n }\n const entry = Object.entries(scenario.backend.responses ?? {}).find(\n ([endpoint]) => path.endsWith(endpoint),\n )?.[1]\n const listed = typeof entry === 'function' ? entry(requested) : entry\n if (listed !== undefined && !isStepResponse(listed)) {\n const { status, retryAfterSeconds } = listed\n // fun-backend's 429 body; the SDK reads no `retryAfterSeconds` without `errorCode`.\n return json(\n {\n ...(status === 429 ? { errorCode: 'TooManyRequestsError' } : {}),\n errorMsg: 'preview: unavailable',\n ...(retryAfterSeconds === undefined ? {} : { retryAfterSeconds }),\n },\n status,\n )\n }\n current = listed ?? current ?? quote\n return json(current)\n }\n\n // Only Fun's own fiat API: the host's assertion minter lives under a `/fiat/` path too.\n const fiatApi = `${getApiBaseUrl()}/fiat/`\n const currencyLookup = `${FROG_API_BASE_URL}/api/swapped/supportedCountries`\n return async (input, init) => {\n // Read off the input, never wrapped: a wrapped `Request` spends its body before a pass-through.\n const url = input instanceof Request ? input.url : String(input)\n if (\n scenario.backend.currencyLookupFails &&\n url.startsWith(currencyLookup)\n ) {\n return json({ errorMsg: 'preview: unavailable' }, 503)\n }\n if (!url.startsWith(fiatApi)) {\n return passThrough(input, init)\n }\n const method =\n init?.method ?? (input instanceof Request ? input.method : 'GET')\n const { pathname, searchParams } = new URL(url)\n const postedMethods = requestedMethods(init)\n if (postedMethods !== undefined) {\n searchParams.set('methods', postedMethods)\n }\n logger.info('preview:fiat_request', {\n scenario: scenario.id,\n method,\n path: pathname,\n })\n if (quoteDelayMs > 0 && /\\/fiat\\/(routing\\/)?quote$/.test(pathname)) {\n await new Promise((resolve) => setTimeout(resolve, quoteDelayMs))\n }\n return answer(\n pathname,\n method.toUpperCase(),\n requestedAmount(init),\n searchParams,\n requestedProviders(init),\n requestedQuote(init),\n )\n }\n}\n", "import { getApiBaseUrl } from '@funkit/api-base'\nimport type {\n FiatStepResponse,\n SessionTape,\n TapeResponse,\n} from '@funkit/connect-core'\n\nimport { logger } from '../../logging/logger'\nimport {\n requestedMethods,\n requestedProviders,\n routingTable,\n} from '../previewFetch'\nimport { DEFAULT_PREVIEW_QUOTE } from '../scenarios'\n\ntype Fetch = typeof fetch\n\nexport interface ReplayFetchOptions {\n /** Holds an answer for its recorded latency; tests pass one that resolves at once. */\n wait?: (ms: number) => Promise<void>\n /** Answers before this index count as already served: a flow seeded partway through. */\n from?: number\n /** The code sent a request the recorded attempt never answered: it took another path. */\n onOffTape?: (endpoint: string) => void\n /**\n * Answers the fiat API past the recording. The first request the attempt never made means the\n * code left the buyer's path, so every fiat request after it comes here too; without one, those\n * requests are refused.\n */\n offTape?: Fetch\n}\n\n/** How long a recorded expiry already past is given again: the buyer's quote was live. */\nconst REPLAY_EXPIRY_MS = 15 * 60_000\n\n/** The body with every `expiresAt` already past moved ahead, so an old attempt's quote still pays. */\nfunction unexpired(value: unknown): unknown {\n if (Array.isArray(value)) {\n return value.map(unexpired)\n }\n if (typeof value !== 'object' || value === null) {\n return value\n }\n return Object.fromEntries(\n Object.entries(value).map(([key, v]) => [\n key,\n key === 'expiresAt' &&\n typeof v === 'string' &&\n Date.parse(v) <= Date.now()\n ? new Date(Date.now() + REPLAY_EXPIRY_MS).toISOString()\n : unexpired(v),\n ]),\n )\n}\n\nconst QUOTE = /\\/fiat\\/(routing\\/)?quote$/\n\n/** Statuses a `Response` refuses a body for. */\nconst NO_BODY = new Set([101, 103, 204, 205, 304])\n\nconst json = (body: unknown, status = 200) =>\n new Response(NO_BODY.has(status) ? null : JSON.stringify(body), {\n status,\n headers: { 'Content-Type': 'application/json' },\n })\n\nconst sleep = (ms: number) =>\n new Promise<void>((resolve) => setTimeout(resolve, ms))\n\nconst providerOf = (body: unknown): unknown =>\n typeof body === 'object' && body !== null\n ? (body as { provider?: unknown }).provider\n : undefined\n\nfunction isQuoteStep(body: unknown): body is FiatStepResponse {\n return (\n typeof body === 'object' &&\n body !== null &&\n (body as { state?: { kind?: unknown } }).state?.kind === 'QUOTE'\n )\n}\n\n/**\n * A `fetch` that answers Fun's fiat API from a recorded attempt and passes every other request\n * through, so new code meets the backend exactly as that attempt did.\n * - Each request gets the next recorded answer to its endpoint, at recorded latency; a quote that\n * names its provider only gets that provider's, and a read past its answers repeats the last.\n * - What the logs lost comes back: a routing table drawn from the tape's quote, and expiries the\n * recording has outlived moved ahead.\n */\nexport function createReplayFetch(\n tape: SessionTape,\n passThrough: Fetch,\n { wait = sleep, from = 0, onOffTape, offTape }: ReplayFetchOptions = {},\n): Fetch {\n // a poll resumed past `from` still repeats its last answer\n const served = new Set(tape.responses.slice(0, from).map((_, i) => i))\n const quote =\n tape.responses.map((r) => r.body).find(isQuoteStep) ?? DEFAULT_PREVIEW_QUOTE\n\n // A refusal names no provider: the tape says which one it was for, or it answered the one the\n // attempt quoted just before\n const quotedFor = tape.responses.map((response, index) => {\n if (response.provider !== undefined) {\n return response.provider\n }\n for (let i = index; i >= 0; i -= 1) {\n const earlier = tape.responses[i]\n const provider = providerOf(earlier?.body)\n if (QUOTE.test(earlier?.endpoint ?? '') && provider !== undefined) {\n return provider\n }\n }\n return providerOf(response.body)\n })\n\n // every provider the attempt quoted, in order: a drawn table offers each, refusals included\n const recordedProviders = [\n ...new Set(\n tape.responses.flatMap((response, index) => {\n const provider = quotedFor[index]\n return QUOTE.test(response.endpoint) && typeof provider === 'string'\n ? [provider]\n : []\n }),\n ),\n ]\n\n const drawTable = (\n params: URLSearchParams,\n init: RequestInit | undefined,\n ) => {\n const methods = requestedMethods(init)\n if (methods !== undefined) {\n params.set('methods', methods)\n }\n const table = routingTable(quote, undefined, undefined, params, undefined)\n return recordedProviders.length === 0\n ? table\n : {\n ...table,\n methods: table.methods.map((method) => ({\n ...method,\n intervals: method.intervals.map((interval) => ({\n ...interval,\n providers: recordedProviders.map((provider) => ({\n provider,\n next: 'READY',\n visibility: 'COMPLETE',\n })),\n })),\n })),\n }\n }\n\n /** The latest answer served: the code is at least this far through the attempt. */\n let cursor = from - 1\n\n // the providers a quote request allows, as the backend reads them: one, a failover's list, or any\n const answers = (\n index: number,\n endpoint: string,\n asked?: readonly string[],\n ) =>\n tape.responses[index]?.endpoint === endpoint &&\n (asked === undefined || asked.includes(String(quotedFor[index])))\n\n const lastServed = (endpoint: string, asked?: readonly string[]) =>\n Math.max(-1, ...[...served].filter((i) => answers(i, endpoint, asked)))\n\n // The buyer may have sent things the code skips (a second quote), so their answers are passed\n // over and never handed back: a read with nothing left ahead repeats its last answer, and a\n // write leaves the tape, since a skipped older answer would make a diverged run look matched.\n const next = (\n endpoint: string,\n asked: readonly string[] | undefined,\n isRead: boolean,\n ) => {\n const unserved = (_: TapeResponse, index: number) =>\n answers(index, endpoint, asked) && !served.has(index)\n const ahead = tape.responses.findIndex(\n (response, index) => index > cursor && unserved(response, index),\n )\n if (ahead !== -1 || !isRead) {\n return ahead\n }\n const repeat = lastServed(endpoint, asked)\n return repeat === -1 ? tape.responses.findIndex(unserved) : repeat\n }\n\n /** Set once the code sends what the attempt never did: the recording no longer applies. */\n let leftTape = false\n\n const apiBaseUrl = getApiBaseUrl()\n const fiatApi = `${apiBaseUrl}/fiat/`\n return async (input, init) => {\n const url = input instanceof Request ? input.url : String(input)\n if (!url.startsWith(fiatApi)) {\n return passThrough(input, init)\n }\n if (leftTape && offTape !== undefined) {\n return offTape(input, init)\n }\n const method = (\n init?.method ?? (input instanceof Request ? input.method : 'GET')\n ).toUpperCase()\n const { pathname, searchParams } = new URL(url)\n const endpoint = `${method} ${url.slice(apiBaseUrl.length).split('?')[0]}`\n // a `Request` carries its own body: read a copy, so the request still sends as it was\n const sent: RequestInit | undefined =\n init?.body === undefined && input instanceof Request\n ? { ...init, body: await input.clone().text() }\n : init\n\n const isQuote = QUOTE.test(pathname)\n const asked = isQuote ? requestedProviders(sent) : undefined\n // asking for a quote again changes nothing, unlike a second order\n const index = next(endpoint, asked, method === 'GET' || isQuote)\n const isTable = pathname.endsWith('/fiat/routing/table')\n const recorded = tape.responses[index]\n if (recorded === undefined && isTable) {\n // attempts from before the routed flow never fetched one\n return json(drawTable(searchParams, sent))\n }\n if (recorded === undefined) {\n logger.warn('preview:replay_off_tape', { endpoint })\n onOffTape?.(endpoint)\n if (offTape !== undefined) {\n leftTape = true\n return offTape(input, init)\n }\n return json({ errorMsg: `replay: ${endpoint} was never recorded` }, 503)\n }\n served.add(index)\n cursor = Math.max(cursor, index)\n await wait(recorded.durationMs)\n\n if (isTable && !recorded.body && recorded.status < 300) {\n return json(drawTable(searchParams, sent), recorded.status)\n }\n return json(unexpired(recorded.body ?? {}), recorded.status)\n }\n}\n"],
4
+ "sourcesContent": ["// Every SDK state a hosted preview can open at. Pure data with no imports, so tooling outside the\n// bundle (the Appetize PR comment) can read it with plain Node.\n\nexport type PreviewFlow = 'deposit' | 'withdrawal'\n\n/**\n * What the host's flow config must offer for the scenario to open.\n * - `fiatRail`: an amount-first deposit with a fiat rail (Fomo, Pump.fun).\n * - `cryptoDeposit`: the Add money deposit (Betty, Mallard, Ulys, \u2026).\n * - `cryptoDepositLocked`: a crypto deposit of a locked amount (Betty).\n * - `cryptoDepositV2`: an amount-first deposit that also offers Crypto, the\n * V2 crypto pages (Fomo).\n * - `cryptoWithdrawal`: a crypto withdrawal config (Mallard, Ulys).\n * - `omnibusWithdrawFlow`: a withdrawal in the client the\n * `enable-omnibus-withdraw-flow` gate targets (Betty), which passes no\n * wallet and pays Swapped orders from its own account.\n * - `stripeRail`: a fiat rail on a host with a Stripe onramp client, which\n * routing needs before it quotes Stripe at all (Pump.fun).\n */\nexport type PreviewRequirement =\n | 'fiatRail'\n | 'cryptoDeposit'\n | 'cryptoDepositLocked'\n | 'cryptoDepositV2'\n | 'cryptoWithdrawal'\n | 'omnibusWithdrawFlow'\n | 'stripeRail'\n\nexport interface PreviewScenarioEntry {\n title: string\n flow: PreviewFlow\n requires: PreviewRequirement\n /** Source files, relative to `src/`, whose change makes this state worth a link. */\n touches: readonly string[]\n}\n\nconst AMOUNT = [\n 'flow/FiatDepositAmountStep.tsx',\n 'screens/DepositAmountScreen.tsx',\n]\nconst FORM = [\n 'fiat/kyc/FiatIdentityStep.tsx',\n 'fiat/form/FiatFormScreen.tsx',\n 'fiat/form/formLayout.ts',\n 'fiat/kyc/FiatKycFieldControl.tsx',\n]\nconst INTRO = [\n 'fiat/kyc/FiatIdentityStep.tsx',\n 'fiat/kyc/FiatKycIntroScreen.tsx',\n]\nconst STATUS = [\n 'fiat/common/FiatStatusScreen.tsx',\n 'fiat/settlement/depositOutcome.ts',\n]\nconst CRYPTO_V2 = [\n 'flow/CryptoAddressPage.tsx',\n 'flow/CryptoDepositStep.tsx',\n 'flow/CryptoLearnMorePage.tsx',\n 'flow/CryptoListPage.tsx',\n 'flow/CryptoNetworkPage.tsx',\n 'flow/CryptoTokenPage.tsx',\n 'flow/cryptoDepositFlow.ts',\n 'flow/cryptoTokenList.ts',\n 'components/v2/ListRow.tsx',\n]\nconst PROCESSING = [\n 'fiat/processing/DepositProcessingCard.tsx',\n 'fiat/processing/CompletionWave.tsx',\n 'fiat/processing/ProcessingAurora.tsx',\n 'fiat/processing/gradientPuff.ts',\n 'fiat/processing/pressureWave.ts',\n 'fiat/processing/depositProcessing.ts',\n 'screens/DepositAmountScreen.tsx',\n 'flow/FiatDepositAmountStep.tsx',\n]\nconst WITHDRAW = [\n 'flow/WithdrawalFlowContent.tsx',\n 'screens/WithdrawCryptoSteps.tsx',\n]\n\nexport const PREVIEW_SCENARIO_CATALOG = {\n // Fiat rail \u2014 amount entry and sign-in.\n 'fiat.amount': {\n title: 'Amount entry, priced',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.depositMatch': {\n title: 'Amount entry, deposit match with a fee subsidy (internal flag)',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...AMOUNT,\n 'fiat/entry/depositMatch.ts',\n 'flow/DepositMatchSheet.tsx',\n 'screens/DepositMatchScreen.tsx',\n ],\n },\n 'fiat.amount.subsidized': {\n title: 'Amount entry, fee subsidy without the deposit match',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...AMOUNT,\n 'fiat/common/stepDetails.ts',\n 'screens/FeeDetailsScreen.tsx',\n ],\n },\n 'fiat.amount.depositMatch.unsubsidized': {\n title: 'Amount entry, deposit match without a fee subsidy (internal flag)',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...AMOUNT,\n 'fiat/entry/depositMatch.ts',\n 'flow/DepositMatchSheet.tsx',\n 'screens/DepositMatchScreen.tsx',\n ],\n },\n 'fiat.amount.paymentMethodPicker': {\n title: \"Amount entry, the host's payment-method picker open\",\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...AMOUNT,\n 'flow/PaymentMethodPickerSheet.tsx',\n 'flow/PaymentMethodRows.tsx',\n 'preview/PreviewPaymentMethodPicker.tsx',\n ],\n },\n 'fiat.amount.paymentMethodPicker.content': {\n title: 'Payment options, embedded host content',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...AMOUNT,\n 'flow/PaymentMethodPickerSheet.tsx',\n 'preview/PreviewPaymentMethodPicker.tsx',\n ],\n },\n 'fiat.amount.paymentMethodPicker.swapped': {\n title:\n \"Payment options, Swapped's long-tail methods in the host's crypto card\",\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...AMOUNT,\n 'flow/PaymentMethodPickerSheet.tsx',\n 'flow/swappedMethodRows.tsx',\n 'preview/PreviewPaymentMethodPicker.tsx',\n ],\n },\n 'fiat.amount.paymentMethodPicker.swappedPending': {\n title: \"Payment options, Swapped's long tail still being fetched\",\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...AMOUNT,\n 'flow/PaymentMethodPickerSheet.tsx',\n 'flow/PaymentMethodRows.tsx',\n 'flow/swappedMethodRows.tsx',\n ],\n },\n 'fiat.amount.paymentMethodPicker.cryptoToken': {\n title: 'Payment options, embedded crypto currency selection',\n flow: 'deposit',\n requires: 'cryptoDepositV2',\n touches: [...AMOUNT, ...CRYPTO_V2, 'flow/PaymentMethodPickerSheet.tsx'],\n },\n 'fiat.amount.paymentMethodPicker.cryptoNetwork': {\n title: 'Payment options, embedded crypto network selection',\n flow: 'deposit',\n requires: 'cryptoDepositV2',\n touches: [...AMOUNT, ...CRYPTO_V2, 'flow/PaymentMethodPickerSheet.tsx'],\n },\n 'fiat.amount.paymentMethodPicker.cryptoAddress': {\n title: 'Payment options, embedded crypto address',\n flow: 'deposit',\n requires: 'cryptoDepositV2',\n touches: [...AMOUNT, ...CRYPTO_V2, 'flow/PaymentMethodPickerSheet.tsx'],\n },\n 'fiat.amount.paymentMethodPicker.cryptoLearnMore': {\n title: 'Payment options, embedded crypto explainer',\n flow: 'deposit',\n requires: 'cryptoDepositV2',\n touches: [...AMOUNT, ...CRYPTO_V2, 'flow/PaymentMethodPickerSheet.tsx'],\n },\n 'fiat.amount.empty': {\n title: 'Amount entry, empty',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.belowMinimum': {\n title: 'Amount entry, below the provider minimum',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.otpThrottled': {\n title: 'Amount entry, the provider will not send another code',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.noProvider': {\n title: 'Amount entry, no provider serves this buyer (fun-backend #4936)',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.kycUnservable': {\n title: 'Amount entry, identity no provider can take (fun-backend #4875)',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.userLimit': {\n title: \"Amount entry, over the buyer's provider limit (fun-backend #4936)\",\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.kycThreshold': {\n title: 'Amount entry, the daily limit sheet over the amount',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...AMOUNT,\n 'fiat/kyc/useKycLimitSheet.ts',\n 'fiat/processing/FailoverPrompt.tsx',\n ],\n },\n 'fiat.amount.providerOutage': {\n title: 'Amount entry, providers down (fun-backend #4936)',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.noRouteToday': {\n title: \"Amount entry, today's no-route refusal (still Try again)\",\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.providerCeiling': {\n title:\n \"Amount entry, $1,000 priced under one provider's cap; type $10,000 for MoonPay KYC\",\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.gap': {\n title: \"Amount entry, between two providers' ranges (Deposit Minimum)\",\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.amount.currencyLookupFailed': {\n title: \"Amount entry, the buyer's currency lookup failed\",\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'fiat.contact.email': {\n title: 'Contact: email',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/contact/FiatContactScreen.tsx',\n 'fiat/contact/sessionContact.ts',\n ],\n },\n 'fiat.contact.phone': {\n title: 'Contact: phone',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/contact/FiatContactScreen.tsx',\n 'fiat/contact/FiatPhoneField.tsx',\n 'fiat/contact/useContactAutoSubmit.ts',\n ],\n },\n 'fiat.contact.redirected': {\n title: 'Contact: non-US number held for MoonPay',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/contact/useRedirectHold.tsx',\n 'fiat/contact/phoneRegionRedirect.ts',\n ],\n },\n 'fiat.otp.email': {\n title: 'OTP: email code',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['fiat/otp/FiatOtpScreen.tsx'],\n },\n 'fiat.otp.sms': {\n title: 'OTP: SMS code',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['fiat/otp/FiatOtpScreen.tsx'],\n },\n 'fiat.funauth.email': {\n title: 'Fun login: email',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/contact/FiatContactScreen.tsx',\n 'fiat/contact/contactRound.ts',\n ],\n },\n 'fiat.funauth.code': {\n title: 'Fun login: email code',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/otp/FiatOtpScreen.tsx',\n 'fiat/otp/otpScreenProps.ts',\n 'fiat/otp/useResendCooldown.ts',\n ],\n },\n 'fiat.funauth.code.tooMany': {\n title: 'Fun login: too many attempts',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['fiat/otp/FiatOtpScreen.tsx', 'fiat/otp/otpScreenProps.ts'],\n },\n 'fiat.funauth.reauth': {\n title: 'Fun login: sign in again over a paid order',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/otp/FunReauthStep.tsx',\n 'fiat/otp/useFunSession.ts',\n 'flow/FiatDepositAmountStep.tsx',\n ],\n },\n 'fiat.funauth.verified': {\n title: 'Fun login: email verified',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['fiat/otp/FiatOtpScreen.tsx', 'fiat/otp/useOtpReceipt.ts'],\n },\n // KYC \u2014 identity rounds.\n 'kyc.l1.intro': {\n title: 'KYC L1: consent faceplate',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: INTRO,\n },\n 'kyc.l1.name': {\n title: 'KYC L1: name',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: FORM,\n },\n 'kyc.l1.dob': {\n title: 'KYC L1: date of birth',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/form/FiatBirthDateField.tsx'],\n },\n 'kyc.l1.address': {\n title: 'KYC L1: address',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/country/subdivisions.ts'],\n },\n 'kyc.l1.ssn': {\n title: 'KYC L1: SSN',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/form/FiatSsnField.tsx'],\n },\n 'kyc.nationality': {\n title: 'KYC: nationality',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/country/FiatCountrySheet.tsx'],\n },\n 'kyc.country': {\n title: 'KYC: country of residence',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/country/FiatCountrySheet.tsx'],\n },\n 'kyc.ssnLastFour': {\n title: 'KYC: SSN last four',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/form/FiatSsnField.tsx'],\n },\n 'kyc.l2.intro': {\n title: 'KYC L2: additional-information faceplate',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: INTRO,\n },\n 'kyc.stripe.l1.intro': {\n title: 'KYC Stripe L1: step-up faceplate',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...INTRO,\n 'fiat/providers/kycIntro.ts',\n 'fiat/providers/stripe/stripeKycIntro.ts',\n ],\n },\n 'kyc.l2.moonpay-consent': {\n title: 'KYC L2: MoonPay sharing consent',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...INTRO,\n 'fiat/providers/kycIntro.ts',\n 'fiat/kyc/FiatSharingConsentNotice.tsx',\n 'fiat/kyc/useSharingConsent.ts',\n ],\n },\n 'kyc.l2.dob': {\n title: 'KYC L2: age',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: FORM,\n },\n 'kyc.l2.occupation': {\n title: 'KYC L2: occupation',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/form/FiatChoiceList.tsx'],\n },\n 'kyc.l2.purpose': {\n title: 'KYC L2: purpose',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/form/FiatChoiceList.tsx'],\n },\n 'kyc.dueDiligence': {\n title: 'KYC: due diligence',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: FORM,\n },\n 'kyc.dueDiligence.phoneRefused': {\n title: 'KYC: due diligence, phone number refused',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...FORM,\n 'fiat/form/refusedFields.ts',\n 'fiat/form/shownFieldIssues.ts',\n ],\n },\n 'kyc.dueDiligence.income': {\n title: 'KYC: due diligence figures',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: FORM,\n },\n 'kyc.edd.profession': {\n title: 'KYC: enhanced due diligence profession',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/form/FiatChoiceList.tsx'],\n },\n 'kyc.edd.netWorth': {\n title: 'KYC: enhanced due diligence net worth',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: FORM,\n },\n 'kyc.form.unsupported': {\n title: 'KYC: form this build cannot draw',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, ...STATUS],\n },\n 'kyc.stepUp.afterReview': {\n title: 'KYC: a second round after review',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/pageTurn.ts', 'fiat/kyc/FiatKycOutcomeScreen.tsx'],\n },\n 'kyc.form.retry': {\n title: 'KYC: form send failed',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/common/FiatErrorNotice.tsx'],\n },\n 'kyc.form.rateLimited': {\n title: 'KYC: form send rate-limited',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...FORM, 'fiat/common/FiatErrorNotice.tsx', ...AMOUNT],\n },\n // KYC \u2014 capture and verdicts.\n 'kyc.capture.intro': {\n title: 'KYC: document-capture intro',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/kyc/FiatDocumentCaptureStep.tsx',\n 'fiat/kyc/FiatKycIntroScreen.tsx',\n ],\n },\n 'kyc.capture.moonpay-handoff': {\n title: 'KYC: MoonPay asks for more of its hosted check',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/providers/moonpay/moonpayHandoffCard.tsx',\n 'fiat/kyc/useKycCaptureRound.ts',\n ],\n },\n 'kyc.moonpay-check.intro': {\n title: \"KYC: MoonPay checkout's intro to MoonPay's own check\",\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/providers/moonpay/fullCheckout/checkoutScreens.tsx',\n 'fiat/providers/moonpay/fullCheckout/useCheckoutModel.ts',\n 'fiat/kyc/FiatKycIntroScreen.tsx',\n ],\n },\n 'kyc.moonpay-check.again': {\n title: 'KYC: MoonPay checkout asks for additional verification',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/providers/moonpay/fullCheckout/checkoutScreens.tsx',\n 'fiat/providers/moonpay/fullCheckout/useCheckoutModel.ts',\n 'fiat/providers/moonpay/moonpayHandoffCard.tsx',\n ],\n },\n 'kyc.completion.review': {\n title: 'KYC completion: in review',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/kyc/FiatKycOutcomeScreen.tsx',\n 'fiat/kyc/useKycCompletion.ts',\n ],\n },\n 'kyc.review.extended': {\n title: 'KYC: an extended review opens the pending card',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['fiat/kyc/useKycCompletion.ts', 'fiat/kyc/kycOptionRows.ts'],\n },\n 'kyc.review.brief': {\n title: 'KYC: a brief review waited out, then priced',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/kyc/useKycCompletion.ts',\n 'fiat/kyc/FiatKycOutcomeScreen.tsx',\n ],\n },\n 'kyc.completion.hold': {\n title: 'KYC completion: on hold',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/kyc/FiatKycOutcomeScreen.tsx',\n 'fiat/kyc/useKycCompletion.ts',\n ],\n },\n 'kyc.completion.restricted': {\n title: 'KYC completion: rejected',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/kyc/FiatKycOutcomeScreen.tsx',\n 'fiat/kyc/useKycCompletion.ts',\n ],\n },\n 'kyc.required': {\n title: 'Amount entry, identity asked before a first deposit',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: AMOUNT,\n },\n 'kyc.verdict.review': {\n title: 'Amount entry after KYC: in review',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...AMOUNT, 'fiat/kyc/FiatKycNotice.tsx'],\n },\n 'kyc.verdict.hold': {\n title: 'Amount entry after KYC: on hold',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...AMOUNT, 'fiat/kyc/FiatKycNotice.tsx'],\n },\n 'kyc.verdict.rejected': {\n title: 'Amount entry after KYC: rejected',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...AMOUNT, 'fiat/kyc/FiatKycNotice.tsx'],\n },\n 'kyc.options.review': {\n title: 'KYC options card: in review',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/kyc/FiatKycOptionsScreen.tsx',\n 'fiat/kyc/FiatKycOptionRow.tsx',\n ],\n },\n 'kyc.options.hold': {\n title: 'KYC options card: on hold',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/kyc/FiatKycOptionsScreen.tsx',\n 'fiat/kyc/FiatKycOptionRow.tsx',\n ],\n },\n 'kyc.options.rejected': {\n title: 'KYC options card: rejected',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/kyc/FiatKycOptionsScreen.tsx',\n 'fiat/kyc/FiatKycOptionRow.tsx',\n ],\n },\n // Orders.\n 'order.review': {\n title: 'Order review',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: STATUS,\n },\n 'order.bankInstructions': {\n title: 'Bank transfer instructions (not drawn on RN yet)',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: STATUS,\n },\n 'order.pending': {\n title: 'Pending order: resume or cancel',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['fiat/settlement/FiatPendingOrderScreen.tsx'],\n },\n 'order.tracking': {\n title: 'Order processing',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: STATUS,\n },\n 'order.processing': {\n title: 'Paid, the order still settling: the processing card',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: PROCESSING,\n },\n 'order.processing.lands': {\n title: 'Paid, then the order settles: the processing card lands',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...PROCESSING, 'fiat/processing/CompletionCheck.tsx'],\n },\n 'order.processing.fails': {\n title:\n 'Paid, then the order fails: the processing card gives way to the failed sheet',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n ...PROCESSING,\n 'fiat/processing/DepositCardSheet.tsx',\n 'fiat/processing/ProcessingFailure.tsx',\n 'fiat/processing/cardSurface.tsx',\n ],\n },\n 'order.success': {\n title: 'Order settled (closes into the deposit toast)',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...STATUS, 'fiat/settlement/FiatReceipt.tsx'],\n },\n 'order.failed': {\n title: 'Order failed',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: STATUS,\n },\n 'order.deliveryFailed': {\n title: 'Paid, but the token purchase failed',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...STATUS, 'flow/renderFiatFlowScreen.tsx'],\n },\n 'order.cancelled': {\n title: 'Order cancelled',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: STATUS,\n },\n 'order.refunded': {\n title: 'Order refunded',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: STATUS,\n },\n 'fiat.blocked': {\n title: 'Blocked by the rail',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: STATUS,\n },\n 'fiat.blocked.later': {\n title: 'Blocked by the rail: region, with a comeback date',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['fiat/common/FiatRegionUnsupportedScreen.tsx'],\n },\n 'fiat.blocked.unservable': {\n title: 'Blocked by the rail: nothing can serve this deposit',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['fiat/common/FiatUnavailableScreen.tsx'],\n },\n 'fiat.accountIneligible': {\n title: \"The host's minter refused this account\",\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/common/FiatUnavailableScreen.tsx',\n 'fiat/kyc/useIdentityAssertion.ts',\n ],\n },\n 'fiat.unsupported': {\n title: 'State this build predates',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: STATUS,\n },\n 'fiat.surfaceFailed': {\n title: 'Provider surface failed',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: STATUS,\n },\n 'fiat.paymentFailed': {\n title: 'Apple Pay payment failed',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/processing/DepositProcessingCard.tsx',\n 'fiat/processing/DepositCardSheet.tsx',\n 'fiat/processing/ProcessingFailure.tsx',\n 'fiat/payment/usePaymentFailureAnswer.ts',\n ],\n },\n 'fiat.paymentDismissed': {\n title: 'Coinbase Apple Pay sheet closed',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/processing/FailoverPrompt.tsx',\n 'fiat/payment/usePaymentFailureAnswer.ts',\n 'fiat/payment/failoverPrompt.ts',\n 'fiat/providers/coinbase/coinbaseApplePay.tsx',\n ],\n },\n 'fiat.insufficientFunds': {\n title: 'Card without the funds at Coinbase, amount lowered',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/processing/FailoverPrompt.tsx',\n 'fiat/payment/failoverKind.ts',\n 'fiat/payment/insufficientFundsAmount.ts',\n ],\n },\n 'fiat.insufficientFundsAtMinimum': {\n title: 'Card without the funds at Coinbase, at the minimum',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/processing/FailoverPrompt.tsx',\n 'fiat/payment/failoverKind.ts',\n 'fiat/payment/failoverPrompt.ts',\n ],\n },\n 'fiat.stripeDeclined': {\n title: 'Card declined at Stripe, no reason given',\n flow: 'deposit',\n requires: 'stripeRail',\n touches: [\n 'fiat/processing/FailoverPrompt.tsx',\n 'fiat/payment/failoverKind.ts',\n 'fiat/providers/stripe/stripeCardRefusal.ts',\n ],\n },\n 'fiat.softDeclined': {\n title: 'Card bank holds the charge for approval at Coinbase',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/processing/FailoverPrompt.tsx',\n 'fiat/payment/failoverKind.ts',\n 'fiat/payment/failoverPrompt.ts',\n ],\n },\n 'fiat.failoverVerified': {\n title: 'Verified after a failover, payment held',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/entry/useCaptureHold.ts',\n 'fiat/payment/failoverPrompt.ts',\n 'fiat/processing/FailoverPrompt.tsx',\n ],\n },\n 'fiat.prepaidDeclined': {\n title: 'Prepaid card declined at Coinbase',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/processing/FailoverPrompt.tsx',\n 'fiat/payment/usePaymentFailureAnswer.ts',\n 'fiat/payment/failoverPrompt.ts',\n 'fiat/payment/failoverKind.ts',\n ],\n },\n 'fiat.prepaidDeclinedAlone': {\n title: 'Prepaid card declined, no other partner',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'fiat/processing/FailoverPrompt.tsx',\n 'fiat/payment/failoverKind.ts',\n 'fiat/payment/failoverPrompt.ts',\n ],\n },\n 'fiat.retryable': {\n title: 'Submission failed, retryable',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: STATUS,\n },\n 'fiat.rateLimited': {\n title: 'Submission rate-limited, seconds to wait',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...STATUS, ...AMOUNT],\n },\n 'fiat.rateLimited.retryAfter': {\n title: 'Submission rate-limited, minutes to wait',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [...STATUS, ...AMOUNT],\n },\n // Crypto deposit.\n 'deposit.wallet.connecting': {\n title: 'Wallet deposit: connecting to Phantom',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'flow/WalletConnectingAction.tsx',\n 'flow/WalletDepositStep.tsx',\n 'flow/useWalletDeposit.ts',\n ],\n },\n 'deposit.wallet.connectFailed': {\n title: 'Wallet deposit: connection failed',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'flow/WalletConnectingAction.tsx',\n 'flow/WalletDepositStep.tsx',\n 'flow/useWalletDeposit.ts',\n ],\n },\n 'deposit.wallet.amount': {\n title: 'Wallet deposit: amount and held token',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: [\n 'flow/WalletDepositStep.tsx',\n 'flow/useWalletDeposit.ts',\n 'screens/DepositAmountScreen.tsx',\n ],\n },\n 'deposit.wallet.assets': {\n title: 'Wallet deposit: long asset list and low balances',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/WalletDepositStep.tsx', 'flow/useWalletDeposit.ts'],\n },\n 'deposit.wallet.insufficient': {\n title: 'Wallet deposit: insufficient balance',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/WalletDepositStep.tsx', 'flow/useWalletDeposit.ts'],\n },\n 'deposit.wallet.empty': {\n title: 'Wallet deposit: no supported balance',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/WalletDepositStep.tsx', 'flow/useWalletDeposit.ts'],\n },\n 'deposit.wallet.emptyAssets': {\n title: 'Wallet deposit: empty asset list',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/WalletDepositStep.tsx', 'flow/useWalletDeposit.ts'],\n },\n 'deposit.wallet.unlink': {\n title: 'Wallet deposit: unlink menu',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/WalletDepositStep.tsx', 'flow/useWalletDeposit.ts'],\n },\n 'deposit.wallet.unlinkFailed': {\n title: 'Wallet deposit: unlink failed',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/WalletDepositStep.tsx', 'flow/useWalletDeposit.ts'],\n },\n 'deposit.wallet.confirm': {\n title: 'Wallet deposit: confirmation',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/WalletDepositStep.tsx', 'screens/PaymentConfirmScreen.tsx'],\n },\n 'deposit.wallet.sent': {\n title: 'Wallet deposit: submitted successfully',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/WalletDepositStep.tsx', 'flow/useWalletDeposit.ts'],\n },\n 'deposit.wallet.failed': {\n title: 'Wallet deposit: transfer failed',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/WalletDepositStep.tsx', 'flow/useWalletDeposit.ts'],\n },\n 'deposit.wallet.pending': {\n title: 'Wallet deposit: unresolved transfer',\n flow: 'deposit',\n requires: 'fiatRail',\n touches: ['flow/WalletDepositStep.tsx', 'flow/useWalletDeposit.ts'],\n },\n 'deposit.addMoney': {\n title: 'Add money: method list',\n flow: 'deposit',\n requires: 'cryptoDeposit',\n touches: ['screens/SelectMethodScreen.tsx'],\n },\n 'deposit.transfer': {\n title: 'Transfer crypto: deposit address',\n flow: 'deposit',\n requires: 'cryptoDeposit',\n touches: ['screens/TransferCryptoScreen.tsx'],\n },\n 'deposit.lockedTransfer': {\n title: 'Locked deposit: token and chain dropdowns over the QR card',\n flow: 'deposit',\n requires: 'cryptoDepositLocked',\n touches: [\n 'screens/LockedTransferCryptoScreen.tsx',\n 'components/DepositQrCard.tsx',\n 'components/TokenChainSelector.tsx',\n 'flow/useDepositSelection.ts',\n 'screens/SelectReceiveTokenScreen.tsx',\n 'screens/SelectAvailableChainScreen.tsx',\n ],\n },\n // V2 crypto deposit: one inset modal, resized per page.\n 'deposit.crypto.token': {\n title: 'V2 crypto: token page, peek height',\n flow: 'deposit',\n requires: 'cryptoDepositV2',\n touches: CRYPTO_V2,\n },\n 'deposit.crypto.token.search': {\n title: 'V2 crypto: token page, searching at max height',\n flow: 'deposit',\n requires: 'cryptoDepositV2',\n touches: CRYPTO_V2,\n },\n 'deposit.crypto.network': {\n title: 'V2 crypto: network page',\n flow: 'deposit',\n requires: 'cryptoDepositV2',\n touches: CRYPTO_V2,\n },\n 'deposit.crypto.address': {\n title: 'V2 crypto: deposit address page',\n flow: 'deposit',\n requires: 'cryptoDepositV2',\n touches: CRYPTO_V2,\n },\n 'deposit.crypto.address.expanded': {\n title: 'V2 crypto: deposit address, tapped open in full',\n flow: 'deposit',\n requires: 'cryptoDepositV2',\n touches: CRYPTO_V2,\n },\n 'deposit.crypto.learnMore': {\n title: 'V2 crypto: learn more, max height',\n flow: 'deposit',\n requires: 'cryptoDepositV2',\n touches: CRYPTO_V2,\n },\n // Crypto withdrawal.\n 'withdraw.method': {\n title: 'Withdraw: payout methods',\n flow: 'withdrawal',\n requires: 'cryptoWithdrawal',\n touches: [\n 'flow/WithdrawalFlowContent.tsx',\n 'screens/WithdrawMethodScreen.tsx',\n ],\n },\n 'withdraw.method.venuePayout': {\n title: 'Withdraw: payout methods, cash paid by the venue (no wallet)',\n flow: 'withdrawal',\n requires: 'omnibusWithdrawFlow',\n touches: [\n 'flow/WithdrawalFlowContent.tsx',\n 'flow/withdrawalMethods.ts',\n 'screens/WithdrawMethodScreen.tsx',\n 'transfer/hooks/useWithdrawalFops.ts',\n 'withdrawal/withdrawalPayer.ts',\n 'withdrawal/useWithdrawalExecution.ts',\n ],\n },\n 'withdraw.amount': {\n title: 'Withdraw: amount',\n flow: 'withdrawal',\n requires: 'cryptoWithdrawal',\n touches: [...WITHDRAW, 'screens/WithdrawAmountScreen.tsx'],\n },\n 'withdraw.address': {\n title: 'Withdraw: recipient address',\n flow: 'withdrawal',\n requires: 'cryptoWithdrawal',\n touches: [...WITHDRAW, 'screens/WithdrawAddressScreen.tsx'],\n },\n 'withdraw.address.pastePanel': {\n title: 'Withdraw: recipient address, paste panel',\n flow: 'withdrawal',\n requires: 'omnibusWithdrawFlow',\n touches: [\n ...WITHDRAW,\n 'screens/WithdrawAddressScreen.tsx',\n 'components/PasteAddressPanel.tsx',\n 'components/WalletAddressInput.tsx',\n ],\n },\n 'withdraw.address.pastePanel.editing': {\n title: 'Withdraw: recipient address, paste panel editing',\n flow: 'withdrawal',\n requires: 'omnibusWithdrawFlow',\n touches: [\n ...WITHDRAW,\n 'screens/WithdrawAddressScreen.tsx',\n 'components/WalletAddressInput.tsx',\n ],\n },\n 'withdraw.receiveToken': {\n title: 'Withdraw: receive token and chain',\n flow: 'withdrawal',\n requires: 'cryptoWithdrawal',\n touches: [...WITHDRAW, 'screens/SelectReceiveTokenAndChainScreen.tsx'],\n },\n 'withdraw.complete': {\n title: 'Withdraw: submitted',\n flow: 'withdrawal',\n requires: 'cryptoWithdrawal',\n touches: [\n 'screens/WithdrawCryptoComplete.tsx',\n 'screens/WithdrawCompleteScreen.tsx',\n ],\n },\n 'withdraw.error': {\n title: 'Withdraw: execution failed',\n flow: 'withdrawal',\n requires: 'cryptoWithdrawal',\n touches: [\n 'flow/WithdrawalFlowContent.tsx',\n 'screens/WithdrawMethodScreen.tsx',\n ],\n },\n} as const satisfies Record<string, PreviewScenarioEntry>\n\nexport type PreviewScenarioId = keyof typeof PREVIEW_SCENARIO_CATALOG\n\nexport const PREVIEW_SCENARIO_IDS = Object.keys(\n PREVIEW_SCENARIO_CATALOG,\n) as PreviewScenarioId[]\n", "import type {\n FailureReason,\n FiatProvider,\n FiatStepResponse,\n FormDescriptor,\n Quote,\n} from '@funkit/connect-core'\nimport { MOONPAY_SHARING_CONSENT_VERSION } from '@funkit/connect-core'\n\nimport { PERSONA_PRIVACY_POLICY_URL } from '../fiat/kyc/legalLinks'\nimport type { CryptoFlowScreen } from '../flow/cryptoDepositFlow'\n\nimport { type FlowPreviewSeed, openingStep } from './flowPreview'\nimport {\n COUNTRY_FORM,\n DUE_DILIGENCE_FORM,\n ENHANCED_DUE_DILIGENCE_FORM,\n L2_FORM,\n LAST_FOUR_FORM,\n NATIONALITY_FORM,\n UNSUPPORTED_FORM,\n US_QUOTE,\n US_ROUND,\n} from './fixtures/kycForms'\nimport { moonPayChallengeState } from './fixtures/moonPayChallenge'\nimport {\n PREVIEW_SCENARIO_CATALOG,\n type PreviewScenarioEntry,\n type PreviewScenarioId,\n} from './scenarioCatalog'\n\n/**\n * A canned `/fiat/*` answer: a step response, or an HTTP failure to provoke a retry.\n * - `retryAfterSeconds` rides a 429's body, as fun-backend's rate limiter sends it.\n */\nexport type PreviewResponse =\n | FiatStepResponse\n | { status: number; retryAfterSeconds?: number }\n /**\n * Built per request, for a step whose times count from when it is asked for,\n * or that answers the quote the request names.\n */\n | ((request: { quoteRef?: string }) => FiatStepResponse)\n\n/**\n * The fiat backend a scenario runs against, so a seeded screen stays put and its CTAs answer.\n * - `quote` answers `POST /fiat/quote`; unset keeps the priced quote every rail starts from.\n * - `responses` answer other endpoints by path; anything unlisted re-sends the step on screen.\n */\n/**\n * The `reason` a scenario's quote is refused with, as fun-backend's `FiatNoRouteError` sends it.\n * - All but `NO_CANDIDATE_LEGACY` follow fun-backend #4936 / #4875, which are not deployed yet.\n */\nexport type PreviewNoRouteReason =\n | 'NO_CANDIDATE_LEGACY'\n | 'NO_CANDIDATE'\n | 'KYC_INSUFFICIENT'\n | 'USER_LIMIT'\n | 'PROVIDER_OUTAGE'\n\nexport type PreviewRange = readonly [\n min: string,\n max: string,\n userMax: string | null,\n]\n\n/** One provider's span of the table, and what its quote answers at an amount inside it. */\nexport interface PreviewProviderRoute {\n provider: FiatProvider\n min: string\n max: string\n /** How much of its requirements the table can see; every entry still needs a sign-in. */\n visibility: 'AUTH_GATED' | 'PARTIAL' | 'COMPLETE'\n answer: (amount: string) => FiatStepResponse\n}\n\nexport interface PreviewBackend {\n quote?: FiatStepResponse\n minimum?: string\n /** Every quote is refused with this no-route reason. */\n noRoute?: PreviewNoRouteReason\n /**\n * The only amounts served, as `[min, max, userMax]`: the routing table lists\n * them, and a quote outside all of them is refused with them as\n * `serviceableRanges`, the way fun-backend #5119 keeps a buyer cap's gap.\n */\n ranges?: readonly PreviewRange[]\n /**\n * Several providers, preferred first: the table splits wherever one starts or stops, a routed\n * quote is answered by the provider it names, and `POST /fiat/quote` by the first one (inside\n * the host's pinned list) that serves the amount.\n */\n providers?: readonly PreviewProviderRoute[]\n /** The routing table's `currentLimit` for the scenario's provider: what it serves now without another check. */\n currentLimit?: string\n /** The routing table predicts the fee is reimbursed, so an empty amount reads \"No fees with debit cards\". */\n feeSubsidized?: true\n /** The country \u2192 currency lookup fails, so no quote is ever asked for. */\n currencyLookupFails?: boolean\n responses?: Readonly<Record<string, PreviewResponse>>\n /** `endpoint` answers `step` once `afterMs` has passed since it was first asked: an order that settles while watched. */\n settles?: { endpoint: string; afterMs: number; step: FiatStepResponse }\n}\n\nexport interface PreviewScenario extends PreviewScenarioEntry {\n id: PreviewScenarioId\n seed: FlowPreviewSeed\n backend: PreviewBackend\n}\n\nconst PROVIDER = 'MOONPAY' as const\nconst { quoteRef } = US_QUOTE\nconst AMOUNT = '105'\nconst CREATED_AT = '2026-09-01T12:00:00Z'\nconst TX_HASH =\n '0x5c504ed432cb51138bcf09aa5e8a410dd4a1e204ef84bfed1be16dfba1b22060' as const\n\nconst WALLET: NonNullable<NonNullable<FlowPreviewSeed['deposit']>['wallet']> = {\n app: {\n name: 'Phantom',\n iconUrl: 'https://sdk-cdn.fun.xyz/images/wallets/phantom.svg',\n connect: async () => 'preview-wallet',\n disconnect: () => {},\n supportsAsset: () => true,\n transfer: async () => 'preview-signature',\n },\n from: 'preview-wallet',\n to: 'preview-deposit',\n amount: '25',\n status: 'idle',\n tokens: [\n {\n chainId: '1151111081099710',\n contractAddress: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',\n symbol: 'USDC',\n name: 'USD Coin',\n decimals: 6,\n tokenBalance: '40000000',\n price: 1,\n totalUsdValue: 40,\n },\n ],\n}\n\nconst pricedQuote = (inputs?: Record<string, { type: 'TEXT' }>) =>\n ({\n state: {\n kind: 'QUOTE',\n quote: US_QUOTE,\n limits: { min: '20.00', max: '2000.00' },\n },\n provider: PROVIDER,\n transitions: [\n {\n id: 'continue',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/session',\n params: { quoteRef },\n ...(inputs === undefined ? {} : { inputs }),\n },\n ],\n }) satisfies FiatStepResponse\n\nconst PRICED = pricedQuote()\n\n/** Pump's match: the whole amount, up to $50. */\nconst PREVIEW_MATCH = { rate: 1, max: { currency: 'USD', amount: 50 } }\n\n/** The quote re-presented after too many code sends; its Continue retries. */\nconst otpThrottled: FiatStepResponse = {\n ...pricedQuote({ phone: { type: 'TEXT' } }),\n state: {\n ...PRICED.state,\n error: {\n category: 'USER_ERROR',\n code: 'OTP_DISPATCH_THROTTLED',\n retryable: true,\n recovery: 'NONE',\n },\n },\n}\n\nconst otp = (channel: 'EMAIL_OTP' | 'SMS_OTP'): FiatStepResponse => ({\n state: { kind: 'SESSION_AUTH', channel },\n provider: PROVIDER,\n transitions: [\n {\n id: 'verify',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/session/verify',\n params: { quoteRef },\n inputs: { code: { type: 'TEXT', length: 6 } },\n },\n {\n id: 'resend',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/session',\n params: { quoteRef },\n },\n ],\n})\n\n/** A Fun-run login's entry quote, sent with no session: it asks for the email. */\nconst FUN_AUTH_EMAIL: FiatStepResponse = {\n state: { kind: 'FUN_AUTH', channel: 'EMAIL_OTP', phase: 'IDENTIFIER' },\n transitions: [\n {\n id: 'start',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/auth',\n inputs: { email: { type: 'TEXT' } },\n },\n ],\n}\n\nconst FUN_AUTH_RESEND = {\n id: 'resend',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/auth',\n params: { verificationRef: 'vr_preview' },\n} as const\n\n// Built per call, so each code's countdown starts when it is sent.\nconst funAuthCode = (): FiatStepResponse => ({\n state: {\n kind: 'FUN_AUTH',\n channel: 'EMAIL_OTP',\n phase: 'CODE',\n expiresAtMs: Date.now() + 10 * 60_000,\n resendAvailableAtMs: Date.now() + 30_000,\n attemptsRemaining: 3,\n },\n transitions: [\n {\n id: 'verify',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/auth/verify',\n params: { verificationRef: 'vr_preview' },\n inputs: { otpCode: { type: 'TEXT', length: 6, regex: '^\\\\d{6}$' } },\n },\n FUN_AUTH_RESEND,\n ],\n})\n\n/** The challenge is dropped: only a fresh code moves on. */\nconst FUN_AUTH_TOO_MANY: FiatStepResponse = {\n state: {\n kind: 'FUN_AUTH',\n channel: 'EMAIL_OTP',\n phase: 'CODE',\n attemptsRemaining: 0,\n error: {\n category: 'USER_ERROR',\n code: 'TOO_MANY_ATTEMPTS',\n retryable: true,\n recovery: 'NONE',\n },\n },\n transitions: [FUN_AUTH_RESEND],\n}\n\nconst FUN_AUTH_VERIFIED: FiatStepResponse = {\n state: { kind: 'FUN_AUTH', channel: 'EMAIL_OTP', phase: 'VERIFIED' },\n transitions: [],\n session: {\n accessToken: 'preview-access-token',\n refreshHandle: 'preview-refresh-handle',\n expiresAtMs: Date.now() + 60 * 60_000,\n },\n}\n\nconst kycForm = (\n form: FormDescriptor,\n stripeTier?: 'l0' | 'l1',\n error?: FailureReason,\n): FiatStepResponse => ({\n state: {\n kind: 'KYC',\n phase: 'INPUT_REQUIRED',\n quote: US_QUOTE,\n form,\n ...(error === undefined ? {} : { error }),\n },\n provider: stripeTier === undefined ? PROVIDER : 'STRIPE',\n transitions: [\n {\n id: 'submit_round',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/kyc/form',\n params: {\n quoteRef,\n formId: form.formId,\n ...(stripeTier === undefined ? {} : { kycTier: stripeTier }),\n },\n inputs: { values: { type: 'FORM_VALUES' } },\n },\n ],\n})\n\n/** Each provider's testing quote as Datadog logged it on 2026-10-04/05: rate and fee label. */\nconst PROVIDER_PRICING: Partial<\n Record<FiatProvider, { rate: number; feeLabel: string }>\n> = {\n COINBASE: { rate: 0.9804, feeLabel: 'Coinbase fee' },\n STRIPE: { rate: 0.961169, feeLabel: 'Stripe fee' },\n MOONPAY: { rate: 0.956546, feeLabel: 'MoonPay fee' },\n}\n\nconst quoteAt = (provider: FiatProvider, amount: string): Quote => {\n const { rate, feeLabel } = PROVIDER_PRICING[provider] ?? {\n rate: 0.995,\n feeLabel: 'Fee',\n }\n const fee = (Number(amount) * (1 - rate)).toFixed(2)\n return {\n ...US_QUOTE,\n quoteRef: `qr_${provider.toLowerCase()}_${amount}`,\n fiat: { ...US_QUOTE.fiat, amount },\n crypto: { ...US_QUOTE.crypto, amount: (Number(amount) * rate).toFixed(2) },\n rate: rate.toFixed(6),\n totalFee: fee,\n feeBreakdown: [\n { id: 'provider_fee', labelFallback: feeLabel, amount: fee },\n ],\n }\n}\n\n/**\n * A signed-in buyer's price as the testing backend sends it: `open_session` to\n * `POST /fiat/payment-session`.\n * - Without Coinbase's `preparedPayment` and Stripe's Link token: neither is real outside a\n * provider session.\n */\nconst pricedAt =\n (provider: FiatProvider, max: string, min = '5') =>\n (amount: string): FiatStepResponse => {\n const quote = quoteAt(provider, amount)\n return {\n provider,\n state: { kind: 'QUOTE', quote, limits: { min, max } },\n transitions: [\n {\n id: 'open_session',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/payment-session',\n params: { provider, quoteRef: quote.quoteRef },\n labelFallback: 'Continue',\n },\n ],\n }\n }\n\n/**\n * Stripe's price holds nothing until the tap opens its pay sheet; MoonPay and Coinbase prepare\n * checkout on arrival, and typing over that round remounts the step and drops its ceiling. A\n * preview has no Stripe SDK, so MoonPay's tier stands in for Stripe with a CTA nothing prepares.\n */\nconst payableOnTap = (step: FiatStepResponse): FiatStepResponse => ({\n ...step,\n transitions: [\n {\n id: 'continue',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/orders',\n params: {\n quoteRef:\n step.state.kind === 'QUOTE' ? step.state.quote.quoteRef : quoteRef,\n },\n },\n ],\n})\n\n/**\n * MoonPay prices this buyer's $5,000 tier now, and holds more on identity with the quote attached.\n * - The testing backend answers with Sumsub capture after the MoonPay sign-in; neither draws in a\n * preview, so the identity form stands in for it.\n */\nconst moonPayAt = (amount: string): FiatStepResponse => {\n if (Number(amount) <= 5000) {\n return payableOnTap(pricedAt('MOONPAY', '5000.00')(amount))\n }\n const round = kycForm(US_ROUND)\n return round.state.kind === 'KYC' && round.state.phase === 'INPUT_REQUIRED'\n ? {\n ...round,\n provider: 'MOONPAY',\n refreshLimits: true,\n state: { ...round.state, quote: quoteAt('MOONPAY', amount) },\n }\n : round\n}\n\n/** Transak's covered price, payable up to `limit` and held on identity above it. Transak sends\n * nothing ahead of the tap, so the held entry stays on screen. */\nconst kycAbove =\n (limit: string) =>\n (amount: string): FiatStepResponse => {\n const priced = quoteAt('TRANSAK', amount)\n const quote: Quote = {\n ...priced,\n feeSubsidy: { currency: 'USD', amount: priced.totalFee },\n }\n const payable = Number(amount) <= Number(limit)\n return {\n provider: 'TRANSAK',\n state: { kind: 'QUOTE', quote, limits: { min: '5', max: '5000.00' } },\n transitions: [\n payable\n ? {\n id: 'continue',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/orders',\n params: { quoteRef: quote.quoteRef },\n }\n : {\n id: 'kyc_required',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/session',\n params: { quoteRef: quote.quoteRef },\n labelFallback: 'KYC required',\n },\n ],\n }\n }\n\n// fun-backend #5120 sends the field-group code; until it deploys the round carries `INVALID_VALUE`.\nconst PHONE_REFUSAL: FailureReason = {\n category: 'USER_ERROR',\n retryable: true,\n recovery: 'NONE',\n code: 'PHONE_INVALID',\n}\n\nconst IN_REVIEW: FiatStepResponse = {\n state: {\n kind: 'KYC',\n phase: 'NO_ACTION_REQUIRED',\n reason: 'IN_REVIEW',\n quote: US_QUOTE,\n },\n provider: PROVIDER,\n transitions: [\n {\n id: 'poll',\n mode: 'AWAIT',\n poll: {\n endpoint: `GET /fiat/quotes/${quoteRef}`,\n intervalMs: 3000,\n backoffFactor: 1.5,\n maxIntervalMs: 10000,\n giveUpAfterMs: 90000,\n },\n },\n ],\n}\n\n/** An in-review answer naming how long the review is expected to take. */\ntype ReviewDuration = NonNullable<\n Extract<FiatStepResponse['state'], { phase: 'NO_ACTION_REQUIRED' }>['review']\n>\nconst reviewFor = (review: ReviewDuration): FiatStepResponse =>\n ({\n ...IN_REVIEW,\n state: { ...IN_REVIEW.state, review },\n }) as FiatStepResponse\n\n/**\n * Opens on the amount screen, so the routing table (and its `currentLimit`) is fetched before the\n * check: a seeded round turns the table off. Fill in the form; it sends into `review`, and each\n * poll then answers `polled`.\n */\nconst submittedInto = (review: FiatStepResponse, polled: FiatStepResponse) =>\n fiat(\n { pressEntry: true },\n {\n quote: kycForm(US_ROUND),\n currentLimit: '500.00',\n responses: {\n '/fiat/kyc/form': review,\n [`/fiat/quotes/${quoteRef}`]: polled,\n },\n },\n )\n\nconst ON_HOLD: FiatStepResponse = {\n state: {\n kind: 'KYC',\n phase: 'NO_ACTION_REQUIRED',\n reason: 'ON_HOLD',\n retryAfter: '2026-12-01T09:00:00Z',\n quote: US_QUOTE,\n },\n provider: PROVIDER,\n transitions: [],\n}\n\nconst REJECTED: FiatStepResponse = {\n state: {\n kind: 'KYC',\n phase: 'NO_ACTION_REQUIRED',\n reason: 'REJECTED',\n quote: US_QUOTE,\n failureReason: {\n category: 'KYC_REJECTED',\n retryable: false,\n recovery: 'CONTACT_SUPPORT',\n },\n },\n provider: PROVIDER,\n transitions: [],\n}\n\nconst KYC_CAPTURE: FiatStepResponse = {\n state: {\n kind: 'KYC',\n phase: 'CAPTURE',\n quote: US_QUOTE,\n surface: {\n kind: 'KYC_SDK',\n provider: 'SUMSUB',\n params: { accessToken: 'preview-token' },\n expiresAt: '2027-01-01T00:00:00Z',\n },\n },\n provider: PROVIDER,\n transitions: [\n {\n id: 'capture',\n mode: 'CLIENT_SURFACE',\n report: {\n endpoint: 'POST /fiat/kyc/capture',\n params: { quoteRef },\n result: { type: 'KYC_SDK_RESULT', bodyKey: 'result' },\n },\n },\n ],\n}\n\n/** A MoonPay quote its own checkout takes over, as `POST /fiat/quote` hands it off. */\nconst MOONPAY_HANDOFF: FiatStepResponse = {\n ...pricedAt('MOONPAY', '5000')(AMOUNT),\n transitions: [],\n handoff: { provider: 'MOONPAY' as const },\n}\n\nconst MOONPAY_HOSTED_CHECK: FiatStepResponse = {\n state: {\n kind: 'KYC',\n phase: 'CAPTURE',\n quote: US_QUOTE,\n surface: {\n kind: 'URL_REDIRECT',\n provider: 'MOONPAY',\n params: { url: 'https://buy-sandbox.moonpay.com/challenge' },\n },\n },\n provider: PROVIDER,\n transitions: [\n {\n id: 'capture',\n mode: 'CLIENT_SURFACE',\n report: {\n endpoint: 'POST /fiat/kyc/capture',\n params: { quoteRef, provider: PROVIDER },\n expects: ['result'],\n },\n },\n ],\n}\n\nconst MOONPAY_SHARING_CONSENT: FiatStepResponse = {\n state: { kind: 'SESSION_AUTH', channel: 'PROVIDER_RENDERED' },\n provider: PROVIDER,\n transitions: [\n {\n id: 'start',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/session',\n params: { quoteRef, provider: PROVIDER },\n inputs: {\n termsAcceptance: {\n type: 'TERMS_ACCEPTANCE',\n version: MOONPAY_SHARING_CONSENT_VERSION,\n documentUrl: PERSONA_PRIVACY_POLICY_URL,\n labelFallback: 'Accept the terms',\n },\n },\n labelFallback: 'Continue',\n },\n ],\n}\n\nconst ORDER_REVIEW: FiatStepResponse = {\n state: { kind: 'ORDER', phase: 'AWAITING_CONFIRMATION', quote: US_QUOTE },\n provider: PROVIDER,\n transitions: [\n {\n id: 'confirm',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/orders',\n params: { quoteRef },\n },\n ],\n}\n\nconst ORDER = {\n orderId: 'o_preview',\n fiat: US_QUOTE.fiat,\n crypto: US_QUOTE.crypto,\n method: 'apple_pay',\n createdAt: CREATED_AT,\n} as const\n\nconst orderCreated = (\n state: Omit<\n Extract<FiatStepResponse['state'], { kind: 'ORDER'; phase: 'CREATED' }>,\n 'kind' | 'phase' | 'order'\n >,\n): FiatStepResponse => ({\n state: { kind: 'ORDER', phase: 'CREATED', order: ORDER, ...state },\n provider: PROVIDER,\n transitions: [],\n})\n\nconst SETTLED_ORDER = orderCreated({\n status: 'SETTLED',\n tx: { chainId: 1151111081099710, hash: TX_HASH },\n})\n\nconst FAILED_ORDER = orderCreated({\n status: 'FAILED',\n failureReason: {\n category: 'PAYMENT_DECLINED',\n retryable: true,\n recovery: 'RETRY_PAYMENT',\n },\n})\n\n/** An order the buyer just paid for, polled the way fun-backend sends it. */\nconst PROCESSING_ORDER: FiatStepResponse = {\n ...orderCreated({ status: 'PROCESSING' }),\n transitions: [\n {\n id: 'poll',\n mode: 'AWAIT',\n poll: {\n endpoint: `GET /fiat/orders/${ORDER.orderId}`,\n intervalMs: 2000,\n backoffFactor: 1,\n maxIntervalMs: 2000,\n // Long enough to read every line of the wait before the poll gives up.\n giveUpAfterMs: 600_000,\n },\n },\n ],\n}\n\n/**\n * The order a pay tap opens for the quote it named (`qr_<provider>_<amount>`), polled as\n * `PROCESSING_ORDER` is: a failover's lowered or switched quote, not the fixed MoonPay order.\n */\nconst processingOrderFor = ({ quoteRef }: { quoteRef?: string }) => {\n const [, provider, amount] = /^qr_([a-z]+)_(.+)$/.exec(quoteRef ?? '') ?? []\n if (provider === undefined || amount === undefined) {\n return PROCESSING_ORDER\n }\n const quote = quoteAt(provider.toUpperCase() as FiatProvider, amount)\n return {\n ...PROCESSING_ORDER,\n provider: provider.toUpperCase() as FiatProvider,\n state: {\n ...PROCESSING_ORDER.state,\n order: { ...ORDER, fiat: quote.fiat, crypto: quote.crypto },\n },\n } as FiatStepResponse\n}\n\nconst PENDING_ORDER: FiatStepResponse = {\n state: {\n kind: 'PENDING_ORDER',\n order: { ...ORDER, status: 'AWAITING_PAYMENT' },\n },\n provider: PROVIDER,\n transitions: [\n { id: 'resume', mode: 'SUBMIT', endpoint: 'GET /fiat/orders/o_preview' },\n {\n id: 'cancel',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/orders/o_preview/cancel',\n },\n ],\n}\n\n/** Transak's Apple Pay sheet, ready to open: a held capture never draws it. */\nconst TRANSAK_CAPTURE: FiatStepResponse = {\n state: {\n kind: 'PAYMENT',\n phase: 'CAPTURE',\n surface: {\n kind: 'PAY_SHEET',\n provider: 'TRANSAK',\n params: { sessionId: 'preview-session', environment: 'STAGING' },\n },\n },\n provider: 'TRANSAK',\n transitions: [\n {\n id: 'capture',\n mode: 'CLIENT_SURFACE',\n report: { endpoint: 'POST /fiat/orders', expects: ['requestId'] },\n },\n ],\n}\n\nconst BANK_INSTRUCTIONS: FiatStepResponse = {\n state: {\n kind: 'PAYMENT',\n phase: 'INSTRUCT',\n orderId: 'o_preview',\n instructions: {\n kind: 'BANK_FIELDS',\n fields: [\n { id: 'beneficiary', labelFallback: 'Beneficiary', value: 'MoonPay' },\n { id: 'routing', labelFallback: 'Routing number', value: '021000021' },\n { id: 'account', labelFallback: 'Account number', value: '12345678' },\n { id: 'reference', labelFallback: 'Reference', value: 'o_preview' },\n ],\n expiresAt: '2027-01-01T00:00:00Z',\n },\n },\n provider: PROVIDER,\n transitions: [\n {\n id: 'confirm_paid',\n mode: 'SUBMIT',\n endpoint: 'POST /fiat/orders/o_preview/confirm-payment',\n },\n ],\n}\n\n// A state the SDK has no screen for, the way a newer contract's would arrive.\nconst UNDRAWN = {\n state: { kind: 'WALLET_AUTH', challenge: { kind: 'SIWE', message: '\u2026' } },\n provider: PROVIDER,\n transitions: [],\n} as unknown as FiatStepResponse\n\nconst UNAVAILABLE = { status: 503 } as const\n// The login budget's 429 names what is left of its window; under a minute here.\nconst RATE_LIMITED = { status: 429, retryAfterSeconds: 45 } as const\n\n/**\n * What each CTA answers with unless a scenario says otherwise, so a preview keeps going past the\n * screen it opened on: sign-in, code, identity form, review, a settled order.\n */\nconst JOURNEY: Readonly<Record<string, PreviewResponse>> = {\n '/fiat/session': otp('EMAIL_OTP'),\n '/fiat/session/verify': kycForm(US_ROUND),\n '/fiat/auth': funAuthCode,\n '/fiat/auth/verify': FUN_AUTH_VERIFIED,\n '/fiat/kyc/form': ORDER_REVIEW,\n '/fiat/orders': SETTLED_ORDER,\n}\n\nconst fiat = (\n fiatSeed: NonNullable<FlowPreviewSeed['deposit']>['fiat'],\n backend: PreviewBackend = {},\n) => ({\n seed: { deposit: { fiat: { amount: AMOUNT, ...fiatSeed } } },\n backend: { ...backend, responses: { ...JOURNEY, ...backend.responses } },\n})\n\nconst paymentCrypto = (page: CryptoFlowScreen) => {\n const scenario = fiat(\n { paymentMethodPicker: true, paymentMethodCrypto: page },\n { quote: { ...PRICED, provider: 'TRANSAK' } },\n )\n return {\n ...scenario,\n seed: {\n deposit: {\n ...scenario.seed.deposit,\n chainId: '8453',\n sourceSymbol: 'USDC',\n },\n },\n }\n}\n\nconst form = (\n formDescriptor: FormDescriptor,\n identity: NonNullable<FiatSeed['identity']>,\n) => fiat({ step: kycForm(formDescriptor), identity })\n\ntype FiatSeed = NonNullable<NonNullable<FlowPreviewSeed['deposit']>['fiat']>\n\nconst DEMO_RECIPIENT = '0x2A8Bd916E85d98d8175258De99fc0ddbcC102eF6'\n\nconst DEFINITIONS: Record<\n PreviewScenarioId,\n { seed: FlowPreviewSeed; backend: PreviewBackend }\n> = {\n // Transak's entry isn't sent ahead of the tap, so the priced entry stays up until pressed.\n 'fiat.amount': fiat({}, { quote: { ...PRICED, provider: 'TRANSAK' } }),\n 'fiat.amount.depositMatch': fiat(\n { depositMatch: PREVIEW_MATCH },\n {\n feeSubsidized: true,\n quote: {\n ...PRICED,\n state: {\n ...PRICED.state,\n quote: {\n ...US_QUOTE,\n feeSubsidy: { currency: 'USD', amount: '0.50' },\n },\n },\n provider: 'TRANSAK',\n },\n },\n ),\n 'fiat.amount.subsidized': fiat(\n {},\n {\n feeSubsidized: true,\n quote: {\n ...PRICED,\n state: {\n ...PRICED.state,\n quote: {\n ...US_QUOTE,\n feeSubsidy: { currency: 'USD', amount: '0.50' },\n },\n },\n provider: 'TRANSAK',\n },\n },\n ),\n 'fiat.amount.depositMatch.unsubsidized': fiat(\n { depositMatch: PREVIEW_MATCH },\n { quote: { ...PRICED, provider: 'TRANSAK' } },\n ),\n 'fiat.amount.paymentMethodPicker': fiat(\n { paymentMethodPicker: true },\n { quote: { ...PRICED, provider: 'TRANSAK' } },\n ),\n 'fiat.amount.paymentMethodPicker.content': fiat(\n { paymentMethodPicker: true, paymentMethodContent: true },\n { quote: { ...PRICED, provider: 'TRANSAK' } },\n ),\n 'fiat.amount.paymentMethodPicker.swapped': fiat(\n { paymentMethodPicker: true, paymentMethodSwapped: true },\n { quote: { ...PRICED, provider: 'TRANSAK' } },\n ),\n 'fiat.amount.paymentMethodPicker.swappedPending': fiat(\n { paymentMethodPicker: true, paymentMethodSwappedPending: true },\n { quote: { ...PRICED, provider: 'TRANSAK' } },\n ),\n 'fiat.amount.paymentMethodPicker.cryptoToken': paymentCrypto('cryptoToken'),\n 'fiat.amount.paymentMethodPicker.cryptoNetwork':\n paymentCrypto('cryptoNetwork'),\n 'fiat.amount.paymentMethodPicker.cryptoAddress':\n paymentCrypto('cryptoAddress'),\n 'fiat.amount.paymentMethodPicker.cryptoLearnMore':\n paymentCrypto('cryptoLearnMore'),\n 'fiat.amount.empty': fiat(\n { amount: '' },\n { quote: { ...PRICED, provider: 'TRANSAK' } },\n ),\n 'fiat.amount.belowMinimum': fiat(\n { amount: '10' },\n { quote: PRICED, minimum: '20' },\n ),\n 'fiat.amount.otpThrottled': fiat(\n { step: otpThrottled },\n { responses: { '/fiat/session': otp('SMS_OTP') } },\n ),\n 'fiat.amount.noProvider': fiat({}, { noRoute: 'NO_CANDIDATE' }),\n 'fiat.amount.kycUnservable': fiat({}, { noRoute: 'KYC_INSUFFICIENT' }),\n 'fiat.amount.userLimit': fiat({}, { noRoute: 'USER_LIMIT' }),\n 'fiat.amount.providerOutage': fiat({}, { noRoute: 'PROVIDER_OUTAGE' }),\n 'fiat.amount.noRouteToday': fiat({}, { noRoute: 'NO_CANDIDATE_LEGACY' }),\n // alex_fine on 2026-10-04: $995 left on Coinbase, $7,285.96 on Stripe; MoonPay $5,000 now and\n // $20,000 after identity. The $1,000 price must not cap a $10,000 deposit MoonPay asks to\n // verify. A host with no Stripe SDK skips Stripe; MoonPay's $5,000 tier stands in for it.\n // Payable at the seeded amount; one more digit asks for identity, which the screen reads as a\n // crossed daily limit.\n 'fiat.amount.kycThreshold': fiat(\n { paymentMethodPicker: true },\n {\n feeSubsidized: true,\n providers: [\n {\n provider: 'TRANSAK',\n min: '5',\n max: '5000',\n visibility: 'AUTH_GATED',\n answer: kycAbove(AMOUNT),\n },\n ],\n },\n ),\n 'fiat.amount.providerCeiling': fiat(\n { amount: '1000' },\n {\n providers: [\n {\n provider: 'COINBASE',\n min: '5',\n max: '995',\n visibility: 'AUTH_GATED',\n answer: pricedAt('COINBASE', '995'),\n },\n {\n provider: 'STRIPE',\n min: '5',\n max: '7285.96',\n visibility: 'AUTH_GATED',\n answer: pricedAt('STRIPE', '7285.96'),\n },\n {\n provider: 'MOONPAY',\n min: '20',\n max: '20000',\n visibility: 'PARTIAL',\n answer: moonPayAt,\n },\n ],\n },\n ),\n // A New York buyer: no Stripe, $10 left on Coinbase, MoonPay from $20.\n 'fiat.amount.gap': fiat(\n { amount: '12' },\n {\n ranges: [\n ['5', '2500', '10'],\n ['20', '10000', null],\n ],\n },\n ),\n 'fiat.amount.currencyLookupFailed': fiat({}, { currencyLookupFails: true }),\n 'fiat.contact.email': fiat(\n { pressEntry: true },\n { quote: pricedQuote({ email: { type: 'TEXT' } }) },\n ),\n 'fiat.contact.phone': fiat(\n { pressEntry: true },\n { quote: pricedQuote({ phone: { type: 'TEXT' } }) },\n ),\n 'fiat.contact.redirected': fiat({\n redirectHold: {\n fields: [{ name: 'phoneNumber', kind: 'PHONE' }],\n contacts: { phone: '+33612345678' },\n },\n }),\n 'fiat.otp.email': fiat({ step: otp('EMAIL_OTP') }),\n 'fiat.otp.sms': fiat({ step: otp('SMS_OTP') }),\n 'fiat.funauth.email': fiat({ pressEntry: true }, { quote: FUN_AUTH_EMAIL }),\n // Built as the scenario opens, so its resend countdown starts then.\n 'fiat.funauth.code': fiat({ step: funAuthCode }),\n 'fiat.funauth.code.tooMany': fiat({ step: FUN_AUTH_TOO_MANY }),\n 'fiat.funauth.verified': fiat({ step: FUN_AUTH_VERIFIED }),\n 'fiat.funauth.reauth': fiat({\n step: PROCESSING_ORDER,\n paymentCaptured: true,\n funReauth: true,\n }),\n 'kyc.l1.intro': form(US_ROUND, { page: 'consent' }),\n 'kyc.l1.name': form(US_ROUND, { page: 'form', section: 'NAME' }),\n 'kyc.l1.dob': form(US_ROUND, { page: 'form', section: 'DOB' }),\n 'kyc.l1.address': form(US_ROUND, { page: 'form', section: 'ADDRESS' }),\n 'kyc.l1.ssn': form(US_ROUND, { page: 'form', section: 'SSN' }),\n 'kyc.nationality': form(NATIONALITY_FORM, { page: 'form' }),\n 'kyc.country': form(COUNTRY_FORM, { page: 'form' }),\n 'kyc.ssnLastFour': form(LAST_FOUR_FORM, { page: 'form' }),\n 'kyc.l2.intro': form(L2_FORM, { page: 'consent' }),\n 'kyc.stripe.l1.intro': fiat({\n step: kycForm(US_ROUND, 'l1'),\n identity: { page: 'consent' },\n }),\n 'kyc.l2.moonpay-consent': fiat(\n { step: MOONPAY_SHARING_CONSENT },\n { responses: { '/fiat/session': IN_REVIEW } },\n ),\n 'kyc.l2.dob': form(L2_FORM, { page: 'form', section: 'DOB' }),\n 'kyc.l2.occupation': form(L2_FORM, { page: 'form', section: 'OCCUPATION' }),\n 'kyc.l2.purpose': form(L2_FORM, { page: 'form', section: 'PURPOSE' }),\n 'kyc.dueDiligence': form(DUE_DILIGENCE_FORM, { page: 'form' }),\n 'kyc.dueDiligence.phoneRefused': fiat({\n step: kycForm(DUE_DILIGENCE_FORM, undefined, PHONE_REFUSAL),\n identity: { page: 'form' },\n }),\n 'kyc.dueDiligence.income': form(DUE_DILIGENCE_FORM, {\n page: 'form',\n section: 'INCOME',\n }),\n 'kyc.edd.profession': form(ENHANCED_DUE_DILIGENCE_FORM, {\n page: 'form',\n section: 'OCCUPATION',\n }),\n 'kyc.edd.netWorth': form(ENHANCED_DUE_DILIGENCE_FORM, {\n page: 'form',\n section: 'NET_WORTH',\n }),\n 'kyc.form.unsupported': form(UNSUPPORTED_FORM, { page: 'form' }),\n // The review's poll lands on a second round, so the round's screens are drawn again.\n 'kyc.stepUp.afterReview': fiat(\n { step: kycForm(LAST_FOUR_FORM), identity: { page: 'form' } },\n {\n responses: {\n '/fiat/kyc/form': IN_REVIEW,\n [`/fiat/quotes/${quoteRef}`]: kycForm(L2_FORM),\n },\n },\n ),\n 'kyc.form.retry': fiat(\n {\n step: kycForm(US_ROUND),\n identity: { page: 'form', section: 'SSN' },\n submitOnOpen: 'submit_round',\n },\n { responses: { '/fiat/kyc/form': UNAVAILABLE } },\n ),\n 'kyc.form.rateLimited': fiat(\n {\n step: kycForm(US_ROUND),\n identity: { page: 'form', section: 'SSN' },\n submitOnOpen: 'submit_round',\n },\n { responses: { '/fiat/kyc/form': RATE_LIMITED } },\n ),\n 'kyc.capture.intro': fiat({ step: KYC_CAPTURE }),\n 'kyc.capture.moonpay-handoff': fiat({\n step: MOONPAY_HOSTED_CHECK,\n captureReissued: true,\n moonPayCaptureRedoing: true,\n }),\n // The quote hands off to MoonPay's own checkout, seeded at MoonPay's extra check: the preview's\n // backend answers no `/fiat/next`.\n 'kyc.moonpay-check.intro': fiat(\n { moonPayChallenge: (start) => moonPayChallengeState(start, 'intro') },\n { quote: MOONPAY_HANDOFF },\n ),\n 'kyc.moonpay-check.again': fiat(\n { moonPayChallenge: (start) => moonPayChallengeState(start, 'again') },\n { quote: MOONPAY_HANDOFF },\n ),\n 'kyc.completion.review': fiat({ step: IN_REVIEW, kycCompletion: 'review' }),\n // The pending card at once, with \"Deposit max\" at the table's current limit.\n 'kyc.review.extended': submittedInto(\n reviewFor({ duration: 'EXTENDED' }),\n reviewFor({ duration: 'EXTENDED' }),\n ),\n // \"Authorizing your limits now\u2026\" while the poll runs, then the price it brings.\n 'kyc.review.brief': submittedInto(\n reviewFor({ duration: 'BRIEF', holdMs: 30_000 }),\n PRICED,\n ),\n 'kyc.completion.hold': fiat({ step: ON_HOLD, kycCompletion: 'hold' }),\n 'kyc.completion.restricted': fiat({\n step: REJECTED,\n kycCompletion: 'restricted',\n }),\n 'kyc.required': fiat({}, { quote: kycForm(US_ROUND) }),\n 'kyc.verdict.review': fiat({ step: IN_REVIEW }),\n 'kyc.verdict.hold': fiat({ step: ON_HOLD }),\n 'kyc.verdict.rejected': fiat({ step: REJECTED }),\n 'kyc.options.review': fiat({ step: IN_REVIEW, pressEntry: true }),\n 'kyc.options.hold': fiat({ step: ON_HOLD, pressEntry: true }),\n 'kyc.options.rejected': fiat({ step: REJECTED, pressEntry: true }),\n 'order.review': fiat({ step: ORDER_REVIEW }),\n 'order.bankInstructions': fiat({ step: BANK_INSTRUCTIONS }),\n 'order.pending': fiat({ step: PENDING_ORDER }),\n 'order.tracking': fiat({ step: orderCreated({ status: 'PROCESSING' }) }),\n 'order.success': fiat({ step: SETTLED_ORDER }),\n 'order.processing': fiat({ step: PROCESSING_ORDER, paymentCaptured: true }),\n // Lands after the first two lines of the wait have had their turn.\n 'order.processing.lands': fiat(\n { step: PROCESSING_ORDER, paymentCaptured: true },\n {\n settles: {\n endpoint: `/fiat/orders/${ORDER.orderId}`,\n afterMs: 11_000,\n step: SETTLED_ORDER,\n },\n },\n ),\n // Fails at the same point the landing would: the card gives way to the\n // payment-failed sheet.\n 'order.processing.fails': fiat(\n { step: PROCESSING_ORDER, paymentCaptured: true },\n {\n settles: {\n endpoint: `/fiat/orders/${ORDER.orderId}`,\n afterMs: 11_000,\n step: FAILED_ORDER,\n },\n },\n ),\n 'order.failed': fiat({ step: FAILED_ORDER }),\n 'order.deliveryFailed': fiat({\n step: {\n state: { kind: 'DELIVERY', state: 'FAILED' },\n orderId: ORDER.orderId,\n provider: PROVIDER,\n transitions: [],\n },\n }),\n 'order.cancelled': fiat({\n step: orderCreated({ status: 'CANCELLED' }),\n }),\n 'order.refunded': fiat({\n step: orderCreated({\n status: 'REFUNDED',\n refund: { ...US_QUOTE.fiat, expectedBy: '2026-09-08T12:00:00Z' },\n }),\n }),\n 'fiat.blocked': fiat({\n step: {\n state: {\n kind: 'BLOCKED',\n reason: 'REGION_UNSUPPORTED',\n retryAfter: null,\n },\n transitions: [],\n },\n }),\n 'fiat.blocked.later': fiat({\n step: {\n state: {\n kind: 'BLOCKED',\n reason: 'REGION_UNSUPPORTED',\n retryAfter: '2026-11-01T00:00:00Z',\n },\n transitions: [],\n },\n }),\n 'fiat.blocked.unservable': fiat({\n step: {\n state: { kind: 'BLOCKED', reason: 'ASSET_UNSUPPORTED', retryAfter: null },\n transitions: [],\n },\n }),\n 'fiat.accountIneligible': fiat({ accountIneligible: true }),\n 'fiat.unsupported': fiat({ step: UNDRAWN }),\n 'fiat.surfaceFailed': fiat({\n step: ORDER_REVIEW,\n surfaceFailure: {\n code: 'provider_error',\n detail: 'The provider could not start this payment.',\n },\n }),\n // The quote's own pay sheet failed: the processing card holds the ways on.\n // Transak, not MoonPay: MoonPay's entry starts its session ahead of the tap,\n // which would carry the page past the failure. Coinbase is left for the\n // reroute probe to find, so the card offers another provider.\n 'fiat.paymentFailed': fiat(\n { amount: AMOUNT, quoteSurfaceFailure: { code: 'provider_error' } },\n {\n providers: [\n {\n provider: 'TRANSAK',\n min: '5',\n max: '2000',\n visibility: 'AUTH_GATED',\n answer: pricedAt('TRANSAK', '2000'),\n },\n {\n provider: 'COINBASE',\n min: '5',\n max: '2000',\n visibility: 'AUTH_GATED',\n answer: pricedAt('COINBASE', '2000'),\n },\n ],\n },\n ),\n // Coinbase first: its sheet is the one closed, and Transak the provider offered instead.\n 'fiat.paymentDismissed': fiat(\n {\n amount: AMOUNT,\n quoteSurfaceFailure: { code: 'coinbase_apple_pay:dismissed' },\n },\n {\n responses: { '/fiat/orders': processingOrderFor },\n providers: [\n {\n provider: 'COINBASE',\n min: '5',\n max: '2000',\n visibility: 'AUTH_GATED',\n // Payable on tap: a prepared session would open a round, and the\n // closed sheet is the quote's own.\n answer: (amount) =>\n payableOnTap(pricedAt('COINBASE', '2000')(amount)),\n },\n {\n provider: 'TRANSAK',\n min: '5',\n max: '2000',\n visibility: 'AUTH_GATED',\n answer: pricedAt('TRANSAK', '2000'),\n },\n ],\n },\n ),\n // The card cannot cover the charge: the amount is halved and Coinbase paid again.\n 'fiat.insufficientFunds': fiat(\n {\n amount: AMOUNT,\n quoteSurfaceFailure: {\n code: 'ERROR_CODE_GUEST_CARD_INSUFFICIENT_BALANCE',\n },\n },\n {\n responses: { '/fiat/orders': processingOrderFor },\n providers: [\n {\n provider: 'COINBASE',\n min: '5',\n max: '2000',\n visibility: 'AUTH_GATED',\n // Payable on tap, as the declined sheet was the quote's own.\n answer: (amount) =>\n payableOnTap(pricedAt('COINBASE', '2000')(amount)),\n },\n ],\n },\n ),\n // The same decline at Coinbase's minimum: nothing halves, so another card is asked for.\n 'fiat.insufficientFundsAtMinimum': fiat(\n {\n amount: AMOUNT,\n quoteSurfaceFailure: {\n code: 'ERROR_CODE_GUEST_CARD_INSUFFICIENT_BALANCE',\n },\n },\n {\n responses: { '/fiat/orders': processingOrderFor },\n providers: [\n {\n provider: 'COINBASE',\n min: AMOUNT,\n max: '2000',\n visibility: 'AUTH_GATED',\n // Payable on tap, as the declined sheet was the quote's own. The\n // decline reads its floor off this quote's limits.\n answer: (amount) =>\n payableOnTap(pricedAt('COINBASE', '2000', AMOUNT)(amount)),\n },\n ],\n },\n ),\n // Stripe declined the card without a reason: Apple Pay opens at Stripe again.\n 'fiat.stripeDeclined': fiat(\n {\n amount: AMOUNT,\n quoteSurfaceFailure: { code: 'perform_checkout:card_declined' },\n },\n {\n responses: { '/fiat/orders': processingOrderFor },\n providers: [\n {\n provider: 'STRIPE',\n min: '5',\n max: '7285.96',\n visibility: 'AUTH_GATED',\n // Payable on tap, as the declined sheet was the quote's own.\n answer: (amount) =>\n payableOnTap(pricedAt('STRIPE', '7285.96')(amount)),\n },\n ],\n },\n ),\n // The card's bank holds the charge for approval: Coinbase is paid again at the same amount.\n 'fiat.softDeclined': fiat(\n {\n amount: AMOUNT,\n quoteSurfaceFailure: { code: 'ERROR_CODE_GUEST_CARD_SOFT_DECLINED' },\n },\n {\n responses: { '/fiat/orders': processingOrderFor },\n providers: [\n {\n provider: 'COINBASE',\n min: '5',\n max: '2000',\n visibility: 'AUTH_GATED',\n // Payable on tap, as the declined sheet was the quote's own.\n answer: (amount) =>\n payableOnTap(pricedAt('COINBASE', '2000')(amount)),\n },\n ],\n },\n ),\n // Signed in where a failover moved the deposit: the payment waits on the verified sheet.\n 'fiat.failoverVerified': fiat({\n step: TRANSAK_CAPTURE,\n failoverVerified: true,\n }),\n 'fiat.prepaidDeclined': fiat(\n {\n amount: AMOUNT,\n quoteSurfaceFailure: { code: 'ERROR_CODE_GUEST_CARD_PREPAID_DECLINED' },\n },\n {\n responses: { '/fiat/orders': processingOrderFor },\n providers: [\n {\n provider: 'COINBASE',\n min: '5',\n max: '2000',\n visibility: 'AUTH_GATED',\n // Payable on tap, so the decline lands on the quote's own sheet,\n // not a round.\n answer: (amount) =>\n payableOnTap(pricedAt('COINBASE', '2000')(amount)),\n },\n {\n provider: 'TRANSAK',\n min: '5',\n max: '2000',\n visibility: 'AUTH_GATED',\n answer: pricedAt('TRANSAK', '2000'),\n },\n ],\n },\n ),\n // A prepaid decline with nobody else to take it: Continue's switch lands back at Coinbase.\n 'fiat.prepaidDeclinedAlone': fiat(\n {\n amount: AMOUNT,\n quoteSurfaceFailure: { code: 'ERROR_CODE_GUEST_CARD_PREPAID_DECLINED' },\n },\n {\n responses: { '/fiat/orders': processingOrderFor },\n providers: [\n {\n provider: 'COINBASE',\n min: '5',\n max: '2000',\n visibility: 'AUTH_GATED',\n // Payable on tap, as the declined sheet was the quote's own.\n answer: (amount) =>\n payableOnTap(pricedAt('COINBASE', '2000')(amount)),\n },\n ],\n },\n ),\n 'fiat.retryable': fiat(\n { step: ORDER_REVIEW, submitOnOpen: 'confirm' },\n { responses: { '/fiat/orders': UNAVAILABLE } },\n ),\n 'fiat.rateLimited': fiat(\n { step: ORDER_REVIEW, submitOnOpen: 'confirm' },\n { responses: { '/fiat/orders': RATE_LIMITED } },\n ),\n 'fiat.rateLimited.retryAfter': fiat(\n { step: ORDER_REVIEW, submitOnOpen: 'confirm' },\n {\n responses: {\n '/fiat/orders': { ...RATE_LIMITED, retryAfterSeconds: 300 },\n },\n },\n ),\n 'deposit.addMoney': {\n seed: { deposit: { screen: 'addMoney' } },\n backend: {},\n },\n 'deposit.wallet.amount': {\n seed: { deposit: { screen: 'depositAmount', wallet: WALLET } },\n backend: {},\n },\n 'deposit.wallet.connecting': {\n seed: {\n deposit: {\n screen: 'depositAmount',\n wallet: { ...WALLET, amount: '', connection: 'connecting' },\n },\n },\n backend: {},\n },\n 'deposit.wallet.connectFailed': {\n seed: {\n deposit: {\n screen: 'depositAmount',\n wallet: { ...WALLET, amount: '', connection: 'failed' },\n },\n },\n backend: {},\n },\n 'deposit.wallet.assets': {\n seed: {\n deposit: {\n screen: 'depositAmount',\n wallet: {\n ...WALLET,\n assetListOpen: true,\n tokens: Array.from({ length: 14 }, (_, index) => ({\n ...WALLET.tokens[0],\n contractAddress: `preview-token-${index}`,\n name: `Token ${index + 1}`,\n symbol: `T${index + 1}`,\n tokenBalance:\n index < 10 ? String((40 - index) * 1_000_000) : '1000',\n totalUsdValue: index < 10 ? 40 - index : 0.001,\n })),\n },\n },\n },\n backend: {},\n },\n 'deposit.wallet.insufficient': {\n seed: {\n deposit: {\n screen: 'depositAmount',\n wallet: {\n ...WALLET,\n amount: '',\n tokens: [\n { ...WALLET.tokens[0], tokenBalance: '1000', totalUsdValue: 0.001 },\n ],\n },\n },\n },\n backend: {},\n },\n 'deposit.wallet.empty': {\n seed: {\n deposit: {\n screen: 'depositAmount',\n wallet: { ...WALLET, amount: '', tokens: [] },\n },\n },\n backend: {},\n },\n 'deposit.wallet.emptyAssets': {\n seed: {\n deposit: {\n screen: 'depositAmount',\n wallet: { ...WALLET, amount: '', tokens: [], assetListOpen: true },\n },\n },\n backend: {},\n },\n 'deposit.wallet.unlink': {\n seed: {\n deposit: {\n screen: 'depositAmount',\n wallet: { ...WALLET, menuOpen: true },\n },\n },\n backend: {},\n },\n 'deposit.wallet.unlinkFailed': {\n seed: {\n deposit: {\n screen: 'depositAmount',\n wallet: { ...WALLET, unlinkFailed: true },\n },\n },\n backend: {},\n },\n 'deposit.wallet.confirm': {\n seed: { deposit: { screen: 'walletConfirm', wallet: WALLET } },\n backend: {},\n },\n 'deposit.wallet.sent': {\n seed: {\n deposit: {\n screen: 'walletConfirm',\n wallet: { ...WALLET, status: 'sent' },\n },\n },\n backend: {},\n },\n 'deposit.wallet.failed': {\n seed: {\n deposit: {\n screen: 'walletConfirm',\n wallet: { ...WALLET, status: 'failed' },\n },\n },\n backend: {},\n },\n 'deposit.wallet.pending': {\n seed: {\n deposit: {\n screen: 'walletConfirm',\n wallet: { ...WALLET, status: 'pending' },\n },\n },\n backend: {},\n },\n 'deposit.transfer': {\n seed: { deposit: { screen: 'transfer', chainId: '8453' } },\n backend: {},\n },\n 'deposit.lockedTransfer': {\n seed: {\n deposit: { screen: 'transfer', chainId: '8453', sourceSymbol: 'USDC' },\n },\n backend: {},\n },\n 'deposit.crypto.token': {\n seed: { deposit: { screen: 'cryptoToken' } },\n backend: {},\n },\n 'deposit.crypto.token.search': {\n seed: { deposit: { screen: 'cryptoToken', tokenQuery: 'w' } },\n backend: {},\n },\n 'deposit.crypto.network': {\n seed: {\n deposit: {\n screen: 'cryptoNetwork',\n chainId: '8453',\n sourceSymbol: 'USDC',\n },\n },\n backend: {},\n },\n 'deposit.crypto.address': {\n seed: {\n deposit: {\n screen: 'cryptoAddress',\n chainId: '8453',\n sourceSymbol: 'USDC',\n },\n },\n backend: {},\n },\n 'deposit.crypto.address.expanded': {\n seed: {\n deposit: {\n screen: 'cryptoAddress',\n chainId: '8453',\n sourceSymbol: 'USDC',\n addressExpanded: true,\n },\n },\n backend: {},\n },\n 'deposit.crypto.learnMore': {\n seed: {\n deposit: {\n screen: 'cryptoLearnMore',\n chainId: '8453',\n sourceSymbol: 'USDC',\n },\n },\n backend: {},\n },\n 'withdraw.method': { seed: { withdrawal: {} }, backend: {} },\n // The list the venue's users see: cash rows offered with no wallet, because\n // `submitFiatWithdrawal` pays Swapped. Live /fops, so the rows depend on region.\n 'withdraw.method.venuePayout': {\n seed: { withdrawal: { stack: ['withdrawMethod'] } },\n backend: {},\n },\n 'withdraw.amount': {\n seed: {\n withdrawal: { stack: ['withdrawMethod', 'withdrawAmount'], amount: '25' },\n },\n backend: {},\n },\n 'withdraw.address': {\n seed: {\n withdrawal: {\n stack: ['withdrawMethod', 'withdrawAmount', 'withdrawAddress'],\n amount: '25',\n recipient: DEMO_RECIPIENT,\n },\n },\n backend: {},\n },\n // Empty, which is where the panel shows.\n 'withdraw.address.pastePanel': {\n seed: {\n withdrawal: {\n stack: ['withdrawMethod', 'withdrawAmount', 'withdrawAddress'],\n amount: '25',\n },\n },\n backend: {},\n },\n // Filled and open for editing: the field shows the address start, not its tail.\n 'withdraw.address.pastePanel.editing': {\n seed: {\n withdrawal: {\n stack: ['withdrawMethod', 'withdrawAmount', 'withdrawAddress'],\n amount: '25',\n recipient: DEMO_RECIPIENT,\n addressFocused: true,\n },\n },\n backend: {},\n },\n 'withdraw.receiveToken': {\n seed: {\n withdrawal: {\n stack: [\n 'withdrawMethod',\n 'withdrawAmount',\n 'withdrawAddress',\n 'withdrawReceiveToken',\n ],\n amount: '25',\n recipient: DEMO_RECIPIENT,\n },\n },\n backend: {},\n },\n 'withdraw.complete': {\n seed: {\n withdrawal: {\n stack: ['withdrawComplete'],\n complete: {\n txHash: TX_HASH,\n amountLabel: '25 USDG',\n usdLabel: '$25.00',\n },\n },\n },\n backend: {},\n },\n 'withdraw.error': {\n seed: { withdrawal: { executionError: true } },\n backend: {},\n },\n}\n\nexport const PREVIEW_SCENARIOS: Readonly<\n Record<PreviewScenarioId, PreviewScenario>\n> = Object.fromEntries(\n Object.entries(DEFINITIONS).map(([id, definition]) => [\n id,\n {\n id,\n ...PREVIEW_SCENARIO_CATALOG[id as PreviewScenarioId],\n ...definition,\n },\n ]),\n) as Record<PreviewScenarioId, PreviewScenario>\n\n/** The step a scenario's fiat session opens on: its seed, else the quote the entry prices. */\nexport function scenarioStartStep(\n scenario: PreviewScenario,\n): FiatStepResponse | undefined {\n return openingStep(scenario.seed.deposit?.fiat) ?? scenario.backend.quote\n}\n\nexport const DEFAULT_PREVIEW_QUOTE = PRICED\n", "// KYC round fixtures shared by the on-device stories and hosted-preview deep links, so a\n// state reachable in one is reachable in the other.\n\nimport type { FormDescriptor, FormField, Quote } from '@funkit/connect-core'\n\nimport {\n EXPECTED_AMOUNT_PER_MONTH,\n GROSS_ANNUAL_INCOME,\n NET_WORTH,\n TRANSACTIONS_PER_MONTH,\n} from '../../fiat/form/formLayout'\n\nconst text = (\n id: FormField['id'],\n label: string,\n required = true,\n): FormField => ({\n id,\n type: 'TEXT',\n labelFallback: label,\n required,\n})\n\n/** Every field the L1 frames draw, and nothing else. */\nexport const US_ROUND: FormDescriptor = {\n formId: 'us-v2:0',\n fields: [\n text('LEGAL_FIRST_NAME', 'First name'),\n text('LEGAL_LAST_NAME', 'Last Name'),\n {\n id: 'DATE_OF_BIRTH',\n type: 'DATE',\n labelFallback: 'Date of Birth',\n required: true,\n },\n text('RESIDENTIAL_ADDRESS_LINE_1', 'Address'),\n text('RESIDENTIAL_ADDRESS_LINE_2', 'Apartment, suite, etc.', false),\n text('RESIDENTIAL_ADDRESS_CITY', 'City'),\n {\n id: 'RESIDENTIAL_ADDRESS_REGION',\n type: 'SELECT',\n labelFallback: 'State',\n required: true,\n options: [\n { id: 'CA', labelFallback: 'California' },\n { id: 'NY', labelFallback: 'New York' },\n { id: 'TX', labelFallback: 'Texas' },\n ],\n },\n text('RESIDENTIAL_ADDRESS_POSTAL_CODE', 'ZIP code'),\n text('TAX_IDENTIFIER', 'SSN'),\n ],\n}\n\nexport const LAST_FOUR_FORM: FormDescriptor = {\n formId: 'last-four',\n fields: [\n {\n id: 'TAX_IDENTIFIER',\n type: 'TEXT',\n labelFallback: 'SSN',\n required: true,\n regex: '^\\\\d{4}$',\n },\n ],\n}\n\nexport const COUNTRY_FORM: FormDescriptor = {\n formId: 'country',\n fields: [\n {\n id: 'RESIDENTIAL_ADDRESS_COUNTRY',\n type: 'COUNTRY',\n labelFallback: 'Country',\n required: true,\n },\n ],\n}\n\n/** An address round as MoonPay words it, whose labels follow the country. */\nexport const ADDRESS_ROUND: FormDescriptor = {\n formId: 'address',\n fields: [\n ...COUNTRY_FORM.fields,\n text('RESIDENTIAL_ADDRESS_LINE_1', 'Address line 1'),\n text('RESIDENTIAL_ADDRESS_CITY', 'City'),\n text('RESIDENTIAL_ADDRESS_REGION', 'State, province, or region'),\n text('RESIDENTIAL_ADDRESS_POSTAL_CODE', 'Postal code'),\n ],\n}\n\n/** The round MoonPay closes with: one COUNTRY-typed field, asked alone. */\nexport const NATIONALITY_FORM: FormDescriptor = {\n formId: 'nationality',\n fields: [\n {\n id: 'NATIONALITY',\n type: 'COUNTRY',\n labelFallback: 'Nationality',\n required: true,\n },\n ],\n}\n\n/** A COUNTRY field no frame drew, so the catch-all page has to name it. */\nexport const DETAILS_COUNTRY_FORM: FormDescriptor = {\n formId: 'details-country',\n fields: [\n {\n id: 'COUNTRY_OF_BIRTH',\n type: 'COUNTRY',\n labelFallback: 'Country of birth',\n required: true,\n },\n ],\n}\n\nexport const OCCUPATION_FORM: FormDescriptor = {\n formId: 'kyc-r2-occupation',\n fields: [\n {\n id: 'OCCUPATION_TITLE',\n type: 'SELECT',\n labelFallback: 'Please select occupation',\n required: true,\n options: [\n 'Consulting, IT, or business services',\n 'Design, marketing or communication',\n 'Travel, accommodation, or transport',\n 'Entertainment, arts or photography',\n 'Health, sports or personal care',\n 'Food, beverages, or tobacco',\n 'Retail, eCommerce, wholesale or manufacturing',\n 'Dealers & Resellers',\n 'Financial services, products, or holding companies',\n ].map((labelFallback, index) => ({\n id: `occupation-${index}`,\n labelFallback,\n })),\n },\n ],\n}\n\nexport const PURPOSE_FORM: FormDescriptor = {\n formId: 'kyc-r2-purpose',\n fields: [\n {\n id: 'PURPOSE_OF_TRANSACTION',\n type: 'SELECT',\n labelFallback: 'Please select',\n required: true,\n options: [\n { id: 'investment', labelFallback: 'Investment' },\n { id: 'payments', labelFallback: 'Payments' },\n ],\n },\n ],\n}\n\nconst AMOUNT_REGEX = '^(?!0+(\\\\.0{1,2})?$)\\\\d{1,12}(\\\\.\\\\d{1,2})?$'\n\nconst pattern = (\n id: FormField['id'],\n label: string,\n regex: string,\n): FormField => ({\n id,\n type: 'TEXT',\n labelFallback: label,\n required: true,\n regex,\n})\n\nconst select = (\n id: FormField['id'],\n label: string,\n options: [string, string][],\n): FormField => ({\n id,\n type: 'SELECT',\n labelFallback: label,\n required: true,\n options: options.map(([optionId, labelFallback]) => ({\n id: optionId,\n labelFallback,\n })),\n})\n\n/**\n * MoonPay's customer due diligence round: the tax fields, the phone, and the\n * declarations and figures its questionnaire asks for, all in one form.\n */\nexport const DUE_DILIGENCE_FORM: FormDescriptor = {\n formId: 'moonpay-cdd',\n fields: [\n {\n id: 'TAX_RESIDENCE_COUNTRY',\n type: 'COUNTRY',\n labelFallback: 'Tax residence',\n required: true,\n },\n pattern('TAX_IDENTIFIER', 'SSN', '^\\\\d{9}$'),\n pattern('PHONE_NUMBER', 'Mobile phone number', '^\\\\+[1-9]\\\\d{1,14}$'),\n select('EMPLOYMENT_STATUS', 'Employment status', [\n ['employedOrSelfEmployed', 'Employed or self-employed'],\n ['retired', 'Retired'],\n ['student', 'Student'],\n ['unemployed', 'Unemployed'],\n ]),\n select('PURPOSE_OF_SERVICE', 'What will you use this for?', [\n ['investing', 'Investing'],\n ['payments', 'Payments'],\n ['purchasingDigitalAssets', 'Buying digital assets'],\n ['purchasingGoodsOrServices', 'Buying goods or services'],\n ['trading', 'Trading'],\n ]),\n select('SOURCE_OF_WEALTH_DECLARATION', 'Source of wealth', [\n ['salary', 'Salary'],\n ['savings', 'Savings'],\n ['investments', 'Investments'],\n ['cryptoTrading', 'Crypto trading'],\n ['other', 'Other'],\n ]),\n pattern(GROSS_ANNUAL_INCOME, 'Gross annual income', AMOUNT_REGEX),\n pattern(\n EXPECTED_AMOUNT_PER_MONTH,\n 'Expected amount per month',\n AMOUNT_REGEX,\n ),\n pattern(\n TRANSACTIONS_PER_MONTH,\n 'Transactions per month',\n '^[1-9]\\\\d{0,3}$',\n ),\n ],\n}\n\n/** MoonPay's enhanced due diligence round: the profession, then the net worth. */\nexport const ENHANCED_DUE_DILIGENCE_FORM: FormDescriptor = {\n formId: 'moonpay-edd',\n fields: [\n select('OCCUPATION_INDUSTRY', 'Profession', [\n ['agriculture', 'Agriculture'],\n ['artsAndEntertainment', 'Arts and entertainment'],\n ['businessOwner', 'Business owner'],\n ['education', 'Education'],\n ['financialServices', 'Financial services'],\n ['healthcare', 'Healthcare'],\n ['industrialTradesAndTransport', 'Industrial trades and transport'],\n ['informationAndTechnology', 'Information and technology'],\n ['legalAndProfessionalServices', 'Legal and professional services'],\n ['publicSector', 'Public sector'],\n ['realEstate', 'Real estate'],\n ['retail', 'Retail'],\n ['seniorManagement', 'Senior management'],\n ]),\n pattern(NET_WORTH, 'Net worth (USD)', AMOUNT_REGEX),\n ],\n}\n\n/** The additional-information round the L2 faceplate introduces. */\nexport const L2_FORM: FormDescriptor = {\n formId: 'kyc-r2-l2',\n fields: [\n {\n id: 'DATE_OF_BIRTH',\n type: 'DATE',\n labelFallback: 'Date of Birth',\n required: true,\n },\n ...OCCUPATION_FORM.fields,\n ...PURPOSE_FORM.fields,\n ],\n}\n\n/** A form the native renderer has no drawing for. */\nexport const UNSUPPORTED_FORM: FormDescriptor = {\n formId: 'unsupported',\n fields: [\n {\n id: 'QUESTIONNAIRE_RESPONSE:us-v2:passport',\n type: 'FILE',\n labelFallback: 'Passport',\n required: true,\n },\n ],\n}\n\n/**\n * The quote the round carries, so the price stays on screen through\n * verification. `$105` is the amount the frames are drawn with.\n */\nexport const US_QUOTE: Quote = {\n quoteRef: 'q_kyc_story',\n fiat: { currency: 'USD', amount: '105.00' },\n crypto: { currency: 'USDC', network: 'solana', amount: '104.50' },\n rate: '0.995238',\n totalFee: '0.50',\n feeBreakdown: [{ id: 'provider_fee', labelFallback: 'Fee', amount: '0.50' }],\n paymentMethod: 'apple_pay',\n expiresAt: '2027-01-01T00:00:00Z',\n}\n\nexport const VALID_VALUES = {\n LEGAL_FIRST_NAME: 'Jane',\n LEGAL_LAST_NAME: 'Doe',\n DATE_OF_BIRTH: '1990-06-15',\n RESIDENTIAL_ADDRESS_LINE_1: '123 Example Street',\n RESIDENTIAL_ADDRESS_CITY: 'New York',\n RESIDENTIAL_ADDRESS_REGION: 'NY',\n RESIDENTIAL_ADDRESS_POSTAL_CODE: '10001',\n TAX_IDENTIFIER: '123456789',\n}\n\n/** The Brooklyn address the KYC R2 address frames are drawn with. */\nexport const FRAME_ADDRESS = {\n RESIDENTIAL_ADDRESS_LINE_1: '482 Bedford Ave',\n RESIDENTIAL_ADDRESS_CITY: 'Brooklyn',\n RESIDENTIAL_ADDRESS_REGION: 'NY',\n RESIDENTIAL_ADDRESS_POSTAL_CODE: '10013',\n}\n", "import {\n type MoonPayCheckoutEvent,\n type MoonPayCheckoutState,\n type MoonPayQuoteInput,\n moonPayCheckoutReducer,\n} from '@funkit/connect-core'\n\n/** MoonPay's own extra check: its intro, or its \"additional verification\" card after one completed check. */\nexport type MoonPayChallengePreview = 'intro' | 'again'\n\nconst SESSION_TOKEN = 'preview_session'\n\n/**\n * The MoonPay checkout at its own extra check, for a preview. The preview's backend answers no\n * `POST /fiat/next` and no MoonPay SDK runs, so the reducer is fed the answers that lead there:\n * a returning buyer's `connect`, the `order` prompt, and a device quote that asks for the check.\n */\nexport function moonPayChallengeState(\n start: MoonPayCheckoutState,\n card: MoonPayChallengePreview,\n): MoonPayCheckoutState {\n const quoteInput = {\n source: { asset: { code: 'USD' }, amount: start.checkout.amount },\n destination: { asset: { code: 'usdc_sol' } },\n wallet: { address: 'preview' },\n paymentMethod: { type: 'apple_pay' },\n feeBehavior: 'inclusive',\n } as unknown as MoonPayQuoteInput\n const challenged: MoonPayCheckoutEvent = {\n type: 'DEVICE_QUOTE',\n input: quoteInput,\n quote: {\n signature: 'preview',\n executable: false,\n challengeUrl: 'https://buy-sandbox.moonpay.com/challenge',\n },\n }\n const events: ((state: MoonPayCheckoutState) => MoonPayCheckoutEvent)[] = [\n (state) => ({\n type: 'STEP',\n call: stepCall(state),\n response: { next: 'connect', sessionToken: SESSION_TOKEN, quoteInput },\n }),\n () => ({\n type: 'CONNECTED',\n sessionToken: SESSION_TOKEN,\n credentials: { customerId: 'preview', accessToken: 'preview' },\n }),\n (state) => ({\n type: 'STEP',\n call: stepCall(state),\n response: { next: 'order', orderId: 'ord_preview', quoteInput },\n }),\n () => challenged,\n ...(card === 'again'\n ? [\n (): MoonPayCheckoutEvent => ({ type: 'QUOTE_CHALLENGE_PASSED' }),\n () => challenged,\n ]\n : []),\n ]\n return events.reduce(\n (state, event) => moonPayCheckoutReducer(state, event(state)),\n start,\n )\n}\n\nfunction stepCall(\n state: MoonPayCheckoutState,\n): Extract<MoonPayCheckoutEvent, { type: 'STEP' }>['call'] {\n const { call } = state\n if (call === undefined || call.action === 'order') {\n throw new Error('preview: no step in flight')\n }\n return call\n}\n", "import { FROG_API_BASE_URL, getApiBaseUrl } from '@funkit/api-base'\nimport type { FiatStepResponse } from '@funkit/connect-core'\n\nimport { logger } from '../logging/logger'\nimport { openingStep } from './flowPreview'\nimport {\n DEFAULT_PREVIEW_QUOTE,\n type PreviewNoRouteReason,\n type PreviewProviderRoute,\n type PreviewRange,\n type PreviewResponse,\n type PreviewScenario,\n} from './scenarios'\n\ntype Fetch = typeof fetch\n\nconst json = (body: unknown, status = 200) =>\n new Response(JSON.stringify(body), {\n status,\n headers: { 'Content-Type': 'application/json' },\n })\n\nfunction requestedAmount(init: RequestInit | undefined): number | undefined {\n if (typeof init?.body !== 'string') {\n return undefined\n }\n try {\n const amount = Number(\n (JSON.parse(init.body) as { fiatAmount?: unknown }).fiatAmount,\n )\n return Number.isFinite(amount) ? amount : undefined\n } catch {\n return undefined\n }\n}\n\n/** The quote a CTA's body names, for a response built per request. */\nfunction requestedQuote(init: RequestInit | undefined): { quoteRef?: string } {\n if (typeof init?.body !== 'string') {\n return {}\n }\n try {\n const { quoteRef } = JSON.parse(init.body) as { quoteRef?: unknown }\n return typeof quoteRef === 'string' ? { quoteRef } : {}\n } catch {\n return {}\n }\n}\n\n/** A routed quote's one provider, or `POST /fiat/quote`'s pinned list; undefined for any. */\nexport function requestedProviders(\n init: RequestInit | undefined,\n): readonly string[] | undefined {\n if (typeof init?.body !== 'string') {\n return undefined\n }\n try {\n const body = JSON.parse(init.body) as {\n provider?: string\n routingOverrides?: { providers?: string[] }\n }\n return body.provider === undefined\n ? body.routingOverrides?.providers\n : [body.provider]\n } catch {\n return undefined\n }\n}\n\nconst toCents = (amount: string) => Math.round(Number(amount) * 100)\nconst fromCents = (cents: number) => (cents / 100).toFixed(2)\n\n/** Split wherever a provider starts or stops; each piece lists who serves it, in their order. */\nfunction providersTable(\n providers: readonly PreviewProviderRoute[],\n search: URLSearchParams,\n) {\n const edges = [\n ...new Set(\n providers.flatMap(({ min, max }) => [toCents(min), toCents(max) + 1]),\n ),\n ].sort((a, b) => a - b)\n const intervals = edges.slice(0, -1).flatMap((start, index) => {\n const end = (edges[index + 1] ?? start) - 1\n const serving = providers.filter(\n ({ min, max }) => toCents(min) <= start && toCents(max) >= end,\n )\n return serving.length === 0\n ? []\n : [\n {\n min: fromCents(start),\n max: fromCents(end),\n providers: serving.map(({ provider, visibility }) => ({\n provider,\n next: 'AUTH',\n visibility,\n })),\n },\n ]\n })\n const methods = (search.get('methods') ?? 'apple_pay').split(',')\n return {\n expiresAt: new Date(Date.now() + 60_000).toISOString(),\n methods: methods.map((method) => ({ method, intervals })),\n }\n}\n\n/** The methods a `POST /fiat/routing/table` body asks for. */\nexport function requestedMethods(\n init: RequestInit | undefined,\n): string | undefined {\n if (typeof init?.body !== 'string') {\n return undefined\n }\n try {\n const { methods } = JSON.parse(init.body) as { methods?: unknown }\n return Array.isArray(methods) ? methods.join(',') : undefined\n } catch {\n return undefined\n }\n}\n\nfunction belowMinimum(minimum: string): Response {\n return json(\n {\n errorCode: 'FiatAmountBelowMinimumError',\n errorMsg: `The minimum for this purchase is ${minimum} USD.`,\n minFiatAmount: minimum,\n fiatCurrencyCode: 'USD',\n },\n 400,\n )\n}\n\n/**\n * fun-backend's `FiatNoRouteError`: a 400 for the buyer's own limit, a 404 otherwise.\n * - `retryable` is what fun-backend #4936 adds; `NO_CANDIDATE_LEGACY` is today's bare body.\n */\nfunction noRoute(scenarioReason: PreviewNoRouteReason): Response {\n const legacy = scenarioReason === 'NO_CANDIDATE_LEGACY'\n const reason = legacy ? 'NO_CANDIDATE' : scenarioReason\n const retryable = legacy ? {} : { retryable: reason === 'PROVIDER_OUTAGE' }\n if (reason === 'USER_LIMIT') {\n return json(\n {\n serviceableRanges: [],\n reason,\n ...retryable,\n code: 'LIMITS_EXCEEDED',\n recovery: 'REQUOTE',\n errorCode: 'FiatNoRouteError',\n errorMsg: 'Your current provider limits do not allow this purchase.',\n },\n 400,\n )\n }\n return json(\n {\n serviceableRanges: [],\n reason,\n ...retryable,\n errorCode: 'FiatNoRouteError',\n errorMsg: 'No provider can price that purchase right now.',\n },\n 404,\n )\n}\n\n/** The amount sits in none of `ranges`, each read to the buyer's cap where it has one. */\nfunction isUnserved(ranges: readonly PreviewRange[], amount: number): boolean {\n return !ranges.some(\n ([min, max, userMax]) =>\n amount >= Number(min) && amount <= Number(userMax ?? max),\n )\n}\n\n/** A no-candidate refusal that names what is served, so a gap between ranges shows. */\nfunction unservedAmount(ranges: readonly PreviewRange[]): Response {\n const money = (amount: string) => ({ amount, currency: 'USD' })\n return json(\n {\n serviceableRanges: ranges.map(([min, max, userMax]) => ({\n min: money(min),\n max: money(max),\n userMax: userMax === null ? null : money(userMax),\n })),\n reason: 'NO_CANDIDATE',\n retryable: false,\n errorCode: 'FiatNoRouteError',\n errorMsg: 'No provider can price that purchase right now.',\n },\n 404,\n )\n}\n\nfunction isStepResponse(\n response: PreviewResponse,\n): response is FiatStepResponse {\n return 'state' in response\n}\n\n/**\n * One interval per requested method, served by the scenario quote's provider.\n * - Without it the routed flow cannot quote at all, so every re-quote lands on \"Try again\".\n */\nexport function routingTable(\n quote: FiatStepResponse,\n minimum: string | undefined,\n ranges: readonly PreviewRange[] | undefined,\n search: URLSearchParams,\n currentLimit: string | undefined,\n) {\n const limits = quote.state.kind === 'QUOTE' ? quote.state.limits : undefined\n const provider = 'provider' in quote ? quote.provider : 'MOONPAY'\n const spans =\n ranges?.map(([min, max, userMax]) => [min, userMax ?? max] as const) ??\n ([[minimum ?? limits?.min ?? 1, limits?.max ?? 1_000_000]] as const)\n const methods = (search.get('methods') ?? 'apple_pay').split(',')\n return {\n expiresAt: new Date(Date.now() + 60_000).toISOString(),\n methods: methods.map((method) => ({\n method,\n intervals: spans.map(([min, max]) => ({\n min: Number(min).toFixed(2),\n max: Number(max).toFixed(2),\n providers: [\n {\n provider,\n next: 'READY',\n visibility: 'COMPLETE',\n ...(currentLimit === undefined ? {} : { currentLimit }),\n },\n ],\n })),\n })),\n }\n}\n\n/**\n * A `fetch` that answers the fiat backend from a scenario and passes every other request through.\n * - The session stays on whatever step it was last sent: polls and unlisted CTAs re-send it.\n * - Install it as `globalThis.fetch` before the flow opens; `@funkit/api-base` reads it per call.\n * - `quoteDelayMs` holds each quote back, so a reviewer sees it load before a\n * seeded failure lands on it.\n */\nexport function createPreviewFetch(\n scenario: PreviewScenario,\n passThrough: Fetch,\n { quoteDelayMs = 0 }: { quoteDelayMs?: number } = {},\n): Fetch {\n let current = openingStep(scenario.seed.deposit?.fiat)\n const quote = scenario.backend.quote ?? DEFAULT_PREVIEW_QUOTE\n const {\n minimum,\n noRoute: noRouteReason,\n ranges,\n providers,\n currentLimit,\n feeSubsidized,\n settles,\n } = scenario.backend\n let settlesFrom: number | undefined\n\n const answer = (\n path: string,\n method: string,\n amount: number | undefined,\n search: URLSearchParams,\n asked: readonly string[] | undefined,\n requested: { quoteRef?: string },\n ): Response => {\n if (path.endsWith('/fiat/routing/table')) {\n const table =\n providers === undefined\n ? routingTable(quote, minimum, ranges, search, currentLimit)\n : providersTable(providers, search)\n return json(\n feeSubsidized === undefined\n ? table\n : { ...table, feeSubsidy: { subsidized: true } },\n )\n }\n const isQuote =\n method === 'POST' &&\n (path.endsWith('/fiat/quote') || path.endsWith('/fiat/routing/quote'))\n if (isQuote && providers !== undefined && amount !== undefined) {\n const route = providers.find(\n ({ provider, min, max }) =>\n (asked === undefined || asked.includes(provider)) &&\n amount >= Number(min) &&\n amount <= Number(max),\n )\n if (route === undefined) {\n return noRoute('NO_CANDIDATE')\n }\n current = route.answer(String(amount))\n return json(current)\n }\n if (isQuote) {\n if (\n minimum !== undefined &&\n amount !== undefined &&\n amount < Number(minimum)\n ) {\n return belowMinimum(minimum)\n }\n if (noRouteReason !== undefined) {\n return noRoute(noRouteReason)\n }\n if (\n ranges !== undefined &&\n amount !== undefined &&\n isUnserved(ranges, amount)\n ) {\n return unservedAmount(ranges)\n }\n current = quote\n return json(quote)\n }\n if (settles !== undefined && path.endsWith(settles.endpoint)) {\n settlesFrom ??= Date.now()\n if (Date.now() - settlesFrom >= settles.afterMs) {\n current = settles.step\n return json(current)\n }\n }\n const entry = Object.entries(scenario.backend.responses ?? {}).find(\n ([endpoint]) => path.endsWith(endpoint),\n )?.[1]\n const listed = typeof entry === 'function' ? entry(requested) : entry\n if (listed !== undefined && !isStepResponse(listed)) {\n const { status, retryAfterSeconds } = listed\n // fun-backend's 429 body; the SDK reads no `retryAfterSeconds` without `errorCode`.\n return json(\n {\n ...(status === 429 ? { errorCode: 'TooManyRequestsError' } : {}),\n errorMsg: 'preview: unavailable',\n ...(retryAfterSeconds === undefined ? {} : { retryAfterSeconds }),\n },\n status,\n )\n }\n current = listed ?? current ?? quote\n return json(current)\n }\n\n // Only Fun's own fiat API: the host's assertion minter lives under a `/fiat/` path too.\n const fiatApi = `${getApiBaseUrl()}/fiat/`\n const currencyLookup = `${FROG_API_BASE_URL}/api/swapped/supportedCountries`\n return async (input, init) => {\n // Read off the input, never wrapped: a wrapped `Request` spends its body before a pass-through.\n const url = input instanceof Request ? input.url : String(input)\n if (\n scenario.backend.currencyLookupFails &&\n url.startsWith(currencyLookup)\n ) {\n return json({ errorMsg: 'preview: unavailable' }, 503)\n }\n if (!url.startsWith(fiatApi)) {\n return passThrough(input, init)\n }\n const method =\n init?.method ?? (input instanceof Request ? input.method : 'GET')\n const { pathname, searchParams } = new URL(url)\n const postedMethods = requestedMethods(init)\n if (postedMethods !== undefined) {\n searchParams.set('methods', postedMethods)\n }\n logger.info('preview:fiat_request', {\n scenario: scenario.id,\n method,\n path: pathname,\n })\n if (quoteDelayMs > 0 && /\\/fiat\\/(routing\\/)?quote$/.test(pathname)) {\n await new Promise((resolve) => setTimeout(resolve, quoteDelayMs))\n }\n return answer(\n pathname,\n method.toUpperCase(),\n requestedAmount(init),\n searchParams,\n requestedProviders(init),\n requestedQuote(init),\n )\n }\n}\n", "import { getApiBaseUrl } from '@funkit/api-base'\nimport type {\n FiatStepResponse,\n SessionTape,\n TapeResponse,\n} from '@funkit/connect-core'\n\nimport { logger } from '../../logging/logger'\nimport {\n requestedMethods,\n requestedProviders,\n routingTable,\n} from '../previewFetch'\nimport { DEFAULT_PREVIEW_QUOTE } from '../scenarios'\n\ntype Fetch = typeof fetch\n\nexport interface ReplayFetchOptions {\n /** Holds an answer for its recorded latency; tests pass one that resolves at once. */\n wait?: (ms: number) => Promise<void>\n /** Answers before this index count as already served: a flow seeded partway through. */\n from?: number\n /** The code sent a request the recorded attempt never answered: it took another path. */\n onOffTape?: (endpoint: string) => void\n /**\n * Answers the fiat API past the recording. The first request the attempt never made means the\n * code left the buyer's path, so every fiat request after it comes here too; without one, those\n * requests are refused.\n */\n offTape?: Fetch\n}\n\n/** How long a recorded expiry already past is given again: the buyer's quote was live. */\nconst REPLAY_EXPIRY_MS = 15 * 60_000\n\n/** The body with every `expiresAt` already past moved ahead, so an old attempt's quote still pays. */\nfunction unexpired(value: unknown): unknown {\n if (Array.isArray(value)) {\n return value.map(unexpired)\n }\n if (typeof value !== 'object' || value === null) {\n return value\n }\n return Object.fromEntries(\n Object.entries(value).map(([key, v]) => [\n key,\n key === 'expiresAt' &&\n typeof v === 'string' &&\n Date.parse(v) <= Date.now()\n ? new Date(Date.now() + REPLAY_EXPIRY_MS).toISOString()\n : unexpired(v),\n ]),\n )\n}\n\nconst QUOTE = /\\/fiat\\/(routing\\/)?quote$/\n\n/** Statuses a `Response` refuses a body for. */\nconst NO_BODY = new Set([101, 103, 204, 205, 304])\n\nconst json = (body: unknown, status = 200) =>\n new Response(NO_BODY.has(status) ? null : JSON.stringify(body), {\n status,\n headers: { 'Content-Type': 'application/json' },\n })\n\nconst sleep = (ms: number) =>\n new Promise<void>((resolve) => setTimeout(resolve, ms))\n\nconst providerOf = (body: unknown): unknown =>\n typeof body === 'object' && body !== null\n ? (body as { provider?: unknown }).provider\n : undefined\n\nfunction isQuoteStep(body: unknown): body is FiatStepResponse {\n return (\n typeof body === 'object' &&\n body !== null &&\n (body as { state?: { kind?: unknown } }).state?.kind === 'QUOTE'\n )\n}\n\n/**\n * A `fetch` that answers Fun's fiat API from a recorded attempt and passes every other request\n * through, so new code meets the backend exactly as that attempt did.\n * - Each request gets the next recorded answer to its endpoint, at recorded latency; a quote that\n * names its provider only gets that provider's, and a read past its answers repeats the last.\n * - What the logs lost comes back: a routing table drawn from the tape's quote, and expiries the\n * recording has outlived moved ahead.\n */\nexport function createReplayFetch(\n tape: SessionTape,\n passThrough: Fetch,\n { wait = sleep, from = 0, onOffTape, offTape }: ReplayFetchOptions = {},\n): Fetch {\n // a poll resumed past `from` still repeats its last answer\n const served = new Set(tape.responses.slice(0, from).map((_, i) => i))\n const quote =\n tape.responses.map((r) => r.body).find(isQuoteStep) ?? DEFAULT_PREVIEW_QUOTE\n\n // A refusal names no provider: the tape says which one it was for, or it answered the one the\n // attempt quoted just before\n const quotedFor = tape.responses.map((response, index) => {\n if (response.provider !== undefined) {\n return response.provider\n }\n for (let i = index; i >= 0; i -= 1) {\n const earlier = tape.responses[i]\n const provider = providerOf(earlier?.body)\n if (QUOTE.test(earlier?.endpoint ?? '') && provider !== undefined) {\n return provider\n }\n }\n return providerOf(response.body)\n })\n\n // every provider the attempt quoted, in order: a drawn table offers each, refusals included\n const recordedProviders = [\n ...new Set(\n tape.responses.flatMap((response, index) => {\n const provider = quotedFor[index]\n return QUOTE.test(response.endpoint) && typeof provider === 'string'\n ? [provider]\n : []\n }),\n ),\n ]\n\n const drawTable = (\n params: URLSearchParams,\n init: RequestInit | undefined,\n ) => {\n const methods = requestedMethods(init)\n if (methods !== undefined) {\n params.set('methods', methods)\n }\n const table = routingTable(quote, undefined, undefined, params, undefined)\n return recordedProviders.length === 0\n ? table\n : {\n ...table,\n methods: table.methods.map((method) => ({\n ...method,\n intervals: method.intervals.map((interval) => ({\n ...interval,\n providers: recordedProviders.map((provider) => ({\n provider,\n next: 'READY',\n visibility: 'COMPLETE',\n })),\n })),\n })),\n }\n }\n\n /** The latest answer served: the code is at least this far through the attempt. */\n let cursor = from - 1\n\n // the providers a quote request allows, as the backend reads them: one, a failover's list, or any\n const answers = (\n index: number,\n endpoint: string,\n asked?: readonly string[],\n ) =>\n tape.responses[index]?.endpoint === endpoint &&\n (asked === undefined || asked.includes(String(quotedFor[index])))\n\n const lastServed = (endpoint: string, asked?: readonly string[]) =>\n Math.max(-1, ...[...served].filter((i) => answers(i, endpoint, asked)))\n\n // The buyer may have sent things the code skips (a second quote), so their answers are passed\n // over and never handed back: a read with nothing left ahead repeats its last answer, and a\n // write leaves the tape, since a skipped older answer would make a diverged run look matched.\n const next = (\n endpoint: string,\n asked: readonly string[] | undefined,\n isRead: boolean,\n ) => {\n const unserved = (_: TapeResponse, index: number) =>\n answers(index, endpoint, asked) && !served.has(index)\n const ahead = tape.responses.findIndex(\n (response, index) => index > cursor && unserved(response, index),\n )\n if (ahead !== -1 || !isRead) {\n return ahead\n }\n const repeat = lastServed(endpoint, asked)\n return repeat === -1 ? tape.responses.findIndex(unserved) : repeat\n }\n\n /** Set once the code sends what the attempt never did: the recording no longer applies. */\n let leftTape = false\n\n const apiBaseUrl = getApiBaseUrl()\n const fiatApi = `${apiBaseUrl}/fiat/`\n return async (input, init) => {\n const url = input instanceof Request ? input.url : String(input)\n if (!url.startsWith(fiatApi)) {\n return passThrough(input, init)\n }\n if (leftTape && offTape !== undefined) {\n return offTape(input, init)\n }\n const method = (\n init?.method ?? (input instanceof Request ? input.method : 'GET')\n ).toUpperCase()\n const { pathname, searchParams } = new URL(url)\n const endpoint = `${method} ${url.slice(apiBaseUrl.length).split('?')[0]}`\n // a `Request` carries its own body: read a copy, so the request still sends as it was\n const sent: RequestInit | undefined =\n init?.body === undefined && input instanceof Request\n ? { ...init, body: await input.clone().text() }\n : init\n\n const isQuote = QUOTE.test(pathname)\n const asked = isQuote ? requestedProviders(sent) : undefined\n // asking for a quote again changes nothing, unlike a second order\n const index = next(endpoint, asked, method === 'GET' || isQuote)\n const isTable = pathname.endsWith('/fiat/routing/table')\n const recorded = tape.responses[index]\n if (recorded === undefined && isTable) {\n // attempts from before the routed flow never fetched one\n return json(drawTable(searchParams, sent))\n }\n if (recorded === undefined) {\n logger.warn('preview:replay_off_tape', { endpoint })\n onOffTape?.(endpoint)\n if (offTape !== undefined) {\n leftTape = true\n return offTape(input, init)\n }\n return json({ errorMsg: `replay: ${endpoint} was never recorded` }, 503)\n }\n served.add(index)\n cursor = Math.max(cursor, index)\n await wait(recorded.durationMs)\n\n if (isTable && !recorded.body && recorded.status < 300) {\n return json(drawTable(searchParams, sent), recorded.status)\n }\n return json(unexpired(recorded.body ?? {}), recorded.status)\n }\n}\n"],
5
5
  "mappings": ";;;;;;;;;;;;;;;AAoCA,IAAM,SAAS;AAAA,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