@funkit/connect-rn 6.2.0 → 8.0.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 +148 -0
- package/README.md +97 -60
- package/dist/chunk-D64EJ57D.js +161 -0
- package/dist/chunk-D64EJ57D.js.map +7 -0
- package/dist/{chunk-VIMRV7N2.js → chunk-KZOSYNGV.js} +369 -207
- package/dist/chunk-KZOSYNGV.js.map +7 -0
- package/dist/{chunk-PLSQBNDE.js → chunk-SRVRWQO6.js} +5 -3
- package/dist/{chunk-PLSQBNDE.js.map → chunk-SRVRWQO6.js.map} +1 -1
- package/dist/clients/lighter.js +4 -2
- package/dist/clients/lighter.js.map +1 -1
- package/dist/clients/nado.js +5 -3
- package/dist/clients/nado.js.map +1 -1
- package/dist/clients/solana/index.d.ts +5 -0
- package/dist/clients/solana/index.d.ts.map +1 -0
- package/dist/clients/solana/solanaWithdrawal.d.ts +20 -0
- package/dist/clients/solana/solanaWithdrawal.d.ts.map +1 -0
- package/dist/clients/solana/useSolanaWithdrawal.d.ts +13 -0
- package/dist/clients/solana/useSolanaWithdrawal.d.ts.map +1 -0
- package/dist/clients/solana.d.ts +1 -0
- package/dist/clients/solana.js +87 -0
- package/dist/clients/solana.js.map +7 -0
- package/dist/index.d.ts +7 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7035 -2945
- package/dist/index.js.map +4 -4
- package/dist/src/components/Grabber.d.ts +3 -1
- package/dist/src/components/Grabber.d.ts.map +1 -1
- package/dist/src/components/LoadingSpinner.d.ts.map +1 -1
- package/dist/src/components/PillButton.d.ts.map +1 -1
- package/dist/src/components/v2/QuickAmountsRow.d.ts.map +1 -1
- package/dist/src/fiat/FiatChoiceField.d.ts +7 -1
- package/dist/src/fiat/FiatChoiceField.d.ts.map +1 -1
- package/dist/src/fiat/FiatCountrySheet.d.ts +11 -0
- package/dist/src/fiat/FiatCountrySheet.d.ts.map +1 -1
- package/dist/src/fiat/FiatFailureBanner.d.ts +14 -0
- package/dist/src/fiat/FiatFailureBanner.d.ts.map +1 -0
- package/dist/src/fiat/FiatFormScreen.d.ts +11 -1
- package/dist/src/fiat/FiatFormScreen.d.ts.map +1 -1
- package/dist/src/fiat/FiatIdentityStep.d.ts.map +1 -1
- package/dist/src/fiat/FiatKycFieldControl.d.ts +9 -2
- package/dist/src/fiat/FiatKycFieldControl.d.ts.map +1 -1
- package/dist/src/fiat/FiatKycOptionsScreen.d.ts.map +1 -1
- package/dist/src/fiat/FiatKycOutcomeScreen.d.ts +15 -2
- package/dist/src/fiat/FiatKycOutcomeScreen.d.ts.map +1 -1
- package/dist/src/fiat/FiatKycPhoneField.d.ts +21 -0
- package/dist/src/fiat/FiatKycPhoneField.d.ts.map +1 -0
- package/dist/src/fiat/FiatReceipt.d.ts +21 -0
- package/dist/src/fiat/FiatReceipt.d.ts.map +1 -0
- package/dist/src/fiat/FiatRegionUnsupportedScreen.d.ts +11 -0
- package/dist/src/fiat/FiatRegionUnsupportedScreen.d.ts.map +1 -0
- package/dist/src/fiat/FiatStatusScreen.d.ts.map +1 -1
- package/dist/src/fiat/FiatSubmissionIndicator.d.ts.map +1 -1
- package/dist/src/fiat/KycGlassBackdrop.d.ts.map +1 -1
- package/dist/src/fiat/ScreenSurfaceCover.d.ts +11 -0
- package/dist/src/fiat/ScreenSurfaceCover.d.ts.map +1 -0
- package/dist/src/fiat/SurfaceSlot.d.ts +12 -1
- package/dist/src/fiat/SurfaceSlot.d.ts.map +1 -1
- package/dist/src/fiat/depositOutcome.d.ts +33 -0
- package/dist/src/fiat/depositOutcome.d.ts.map +1 -0
- package/dist/src/fiat/fieldAutofill.d.ts.map +1 -1
- package/dist/src/fiat/formLayout.d.ts +12 -5
- package/dist/src/fiat/formLayout.d.ts.map +1 -1
- package/dist/src/fiat/formScreenProps.d.ts +4 -2
- package/dist/src/fiat/formScreenProps.d.ts.map +1 -1
- package/dist/src/fiat/kycFormPosition.d.ts +25 -1
- package/dist/src/fiat/kycFormPosition.d.ts.map +1 -1
- package/dist/src/fiat/kycFormState.d.ts +10 -0
- package/dist/src/fiat/kycFormState.d.ts.map +1 -1
- package/dist/src/fiat/kycUnavailableAlert.d.ts +21 -1
- package/dist/src/fiat/kycUnavailableAlert.d.ts.map +1 -1
- package/dist/src/fiat/methodName.d.ts +8 -0
- package/dist/src/fiat/methodName.d.ts.map +1 -0
- package/dist/src/fiat/providerFailover.d.ts +12 -0
- package/dist/src/fiat/providerFailover.d.ts.map +1 -0
- package/dist/src/fiat/providers/CoinbaseCheckoutSurface.d.ts +4 -2
- package/dist/src/fiat/providers/CoinbaseCheckoutSurface.d.ts.map +1 -1
- package/dist/src/fiat/providers/StripeSessionAuthController.d.ts +29 -0
- package/dist/src/fiat/providers/StripeSessionAuthController.d.ts.map +1 -0
- package/dist/src/fiat/providers/StripeSessionAuthScreen.d.ts +10 -0
- package/dist/src/fiat/providers/StripeSessionAuthScreen.d.ts.map +1 -0
- package/dist/src/fiat/providers/adapter.d.ts +6 -0
- package/dist/src/fiat/providers/adapter.d.ts.map +1 -1
- package/dist/src/fiat/providers/coinbaseOnrampEvents.d.ts +7 -3
- package/dist/src/fiat/providers/coinbaseOnrampEvents.d.ts.map +1 -1
- package/dist/src/fiat/providers/describeThrown.d.ts +14 -0
- package/dist/src/fiat/providers/describeThrown.d.ts.map +1 -0
- package/dist/src/fiat/providers/moonpay.d.ts.map +1 -1
- package/dist/src/fiat/providers/moonpayTrace.d.ts +25 -0
- package/dist/src/fiat/providers/moonpayTrace.d.ts.map +1 -0
- package/dist/src/fiat/providers/stripeAccountCreation.d.ts +12 -0
- package/dist/src/fiat/providers/stripeAccountCreation.d.ts.map +1 -0
- package/dist/src/fiat/providers/stripeAuthorize.d.ts +5 -0
- package/dist/src/fiat/providers/stripeAuthorize.d.ts.map +1 -0
- package/dist/src/fiat/providers/stripeCheckout.d.ts +28 -0
- package/dist/src/fiat/providers/stripeCheckout.d.ts.map +1 -0
- package/dist/src/fiat/providers/stripeKyc.d.ts +56 -0
- package/dist/src/fiat/providers/stripeKyc.d.ts.map +1 -0
- package/dist/src/fiat/providers/stripeKycInfo.d.ts +11 -0
- package/dist/src/fiat/providers/stripeKycInfo.d.ts.map +1 -0
- package/dist/src/fiat/providers/stripeOnramp.d.ts +135 -0
- package/dist/src/fiat/providers/stripeOnramp.d.ts.map +1 -0
- package/dist/src/fiat/providers/stripeOnrampBridge.d.ts +20 -0
- package/dist/src/fiat/providers/stripeOnrampBridge.d.ts.map +1 -0
- package/dist/src/fiat/providers/stripePayment.d.ts +34 -0
- package/dist/src/fiat/providers/stripePayment.d.ts.map +1 -0
- package/dist/src/fiat/providers/stripeSdk.d.ts +19 -0
- package/dist/src/fiat/providers/stripeSdk.d.ts.map +1 -0
- package/dist/src/fiat/providers/stripeSeamlessSignIn.d.ts +18 -0
- package/dist/src/fiat/providers/stripeSeamlessSignIn.d.ts.map +1 -0
- package/dist/src/fiat/providers/stripeSessionAuth.d.ts +43 -0
- package/dist/src/fiat/providers/stripeSessionAuth.d.ts.map +1 -0
- package/dist/src/fiat/providers/useStripeOnrampClient.d.ts +35 -0
- package/dist/src/fiat/providers/useStripeOnrampClient.d.ts.map +1 -0
- package/dist/src/fiat/quoteRefusal.d.ts +27 -0
- package/dist/src/fiat/quoteRefusal.d.ts.map +1 -1
- package/dist/src/fiat/renderCaptureSurface.d.ts +1 -1
- package/dist/src/fiat/renderCaptureSurface.d.ts.map +1 -1
- package/dist/src/fiat/sectionDetail.d.ts.map +1 -1
- package/dist/src/fiat/stepDetails.d.ts +5 -1
- package/dist/src/fiat/stepDetails.d.ts.map +1 -1
- package/dist/src/fiat/useFiatDirectDelivery.d.ts +5 -4
- package/dist/src/fiat/useFiatDirectDelivery.d.ts.map +1 -1
- package/dist/src/fiat/useIdentityAssertion.d.ts +35 -0
- package/dist/src/fiat/useIdentityAssertion.d.ts.map +1 -0
- package/dist/src/fiat/useKycCompletion.d.ts +11 -3
- package/dist/src/fiat/useKycCompletion.d.ts.map +1 -1
- package/dist/src/fiat/useQuoteableCeiling.d.ts +28 -0
- package/dist/src/fiat/useQuoteableCeiling.d.ts.map +1 -0
- package/dist/src/fiat/useStaleQuoteRecovery.d.ts +8 -1
- package/dist/src/fiat/useStaleQuoteRecovery.d.ts.map +1 -1
- package/dist/src/flow/DepositAmountStep.d.ts +4 -2
- package/dist/src/flow/DepositAmountStep.d.ts.map +1 -1
- package/dist/src/flow/DepositFlowContent.d.ts +4 -1
- package/dist/src/flow/DepositFlowContent.d.ts.map +1 -1
- package/dist/src/flow/DepositReceivedToast.d.ts +17 -0
- package/dist/src/flow/DepositReceivedToast.d.ts.map +1 -0
- package/dist/src/flow/FeeDetailsSheet.d.ts.map +1 -1
- package/dist/src/flow/FiatDepositAmountStep.d.ts +6 -2
- package/dist/src/flow/FiatDepositAmountStep.d.ts.map +1 -1
- package/dist/src/flow/FiatRegionBlockedStep.d.ts +14 -0
- package/dist/src/flow/FiatRegionBlockedStep.d.ts.map +1 -0
- package/dist/src/flow/FiatRegionPendingStep.d.ts +10 -0
- package/dist/src/flow/FiatRegionPendingStep.d.ts.map +1 -0
- package/dist/src/flow/FlowSheet.d.ts +14 -20
- package/dist/src/flow/FlowSheet.d.ts.map +1 -1
- package/dist/src/flow/FunkitFlowProvider.d.ts +18 -5
- package/dist/src/flow/FunkitFlowProvider.d.ts.map +1 -1
- package/dist/src/flow/SheetMaterial.d.ts +11 -0
- package/dist/src/flow/SheetMaterial.d.ts.map +1 -0
- package/dist/src/flow/StepPage.d.ts +16 -0
- package/dist/src/flow/StepPage.d.ts.map +1 -0
- package/dist/src/flow/WithdrawalFlowContent.d.ts.map +1 -1
- package/dist/src/flow/accountContext.d.ts +6 -0
- package/dist/src/flow/accountContext.d.ts.map +1 -0
- package/dist/src/flow/depositFlowConfig.d.ts +116 -31
- package/dist/src/flow/depositFlowConfig.d.ts.map +1 -1
- package/dist/src/flow/depositMethods.d.ts +21 -0
- package/dist/src/flow/depositMethods.d.ts.map +1 -0
- package/dist/src/flow/depositRailCopy.d.ts +20 -0
- package/dist/src/flow/depositRailCopy.d.ts.map +1 -0
- package/dist/src/flow/flowError.d.ts +47 -0
- package/dist/src/flow/flowError.d.ts.map +1 -0
- package/dist/src/flow/flowStepHeight.d.ts +19 -0
- package/dist/src/flow/flowStepHeight.d.ts.map +1 -0
- package/dist/src/flow/useDepositReceivedToast.d.ts +22 -0
- package/dist/src/flow/useDepositReceivedToast.d.ts.map +1 -0
- package/dist/src/flow/validateClientMetadata.d.ts +2 -3
- package/dist/src/flow/validateClientMetadata.d.ts.map +1 -1
- package/dist/src/flow/withdrawalFlowConfig.d.ts +5 -4
- package/dist/src/flow/withdrawalFlowConfig.d.ts.map +1 -1
- package/dist/src/geo/useFiatRegionSupport.d.ts +23 -0
- package/dist/src/geo/useFiatRegionSupport.d.ts.map +1 -0
- package/dist/src/hooks/useGuardedAmountInput.d.ts +15 -15
- package/dist/src/hooks/useGuardedAmountInput.d.ts.map +1 -1
- package/dist/src/hooks/usePressScale.d.ts +22 -3
- package/dist/src/hooks/usePressScale.d.ts.map +1 -1
- package/dist/src/hooks/useSheetFade.d.ts +11 -0
- package/dist/src/hooks/useSheetFade.d.ts.map +1 -0
- package/dist/src/icons/FigmaSystemIcons.d.ts +1 -0
- package/dist/src/icons/FigmaSystemIcons.d.ts.map +1 -1
- package/dist/src/icons/KycIdentityIcon.d.ts +2 -1
- package/dist/src/icons/KycIdentityIcon.d.ts.map +1 -1
- package/dist/src/icons/KycStatusIcon.d.ts +1 -1
- package/dist/src/icons/KycStatusIcon.d.ts.map +1 -1
- package/dist/src/icons/kycArtwork.d.ts +15 -0
- package/dist/src/icons/kycArtwork.d.ts.map +1 -1
- package/dist/src/identity/IdentityContext.d.ts +31 -8
- package/dist/src/identity/IdentityContext.d.ts.map +1 -1
- package/dist/src/logging/debugBridge.d.ts +13 -0
- package/dist/src/logging/debugBridge.d.ts.map +1 -0
- package/dist/src/native/glassEffect.d.ts +18 -0
- package/dist/src/native/glassEffect.d.ts.map +1 -0
- package/dist/src/providers/FunkitProvider.d.ts +18 -9
- package/dist/src/providers/FunkitProvider.d.ts.map +1 -1
- package/dist/src/providers/NativeCapabilitiesContext.d.ts +20 -14
- package/dist/src/providers/NativeCapabilitiesContext.d.ts.map +1 -1
- package/dist/src/providers/useFrozenIdentity.d.ts +19 -0
- package/dist/src/providers/useFrozenIdentity.d.ts.map +1 -0
- package/dist/src/providers/useFunkitCheckout.d.ts +7 -3
- package/dist/src/providers/useFunkitCheckout.d.ts.map +1 -1
- package/dist/src/screens/DepositAmountScreen.d.ts +1 -1
- package/dist/src/screens/DepositAmountScreen.d.ts.map +1 -1
- package/dist/src/screens/FeeDetailsScreen.d.ts +7 -13
- package/dist/src/screens/FeeDetailsScreen.d.ts.map +1 -1
- package/dist/src/screens/WithdrawAddressScreen.d.ts.map +1 -1
- package/dist/src/screens/WithdrawAmountScreen.d.ts.map +1 -1
- package/dist/src/screens/WithdrawCompleteScreen.d.ts.map +1 -1
- package/dist/src/screens/depositMetrics.d.ts +2 -3
- package/dist/src/screens/depositMetrics.d.ts.map +1 -1
- package/dist/src/statsig/useStatsigReady.d.ts +11 -0
- package/dist/src/statsig/useStatsigReady.d.ts.map +1 -0
- package/dist/src/swapped/SwappedWebView.d.ts.map +1 -1
- package/dist/src/swapped/SwappedWithdrawScreen.d.ts +3 -1
- package/dist/src/swapped/SwappedWithdrawScreen.d.ts.map +1 -1
- package/dist/src/swapped/paymentNavigation.d.ts +21 -0
- package/dist/src/swapped/paymentNavigation.d.ts.map +1 -0
- package/dist/src/theme/buildFunkitTheme.d.ts +15 -11
- package/dist/src/theme/buildFunkitTheme.d.ts.map +1 -1
- package/dist/src/theme/restyle.d.ts +495 -363
- package/dist/src/theme/restyle.d.ts.map +1 -1
- package/dist/src/theme/toRestyleTheme.d.ts +45 -33
- package/dist/src/theme/toRestyleTheme.d.ts.map +1 -1
- package/dist/src/theme/tokens.d.ts +5 -5
- package/dist/src/theme/tokens.d.ts.map +1 -1
- package/dist/src/transfer/hooks/useDepositRecipient.d.ts +2 -2
- package/dist/src/transfer/hooks/useDepositRecipient.d.ts.map +1 -1
- package/dist/src/transfer/hooks/useTokenTransfer.d.ts +3 -2
- package/dist/src/transfer/hooks/useTokenTransfer.d.ts.map +1 -1
- package/dist/src/transfer/hooks/useTransferInit.d.ts +2 -3
- package/dist/src/transfer/hooks/useTransferInit.d.ts.map +1 -1
- package/dist/src/utils/formatAmount.d.ts +4 -3
- package/dist/src/utils/formatAmount.d.ts.map +1 -1
- package/dist/src/utils/motion.d.ts +18 -0
- package/dist/src/utils/motion.d.ts.map +1 -1
- package/dist/src/withdrawal/fiatTargetDecimals.d.ts +13 -0
- package/dist/src/withdrawal/fiatTargetDecimals.d.ts.map +1 -0
- package/dist/src/withdrawal/useCryptoWithdrawalForm.d.ts.map +1 -1
- package/dist/src/withdrawal/useSourceTokenDecimals.d.ts.map +1 -1
- package/dist/src/withdrawal/useWithdrawalExecution.d.ts.map +1 -1
- package/dist/src/withdrawal/useWithdrawalSourceTokenBalance.d.ts +11 -0
- package/dist/src/withdrawal/useWithdrawalSourceTokenBalance.d.ts.map +1 -0
- package/expo-module.config.json +6 -0
- package/ios/FunkitGlassEffect.podspec +23 -0
- package/ios/FunkitGlassEffectModule.swift +126 -0
- package/ios/GlassStyle.swift +52 -0
- package/ios/GlassView.swift +305 -0
- package/package.json +23 -7
- package/dist/chunk-VIMRV7N2.js.map +0 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,153 @@
|
|
|
1
1
|
# @funkit/connect-rn
|
|
2
2
|
|
|
3
|
+
## 8.0.0
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- fd90e03: The deposit sheets' Liquid Glass material now ships inside the SDK, so a host installs nothing and passes nothing for it.
|
|
8
|
+
|
|
9
|
+
Migration: `expo` and `expo-blur` are now peer dependencies — install both, then rebuild your binary so the SDK's `FunkitGlassEffect` pod links. Drop `renderBackdropBlur` and `liquidGlass` from `FunkitProvider` unless you need a different material; a kept `renderBackdropBlur` takes no arguments now (`BackdropBlurRenderer` is `() => ReactNode`).
|
|
10
|
+
- 28c7128: Deposits await the sheet, hosts pass their identity minter by ref, and a failed identity check now tells the host whether to sign the user back in, stop, or retry.
|
|
11
|
+
|
|
12
|
+
`checkoutConfig.targetAsset` also accepts a Solana mint, so Solana USDC targets need no cast.
|
|
13
|
+
|
|
14
|
+
**Migration**
|
|
15
|
+
|
|
16
|
+
- `beginDeposit` now returns `Promise<void>` that resolves once the flow is on screen. It also resolves (never rejects) if a newer `beginDeposit` replaced it or the flow closed first, so fire-and-forget callers get no unhandled rejection; check `onDepositError` for failures. A misconfigured flow still throws synchronously at the call, so existing `try { beginDeposit(cfg) } catch {}` keeps working; `await` it to know when the sheet is up.
|
|
17
|
+
- Pass `getIdentityAssertionRef` (a `useRef` holding your minter) on `FunkitProvider`'s `config`. `getIdentityAssertion` still works but is deprecated.
|
|
18
|
+
- Have your minter reject with `code: 'SESSION_EXPIRED' | 'ACCOUNT_INELIGIBLE' | 'TRANSIENT'`. `onDepositError` gains the `session_expired` code: the flow has closed — re-authenticate the user and call `beginDeposit` again.
|
|
19
|
+
|
|
20
|
+
### Minor Changes
|
|
21
|
+
|
|
22
|
+
- 387e230: Fiat deposits with an identity minter let the backend resolve the recipient from the verified assertion without a frontend wallet address.
|
|
23
|
+
- a1f9be5: Accept an explicit gross destination-token deposit cap in client metadata, independently of the fiat input amount.
|
|
24
|
+
- 01c1797: Withdraw USDC from a connected Solana wallet, to crypto or to cash, through the new opt-in Solana withdrawal entry.
|
|
25
|
+
|
|
26
|
+
### Patch Changes
|
|
27
|
+
|
|
28
|
+
- fd90e03: Deposit amount digits use their natural widths instead of tabular spacing.
|
|
29
|
+
- afbd9e5: Allow hosts to send debug events through the configured Funkit logging pipeline.
|
|
30
|
+
- 50fe735: Full-height withdrawal steps fill the container the flow is mounted in rather than the browser window, so a host dialog no longer clips the foot of the screen.
|
|
31
|
+
- d7f401e: Hide the deposit max route on the identity options card and offer a way to close the deposit instead
|
|
32
|
+
- 9fcba82: An amount over the buyer's own limit is now answered on the amount field, naming the cap that refused and offering the way down to it, instead of an alert the buyer has to dismiss before they can act. The alert remains for a refusal that carries no cap under the entered amount.
|
|
33
|
+
- c452c25: The amount screen now learns the buyer's spending ceiling before it asks for a price, so an amount over it is answered immediately instead of buying a refusal.
|
|
34
|
+
- e056364: Fix the withdrawal amount screen laying out wrongly and the flow sheet logging a nested-button DOM error under react-native-web.
|
|
35
|
+
- 3889bd1: The Liquid Glass deposit sheet takes a lighter tint, so more of the host app reads through it.
|
|
36
|
+
- fd90e03: Fade the deposit sheet's grabber in with the sheet instead of showing it at full strength mid-rise.
|
|
37
|
+
- 91a2785: Remove the close button from the fee details drawer
|
|
38
|
+
- 30c01e5: Support withdrawals from non-EVM source tokens on the React Native crypto and cash rails.
|
|
39
|
+
- 6c28263: Document Solana withdrawal setup.
|
|
40
|
+
- 32d3ac1: Keep the Swapped card payment journey inside the WebView instead of handing it to the system browser
|
|
41
|
+
- Updated dependencies [d4de552]
|
|
42
|
+
- Updated dependencies [28c7128]
|
|
43
|
+
- Updated dependencies [30c01e5]
|
|
44
|
+
- Updated dependencies [d4de552]
|
|
45
|
+
- Updated dependencies [12a70d7]
|
|
46
|
+
- Updated dependencies [c452c25]
|
|
47
|
+
- @funkit/api-base@8.5.0
|
|
48
|
+
- @funkit/connect-core@8.3.0
|
|
49
|
+
|
|
50
|
+
## 7.0.0
|
|
51
|
+
|
|
52
|
+
### Major Changes
|
|
53
|
+
|
|
54
|
+
- 642346f: Fee details drawer matches the design's type, spacing and attribution mark
|
|
55
|
+
|
|
56
|
+
Migration: register a third Inter cut, `Inter-SemiBold`, alongside `Inter-Regular` and `Inter-Medium`. Until then the semibold weight falls back to the platform system font. A hand-built `FunkitFontTokens` needs a `body.weight.semibold` entry.
|
|
57
|
+
- 3bf7a60: `@stripe/stripe-react-native` is now an optional peer dependency, loaded only when a host configures Stripe, so hosts without Stripe never link or evaluate its native module.
|
|
58
|
+
|
|
59
|
+
**Breaking:** the SDK is no longer a dependency of this package. Nothing changes for a host that does not pass `stripeOnramp` to `FunkitProvider`: no install, no rebuild, and Expo Go keeps working.
|
|
60
|
+
|
|
61
|
+
**Migration for hosts using Stripe.** Install the SDK in your app and link its Onramp module, then rebuild the native binary. The Stripe rail cannot run in Expo Go.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
pnpm add @stripe/stripe-react-native
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
```jsonc
|
|
68
|
+
// app.json / app.config.ts (Expo)
|
|
69
|
+
"plugins": [["@stripe/stripe-react-native", { "includeOnramp": true }]]
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Bare React Native autolinks the base module but not Onramp: add `pod 'stripe-react-native/Onramp'` to your Podfile and `StripeSdk_includeOnramp=true` to `gradle.properties`, then `pod install` and rebuild. A JS-only update (EAS Update, CodePush) cannot add the native module, so ship a store build before enabling `stripeOnramp` for users.
|
|
73
|
+
- c4ea859: Bind Stripe's SDK inside the package instead of asking hosts to implement a client
|
|
74
|
+
|
|
75
|
+
**Breaking:** `StripeOnrampClient` and its ten supporting types (`StripeAuthorizeResult`, `StripeHasLinkAccountResult`, `StripeKycInfo`, `StripeLinkRegistration`, `StripeOnrampError`, `StripeRegisterLinkUserResult`, `StripeCollectPaymentMethodResult`, `StripeCreateCryptoPaymentTokenResult`, `StripePlatformPayParams`, `StripeVoidResult`) are no longer exported, and `<FunkitProvider stripeOnramp>` now takes `StripeOnrampConfig` rather than a client.
|
|
76
|
+
|
|
77
|
+
**Migration.** Delete your Stripe boundary component, keep `@stripe/stripe-react-native` installed in your app (it is an optional peer of this package), and pass the configuration straight to the provider:
|
|
78
|
+
|
|
79
|
+
```diff
|
|
80
|
+
-<StripeOnrampBoundary config={stripeConfig}>
|
|
81
|
+
- {(stripeOnramp) => <FunkitProvider stripeOnramp={stripeOnramp}>{children}</FunkitProvider>}
|
|
82
|
+
-</StripeOnrampBoundary>
|
|
83
|
+
+<FunkitProvider
|
|
84
|
+
+ stripeOnramp={{
|
|
85
|
+
+ publishableKey: STRIPE_PUBLISHABLE_KEY,
|
|
86
|
+
+ merchantDisplayName: 'Your App',
|
|
87
|
+
+ merchantIdentifier: 'merchant.your.app',
|
|
88
|
+
+ urlScheme: 'your-app',
|
|
89
|
+
+ }}
|
|
90
|
+
+>
|
|
91
|
+
+ {children}
|
|
92
|
+
+</FunkitProvider>
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
Omit `stripeOnramp` and no Stripe code runs. Apple Pay still requires a native rebuild, because the Apple Merchant ID is an app entitlement.
|
|
96
|
+
|
|
97
|
+
### Minor Changes
|
|
98
|
+
|
|
99
|
+
- 67085fd: Direct fiat deposits now settle on Coinbase's own success event and report it through `onDepositSubmitted`, replacing the status screens with a confirmation toast.
|
|
100
|
+
- 1bccb47: Refuse an unsupported region before the deposit amount screen, instead of after a quote or a KYC form.
|
|
101
|
+
- 6594183: Resolve whether fiat deposits are served in the buyer's region from their IP, and log the decision.
|
|
102
|
+
- f2ac65e: Add the unsupported-region receipt, which closes back to the host app instead of offering a retry.
|
|
103
|
+
- 00e8eae: Fiat deposit methods can pin quotes to a chosen set of providers when testing against a non-production backend; production refuses it.
|
|
104
|
+
- cd5ac82: Correlate a flow's logs under one trace id, and expose `getFunkitTraceInfo` / `flushFunkitLogs` for host debug tooling.
|
|
105
|
+
- 400e5f6: Configure deposit payment methods and their fiat target assets while preserving existing deposit behavior.
|
|
106
|
+
- 400e5f6: Localize deposit payment labels, fee details, and payment badges automatically.
|
|
107
|
+
- 400e5f6: Report deposit outcomes and standardize flow errors with codes and retry flags.
|
|
108
|
+
- 400e5f6: Keep the active user identity stable until an open flow closes.
|
|
109
|
+
- 400e5f6: Format deposit balances and support asynchronously loaded withdrawal balances in React Native flows.
|
|
110
|
+
- bc00257: Add an optional Stripe Embedded Components session-auth capability to the managed fiat flow.
|
|
111
|
+
|
|
112
|
+
### Patch Changes
|
|
113
|
+
|
|
114
|
+
- fba9acb: Turn between the deposit amount screen and the pages after it instead of cutting
|
|
115
|
+
- 1939601: Country picker: a close button over the list, the chosen country headed "Your Country", and an index rail that appears once the list is scrolled
|
|
116
|
+
- fa27e56: Lighten the deposit sheet and fee drawer so the host's material reads through, give the drawer the design's drop shadow, and keep opaque flow sheets filled on Liquid Glass hosts.
|
|
117
|
+
- 142dfed: more useful error states for failed quoting
|
|
118
|
+
- ceb94c5: Report a fiat payment failure as a banner over the deposit header instead of a notice beside the action.
|
|
119
|
+
- d532b7d: The test-only fiat provider override is now `unstable_routingOverrides`, so it is not reached by accident.
|
|
120
|
+
- b23016a: Remove the bright line down the deposit sheet's edges and across the fee drawer's head.
|
|
121
|
+
- d7b5ef8: Deposits now have a maximum: over it the amount jolts, the screen names the cap and offers "Change to maximum", and an over-limit refusal says what the ceiling is.
|
|
122
|
+
- 085ecd5: The identity acknowledgement waits four seconds before showing its verdict, and Continue hands the deposit amount back instead of closing the flow.
|
|
123
|
+
- 154a1bb: The KYC country chooser opens on the country the field already holds instead of at the top of the list
|
|
124
|
+
- 154a1bb: Draw MoonPay's customer due diligence round as its own KYC pages.
|
|
125
|
+
- c6fc603: The KYC glyphs now fade from the host's brand color instead of grey.
|
|
126
|
+
- 35e4cbd: Stop the identity form opening with a refusal banner about the round before it.
|
|
127
|
+
- 154a1bb: Fix the MoonPay deposit's KYC and failure screens: forms stay usable when a quote lapses, a captured payment is never charged twice, and a refused authorization says what to do next.
|
|
128
|
+
- 154a1bb: Reuse active MoonPay connections and complete quote challenges without asking returning customers to authenticate again.
|
|
129
|
+
- 997387f: Deposit amount pills now use the screen's number style and Figma's tighter spacing.
|
|
130
|
+
- 142dfed: A deposit now has one maximum and one answer to it. Whichever ceiling binds — the host's, the corridor's, or the buyer's own remaining allowance reported by a refusal — the amount jolts, the screen names the figure, and a single tap changes the amount to it. The invented $2,500 fallback is gone, so the only maximum a buyer is shown is one that is really enforced, and $1,000,000 is the sole hard bound on what can be typed.
|
|
131
|
+
- d4a167c: Give the primary action a press response, so a submission reads as taken.
|
|
132
|
+
- e6addf8: Fee rates in the deposit fee details drawer are always written to two decimals (e.g. 4.20%).
|
|
133
|
+
- f147595: Deposit maximums are now remembered for the session, so an amount already known to be over the maximum is answered immediately.
|
|
134
|
+
- 4b42434: Speed the loading ring up to a turn every 600ms.
|
|
135
|
+
- c4ea859: Report why Stripe authorization failed instead of "[object Object]".
|
|
136
|
+
- c4ea859: Complete a Stripe purchase that needs a card confirmation step.
|
|
137
|
+
- c4ea859: Fix Stripe's KYC rounds dead-ending after the first one.
|
|
138
|
+
- c4ea859: Sign a returning buyer back into Stripe without a second one-time code.
|
|
139
|
+
- Updated dependencies [142dfed]
|
|
140
|
+
- Updated dependencies [1bccb47]
|
|
141
|
+
- Updated dependencies [38e9946]
|
|
142
|
+
- Updated dependencies [d532b7d]
|
|
143
|
+
- Updated dependencies [00e8eae]
|
|
144
|
+
- Updated dependencies [cd5ac82]
|
|
145
|
+
- Updated dependencies [154a1bb]
|
|
146
|
+
- Updated dependencies [f147595]
|
|
147
|
+
- Updated dependencies [c4ea859]
|
|
148
|
+
- Updated dependencies [bc00257]
|
|
149
|
+
- @funkit/connect-core@8.2.0
|
|
150
|
+
|
|
3
151
|
## 6.2.0
|
|
4
152
|
|
|
5
153
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -39,6 +39,17 @@ log transports, identity context, and transfer hooks are **internal** (mirroring
|
|
|
39
39
|
`@funkit/connect`, which exports none of them). When adding a public export, wire
|
|
40
40
|
it explicitly in `index.ts`.
|
|
41
41
|
|
|
42
|
+
## Payment deposit metadata
|
|
43
|
+
|
|
44
|
+
`clientMetadata.authorizedAmountBaseUnit` is an explicit maximum gross deposit
|
|
45
|
+
in destination-token base units, forwarded unchanged to `POST /eoa`. For Base
|
|
46
|
+
EURC, `'20000000'` caps the gross deposit at 20 EURC before fees. It is separate
|
|
47
|
+
from `initialAmount` (fiat input), `lockAmount` (UI editing), and actual net credit;
|
|
48
|
+
no cap is inferred. Supply a positive integer string of 1–30 digits without leading
|
|
49
|
+
zeros, or `beginDeposit` throws `FunkitMisconfiguredError` before opening.
|
|
50
|
+
The field is optional in the SDK; Betty's backend requires it with the payment
|
|
51
|
+
IDs and rejects a different cap or destination when reusing the same payment ID.
|
|
52
|
+
|
|
42
53
|
## MoonPay crypto setup
|
|
43
54
|
|
|
44
55
|
MoonPay requires a secure `globalThis.crypto.getRandomValues` implementation on
|
|
@@ -156,6 +167,20 @@ Two deliberate choices keep it that way:
|
|
|
156
167
|
copy degrades to a no-op + warning rather than crashing. A host injects its own
|
|
157
168
|
writer via `FunkitProvider`'s `copyToClipboard` (e.g. `expo-clipboard`), and
|
|
158
169
|
that override runs instead, so the throwing path never executes.
|
|
170
|
+
- **Stripe is an optional peer, loaded on demand.** `@stripe/stripe-react-native`
|
|
171
|
+
is a native module *not* in Expo Go, and it throws at import time on a binary
|
|
172
|
+
without its pod. Nothing names the package outside the guarded `import()` in
|
|
173
|
+
`src/fiat/providers/stripeSdk.ts`, which `StripeOnrampBridge` runs only after a
|
|
174
|
+
host passed `stripeOnramp` to `FunkitProvider`. A host that never configures
|
|
175
|
+
Stripe never installs it and never links it. A host that wants Stripe installs
|
|
176
|
+
it, enables its Onramp module (Expo: the config plugin with
|
|
177
|
+
`includeOnramp: true`; bare RN: `stripe-react-native/Onramp` in the Podfile and
|
|
178
|
+
`StripeSdk_includeOnramp=true` in `gradle.properties`), and rebuilds; that
|
|
179
|
+
rail cannot run in Expo Go.
|
|
180
|
+
- **The glass module is optional at runtime.** `FunkitGlassEffect` (this
|
|
181
|
+
package's `ios/`) is not in Expo Go. `src/native/glassEffect.ts` looks it up
|
|
182
|
+
with `requireOptionalNativeModule`, so an unlinked binary renders the
|
|
183
|
+
`expo-blur` fallback (which Expo Go bundles) instead of throwing.
|
|
159
184
|
- **No `react-native-device-info`.** `src/statsig/statsigMetadata.ts` vendors the
|
|
160
185
|
Statsig metadata adapter with the `react-native-device-info` dependency removed
|
|
161
186
|
(it's a native module that needs a dev build). The app-version / device-model
|
|
@@ -163,67 +188,34 @@ Two deliberate choices keep it that way:
|
|
|
163
188
|
built-in `Platform` / `NativeModules` (no extra native dep). Geo/IP resolution
|
|
164
189
|
uses plain `fetch`.
|
|
165
190
|
|
|
166
|
-
**Contributor rule:** don't add a hard top-level import of a
|
|
167
|
-
|
|
168
|
-
|
|
191
|
+
**Contributor rule:** don't add a hard top-level import of a native module that
|
|
192
|
+
Expo Go doesn't bundle. If you genuinely need one, make it optional + lazily
|
|
193
|
+
imported + guarded with a host-injectable override, the way clipboard is — or,
|
|
194
|
+
for a native view of our own, look it up as an optional module the way the glass
|
|
195
|
+
view is.
|
|
169
196
|
|
|
170
197
|
## Sheet material (blur / Liquid Glass)
|
|
171
198
|
|
|
172
199
|
The V2 deposit sheet and the drawers over it (fee details, country list, KYC
|
|
173
200
|
choosers) are drawn on glass: the design's Figma layer is a dark fill with a
|
|
174
|
-
**Glass** effect, which is iOS 26's Liquid Glass. The SDK ships
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
```tsx
|
|
193
|
-
import { BlurView } from 'expo-blur'
|
|
194
|
-
import { GlassView, isLiquidGlassAvailable } from 'expo-glass-effect'
|
|
195
|
-
import { StyleSheet } from 'react-native'
|
|
196
|
-
|
|
197
|
-
const liquidGlass = isLiquidGlassAvailable()
|
|
198
|
-
|
|
199
|
-
const renderBackdropBlur = ({ tint }: { tint: string }) =>
|
|
200
|
-
liquidGlass ? (
|
|
201
|
-
<GlassView
|
|
202
|
-
glassEffectStyle="regular" // the frosted cut the design draws
|
|
203
|
-
tintColor={tint}
|
|
204
|
-
colorScheme="dark" // the SDK carries its own theme
|
|
205
|
-
style={StyleSheet.absoluteFill}
|
|
206
|
-
/>
|
|
207
|
-
) : (
|
|
208
|
-
<BlurView tint="default" intensity={90} style={StyleSheet.absoluteFill} />
|
|
209
|
-
)
|
|
210
|
-
|
|
211
|
-
<FunkitProvider renderBackdropBlur={renderBackdropBlur} liquidGlass={liquidGlass} />
|
|
212
|
-
```
|
|
213
|
-
|
|
214
|
-
Bare React Native — [`@callstack/liquid-glass`](https://github.com/callstack/liquid-glass)
|
|
215
|
-
(RN 0.80+, Xcode 26) and
|
|
216
|
-
[`@react-native-community/blur`](https://github.com/react-native-community/react-native-blur)
|
|
217
|
-
take the same shape. `LiquidGlassView` names the props `effect` / `tintColor` /
|
|
218
|
-
`colorScheme`, and `isLiquidGlassSupported` is a constant rather than a
|
|
219
|
-
function — it reads `false` on a binary built without the module, where
|
|
220
|
-
`isLiquidGlassAvailable()` throws.
|
|
221
|
-
|
|
222
|
-
Neither glass module is bundled in Expo Go, so a development build is needed.
|
|
223
|
-
Liquid Glass exists on iOS 26 only; Android and earlier iOS take the blur
|
|
224
|
-
branch, so always ship both. The
|
|
225
|
-
[`with-expo`](../../apps/with-expo/components/BackdropBlur.tsx) playground is a
|
|
226
|
-
working example of the Expo pair.
|
|
201
|
+
**Glass** effect, which is iOS 26's Liquid Glass. The SDK ships that material
|
|
202
|
+
itself (`src/flow/SheetMaterial.tsx`): an `expo-blur` blur of the host app with
|
|
203
|
+
the SDK's own Liquid Glass view refracting through it. The tint is the
|
|
204
|
+
material's — every surface renders it as is, and none passes one in.
|
|
205
|
+
|
|
206
|
+
The glass view is a native module this package carries under `ios/`
|
|
207
|
+
(`FunkitGlassEffect`, forked from `expo-glass-effect` with iOS 26's
|
|
208
|
+
container-concentric corners added, so the slab's corners match the device's).
|
|
209
|
+
Expo autolinking picks it up from `expo-module.config.json`; a host rebuilds
|
|
210
|
+
its binary once after upgrading. Where the pod isn't linked — Android, Expo Go,
|
|
211
|
+
a binary built before the upgrade — `src/native/glassEffect.ts` reads the
|
|
212
|
+
module as absent, the blur stands alone, and each surface paints its fill over
|
|
213
|
+
it, as the blur path always has.
|
|
214
|
+
|
|
215
|
+
`expo` and `expo-blur` are peer dependencies for this. A host that wants a
|
|
216
|
+
different native material still has `FunkitProvider`'s `renderBackdropBlur`,
|
|
217
|
+
paired with `liquidGlass` when that view is Liquid Glass; the SDK then paints
|
|
218
|
+
no fill over it.
|
|
227
219
|
|
|
228
220
|
## Lighter withdrawals
|
|
229
221
|
|
|
@@ -306,6 +298,44 @@ required by the config type and reserved for that rail, so it must be supplied
|
|
|
306
298
|
even though nothing calls it today; a stub is fine. Same for the optional
|
|
307
299
|
`getSecureMinWithdrawalAmount`.
|
|
308
300
|
|
|
301
|
+
## Solana withdrawals
|
|
302
|
+
|
|
303
|
+
Solana lives on its own entry, `@funkit/connect-rn/clients/solana`, so a host
|
|
304
|
+
that never configures it carries none of it. The host owns the Solana wallet
|
|
305
|
+
connection; the SDK takes the connected wallet's signer and builds a withdrawal
|
|
306
|
+
config over it. USDC on Solana is the only source today, and both the crypto
|
|
307
|
+
and the cash (Swapped) methods work from it.
|
|
308
|
+
|
|
309
|
+
```tsx
|
|
310
|
+
import { useFunkitCheckout } from '@funkit/connect-rn'
|
|
311
|
+
import { useSolanaWithdrawal } from '@funkit/connect-rn/clients/solana'
|
|
312
|
+
import { useMemo } from 'react'
|
|
313
|
+
|
|
314
|
+
// Both inputs are compared by identity, so keep them stable across renders.
|
|
315
|
+
const solana = useMemo(() => ({ signer: solanaWallet }), [solanaWallet])
|
|
316
|
+
const config = useMemo(
|
|
317
|
+
() => ({
|
|
318
|
+
defaultReceiveToken: 'USDC',
|
|
319
|
+
// Your own accounting for the spendable balance, if you have it.
|
|
320
|
+
withdrawalSourceTokenBalance: () => usdcBalance,
|
|
321
|
+
}),
|
|
322
|
+
[usdcBalance],
|
|
323
|
+
)
|
|
324
|
+
// `solanaWallet`: a base58 address, the RPC connection funkit submits through,
|
|
325
|
+
// and one of `signTransaction` / `signAndSendTransaction`.
|
|
326
|
+
const withdrawal = useSolanaWithdrawal({ solana, config })
|
|
327
|
+
|
|
328
|
+
const { beginWithdrawal } = useFunkitCheckout()
|
|
329
|
+
// `undefined` while the signer is absent or its address is not base58.
|
|
330
|
+
if (withdrawal) beginWithdrawal(withdrawal)
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
Install `@solana/web3.js` (an optional peer) and give Hermes what it lacks
|
|
334
|
+
before importing the SDK: `Buffer` (the `buffer` package), a full `URL`
|
|
335
|
+
(`react-native-url-polyfill/auto`), and `crypto.getRandomValues` as described
|
|
336
|
+
under [MoonPay crypto setup](#moonpay-crypto-setup). Point the connection at an
|
|
337
|
+
RPC you control; Solana's public endpoints rate-limit.
|
|
338
|
+
|
|
309
339
|
## Local development
|
|
310
340
|
|
|
311
341
|
> No root shortcut exists for this package — use the `pnpm --filter` form (or
|
|
@@ -378,9 +408,9 @@ Android matches custom fonts by exact family-name string, and a font loaded at
|
|
|
378
408
|
runtime registers one native typeface per name — so `fontWeight: '500'` on a
|
|
379
409
|
custom `Inter` family is silently ignored. connect-rn therefore expresses weight
|
|
380
410
|
through the **family name** (set `family` + a per-weight `familySuffix`), and the
|
|
381
|
-
host registers **each cut under its own name** —
|
|
382
|
-
`Inter-
|
|
383
|
-
hardcode them.
|
|
411
|
+
host registers **each cut under its own name** — `Inter-Regular`, `Inter-Medium`
|
|
412
|
+
and `Inter-SemiBold`. Use `fontFamilyForWeight(...)` to resolve those names so you
|
|
413
|
+
don't hardcode them.
|
|
384
414
|
|
|
385
415
|
Define the font tokens in your host app, load the files **before rendering
|
|
386
416
|
`<FunkitProvider>`** (if a name is missing, that text falls back to the system
|
|
@@ -388,7 +418,12 @@ font), and build your theme with them. Example with Expo (`expo-font` +
|
|
|
388
418
|
`@expo-google-fonts/inter`):
|
|
389
419
|
|
|
390
420
|
```tsx
|
|
391
|
-
import {
|
|
421
|
+
import {
|
|
422
|
+
useFonts,
|
|
423
|
+
Inter_400Regular,
|
|
424
|
+
Inter_500Medium,
|
|
425
|
+
Inter_600SemiBold,
|
|
426
|
+
} from '@expo-google-fonts/inter'
|
|
392
427
|
import {
|
|
393
428
|
type FunkitFontTokens,
|
|
394
429
|
fontFamilyForWeight,
|
|
@@ -403,6 +438,7 @@ const interFonts: FunkitFontTokens = {
|
|
|
403
438
|
weights: {
|
|
404
439
|
base: { familySuffix: 'Regular', cssWeight: '400' },
|
|
405
440
|
medium: { familySuffix: 'Medium', cssWeight: '500' },
|
|
441
|
+
semibold: { familySuffix: 'SemiBold', cssWeight: '600' },
|
|
406
442
|
},
|
|
407
443
|
}
|
|
408
444
|
|
|
@@ -415,6 +451,7 @@ export default function App() {
|
|
|
415
451
|
const [fontsLoaded] = useFonts({
|
|
416
452
|
[fontFamilyForWeight(interFonts, 'base')]: Inter_400Regular, // 'Inter-Regular'
|
|
417
453
|
[fontFamilyForWeight(interFonts, 'medium')]: Inter_500Medium, // 'Inter-Medium'
|
|
454
|
+
[fontFamilyForWeight(interFonts, 'semibold')]: Inter_600SemiBold, // 'Inter-SemiBold'
|
|
418
455
|
})
|
|
419
456
|
if (!fontsLoaded) return null // or a splash screen
|
|
420
457
|
return <FunkitProvider themes={themes} {...}>{/* … */}</FunkitProvider>
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
// src/logging/logger.ts
|
|
2
|
+
import { FunLogger } from "@funkit/connect-core";
|
|
3
|
+
|
|
4
|
+
// src/logging/serializeLogBatch.ts
|
|
5
|
+
var UNSERIALIZABLE_DATA = "[Unserializable]";
|
|
6
|
+
function serializeLogBatch(batch) {
|
|
7
|
+
try {
|
|
8
|
+
return JSON.stringify(batch, createSafeJsonReplacer());
|
|
9
|
+
} catch {
|
|
10
|
+
return `[${batch.map(serializeRecord).join(",")}]`;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
function serializeRecord(record) {
|
|
14
|
+
const attributes = Object.entries(record).flatMap(([key, value]) => {
|
|
15
|
+
const serialized = serializeValue(value);
|
|
16
|
+
return serialized === void 0 ? [] : [`${JSON.stringify(key)}:${serialized}`];
|
|
17
|
+
});
|
|
18
|
+
return `{${attributes.join(",")}}`;
|
|
19
|
+
}
|
|
20
|
+
function serializeValue(value) {
|
|
21
|
+
try {
|
|
22
|
+
return JSON.stringify(value, createSafeJsonReplacer());
|
|
23
|
+
} catch {
|
|
24
|
+
return JSON.stringify(UNSERIALIZABLE_DATA);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function createSafeJsonReplacer() {
|
|
28
|
+
const ancestors = [];
|
|
29
|
+
return function(_key, value) {
|
|
30
|
+
if (typeof value === "bigint") {
|
|
31
|
+
return value.toString();
|
|
32
|
+
}
|
|
33
|
+
if (typeof value === "function") {
|
|
34
|
+
return `[Function] ${value.name || "anonymous"}`;
|
|
35
|
+
}
|
|
36
|
+
if (typeof value === "symbol") {
|
|
37
|
+
return `[Symbol] ${value.description ?? ""}`;
|
|
38
|
+
}
|
|
39
|
+
if (value === null || typeof value !== "object") {
|
|
40
|
+
return value;
|
|
41
|
+
}
|
|
42
|
+
if ("$$typeof" in value) {
|
|
43
|
+
return "[React]";
|
|
44
|
+
}
|
|
45
|
+
while (ancestors.length > 0 && ancestors[ancestors.length - 1] !== this) {
|
|
46
|
+
ancestors.pop();
|
|
47
|
+
}
|
|
48
|
+
if (ancestors.includes(value)) {
|
|
49
|
+
return "[Circular]";
|
|
50
|
+
}
|
|
51
|
+
ancestors.push(value);
|
|
52
|
+
return value;
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// src/logging/datadogHttpLogTransport.ts
|
|
57
|
+
var DEFAULT_SERVICE = "connect-rn";
|
|
58
|
+
var DEFAULT_SITE = "datadoghq.com";
|
|
59
|
+
var DEFAULT_FLUSH_INTERVAL_MS = 5e3;
|
|
60
|
+
var DEFAULT_MAX_BATCH_SIZE = 50;
|
|
61
|
+
var DatadogHttpLogTransport = class {
|
|
62
|
+
constructor(options) {
|
|
63
|
+
this.consent = "granted";
|
|
64
|
+
this.queue = [];
|
|
65
|
+
this.flushTimer = null;
|
|
66
|
+
const site = options.site ?? DEFAULT_SITE;
|
|
67
|
+
this.service = options.service ?? DEFAULT_SERVICE;
|
|
68
|
+
this.env = options.env;
|
|
69
|
+
this.flushIntervalMs = options.flushIntervalMs ?? DEFAULT_FLUSH_INTERVAL_MS;
|
|
70
|
+
this.maxBatchSize = options.maxBatchSize ?? DEFAULT_MAX_BATCH_SIZE;
|
|
71
|
+
this.intakeUrl = `https://browser-intake-${site}/api/v2/logs?dd-api-key=${encodeURIComponent(options.clientToken)}&ddsource=react-native&dd-evp-origin=react-native`;
|
|
72
|
+
}
|
|
73
|
+
setEnv(environment) {
|
|
74
|
+
this.env = environment;
|
|
75
|
+
}
|
|
76
|
+
setTrackingConsent(consent) {
|
|
77
|
+
this.consent = consent;
|
|
78
|
+
if (consent !== "granted") {
|
|
79
|
+
this.queue = [];
|
|
80
|
+
this.clearTimer();
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
log({ level, title, context, error }) {
|
|
84
|
+
if (this.consent !== "granted") {
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
const entry = {
|
|
88
|
+
// Caller context first so the mandatory Datadog fields below always win —
|
|
89
|
+
// a future LogContext attribute named e.g. `message`/`status` can't
|
|
90
|
+
// silently corrupt the record.
|
|
91
|
+
...context,
|
|
92
|
+
ddsource: "react-native",
|
|
93
|
+
service: this.service,
|
|
94
|
+
status: level,
|
|
95
|
+
message: title,
|
|
96
|
+
...this.env ? { ddtags: `env:${this.env}` } : {},
|
|
97
|
+
...error ? {
|
|
98
|
+
error: {
|
|
99
|
+
message: error.message,
|
|
100
|
+
stack: error.stack,
|
|
101
|
+
kind: error.name
|
|
102
|
+
}
|
|
103
|
+
} : {}
|
|
104
|
+
};
|
|
105
|
+
this.queue.push(entry);
|
|
106
|
+
if (this.queue.length >= this.maxBatchSize) {
|
|
107
|
+
this.flush();
|
|
108
|
+
} else {
|
|
109
|
+
this.scheduleFlush();
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
/** Send the buffered batch. Fire-and-forget; network errors are swallowed. */
|
|
113
|
+
flush() {
|
|
114
|
+
this.clearTimer();
|
|
115
|
+
if (this.queue.length === 0) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
if (typeof fetch !== "function") {
|
|
119
|
+
this.queue = [];
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const batch = this.queue;
|
|
123
|
+
this.queue = [];
|
|
124
|
+
fetch(this.intakeUrl, {
|
|
125
|
+
method: "POST",
|
|
126
|
+
headers: { "Content-Type": "application/json" },
|
|
127
|
+
body: serializeLogBatch(batch)
|
|
128
|
+
}).catch(() => {
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
scheduleFlush() {
|
|
132
|
+
if (this.flushTimer != null) {
|
|
133
|
+
return;
|
|
134
|
+
}
|
|
135
|
+
this.flushTimer = setTimeout(() => {
|
|
136
|
+
this.flushTimer = null;
|
|
137
|
+
this.flush();
|
|
138
|
+
}, this.flushIntervalMs);
|
|
139
|
+
}
|
|
140
|
+
clearTimer() {
|
|
141
|
+
if (this.flushTimer != null) {
|
|
142
|
+
clearTimeout(this.flushTimer);
|
|
143
|
+
this.flushTimer = null;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
// src/logging/logger.ts
|
|
149
|
+
var DDOG_CLIENT_TOKEN = "pub4f86c6be8c792cb48dc156a8c17d9a47";
|
|
150
|
+
var logger = new FunLogger(
|
|
151
|
+
new DatadogHttpLogTransport({
|
|
152
|
+
clientToken: DDOG_CLIENT_TOKEN
|
|
153
|
+
// service defaults to 'connect-rn' (see DatadogHttpLogTransport).
|
|
154
|
+
})
|
|
155
|
+
);
|
|
156
|
+
logger.setDebugTag(process.env.EXPO_PUBLIC_DEV_TAG ?? null);
|
|
157
|
+
|
|
158
|
+
export {
|
|
159
|
+
logger
|
|
160
|
+
};
|
|
161
|
+
//# sourceMappingURL=chunk-D64EJ57D.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/logging/logger.ts", "../src/logging/serializeLogBatch.ts", "../src/logging/datadogHttpLogTransport.ts"],
|
|
4
|
+
"sourcesContent": ["import { FunLogger } from '@funkit/connect-core'\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.\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 */\nexport const logger = new FunLogger(\n new DatadogHttpLogTransport({\n clientToken: DDOG_CLIENT_TOKEN,\n // service defaults to 'connect-rn' (see DatadogHttpLogTransport).\n }),\n)\n\n// Names a developer's build in Datadog and switches on the MoonPay frame taps.\n// Metro inlines `EXPO_PUBLIC_*` only outside `node_modules` (expo/expo#46982),\n// so this resolves in this monorepo's playground and is `undefined` \u2014 taps off \u2014\n// for anyone consuming the published package. That is the intent: it is dev\n// tooling, and a host needs no API to opt out of it.\nlogger.setDebugTag(process.env.EXPO_PUBLIC_DEV_TAG ?? null)\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", "import type {\n LogRecord,\n LogTransport,\n TrackingConsent,\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 * Records are batched and flushed fire-and-forget on a timer (or when the batch\n * fills); network errors are swallowed so logging never breaks 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 = 'datadoghq.com'\nconst DEFAULT_FLUSH_INTERVAL_MS = 5_000\nconst DEFAULT_MAX_BATCH_SIZE = 50\n\nexport class DatadogHttpLogTransport implements LogTransport {\n private readonly intakeUrl: string\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 private queue: DatadogLogEntry[] = []\n private flushTimer: ReturnType<typeof setTimeout> | null = 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 this.intakeUrl =\n `https://browser-intake-${site}/api/v2/logs` +\n `?dd-api-key=${encodeURIComponent(options.clientToken)}` +\n `&ddsource=react-native&dd-evp-origin=react-native`\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.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 ...(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\n if (this.queue.length >= this.maxBatchSize) {\n this.flush()\n } else {\n this.scheduleFlush()\n }\n }\n\n /** Send the buffered batch. Fire-and-forget; network errors are swallowed. */\n flush(): void {\n this.clearTimer()\n if (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 const batch = this.queue\n this.queue = []\n\n fetch(this.intakeUrl, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: serializeLogBatch(batch),\n }).catch(() => {\n // Swallow: logging must never break a user flow.\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"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|