@funkit/connect-rn 2.0.0 → 3.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.
Files changed (78) hide show
  1. package/CHANGELOG.md +72 -0
  2. package/dist/index.d.ts +6 -2
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +1988 -860
  5. package/dist/index.js.map +4 -4
  6. package/dist/src/flow/AddressCopiedToast.d.ts +4 -3
  7. package/dist/src/flow/AddressCopiedToast.d.ts.map +1 -1
  8. package/dist/src/flow/FunkitFlowProvider.d.ts +3 -0
  9. package/dist/src/flow/FunkitFlowProvider.d.ts.map +1 -1
  10. package/dist/src/flow/withdrawalFlowConfig.d.ts +68 -0
  11. package/dist/src/flow/withdrawalFlowConfig.d.ts.map +1 -0
  12. package/dist/src/geo/useCheckoutBlocked.d.ts.map +1 -1
  13. package/dist/src/geo/useUserIpInfo.d.ts +2 -21
  14. package/dist/src/geo/useUserIpInfo.d.ts.map +1 -1
  15. package/dist/src/hooks/useScreenSize.d.ts +4 -0
  16. package/dist/src/hooks/useScreenSize.d.ts.map +1 -0
  17. package/dist/src/icons/FigmaSystemIcons.d.ts +1 -0
  18. package/dist/src/icons/FigmaSystemIcons.d.ts.map +1 -1
  19. package/dist/src/icons/FunIcon.d.ts.map +1 -1
  20. package/dist/src/icons/SourceTokenCluster.d.ts.map +1 -1
  21. package/dist/src/icons/StatusIcon.d.ts +2 -0
  22. package/dist/src/icons/StatusIcon.d.ts.map +1 -0
  23. package/dist/src/icons/TokenChainIcon.d.ts.map +1 -1
  24. package/dist/src/identity/IdentityContext.d.ts.map +1 -1
  25. package/dist/src/logging/datadogHttpLogTransport.d.ts.map +1 -1
  26. package/dist/src/providers/FunkitProvider.d.ts.map +1 -1
  27. package/dist/src/providers/useFunkitCheckout.d.ts +9 -3
  28. package/dist/src/providers/useFunkitCheckout.d.ts.map +1 -1
  29. package/dist/src/screens/AvailableChainsScreen.d.ts +2 -1
  30. package/dist/src/screens/AvailableChainsScreen.d.ts.map +1 -1
  31. package/dist/src/screens/CheckoutBlockedScreen.d.ts.map +1 -1
  32. package/dist/src/screens/NetworkSelector.d.ts.map +1 -1
  33. package/dist/src/screens/QrCodeScreen.d.ts +10 -10
  34. package/dist/src/screens/QrCodeScreen.d.ts.map +1 -1
  35. package/dist/src/screens/SelectMethodScreen.d.ts.map +1 -1
  36. package/dist/src/screens/TransferCryptoScreen.d.ts.map +1 -1
  37. package/dist/src/screens/WithdrawMethodScreen.d.ts +30 -0
  38. package/dist/src/screens/WithdrawMethodScreen.d.ts.map +1 -0
  39. package/dist/src/statsig/useDynamicConfig.d.ts +6 -0
  40. package/dist/src/statsig/useDynamicConfig.d.ts.map +1 -0
  41. package/dist/src/swapped/SwappedScreen.d.ts +6 -14
  42. package/dist/src/swapped/SwappedScreen.d.ts.map +1 -1
  43. package/dist/src/swapped/SwappedScreenShell.d.ts +24 -0
  44. package/dist/src/swapped/SwappedScreenShell.d.ts.map +1 -0
  45. package/dist/src/swapped/SwappedWebView.d.ts.map +1 -1
  46. package/dist/src/swapped/SwappedWithdrawScreen.d.ts +20 -0
  47. package/dist/src/swapped/SwappedWithdrawScreen.d.ts.map +1 -0
  48. package/dist/src/swapped/buildSwappedTheme.d.ts +7 -4
  49. package/dist/src/swapped/buildSwappedTheme.d.ts.map +1 -1
  50. package/dist/src/swapped/webViewSwappedTransport.d.ts +8 -7
  51. package/dist/src/swapped/webViewSwappedTransport.d.ts.map +1 -1
  52. package/dist/src/theme/buildFunkitTheme.d.ts +192 -0
  53. package/dist/src/theme/buildFunkitTheme.d.ts.map +1 -0
  54. package/dist/src/theme/restyle.d.ts +2818 -2224
  55. package/dist/src/theme/restyle.d.ts.map +1 -1
  56. package/dist/src/theme/themes.d.ts +34 -0
  57. package/dist/src/theme/themes.d.ts.map +1 -0
  58. package/dist/src/theme/toRestyleTheme.d.ts +257 -205
  59. package/dist/src/theme/toRestyleTheme.d.ts.map +1 -1
  60. package/dist/src/theme/tokens.d.ts +162 -139
  61. package/dist/src/theme/tokens.d.ts.map +1 -1
  62. package/dist/src/transfer/fops.d.ts +8 -0
  63. package/dist/src/transfer/fops.d.ts.map +1 -1
  64. package/dist/src/transfer/hooks/useFiatExchangeRates.d.ts +11 -0
  65. package/dist/src/transfer/hooks/useFiatExchangeRates.d.ts.map +1 -0
  66. package/dist/src/transfer/hooks/useFops.d.ts.map +1 -1
  67. package/dist/src/transfer/hooks/useTokenTransfer.d.ts.map +1 -1
  68. package/dist/src/transfer/hooks/useUDAParams.d.ts +1 -1
  69. package/dist/src/transfer/hooks/useUDAParams.d.ts.map +1 -1
  70. package/dist/src/transfer/hooks/useWithdrawalFops.d.ts +39 -0
  71. package/dist/src/transfer/hooks/useWithdrawalFops.d.ts.map +1 -0
  72. package/dist/src/utils/customers.d.ts +2 -0
  73. package/dist/src/utils/customers.d.ts.map +1 -0
  74. package/dist/src/withdrawal/publicClient.d.ts +10 -0
  75. package/dist/src/withdrawal/publicClient.d.ts.map +1 -0
  76. package/dist/src/withdrawal/useWithdrawalExecution.d.ts +21 -0
  77. package/dist/src/withdrawal/useWithdrawalExecution.d.ts.map +1 -0
  78. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,77 @@
1
1
  # @funkit/connect-rn
2
2
 
3
+ ## 3.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 6fb8531: Rework the theme tokens to strictly mirror the Figma "Fun Variables" export.
8
+
9
+ `FunkitTokens` is now a nested tree matching Figma's variable groups
10
+ (`background` / `content` / `border` / `font` / `spacing` / `brand` / `button` /
11
+ `opacity`) instead of the previous flat groups, and only reflects states that
12
+ exist in the design (`default` / `pressed` / some `disabled`). The Restyle theme
13
+ no longer exposes a flat `colors` bucket — colors are read from the nested
14
+ groups via `useTheme()`.
15
+
16
+ **Breaking changes / migration:**
17
+
18
+ - **`FunkitColorTokens` is removed.** There is no flat color type or `colors`
19
+ bucket. Read colors from the nested groups, e.g. `theme.background.modal`,
20
+ `theme.content.elements.primary`, `theme.background.button.primary.default`.
21
+ - **`FunkitTokens` is restructured** into the nested Figma groups. Code that
22
+ built or spread `FunkitTokens` (e.g. `tokens.colors`, `tokens.radii`,
23
+ `tokens.sizes`, `tokens.fonts`) must move to the new shape
24
+ (`tokens.background`/`content`/`border.radius`/`button`/`font`, …).
25
+ - **`fonts` → `font`**, now split into `body` / `header` with Figma style-name
26
+ weights (`Regular` / `Medium`); `fontFamilyForWeight(family, styleName)`
27
+ replaces the old `(fonts, weight)` signature. New exports: `ButtonSurface`,
28
+ `FunkitFontStyleName`, `FONT_STYLE_CSS_WEIGHT`.
29
+ - Components should set colors via `style` from `useTheme()` rather than Restyle
30
+ color-string props (`backgroundColor="…"`), which no longer resolve.
31
+
32
+ ### Minor Changes
33
+
34
+ - 5867170: Add `lightTheme(override?)` / `darkTheme(override?)` theme factories and the
35
+ `FunkitTokensOverride` type, mirroring web's `@funkit/connect` theme API.
36
+ Consumers build a brand theme by passing a deep-partial override of the nested
37
+ `FunkitTokens` groups — deep-merged onto the built-in light/dark tokens — instead
38
+ of assembling a full token object by hand.
39
+
40
+ ### Patch Changes
41
+
42
+ - 20c27a4: Use the raw `externalUserId` as the Funkit `userId` for Mallard instead of pipe-joining it with the apiKey. Mallard supplies the wallet address as `externalUserId` and expects it passed through unprefixed.
43
+ - 30b1e1d: Fix the Add money list flashing crypto-only during Statsig init: `FunkitFlowProvider` now holds the skeleton on `useStatsigClient().isLoading`, since while Statsig initializes the `enableswappeddeposit` gate reads its `false` fallback (indistinguishable from a genuinely-off gate).
44
+ - a4a146d: `FunkitProvider`'s `debug` prop now defaults to `__DEV__`: React Native debug builds echo every log record to the console (Metro terminal) and run Statsig in the dev environment tier, matching the web SDK's `debug` semantics. Release builds are unchanged; pass `debug={false}` to force production behavior in a dev build.
45
+ - e0bcdb7: Resolve country-conditional Statsig variant configs against the user's IP country: new RN `useDynamicConfig` wrapper (mirroring the web SDK's) threads `alpha2` into core config resolution for all connect-rn call sites.
46
+ - dd503cd: Show the status icon on the unavailable / error message states, matching the
47
+ geo-blocked screen.
48
+ - dad6cb2: Move the duplicated Moonpay→ipapi IP-country lookup into a shared `useUserIpInfo` hook in `@funkit/connect-core`; web and RN keep thin wrappers injecting their `logger`, `enabled` gate, and `staleTime`. Public API and web behavior unchanged.
49
+ - Updated dependencies [0755d6b]
50
+ - Updated dependencies [96f35d1]
51
+ - Updated dependencies [dad6cb2]
52
+ - @funkit/connect-core@2.1.0
53
+
54
+ ## 2.1.0
55
+
56
+ ### Minor Changes
57
+
58
+ - 88c8874: Execute fiat-withdrawal orders through the host `WithdrawalClient` — a validated Swapped order runs the on-chain leg and reports `onWithdrawalSubmitted(orderId, txHash)`; user rejections stay interactive, failures surface a retryable error and `onWithdrawalError`
59
+ - 1afdd25: Handle the Swapped withdrawal lifecycle messages in the embed (fiat offramp, [5/8]): `webViewSwappedTransport` / `SwappedScreen` parse and relay `SWAPPED_NEW_WITHDRAWAL`, `SWAPPED_WITHDRAWAL_SUCCESSFUL`, and validated `SWAPPED_ORDER_DATA`. The WebView message origin gate is now fail-closed, validating against the last committed navigation URL when a build omits `nativeEvent.url`. Deposit behavior unchanged.
60
+ - 2509eaf: Wire the managed Swapped fiat-offramp flow ([6/8]): `useFunkitCheckout` gains `beginWithdrawal(config)`, and `FunkitFlowProvider` drives the payout-method list → Swapped WebView, capping the sell to `sourceUsdBalance` and blocking below Swapped's minimum. Exports the `WithdrawalFlowConfig` / `WithdrawalClient` contract types. On-chain execution lands in [7/8]; until then a validated order reaches the host via `onWithdrawalOrder`.
61
+ - 140835a: Add the withdrawal FOPs data layer (Swapped fiat offramp, [3/8]): the `WithdrawalFlowConfig` contract types, `useWithdrawalFops` (Statsig-gated payout-method fetch + balance→EUR sell cap), and `useFiatExchangeRates`. Data only — the screen and flow wiring land in later PRs.
62
+ - 0564bb8: Add `WithdrawMethodScreen` (Swapped fiat offramp, [4/8]) — the payout-method picker, a thin composition over `SelectMethodScreen` (bare-list layout) with terminal empty / balance-too-low states. Tested but not yet wired into the flow.
63
+
64
+ ### Patch Changes
65
+
66
+ - 8211c26: feat(connect-rn): render AvailableChainsScreen as nested sheet with Got it button
67
+ - 916073b: Update CheckoutBlockedScreen to match Figma design: add "Add money" title, swap info icon for alert circle icon, add "View available regions" link text
68
+ - e5320cb: feat(connect-rn): render QrCodeScreen as nested bottom sheet with Done button and responsive padding
69
+ - d0c8554: fix(connect-rn): primary buttons follow the `button` radius token
70
+
71
+ Primary action buttons (Copy/Share, Done, retry, "Got it") hardcoded a full-pill radius instead of reading the themeable `button` token, so brands could not square their buttons. They now use `borderRadius="button"`; the default token is 999, keeping the full-pill look for themes that don't override it.
72
+
73
+ - 89018b6: Split the internal `SwappedScreen` into deposit (`SwappedScreen`) and withdrawal (`SwappedWithdrawScreen`) components with per-mode message handling. No public API or user-facing behavior changes.
74
+
3
75
  ## 2.0.0
4
76
 
5
77
  ### Major Changes
package/dist/index.d.ts CHANGED
@@ -1,8 +1,10 @@
1
- export type { CheckoutTokenTransferConfig } from '@funkit/connect-core';
1
+ export type { CheckoutTokenTransferConfig, SwappedSellOrderData, WithdrawalClient, WithdrawalTransaction, } from '@funkit/connect-core';
2
2
  export { darkTokens, fontFamilyForWeight, lightTokens, } from './src/theme/tokens';
3
- export type { FunkitColorTokens, FunkitFontTokens, FunkitFontWeight, FunkitTokens, } from './src/theme/tokens';
3
+ export type { ButtonSurface, FunkitFontStyleName, FunkitFontTokens, FunkitFontWeight, FunkitTokens, } from './src/theme/tokens';
4
4
  export { defaultDarkTheme, defaultLightTheme, toRestyleTheme, } from './src/theme/toRestyleTheme';
5
5
  export type { FunkitTheme } from './src/theme/toRestyleTheme';
6
+ export { darkTheme, lightTheme } from './src/theme/themes';
7
+ export type { FunkitTokensOverride } from './src/theme/themes';
6
8
  export { normalizeColorScheme, resolveColorScheme, useColorScheme, } from './src/theme/useColorScheme';
7
9
  export type { ColorScheme, SystemColorScheme } from './src/theme/useColorScheme';
8
10
  export { useFunkitTheme } from './src/theme/useFunkitTheme';
@@ -17,7 +19,9 @@ export { FunkitProvider } from './src/providers/FunkitProvider';
17
19
  export type { FunkitProviderProps } from './src/providers/FunkitProvider';
18
20
  export type { FunkitConfig } from './src/identity/IdentityContext';
19
21
  export { useFunkitCheckout } from './src/providers/useFunkitCheckout';
22
+ export type { FunkitCheckoutCallbacks } from './src/providers/useFunkitCheckout';
20
23
  export type { DepositFlowCallbacks, DepositFlowConfig, DynamicTargetAssetCandidate, } from './src/flow/depositFlowConfig';
24
+ export type { WithdrawalFlowCallbacks, WithdrawalFlowConfig, WithdrawalToken, } from './src/flow/withdrawalFlowConfig';
21
25
  export type { PaymentMethodOption, ReceiveTokenOption, } from './src/screens/SelectMethodScreen';
22
26
  export type { ChainOption } from './src/flow/depositFlowConfig';
23
27
  export type { SupportedToken, TokenChainFilter, } from './src/transfer/supportedTokens';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAgBA,YAAY,EAAE,2BAA2B,EAAE,MAAM,sBAAsB,CAAA;AAKvE,OAAO,EACL,UAAU,EACV,mBAAmB,EACnB,WAAW,GACZ,MAAM,oBAAoB,CAAA;AAC3B,YAAY,EACV,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,YAAY,GACb,MAAM,oBAAoB,CAAA;AAG3B,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,cAAc,GACf,MAAM,4BAA4B,CAAA;AACnC,YAAY,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAA;AAG7D,OAAO,EACL,oBAAoB,EACpB,kBAAkB,EAClB,cAAc,GACf,MAAM,4BAA4B,CAAA;AACnC,YAAY,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAA;AAGhF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAC3D,YAAY,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAA;AAGhE,OAAO,EAAE,GAAG,EAAE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