@funkit/connect-rn 9.1.2 → 9.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.
- package/CHANGELOG.md +142 -0
- package/README.md +23 -0
- package/dist/{chunk-ESQLFNOK.js → chunk-BSYYQSWJ.js} +3 -1
- package/dist/chunk-BSYYQSWJ.js.map +7 -0
- package/dist/{chunk-OJN7XVWC.js → chunk-GPJAVLS6.js} +3 -3
- package/dist/chunk-GPJAVLS6.js.map +7 -0
- package/dist/{chunk-ZE77GVDW.js → chunk-KOJEF2II.js} +97 -29
- package/dist/chunk-KOJEF2II.js.map +7 -0
- package/dist/{chunk-2C2OETEM.js → chunk-ZIE5S6XC.js} +275 -163
- package/dist/chunk-ZIE5S6XC.js.map +7 -0
- package/dist/clients/lighter.js +2 -2
- package/dist/clients/lighter.js.map +1 -1
- package/dist/clients/nado.js +3 -3
- package/dist/clients/solana.js +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +29053 -25237
- package/dist/index.js.map +4 -4
- package/dist/preview.js +199 -35
- package/dist/preview.js.map +2 -2
- package/dist/src/components/AssetList.d.ts +27 -0
- package/dist/src/components/AssetList.d.ts.map +1 -0
- package/dist/src/components/DepositQrCard.d.ts +20 -0
- package/dist/src/components/DepositQrCard.d.ts.map +1 -0
- package/dist/src/components/Grabber.d.ts +3 -1
- package/dist/src/components/Grabber.d.ts.map +1 -1
- package/dist/src/components/InfoTooltip.d.ts.map +1 -1
- package/dist/src/components/SearchInput.d.ts +4 -1
- package/dist/src/components/SearchInput.d.ts.map +1 -1
- package/dist/src/components/SearchableAssetListSheet.d.ts +16 -0
- package/dist/src/components/SearchableAssetListSheet.d.ts.map +1 -0
- package/dist/src/components/TokenChainSelector.d.ts +15 -0
- package/dist/src/components/TokenChainSelector.d.ts.map +1 -0
- package/dist/src/components/v2/FeeLine.d.ts +35 -0
- package/dist/src/components/v2/FeeLine.d.ts.map +1 -0
- package/dist/src/fiat/FiatContactScreen.d.ts.map +1 -1
- package/dist/src/fiat/FiatFormFieldRow.d.ts +1 -1
- package/dist/src/fiat/FiatFormFieldRow.d.ts.map +1 -1
- package/dist/src/fiat/FiatFormScreen.d.ts.map +1 -1
- package/dist/src/fiat/FiatKycOptionRow.d.ts +4 -1
- package/dist/src/fiat/FiatKycOptionRow.d.ts.map +1 -1
- package/dist/src/fiat/FiatKycOutcomeScreen.d.ts +1 -4
- package/dist/src/fiat/FiatKycOutcomeScreen.d.ts.map +1 -1
- package/dist/src/fiat/FiatKycPhoneField.d.ts.map +1 -1
- package/dist/src/fiat/FiatOtpScreen.d.ts.map +1 -1
- package/dist/src/fiat/FiatSsnField.d.ts.map +1 -1
- package/dist/src/fiat/FiatStatusScreen.d.ts +1 -0
- package/dist/src/fiat/FiatStatusScreen.d.ts.map +1 -1
- package/dist/src/fiat/FiatStepFailedScreen.d.ts.map +1 -1
- package/dist/src/fiat/FiatUnsupportedStep.d.ts.map +1 -1
- package/dist/src/fiat/SurfaceSlot.d.ts.map +1 -1
- package/dist/src/fiat/actionSlot.d.ts +51 -0
- package/dist/src/fiat/actionSlot.d.ts.map +1 -0
- package/dist/src/fiat/applePayAttempt.d.ts +25 -0
- package/dist/src/fiat/applePayAttempt.d.ts.map +1 -0
- package/dist/src/fiat/closeFailure.d.ts +4 -1
- package/dist/src/fiat/closeFailure.d.ts.map +1 -1
- package/dist/src/fiat/contactRound.d.ts +33 -0
- package/dist/src/fiat/contactRound.d.ts.map +1 -0
- package/dist/src/fiat/depositOutcome.d.ts +2 -3
- package/dist/src/fiat/depositOutcome.d.ts.map +1 -1
- package/dist/src/fiat/depositProcessing.d.ts +20 -0
- package/dist/src/fiat/depositProcessing.d.ts.map +1 -0
- package/dist/src/fiat/depositSettlement.d.ts +18 -0
- package/dist/src/fiat/depositSettlement.d.ts.map +1 -0
- package/dist/src/fiat/fieldLimits.d.ts +13 -0
- package/dist/src/fiat/fieldLimits.d.ts.map +1 -0
- package/dist/src/fiat/kyc/fieldLabel.d.ts.map +1 -0
- package/dist/src/fiat/{formScreenProps.d.ts → kyc/formScreenProps.d.ts} +1 -1
- package/dist/src/fiat/kyc/formScreenProps.d.ts.map +1 -0
- package/dist/src/fiat/{formValidationError.d.ts → kyc/formValidationError.d.ts} +1 -1
- package/dist/src/fiat/kyc/formValidationError.d.ts.map +1 -0
- package/dist/src/fiat/kyc/isAdditionalKycForm.d.ts.map +1 -0
- package/dist/src/fiat/kyc/kycCapture.d.ts +13 -0
- package/dist/src/fiat/kyc/kycCapture.d.ts.map +1 -0
- package/dist/src/fiat/kyc/kycCopy.d.ts +21 -0
- package/dist/src/fiat/kyc/kycCopy.d.ts.map +1 -0
- package/dist/src/fiat/kyc/kycFailover.d.ts +10 -0
- package/dist/src/fiat/kyc/kycFailover.d.ts.map +1 -0
- package/dist/src/fiat/kyc/kycFieldValidators.d.ts.map +1 -0
- package/dist/src/fiat/kyc/kycForm.d.ts +39 -0
- package/dist/src/fiat/kyc/kycForm.d.ts.map +1 -0
- package/dist/src/fiat/{kycFormAttempt.d.ts → kyc/kycFormAttempt.d.ts} +1 -1
- package/dist/src/fiat/kyc/kycFormAttempt.d.ts.map +1 -0
- package/dist/src/fiat/kyc/kycFormState.d.ts.map +1 -0
- package/dist/src/fiat/{kycOptionRows.d.ts → kyc/kycOptionRows.d.ts} +9 -2
- package/dist/src/fiat/kyc/kycOptionRows.d.ts.map +1 -0
- package/dist/src/fiat/kyc/kycRoutes.d.ts +34 -0
- package/dist/src/fiat/kyc/kycRoutes.d.ts.map +1 -0
- package/dist/src/fiat/kyc/kycVerdict.d.ts +34 -0
- package/dist/src/fiat/kyc/kycVerdict.d.ts.map +1 -0
- package/dist/src/fiat/kyc/kycWait.d.ts.map +1 -0
- package/dist/src/fiat/{sectionDetail.d.ts → kyc/sectionDetail.d.ts} +1 -1
- package/dist/src/fiat/kyc/sectionDetail.d.ts.map +1 -0
- package/dist/src/fiat/kyc/useKycCaptureRound.d.ts.map +1 -0
- package/dist/src/fiat/kyc/useKycCompletion.d.ts +33 -0
- package/dist/src/fiat/kyc/useKycCompletion.d.ts.map +1 -0
- package/dist/src/fiat/kyc/useKycFormFailure.d.ts +16 -0
- package/dist/src/fiat/kyc/useKycFormFailure.d.ts.map +1 -0
- package/dist/src/fiat/{useKycRoundReporting.d.ts → kyc/useKycRoundReporting.d.ts} +1 -1
- package/dist/src/fiat/kyc/useKycRoundReporting.d.ts.map +1 -0
- package/dist/src/fiat/kyc/useKycScreens.d.ts +48 -0
- package/dist/src/fiat/kyc/useKycScreens.d.ts.map +1 -0
- package/dist/src/fiat/kyc/useKycThreshold.d.ts +15 -0
- package/dist/src/fiat/kyc/useKycThreshold.d.ts.map +1 -0
- package/dist/src/fiat/paymentReroute.d.ts +28 -1
- package/dist/src/fiat/paymentReroute.d.ts.map +1 -1
- package/dist/src/fiat/paymentSurfaceFailure.d.ts +5 -4
- package/dist/src/fiat/paymentSurfaceFailure.d.ts.map +1 -1
- package/dist/src/fiat/processing/CompletionCheck.d.ts +12 -0
- package/dist/src/fiat/processing/CompletionCheck.d.ts.map +1 -0
- package/dist/src/fiat/processing/CompletionWave.d.ts +17 -0
- package/dist/src/fiat/processing/CompletionWave.d.ts.map +1 -0
- package/dist/src/fiat/processing/DepositCardSheet.d.ts +25 -0
- package/dist/src/fiat/processing/DepositCardSheet.d.ts.map +1 -0
- package/dist/src/fiat/processing/DepositProcessingCard.d.ts +22 -0
- package/dist/src/fiat/processing/DepositProcessingCard.d.ts.map +1 -0
- package/dist/src/fiat/processing/ProcessingAurora.d.ts +13 -0
- package/dist/src/fiat/processing/ProcessingAurora.d.ts.map +1 -0
- package/dist/src/fiat/processing/ProcessingFailure.d.ts +26 -0
- package/dist/src/fiat/processing/ProcessingFailure.d.ts.map +1 -0
- package/dist/src/fiat/processing/ProcessingOptionIcons.d.ts +21 -0
- package/dist/src/fiat/processing/ProcessingOptionIcons.d.ts.map +1 -0
- package/dist/src/fiat/processing/ProcessingProgress.d.ts +7 -0
- package/dist/src/fiat/processing/ProcessingProgress.d.ts.map +1 -0
- package/dist/src/fiat/processing/RevealText.d.ts +16 -0
- package/dist/src/fiat/processing/RevealText.d.ts.map +1 -0
- package/dist/src/fiat/processing/cardSurface.d.ts +65 -0
- package/dist/src/fiat/processing/cardSurface.d.ts.map +1 -0
- package/dist/src/fiat/processing/cornerRadius.d.ts +13 -0
- package/dist/src/fiat/processing/cornerRadius.d.ts.map +1 -0
- package/dist/src/fiat/processing/gradientPuff.d.ts +18 -0
- package/dist/src/fiat/processing/gradientPuff.d.ts.map +1 -0
- package/dist/src/fiat/processing/pressureWave.d.ts +23 -0
- package/dist/src/fiat/processing/pressureWave.d.ts.map +1 -0
- package/dist/src/fiat/processing/skiaPeer.d.ts +15 -0
- package/dist/src/fiat/processing/skiaPeer.d.ts.map +1 -0
- package/dist/src/fiat/providerFailover.d.ts +34 -0
- package/dist/src/fiat/providerFailover.d.ts.map +1 -0
- package/dist/src/fiat/providers/adapter.d.ts +8 -3
- package/dist/src/fiat/providers/adapter.d.ts.map +1 -1
- package/dist/src/fiat/providers/applePayPaintGate.d.ts.map +1 -1
- package/dist/src/fiat/providers/coinbase/CoinbaseCheckoutSurface.d.ts +3 -1
- package/dist/src/fiat/providers/coinbase/CoinbaseCheckoutSurface.d.ts.map +1 -1
- package/dist/src/fiat/providers/coinbase/CoinbaseWarmup.d.ts.map +1 -1
- package/dist/src/fiat/providers/coinbase/coinbaseOnrampEvents.d.ts +9 -0
- package/dist/src/fiat/providers/coinbase/coinbaseOnrampEvents.d.ts.map +1 -1
- package/dist/src/fiat/providers/coinbase/coinbasePreparedPayment.d.ts +7 -1
- package/dist/src/fiat/providers/coinbase/coinbasePreparedPayment.d.ts.map +1 -1
- package/dist/src/fiat/providers/moonpay/moonpay.d.ts.map +1 -1
- package/dist/src/fiat/providers/moonpay/moonpayCardRefusal.d.ts.map +1 -1
- package/dist/src/fiat/providers/stripe/StripeSessionAuthScreen.d.ts.map +1 -1
- package/dist/src/fiat/providers/stripe/stripeApplePayReady.d.ts +5 -1
- package/dist/src/fiat/providers/stripe/stripeApplePayReady.d.ts.map +1 -1
- package/dist/src/fiat/providers/stripe/stripeKyc.d.ts +9 -1
- package/dist/src/fiat/providers/stripe/stripeKyc.d.ts.map +1 -1
- package/dist/src/fiat/providers/stripe/stripeLinkWarmup.d.ts +12 -0
- package/dist/src/fiat/providers/stripe/stripeLinkWarmup.d.ts.map +1 -1
- package/dist/src/fiat/providers/stripe/stripePayment.d.ts.map +1 -1
- package/dist/src/fiat/providers/stripe/stripePreparedPayment.d.ts +22 -0
- package/dist/src/fiat/providers/stripe/stripePreparedPayment.d.ts.map +1 -0
- package/dist/src/fiat/providers/stripe/stripeRoundPush.d.ts +15 -0
- package/dist/src/fiat/providers/stripe/stripeRoundPush.d.ts.map +1 -1
- package/dist/src/fiat/providers/stripe/useCreateStripeAccountWithExistingUserData.d.ts.map +1 -1
- package/dist/src/fiat/providers/stripe/useStripeKycFailover.d.ts +5 -0
- package/dist/src/fiat/providers/stripe/useStripeKycFailover.d.ts.map +1 -0
- package/dist/src/fiat/providers/stripe/useStripeKycPush.d.ts +20 -0
- package/dist/src/fiat/providers/stripe/useStripeKycPush.d.ts.map +1 -0
- package/dist/src/fiat/providers/stripe/useStripeSessionAuth.d.ts +18 -1
- package/dist/src/fiat/providers/stripe/useStripeSessionAuth.d.ts.map +1 -1
- package/dist/src/fiat/providers/stripe/useStripeSheets.d.ts +9 -0
- package/dist/src/fiat/providers/stripe/useStripeSheets.d.ts.map +1 -0
- package/dist/src/fiat/providers/stripe/useStripeState.d.ts +7 -0
- package/dist/src/fiat/providers/stripe/useStripeState.d.ts.map +1 -0
- package/dist/src/fiat/providers/transak/TransakApplePaySurface.d.ts.map +1 -1
- package/dist/src/fiat/quoteRouting.d.ts +54 -0
- package/dist/src/fiat/quoteRouting.d.ts.map +1 -0
- package/dist/src/fiat/sessionAuth.d.ts +8 -0
- package/dist/src/fiat/sessionAuth.d.ts.map +1 -0
- package/dist/src/fiat/shownFieldIssues.d.ts +1 -1
- package/dist/src/fiat/shownFieldIssues.d.ts.map +1 -1
- package/dist/src/fiat/stepSurface.d.ts +35 -0
- package/dist/src/fiat/stepSurface.d.ts.map +1 -0
- package/dist/src/fiat/{renderCaptureSurface.d.ts → surfaceRegistry.d.ts} +5 -5
- package/dist/src/fiat/surfaceRegistry.d.ts.map +1 -0
- package/dist/src/fiat/useAuthHandoff.d.ts +17 -0
- package/dist/src/fiat/useAuthHandoff.d.ts.map +1 -0
- package/dist/src/fiat/useCaptureHold.d.ts +22 -0
- package/dist/src/fiat/useCaptureHold.d.ts.map +1 -0
- package/dist/src/fiat/useContactAutoSubmit.d.ts.map +1 -1
- package/dist/src/fiat/useDatePickerDock.d.ts.map +1 -1
- package/dist/src/fiat/useDepositSettlement.d.ts +33 -0
- package/dist/src/fiat/useDepositSettlement.d.ts.map +1 -0
- package/dist/src/fiat/useEntryQuote.d.ts +25 -0
- package/dist/src/fiat/useEntryQuote.d.ts.map +1 -0
- package/dist/src/fiat/useEntrySubmit.d.ts +24 -0
- package/dist/src/fiat/useEntrySubmit.d.ts.map +1 -0
- package/dist/src/fiat/useFailureAnnouncements.d.ts +17 -0
- package/dist/src/fiat/useFailureAnnouncements.d.ts.map +1 -0
- package/dist/src/fiat/useIdentityAssertion.d.ts +2 -6
- package/dist/src/fiat/useIdentityAssertion.d.ts.map +1 -1
- package/dist/src/fiat/usePaymentFailureAnswer.d.ts +37 -22
- package/dist/src/fiat/usePaymentFailureAnswer.d.ts.map +1 -1
- package/dist/src/fiat/useProcessingPhase.d.ts +4 -0
- package/dist/src/fiat/useProcessingPhase.d.ts.map +1 -0
- package/dist/src/fiat/useReplayableFailure.d.ts.map +1 -1
- package/dist/src/fiat/useRerouteProbe.d.ts +24 -0
- package/dist/src/fiat/useRerouteProbe.d.ts.map +1 -0
- package/dist/src/fiat/useStaleQuoteRecovery.d.ts +16 -0
- package/dist/src/fiat/useStaleQuoteRecovery.d.ts.map +1 -1
- package/dist/src/fiat/useStandingRefusals.d.ts +1 -1
- package/dist/src/fiat/useStandingRefusals.d.ts.map +1 -1
- package/dist/src/fiat/useSurfaceAttempt.d.ts +24 -0
- package/dist/src/fiat/useSurfaceAttempt.d.ts.map +1 -0
- package/dist/src/flow/DepositAmountStep.d.ts.map +1 -1
- package/dist/src/flow/DepositFlowContent.d.ts +1 -4
- package/dist/src/flow/DepositFlowContent.d.ts.map +1 -1
- package/dist/src/flow/Drawer.d.ts +24 -2
- package/dist/src/flow/Drawer.d.ts.map +1 -1
- package/dist/src/flow/FiatDepositAmountStep.d.ts +1 -11
- package/dist/src/flow/FiatDepositAmountStep.d.ts.map +1 -1
- package/dist/src/flow/FlowSheet.d.ts.map +1 -1
- package/dist/src/flow/FunkitFlowProvider.d.ts.map +1 -1
- package/dist/src/flow/WithdrawalFlowContent.d.ts.map +1 -1
- package/dist/src/flow/entryBanners.d.ts +29 -0
- package/dist/src/flow/entryBanners.d.ts.map +1 -0
- package/dist/src/flow/fiatStepScreens.d.ts +30 -0
- package/dist/src/flow/fiatStepScreens.d.ts.map +1 -0
- package/dist/src/flow/fiatSubmitRenderer.d.ts +100 -0
- package/dist/src/flow/fiatSubmitRenderer.d.ts.map +1 -0
- package/dist/src/flow/flowStepHeight.d.ts +4 -8
- package/dist/src/flow/flowStepHeight.d.ts.map +1 -1
- package/dist/src/flow/renderFiatFlowScreen.d.ts +97 -0
- package/dist/src/flow/renderFiatFlowScreen.d.ts.map +1 -0
- package/dist/src/flow/screenBundles.d.ts +49 -0
- package/dist/src/flow/screenBundles.d.ts.map +1 -0
- package/dist/src/flow/sheetPressHold.d.ts.map +1 -1
- package/dist/src/flow/useDepositSelection.d.ts +38 -0
- package/dist/src/flow/useDepositSelection.d.ts.map +1 -0
- package/dist/src/flow/useFeeDetails.d.ts +19 -0
- package/dist/src/flow/useFeeDetails.d.ts.map +1 -0
- package/dist/src/hooks/useCheckoutsListenerByUserId.d.ts.map +1 -0
- package/dist/src/hooks/useEnclosingSheetOpen.d.ts +8 -0
- package/dist/src/hooks/useEnclosingSheetOpen.d.ts.map +1 -0
- package/dist/src/hooks/useNestedSheet.d.ts +12 -0
- package/dist/src/hooks/useNestedSheet.d.ts.map +1 -1
- package/dist/src/hooks/useRecentDeposits.d.ts.map +1 -0
- package/dist/src/hooks/useSettledOpacity.d.ts +10 -0
- package/dist/src/hooks/useSettledOpacity.d.ts.map +1 -0
- package/dist/src/icons/FunIcon.d.ts +2 -2
- package/dist/src/icons/FunIcon.d.ts.map +1 -1
- package/dist/src/icons/iconSvg.d.ts +10 -0
- package/dist/src/icons/iconSvg.d.ts.map +1 -0
- package/dist/src/logging/datadogHttpLogTransport.d.ts +20 -2
- package/dist/src/logging/datadogHttpLogTransport.d.ts.map +1 -1
- package/dist/src/logging/logger.d.ts +5 -5
- package/dist/src/logging/logger.d.ts.map +1 -1
- package/dist/src/native/glassEffect.d.ts +4 -0
- package/dist/src/native/glassEffect.d.ts.map +1 -1
- package/dist/src/preview/fiatPreviewPress.d.ts +6 -0
- package/dist/src/preview/fiatPreviewPress.d.ts.map +1 -0
- package/dist/src/preview/flowPreview.d.ts +8 -2
- package/dist/src/preview/flowPreview.d.ts.map +1 -1
- package/dist/src/preview/previewFetch.d.ts.map +1 -1
- package/dist/src/preview/scenarioCatalog.d.ts +43 -6
- package/dist/src/preview/scenarioCatalog.d.ts.map +1 -1
- package/dist/src/preview/scenarios.d.ts +8 -0
- package/dist/src/preview/scenarios.d.ts.map +1 -1
- package/dist/src/providers/BrandingContext.d.ts.map +1 -0
- package/dist/src/providers/FunkitProvider.d.ts +2 -2
- package/dist/src/providers/FunkitProvider.d.ts.map +1 -1
- package/dist/src/providers/FunkitStatsigProvider.d.ts.map +1 -1
- package/dist/src/{haptics → providers}/HapticsContext.d.ts +3 -1
- package/dist/src/providers/HapticsContext.d.ts.map +1 -0
- package/dist/src/providers/IdentityContext.d.ts.map +1 -0
- package/dist/src/{haptics → providers}/hapticTap.d.ts +3 -2
- package/dist/src/providers/hapticTap.d.ts.map +1 -0
- package/dist/src/providers/useFrozenIdentity.d.ts +1 -1
- package/dist/src/providers/useFrozenIdentity.d.ts.map +1 -1
- package/dist/src/screens/DepositAmountScreen.d.ts +20 -22
- package/dist/src/screens/DepositAmountScreen.d.ts.map +1 -1
- package/dist/src/screens/LockedTransferCryptoScreen.d.ts +11 -6
- package/dist/src/screens/LockedTransferCryptoScreen.d.ts.map +1 -1
- package/dist/src/screens/SelectAvailableChainScreen.d.ts +12 -0
- package/dist/src/screens/SelectAvailableChainScreen.d.ts.map +1 -0
- package/dist/src/screens/SelectChainScreen.d.ts.map +1 -1
- package/dist/src/screens/SelectReceiveTokenScreen.d.ts.map +1 -1
- package/dist/src/screens/TokenAndChainPickerScreen.d.ts.map +1 -1
- package/dist/src/screens/WithdrawAmountScreen.d.ts +3 -1
- package/dist/src/screens/WithdrawAmountScreen.d.ts.map +1 -1
- package/dist/src/screens/WithdrawCryptoSteps.d.ts.map +1 -1
- package/dist/src/screens/depositMetrics.d.ts +7 -0
- package/dist/src/screens/depositMetrics.d.ts.map +1 -1
- package/dist/src/theme/buildFunkitTheme.d.ts +2 -0
- package/dist/src/theme/buildFunkitTheme.d.ts.map +1 -1
- package/dist/src/theme/restyle.d.ts +66 -0
- package/dist/src/theme/restyle.d.ts.map +1 -1
- package/dist/src/theme/toRestyleTheme.d.ts +6 -0
- package/dist/src/theme/toRestyleTheme.d.ts.map +1 -1
- package/dist/src/theme/typeScale.d.ts +12 -0
- package/dist/src/theme/typeScale.d.ts.map +1 -1
- package/dist/src/theme/useFunkitTheme.d.ts.map +1 -1
- package/dist/src/transfer/DepositQrCode.d.ts +31 -0
- package/dist/src/transfer/DepositQrCode.d.ts.map +1 -0
- package/dist/src/transfer/DepositQrGlyph.d.ts +15 -0
- package/dist/src/transfer/DepositQrGlyph.d.ts.map +1 -0
- package/dist/src/transfer/depositQrCodeUri.d.ts +8 -0
- package/dist/src/transfer/depositQrCodeUri.d.ts.map +1 -0
- package/dist/src/transfer/depositSelection.d.ts +13 -0
- package/dist/src/transfer/depositSelection.d.ts.map +1 -0
- package/dist/src/transfer/hooks/useLockedTokenAmount.d.ts.map +1 -1
- package/dist/src/transfer/hooks/useTokenTransfer.d.ts.map +1 -1
- package/dist/src/transfer/monoChainLogo.d.ts +20 -0
- package/dist/src/transfer/monoChainLogo.d.ts.map +1 -0
- package/dist/src/transfer/qrModules.d.ts +20 -0
- package/dist/src/transfer/qrModules.d.ts.map +1 -0
- package/dist/src/utils/assetSearch.d.ts +5 -0
- package/dist/src/utils/assetSearch.d.ts.map +1 -0
- package/dist/src/utils/tokenAndChainPicker.d.ts +2 -0
- package/dist/src/utils/tokenAndChainPicker.d.ts.map +1 -1
- package/dist/src/utils/tokenOnChainJoiner.d.ts +12 -0
- package/dist/src/utils/tokenOnChainJoiner.d.ts.map +1 -0
- package/dist/src/withdrawal/useDepositAddressWithdrawalStatus.d.ts.map +1 -1
- package/dist/src/withdrawal/useWithdrawalSourceTokenBalance.d.ts.map +1 -1
- package/package.json +11 -4
- package/dist/chunk-2C2OETEM.js.map +0 -7
- package/dist/chunk-ESQLFNOK.js.map +0 -7
- package/dist/chunk-OJN7XVWC.js.map +0 -7
- package/dist/chunk-ZE77GVDW.js.map +0 -7
- package/dist/src/branding/BrandingContext.d.ts.map +0 -1
- package/dist/src/fiat/FiatPaymentFailedSheet.d.ts +0 -26
- package/dist/src/fiat/FiatPaymentFailedSheet.d.ts.map +0 -1
- package/dist/src/fiat/fieldLabel.d.ts.map +0 -1
- package/dist/src/fiat/formScreenProps.d.ts.map +0 -1
- package/dist/src/fiat/formValidationError.d.ts.map +0 -1
- package/dist/src/fiat/isAdditionalKycForm.d.ts.map +0 -1
- package/dist/src/fiat/kycFailover.d.ts +0 -6
- package/dist/src/fiat/kycFailover.d.ts.map +0 -1
- package/dist/src/fiat/kycFieldValidators.d.ts.map +0 -1
- package/dist/src/fiat/kycFormAttempt.d.ts.map +0 -1
- package/dist/src/fiat/kycFormState.d.ts.map +0 -1
- package/dist/src/fiat/kycOptionRows.d.ts.map +0 -1
- package/dist/src/fiat/kycWait.d.ts.map +0 -1
- package/dist/src/fiat/renderCaptureSurface.d.ts.map +0 -1
- package/dist/src/fiat/sectionDetail.d.ts.map +0 -1
- package/dist/src/fiat/useKycCaptureRound.d.ts.map +0 -1
- package/dist/src/fiat/useKycCompletion.d.ts +0 -21
- package/dist/src/fiat/useKycCompletion.d.ts.map +0 -1
- package/dist/src/fiat/useKycRoundReporting.d.ts.map +0 -1
- package/dist/src/flow/DepositReceivedToast.d.ts +0 -17
- package/dist/src/flow/DepositReceivedToast.d.ts.map +0 -1
- package/dist/src/flow/useDepositReceivedToast.d.ts +0 -31
- package/dist/src/flow/useDepositReceivedToast.d.ts.map +0 -1
- package/dist/src/haptics/HapticsContext.d.ts.map +0 -1
- package/dist/src/haptics/hapticTap.d.ts.map +0 -1
- package/dist/src/history/useCheckoutsListenerByUserId.d.ts.map +0 -1
- package/dist/src/history/useRecentDeposits.d.ts.map +0 -1
- package/dist/src/identity/IdentityContext.d.ts.map +0 -1
- /package/dist/src/fiat/{fieldLabel.d.ts → kyc/fieldLabel.d.ts} +0 -0
- /package/dist/src/fiat/{isAdditionalKycForm.d.ts → kyc/isAdditionalKycForm.d.ts} +0 -0
- /package/dist/src/fiat/{kycFieldValidators.d.ts → kyc/kycFieldValidators.d.ts} +0 -0
- /package/dist/src/fiat/{kycFormState.d.ts → kyc/kycFormState.d.ts} +0 -0
- /package/dist/src/fiat/{kycWait.d.ts → kyc/kycWait.d.ts} +0 -0
- /package/dist/src/fiat/{useKycCaptureRound.d.ts → kyc/useKycCaptureRound.d.ts} +0 -0
- /package/dist/src/{history → hooks}/useCheckoutsListenerByUserId.d.ts +0 -0
- /package/dist/src/{history → hooks}/useRecentDeposits.d.ts +0 -0
- /package/dist/src/{branding → providers}/BrandingContext.d.ts +0 -0
- /package/dist/src/{identity → providers}/IdentityContext.d.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,147 @@
|
|
|
1
1
|
# @funkit/connect-rn
|
|
2
2
|
|
|
3
|
+
## 9.3.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 7bc5bb0: Apple Pay deposits now wait on an animated processing card, which also offers the ways on when a payment fails, in place of the deposit toasts and payment-failed screen; a custom `hapticFeedback` may receive `'success'`, and the optional `@shopify/react-native-skia` peer draws the card's effects.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- b566e67: No consumer-facing changes.
|
|
12
|
+
- 5553773: No consumer-facing changes.
|
|
13
|
+
- c8b92f2: No consumer-facing changes.
|
|
14
|
+
- a4e0ef7: No consumer-facing changes.
|
|
15
|
+
- ed9fa79: No consumer-facing changes.
|
|
16
|
+
- 1d4f539: No consumer-facing changes.
|
|
17
|
+
- 7259782: No consumer-facing changes.
|
|
18
|
+
- 8d44192: No consumer-facing changes.
|
|
19
|
+
- 8776f81: No consumer-facing changes.
|
|
20
|
+
- 92e0e5b: No consumer-facing changes.
|
|
21
|
+
- 39d13e0: No consumer-facing changes.
|
|
22
|
+
- 103add4: No consumer-facing changes.
|
|
23
|
+
- b7ba436: No consumer-facing changes.
|
|
24
|
+
- 4087713: No consumer-facing changes.
|
|
25
|
+
- a25d57a: No consumer-facing changes.
|
|
26
|
+
- e706f76: Hide the disabled Continue button on the withdrawal amount screen while the amount is below the minimum.
|
|
27
|
+
- 7465f81: No consumer-facing changes.
|
|
28
|
+
- 0ba0440: No consumer-facing changes.
|
|
29
|
+
- e31358f: No consumer-facing changes.
|
|
30
|
+
- c0bfa4c: No consumer-facing changes.
|
|
31
|
+
- 0771dce: No consumer-facing changes.
|
|
32
|
+
- 55157e2: No consumer-facing changes.
|
|
33
|
+
- d9c0832: No consumer-facing changes.
|
|
34
|
+
- 8dc150b: No consumer-facing changes.
|
|
35
|
+
- f0adf5f: No consumer-facing changes.
|
|
36
|
+
- 52f9fdf: No consumer-facing changes.
|
|
37
|
+
- e43bd32: A declined MoonPay Apple Pay payment now offers another payment method instead of keeping the buyer on MoonPay.
|
|
38
|
+
- 4811617: Retrying a failed MoonPay payment now fetches a new quote instead of reopening the failure sheet.
|
|
39
|
+
- 674a6a6: No consumer-facing changes.
|
|
40
|
+
- db6f0f4: Suggest a debit card on the failed Apple Pay screen, since prepaid cards are often declined.
|
|
41
|
+
- 0211812: Offer "Deposit a higher amount" after a failed Apple Pay payment when the only provider left needs a higher minimum, and show the next provider's minimum after a refused identity check when no provider left serves the entered amount.
|
|
42
|
+
- cd38732: No consumer-facing changes.
|
|
43
|
+
- 954ebff: No consumer-facing changes.
|
|
44
|
+
- 1140645: No consumer-facing changes.
|
|
45
|
+
- 84246c9: No consumer-facing changes.
|
|
46
|
+
- 43191ae: No consumer-facing changes.
|
|
47
|
+
- 753414a: No consumer-facing changes.
|
|
48
|
+
- 6bcd238: No consumer-facing changes.
|
|
49
|
+
- 6a3bb31: Stop replaying a Stripe Link sign-in credential the SDK already refused. The tap no longer redeems it a second time, and a payment that fails on the spent credential reprices instead of reopening the same sheet.
|
|
50
|
+
- 290652a: No consumer-facing changes.
|
|
51
|
+
- 33a2245: No consumer-facing changes.
|
|
52
|
+
- f329ac6: No consumer-facing changes.
|
|
53
|
+
- 5c09d7e: No consumer-facing changes.
|
|
54
|
+
- 637190d: No consumer-facing changes.
|
|
55
|
+
- 75683b0: Fail over to the next fiat provider when the Stripe SDK refuses Link registration before reaching Stripe (e.g. Apple private relay emails), instead of re-showing an account-creation form that can never pass.
|
|
56
|
+
- 8fafe60: No consumer-facing changes.
|
|
57
|
+
- 8d59c52: No consumer-facing changes.
|
|
58
|
+
- 413e188: No consumer-facing changes.
|
|
59
|
+
- 419d247: No consumer-facing changes.
|
|
60
|
+
- 6c01b69: No consumer-facing changes.
|
|
61
|
+
- 3869e4c: No consumer-facing changes.
|
|
62
|
+
- 6eccdf5: No consumer-facing changes.
|
|
63
|
+
- 51c8eaa: No consumer-facing changes.
|
|
64
|
+
- dcdd9f8: No consumer-facing changes.
|
|
65
|
+
- 925604e: No consumer-facing changes.
|
|
66
|
+
- 006231f: No consumer-facing changes.
|
|
67
|
+
- b1ad1b8: No consumer-facing changes.
|
|
68
|
+
- 4d3863d: No consumer-facing changes.
|
|
69
|
+
- bfddc00: No consumer-facing changes.
|
|
70
|
+
- 19c02cf: No consumer-facing changes.
|
|
71
|
+
- e452c7c: No consumer-facing changes.
|
|
72
|
+
- bfc76f6: No consumer-facing changes.
|
|
73
|
+
- c6f367f: No consumer-facing changes.
|
|
74
|
+
- e8e21e5: No consumer-facing changes.
|
|
75
|
+
- 7477344: No consumer-facing changes.
|
|
76
|
+
- fa4db7b: No consumer-facing changes.
|
|
77
|
+
- e0f7d86: No consumer-facing changes.
|
|
78
|
+
- 2cce1d1: No consumer-facing changes.
|
|
79
|
+
- 0775497: No consumer-facing changes.
|
|
80
|
+
- e30f005: No consumer-facing changes.
|
|
81
|
+
- 154dce0: No consumer-facing changes.
|
|
82
|
+
- 6405bf3: No consumer-facing changes.
|
|
83
|
+
- b7f4140: No consumer-facing changes.
|
|
84
|
+
- adf03ef: No consumer-facing changes.
|
|
85
|
+
- 388a5ec: No consumer-facing changes.
|
|
86
|
+
- 58b6277: No consumer-facing changes.
|
|
87
|
+
- 0a4b3af: No consumer-facing changes.
|
|
88
|
+
- 3028fba: No consumer-facing changes.
|
|
89
|
+
- 0cfe596: No consumer-facing changes.
|
|
90
|
+
- 63dfb4d: No consumer-facing changes.
|
|
91
|
+
- 9feda14: No consumer-facing changes.
|
|
92
|
+
- 27f77fd: No consumer-facing changes.
|
|
93
|
+
- 28d002a: No consumer-facing changes.
|
|
94
|
+
- b5a0963: No consumer-facing changes.
|
|
95
|
+
- 4112e02: No consumer-facing changes.
|
|
96
|
+
- 774e178: Log the paid fiat amount when a fiat deposit settles.
|
|
97
|
+
- 12118d9: No consumer-facing changes.
|
|
98
|
+
- e0d4476: No consumer-facing changes.
|
|
99
|
+
- 0cf0704: Fix retrying a failed fiat payment reopening the same spent session, which failed again on every retry.
|
|
100
|
+
- d17c717: Fix the fiat amount page fading in on first open, and a MoonPay pay sheet reporting a lost session on every redraw.
|
|
101
|
+
- 9b6fef9: Fix the withdrawal recipient address shifting to the right when the field loses focus on web.
|
|
102
|
+
- Updated dependencies [7bc5bb0]
|
|
103
|
+
- Updated dependencies [309d703]
|
|
104
|
+
- Updated dependencies [84548dd]
|
|
105
|
+
- Updated dependencies [0211812]
|
|
106
|
+
- Updated dependencies [6eccdf5]
|
|
107
|
+
- Updated dependencies [51c8eaa]
|
|
108
|
+
- @funkit/connect-core@9.3.0
|
|
109
|
+
|
|
110
|
+
## 9.2.0
|
|
111
|
+
|
|
112
|
+
### Minor Changes
|
|
113
|
+
|
|
114
|
+
- 860bfcd: The locked deposit screen's token and chain dropdowns open searchable lists that switch the deposit in place; chains without the chosen token stay listed but disabled.
|
|
115
|
+
- 3ddca38: Redesign the locked-amount crypto deposit screen with token and chain dropdowns, a QR code, and Copy / Share buttons.
|
|
116
|
+
- 032b1a3: A KYC review expected to take a while, or one still open once the wait for its verdict ends, now shows the "still being processed" card, whose option is to deposit the most the buyer can deposit without further verification. Shorter reviews keep the "Authorizing your limits" screen, after a form or a document capture.
|
|
117
|
+
|
|
118
|
+
### Patch Changes
|
|
119
|
+
|
|
120
|
+
- 2765fe4: Add a searchable "Available chains" sheet, not yet shown in any flow.
|
|
121
|
+
- 2932f5b: A Coinbase payment that fails after the charge shows the payment-failed screen as soon as Coinbase reports it, instead of after the refund lands
|
|
122
|
+
- a28eefb: Add a deposit card with the send amount, QR code, address and Copy / Share actions, not yet shown in any flow.
|
|
123
|
+
- dcc98fa: Full-height flow steps now fill the sheet instead of shrinking to their content.
|
|
124
|
+
- c8bce82: After a provider handoff, the amount screen's button is the new provider's own instead of a fixed "Verification Required", and the handoff toast says the buyer was switched to a different payment provider
|
|
125
|
+
- c8bce82: A provider that refuses a fiat input step (sign-in, identity form, or document capture) moves the buyer to the next provider instead of asking again
|
|
126
|
+
- cb64dae: The locked deposit screen shows the chain logo in the QR code's center in black and white.
|
|
127
|
+
- 2786bcf: The locked deposit screen draws its QR code with rounded, merged modules straight on the card, with the chain logo on a center tile and room around it to scan.
|
|
128
|
+
- ad97183: Add the token and chain selection rules for the deposit screen's dropdowns, not yet used in any flow.
|
|
129
|
+
- b476dec: Reopening a picker or drawer while it is still closing no longer leaves a dimmed screen with no sheet.
|
|
130
|
+
- 0d09860: A provider that failed the buyer (identity or payment) stays out of every fiat quote for the rest of the sheet, including the payment reroute probe and after an amount change
|
|
131
|
+
- 72887ce: No visible change to the deposit chain picker.
|
|
132
|
+
- be7a7ad: The withdrawal "Available tokens" sheet now says "No results" when a search matches no token.
|
|
133
|
+
- cdb4501: Stripe's Apple Pay sheet opens from the quote, without waiting on a payment session.
|
|
134
|
+
- 04637fd: Add a token-and-chain selector row, not yet shown in any flow.
|
|
135
|
+
- ac34337: Hold Datadog logs until the logging route is known, and optionally send them through an ad-blocker-resilient proxy
|
|
136
|
+
- a96b0a4: Fix excess bottom spacing on Android withdrawal screens.
|
|
137
|
+
- 5c9ab3f: Fiat buttons keep their label and show a spinner while working, instead of switching to "Submitting".
|
|
138
|
+
- Updated dependencies [cdb4501]
|
|
139
|
+
- Updated dependencies [96f7890]
|
|
140
|
+
- Updated dependencies [032b1a3]
|
|
141
|
+
- Updated dependencies [8189df3]
|
|
142
|
+
- @funkit/connect-core@9.2.0
|
|
143
|
+
- @funkit/api-base@9.0.1
|
|
144
|
+
|
|
3
145
|
## 9.1.2
|
|
4
146
|
|
|
5
147
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -238,6 +238,23 @@ four Info.plist keys above. Bundle the Inter `.ttf` files natively (`UIAppFonts`
|
|
|
238
238
|
on iOS, `android/app/src/main/assets/fonts` on Android), named
|
|
239
239
|
`Inter-Regular`, `Inter-Medium` and `Inter-SemiBold` as the theme uses them.
|
|
240
240
|
|
|
241
|
+
## Deposit processing effects (optional)
|
|
242
|
+
|
|
243
|
+
After an Apple Pay payment, the deposit waits on a processing card. With
|
|
244
|
+
`@shopify/react-native-skia` installed, the card draws drifting light behind
|
|
245
|
+
its copy and a pressure wave when the deposit lands. Without it, the card
|
|
246
|
+
works the same and draws flat.
|
|
247
|
+
|
|
248
|
+
`@shopify/react-native-skia` is an **optional peer**, and Expo Go bundles it.
|
|
249
|
+
|
|
250
|
+
```sh
|
|
251
|
+
npx expo install @shopify/react-native-skia
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
In a bare React Native app, `pnpm add @shopify/react-native-skia`, install iOS
|
|
255
|
+
pods, and rebuild the native app. With pnpm, allow its install script, which
|
|
256
|
+
fetches Skia's prebuilt binaries: add it to `pnpm.onlyBuiltDependencies`.
|
|
257
|
+
|
|
241
258
|
## Peer dependencies
|
|
242
259
|
|
|
243
260
|
These are declared as **peer dependencies** (not bundled), so the host app links a
|
|
@@ -308,6 +325,12 @@ Two deliberate choices keep it that way:
|
|
|
308
325
|
step checks for its native module first and `import()`s
|
|
309
326
|
`@sumsub/react-native-mobilesdk-module` only when it is linked
|
|
310
327
|
(`src/fiat/providers/sumsub/sumsubSdk.ts`); otherwise Sumsub runs in the WebView.
|
|
328
|
+
- **Skia is an optional peer, loaded on demand.** `@shopify/react-native-skia`
|
|
329
|
+
draws the deposit processing card's effects. Expo Go bundles it, but a host
|
|
330
|
+
need not install it: `src/fiat/processing/skiaPeer.ts` `import()`s it
|
|
331
|
+
inside a try/catch when the card first shows, or as a deposit flow opens where
|
|
332
|
+
Liquid Glass needs the card's corners measured. The card draws flat without
|
|
333
|
+
it.
|
|
311
334
|
- **The glass module is optional at runtime.** `FunkitGlassEffect` (this
|
|
312
335
|
package's `ios/`) is not in Expo Go. `src/native/glassEffect.ts` looks it up
|
|
313
336
|
with `requireOptionalNativeModule`, so an unlinked binary renders the
|
|
@@ -38,6 +38,7 @@ var SEED = {
|
|
|
38
38
|
fiatSurfaceFailure: (p) => p.deposit?.fiat?.surfaceFailure,
|
|
39
39
|
fiatAccountIneligible: (p) => p.deposit?.fiat?.accountIneligible,
|
|
40
40
|
fiatDepositMatch: (p) => p.deposit?.fiat?.depositMatch,
|
|
41
|
+
fiatPaymentCaptured: (p) => p.deposit?.fiat?.paymentCaptured,
|
|
41
42
|
kycCompletion: (p) => p.deposit?.fiat?.kycCompletion,
|
|
42
43
|
identityPage: (p) => p.deposit?.fiat?.identity?.page,
|
|
43
44
|
identitySection: (p) => {
|
|
@@ -47,6 +48,7 @@ var SEED = {
|
|
|
47
48
|
documentStarted: (p) => p.deposit?.fiat?.documentStarted,
|
|
48
49
|
fiatCaptureReissued: (p) => p.deposit?.fiat?.captureReissued,
|
|
49
50
|
depositChainId: (p) => p.deposit?.chainId,
|
|
51
|
+
depositSourceSymbol: (p) => p.deposit?.sourceSymbol,
|
|
50
52
|
withdrawalMethodId: (p) => p.withdrawal?.methodId,
|
|
51
53
|
withdrawalAmount: (p) => p.withdrawal?.amount,
|
|
52
54
|
withdrawalRecipient: (p) => p.withdrawal?.recipient,
|
|
@@ -372,4 +374,4 @@ export {
|
|
|
372
374
|
PERSONA_PRIVACY_POLICY_URL,
|
|
373
375
|
kycProviderDisplayName
|
|
374
376
|
};
|
|
375
|
-
//# sourceMappingURL=chunk-
|
|
377
|
+
//# sourceMappingURL=chunk-BSYYQSWJ.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/preview/flowPreview.tsx", "../src/fiat/legalLinks.ts", "../src/fiat/formLayout.ts", "../src/fiat/keyboardReturnKey.ts", "../src/fiat/postalCodeCountries.ts"],
|
|
4
|
+
"sourcesContent": ["import type { FiatStepResponse } from '@funkit/connect-core'\nimport {\n type Dispatch,\n type ReactNode,\n type SetStateAction,\n createContext,\n useContext,\n useEffect,\n useMemo,\n useState,\n} from 'react'\n\nimport type { KycCompletion } from '../fiat/kyc/useKycCompletion'\nimport type { KycSection } from '../fiat/formLayout'\nimport type { FlowScreen } from '../flow/FunkitFlowProvider'\nimport type { DepositMatchTerms } from '../flow/depositFlowConfig'\n\n/**\n * Where the fiat session opens. Each field seeds one piece of state a user would otherwise reach\n * by tapping through, so any screen of the rail is one seed away.\n */\nexport interface FiatPreviewSeed {\n /** The step response the session opens on, as if the backend had just sent it. */\n step?: FiatStepResponse\n /** The amount entry's value. */\n amount?: string\n /** Presses the entry CTA once it is ready: opens the contact round, or the KYC options card. */\n pressEntry?: boolean\n /** An identity round's consent intro, or its form open at a section. */\n identity?: { page: 'consent' } | { page: 'form'; section?: KycSection }\n /** Past the document-capture intro, onto the provider's own surface. */\n documentStarted?: boolean\n /** The provider asked for its capture again after the buyer finished one. */\n captureReissued?: boolean\n /** The acknowledgement a finished identity form shows before its verdict. */\n kycCompletion?: KycCompletion\n /** A provider surface that failed, as the adapter reports it. */\n surfaceFailure?: { code: string; detail?: string }\n /** Submits the seeded step's CTA with this id on open \u2014 how a failed send is reached. */\n submitOnOpen?: string\n /** The host's identity minter refused this account. */\n accountIneligible?: boolean\n /** Turns the deposit-match preview on, as the host's internal flag does. */\n depositMatch?: DepositMatchTerms\n /** The pay sheet already took the payment, so the seeded order is one the buyer just paid for. */\n paymentCaptured?: boolean\n}\n\nexport interface DepositPreviewSeed {\n /** The screen the flow opens on; defaults to the root `beginDeposit` picks. Transfer opens above it. */\n screen?: Extract<FlowScreen, 'depositAmount' | 'addMoney' | 'transfer'>\n fiat?: FiatPreviewSeed\n /** The deposit chain, by id, as if picked from the Crypto row \u2014 Transfer needs one. */\n chainId?: string\n /** A locked deposit's source token, by symbol, as if picked with `chainId` \u2014 its Transfer needs both. */\n sourceSymbol?: string\n}\n\ntype WithdrawalStackScreen = Extract<\n FlowScreen,\n | 'withdrawMethod'\n | 'withdrawAmount'\n | 'withdrawAddress'\n | 'withdrawReceiveToken'\n>\n\n/** The submitted withdrawal the completion screen reports on. */\nexport interface WithdrawalPreviewCompletion {\n txHash: `0x${string}`\n amountLabel: string\n usdLabel?: string\n tokenLabel?: string\n}\n\ninterface WithdrawalPreviewFields {\n /** The payout method picked on the list, by `WithdrawalMethodOption.id`. */\n methodId?: string\n amount?: string\n recipient?: string\n /** The paste-panel address field, open for editing (its tail gives way to the address start). */\n addressFocused?: boolean\n /** The retryable error that replaces every screen after a failed execution. */\n executionError?: boolean\n}\n\n/**\n * The withdrawal flow's opening state. The type rules out the stacks that render nothing: an\n * empty one, and a completion screen with no withdrawal to report.\n */\nexport type WithdrawalPreviewSeed = WithdrawalPreviewFields &\n (\n | {\n /** The screens on the stack, root first; defaults to the payout-method list. */\n stack?: [WithdrawalStackScreen, ...WithdrawalStackScreen[]]\n complete?: undefined\n }\n | { stack: ['withdrawComplete']; complete: WithdrawalPreviewCompletion }\n )\n\n/**\n * A state to open the SDK's flow at, for hosted previews and QA builds.\n * - Consumed by the next matching `begin*` only; closing and reopening starts clean.\n * - Never set in production: every read falls back to the flow's own start.\n */\nexport interface FlowPreviewSeed {\n deposit?: DepositPreviewSeed\n withdrawal?: WithdrawalPreviewSeed\n}\n\nconst HostPreviewContext = createContext<FlowPreviewSeed | undefined>(undefined)\n\n/**\n * Opens the next `beginDeposit` / `beginWithdrawal` below it at `seed`.\n * - Mount it above `<FunkitProvider>`.\n * - Memoize `seed`: a new object is a new preview, so one built inline reopens every flow seeded.\n */\nexport function FunkitFlowPreview({\n seed,\n children,\n}: {\n seed: FlowPreviewSeed | undefined\n children: ReactNode\n}) {\n return (\n <HostPreviewContext.Provider value={seed}>\n {children}\n </HostPreviewContext.Provider>\n )\n}\n\n/** The seed a host mounted; read by the flow provider when a flow opens. */\nexport function useHostFlowPreview(): FlowPreviewSeed | undefined {\n return useContext(HostPreviewContext)\n}\n\n/** The seeds of the flow session a host preview opened; empty everywhere else. */\nexport interface ActivePreview {\n deposit?: DepositPreviewSeed\n withdrawal?: WithdrawalPreviewSeed\n}\n\nconst NO_PREVIEW: ActivePreview = {}\nconst ActivePreviewContext = createContext<ActivePreview>(NO_PREVIEW)\n\n/** Scopes a consumed seed to the one flow session it opened. */\nexport function ActiveFlowPreview({\n deposit,\n withdrawal,\n children,\n}: {\n deposit?: DepositPreviewSeed\n withdrawal?: WithdrawalPreviewSeed\n children: ReactNode\n}) {\n // The value names the session: readers are tracked against it.\n const preview = useMemo(\n () =>\n deposit === undefined && withdrawal === undefined\n ? NO_PREVIEW\n : { deposit, withdrawal },\n [deposit, withdrawal],\n )\n return (\n <ActivePreviewContext.Provider value={preview}>\n {children}\n </ActivePreviewContext.Provider>\n )\n}\n\n/** Reads one seed value out of the session's preview. */\nexport type PreviewPick<T> = (preview: ActivePreview) => T | undefined\n\n/**\n * Every seed value a flow reads, one reader each. Readers are tracked by identity, so each is\n * declared once here rather than inline where it is read.\n */\nexport const SEED = {\n fiatAmount: (p) => p.deposit?.fiat?.amount,\n fiatStep: (p) => p.deposit?.fiat?.step,\n fiatPressEntry: (p) => p.deposit?.fiat?.pressEntry,\n fiatSubmitOnOpen: (p) => p.deposit?.fiat?.submitOnOpen,\n fiatSurfaceFailure: (p) => p.deposit?.fiat?.surfaceFailure,\n fiatAccountIneligible: (p) => p.deposit?.fiat?.accountIneligible,\n fiatDepositMatch: (p) => p.deposit?.fiat?.depositMatch,\n fiatPaymentCaptured: (p) => p.deposit?.fiat?.paymentCaptured,\n kycCompletion: (p) => p.deposit?.fiat?.kycCompletion,\n identityPage: (p) => p.deposit?.fiat?.identity?.page,\n identitySection: (p) => {\n const identity = p.deposit?.fiat?.identity\n return identity?.page === 'form' ? identity.section : undefined\n },\n documentStarted: (p) => p.deposit?.fiat?.documentStarted,\n fiatCaptureReissued: (p) => p.deposit?.fiat?.captureReissued,\n depositChainId: (p) => p.deposit?.chainId,\n depositSourceSymbol: (p) => p.deposit?.sourceSymbol,\n withdrawalMethodId: (p) => p.withdrawal?.methodId,\n withdrawalAmount: (p) => p.withdrawal?.amount,\n withdrawalRecipient: (p) => p.withdrawal?.recipient,\n withdrawalAddressFocused: (p) => p.withdrawal?.addressFocused,\n withdrawalComplete: (p) => p.withdrawal?.complete,\n withdrawalExecutionError: (p) => p.withdrawal?.executionError,\n} satisfies Record<string, PreviewPick<unknown>>\n\nconst readers = new WeakMap<ActivePreview, Set<PreviewPick<unknown>>>()\n\n/**\n * The seed value for the first mount that reads it; `undefined` for every mount after.\n * - A later mount of the same reader is the user moving on (a new round, a return to the entry),\n * so a seed never re-applies after the state it describes.\n * - Marked read on commit, so Strict Mode's double render still sees it.\n */\nexport function useSeed<T>(pick: PreviewPick<T>): T | undefined {\n const preview = useContext(ActivePreviewContext)\n const [seed] = useState(() =>\n readers.get(preview)?.has(pick) === true ? undefined : pick(preview),\n )\n useEffect(() => {\n if (preview === NO_PREVIEW) {\n return\n }\n const read = readers.get(preview) ?? new Set()\n read.add(pick)\n readers.set(preview, read)\n }, [preview, pick])\n return seed\n}\n\n/**\n * `useState` whose initial value a host preview may seed; production always starts at `initial`.\n * `fromSeed` shapes a seed value into the state when the two differ.\n */\nexport function useSeededState<T>(\n pick: PreviewPick<T>,\n initial: T,\n): [T, Dispatch<SetStateAction<T>>]\nexport function useSeededState<S, T>(\n pick: PreviewPick<S>,\n initial: T,\n fromSeed: (seed: S) => T,\n): [T, Dispatch<SetStateAction<T>>]\nexport function useSeededState<S, T>(\n pick: PreviewPick<S>,\n initial: T,\n fromSeed?: (seed: S) => T,\n): [T, Dispatch<SetStateAction<T>>] {\n const seed = useSeed(pick)\n return useState<T>(() => {\n if (seed === undefined) {\n return initial\n }\n return fromSeed === undefined ? (seed as unknown as T) : fromSeed(seed)\n })\n}\n", "import type { FiatProvider, KYCProvider } from '@funkit/connect-core'\n\n/**\n * The documents the identity step points at.\n *\n * Held together because two screens link them, and a provider change is one\n * edit rather than a hunt through the copy.\n */\n\n/** Fun's own policy, linked from the consent the buyer has to give. */\nexport const PRIVACY_POLICY_URL = 'https://fun.xyz/privacy'\n\n/**\n * Bumped whenever the consent copy changes, and logged and recorded with every\n * consent, so a record can be matched to the words the buyer actually read.\n * The backend must publish the same revision (`FUN_KYC_CONSENT_TERMS`).\n */\nexport const CONSENT_COPY_VERSION = 'fun-kyc-consent-2026-09-11'\n\n/** Persona's policy, linked from MoonPay's sharing disclosure (`MOONPAY_SHARING_CONSENT_VERSION`). */\nexport const PERSONA_PRIVACY_POLICY_URL =\n 'https://withpersona.com/legal/privacy-policy'\n\n/**\n * The terms of the provider that settles the order, keyed by the provider the\n * round names.\n *\n * Only verified URLs belong here. A provider absent from the map is named in\n * the copy without a link and logged (`kyc_provider_terms_url_missing`) \u2014 it\n * is never guessed, and never falls back to another provider's terms.\n */\nconst PROVIDER_TERMS_URLS: Partial<Record<FiatProvider, string>> = {\n BANXA: 'https://banxa.com/terms-of-use/',\n}\n\n/** How each provider writes its own name; the enum is upper-case. */\nconst PROVIDER_NAMES: Partial<Record<FiatProvider, string>> = {\n BANXA: 'Banxa',\n TRANSAK: 'Transak',\n}\n\n/** The identity vendors, which settle no orders and so are kept apart. */\nconst KYC_PROVIDER_NAMES: Partial<Record<KYCProvider, string>> = {\n SUMSUB: 'Sumsub',\n}\n\n/** Title-cases an upper-case enum member for a provider with no name on record. */\nconst titleCase = (value: string) =>\n value.charAt(0) + value.slice(1).toLowerCase()\n\n/** The provider's terms, or `undefined` when none is on record for it. */\nexport function providerTermsUrl(\n provider: FiatProvider | undefined,\n): string | undefined {\n return provider === undefined ? undefined : PROVIDER_TERMS_URLS[provider]\n}\n\n/**\n * The provider's name as the copy should print it. `fallback` is what a\n * screen drawn with no round to name one says instead.\n */\nexport function providerDisplayName(\n provider: FiatProvider | undefined,\n fallback: string,\n): string {\n if (provider === undefined) {\n return fallback\n }\n return PROVIDER_NAMES[provider] ?? titleCase(provider)\n}\n\n/**\n * The identity vendor's name as the copy should print it. Separate from the\n * settling provider: the two enums name different things and never mix.\n */\nexport function kycProviderDisplayName(\n provider: KYCProvider | undefined,\n fallback: string,\n): string {\n if (provider === undefined) {\n return fallback\n }\n return KYC_PROVIDER_NAMES[provider] ?? titleCase(provider)\n}\n", "import type { FormField, KycFieldId } from '@funkit/connect-core'\nimport { isValueField } from '@funkit/connect-core'\nimport { Platform, type TextInputProps } from 'react-native'\n\nimport { PADS_WITHOUT_RETURN_KEY } from './keyboardReturnKey'\nimport { type PostalCodeForm, postalCodeForm } from './postalCodeCountries'\n\n/**\n * The pages the US form is drawn as, in the order the design steps them.\n *\n * Figma \"EDIT: KYC Enhancements\": 1508:2616 (name), 1844:17471 (date of\n * birth), 1631:7256 (address), 1631:7883 (SSN). `DETAILS` is not a frame \u2014 it\n * is where a field the design never drew goes, so a form the server words its\n * own way still renders.\n */\nexport type KycSection =\n | 'NAME'\n | 'DOB'\n | 'NATIONALITY'\n | 'COUNTRY'\n | 'ADDRESS'\n | 'SSN'\n | 'PHONE'\n | 'OCCUPATION'\n | 'EMPLOYMENT'\n | 'PURPOSE'\n | 'SOURCE_OF_WEALTH'\n | 'INCOME'\n | 'NET_WORTH'\n | 'ACTIVITY'\n | 'DETAILS'\n\nexport interface KycSectionPage {\n section: KycSection\n /** Drawn as one card with a rule between rows, rather than loose boxes. */\n grouped: boolean\n /** Fields sharing a row sit side by side, as the design pairs them. */\n rows: FormField[][]\n}\n\n/**\n * The questionnaire answers this build draws a page for. The contract types a\n * questionnaire id as a template; any other lands in `DETAILS`.\n */\nexport const GROSS_ANNUAL_INCOME =\n 'QUESTIONNAIRE_RESPONSE:customerDueDiligence:grossAnnualIncome'\nexport const EXPECTED_AMOUNT_PER_MONTH =\n 'QUESTIONNAIRE_RESPONSE:customerDueDiligence:expectedTransactionAmountPerMonth'\nexport const TRANSACTIONS_PER_MONTH =\n 'QUESTIONNAIRE_RESPONSE:customerDueDiligence:transactionFrequencyPerMonth'\nexport const NET_WORTH = 'QUESTIONNAIRE_RESPONSE:enhancedDueDiligence:netWorth'\n\n/**\n * - `FormField` has no currency key, so a figure's reporting currency rides its\n * label as a trailing \" (XXX)\".\n * - Any other label names no currency.\n */\nconst LABELLED_CURRENCY = / \\(([A-Z]{3})\\)$/\n\nexport function fieldCurrency(field: FormField): string | undefined {\n return LABELLED_CURRENCY.exec(field.labelFallback)?.[1]\n}\n\n/** The label without its currency, for a field whose caption already names it. */\nexport function withoutLabelledCurrency(field: FormField): FormField {\n return {\n ...field,\n labelFallback: field.labelFallback.replace(LABELLED_CURRENCY, ''),\n }\n}\n\n/**\n * Which page a field belongs to, by id.\n *\n * The contract closes the id set, so these are the canonical names and there\n * is no second spelling to carry. An id with no page here lands in `DETAILS`\n * rather than being refused: the server owns the list, and a form is not\n * undrawable just because it asks for something the frames do not group.\n */\nconst SECTION_BY_ID: Readonly<Partial<Record<KycFieldId, KycSection>>> = {\n // 1508:2616 \u2014 \"First name\", \"M.I.\", \"Last Name\".\n LEGAL_FIRST_NAME: 'NAME',\n LEGAL_MIDDLE_NAME: 'NAME',\n LEGAL_LAST_NAME: 'NAME',\n // 1844:17471 \u2014 its own page, asked for on its own over the date picker.\n DATE_OF_BIRTH: 'DOB',\n NATIONALITY: 'NATIONALITY',\n // 1631:7256 \u2014 \"Address\", \"Apartment, suite, etc.\", \"City\", \"State\", \"ZIP code\".\n RESIDENTIAL_ADDRESS_LINE_1: 'ADDRESS',\n RESIDENTIAL_ADDRESS_LINE_2: 'ADDRESS',\n RESIDENTIAL_ADDRESS_CITY: 'ADDRESS',\n RESIDENTIAL_ADDRESS_REGION: 'ADDRESS',\n RESIDENTIAL_ADDRESS_POSTAL_CODE: 'ADDRESS',\n RESIDENTIAL_ADDRESS_COUNTRY: 'COUNTRY',\n // 1631:7883 \u2014 \"SSN\".\n TAX_IDENTIFIER: 'SSN',\n TAX_RESIDENCE_COUNTRY: 'COUNTRY',\n OCCUPATION_TITLE: 'OCCUPATION',\n OCCUPATION_INDUSTRY: 'OCCUPATION',\n PURPOSE_OF_TRANSACTION: 'PURPOSE',\n PURPOSE_OF_SERVICE: 'PURPOSE',\n // MoonPay's customer due diligence round, asked after the SSN.\n PHONE_NUMBER: 'PHONE',\n EMPLOYMENT_STATUS: 'EMPLOYMENT',\n SOURCE_OF_WEALTH_DECLARATION: 'SOURCE_OF_WEALTH',\n [GROSS_ANNUAL_INCOME]: 'INCOME',\n [EXPECTED_AMOUNT_PER_MONTH]: 'ACTIVITY',\n [TRANSACTIONS_PER_MONTH]: 'ACTIVITY',\n [NET_WORTH]: 'NET_WORTH',\n}\n\n/**\n * The keyboard a typed field raises. The SSN page is drawn over a number pad\n * (1631:7883) and the due-diligence figures over the pads that fit them;\n * every other page in the form is drawn over letters.\n */\nconst KEYBOARD_BY_ID: Readonly<\n Partial<Record<KycFieldId, TextInputProps['keyboardType']>>\n> = {\n PHONE_NUMBER: 'phone-pad',\n [GROSS_ANNUAL_INCOME]: 'decimal-pad',\n [EXPECTED_AMOUNT_PER_MONTH]: 'decimal-pad',\n [TRANSACTIONS_PER_MONTH]: 'number-pad',\n [NET_WORTH]: 'decimal-pad',\n}\n\n/**\n * Field types a page can draw. A date and a country are typed into the same\n * filled box as any other answer; a hosted step is an errand the user runs\n * elsewhere and a document streams to an endpoint this build has not\n * installed, so neither has a box to draw.\n */\nconst DRAWN_TYPES = new Set(['TEXT', 'SELECT', 'DATE', 'COUNTRY'])\n\n/** One card ruled between its rows (1631:7256, \"address\"). */\nconst GROUPED_SECTIONS = new Set<KycSection>(['ADDRESS'])\n\n/**\n * The order 1508:2616 \u2192 1844:17471 \u2192 1631:7256 \u2192 1631:7883 walks, anything\n * else trailing.\n */\nconst SECTION_ORDER: readonly KycSection[] = [\n 'NAME',\n 'DOB',\n 'NATIONALITY',\n 'COUNTRY',\n 'ADDRESS',\n 'SSN',\n 'PHONE',\n 'OCCUPATION',\n 'EMPLOYMENT',\n 'PURPOSE',\n 'SOURCE_OF_WEALTH',\n 'INCOME',\n 'NET_WORTH',\n 'ACTIVITY',\n 'DETAILS',\n]\n\n/**\n * The page's field a date picker can answer, when that is the whole page.\n *\n * A picker takes the keyboard's slot, so it can only be offered on a page\n * with nothing else to type: a date beside two names would leave one of the\n * two controls covering the other. Anywhere else the date is typed.\n */\nconst IDENTITY_SECTIONS: ReadonlySet<KycSection> = new Set<KycSection>([\n 'NAME',\n 'DOB',\n 'NATIONALITY',\n 'COUNTRY',\n 'ADDRESS',\n 'SSN',\n])\n\n/**\n * The server owns the field list, so an id this build does not know is not\n * identity: only the frames that collect who someone is qualify.\n */\nexport function isIdentityField(field: FormField): boolean {\n const section = SECTION_BY_ID[field.id]\n return section !== undefined && IDENTITY_SECTIONS.has(section)\n}\n\n/**\n * The pages that draw their answers on the page rather than behind a chooser\n * (2475:8992).\n *\n * Named, not inferred from the field's type: `DETAILS` also collects a\n * `SELECT`, but it holds whatever the server asks for that no frame drew, and\n * a list of unknown length is what the chooser's sheet is for.\n */\nconst INLINE_CHOICE_SECTIONS: ReadonlySet<KycSection> = new Set<KycSection>([\n 'OCCUPATION',\n 'EMPLOYMENT',\n 'PURPOSE',\n 'SOURCE_OF_WEALTH',\n])\n\nexport function isInlineChoiceSection(section: KycSection): boolean {\n return INLINE_CHOICE_SECTIONS.has(section)\n}\n\nexport function pickedDateField(page: KycSectionPage): FormField | undefined {\n const fields = page.rows.flat()\n const only = fields.length === 1 ? fields[0] : undefined\n return only?.type === 'DATE' ? only : undefined\n}\n\n/**\n * Whether the field is typed into, and so takes a turn in the return-key\n * chain. A choice is not.\n */\nexport function isFocusableField(field: FormField): boolean {\n return field.type === 'TEXT' || field.type === 'DATE'\n}\n\n/** Pages whose keyboards read \"next\" on the field that tries the page too (1950:2055, 1951:9265). */\nconst NEXT_TO_TRY_SECTIONS: ReadonlySet<KycSection> = new Set<KycSection>([\n 'NAME',\n 'ADDRESS',\n])\n\nexport interface ReturnHop {\n label: 'next' | 'done'\n /** Absent where the return key tries the page instead. */\n to?: FormField\n}\n\n/**\n * Where a typed field's return key goes: the next required typed field.\n *\n * - An optional line is stepped over (2334:7164) but still hands on when the\n * user taps into it.\n */\nexport function returnHop(\n section: KycSection,\n typedFields: readonly FormField[],\n fieldId: string,\n): ReturnHop | undefined {\n const at = typedFields.findIndex((field) => field.id === fieldId)\n if (at < 0) {\n return undefined\n }\n const to = typedFields.slice(at + 1).find((field) => field.required)\n if (to !== undefined) {\n return { label: 'next', to }\n }\n return { label: NEXT_TO_TRY_SECTIONS.has(section) ? 'next' : 'done' }\n}\n\n/**\n * - Digits alone take the number pad, whose missing return key the page\n * answers with Continue (`isDigitsField`).\n * - A hyphen or space needs iOS's digits-first keyboard, which can type it;\n * Android has none, so it keeps letters.\n */\nconst POSTAL_CODE_KEYBOARD: Readonly<\n Record<PostalCodeForm, TextInputProps['keyboardType']>\n> = {\n digits: 'number-pad',\n separated: Platform.OS === 'ios' ? 'numbers-and-punctuation' : undefined,\n}\n\n/**\n * The country a field's keyboard and choices follow.\n *\n * - The tax ID takes the tax residence's, which also names it in the heading.\n * - Every other field takes the address's.\n */\nexport function fieldCountry(\n field: FormField,\n countries: { address?: string; taxResidence?: string },\n): string | undefined {\n return field.id === 'TAX_IDENTIFIER'\n ? countries.taxResidence\n : countries.address\n}\n\n/** `country` is the field's own, from `fieldCountry`. */\nexport function fieldKeyboardType(\n field: FormField,\n country?: string,\n): TextInputProps['keyboardType'] | undefined {\n if (field.type !== 'TEXT') {\n return undefined\n }\n if (field.id === 'RESIDENTIAL_ADDRESS_POSTAL_CODE') {\n const form = postalCodeForm(country)\n return form === undefined ? undefined : POSTAL_CODE_KEYBOARD[form]\n }\n if (field.id === 'TAX_IDENTIFIER') {\n return taxIdentifierKeyboard(country)\n }\n return KEYBOARD_BY_ID[field.id]\n}\n\nconst DIGIT_TAX_IDENTIFIER_COUNTRIES: ReadonlySet<string> = new Set([\n 'US',\n 'BR',\n])\n\nfunction taxIdentifierKeyboard(\n country: string | undefined,\n): TextInputProps['keyboardType'] | undefined {\n if (\n country === undefined ||\n DIGIT_TAX_IDENTIFIER_COUNTRIES.has(country.toUpperCase())\n ) {\n return 'number-pad'\n }\n return undefined\n}\n\n/** Whether the field raises a pad rather than letters, and so has no return key. */\nexport function isDigitsField(field: FormField, country?: string): boolean {\n const keyboardType = fieldKeyboardType(field, country)\n return keyboardType !== undefined && PADS_WITHOUT_RETURN_KEY.has(keyboardType)\n}\n\n/** Whether the field is drawn at a fixed width rather than growing to fill. */\nexport function isFixedWidthField(field: FormField): boolean {\n return field.id === 'LEGAL_MIDDLE_NAME'\n}\n\n/**\n * The form's fields that no page draws.\n *\n * Type only: an unknown id has a page (`DETAILS`), so refusing one would\n * reject a whole form over a field the screens can draw perfectly well. A\n * form with any of these cannot be completed here, so the caller shows its\n * unsupported state rather than a form missing a field the server requires.\n */\nexport function unsupportedFields(fields: readonly FormField[]): FormField[] {\n return fields.filter((field) => !DRAWN_TYPES.has(field.type))\n}\n\n/**\n * Splits a form into the pages the design steps through.\n *\n * Pages keep the design's order; fields keep the server's, so a page that\n * gains a field it already draws renders it without a client release. A page\n * with no fields is not a page.\n */\nexport function sectionPages(fields: readonly FormField[]): KycSectionPage[] {\n const bySection = new Map<KycSection, FormField[]>()\n for (const field of fields) {\n if (!DRAWN_TYPES.has(field.type)) {\n continue\n }\n // A state the provider does not require is not asked: European\n // addresses have none, and the design draws no row for it.\n if (field.id === 'RESIDENTIAL_ADDRESS_REGION' && !field.required) {\n continue\n }\n const section = SECTION_BY_ID[field.id] ?? 'DETAILS'\n const collected = bySection.get(section) ?? []\n collected.push(field)\n bySection.set(section, collected)\n }\n\n return SECTION_ORDER.flatMap<KycSectionPage>((section) => {\n const collected = bySection.get(section)\n if (collected === undefined) {\n return []\n }\n if (isInlineChoiceSection(section) || section === 'DETAILS') {\n return collected.map((field) => ({\n section,\n grouped: false,\n rows: [[field]],\n }))\n }\n return [\n {\n section,\n grouped: GROUPED_SECTIONS.has(section),\n rows:\n section === 'ADDRESS'\n ? addressRows(collected)\n : collected.map((field) => [field]),\n },\n ]\n })\n}\n\n/**\n * The address card as the design lays it out for the country (1631:7256):\n * the street, the apartment line, then the city with the state and ZIP paired\n * under it \u2014 or, where the provider asks for no state, the postal code paired\n * before the city, as a European address reads. A field the design does not\n * place trails on its own row.\n */\nfunction addressRows(fields: readonly FormField[]): FormField[][] {\n const byId = new Map(fields.map((field) => [field.id, field]))\n const take = (id: KycFieldId) => {\n const field = byId.get(id)\n byId.delete(id)\n return field\n }\n const line1 = take('RESIDENTIAL_ADDRESS_LINE_1')\n const line2 = take('RESIDENTIAL_ADDRESS_LINE_2')\n const city = take('RESIDENTIAL_ADDRESS_CITY')\n const region = take('RESIDENTIAL_ADDRESS_REGION')\n const postal = take('RESIDENTIAL_ADDRESS_POSTAL_CODE')\n const rows: (FormField | undefined)[][] = [[line1], [line2]]\n if (region === undefined) {\n rows.push([postal, city])\n } else {\n rows.push([city], [region, postal])\n }\n return [...rows, ...[...byId.values()].map((field) => [field])]\n .map((row) => row.filter((field) => field !== undefined))\n .filter((row) => row.length > 0)\n}\n", "import type { TextInputProps } from 'react-native'\n\n/**\n * Keyboards with no return key. iOS draws a floating button of its own when\n * one of these is asked for a return key, and it lands over the screen's\n * bottom-right \u2014 where the advance control already is.\n */\nexport const PADS_WITHOUT_RETURN_KEY = new Set<TextInputProps['keyboardType']>([\n 'number-pad',\n 'numeric',\n 'decimal-pad',\n 'phone-pad',\n])\n", "/**\n * How a country writes its postal codes, where Google's address metadata\n * (libaddressinput, chromium-i18n.appspot.com/ssl-address/data) and\n * `postcode-validator` agree. Anywhere they disagree is on neither list, so\n * the keyboard stays letters (`postalCodeCountries.drift.test.ts`).\n *\n * - `digits`: codes are written as digits alone. The US ZIP+4 extension and\n * FR's space are optional, and neither is how the post office writes them.\n * - `separated`: digits the country writes split by a hyphen or space\n * (`12345-678`, `123 45`), which a number pad cannot type.\n * - A country whose codes carry any letter (GB, CA, NL, IE, AR, MT, LV\u2026), or\n * that has no postal code, is on neither list.\n */\nexport type PostalCodeForm = 'digits' | 'separated'\n\nconst codes = (list: string): ReadonlySet<string> =>\n new Set(list.trim().split(/\\s+/))\n\nconst DIGIT_COUNTRIES = codes(`\n AF AL AM AS AT AU AX AZ BA BD BE BG BH BL BT BY CC CH CL CN CO CU CV\n CX CY DE DK DO DZ EC EE EG EH ES ET FI FM FO FR GE GF GL GN GP GT GU\n GW HM HN HR HT HU ID IL IN IQ IS IT JO KE KG KH KR KW KZ LA LI LK LR\n LS LT LU MA MC MD ME MF MG MH MK MM MN MP MQ MV MX MY MZ NA NC NE NF\n NG NO NP NZ PF PG PH PK PM PR PW PY RE RO RS RU SA SD SG SI SJ SM SN\n TH TJ TM TN TR TW TZ UA UM US UY UZ VA VE VI VN WF XK YT ZA ZM\n`)\n\nconst SEPARATED_COUNTRIES = codes(`\n BR CR CZ GR IR JP LB PL PT SE SK\n`)\n\nexport function postalCodeForm(\n alpha2: string | undefined,\n): PostalCodeForm | undefined {\n const code = alpha2?.toUpperCase()\n if (code === undefined) {\n return undefined\n }\n if (DIGIT_COUNTRIES.has(code)) {\n return 'digits'\n }\n return SEPARATED_COUNTRIES.has(code) ? 'separated' : undefined\n}\n"],
|
|
5
|
+
"mappings": ";AACA;AAAA,EAIE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAkHH;AAfJ,IAAM,qBAAqB,cAA2C,MAAS;AAOxE,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AACF,GAGG;AACD,SACE,oBAAC,mBAAmB,UAAnB,EAA4B,OAAO,MACjC,UACH;AAEJ;AAGO,SAAS,qBAAkD;AAChE,SAAO,WAAW,kBAAkB;AACtC;AAQA,IAAM,aAA4B,CAAC;AACnC,IAAM,uBAAuB,cAA6B,UAAU;AAG7D,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AACF,GAIG;AAED,QAAM,UAAU;AAAA,IACd,MACE,YAAY,UAAa,eAAe,SACpC,aACA,EAAE,SAAS,WAAW;AAAA,IAC5B,CAAC,SAAS,UAAU;AAAA,EACtB;AACA,SACE,oBAAC,qBAAqB,UAArB,EAA8B,OAAO,SACnC,UACH;AAEJ;AASO,IAAM,OAAO;AAAA,EAClB,YAAY,CAAC,MAAM,EAAE,SAAS,MAAM;AAAA,EACpC,UAAU,CAAC,MAAM,EAAE,SAAS,MAAM;AAA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AC;AAAA,EACpC;AACA,SAAO,CAAC,GAAG,MAAM,GAAG,CAAC,GAAG,KAAK,OAAO,CAAC,EAAE,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,EAC3D,IAAI,CAAC,QAAQ,IAAI,OAAO,CAAC,UAAU,UAAU,MAAS,CAAC,EACvD,OAAO,CAAC,QAAQ,IAAI,SAAS,CAAC;AACnC;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
useFunkitIdentity
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZIE5S6XC.js";
|
|
4
4
|
import {
|
|
5
5
|
logger
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-KOJEF2II.js";
|
|
7
7
|
|
|
8
8
|
// src/statsig/useDynamicConfig.ts
|
|
9
9
|
import {
|
|
@@ -114,4 +114,4 @@ export {
|
|
|
114
114
|
useIsStablecoin,
|
|
115
115
|
useSourceTokenUsdPrice
|
|
116
116
|
};
|
|
117
|
-
//# sourceMappingURL=chunk-
|
|
117
|
+
//# sourceMappingURL=chunk-GPJAVLS6.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/statsig/useDynamicConfig.ts", "../src/geo/useUserIpInfo.ts", "../src/withdrawal/useSourceTokenUsdPrice.ts", "../src/hooks/useIsStablecoin.ts"],
|
|
4
|
+
"sourcesContent": ["import {\n type DynamicConfigName,\n type DynamicConfigValue,\n useDynamicConfig as useCoreDynamicConfig,\n} from '@funkit/connect-core'\n\nimport { useUserIpInfo } from '../geo/useUserIpInfo'\n\n// RN counterpart of `@funkit/connect`'s `hooks/statsig/useDynamicConfig`. The\n// core hook takes `countryCode` as a parameter so it stays platform-agnostic;\n// this wrapper threads the user's IP-derived `alpha2` (Moonpay/ipapi) so\n// country-conditional variant configs (e.g. `enableswappeddeposit`) resolve\n// against the real region instead of falling to their default branch.\nexport type { DynamicConfigName, DynamicConfigValue }\n\nexport const useDynamicConfig = <Name extends DynamicConfigName>(\n name: Name,\n options?: {\n bypassCountryCode?: boolean\n },\n): DynamicConfigValue<Name> => {\n const { userIpInfo } = useUserIpInfo()\n return useCoreDynamicConfig(name, {\n bypassCountryCode: options?.bypassCountryCode,\n countryCode: userIpInfo?.alpha2,\n })\n}\n", "import { useUserIpInfo as useCoreUserIpInfo } from '@funkit/connect-core'\nimport type { QueryClient } from '@tanstack/react-query'\n\nimport { useFunkitIdentity } from '../providers/IdentityContext'\nimport { logger } from '../logging/logger'\n\n// Re-exported so existing RN importers (isCountryBlocked, the flow hooks, tests)\n// keep their type source unchanged after the fetch logic moved to core.\nexport type {\n FunkitUserIpInfo,\n UseUserIpInfoResult,\n} from '@funkit/connect-core'\n\n// Thin RN wrapper over the shared core `useUserIpInfo` (V1 PR13 moved the\n// Moonpay\u2192ipapi fetch logic there so web and RN don't duplicate it). RN is\n// login-agnostic, so the lookup always runs (`enabled: true`); web's wrapper\n// gates on `isUserLoggedIn` instead. `apiKey` lets the core hook reach the\n// first-party geo endpoint; the chain it picks is Statsig-driven.\nexport function useUserIpInfo() {\n const { apiKey } = useFunkitIdentity()\n\n // Login-agnostic + session-stable: always run, never go stale. The fiat\n // rail prices a US buyer by state, so a stateless answer is worth a second\n // provider here; web reads only the country and leaves this off.\n return useCoreUserIpInfo({\n logger,\n apiKey,\n enabled: true,\n staleTime: Number.POSITIVE_INFINITY,\n requireState: true,\n })\n}\n\n/**\n * Re-asks for the location in the background; a cached answer keeps rendering\n * until the new one lands. Matches the core hook's query key, which\n * `useUserIpInfo.test.tsx` pins.\n */\nexport function refreshUserIpInfo(queryClient: QueryClient): void {\n void queryClient.invalidateQueries({ queryKey: ['getUserIpInfo'] })\n}\n", "import { getAssetPriceInfoWithFallback } from '@funkit/connect-core'\nimport { useQuery } from '@tanstack/react-query'\n\nimport { useIsStablecoin } from '../hooks/useIsStablecoin'\nimport { useFunkitIdentity } from '../providers/IdentityContext'\nimport { logger } from '../logging/logger'\n\nconst SOURCE_TOKEN_PRICE_QUERY_KEY = 'sourceTokenUsdPrice'\n\n/** Long enough that typing doesn't refetch, short enough to stay honest. */\nconst PRICE_STALE_TIME_MS = 60_000\n\n/** What a dollar stablecoin is worth, without asking anyone. */\nconst STABLECOIN_USD_PRICE = 1\n\n/**\n * Spot USD price of the source token, for the USD floor and ceiling the host\n * configures (`getMinWithdrawalUSD`, `getMaxWithdrawalFiat`, or\n * `getMaxWithdrawalUSD`).\n *\n * A dollar stablecoin is priced from its symbol and never fetched, as web's\n * `useAssetAddressPrice` does \u2014 it is the common withdrawal source, and the\n * amount screen was waiting on a round trip to be told a dollar is a dollar.\n *\n * `0` means \"unknown\", which is what the core validator reads as \"no price\" \u2014\n * so a failed or in-flight lookup leaves the USD limits inert rather than\n * judging an amount against a made-up rate. Per-token limits and the balance\n * check are unaffected either way.\n *\n * Not every source has a price: Lighter's L2 assets are addressed by index, not\n * by an ERC-20 funkit's price API knows, so that lookup 404s and core's Relay\n * fallback is what prices them.\n */\nexport function useSourceTokenUsdPrice(\n sourceToken:\n | { chainId: string | number; address: string; symbol: string }\n | undefined,\n {\n enabled = true,\n refetchInterval = false,\n }: {\n enabled?: boolean\n refetchInterval?: number | false\n } = {},\n) {\n const { apiKey } = useFunkitIdentity()\n const isStablecoin = useIsStablecoin()\n const chainId = sourceToken ? String(sourceToken.chainId) : undefined\n const isStable = !!sourceToken && isStablecoin(sourceToken.symbol)\n const unavailable = enabled && !!sourceToken && !isStable && !apiKey\n\n const query = useQuery({\n queryKey: [\n SOURCE_TOKEN_PRICE_QUERY_KEY,\n apiKey,\n chainId,\n sourceToken?.address,\n ],\n queryFn: async () => {\n if (!sourceToken || !chainId) {\n throw new Error('Missing price inputs')\n }\n const info = await getAssetPriceInfoWithFallback({\n chainId,\n assetTokenAddress: sourceToken.address as `0x${string}`,\n apiKey,\n logger,\n })\n const unitPrice = info.unitPrice\n if (!Number.isFinite(unitPrice) || unitPrice <= 0) {\n // Reported here, not on read: a cached bad price would otherwise warn\n // on every render. A non-positive price would silently scale every USD\n // limit to nothing.\n logger.warn('connect-rn:withdrawal:unusable_source_price', {\n chainId: sourceToken.chainId,\n address: sourceToken.address,\n unitPrice,\n })\n return 0\n }\n return unitPrice\n },\n enabled: enabled && !!sourceToken && !isStable && !unavailable,\n staleTime: PRICE_STALE_TIME_MS,\n refetchInterval: isStable ? false : refetchInterval,\n retry: false,\n })\n\n return {\n refetch: query.refetch,\n data: isStable ? STABLECOIN_USD_PRICE : (query.data ?? 0),\n isUnavailable: unavailable,\n isPending: !isStable && !unavailable && query.isPending,\n isError: !isStable && (unavailable || query.isError),\n isFetching: !isStable && query.isFetching,\n }\n}\n", "import { useCallback } from 'react'\nimport { useDynamicConfig } from '../statsig/useDynamicConfig'\n\nexport type IsStablecoinFn = (symbol: string) => boolean\n\nexport function useIsStablecoin(): IsStablecoinFn {\n const stablecoinSymbols = useDynamicConfig('stablecoinsymbols')\n return useCallback(\n (symbol: string) =>\n stablecoinSymbols.some((stable) =>\n symbol.toLowerCase().includes(stable.toLowerCase()),\n ),\n [stablecoinSymbols],\n )\n}\n"],
|
|
5
|
+
"mappings": ";;;;;;;;AAAA;AAAA,EAGE,oBAAoB;AAAA,OACf;;;ACJP,SAAS,iBAAiB,yBAAyB;AAkB5C,SAAS,gBAAgB;AAC9B,QAAM,EAAE,OAAO,IAAI,kBAAkB;AAKrC,SAAO,kBAAkB;AAAA,IACvB;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT,WAAW,OAAO;AAAA,IAClB,cAAc;AAAA,EAChB,CAAC;AACH;AAOO,SAAS,kBAAkB,aAAgC;AAChE,OAAK,YAAY,kBAAkB,EAAE,UAAU,CAAC,eAAe,EAAE,CAAC;AACpE;;;ADzBO,IAAM,mBAAmB,CAC9B,MACA,YAG6B;AAC7B,QAAM,EAAE,WAAW,IAAI,cAAc;AACrC,SAAO,qBAAqB,MAAM;A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AAA,QACF,CAAC;AACD,eAAO;AAAA,MACT;AACA,aAAO;AAAA,IACT;AAAA,IACA,SAAS,WAAW,CAAC,CAAC,eAAe,CAAC,YAAY,CAAC;AAAA,IACnD,WAAW;AAAA,IACX,iBAAiB,WAAW,QAAQ;AAAA,IACpC,OAAO;AAAA,EACT,CAAC;AAED,SAAO;AAAA,IACL,SAAS,MAAM;AAAA,IACf,MAAM,WAAW,uBAAwB,MAAM,QAAQ;AAAA,IACvD,eAAe;AAAA,IACf,WAAW,CAAC,YAAY,CAAC,eAAe,MAAM;AAAA,IAC9C,SAAS,CAAC,aAAa,eAAe,MAAM;AAAA,IAC5C,YAAY,CAAC,YAAY,MAAM;AAAA,EACjC;AACF;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
// src/logging/logger.ts
|
|
2
|
-
import { FunLogger } from "@funkit/connect-core";
|
|
2
|
+
import { FunLogger, createDatadogRouter } from "@funkit/connect-core";
|
|
3
3
|
import { AppState } from "react-native";
|
|
4
4
|
|
|
5
5
|
// src/logging/datadogHttpLogTransport.ts
|
|
6
6
|
import { retry } from "@lifeomic/attempt";
|
|
7
|
+
import {
|
|
8
|
+
DATADOG_PROXY_SITE,
|
|
9
|
+
buildDatadogProxyUrl
|
|
10
|
+
} from "@funkit/connect-core";
|
|
7
11
|
|
|
8
12
|
// src/logging/serializeLogBatch.ts
|
|
9
13
|
var UNSERIALIZABLE_DATA = "[Unserializable]";
|
|
@@ -59,7 +63,8 @@ function createSafeJsonReplacer() {
|
|
|
59
63
|
|
|
60
64
|
// src/logging/datadogHttpLogTransport.ts
|
|
61
65
|
var DEFAULT_SERVICE = "connect-rn";
|
|
62
|
-
var DEFAULT_SITE =
|
|
66
|
+
var DEFAULT_SITE = DATADOG_PROXY_SITE;
|
|
67
|
+
var INTAKE_PATH = "/api/v2/logs";
|
|
63
68
|
var DEFAULT_FLUSH_INTERVAL_MS = 5e3;
|
|
64
69
|
var DEFAULT_MAX_BATCH_SIZE = 50;
|
|
65
70
|
var SEND_RETRY = {
|
|
@@ -81,12 +86,26 @@ var DatadogHttpLogTransport = class {
|
|
|
81
86
|
this.queue = [];
|
|
82
87
|
this.flushTimer = null;
|
|
83
88
|
this.isSending = false;
|
|
89
|
+
this.route = null;
|
|
84
90
|
const site = options.site ?? DEFAULT_SITE;
|
|
85
91
|
this.service = options.service ?? DEFAULT_SERVICE;
|
|
86
92
|
this.env = options.env;
|
|
87
93
|
this.flushIntervalMs = options.flushIntervalMs ?? DEFAULT_FLUSH_INTERVAL_MS;
|
|
88
94
|
this.maxBatchSize = options.maxBatchSize ?? DEFAULT_MAX_BATCH_SIZE;
|
|
89
|
-
|
|
95
|
+
const parameters = `dd-api-key=${encodeURIComponent(options.clientToken)}&ddsource=react-native&dd-evp-origin=react-native`;
|
|
96
|
+
this.directIntakeUrl = `https://browser-intake-${site}${INTAKE_PATH}?${parameters}`;
|
|
97
|
+
this.proxyIntakeUrl = site === DATADOG_PROXY_SITE ? buildDatadogProxyUrl({ parameters }) : null;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Sets where logs go and sends everything queued so far. A later call
|
|
101
|
+
* switches the route for every send that starts after it.
|
|
102
|
+
*/
|
|
103
|
+
setRoute(decision) {
|
|
104
|
+
this.route = decision.route === "proxy" && this.proxyIntakeUrl ? { decision, intakeUrl: this.proxyIntakeUrl } : {
|
|
105
|
+
decision: { ...decision, route: "direct" },
|
|
106
|
+
intakeUrl: this.directIntakeUrl
|
|
107
|
+
};
|
|
108
|
+
this.flush();
|
|
90
109
|
}
|
|
91
110
|
setEnv(environment) {
|
|
92
111
|
this.env = environment;
|
|
@@ -141,18 +160,53 @@ var DatadogHttpLogTransport = class {
|
|
|
141
160
|
*/
|
|
142
161
|
flush() {
|
|
143
162
|
this.clearTimer();
|
|
144
|
-
if (this.isSending || this.queue.length === 0) {
|
|
163
|
+
if (!this.route || this.isSending || this.queue.length === 0) {
|
|
145
164
|
return;
|
|
146
165
|
}
|
|
147
166
|
if (typeof fetch !== "function") {
|
|
148
167
|
this.queue = [];
|
|
149
168
|
return;
|
|
150
169
|
}
|
|
151
|
-
|
|
170
|
+
this.isSending = true;
|
|
171
|
+
this.sendBatch(this.queue.splice(0, this.maxBatchSize)).then((sent) => {
|
|
172
|
+
this.isSending = false;
|
|
173
|
+
if (sent) {
|
|
174
|
+
this.flush();
|
|
175
|
+
} else if (this.queue.length > 0) {
|
|
176
|
+
this.scheduleFlush();
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Send every queued record now, one request per batch, without waiting for
|
|
182
|
+
* earlier requests. For the moment before iOS suspends the app, when a
|
|
183
|
+
* one-at-a-time flush would leave the later batches unsent.
|
|
184
|
+
*/
|
|
185
|
+
flushAll() {
|
|
186
|
+
this.clearTimer();
|
|
187
|
+
if (!this.route || typeof fetch !== "function") {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
while (this.queue.length > 0) {
|
|
191
|
+
void this.sendBatch(this.queue.splice(0, this.maxBatchSize)).then(
|
|
192
|
+
(sent) => {
|
|
193
|
+
if (!sent && this.queue.length > 0) {
|
|
194
|
+
this.scheduleFlush();
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/** Resolves whether the batch was sent; a failed batch rejoins the queue. */
|
|
201
|
+
sendBatch(batch) {
|
|
202
|
+
const route = this.route;
|
|
203
|
+
if (!route) {
|
|
204
|
+
this.queue = [...batch, ...this.queue].slice(-MAX_QUEUED_RECORDS);
|
|
205
|
+
return Promise.resolve(false);
|
|
206
|
+
}
|
|
152
207
|
const generation = this.consentGeneration;
|
|
153
208
|
const isWithdrawn = () => this.consentGeneration !== generation;
|
|
154
|
-
|
|
155
|
-
retry(
|
|
209
|
+
return retry(
|
|
156
210
|
async () => {
|
|
157
211
|
const controller = new AbortController();
|
|
158
212
|
let timeout;
|
|
@@ -164,10 +218,15 @@ var DatadogHttpLogTransport = class {
|
|
|
164
218
|
});
|
|
165
219
|
try {
|
|
166
220
|
const response = await Promise.race([
|
|
167
|
-
fetch(
|
|
221
|
+
fetch(route.intakeUrl, {
|
|
168
222
|
method: "POST",
|
|
169
223
|
headers: { "Content-Type": "application/json" },
|
|
170
|
-
body: serializeLogBatch(
|
|
224
|
+
body: serializeLogBatch(
|
|
225
|
+
batch.map((entry) => ({
|
|
226
|
+
...entry,
|
|
227
|
+
datadogRoute: route.decision
|
|
228
|
+
}))
|
|
229
|
+
),
|
|
171
230
|
signal: controller.signal
|
|
172
231
|
}),
|
|
173
232
|
timedOut
|
|
@@ -191,18 +250,13 @@ var DatadogHttpLogTransport = class {
|
|
|
191
250
|
}
|
|
192
251
|
).then(
|
|
193
252
|
() => true,
|
|
194
|
-
() =>
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
}
|
|
200
|
-
if (sent) {
|
|
201
|
-
this.flush();
|
|
202
|
-
} else if (this.queue.length > 0) {
|
|
203
|
-
this.scheduleFlush();
|
|
253
|
+
() => {
|
|
254
|
+
if (!isWithdrawn()) {
|
|
255
|
+
this.queue = [...batch, ...this.queue].slice(-MAX_QUEUED_RECORDS);
|
|
256
|
+
}
|
|
257
|
+
return false;
|
|
204
258
|
}
|
|
205
|
-
|
|
259
|
+
);
|
|
206
260
|
}
|
|
207
261
|
scheduleFlush() {
|
|
208
262
|
if (this.flushTimer != null) {
|
|
@@ -226,20 +280,34 @@ function isRetryableStatus(status) {
|
|
|
226
280
|
|
|
227
281
|
// src/logging/logger.ts
|
|
228
282
|
var DDOG_CLIENT_TOKEN = "pub4f86c6be8c792cb48dc156a8c17d9a47";
|
|
229
|
-
var
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
283
|
+
var transport = new DatadogHttpLogTransport({
|
|
284
|
+
clientToken: DDOG_CLIENT_TOKEN
|
|
285
|
+
// service defaults to 'connect-rn' (see DatadogHttpLogTransport).
|
|
286
|
+
});
|
|
287
|
+
var logger = new FunLogger(transport);
|
|
288
|
+
var datadogRouter = createDatadogRouter({
|
|
289
|
+
setRoute: (decision) => {
|
|
290
|
+
transport.setRoute(decision);
|
|
291
|
+
logger.info("datadog:routeDecided", decision);
|
|
292
|
+
},
|
|
293
|
+
subscribeToExit: (onExit) => {
|
|
294
|
+
const subscription = AppState.addEventListener("change", (state) => {
|
|
295
|
+
if (state === "background") {
|
|
296
|
+
onExit();
|
|
297
|
+
}
|
|
298
|
+
});
|
|
299
|
+
return () => subscription.remove();
|
|
300
|
+
}
|
|
301
|
+
});
|
|
235
302
|
logger.setDebugTag(process.env.EXPO_PUBLIC_DEV_TAG ?? null);
|
|
236
303
|
AppState.addEventListener("change", (state) => {
|
|
237
304
|
if (state === "background") {
|
|
238
|
-
|
|
305
|
+
transport.flushAll();
|
|
239
306
|
}
|
|
240
307
|
});
|
|
241
308
|
|
|
242
309
|
export {
|
|
243
|
-
logger
|
|
310
|
+
logger,
|
|
311
|
+
datadogRouter
|
|
244
312
|
};
|
|
245
|
-
//# sourceMappingURL=chunk-
|
|
313
|
+
//# sourceMappingURL=chunk-KOJEF2II.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/logging/logger.ts", "../src/logging/datadogHttpLogTransport.ts", "../src/logging/serializeLogBatch.ts"],
|
|
4
|
+
"sourcesContent": ["import { FunLogger, createDatadogRouter } from '@funkit/connect-core'\nimport { AppState } from 'react-native'\n\nimport { DatadogHttpLogTransport } from './datadogHttpLogTransport'\n\n// Public Datadog client token (same one `@funkit/connect` uses for web). A\n// client token is safe to embed in client apps. The puppy.fun.xyz proxy only\n// forwards requests carrying this token. Rotating it also means updating\n// ALLOWED_CLIENT_TOKEN in fun-xyz/cfn-infra's cloudformations/puppy-dd-proxy.yaml\n// and redeploying that stack; otherwise every proxied log is rejected.\nconst DDOG_CLIENT_TOKEN = 'pub4f86c6be8c792cb48dc156a8c17d9a47'\n\n/**\n * The React Native `FunLogger` singleton. Mirrors `@funkit/connect`'s web\n * `logger`, but injects the raw-HTTP {@link DatadogHttpLogTransport} (no Datadog\n * SDK, no native modules) instead of `@datadog/browser-logs`. The host wires\n * `logger.configure(...)` / `setUserInfo(...)` once identity is available.\n */\nconst transport = new DatadogHttpLogTransport({\n clientToken: DDOG_CLIENT_TOKEN,\n // service defaults to 'connect-rn' (see DatadogHttpLogTransport).\n})\n\nexport const logger = new FunLogger(transport)\n\n/**\n * Holds every log until the `sdk-datadog-proxy` gate gives a route.\n * `FunkitStatsigProvider` attaches its client. Backgrounding the app before\n * then sets a provisional route, so the queue is sent before iOS suspends JS.\n */\nexport const datadogRouter = createDatadogRouter({\n setRoute: (decision) => {\n transport.setRoute(decision)\n logger.info('datadog:routeDecided', decision)\n },\n subscribeToExit: (onExit) => {\n const subscription = AppState.addEventListener('change', (state) => {\n if (state === 'background') {\n onExit()\n }\n })\n return () => subscription.remove()\n },\n})\n\n// Names a developer's build in Datadog.\n// Metro inlines `EXPO_PUBLIC_*` only outside `node_modules` (expo/expo#46982),\n// so this resolves in this monorepo's playground and is `undefined`\n// for anyone consuming the published package. A host needs no API to opt out.\nlogger.setDebugTag(process.env.EXPO_PUBLIC_DEV_TAG ?? null)\n\n// iOS suspends JS shortly after the app leaves the foreground, freezing the\n// batch timer. A redirect, 3DS or KYC camera handoff would otherwise strand the\n// records that explain it, or lose them if the OS kills the app.\nAppState.addEventListener('change', (state) => {\n if (state === 'background') {\n transport.flushAll()\n }\n})\n", "import { retry } from '@lifeomic/attempt'\nimport {\n DATADOG_PROXY_SITE,\n type DatadogRouteDecision,\n type LogRecord,\n type LogTransport,\n type TrackingConsent,\n buildDatadogProxyUrl,\n} from '@funkit/connect-core'\n\nimport { serializeLogBatch } from './serializeLogBatch'\n\n/**\n * React Native `LogTransport` that ships records to Datadog over **raw HTTP**\n * (`fetch`) \u2014 deliberately NOT the Datadog SDK. `@datadog/mobile-react-native`\n * pulls in native modules (autolinking, pods, no Expo Go); a plain `fetch` to\n * the logs intake needs none, so this works in Expo Go and any RN runtime.\n *\n * Nothing is sent until {@link setRoute} receives a route; records\n * wait in the queue until then.\n *\n * Records are batched and flushed on a timer (or when the batch fills). Each\n * batch retries with backoff, then waits for the next flush if the intake is\n * still unreachable; nothing a send does can throw back into a user flow.\n * Authenticates with the public Datadog **client token** via `dd-api-key`\n * (the same credential the browser SDK uses \u2014 safe to embed), so no server-side\n * API key is needed.\n */\nexport interface DatadogHttpLogTransportOptions {\n /** Datadog client token (`pub\u2026`). Safe to ship in client apps. */\n clientToken: string\n /** Service name attached to every log. */\n service?: string\n /** Datadog site, e.g. `datadoghq.com` (default), `datadoghq.eu`. */\n site?: string\n /** Initial environment tag; also settable later via {@link setEnv}. */\n env?: string\n /** Flush the batch at most this often (ms). Default 5000. */\n flushIntervalMs?: number\n /** Flush immediately once the batch reaches this size. Default 50. */\n maxBatchSize?: number\n}\n\ninterface DatadogLogEntry {\n ddsource: string\n service: string\n status: LogRecord['level']\n message: string\n ddtags?: string\n error?: { message: string; stack?: string; kind: string }\n [attribute: string]: unknown\n}\n\nconst DEFAULT_SERVICE = 'connect-rn'\nconst DEFAULT_SITE = DATADOG_PROXY_SITE\nconst INTAKE_PATH = '/api/v2/logs'\nconst DEFAULT_FLUSH_INTERVAL_MS = 5_000\nconst DEFAULT_MAX_BATCH_SIZE = 50\n// About three minutes of backoff: long enough to outlast a dropped connection\n// or a rate limit, short enough that an offline app stops holding records.\nconst SEND_RETRY = {\n delay: 2_000,\n factor: 2,\n maxDelay: 60_000,\n maxAttempts: 8,\n jitter: true,\n}\n// A hung request would otherwise hold the queue behind it. It is aborted, not\n// abandoned, so a late answer cannot deliver the batch a second time.\nconst SEND_TIMEOUT_MS = 15_000\n\n// Bounds memory through a long outage; the newest records are the ones that\n// explain whatever the user is looking at when the connection returns.\nconst MAX_QUEUED_RECORDS = 500\n\n/** Tells `retry` the intake may take the batch on another attempt. */\nclass RetryableSend extends Error {}\n\nexport class DatadogHttpLogTransport implements LogTransport {\n private readonly directIntakeUrl: string\n private readonly proxyIntakeUrl: string | null\n private readonly service: string\n private readonly flushIntervalMs: number\n private readonly maxBatchSize: number\n\n private env: string | undefined\n private consent: TrackingConsent = 'granted'\n // Bumped on every withdrawal, so a batch taken before one never sends.\n private consentGeneration = 0\n private queue: DatadogLogEntry[] = []\n private flushTimer: ReturnType<typeof setTimeout> | null = null\n private isSending = false\n private route: { decision: DatadogRouteDecision; intakeUrl: string } | null =\n null\n\n constructor(options: DatadogHttpLogTransportOptions) {\n const site = options.site ?? DEFAULT_SITE\n this.service = options.service ?? DEFAULT_SERVICE\n this.env = options.env\n this.flushIntervalMs = options.flushIntervalMs ?? DEFAULT_FLUSH_INTERVAL_MS\n this.maxBatchSize = options.maxBatchSize ?? DEFAULT_MAX_BATCH_SIZE\n // Browser/mobile logs intake; the client token authenticates via dd-api-key.\n const parameters =\n `dd-api-key=${encodeURIComponent(options.clientToken)}` +\n `&ddsource=react-native&dd-evp-origin=react-native`\n this.directIntakeUrl = `https://browser-intake-${site}${INTAKE_PATH}?${parameters}`\n // The proxy only forwards to the default site's intake.\n this.proxyIntakeUrl =\n site === DATADOG_PROXY_SITE ? buildDatadogProxyUrl({ parameters }) : null\n }\n\n /**\n * Sets where logs go and sends everything queued so far. A later call\n * switches the route for every send that starts after it.\n */\n setRoute(decision: DatadogRouteDecision): void {\n this.route =\n decision.route === 'proxy' && this.proxyIntakeUrl\n ? { decision, intakeUrl: this.proxyIntakeUrl }\n : {\n decision: { ...decision, route: 'direct' },\n intakeUrl: this.directIntakeUrl,\n }\n this.flush()\n }\n\n setEnv(environment: string): void {\n this.env = environment\n }\n\n setTrackingConsent(consent: TrackingConsent): void {\n this.consent = consent\n if (consent !== 'granted') {\n // Drop anything buffered when consent is withdrawn.\n this.queue = []\n this.consentGeneration++\n this.clearTimer()\n }\n }\n\n log({ level, title, context, error }: LogRecord): void {\n if (this.consent !== 'granted') {\n return\n }\n\n const entry: DatadogLogEntry = {\n // Caller context first so the mandatory Datadog fields below always win \u2014\n // a future LogContext attribute named e.g. `message`/`status` can't\n // silently corrupt the record.\n ...context,\n ddsource: 'react-native',\n service: this.service,\n status: level,\n message: title,\n // Stamped at emit time: Datadog otherwise dates a record by its arrival,\n // which lags by the batch interval, or by minutes after a background.\n date: Date.now(),\n ...(this.env ? { ddtags: `env:${this.env}` } : {}),\n ...(error\n ? {\n error: {\n message: error.message,\n stack: error.stack,\n kind: error.name,\n },\n }\n : {}),\n }\n\n this.queue.push(entry)\n if (this.queue.length > MAX_QUEUED_RECORDS) {\n this.queue.shift()\n }\n\n if (this.queue.length >= this.maxBatchSize) {\n this.flush()\n } else {\n this.scheduleFlush()\n }\n }\n\n /**\n * Send the oldest batch, then the next once it lands. One send at a time:\n * a failed batch goes back to the front of the queue, so the cap always\n * drops the oldest records.\n */\n flush(): void {\n this.clearTimer()\n if (!this.route || this.isSending || this.queue.length === 0) {\n return\n }\n if (typeof fetch !== 'function') {\n // No fetch (e.g. SSR import) \u2014 drop rather than throw.\n this.queue = []\n return\n }\n\n this.isSending = true\n // At most a batch per request: a backlog from an outage sent whole can\n // pass the intake's payload limit and be refused.\n this.sendBatch(this.queue.splice(0, this.maxBatchSize)).then((sent) => {\n this.isSending = false\n if (sent) {\n this.flush()\n } else if (this.queue.length > 0) {\n this.scheduleFlush()\n }\n })\n }\n\n /**\n * Send every queued record now, one request per batch, without waiting for\n * earlier requests. For the moment before iOS suspends the app, when a\n * one-at-a-time flush would leave the later batches unsent.\n */\n flushAll(): void {\n this.clearTimer()\n if (!this.route || typeof fetch !== 'function') {\n return\n }\n while (this.queue.length > 0) {\n void this.sendBatch(this.queue.splice(0, this.maxBatchSize)).then(\n (sent) => {\n if (!sent && this.queue.length > 0) {\n this.scheduleFlush()\n }\n },\n )\n }\n }\n\n /** Resolves whether the batch was sent; a failed batch rejoins the queue. */\n private sendBatch(batch: DatadogLogEntry[]): Promise<boolean> {\n const route = this.route\n if (!route) {\n this.queue = [...batch, ...this.queue].slice(-MAX_QUEUED_RECORDS)\n return Promise.resolve(false)\n }\n const generation = this.consentGeneration\n const isWithdrawn = () => this.consentGeneration !== generation\n return retry(\n async () => {\n const controller = new AbortController()\n let timeout: ReturnType<typeof setTimeout> | undefined\n // Raced, not only aborted: a host fetch may ignore the signal.\n const timedOut = new Promise<never>((_, reject) => {\n timeout = setTimeout(() => {\n controller.abort()\n reject(new RetryableSend('request timed out'))\n }, SEND_TIMEOUT_MS)\n })\n try {\n const response = await Promise.race([\n fetch(route.intakeUrl, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: serializeLogBatch(\n batch.map((entry) => ({\n ...entry,\n datadogRoute: route.decision,\n })),\n ),\n signal: controller.signal,\n }),\n timedOut,\n ])\n if (!response.ok && isRetryableStatus(response.status)) {\n throw new RetryableSend(`intake answered ${response.status}`)\n }\n } finally {\n clearTimeout(timeout)\n }\n },\n {\n ...SEND_RETRY,\n // Checks the generation, not the current value: consent may be\n // withdrawn and granted again within one backoff.\n beforeAttempt: (context) => {\n if (isWithdrawn()) {\n context.abort()\n }\n },\n },\n ).then(\n () => true,\n () => {\n if (!isWithdrawn()) {\n this.queue = [...batch, ...this.queue].slice(-MAX_QUEUED_RECORDS)\n }\n return false\n },\n )\n }\n\n private scheduleFlush(): void {\n if (this.flushTimer != null) {\n return\n }\n this.flushTimer = setTimeout(() => {\n this.flushTimer = null\n this.flush()\n }, this.flushIntervalMs)\n }\n\n private clearTimer(): void {\n if (this.flushTimer != null) {\n clearTimeout(this.flushTimer)\n this.flushTimer = null\n }\n }\n}\n\n/**\n * Other 4xx answers reject the payload itself, so sending it again cannot\n * succeed.\n */\nfunction isRetryableStatus(status: number): boolean {\n return status === 408 || status === 429 || status >= 500\n}\n", "const UNSERIALIZABLE_DATA = '[Unserializable]'\n\n/**\n * Serialize log records to a JSON body. Always succeeds.\n *\n * Web gets this from `@datadog/browser-logs`; the raw-`fetch` RN transport has\n * no such layer and serializes inside the caller's `log()`, so a throw would\n * land in a user flow.\n */\nexport function serializeLogBatch(batch: readonly object[]): string {\n try {\n return JSON.stringify(batch, createSafeJsonReplacer())\n } catch {\n return `[${batch.map(serializeRecord).join(',')}]`\n }\n}\n\n/** Attribute by attribute, so one bad value can't drop unrelated records. */\nfunction serializeRecord(record: object): string {\n const attributes = Object.entries(record).flatMap(([key, value]) => {\n const serialized = serializeValue(value)\n // Omit undefined, as JSON.stringify does for object properties.\n return serialized === undefined\n ? []\n : [`${JSON.stringify(key)}:${serialized}`]\n })\n return `{${attributes.join(',')}}`\n}\n\nfunction serializeValue(value: unknown): string | undefined {\n try {\n return JSON.stringify(value, createSafeJsonReplacer())\n } catch {\n return JSON.stringify(UNSERIALIZABLE_DATA)\n }\n}\n\n/**\n * Resolves what `JSON.stringify` can't, inside the traversal it already makes.\n * `toJSON` runs before the replacer, so a throwing one escapes to the callers\n * above. Create one per `stringify`.\n */\nfunction createSafeJsonReplacer() {\n const ancestors: object[] = []\n\n return function (this: unknown, _key: string, value: unknown): unknown {\n if (typeof value === 'bigint') {\n return value.toString()\n }\n if (typeof value === 'function') {\n return `[Function] ${value.name || 'anonymous'}`\n }\n if (typeof value === 'symbol') {\n return `[Symbol] ${value.description ?? ''}`\n }\n if (value === null || typeof value !== 'object') {\n return value\n }\n\n // React values reference the fiber that rendered them, or themselves \u2014\n // internals either way, so mark the family instead of walking it.\n if ('$$typeof' in value) {\n return '[React]'\n }\n\n // `this` is the object `value` came from; unwinding to it leaves only true\n // ancestors, so a repeated sibling reference isn't read as a cycle.\n while (ancestors.length > 0 && ancestors[ancestors.length - 1] !== this) {\n ancestors.pop()\n }\n if (ancestors.includes(value)) {\n return '[Circular]'\n }\n ancestors.push(value)\n return value\n }\n}\n"],
|
|
5
|
+
"mappings": ";AAAA,SAAS,WAAW,2BAA2B;AAC/C,SAAS,gBAAgB;;;ACDzB,SAAS,aAAa;AACtB;AA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