@funkit/connect-rn 0.2.0 → 1.0.2

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 (117) hide show
  1. package/README.md +72 -0
  2. package/dist/index.d.ts +11 -8
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +3595 -612
  5. package/dist/index.js.map +4 -4
  6. package/dist/src/flow/AddressCopiedToast.d.ts +18 -0
  7. package/dist/src/flow/AddressCopiedToast.d.ts.map +1 -0
  8. package/dist/src/flow/FlowSheet.d.ts +47 -0
  9. package/dist/src/flow/FlowSheet.d.ts.map +1 -0
  10. package/dist/src/flow/FunkitFlowProvider.d.ts +23 -0
  11. package/dist/src/flow/FunkitFlowProvider.d.ts.map +1 -0
  12. package/dist/src/flow/depositFlowConfig.d.ts +101 -0
  13. package/dist/src/flow/depositFlowConfig.d.ts.map +1 -0
  14. package/dist/src/flow/useKeyboardHeight.d.ts +21 -0
  15. package/dist/src/flow/useKeyboardHeight.d.ts.map +1 -0
  16. package/dist/src/geo/isCountryBlocked.d.ts +3 -0
  17. package/dist/src/geo/isCountryBlocked.d.ts.map +1 -0
  18. package/dist/src/geo/useCheckoutBlocked.d.ts +10 -0
  19. package/dist/src/geo/useCheckoutBlocked.d.ts.map +1 -0
  20. package/dist/src/geo/useUserIpInfo.d.ts +22 -0
  21. package/dist/src/geo/useUserIpInfo.d.ts.map +1 -0
  22. package/dist/src/icons/CopyAddressIcon.d.ts +9 -0
  23. package/dist/src/icons/CopyAddressIcon.d.ts.map +1 -0
  24. package/dist/src/icons/CryptoBitcoinIcon.d.ts +9 -0
  25. package/dist/src/icons/CryptoBitcoinIcon.d.ts.map +1 -0
  26. package/dist/src/icons/CryptoTransferQRIcon.d.ts +9 -0
  27. package/dist/src/icons/CryptoTransferQRIcon.d.ts.map +1 -0
  28. package/dist/src/icons/FigmaSystemIcons.d.ts +19 -0
  29. package/dist/src/icons/FigmaSystemIcons.d.ts.map +1 -0
  30. package/dist/src/icons/FunIcon.d.ts +18 -0
  31. package/dist/src/icons/FunIcon.d.ts.map +1 -0
  32. package/dist/src/icons/PaymentBrandIcons.d.ts +24 -0
  33. package/dist/src/icons/PaymentBrandIcons.d.ts.map +1 -0
  34. package/dist/src/icons/QrChainCluster.d.ts +22 -0
  35. package/dist/src/icons/QrChainCluster.d.ts.map +1 -0
  36. package/dist/src/icons/SourceTokenCluster.d.ts +31 -0
  37. package/dist/src/icons/SourceTokenCluster.d.ts.map +1 -0
  38. package/dist/src/icons/TokenChainIcon.d.ts +19 -0
  39. package/dist/src/icons/TokenChainIcon.d.ts.map +1 -0
  40. package/dist/src/icons/assetLogos.d.ts +12 -0
  41. package/dist/src/icons/assetLogos.d.ts.map +1 -0
  42. package/dist/src/icons/funIconUri.d.ts +16 -0
  43. package/dist/src/icons/funIconUri.d.ts.map +1 -0
  44. package/dist/src/identity/IdentityContext.d.ts +30 -1
  45. package/dist/src/identity/IdentityContext.d.ts.map +1 -1
  46. package/dist/src/logging/datadogHttpLogTransport.d.ts +0 -7
  47. package/dist/src/logging/datadogHttpLogTransport.d.ts.map +1 -1
  48. package/dist/src/providers/FunkitProvider.d.ts +37 -6
  49. package/dist/src/providers/FunkitProvider.d.ts.map +1 -1
  50. package/dist/src/providers/FunkitStatsigProvider.d.ts +6 -2
  51. package/dist/src/providers/FunkitStatsigProvider.d.ts.map +1 -1
  52. package/dist/src/providers/useFunkitCheckout.d.ts +14 -0
  53. package/dist/src/providers/useFunkitCheckout.d.ts.map +1 -0
  54. package/dist/src/screens/AddMoneyScreen.d.ts +57 -2
  55. package/dist/src/screens/AddMoneyScreen.d.ts.map +1 -1
  56. package/dist/src/screens/AvailableChainsScreen.d.ts +33 -0
  57. package/dist/src/screens/AvailableChainsScreen.d.ts.map +1 -0
  58. package/dist/src/screens/CheckoutBlockedScreen.d.ts +2 -0
  59. package/dist/src/screens/CheckoutBlockedScreen.d.ts.map +1 -0
  60. package/dist/src/screens/NetworkSelector.d.ts +31 -0
  61. package/dist/src/screens/NetworkSelector.d.ts.map +1 -0
  62. package/dist/src/screens/QrCodeScreen.d.ts +30 -14
  63. package/dist/src/screens/QrCodeScreen.d.ts.map +1 -1
  64. package/dist/src/screens/TransferCryptoScreen.d.ts +25 -12
  65. package/dist/src/screens/TransferCryptoScreen.d.ts.map +1 -1
  66. package/dist/src/statsig/statsigMetadata.d.ts.map +1 -1
  67. package/dist/src/swapped/SwappedScreen.d.ts +21 -0
  68. package/dist/src/swapped/SwappedScreen.d.ts.map +1 -0
  69. package/dist/src/swapped/SwappedWebView.d.ts +18 -0
  70. package/dist/src/swapped/SwappedWebView.d.ts.map +1 -0
  71. package/dist/src/swapped/buildSwappedTheme.d.ts +31 -0
  72. package/dist/src/swapped/buildSwappedTheme.d.ts.map +1 -0
  73. package/dist/src/swapped/webViewSwappedTransport.d.ts +74 -0
  74. package/dist/src/swapped/webViewSwappedTransport.d.ts.map +1 -0
  75. package/dist/src/theme/FunkitThemeProvider.d.ts +14 -2
  76. package/dist/src/theme/FunkitThemeProvider.d.ts.map +1 -1
  77. package/dist/src/theme/restyle.d.ts +1140 -513
  78. package/dist/src/theme/restyle.d.ts.map +1 -1
  79. package/dist/src/theme/toRestyleTheme.d.ts +90 -48
  80. package/dist/src/theme/toRestyleTheme.d.ts.map +1 -1
  81. package/dist/src/theme/tokens.d.ts +52 -8
  82. package/dist/src/theme/tokens.d.ts.map +1 -1
  83. package/dist/src/theme/useFunkitTheme.d.ts +4 -10
  84. package/dist/src/theme/useFunkitTheme.d.ts.map +1 -1
  85. package/dist/src/transfer/QrCode.d.ts +24 -0
  86. package/dist/src/transfer/QrCode.d.ts.map +1 -0
  87. package/dist/src/transfer/availableChains.d.ts +53 -0
  88. package/dist/src/transfer/availableChains.d.ts.map +1 -0
  89. package/dist/src/transfer/clipboard.d.ts +23 -0
  90. package/dist/src/transfer/clipboard.d.ts.map +1 -0
  91. package/dist/src/transfer/fops.d.ts +26 -0
  92. package/dist/src/transfer/fops.d.ts.map +1 -0
  93. package/dist/src/transfer/formatDepositAddress.d.ts +9 -0
  94. package/dist/src/transfer/formatDepositAddress.d.ts.map +1 -0
  95. package/dist/src/transfer/hooks/useFops.d.ts +47 -0
  96. package/dist/src/transfer/hooks/useFops.d.ts.map +1 -0
  97. package/dist/src/transfer/hooks/useSupportedTokens.d.ts +26 -0
  98. package/dist/src/transfer/hooks/useSupportedTokens.d.ts.map +1 -0
  99. package/dist/src/transfer/hooks/useTokenTransfer.d.ts +4 -2
  100. package/dist/src/transfer/hooks/useTokenTransfer.d.ts.map +1 -1
  101. package/dist/src/transfer/hooks/useTransferInit.d.ts +1 -1
  102. package/dist/src/transfer/hooks/useTransferInit.d.ts.map +1 -1
  103. package/dist/src/transfer/hooks/useUDAParams.d.ts +1 -1
  104. package/dist/src/transfer/hooks/useUDAParams.d.ts.map +1 -1
  105. package/dist/src/transfer/supportedTokens.d.ts +34 -0
  106. package/dist/src/transfer/supportedTokens.d.ts.map +1 -0
  107. package/dist/src/version.d.ts +2 -0
  108. package/dist/src/version.d.ts.map +1 -0
  109. package/package.json +31 -4
  110. package/dist/src/icons/CopyIcon.d.ts +0 -3
  111. package/dist/src/icons/CopyIcon.d.ts.map +0 -1
  112. package/dist/src/icons/NetworkIconFallback.d.ts +0 -3
  113. package/dist/src/icons/NetworkIconFallback.d.ts.map +0 -1
  114. package/dist/src/icons/QrCodeIcon.d.ts +0 -3
  115. package/dist/src/icons/QrCodeIcon.d.ts.map +0 -1
  116. package/dist/src/theme/colorSchemeContext.d.ts +0 -22
  117. package/dist/src/theme/colorSchemeContext.d.ts.map +0 -1
package/dist/index.js CHANGED
@@ -2,6 +2,17 @@
2
2
  export * from "@funkit/connect-core";
3
3
 
4
4
  // src/theme/tokens.ts
5
+ var systemFontTokens = {
6
+ family: "System",
7
+ weights: {
8
+ base: { cssWeight: "400" },
9
+ medium: { cssWeight: "500" }
10
+ }
11
+ };
12
+ function fontFamilyForWeight(fonts, weight) {
13
+ const { familySuffix } = fonts.weights[weight];
14
+ return familySuffix ? `${fonts.family}-${familySuffix}` : fonts.family;
15
+ }
5
16
  var lightTokens = {
6
17
  colors: {
7
18
  bgModal: "#FFFFFF",
@@ -89,14 +100,7 @@ var lightTokens = {
89
100
  iconMd: 20,
90
101
  iconLg: 20
91
102
  },
92
- fontFamilies: {
93
- body: "Inter",
94
- header: "Inter"
95
- },
96
- fontWeights: {
97
- base: "400",
98
- medium: "500"
99
- },
103
+ fonts: systemFontTokens,
100
104
  fontSizes: {
101
105
  bodyBase: 16,
102
106
  bodyDetail: 14,
@@ -104,6 +108,10 @@ var lightTokens = {
104
108
  headerSubtitle: 15,
105
109
  amountInput: 48,
106
110
  amountSummary: 48
111
+ },
112
+ fontLineHeights: {
113
+ bodyBase: 22,
114
+ bodyDetail: 20
107
115
  }
108
116
  };
109
117
  var darkTokens = {
@@ -193,14 +201,7 @@ var darkTokens = {
193
201
  iconMd: 20,
194
202
  iconLg: 20
195
203
  },
196
- fontFamilies: {
197
- body: "Inter",
198
- header: "Inter"
199
- },
200
- fontWeights: {
201
- base: "400",
202
- medium: "500"
203
- },
204
+ fonts: systemFontTokens,
204
205
  fontSizes: {
205
206
  bodyBase: 16,
206
207
  bodyDetail: 14,
@@ -208,12 +209,26 @@ var darkTokens = {
208
209
  headerSubtitle: 15,
209
210
  amountInput: 32,
210
211
  amountSummary: 40
212
+ },
213
+ fontLineHeights: {
214
+ bodyBase: 22,
215
+ bodyDetail: 20
211
216
  }
212
217
  };
213
218
 
214
219
  // src/theme/toRestyleTheme.ts
215
220
  import { createTheme } from "@shopify/restyle";
216
221
  function toRestyleTheme(tokens) {
222
+ const bodyLineHeight = tokens.fontLineHeights?.bodyBase ?? 22;
223
+ const detailLineHeight = tokens.fontLineHeights?.bodyDetail ?? 20;
224
+ const base = {
225
+ fontFamily: fontFamilyForWeight(tokens.fonts, "base"),
226
+ fontWeight: tokens.fonts.weights.base.cssWeight
227
+ };
228
+ const medium = {
229
+ fontFamily: fontFamilyForWeight(tokens.fonts, "medium"),
230
+ fontWeight: tokens.fonts.weights.medium.cssWeight
231
+ };
217
232
  return createTheme({
218
233
  colors: {
219
234
  ...tokens.colors,
@@ -229,55 +244,60 @@ function toRestyleTheme(tokens) {
229
244
  },
230
245
  textVariants: {
231
246
  defaults: {
232
- fontFamily: tokens.fontFamilies.body,
233
- fontWeight: tokens.fontWeights.base,
247
+ ...base,
234
248
  fontSize: tokens.fontSizes.bodyBase,
249
+ lineHeight: bodyLineHeight,
235
250
  color: "textPrimary"
236
251
  },
237
252
  body: {
238
- fontFamily: tokens.fontFamilies.body,
239
- fontWeight: tokens.fontWeights.base,
253
+ ...base,
240
254
  fontSize: tokens.fontSizes.bodyBase,
255
+ lineHeight: bodyLineHeight,
241
256
  color: "textPrimary"
242
257
  },
243
258
  bodyMedium: {
244
- fontFamily: tokens.fontFamilies.body,
245
- fontWeight: tokens.fontWeights.medium,
259
+ ...medium,
246
260
  fontSize: tokens.fontSizes.bodyBase,
261
+ lineHeight: bodyLineHeight,
247
262
  color: "textPrimary"
248
263
  },
249
264
  detail: {
250
- fontFamily: tokens.fontFamilies.body,
251
- fontWeight: tokens.fontWeights.base,
265
+ ...base,
252
266
  fontSize: tokens.fontSizes.bodyDetail,
267
+ lineHeight: detailLineHeight,
253
268
  color: "textSecondary"
254
269
  },
255
270
  headerTitle: {
256
- fontFamily: tokens.fontFamilies.header,
257
- fontWeight: tokens.fontWeights.medium,
271
+ ...medium,
258
272
  fontSize: tokens.fontSizes.headerTitle,
259
273
  color: "textPrimary",
260
274
  textAlign: "center"
261
275
  },
262
276
  headerSubtitle: {
263
- fontFamily: tokens.fontFamilies.header,
264
- fontWeight: tokens.fontWeights.medium,
277
+ ...medium,
265
278
  fontSize: tokens.fontSizes.headerSubtitle,
266
279
  color: "textSecondary",
267
280
  textAlign: "center"
268
281
  },
269
282
  amountInput: {
270
- fontFamily: tokens.fontFamilies.header,
271
- fontWeight: tokens.fontWeights.medium,
283
+ ...medium,
272
284
  fontSize: tokens.fontSizes.amountInput,
273
285
  color: "textPrimary"
274
286
  },
275
287
  amountSummary: {
276
- fontFamily: tokens.fontFamilies.header,
277
- fontWeight: tokens.fontWeights.medium,
288
+ ...medium,
278
289
  fontSize: tokens.fontSizes.amountSummary,
279
290
  color: "textPrimary"
280
291
  }
292
+ },
293
+ // Per-weight `{ fontFamily, fontWeight }` the `Text` `weight` prop applies on
294
+ // top of any variant. Weight selection must set BOTH for custom fonts (see
295
+ // `fontFamilyForWeight`), so this reuses the exact `base`/`medium` the
296
+ // variants use — letting a node override only its weight (e.g.
297
+ // `variant="detail" weight="medium"`) without a `*Medium` twin per variant.
298
+ textWeights: {
299
+ base,
300
+ medium
281
301
  }
282
302
  });
283
303
  }
@@ -310,13 +330,7 @@ function useColorScheme() {
310
330
  }
311
331
 
312
332
  // src/theme/useFunkitTheme.ts
313
- import { useContext, useMemo } from "react";
314
-
315
- // src/theme/colorSchemeContext.ts
316
- import { createContext } from "react";
317
- var FunkitColorSchemeContext = createContext(null);
318
-
319
- // src/theme/useFunkitTheme.ts
333
+ import { useMemo } from "react";
320
334
  var DEFAULT_THEME_SET = {
321
335
  light: defaultLightTheme,
322
336
  dark: defaultDarkTheme
@@ -335,9 +349,7 @@ function selectTheme(themeSet, scheme) {
335
349
  );
336
350
  }
337
351
  function useFunkitTheme(themeSet = DEFAULT_THEME_SET) {
338
- const providerScheme = useContext(FunkitColorSchemeContext)?.colorScheme;
339
- const systemScheme = useColorScheme();
340
- const scheme = providerScheme ?? systemScheme;
352
+ const scheme = useColorScheme();
341
353
  return useMemo(
342
354
  () => selectTheme(themeSet, scheme),
343
355
  [scheme, themeSet.light, themeSet.dark]
@@ -345,23 +357,165 @@ function useFunkitTheme(themeSet = DEFAULT_THEME_SET) {
345
357
  }
346
358
 
347
359
  // src/theme/restyle.ts
348
- import { createBox, createText } from "@shopify/restyle";
360
+ import {
361
+ createBox,
362
+ createText,
363
+ useTheme as useRestyleTheme
364
+ } from "@shopify/restyle";
365
+ import {
366
+ createElement,
367
+ forwardRef
368
+ } from "react";
349
369
  var Box = createBox();
350
- var Text = createText();
370
+ var RestyleText = createText();
371
+ var Text = forwardRef(
372
+ function Text2({ weight, style, ...rest }, ref) {
373
+ const theme = useRestyleTheme();
374
+ const weightStyle = weight ? theme.textWeights?.[weight] : void 0;
375
+ return createElement(RestyleText, {
376
+ ref,
377
+ style: weightStyle ? [weightStyle, style] : style,
378
+ ...rest
379
+ });
380
+ }
381
+ );
382
+ var useTheme = () => useRestyleTheme();
383
+
384
+ // src/flow/AddressCopiedToast.tsx
385
+ import { StyleSheet, Text as Text3 } from "react-native";
386
+ import Animated, { Easing, FadeOutUp, Keyframe } from "react-native-reanimated";
387
+
388
+ // src/icons/FigmaSystemIcons.tsx
389
+ import { SvgXml } from "react-native-svg";
390
+ import { jsx } from "react/jsx-runtime";
391
+ function useIconColor(color) {
392
+ const theme = useTheme();
393
+ return color ?? theme.colors.textPrimary;
394
+ }
395
+ function renderIcon(svg, size, color) {
396
+ return /* @__PURE__ */ jsx(
397
+ SvgXml,
398
+ {
399
+ xml: svg.replace(/currentColor/g, color),
400
+ width: size,
401
+ height: size
402
+ }
403
+ );
404
+ }
405
+ var CLOSE_SVG = '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M4.41291 3.08709C4.0468 2.72097 3.4532 2.72097 3.08709 3.08709C2.72097 3.4532 2.72097 4.0468 3.08709 4.41291L8.67417 10L3.08709 15.5871C2.72097 15.9532 2.72097 16.5468 3.08709 16.9129C3.4532 17.279 4.0468 17.279 4.41291 16.9129L10 11.3258L15.5871 16.9129C15.9532 17.279 16.5468 17.279 16.9129 16.9129C17.279 16.5468 17.279 15.9532 16.9129 15.5871L11.3258 10L16.9129 4.41291C17.279 4.0468 17.279 3.4532 16.9129 3.08709C16.5468 2.72097 15.9532 2.72097 15.5871 3.08709L10 8.67417L4.41291 3.08709Z" fill="currentColor"/></svg>';
406
+ var QR_SCAN_SVG = '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.83333 9.99935H10V14.166M2.50833 9.99935H2.5M6.675 14.166H6.66667M10.0083 17.4993H10M17.5083 9.99935H17.5M2.5 14.166H3.75M12.9167 9.99935H14.5833M2.5 17.4993H6.66667M10 1.66602V6.66602M14.6667 17.4993H16.1667C16.6334 17.4993 16.8667 17.4993 17.045 17.4085C17.2018 17.3286 17.3293 17.2011 17.4092 17.0443C17.5 16.8661 17.5 16.6327 17.5 16.166V14.666C17.5 14.1993 17.5 13.966 17.4092 13.7877C17.3293 13.6309 17.2018 13.5034 17.045 13.4235C16.8667 13.3327 16.6334 13.3327 16.1667 13.3327H14.6667C14.2 13.3327 13.9666 13.3327 13.7883 13.4235C13.6315 13.5034 13.5041 13.6309 13.4242 13.7877C13.3333 13.966 13.3333 14.1993 13.3333 14.666V16.166C13.3333 16.6327 13.3333 16.8661 13.4242 17.0443C13.5041 17.2011 13.6315 17.3286 13.7883 17.4085C13.9666 17.4993 14.2 17.4993 14.6667 17.4993ZM14.6667 6.66602H16.1667C16.6334 6.66602 16.8667 6.66602 17.045 6.57519C17.2018 6.49529 17.3293 6.36781 17.4092 6.21101C17.5 6.03275 17.5 5.79939 17.5 5.33268V3.83268C17.5 3.36597 17.5 3.13262 17.4092 2.95436C17.3293 2.79756 17.2018 2.67007 17.045 2.59018C16.8667 2.49935 16.6334 2.49935 16.1667 2.49935H14.6667C14.2 2.49935 13.9666 2.49935 13.7883 2.59018C13.6315 2.67007 13.5041 2.79756 13.4242 2.95436C13.3333 3.13262 13.3333 3.36597 13.3333 3.83268V5.33268C13.3333 5.79939 13.3333 6.03275 13.4242 6.21101C13.5041 6.36781 13.6315 6.49529 13.7883 6.57519C13.9666 6.66602 14.2 6.66602 14.6667 6.66602ZM3.83333 6.66602H5.33333C5.80004 6.66602 6.0334 6.66602 6.21166 6.57519C6.36846 6.49529 6.49594 6.36781 6.57584 6.21101C6.66667 6.03275 6.66667 5.79939 6.66667 5.33268V3.83268C6.66667 3.36597 6.66667 3.13262 6.57584 2.95436C6.49594 2.79756 6.36846 2.67007 6.21166 2.59018C6.0334 2.49935 5.80004 2.49935 5.33333 2.49935H3.83333C3.36662 2.49935 3.13327 2.49935 2.95501 2.59018C2.79821 2.67007 2.67072 2.79756 2.59083 2.95436C2.5 3.13262 2.5 3.36597 2.5 3.83268V5.33268C2.5 5.79939 2.5 6.03275 2.59083 6.21101C2.67072 6.36781 2.79821 6.49529 2.95501 6.57519C3.13327 6.66602 3.36662 6.66602 3.83333 6.66602Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>';
407
+ var COPY_SVG = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.6 10.4V12.08C5.6 12.7521 5.6 13.0881 5.73079 13.3448C5.84584 13.5706 6.02942 13.7542 6.25521 13.8692C6.51191 14 6.84794 14 7.52 14H12.08C12.7521 14 13.0881 14 13.3448 13.8692C13.5706 13.7542 13.7542 13.5706 13.8692 13.3448C14 13.0881 14 12.7521 14 12.08V7.52C14 6.84794 14 6.51191 13.8692 6.25521C13.7542 6.02942 13.5706 5.84584 13.3448 5.73079C13.0881 5.6 12.7521 5.6 12.08 5.6H10.4M3.92 10.4H8.48C9.15206 10.4 9.48809 10.4 9.74479 10.2692C9.97058 10.1542 10.1542 9.97058 10.2692 9.74479C10.4 9.48809 10.4 9.15206 10.4 8.48V3.92C10.4 3.24794 10.4 2.91191 10.2692 2.65521C10.1542 2.42942 9.97058 2.24584 9.74479 2.13079C9.48809 2 9.15206 2 8.48 2H3.92C3.24794 2 2.91191 2 2.65521 2.13079C2.42942 2.24584 2.24584 2.42942 2.13079 2.65521C2 2.91191 2 3.24794 2 3.92V8.48C2 9.15206 2 9.48809 2.13079 9.74479C2.24584 9.97058 2.42942 10.1542 2.65521 10.2692C2.91191 10.4 3.24794 10.4 3.92 10.4Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>';
408
+ var SHARE_SVG = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M14 8V10.8C14 11.9201 14 12.4802 13.782 12.908C13.5903 13.2843 13.2843 13.5903 12.908 13.782C12.4802 14 11.9201 14 10.8 14H5.2C4.07989 14 3.51984 14 3.09202 13.782C2.71569 13.5903 2.40973 13.2843 2.21799 12.908C2 12.4802 2 11.9201 2 10.8V8M5.33333 4.66667L8 2L10.6667 4.66667M8 2V10" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>';
409
+ var CHEVRON_RIGHT_SVG = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M5.71967 12.5303C5.42678 12.2374 5.42678 11.7626 5.71967 11.4697L9.18934 8L5.71967 4.53033C5.42678 4.23744 5.42678 3.76256 5.71967 3.46967C6.01256 3.17678 6.48744 3.17678 6.78033 3.46967L10.7803 7.46967C11.0732 7.76256 11.0732 8.23744 10.7803 8.53033L6.78033 12.5303C6.48744 12.8232 6.01256 12.8232 5.71967 12.5303Z" fill="currentColor"/></svg>';
410
+ var CHEVRON_LEFT_SVG = '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M12.8504 15.6629C13.2165 15.2968 13.2165 14.7032 12.8504 14.3371L8.51333 10L12.8504 5.66291C13.2165 5.2968 13.2165 4.7032 12.8504 4.33709C12.4843 3.97097 11.8907 3.97097 11.5246 4.33709L6.52459 9.33709C6.15847 9.7032 6.15847 10.2968 6.52459 10.6629L11.5246 15.6629C11.8907 16.029 12.4843 16.029 12.8504 15.6629Z" fill="currentColor"/></svg>';
411
+ var SUCCESS_CHECK_SVG = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M5.5 8.5L7 10L10.5 6.5M14 8C14 11.3137 11.3137 14 8 14C4.68629 14 2 11.3137 2 8C2 4.68629 4.68629 2 8 2C11.3137 2 14 4.68629 14 8Z" stroke="#52A300" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>';
412
+ var CHEVRON_DOWN_SVG = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.46967 5.71967C3.76256 5.42678 4.23744 5.42678 4.53033 5.71967L8 9.18934L11.4697 5.71967C11.7626 5.42678 12.2374 5.42678 12.5303 5.71967C12.8232 6.01256 12.8232 6.48744 12.5303 6.78033L8.53033 10.7803C8.23744 11.0732 7.76256 11.0732 7.46967 10.7803L3.46967 6.78033C3.17678 6.48744 3.17678 6.01256 3.46967 5.71967Z" fill="currentColor"/></svg>';
413
+ var CHECK_SVG = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M13.8047 4.19526C14.0651 4.45561 14.0651 4.87772 13.8047 5.13807L6.80474 12.1381C6.54439 12.3984 6.12228 12.3984 5.86193 12.1381L2.5286 8.80474C2.26825 8.54439 2.26825 8.12228 2.5286 7.86193C2.78895 7.60158 3.21106 7.60158 3.4714 7.86193L6.33333 10.7239L12.8619 4.19526C13.1223 3.93491 13.5444 3.93491 13.8047 4.19526Z" fill="currentColor"/></svg>';
414
+ function FigmaCloseIcon({ size = 20, color }) {
415
+ return renderIcon(CLOSE_SVG, size, useIconColor(color));
416
+ }
417
+ function FigmaQrScanIcon({ size = 20, color }) {
418
+ return renderIcon(QR_SCAN_SVG, size, useIconColor(color));
419
+ }
420
+ function FigmaCopyIcon({ size = 16, color }) {
421
+ return renderIcon(COPY_SVG, size, useIconColor(color));
422
+ }
423
+ function FigmaShareIcon({ size = 16, color }) {
424
+ return renderIcon(SHARE_SVG, size, useIconColor(color));
425
+ }
426
+ function FigmaChevronRightIcon({ size = 16, color }) {
427
+ return renderIcon(CHEVRON_RIGHT_SVG, size, useIconColor(color));
428
+ }
429
+ function FigmaChevronLeftIcon({ size = 20, color }) {
430
+ return renderIcon(CHEVRON_LEFT_SVG, size, useIconColor(color));
431
+ }
432
+ function FigmaSuccessCheckIcon({ size = 16 }) {
433
+ return /* @__PURE__ */ jsx(SvgXml, { xml: SUCCESS_CHECK_SVG, width: size, height: size });
434
+ }
435
+ function FigmaChevronDownIcon({ size = 16, color }) {
436
+ return renderIcon(CHEVRON_DOWN_SVG, size, useIconColor(color));
437
+ }
438
+ function FigmaCheckIcon({ size = 16, color }) {
439
+ return renderIcon(CHECK_SVG, size, useIconColor(color));
440
+ }
441
+ var INFO_CIRCLE_SVG = '<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10 9.16667V13.3333M10 6.66667H10.0083M17.5 10C17.5 14.1421 14.1421 17.5 10 17.5C5.85786 17.5 2.5 14.1421 2.5 10C2.5 5.85786 5.85786 2.5 10 2.5C14.1421 2.5 17.5 5.85786 17.5 10Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>';
442
+ function FigmaInfoCircleIcon({ size = 20, color }) {
443
+ return renderIcon(INFO_CIRCLE_SVG, size, useIconColor(color));
444
+ }
445
+ var PLUS_SVG = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M8.20833 5V11.4167M5 8.20833H11.4167" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>';
446
+ function FigmaPlusIcon({ size = 16, color }) {
447
+ return renderIcon(PLUS_SVG, size, useIconColor(color));
448
+ }
449
+
450
+ // src/flow/AddressCopiedToast.tsx
451
+ import { jsx as jsx2, jsxs } from "react/jsx-runtime";
452
+ var enterAnimation = new Keyframe({
453
+ 0: {
454
+ opacity: 0,
455
+ transform: [{ translateY: 8 }, { scale: 0.96 }]
456
+ },
457
+ 100: {
458
+ opacity: 1,
459
+ transform: [{ translateY: 0 }, { scale: 1 }],
460
+ easing: Easing.bezier(0.34, 1.36, 0.64, 1)
461
+ }
462
+ }).duration(450);
463
+ var exitAnimation = FadeOutUp.duration(350);
464
+ function AddressCopiedToast({
465
+ label: label2 = "Address copied"
466
+ }) {
467
+ return /* @__PURE__ */ jsxs(
468
+ Animated.View,
469
+ {
470
+ entering: enterAnimation,
471
+ exiting: exitAnimation,
472
+ style: styles.pill,
473
+ accessibilityRole: "alert",
474
+ accessibilityLabel: label2,
475
+ children: [
476
+ /* @__PURE__ */ jsx2(Text3, { style: styles.label, children: label2 }),
477
+ /* @__PURE__ */ jsx2(FigmaSuccessCheckIcon, { size: 16 })
478
+ ]
479
+ }
480
+ );
481
+ }
482
+ var pill = {
483
+ height: 42,
484
+ paddingHorizontal: 16,
485
+ borderRadius: 999,
486
+ backgroundColor: "#ffffff",
487
+ flexDirection: "row",
488
+ alignItems: "center",
489
+ gap: 6,
490
+ shadowColor: "#000000",
491
+ shadowOpacity: 0.08,
492
+ shadowOffset: { width: 0, height: 4 },
493
+ shadowRadius: 12
494
+ };
495
+ var label = {
496
+ color: "#111111",
497
+ fontSize: 16,
498
+ fontWeight: "500"
499
+ };
500
+ var styles = StyleSheet.create({ pill, label });
351
501
 
352
502
  // src/theme/FunkitThemeProvider.tsx
353
503
  import { ThemeProvider } from "@shopify/restyle";
354
504
  import {
505
+ createContext,
355
506
  useCallback,
356
- useContext as useContext2,
507
+ useContext,
357
508
  useMemo as useMemo2,
358
509
  useState as useState2
359
510
  } from "react";
360
- import { jsx } from "react/jsx-runtime";
511
+ import { jsx as jsx3 } from "react/jsx-runtime";
361
512
  var DEFAULT_THEMES = {
362
513
  light: defaultLightTheme,
363
514
  dark: defaultDarkTheme
364
515
  };
516
+ var FunkitColorSchemeContext = createContext(
517
+ null
518
+ );
365
519
  function FunkitThemeProvider({
366
520
  children,
367
521
  themes = DEFAULT_THEMES,
@@ -391,303 +545,854 @@ function FunkitThemeProvider({
391
545
  () => ({ colorScheme: activeScheme, toggleColorScheme, isControlled }),
392
546
  [activeScheme, toggleColorScheme, isControlled]
393
547
  );
394
- return /* @__PURE__ */ jsx(FunkitColorSchemeContext.Provider, { value, children: /* @__PURE__ */ jsx(ThemeProvider, { theme, children }) });
548
+ return /* @__PURE__ */ jsx3(FunkitColorSchemeContext.Provider, { value, children: /* @__PURE__ */ jsx3(ThemeProvider, { theme, children }) });
395
549
  }
396
550
  function useFunkitColorScheme() {
397
- const value = useContext2(FunkitColorSchemeContext);
551
+ const value = useContext(FunkitColorSchemeContext);
398
552
  if (value == null) {
399
553
  throw new Error("useFunkitColorScheme must be used within <FunkitProvider>");
400
554
  }
401
555
  return value;
402
556
  }
403
557
 
404
- // src/providers/FunkitStatsigProvider.tsx
405
- import {
406
- LogEventCompressionMode,
407
- LogLevel,
408
- StatsigProvider
409
- } from "@statsig/react-bindings";
558
+ // src/providers/FunkitProvider.tsx
559
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
560
+ import { useEffect as useEffect12, useMemo as useMemo10, useRef as useRef7 } from "react";
410
561
 
411
- // src/statsig/useClientAsyncInitRN.ts
562
+ // src/flow/FunkitFlowProvider.tsx
563
+ import { useDynamicConfig as useDynamicConfig6 } from "@funkit/connect-core";
412
564
  import {
413
- useStatsigInternalClientFactoryAsync
414
- } from "@statsig/react-bindings";
415
-
416
- // src/statsig/StatsigClientRN.ts
565
+ createContext as createContext3,
566
+ useCallback as useCallback5,
567
+ useContext as useContext3,
568
+ useEffect as useEffect11,
569
+ useMemo as useMemo8,
570
+ useRef as useRef6,
571
+ useState as useState9
572
+ } from "react";
417
573
  import {
418
- StatsigClient
419
- } from "@statsig/react-bindings";
574
+ Platform as Platform2,
575
+ Share,
576
+ StatusBar,
577
+ StyleSheet as StyleSheet3,
578
+ View as View3
579
+ } from "react-native";
420
580
 
421
- // src/statsig/rnSetup.ts
422
- import {
423
- SDKType,
424
- StatsigMetadataProvider
425
- } from "@statsig/react-bindings";
581
+ // src/geo/useCheckoutBlocked.ts
582
+ import { useEffect as useEffect2, useMemo as useMemo3 } from "react";
583
+ import { useDynamicConfig, useEffectEvent } from "@funkit/connect-core";
426
584
 
427
- // src/statsig/appVisibilityShim.ts
428
- import { _notifyVisibilityChanged } from "@statsig/react-bindings";
429
- import { AppState } from "react-native";
430
- var isApplied = false;
431
- function applyAppStateVisibilityShim() {
432
- if (isApplied) {
433
- return;
434
- }
435
- isApplied = true;
436
- AppState.addEventListener(
437
- "change",
438
- (nextAppState) => _notifyVisibilityChanged(
439
- nextAppState === "active" ? "foreground" : "background"
440
- )
441
- );
442
- }
585
+ // src/logging/logger.ts
586
+ import { FunLogger } from "@funkit/connect-core";
443
587
 
444
- // src/statsig/preloadedAsyncStorage.ts
445
- import AsyncStorage from "@react-native-async-storage/async-storage";
446
- import { Log } from "@statsig/react-bindings";
447
- var NOT_READY_ERROR = "Attempting to alter AsyncStorage before it is ready. Values will not be persisted.";
448
- function createPreloadedAsyncStorage() {
449
- const inMemoryStore = {};
450
- let isResolved = false;
451
- let readyPromise = null;
452
- const enforceIsResolved = () => {
453
- if (!isResolved) {
454
- Log.error(NOT_READY_ERROR);
588
+ // src/logging/datadogHttpLogTransport.ts
589
+ var DEFAULT_SERVICE = "connect-rn";
590
+ var DEFAULT_SITE = "datadoghq.com";
591
+ var DEFAULT_FLUSH_INTERVAL_MS = 5e3;
592
+ var DEFAULT_MAX_BATCH_SIZE = 50;
593
+ var DatadogHttpLogTransport = class {
594
+ constructor(options) {
595
+ this.consent = "granted";
596
+ this.queue = [];
597
+ this.flushTimer = null;
598
+ const site = options.site ?? DEFAULT_SITE;
599
+ this.service = options.service ?? DEFAULT_SERVICE;
600
+ this.env = options.env;
601
+ this.flushIntervalMs = options.flushIntervalMs ?? DEFAULT_FLUSH_INTERVAL_MS;
602
+ this.maxBatchSize = options.maxBatchSize ?? DEFAULT_MAX_BATCH_SIZE;
603
+ this.intakeUrl = `https://browser-intake-${site}/api/v2/logs?dd-api-key=${encodeURIComponent(options.clientToken)}&ddsource=react-native&dd-evp-origin=react-native`;
604
+ }
605
+ setEnv(environment) {
606
+ this.env = environment;
607
+ }
608
+ setTrackingConsent(consent) {
609
+ this.consent = consent;
610
+ if (consent !== "granted") {
611
+ this.queue = [];
612
+ this.clearTimer();
455
613
  }
456
- return isResolved;
457
- };
458
- const provider = {
459
- getProviderName: () => "AsyncStorage",
460
- isReady: () => isResolved,
461
- isReadyResolver: () => {
462
- if (!readyPromise) {
463
- readyPromise = prefetchFromAsyncStorage(inMemoryStore).finally(() => {
464
- isResolved = true;
465
- });
466
- }
467
- return readyPromise;
468
- },
469
- getItem: (key) => {
470
- if (!enforceIsResolved()) {
471
- return null;
472
- }
473
- return inMemoryStore[key] ?? null;
474
- },
475
- setItem: (key, value) => {
476
- inMemoryStore[key] = value;
477
- if (!enforceIsResolved()) {
478
- return;
479
- }
480
- AsyncStorage.setItem(key, value).catch(Log.error);
481
- },
482
- removeItem: (key) => {
483
- delete inMemoryStore[key];
484
- if (!enforceIsResolved()) {
485
- return;
486
- }
487
- AsyncStorage.removeItem(key).catch(Log.error);
488
- },
489
- getAllKeys: () => {
490
- if (!enforceIsResolved()) {
491
- return [];
492
- }
493
- return Object.keys(inMemoryStore);
614
+ }
615
+ log({ level, title, context, error }) {
616
+ if (this.consent !== "granted") {
617
+ return;
618
+ }
619
+ const entry = {
620
+ // Caller context first so the mandatory Datadog fields below always win —
621
+ // a future LogContext attribute named e.g. `message`/`status` can't
622
+ // silently corrupt the record.
623
+ ...context,
624
+ ddsource: "react-native",
625
+ service: this.service,
626
+ status: level,
627
+ message: title,
628
+ ...this.env ? { ddtags: `env:${this.env}` } : {},
629
+ ...error ? {
630
+ error: {
631
+ message: error.message,
632
+ stack: error.stack,
633
+ kind: error.name
634
+ }
635
+ } : {}
636
+ };
637
+ this.queue.push(entry);
638
+ if (this.queue.length >= this.maxBatchSize) {
639
+ this.flush();
640
+ } else {
641
+ this.scheduleFlush();
494
642
  }
495
- };
496
- return provider;
497
- }
498
- async function prefetchFromAsyncStorage(inMemoryStore) {
499
- const keys = await AsyncStorage.getAllKeys();
500
- await Promise.all(
501
- keys.map(async (key) => {
502
- if (!key.startsWith("statsig.")) {
503
- return;
504
- }
505
- const cache = await AsyncStorage.getItem(key);
506
- if (!cache) {
507
- return;
508
- }
509
- inMemoryStore[key] = cache;
510
- })
511
- );
512
- }
513
-
514
- // src/statsig/rnSetup.ts
515
- function setupStatsigForReactNative(statsigMetadataAdditions, options) {
516
- applyAppStateVisibilityShim();
517
- SDKType._setBindingType("rn");
518
- if (statsigMetadataAdditions) {
519
- StatsigMetadataProvider.add(statsigMetadataAdditions);
520
643
  }
521
- if (options.storageProvider == null) {
522
- options.storageProvider = createPreloadedAsyncStorage();
644
+ /** Send the buffered batch. Fire-and-forget; network errors are swallowed. */
645
+ flush() {
646
+ this.clearTimer();
647
+ if (this.queue.length === 0) {
648
+ return;
649
+ }
650
+ if (typeof fetch !== "function") {
651
+ this.queue = [];
652
+ return;
653
+ }
654
+ const batch = this.queue;
655
+ this.queue = [];
656
+ fetch(this.intakeUrl, {
657
+ method: "POST",
658
+ headers: { "Content-Type": "application/json" },
659
+ body: JSON.stringify(batch)
660
+ }).catch(() => {
661
+ });
523
662
  }
524
- applyNetworkFix(options);
525
- }
526
- function applyNetworkFix(options) {
527
- if (options.networkConfig?.networkOverrideFunc != null) {
528
- return;
663
+ scheduleFlush() {
664
+ if (this.flushTimer != null) {
665
+ return;
666
+ }
667
+ this.flushTimer = setTimeout(() => {
668
+ this.flushTimer = null;
669
+ this.flush();
670
+ }, this.flushIntervalMs);
529
671
  }
530
- const networkOverrideFunc = (url, args) => {
531
- if (args.body != null && args.method === "POST") {
532
- args.headers = {
533
- "Content-Type": "application/json",
534
- ...args.headers
535
- };
672
+ clearTimer() {
673
+ if (this.flushTimer != null) {
674
+ clearTimeout(this.flushTimer);
675
+ this.flushTimer = null;
536
676
  }
537
- return fetch(url, args);
538
- };
539
- options.networkConfig = {
540
- networkOverrideFunc,
541
- ...options.networkConfig
542
- };
677
+ }
678
+ };
679
+
680
+ // src/logging/logger.ts
681
+ var DDOG_CLIENT_TOKEN = "pub4f86c6be8c792cb48dc156a8c17d9a47";
682
+ var logger = new FunLogger(
683
+ new DatadogHttpLogTransport({
684
+ clientToken: DDOG_CLIENT_TOKEN
685
+ // service defaults to 'connect-rn' (see DatadogHttpLogTransport).
686
+ })
687
+ );
688
+
689
+ // src/geo/isCountryBlocked.ts
690
+ var ALL_MATCH = "*";
691
+ function isCountryBlocked(blockedList, userIpInfo) {
692
+ if (!userIpInfo.alpha2) {
693
+ logger.log("isUserBlockedForCheckout_NoIpDetected");
694
+ return true;
695
+ }
696
+ const isBlocked = blockedList.includes(ALL_MATCH) || blockedList.includes(userIpInfo.alpha2);
697
+ logger.info("isUserBlockedForCheckoutResult", {
698
+ isBlocked,
699
+ blockedList,
700
+ alpha2: userIpInfo.alpha2
701
+ });
702
+ return isBlocked;
543
703
  }
544
704
 
545
- // src/statsig/statsigMetadata.ts
546
- import { NativeModules, Platform } from "react-native";
547
- function resolveLocale() {
548
- if (Platform.OS === "android") {
549
- const i18nManager = NativeModules.I18nManager;
550
- return i18nManager?.localeIdentifier ?? void 0;
705
+ // src/geo/useUserIpInfo.ts
706
+ import { useQuery } from "@tanstack/react-query";
707
+ var MOONPAY_LIVE_API_KEY = "pk_live_IxayBRQuBC3RzpPZkbGPrwUsRWAaeO";
708
+ function errData(error) {
709
+ return { error: error instanceof Error ? error.message : String(error) };
710
+ }
711
+ async function getIpViaMoonpay() {
712
+ const res = await fetch(
713
+ `https://api.moonpay.com/v3/ip_address?apiKey=${MOONPAY_LIVE_API_KEY}`
714
+ );
715
+ if (!res.ok) {
716
+ throw new Error(res.statusText);
551
717
  }
552
- if (Platform.OS === "ios") {
553
- const settings = NativeModules.SettingsManager?.settings;
554
- return settings?.AppLocale ?? settings?.AppleLanguages?.[0] ?? void 0;
718
+ const data = await res.json();
719
+ return { alpha2: data.alpha2, state: data.state };
720
+ }
721
+ async function getIpViaIpApi() {
722
+ const res = await fetch("https://ipapi.co/json");
723
+ if (!res.ok) {
724
+ throw new Error(res.statusText);
555
725
  }
556
- return void 0;
726
+ const data = await res.json();
727
+ return { alpha2: data.country_code, state: data.region_code };
557
728
  }
558
- function getStatsigMetadataAdditions() {
559
- return {
560
- // Device-info-derived fields are dropped (no react-native-device-info).
561
- appVersion: void 0,
562
- systemVersion: void 0,
563
- deviceModelName: void 0,
564
- deviceModel: void 0,
565
- // Available without any native module:
566
- systemName: Platform.OS,
567
- locale: resolveLocale()
568
- };
729
+ function useUserIpInfo() {
730
+ const { data: userIpInfo, isLoading: isLoadingGeoCheck } = useQuery({
731
+ queryKey: ["getUserIpInfo"],
732
+ queryFn: async () => {
733
+ try {
734
+ return await getIpViaMoonpay();
735
+ } catch (moonpayError) {
736
+ logger.warn(
737
+ "connect-rn:getUserIpViaMoonpay:error",
738
+ errData(moonpayError)
739
+ );
740
+ try {
741
+ return await getIpViaIpApi();
742
+ } catch (ipApiError) {
743
+ logger.warn("connect-rn:getUserIpViaIpApi:error", errData(ipApiError));
744
+ throw ipApiError;
745
+ }
746
+ }
747
+ },
748
+ // Location is stable within a session; don't refetch aggressively.
749
+ staleTime: Number.POSITIVE_INFINITY,
750
+ refetchOnMount: false,
751
+ refetchOnReconnect: true,
752
+ refetchOnWindowFocus: false
753
+ });
754
+ return { userIpInfo, isLoadingGeoCheck };
569
755
  }
570
756
 
571
- // src/statsig/StatsigClientRN.ts
572
- var StatsigClientRN = class extends StatsigClient {
573
- constructor(sdkKey, user, options = null) {
574
- const opts = options ?? {};
575
- setupStatsigForReactNative(getStatsigMetadataAdditions(), opts);
576
- super(sdkKey, user, opts);
577
- this.__isRnClient = true;
578
- }
757
+ // src/geo/useCheckoutBlocked.ts
758
+ function useCheckoutBlocked(params) {
759
+ const { userIpInfo, isLoadingGeoCheck } = useUserIpInfo();
760
+ const blockedCountries = useDynamicConfig("blockedcountries");
761
+ const isGeoblocked = useMemo3(() => {
762
+ if (isLoadingGeoCheck) {
763
+ return false;
764
+ }
765
+ if (!userIpInfo) {
766
+ return true;
767
+ }
768
+ return isCountryBlocked(blockedCountries, userIpInfo);
769
+ }, [blockedCountries, isLoadingGeoCheck, userIpInfo]);
770
+ const onCheckoutBlockedEvent = useEffectEvent(() => {
771
+ params.onCheckoutBlocked?.();
772
+ });
773
+ useEffect2(() => {
774
+ if (isGeoblocked) {
775
+ onCheckoutBlockedEvent();
776
+ }
777
+ }, [isGeoblocked]);
778
+ return { isGeoblocked, isLoadingGeoCheck };
779
+ }
780
+
781
+ // src/icons/assetLogos.ts
782
+ var ASSET_LOGO_SRCS = {
783
+ $MFER: "https://sdk-cdn.fun.xyz/images/mfer.png",
784
+ AARBUSDCN: "https://sdk-cdn.fun.xyz/images/aarbusdcn.png",
785
+ AAVE: "https://sdk-cdn.fun.xyz/images/aave.svg",
786
+ AERO: "https://sdk-cdn.fun.xyz/images/aero.svg",
787
+ APE: "https://sdk-cdn.fun.xyz/images/ape.svg",
788
+ APOLWMATIC: "https://sdk-cdn.fun.xyz/images/apolwmatic.png",
789
+ ARB: "https://sdk-cdn.fun.xyz/images/arb.svg",
790
+ BEHYPE: "https://sdk-cdn.fun.xyz/images/behype.svg",
791
+ BENTO: "https://sdk-cdn.fun.xyz/images/bento.png",
792
+ BLERF: "https://sdk-cdn.fun.xyz/images/blerf.png",
793
+ BRETT: "https://sdk-cdn.fun.xyz/images/brett.svg",
794
+ BSHIB: "https://sdk-cdn.fun.xyz/images/bshib.png",
795
+ BTC: "https://sdk-cdn.fun.xyz/images/btc.svg",
796
+ CBBTC: "https://sdk-cdn.fun.xyz/images/cbbtc.svg",
797
+ CBETH: "https://sdk-cdn.fun.xyz/images/cbeth.png",
798
+ CRO: "https://sdk-cdn.fun.xyz/images/cro.svg",
799
+ CRV: "https://sdk-cdn.fun.xyz/images/crv.svg",
800
+ DAI: "https://sdk-cdn.fun.xyz/images/dai.svg",
801
+ DEGEN: "https://sdk-cdn.fun.xyz/images/degen.svg",
802
+ ETH: "https://sdk-cdn.fun.xyz/images/eth.svg",
803
+ GMX: "https://sdk-cdn.fun.xyz/images/gmx.svg",
804
+ GRT: "https://sdk-cdn.fun.xyz/images/grt.svg",
805
+ HYPE: "https://sdk-cdn.fun.xyz/images/hype.svg",
806
+ IMX: "https://sdk-cdn.fun.xyz/images/imx.svg",
807
+ INJ: "https://sdk-cdn.fun.xyz/images/inj.svg",
808
+ LDO: "https://sdk-cdn.fun.xyz/images/ldo.svg",
809
+ LINK: "https://sdk-cdn.fun.xyz/images/link.png",
810
+ LUCK: "https://sdk-cdn.fun.xyz/images/luck.png",
811
+ MATIC: "https://sdk-cdn.fun.xyz/images/matic.svg",
812
+ MFER: "https://sdk-cdn.fun.xyz/images/mfer.png",
813
+ MKR: "https://sdk-cdn.fun.xyz/images/mkr.svg",
814
+ MNT: "https://sdk-cdn.fun.xyz/images/mnt.svg",
815
+ OP: "https://sdk-cdn.fun.xyz/images/optimism.svg",
816
+ PENDLE: "https://sdk-cdn.fun.xyz/images/pendle.svg",
817
+ POL: "https://sdk-cdn.fun.xyz/images/matic.svg",
818
+ PYUSD: "https://sdk-cdn.fun.xyz/images/pyusd.svg",
819
+ QNT: "https://sdk-cdn.fun.xyz/images/qnt.svg",
820
+ RNDR: "https://sdk-cdn.fun.xyz/images/rndr.svg",
821
+ ROOST: "https://sdk-cdn.fun.xyz/images/roost.png",
822
+ SAND: "https://sdk-cdn.fun.xyz/images/sand.svg",
823
+ SHIB: "https://sdk-cdn.fun.xyz/images/shib.svg",
824
+ SNX: "https://sdk-cdn.fun.xyz/images/snx.svg",
825
+ SOL: "https://sdk-cdn.fun.xyz/images/sol.svg",
826
+ SUSDS: "https://sdk-cdn.fun.xyz/images/susds.svg",
827
+ TYBG: "https://sdk-cdn.fun.xyz/images/tybg.png",
828
+ UNI: "https://sdk-cdn.fun.xyz/images/uni.png",
829
+ USDC: "https://sdk-cdn.fun.xyz/images/usdc.svg",
830
+ "USDC.E": "https://sdk-cdn.fun.xyz/images/usdc.svg",
831
+ USDBC: "https://sdk-cdn.fun.xyz/images/usdc.svg",
832
+ USDE: "https://sdk-cdn.fun.xyz/images/usde.svg",
833
+ WUSDE: "https://sdk-cdn.fun.xyz/images/usde.svg",
834
+ EUSDE: "https://sdk-cdn.fun.xyz/images/eusde.svg",
835
+ USDT: "https://sdk-cdn.fun.xyz/images/usdt.svg",
836
+ "USD\u20AE0": "https://sdk-cdn.fun.xyz/images/usdt0.svg",
837
+ USDT0: "https://sdk-cdn.fun.xyz/images/usdt0.svg",
838
+ USDS: "https://sdk-cdn.fun.xyz/images/usds.svg",
839
+ USDH: "https://sdk-cdn.fun.xyz/images/usdh.svg",
840
+ VRTX: "https://sdk-cdn.fun.xyz/images/vrtx.svg",
841
+ WBTC: "https://sdk-cdn.fun.xyz/images/wbtc.svg",
842
+ WEETH: "https://sdk-cdn.fun.xyz/images/weeth.png",
843
+ WETH: "https://sdk-cdn.fun.xyz/images/weth.svg",
844
+ WHYPE: "https://sdk-cdn.fun.xyz/images/whype.png",
845
+ WSTETH: "https://sdk-cdn.fun.xyz/images/wsteth.png",
846
+ TRUMP: "https://sdk-cdn.fun.xyz/images/trump.png",
847
+ BNB: "https://sdk-cdn.fun.xyz/images/bsc.svg",
848
+ WBNB: "https://sdk-cdn.fun.xyz/images/bsc.svg",
849
+ BTCB: "https://sdk-cdn.fun.xyz/images/btc.svg",
850
+ UBTC: "https://sdk-cdn.fun.xyz/images/btc.svg",
851
+ BUSD: "https://sdk-cdn.fun.xyz/images/busd.svg",
852
+ XAUT: "https://sdk-cdn.fun.xyz/images/xaut.png",
853
+ ADA: "https://sdk-cdn.fun.xyz/images/ada.svg",
854
+ XRP: "https://sdk-cdn.fun.xyz/images/xrp.svg",
855
+ UDOGE: "https://sdk-cdn.fun.xyz/images/doge.svg",
856
+ DOGE: "https://sdk-cdn.fun.xyz/images/doge.svg",
857
+ LTC: "https://sdk-cdn.fun.xyz/images/ltc.svg",
858
+ HNT: "https://sdk-cdn.fun.xyz/images/hnt.svg",
859
+ COMP: "https://sdk-cdn.fun.xyz/images/comp.svg",
860
+ PEPE: "https://sdk-cdn.fun.xyz/images/pepe.svg",
861
+ LSTHYPE: "https://sdk-cdn.fun.xyz/images/lsthype.svg",
862
+ HBUSDT: "https://sdk-cdn.fun.xyz/images/hbusdt.svg",
863
+ WVLP: "https://sdk-cdn.fun.xyz/images/wvlp.svg",
864
+ LIQUIDHYPE: "https://sdk-cdn.fun.xyz/images/liquidhype.svg",
865
+ VHYPE: "https://sdk-cdn.fun.xyz/images/vhype.png",
866
+ HBHYPE: "https://sdk-cdn.fun.xyz/images/hbhype.svg",
867
+ MON: "https://sdk-cdn.fun.xyz/images/monad.svg",
868
+ WMON: "https://sdk-cdn.fun.xyz/images/wmon.svg",
869
+ AUSD: "https://sdk-cdn.fun.xyz/images/ausd.svg",
870
+ SUSHI: "https://sdk-cdn.fun.xyz/images/sushi.svg",
871
+ SKY: "https://sdk-cdn.fun.xyz/images/sky.svg",
872
+ LIT: "https://sdk-cdn.fun.xyz/images/lit.svg",
873
+ AZTEC: "https://sdk-cdn.fun.xyz/images/aztec.svg",
874
+ U: "https://sdk-cdn.fun.xyz/images/u.png",
875
+ PUSD: "https://sdk-cdn.fun.xyz/images/pusd.svg"
579
876
  };
877
+ var FALLBACK_ASSET_LOGO = "https://sdk-cdn.fun.xyz/images/dollar_circle.png";
580
878
 
581
- // src/statsig/useClientAsyncInitRN.ts
582
- function useClientAsyncInitRN(sdkKey, initialUser, statsigOptions = null) {
583
- return useStatsigInternalClientFactoryAsync(
584
- (args) => new StatsigClientRN(args.sdkKey, args.initialUser, args.statsigOptions),
879
+ // src/icons/CryptoBitcoinIcon.tsx
880
+ import { SvgXml as SvgXml2 } from "react-native-svg";
881
+ import { jsx as jsx4 } from "react/jsx-runtime";
882
+ var CIRCLE_BITCOIN_SVG = `<svg viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M12.9168 11.8737C12.9168 12.449 12.4505 12.9154 11.8752 12.9154H8.75016V10.832H11.8752C12.4505 10.832 12.9168 11.2984 12.9168 11.8737Z" fill="currentColor"/><path d="M11.4585 7.08203H8.75016V9.16536H11.4585C12.0338 9.16536 12.5002 8.69899 12.5002 8.1237C12.5002 7.5484 12.0338 7.08203 11.4585 7.08203Z" fill="currentColor"/><path fill-rule="evenodd" clip-rule="evenodd" d="M10.0002 0.832031C4.93755 0.832031 0.833496 4.93609 0.833496 9.9987C0.833496 15.0613 4.93755 19.1654 10.0002 19.1654C15.0628 19.1654 19.1668 15.0613 19.1668 9.9987C19.1668 4.93609 15.0628 0.832031 10.0002 0.832031ZM8.3335 4.16536C8.79373 4.16536 9.16683 4.53846 9.16683 4.9987V5.41536H10.0002V4.9987C10.0002 4.53846 10.3733 4.16536 10.8335 4.16536C11.2937 4.16536 11.6668 4.53846 11.6668 4.9987V5.42326C13.0653 5.52964 14.1668 6.69803 14.1668 8.1237C14.1668 8.74941 13.9546 9.32557 13.5983 9.78413C14.2 10.2809 14.5835 11.0325 14.5835 11.8737C14.5835 13.3695 13.3709 14.582 11.8752 14.582H11.6668V14.9987C11.6668 15.4589 11.2937 15.832 10.8335 15.832C10.3733 15.832 10.0002 15.4589 10.0002 14.9987V14.582H9.16683V14.9987C9.16683 15.4589 8.79373 15.832 8.3335 15.832C7.87326 15.832 7.50016 15.4589 7.50016 14.9987V14.582H6.66683C6.20659 14.582 5.8335 14.2089 5.8335 13.7487C5.8335 13.2885 6.20659 12.9154 6.66683 12.9154H7.0835V7.08203H6.66683C6.20659 7.08203 5.8335 6.70894 5.8335 6.2487C5.8335 5.78846 6.20659 5.41536 6.66683 5.41536H7.50016V4.9987C7.50016 4.53846 7.87326 4.16536 8.3335 4.16536Z" fill="currentColor"/></svg>`;
883
+ function CryptoBitcoinIcon({ size = 28 }) {
884
+ const theme = useTheme();
885
+ return /* @__PURE__ */ jsx4(
886
+ SvgXml2,
585
887
  {
586
- sdkKey,
587
- initialUser,
588
- statsigOptions
888
+ xml: CIRCLE_BITCOIN_SVG,
889
+ width: size,
890
+ height: size,
891
+ color: theme.colors.textPrimary
589
892
  }
590
893
  );
591
894
  }
592
895
 
593
- // src/providers/FunkitStatsigProvider.tsx
594
- import { jsx as jsx2 } from "react/jsx-runtime";
595
- var STATSIG_API = "https://data-api.fun.xyz/v1";
596
- var STATSIG_CLIENT_KEY = "client-UmFd8WIJljA7cLmZuDqs3X25M8sKd5WIQP4BSC2bRbM";
597
- function FunkitStatsigProvider({
598
- children,
599
- isDevelopment = false
600
- }) {
601
- const { client } = useClientAsyncInitRN(
602
- STATSIG_CLIENT_KEY,
603
- {},
604
- {
605
- networkConfig: {
606
- api: STATSIG_API,
607
- // default timeout (10s) is too large; statsig usually responds <200ms
608
- networkTimeoutMs: 5e3
609
- },
610
- // Our proxy supports compression; force it on to save bandwidth.
611
- logEventCompressionMode: LogEventCompressionMode.Forced,
612
- // Silence harmless warnings from hooks running before async init (we have
613
- // bootstrap fallbacks).
614
- logLevel: isDevelopment ? void 0 : LogLevel.Error,
615
- environment: {
616
- tier: isDevelopment ? "development" : "production"
617
- }
896
+ // src/icons/FunIcon.tsx
897
+ import { useEffect as useEffect3, useState as useState3 } from "react";
898
+ import { Image } from "react-native";
899
+ import { SvgXml as SvgXml3 } from "react-native-svg";
900
+ import { jsx as jsx5 } from "react/jsx-runtime";
901
+ var svgCache = /* @__PURE__ */ new Map();
902
+ function ensureViewBox(svg) {
903
+ if (/\bviewBox\s*=/.test(svg)) {
904
+ return svg;
905
+ }
906
+ const width = svg.match(/\bwidth="([\d.]+)"/)?.[1];
907
+ const height = svg.match(/\bheight="([\d.]+)"/)?.[1];
908
+ if (!width || !height) {
909
+ return svg;
910
+ }
911
+ return svg.replace(/<svg\b/, `<svg viewBox="0 0 ${width} ${height}"`);
912
+ }
913
+ function FunIcon({ uri, size = 32, fallbackUri }) {
914
+ const [currentUri, setCurrentUri] = useState3(uri);
915
+ const isSvg = currentUri.endsWith(".svg");
916
+ const [xml, setXml] = useState3(
917
+ () => svgCache.get(currentUri) ?? null
918
+ );
919
+ const [rasterLoaded, setRasterLoaded] = useState3(false);
920
+ useEffect3(() => {
921
+ setCurrentUri(uri);
922
+ setRasterLoaded(false);
923
+ setXml(svgCache.get(uri) ?? null);
924
+ }, [uri]);
925
+ const onFailure = () => {
926
+ if (fallbackUri && currentUri !== fallbackUri) {
927
+ setCurrentUri(fallbackUri);
928
+ setRasterLoaded(false);
929
+ setXml(svgCache.get(fallbackUri) ?? null);
930
+ }
931
+ };
932
+ useEffect3(() => {
933
+ if (!isSvg) {
934
+ return;
935
+ }
936
+ const cached = svgCache.get(currentUri);
937
+ if (cached != null) {
938
+ setXml(cached);
939
+ return;
940
+ }
941
+ let active = true;
942
+ fetch(currentUri).then((res) => {
943
+ if (!res.ok) {
944
+ throw new Error(`icon fetch ${res.status}`);
945
+ }
946
+ return res.text();
947
+ }).then((text) => {
948
+ if (!text.includes("<svg")) {
949
+ throw new Error("icon response is not an SVG");
950
+ }
951
+ const normalized = ensureViewBox(text);
952
+ svgCache.set(currentUri, normalized);
953
+ if (active) {
954
+ setXml(normalized);
955
+ }
956
+ }).catch(() => {
957
+ if (active) {
958
+ onFailure();
959
+ }
960
+ });
961
+ return () => {
962
+ active = false;
963
+ };
964
+ }, [currentUri, isSvg]);
965
+ const ready = isSvg ? xml != null : rasterLoaded;
966
+ const clip = { overflow: "hidden" };
967
+ return /* @__PURE__ */ jsx5(
968
+ Box,
969
+ {
970
+ width: size,
971
+ height: size,
972
+ borderRadius: "rounded",
973
+ backgroundColor: ready ? void 0 : "bgSecondary",
974
+ style: clip,
975
+ children: isSvg ? xml != null ? /* @__PURE__ */ jsx5(SvgXml3, { xml, width: size, height: size }) : null : /* @__PURE__ */ jsx5(
976
+ Image,
977
+ {
978
+ source: { uri: currentUri },
979
+ style: { width: size, height: size },
980
+ onLoad: () => setRasterLoaded(true),
981
+ onError: onFailure
982
+ }
983
+ )
618
984
  }
619
985
  );
620
- return /* @__PURE__ */ jsx2(StatsigProvider, { client, children });
621
986
  }
622
987
 
623
- // src/providers/FunkitProvider.tsx
624
- import { jsx as jsx3 } from "react/jsx-runtime";
625
- function FunkitProvider({
626
- children,
627
- themes,
628
- colorScheme,
629
- debug = false
988
+ // src/icons/funIconUri.ts
989
+ var CDN_BASE = "https://sdk-cdn.fun.xyz/images";
990
+ var chainIconUri = (chainKey) => `${CDN_BASE}/${chainKey}.svg`;
991
+ var tokenLogoUri = (symbol) => ASSET_LOGO_SRCS[symbol.toUpperCase()] ?? `${CDN_BASE}/${symbol.toLowerCase()}.svg`;
992
+
993
+ // src/icons/QrChainCluster.tsx
994
+ import { jsx as jsx6 } from "react/jsx-runtime";
995
+ function toIconUri(icon) {
996
+ return icon.startsWith("http") ? icon : chainIconUri(icon);
997
+ }
998
+ var CARD_SIZE = 51;
999
+ var SINGLE_SIZE = 40;
1000
+ var GRID_SIZE = 20;
1001
+ var GRID_GAP = 3;
1002
+ function QrChainCluster({ iconKeys, max = 4 }) {
1003
+ const keys = iconKeys.slice(0, max);
1004
+ const first = keys[0];
1005
+ if (first == null) {
1006
+ return null;
1007
+ }
1008
+ if (keys.length === 1) {
1009
+ return /* @__PURE__ */ jsx6(Box, { alignItems: "center", justifyContent: "center", style: card, children: /* @__PURE__ */ jsx6(Box, { style: ring(SINGLE_SIZE), children: /* @__PURE__ */ jsx6(
1010
+ FunIcon,
1011
+ {
1012
+ uri: toIconUri(first),
1013
+ size: SINGLE_SIZE,
1014
+ fallbackUri: FALLBACK_ASSET_LOGO
1015
+ }
1016
+ ) }) });
1017
+ }
1018
+ return /* @__PURE__ */ jsx6(Box, { alignItems: "center", justifyContent: "center", style: card, children: /* @__PURE__ */ jsx6(Box, { flexDirection: "row", flexWrap: "wrap", style: grid, children: keys.map((key) => /* @__PURE__ */ jsx6(Box, { style: ring(GRID_SIZE), children: /* @__PURE__ */ jsx6(
1019
+ FunIcon,
1020
+ {
1021
+ uri: toIconUri(key),
1022
+ size: GRID_SIZE,
1023
+ fallbackUri: FALLBACK_ASSET_LOGO
1024
+ }
1025
+ ) }, key)) }) });
1026
+ }
1027
+ var grid = {
1028
+ width: GRID_SIZE * 2 + GRID_GAP,
1029
+ gap: GRID_GAP
1030
+ };
1031
+ var card = {
1032
+ width: CARD_SIZE,
1033
+ height: CARD_SIZE,
1034
+ borderRadius: 16,
1035
+ backgroundColor: "#FFFFFF"
1036
+ };
1037
+ var ring = (iconSize) => ({
1038
+ width: iconSize,
1039
+ height: iconSize,
1040
+ borderRadius: 999,
1041
+ backgroundColor: "#FFFFFF",
1042
+ overflow: "hidden"
1043
+ });
1044
+
1045
+ // src/icons/SourceTokenCluster.tsx
1046
+ import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
1047
+ function toIconUri2(icon) {
1048
+ return icon.startsWith("http") ? icon : chainIconUri(icon);
1049
+ }
1050
+ function SourceTokenCluster({
1051
+ icons,
1052
+ maxVisible = 4,
1053
+ size = 16,
1054
+ gap = 2,
1055
+ overflowMode = "count"
1056
+ }) {
1057
+ const theme = useTheme();
1058
+ const visible = icons.slice(0, maxVisible);
1059
+ const overflow = icons.length - visible.length;
1060
+ return /* @__PURE__ */ jsxs2(Box, { flexDirection: "row", alignItems: "center", style: { gap }, children: [
1061
+ visible.map((icon) => /* @__PURE__ */ jsx7(Box, { backgroundColor: "bgSecondary", style: iconRing(size), children: /* @__PURE__ */ jsx7(
1062
+ FunIcon,
1063
+ {
1064
+ uri: toIconUri2(icon),
1065
+ size,
1066
+ fallbackUri: FALLBACK_ASSET_LOGO
1067
+ }
1068
+ ) }, icon)),
1069
+ overflow > 0 ? (
1070
+ // Both chips are a fixed `size`×`size` circle (Figma). The "+" glyph sits
1071
+ // on `bgSecondary` (Add money `crypto2`); the "+N" count on `pillPressed`
1072
+ // (Transfer `tap-target`).
1073
+ /* @__PURE__ */ jsx7(
1074
+ Box,
1075
+ {
1076
+ backgroundColor: overflowMode === "plus" ? "bgSecondary" : "pillPressed",
1077
+ alignItems: "center",
1078
+ justifyContent: "center",
1079
+ style: overflowCircle(size),
1080
+ children: overflowMode === "plus" ? (
1081
+ // The geometric "+" glyph centers cleanly; the text "+" did not.
1082
+ /* @__PURE__ */ jsx7(FigmaPlusIcon, { size, color: theme.colors.textSecondary })
1083
+ ) : /* @__PURE__ */ jsx7(
1084
+ Text,
1085
+ {
1086
+ variant: "bodyMedium",
1087
+ color: "textSecondary",
1088
+ style: overflowText(size),
1089
+ children: `+${overflow}`
1090
+ }
1091
+ )
1092
+ }
1093
+ )
1094
+ ) : null
1095
+ ] });
1096
+ }
1097
+ var iconRing = (size) => ({
1098
+ width: size,
1099
+ height: size,
1100
+ borderRadius: 999,
1101
+ borderWidth: 1,
1102
+ borderColor: "rgba(0,0,0,0.1)",
1103
+ overflow: "hidden",
1104
+ // Center the same-size FunIcon so the border-box hairline doesn't push it 1px
1105
+ // off and clip the bottom-right; it fills the circle with the border on edge.
1106
+ alignItems: "center",
1107
+ justifyContent: "center"
1108
+ });
1109
+ var overflowCircle = (size) => ({
1110
+ width: size,
1111
+ height: size,
1112
+ borderRadius: 999
1113
+ });
1114
+ var overflowText = (size) => ({
1115
+ fontSize: Math.round(size * 0.6),
1116
+ letterSpacing: -0.48
1117
+ });
1118
+
1119
+ // src/icons/TokenChainIcon.tsx
1120
+ import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
1121
+ function TokenChainIcon({
1122
+ symbol,
1123
+ iconSrc,
1124
+ chainKey,
1125
+ size = 24
630
1126
  }) {
631
- return /* @__PURE__ */ jsx3(FunkitStatsigProvider, { isDevelopment: debug, children: /* @__PURE__ */ jsx3(FunkitThemeProvider, { themes, colorScheme, children }) });
1127
+ const badge = Math.round(size * 0.5);
1128
+ return /* @__PURE__ */ jsxs3(Box, { width: size, height: size, children: [
1129
+ /* @__PURE__ */ jsx8(
1130
+ FunIcon,
1131
+ {
1132
+ uri: iconSrc ?? tokenLogoUri(symbol),
1133
+ size,
1134
+ fallbackUri: FALLBACK_ASSET_LOGO
1135
+ }
1136
+ ),
1137
+ chainKey ? /* @__PURE__ */ jsx8(
1138
+ Box,
1139
+ {
1140
+ backgroundColor: "bgModal",
1141
+ borderRadius: "rounded",
1142
+ alignItems: "center",
1143
+ justifyContent: "center",
1144
+ style: badgeRing(badge),
1145
+ children: /* @__PURE__ */ jsx8(
1146
+ FunIcon,
1147
+ {
1148
+ uri: chainIconUri(chainKey),
1149
+ size: badge,
1150
+ fallbackUri: FALLBACK_ASSET_LOGO
1151
+ }
1152
+ )
1153
+ }
1154
+ ) : null
1155
+ ] });
632
1156
  }
1157
+ var badgeRing = (badge) => ({
1158
+ position: "absolute",
1159
+ right: -1,
1160
+ bottom: -1,
1161
+ width: badge + 2,
1162
+ height: badge + 2
1163
+ });
633
1164
 
634
1165
  // src/screens/AddMoneyScreen.tsx
635
- import { useTheme } from "@shopify/restyle";
636
- import { Pressable, ScrollView, StyleSheet } from "react-native";
637
- import { jsx as jsx4, jsxs } from "react/jsx-runtime";
1166
+ import { useEffect as useEffect4, useRef, useState as useState4 } from "react";
1167
+ import { Animated as Animated2, Pressable, ScrollView } from "react-native";
1168
+ import Reanimated, {
1169
+ Easing as Easing2,
1170
+ Keyframe as Keyframe2,
1171
+ useAnimatedStyle,
1172
+ useSharedValue,
1173
+ withTiming
1174
+ } from "react-native-reanimated";
1175
+ import { Fragment, jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
1176
+ var DROPDOWN_OPEN_DURATION = 250;
1177
+ var DROPDOWN_CLOSE_DURATION = 150;
1178
+ var DROPDOWN_EASING = Easing2.bezier(0.22, 1, 0.36, 1);
1179
+ var DROPDOWN_PRE_SCALE = 0.97;
1180
+ var DROPDOWN_TRANSLATE_Y = -4;
1181
+ var AnimatedPressable = Reanimated.createAnimatedComponent(Pressable);
1182
+ var menuEnter = new Keyframe2({
1183
+ 0: {
1184
+ opacity: 0,
1185
+ transform: [
1186
+ { translateY: DROPDOWN_TRANSLATE_Y },
1187
+ { scale: DROPDOWN_PRE_SCALE }
1188
+ ]
1189
+ },
1190
+ 100: {
1191
+ opacity: 1,
1192
+ transform: [{ translateY: 0 }, { scale: 1 }],
1193
+ easing: DROPDOWN_EASING
1194
+ }
1195
+ }).duration(DROPDOWN_OPEN_DURATION);
1196
+ var menuExit = new Keyframe2({
1197
+ 0: {
1198
+ opacity: 1,
1199
+ transform: [{ translateY: 0 }, { scale: 1 }]
1200
+ },
1201
+ 100: {
1202
+ opacity: 0,
1203
+ transform: [
1204
+ { translateY: DROPDOWN_TRANSLATE_Y },
1205
+ { scale: DROPDOWN_PRE_SCALE }
1206
+ ],
1207
+ easing: DROPDOWN_EASING
1208
+ }
1209
+ }).duration(DROPDOWN_CLOSE_DURATION);
1210
+ var scrimEnter = new Keyframe2({
1211
+ 0: { opacity: 0 },
1212
+ 100: { opacity: 1, easing: DROPDOWN_EASING }
1213
+ }).duration(DROPDOWN_OPEN_DURATION);
1214
+ var scrimExit = new Keyframe2({
1215
+ 0: { opacity: 1 },
1216
+ 100: { opacity: 0, easing: DROPDOWN_EASING }
1217
+ }).duration(DROPDOWN_CLOSE_DURATION);
1218
+ var DEFAULT_ERROR_TITLE = "Something went wrong";
1219
+ var DEFAULT_ERROR_MESSAGE = "There was a problem loading data.\nCheck your internet and try again.";
1220
+ var DEFAULT_RETRY_LABEL = "Try again";
638
1221
  function AddMoneyScreen({
639
1222
  methods,
640
1223
  onSelectMethod,
641
- title = "Add money"
1224
+ title = "Add money",
1225
+ loading = false,
1226
+ skeletonCount,
1227
+ error = false,
1228
+ onRetry,
1229
+ errorTitle = DEFAULT_ERROR_TITLE,
1230
+ errorMessage = DEFAULT_ERROR_MESSAGE,
1231
+ retryLabel = DEFAULT_RETRY_LABEL,
1232
+ receiveTokens,
1233
+ selectedReceiveTokenId,
1234
+ onSelectReceiveToken,
1235
+ depositToLabel = "Deposit to",
1236
+ payWithLabel = "Pay with",
1237
+ initialDropdownOpen = false
642
1238
  }) {
643
- const theme = useTheme();
644
- return /* @__PURE__ */ jsxs(
1239
+ const selected = receiveTokens?.find((t) => t.id === selectedReceiveTokenId);
1240
+ const showDropdown = receiveTokens && receiveTokens.length > 0 && selected;
1241
+ const [dropdownOpen, setDropdownOpen] = useState4(initialDropdownOpen);
1242
+ const scrimVisible = !error && showDropdown && dropdownOpen;
1243
+ return /* @__PURE__ */ jsxs4(
645
1244
  Box,
646
1245
  {
647
1246
  backgroundColor: "bgModal",
648
1247
  borderTopLeftRadius: "modal",
649
1248
  borderTopRightRadius: "modal",
650
1249
  children: [
651
- /* @__PURE__ */ jsxs(Box, { alignItems: "center", style: styles.topBar, children: [
652
- /* @__PURE__ */ jsx4(Box, { backgroundColor: "borderFocused", style: styles.grabber }),
653
- /* @__PURE__ */ jsx4(Text, { variant: "bodyMedium", color: "textPrimary", children: title })
1250
+ /* @__PURE__ */ jsxs4(Box, { alignItems: "center", style: topBar, children: [
1251
+ /* @__PURE__ */ jsx9(Box, { backgroundColor: "borderFocused", style: grabber }),
1252
+ /* @__PURE__ */ jsx9(Text, { variant: "bodyMedium", color: "textPrimary", children: title })
654
1253
  ] }),
655
- /* @__PURE__ */ jsx4(
656
- ScrollView,
1254
+ error ? /* @__PURE__ */ jsx9(
1255
+ AddMoneyError,
657
1256
  {
658
- contentContainerStyle: [
659
- styles.listContent,
660
- // Bind the horizontal padding to the spacing token (ScrollView can't
661
- // take Restyle props) so it tracks the theme instead of a raw 16.
662
- { paddingHorizontal: theme.spacing.modalHorizontal }
663
- ],
664
- showsVerticalScrollIndicator: false,
665
- children: methods.map((method) => /* @__PURE__ */ jsx4(
666
- Pressable,
1257
+ title: errorTitle,
1258
+ message: errorMessage,
1259
+ retryLabel,
1260
+ onRetry
1261
+ }
1262
+ ) : loading ? /* @__PURE__ */ jsx9(
1263
+ AddMoneyLoading,
1264
+ {
1265
+ count: skeletonCount,
1266
+ showDropdown: Boolean(showDropdown),
1267
+ depositToLabel,
1268
+ payWithLabel
1269
+ }
1270
+ ) : /* @__PURE__ */ jsxs4(Fragment, { children: [
1271
+ showDropdown ? /* @__PURE__ */ jsxs4(Box, { style: depositSection, children: [
1272
+ /* @__PURE__ */ jsx9(Box, { style: sectionLabel, children: /* @__PURE__ */ jsx9(Text, { variant: "detail", weight: "medium", color: "textSecondary", children: depositToLabel }) }),
1273
+ /* @__PURE__ */ jsx9(
1274
+ ReceiveTokenDropdown,
667
1275
  {
668
- onPress: () => onSelectMethod(method.id),
669
- accessibilityRole: "button",
670
- accessibilityLabel: method.title,
671
- children: /* @__PURE__ */ jsx4(PaymentMethodRow, { method })
672
- },
673
- method.id
674
- ))
1276
+ tokens: receiveTokens,
1277
+ selected,
1278
+ open: dropdownOpen,
1279
+ onToggle: () => setDropdownOpen((o) => !o),
1280
+ onSelect: (id) => {
1281
+ onSelectReceiveToken?.(id);
1282
+ setDropdownOpen(false);
1283
+ }
1284
+ }
1285
+ )
1286
+ ] }) : null,
1287
+ showDropdown ? (
1288
+ // "Pay with" section: a labeled, bordered card wrapping the method
1289
+ // rows with hairline dividers between them (Figma node 11202:8282).
1290
+ /* @__PURE__ */ jsxs4(Box, { style: payWithSection, children: [
1291
+ /* @__PURE__ */ jsx9(Box, { style: sectionLabel, children: /* @__PURE__ */ jsx9(Text, { variant: "detail", weight: "medium", color: "textSecondary", children: payWithLabel }) }),
1292
+ /* @__PURE__ */ jsx9(
1293
+ Box,
1294
+ {
1295
+ backgroundColor: "bgModal",
1296
+ borderColor: "borderDefault",
1297
+ borderWidth: 1,
1298
+ borderRadius: "element",
1299
+ style: methodsCard,
1300
+ children: methods.map((method, i) => /* @__PURE__ */ jsxs4(Box, { children: [
1301
+ i > 0 ? /* @__PURE__ */ jsx9(MethodDivider, {}) : null,
1302
+ /* @__PURE__ */ jsx9(
1303
+ Pressable,
1304
+ {
1305
+ onPress: () => onSelectMethod(method.id),
1306
+ accessibilityRole: "button",
1307
+ accessibilityLabel: method.title,
1308
+ children: /* @__PURE__ */ jsx9(PaymentMethodRow, { method })
1309
+ }
1310
+ )
1311
+ ] }, method.id))
1312
+ }
1313
+ )
1314
+ ] })
1315
+ ) : (
1316
+ // Methods-only: bare rows with full-width hairline dividers, no
1317
+ // outer border (Figma node 11202:8632).
1318
+ /* @__PURE__ */ jsx9(
1319
+ ScrollView,
1320
+ {
1321
+ contentContainerStyle: listContent,
1322
+ showsVerticalScrollIndicator: false,
1323
+ children: methods.map((method, i) => /* @__PURE__ */ jsxs4(Box, { children: [
1324
+ i > 0 ? /* @__PURE__ */ jsx9(MethodDivider, {}) : null,
1325
+ /* @__PURE__ */ jsx9(
1326
+ Pressable,
1327
+ {
1328
+ onPress: () => onSelectMethod(method.id),
1329
+ accessibilityRole: "button",
1330
+ accessibilityLabel: method.title,
1331
+ children: /* @__PURE__ */ jsx9(PaymentMethodRow, { method })
1332
+ }
1333
+ )
1334
+ ] }, method.id))
1335
+ }
1336
+ )
1337
+ )
1338
+ ] }),
1339
+ scrimVisible ? /* @__PURE__ */ jsx9(
1340
+ AnimatedPressable,
1341
+ {
1342
+ entering: scrimEnter,
1343
+ exiting: scrimExit,
1344
+ style: scrim,
1345
+ onPress: () => setDropdownOpen(false),
1346
+ accessibilityRole: "button",
1347
+ accessibilityLabel: "Close"
675
1348
  }
676
- )
1349
+ ) : null
677
1350
  ]
678
1351
  }
679
1352
  );
680
1353
  }
1354
+ function AddMoneyError({
1355
+ title,
1356
+ message,
1357
+ retryLabel,
1358
+ onRetry
1359
+ }) {
1360
+ return /* @__PURE__ */ jsxs4(Box, { alignItems: "center", justifyContent: "center", style: errorContainer, children: [
1361
+ /* @__PURE__ */ jsxs4(Box, { alignItems: "center", style: errorText, children: [
1362
+ /* @__PURE__ */ jsx9(Text, { variant: "bodyMedium", color: "textPrimary", children: title }),
1363
+ /* @__PURE__ */ jsx9(Text, { variant: "detail", color: "textSecondary", style: errorMessageText, children: message })
1364
+ ] }),
1365
+ /* @__PURE__ */ jsx9(
1366
+ Pressable,
1367
+ {
1368
+ onPress: onRetry,
1369
+ accessibilityRole: "button",
1370
+ accessibilityLabel: retryLabel,
1371
+ children: /* @__PURE__ */ jsx9(
1372
+ Box,
1373
+ {
1374
+ backgroundColor: "btnPrimary",
1375
+ borderRadius: "rounded",
1376
+ alignItems: "center",
1377
+ justifyContent: "center",
1378
+ style: retryButton,
1379
+ children: /* @__PURE__ */ jsx9(Text, { variant: "bodyMedium", color: "onBtnPrimary", children: retryLabel })
1380
+ }
1381
+ )
1382
+ }
1383
+ )
1384
+ ] });
1385
+ }
681
1386
  function PaymentMethodRow({ method }) {
682
- return /* @__PURE__ */ jsxs(
1387
+ return /* @__PURE__ */ jsxs4(
683
1388
  Box,
684
1389
  {
685
1390
  flexDirection: "row",
686
1391
  alignItems: "center",
687
1392
  gap: "elementsHorizontal",
688
- style: styles.row,
1393
+ style: row,
689
1394
  children: [
690
- /* @__PURE__ */ jsx4(
1395
+ /* @__PURE__ */ jsx9(
691
1396
  Box,
692
1397
  {
693
1398
  width: 48,
@@ -699,385 +1404,977 @@ function PaymentMethodRow({ method }) {
699
1404
  children: method.icon
700
1405
  }
701
1406
  ),
702
- /* @__PURE__ */ jsxs(Box, { flex: 1, style: styles.details, children: [
703
- /* @__PURE__ */ jsx4(Text, { variant: "bodyMedium", color: "textPrimary", children: method.title }),
704
- method.subtitle ? /* @__PURE__ */ jsx4(Text, { variant: "detail", color: "textSecondary", children: method.subtitle }) : null
1407
+ /* @__PURE__ */ jsxs4(Box, { flex: 1, style: details, children: [
1408
+ /* @__PURE__ */ jsx9(Text, { variant: "bodyMedium", color: "textPrimary", children: method.title }),
1409
+ method.subtitle ? /* @__PURE__ */ jsx9(Text, { variant: "detail", color: "textSecondary", children: method.subtitle }) : null
705
1410
  ] }),
706
1411
  method.trailing
707
1412
  ]
708
1413
  }
709
1414
  );
710
1415
  }
711
- var styles = StyleSheet.create({
712
- topBar: { paddingTop: 20, paddingBottom: 12 },
713
- grabber: {
714
- position: "absolute",
715
- top: 8,
716
- width: 36,
717
- height: 5,
718
- borderRadius: 999
719
- },
720
- listContent: {
721
- paddingBottom: 16,
722
- gap: 6
723
- },
724
- row: { paddingVertical: 10 },
725
- details: { gap: 2 }
726
- });
1416
+ function MethodDivider() {
1417
+ return /* @__PURE__ */ jsx9(Box, { backgroundColor: "borderDefault", style: divider });
1418
+ }
1419
+ function ReceiveTokenDropdown({
1420
+ tokens,
1421
+ selected,
1422
+ open,
1423
+ onToggle,
1424
+ onSelect
1425
+ }) {
1426
+ const selectable = tokens.length > 1;
1427
+ return /* @__PURE__ */ jsxs4(Box, { style: dropdownAnchor, children: [
1428
+ /* @__PURE__ */ jsx9(
1429
+ Pressable,
1430
+ {
1431
+ onPress: selectable ? onToggle : void 0,
1432
+ accessibilityRole: "button",
1433
+ accessibilityLabel: selected.label,
1434
+ children: /* @__PURE__ */ jsxs4(
1435
+ Box,
1436
+ {
1437
+ flexDirection: "row",
1438
+ alignItems: "center",
1439
+ justifyContent: "space-between",
1440
+ backgroundColor: "bgModal",
1441
+ borderColor: "borderDefault",
1442
+ borderWidth: 1,
1443
+ borderRadius: "element",
1444
+ style: dropdownTrigger,
1445
+ children: [
1446
+ /* @__PURE__ */ jsxs4(Box, { flexDirection: "row", alignItems: "center", style: triggerLeft, children: [
1447
+ selected.icon ?? /* @__PURE__ */ jsx9(ReceiveTokenIconFallback, {}),
1448
+ /* @__PURE__ */ jsx9(
1449
+ Text,
1450
+ {
1451
+ variant: "bodyMedium",
1452
+ color: "textPrimary",
1453
+ numberOfLines: 1,
1454
+ style: triggerLabel,
1455
+ children: selected.label
1456
+ }
1457
+ )
1458
+ ] }),
1459
+ selectable ? /* @__PURE__ */ jsx9(AnimatedChevron, { open }) : null
1460
+ ]
1461
+ }
1462
+ )
1463
+ }
1464
+ ),
1465
+ open && selectable ? /* @__PURE__ */ jsx9(
1466
+ Reanimated.View,
1467
+ {
1468
+ entering: menuEnter,
1469
+ exiting: menuExit,
1470
+ style: dropdownMenuOverlay,
1471
+ children: /* @__PURE__ */ jsx9(
1472
+ Box,
1473
+ {
1474
+ backgroundColor: "bgModal",
1475
+ borderRadius: "element",
1476
+ style: dropdownMenu,
1477
+ children: tokens.map((token) => /* @__PURE__ */ jsx9(
1478
+ Pressable,
1479
+ {
1480
+ onPress: () => onSelect(token.id),
1481
+ accessibilityRole: "menuitem",
1482
+ accessibilityLabel: token.label,
1483
+ children: /* @__PURE__ */ jsxs4(
1484
+ Box,
1485
+ {
1486
+ flexDirection: "row",
1487
+ alignItems: "center",
1488
+ justifyContent: "space-between",
1489
+ style: dropdownItem,
1490
+ children: [
1491
+ /* @__PURE__ */ jsxs4(
1492
+ Box,
1493
+ {
1494
+ flexDirection: "row",
1495
+ alignItems: "center",
1496
+ style: triggerLeft,
1497
+ children: [
1498
+ token.icon ?? /* @__PURE__ */ jsx9(ReceiveTokenIconFallback, {}),
1499
+ /* @__PURE__ */ jsx9(Text, { variant: "bodyMedium", color: "textPrimary", children: token.label })
1500
+ ]
1501
+ }
1502
+ ),
1503
+ token.id === selected.id ? /* @__PURE__ */ jsx9(CheckIcon, {}) : null
1504
+ ]
1505
+ }
1506
+ )
1507
+ },
1508
+ token.id
1509
+ ))
1510
+ }
1511
+ )
1512
+ }
1513
+ ) : null
1514
+ ] });
1515
+ }
1516
+ function ReceiveTokenIconFallback() {
1517
+ return /* @__PURE__ */ jsx9(
1518
+ Box,
1519
+ {
1520
+ width: 24,
1521
+ height: 24,
1522
+ borderRadius: "rounded",
1523
+ backgroundColor: "pillPressed"
1524
+ }
1525
+ );
1526
+ }
1527
+ function ChevronDownIcon() {
1528
+ return /* @__PURE__ */ jsx9(FigmaChevronDownIcon, { size: 16 });
1529
+ }
1530
+ function AnimatedChevron({ open }) {
1531
+ const rotation = useSharedValue(open ? 1 : 0);
1532
+ useEffect4(() => {
1533
+ rotation.value = withTiming(open ? 1 : 0, {
1534
+ duration: open ? DROPDOWN_OPEN_DURATION : DROPDOWN_CLOSE_DURATION,
1535
+ easing: DROPDOWN_EASING
1536
+ });
1537
+ }, [open, rotation]);
1538
+ const style = useAnimatedStyle(() => ({
1539
+ transform: [{ rotate: `${rotation.value * 180}deg` }]
1540
+ }));
1541
+ return /* @__PURE__ */ jsx9(Reanimated.View, { style, children: /* @__PURE__ */ jsx9(FigmaChevronDownIcon, { size: 16 }) });
1542
+ }
1543
+ function CheckIcon() {
1544
+ return /* @__PURE__ */ jsx9(FigmaCheckIcon, { size: 16 });
1545
+ }
1546
+ function AddMoneyLoading({
1547
+ count,
1548
+ showDropdown,
1549
+ depositToLabel,
1550
+ payWithLabel
1551
+ }) {
1552
+ const opacity = usePulse();
1553
+ const rowCount = count ?? (showDropdown ? 5 : 6);
1554
+ return /* @__PURE__ */ jsxs4(Fragment, { children: [
1555
+ showDropdown ? /* @__PURE__ */ jsxs4(Box, { style: depositSection, children: [
1556
+ /* @__PURE__ */ jsx9(Box, { style: sectionLabel, children: /* @__PURE__ */ jsx9(Text, { variant: "detail", color: "textSecondary", children: depositToLabel }) }),
1557
+ /* @__PURE__ */ jsxs4(
1558
+ Box,
1559
+ {
1560
+ flexDirection: "row",
1561
+ alignItems: "center",
1562
+ justifyContent: "space-between",
1563
+ backgroundColor: "bgModal",
1564
+ borderColor: "borderDefault",
1565
+ borderWidth: 1,
1566
+ borderRadius: "element",
1567
+ style: dropdownTrigger,
1568
+ children: [
1569
+ /* @__PURE__ */ jsxs4(Animated2.View, { style: [loadingSelectorLeft, { opacity }], children: [
1570
+ /* @__PURE__ */ jsx9(
1571
+ Box,
1572
+ {
1573
+ width: 20,
1574
+ height: 20,
1575
+ borderRadius: "rounded",
1576
+ backgroundColor: "pillPressed"
1577
+ }
1578
+ ),
1579
+ /* @__PURE__ */ jsx9(Box, { backgroundColor: "pillPressed", style: skeletonTitleBar })
1580
+ ] }),
1581
+ /* @__PURE__ */ jsx9(ChevronDownIcon, {})
1582
+ ]
1583
+ }
1584
+ )
1585
+ ] }) : null,
1586
+ showDropdown ? /* @__PURE__ */ jsxs4(Box, { style: payWithSection, children: [
1587
+ /* @__PURE__ */ jsx9(Box, { style: sectionLabel, children: /* @__PURE__ */ jsx9(Text, { variant: "detail", color: "textSecondary", children: payWithLabel }) }),
1588
+ /* @__PURE__ */ jsx9(
1589
+ Box,
1590
+ {
1591
+ backgroundColor: "bgModal",
1592
+ borderColor: "borderDefault",
1593
+ borderWidth: 1,
1594
+ borderRadius: "element",
1595
+ style: methodsCard,
1596
+ children: /* @__PURE__ */ jsx9(
1597
+ Animated2.View,
1598
+ {
1599
+ style: { opacity },
1600
+ accessibilityLabel: "Loading payment methods",
1601
+ children: Array.from({ length: rowCount }, (_, i) => /* @__PURE__ */ jsx9(PaymentMethodRowSkeleton, {}, i))
1602
+ }
1603
+ )
1604
+ }
1605
+ )
1606
+ ] }) : /* @__PURE__ */ jsx9(Box, { style: skeletonListContent, children: /* @__PURE__ */ jsx9(
1607
+ Animated2.View,
1608
+ {
1609
+ style: { opacity },
1610
+ accessibilityLabel: "Loading payment methods",
1611
+ children: Array.from({ length: rowCount }, (_, i) => /* @__PURE__ */ jsx9(PaymentMethodRowSkeleton, {}, i))
1612
+ }
1613
+ ) })
1614
+ ] });
1615
+ }
1616
+ function PaymentMethodRowSkeleton() {
1617
+ return /* @__PURE__ */ jsxs4(
1618
+ Box,
1619
+ {
1620
+ flexDirection: "row",
1621
+ alignItems: "center",
1622
+ gap: "elementsHorizontal",
1623
+ style: skeletonRow,
1624
+ children: [
1625
+ /* @__PURE__ */ jsx9(
1626
+ Box,
1627
+ {
1628
+ width: 48,
1629
+ height: 48,
1630
+ borderRadius: "rounded",
1631
+ backgroundColor: "pillPressed"
1632
+ }
1633
+ ),
1634
+ /* @__PURE__ */ jsxs4(Box, { flex: 1, style: skeletonDetails, children: [
1635
+ /* @__PURE__ */ jsx9(Box, { backgroundColor: "pillPressed", style: skeletonTitleBar }),
1636
+ /* @__PURE__ */ jsx9(Box, { backgroundColor: "pillPressed", style: skeletonSubtitleBar })
1637
+ ] })
1638
+ ]
1639
+ }
1640
+ );
1641
+ }
1642
+ function usePulse() {
1643
+ const opacity = useRef(new Animated2.Value(1)).current;
1644
+ useEffect4(() => {
1645
+ const loop = Animated2.loop(
1646
+ Animated2.sequence([
1647
+ Animated2.timing(opacity, {
1648
+ toValue: 0.5,
1649
+ duration: 700,
1650
+ useNativeDriver: true
1651
+ }),
1652
+ Animated2.timing(opacity, {
1653
+ toValue: 1,
1654
+ duration: 700,
1655
+ useNativeDriver: true
1656
+ })
1657
+ ])
1658
+ );
1659
+ loop.start();
1660
+ return () => loop.stop();
1661
+ }, [opacity]);
1662
+ return opacity;
1663
+ }
1664
+ var topBar = { height: 64, paddingTop: 25, paddingBottom: 12 };
1665
+ var grabber = {
1666
+ position: "absolute",
1667
+ top: 8,
1668
+ width: 36,
1669
+ height: 5,
1670
+ borderRadius: 999
1671
+ };
1672
+ var listContent = {
1673
+ paddingHorizontal: 16,
1674
+ paddingBottom: 16
1675
+ };
1676
+ var row = { padding: 12 };
1677
+ var details = { gap: 2 };
1678
+ var depositSection = {
1679
+ paddingHorizontal: 16,
1680
+ zIndex: 2
1681
+ };
1682
+ var payWithSection = {
1683
+ paddingHorizontal: 16,
1684
+ paddingTop: 12,
1685
+ paddingBottom: 16
1686
+ };
1687
+ var sectionLabel = { paddingHorizontal: 12, paddingBottom: 6 };
1688
+ var methodsCard = { paddingVertical: 2, overflow: "hidden" };
1689
+ var divider = { height: 1 };
1690
+ var dropdownAnchor = { position: "relative" };
1691
+ var dropdownTrigger = { height: 48, paddingHorizontal: 12 };
1692
+ var triggerLeft = { gap: 6, flex: 1 };
1693
+ var triggerLabel = { flex: 1 };
1694
+ var dropdownMenuOverlay = {
1695
+ position: "absolute",
1696
+ top: "100%",
1697
+ left: 0,
1698
+ right: 0,
1699
+ marginTop: 4,
1700
+ zIndex: 30
1701
+ };
1702
+ var dropdownMenu = {
1703
+ shadowColor: "#000",
1704
+ shadowOpacity: 0.12,
1705
+ shadowOffset: { width: 0, height: 8 },
1706
+ shadowRadius: 16,
1707
+ elevation: 8
1708
+ };
1709
+ var dropdownItem = { height: 48, paddingHorizontal: 12 };
1710
+ var scrim = {
1711
+ position: "absolute",
1712
+ top: 0,
1713
+ left: 0,
1714
+ right: 0,
1715
+ bottom: 0,
1716
+ backgroundColor: "rgba(0,0,0,0.2)",
1717
+ zIndex: 1
1718
+ };
1719
+ var errorContainer = {
1720
+ height: 468,
1721
+ gap: 24,
1722
+ paddingHorizontal: 16
1723
+ };
1724
+ var errorText = { gap: 8 };
1725
+ var errorMessageText = { textAlign: "center" };
1726
+ var retryButton = { height: 48, paddingHorizontal: 20 };
1727
+ var skeletonListContent = {
1728
+ paddingHorizontal: 16,
1729
+ paddingBottom: 16
1730
+ };
1731
+ var skeletonRow = { padding: 12 };
1732
+ var loadingSelectorLeft = {
1733
+ flexDirection: "row",
1734
+ alignItems: "center",
1735
+ gap: 6,
1736
+ flex: 1
1737
+ };
1738
+ var skeletonDetails = { gap: 4 };
1739
+ var skeletonTitleBar = { width: 157, height: 16, borderRadius: 4 };
1740
+ var skeletonSubtitleBar = {
1741
+ width: 83,
1742
+ height: 14,
1743
+ borderRadius: 4
1744
+ };
727
1745
 
728
- // src/screens/QrCodeScreen.tsx
729
- import { Pressable as Pressable2, StyleSheet as StyleSheet2 } from "react-native";
730
- import { jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
731
- function QrCodeScreen({
732
- qrCode,
733
- accountName,
734
- onClose,
735
- onShare,
736
- onSupportedChainsPress
1746
+ // src/screens/AvailableChainsScreen.tsx
1747
+ import {
1748
+ Pressable as Pressable2,
1749
+ ScrollView as ScrollView2,
1750
+ useWindowDimensions
1751
+ } from "react-native";
1752
+ import { jsx as jsx10, jsxs as jsxs5 } from "react/jsx-runtime";
1753
+ function AvailableChainsScreen({
1754
+ networkLabel,
1755
+ chains,
1756
+ title = `Available ${networkLabel}`,
1757
+ loading = false,
1758
+ skeletonCount = 8,
1759
+ onClose
737
1760
  }) {
738
- return /* @__PURE__ */ jsxs2(
1761
+ const { height } = useWindowDimensions();
1762
+ return /* @__PURE__ */ jsxs5(
739
1763
  Box,
740
1764
  {
741
1765
  backgroundColor: "bgModal",
742
1766
  borderTopLeftRadius: "modal",
743
1767
  borderTopRightRadius: "modal",
744
- style: styles2.sheet,
1768
+ style: sheet,
745
1769
  children: [
746
- /* @__PURE__ */ jsxs2(Box, { flexDirection: "row", alignItems: "center", style: styles2.topBar, children: [
747
- /* @__PURE__ */ jsx5(
748
- Box,
749
- {
750
- backgroundColor: "borderFocused",
751
- borderRadius: "rounded",
752
- style: styles2.grabber
753
- }
754
- ),
755
- /* @__PURE__ */ jsx5(
1770
+ /* @__PURE__ */ jsxs5(Box, { flexDirection: "row", alignItems: "center", style: topBar2, children: [
1771
+ /* @__PURE__ */ jsx10(
756
1772
  Pressable2,
757
1773
  {
758
1774
  onPress: onClose,
759
1775
  hitSlop: 12,
760
1776
  accessibilityRole: "button",
761
1777
  accessibilityLabel: "Close",
762
- children: /* @__PURE__ */ jsx5(Text, { color: "textPrimary", style: styles2.closeGlyph, children: "\u2715" })
1778
+ children: /* @__PURE__ */ jsx10(Box, { alignItems: "center", justifyContent: "center", style: iconButton, children: /* @__PURE__ */ jsx10(FigmaCloseIcon, {}) })
763
1779
  }
764
- )
1780
+ ),
1781
+ /* @__PURE__ */ jsx10(Box, { flex: 1, alignItems: "center", children: /* @__PURE__ */ jsx10(Text, { variant: "bodyMedium", color: "textPrimary", children: title }) }),
1782
+ /* @__PURE__ */ jsx10(Box, { style: topBarSpacer })
765
1783
  ] }),
766
- /* @__PURE__ */ jsxs2(Box, { alignItems: "center", style: styles2.content, children: [
767
- /* @__PURE__ */ jsxs2(Text, { variant: "body", color: "textSecondary", style: styles2.caption, children: [
768
- `Scan to deposit to this ${accountName ? `${accountName} ` : ""}account.
769
- `,
770
- "Use it only for",
771
- " ",
772
- /* @__PURE__ */ jsx5(
773
- Text,
1784
+ /* @__PURE__ */ jsx10(
1785
+ ScrollView2,
1786
+ {
1787
+ style: [list, { maxHeight: height * 0.72 }],
1788
+ showsVerticalScrollIndicator: false,
1789
+ contentContainerStyle: content,
1790
+ children: loading ? Array.from({ length: skeletonCount }, (_, index) => /* @__PURE__ */ jsx10(AvailableChainSkeleton, {}, index)) : chains.map((chain) => /* @__PURE__ */ jsxs5(
1791
+ Box,
774
1792
  {
775
- variant: "body",
776
- color: "textSecondary",
777
- style: onSupportedChainsPress ? styles2.link : void 0,
778
- onPress: onSupportedChainsPress,
779
- accessibilityRole: onSupportedChainsPress ? "link" : void 0,
780
- children: "supported chains"
781
- }
782
- )
783
- ] }),
784
- /* @__PURE__ */ jsx5(
785
- Box,
786
- {
787
- backgroundColor: "bgModal",
788
- borderColor: "borderDefault",
789
- borderWidth: 2,
790
- alignItems: "center",
791
- justifyContent: "center",
792
- style: styles2.qrFrame,
793
- children: qrCode
794
- }
795
- ),
796
- /* @__PURE__ */ jsx5(
797
- Pressable2,
798
- {
799
- onPress: onShare,
800
- accessibilityRole: "button",
801
- accessibilityLabel: "Share",
802
- children: /* @__PURE__ */ jsx5(
803
- Box,
804
- {
805
- width: 68,
806
- height: 68,
807
- borderRadius: "rounded",
808
- backgroundColor: "bgSecondary",
809
- alignItems: "center",
810
- justifyContent: "center",
811
- children: /* @__PURE__ */ jsx5(Text, { color: "textPrimary", style: styles2.shareGlyph, children: "\u2191" })
812
- }
813
- )
1793
+ flexDirection: "row",
1794
+ alignItems: "center",
1795
+ style: row2,
1796
+ children: [
1797
+ /* @__PURE__ */ jsx10(Box, { style: iconRing2, children: /* @__PURE__ */ jsx10(
1798
+ FunIcon,
1799
+ {
1800
+ uri: chain.iconUri,
1801
+ size: 36,
1802
+ fallbackUri: FALLBACK_ASSET_LOGO
1803
+ }
1804
+ ) }),
1805
+ /* @__PURE__ */ jsx10(Box, { flex: 1, children: /* @__PURE__ */ jsx10(Text, { variant: "bodyMedium", color: "textPrimary", children: chain.name }) }),
1806
+ chain.minLabel ? /* @__PURE__ */ jsx10(Text, { variant: "detail", color: "textSecondary", children: chain.minLabel }) : null
1807
+ ]
1808
+ },
1809
+ chain.id
1810
+ ))
1811
+ }
1812
+ )
1813
+ ]
1814
+ }
1815
+ );
1816
+ }
1817
+ function AvailableChainSkeleton() {
1818
+ return /* @__PURE__ */ jsxs5(Box, { flexDirection: "row", alignItems: "center", style: row2, children: [
1819
+ /* @__PURE__ */ jsx10(Box, { backgroundColor: "pillPressed", style: skeletonIcon }),
1820
+ /* @__PURE__ */ jsx10(Box, { flex: 1, children: /* @__PURE__ */ jsx10(Box, { backgroundColor: "pillPressed", style: skeletonName }) }),
1821
+ /* @__PURE__ */ jsx10(Box, { backgroundColor: "pillPressed", style: skeletonMin })
1822
+ ] });
1823
+ }
1824
+ var sheet = { paddingBottom: 20 };
1825
+ var topBar2 = {
1826
+ paddingVertical: 16,
1827
+ paddingHorizontal: 24,
1828
+ gap: 4
1829
+ };
1830
+ var iconButton = { width: 32, height: 32 };
1831
+ var topBarSpacer = { width: 32, height: 32 };
1832
+ var list = { width: "100%" };
1833
+ var content = { paddingHorizontal: 20 };
1834
+ var row2 = { gap: 12, paddingVertical: 10 };
1835
+ var skeletonIcon = { width: 36, height: 36, borderRadius: 999 };
1836
+ var skeletonName = { width: 157, height: 16, borderRadius: 4 };
1837
+ var skeletonMin = { width: 46, height: 16, borderRadius: 4 };
1838
+ var iconRing2 = {
1839
+ width: 36,
1840
+ height: 36,
1841
+ borderRadius: 999,
1842
+ borderWidth: 1,
1843
+ borderColor: "rgba(0,0,0,0.1)",
1844
+ overflow: "hidden",
1845
+ alignItems: "center",
1846
+ justifyContent: "center"
1847
+ };
1848
+
1849
+ // src/screens/CheckoutBlockedScreen.tsx
1850
+ import { StyleSheet as StyleSheet2 } from "react-native";
1851
+ import { jsx as jsx11, jsxs as jsxs6 } from "react/jsx-runtime";
1852
+ function CheckoutBlockedScreen() {
1853
+ return /* @__PURE__ */ jsxs6(
1854
+ Box,
1855
+ {
1856
+ backgroundColor: "bgModal",
1857
+ borderTopLeftRadius: "modal",
1858
+ borderTopRightRadius: "modal",
1859
+ children: [
1860
+ /* @__PURE__ */ jsx11(Box, { alignItems: "center", style: styles2.topBar, children: /* @__PURE__ */ jsx11(Box, { backgroundColor: "borderFocused", style: styles2.grabber }) }),
1861
+ /* @__PURE__ */ jsxs6(Box, { alignItems: "center", justifyContent: "center", style: styles2.content, children: [
1862
+ /* @__PURE__ */ jsx11(
1863
+ Box,
1864
+ {
1865
+ backgroundColor: "bgSecondary",
1866
+ borderRadius: "rounded",
1867
+ alignItems: "center",
1868
+ justifyContent: "center",
1869
+ style: styles2.iconCircle,
1870
+ children: /* @__PURE__ */ jsx11(FigmaInfoCircleIcon, { size: 24 })
814
1871
  }
815
- )
1872
+ ),
1873
+ /* @__PURE__ */ jsxs6(Box, { alignItems: "center", style: styles2.textGroup, children: [
1874
+ /* @__PURE__ */ jsx11(Text, { variant: "bodyMedium", color: "textPrimary", children: "Not available" }),
1875
+ /* @__PURE__ */ jsx11(
1876
+ Text,
1877
+ {
1878
+ variant: "detail",
1879
+ color: "textSecondary",
1880
+ style: styles2.descriptionText,
1881
+ children: "This service is not available in your region."
1882
+ }
1883
+ )
1884
+ ] })
816
1885
  ] })
817
1886
  ]
818
1887
  }
819
1888
  );
820
1889
  }
821
1890
  var styles2 = StyleSheet2.create({
822
- sheet: { paddingBottom: 32 },
823
- topBar: {
824
- paddingTop: 20,
825
- paddingBottom: 8,
826
- paddingHorizontal: 12
827
- },
1891
+ topBar: { paddingTop: 20, paddingBottom: 12 },
828
1892
  grabber: {
829
1893
  position: "absolute",
830
1894
  top: 8,
831
- left: "50%",
832
- marginLeft: -18,
833
1895
  width: 36,
834
- height: 5
1896
+ height: 5,
1897
+ borderRadius: 999
835
1898
  },
836
- content: { paddingHorizontal: 20, paddingTop: 16, gap: 32 },
837
- caption: { textAlign: "center" },
838
- link: { textDecorationLine: "underline" },
839
- qrFrame: {
840
- width: 275,
841
- height: 275,
842
- borderRadius: 20,
843
- padding: 16
1899
+ content: {
1900
+ height: 468,
1901
+ gap: 16,
1902
+ paddingHorizontal: 16
844
1903
  },
845
- closeGlyph: { fontSize: 18, lineHeight: 22 },
846
- shareGlyph: { fontSize: 28, lineHeight: 32, fontWeight: "500" }
1904
+ iconCircle: { width: 48, height: 48 },
1905
+ textGroup: { gap: 8 },
1906
+ descriptionText: { textAlign: "center" }
847
1907
  });
848
1908
 
849
- // src/screens/TransferCryptoScreen.tsx
850
- import { useEffect as useEffect2, useRef, useState as useState3 } from "react";
851
- import { Pressable as Pressable3, StyleSheet as StyleSheet5 } from "react-native";
852
-
853
- // src/icons/CopyIcon.tsx
854
- import { StyleSheet as StyleSheet3 } from "react-native";
855
- import { jsx as jsx6, jsxs as jsxs3 } from "react/jsx-runtime";
856
- function CopyIcon() {
857
- return /* @__PURE__ */ jsxs3(Box, { width: 18, height: 18, children: [
858
- /* @__PURE__ */ jsx6(Box, { borderWidth: 1.5, borderColor: "textPrimary", style: styles3.back }),
859
- /* @__PURE__ */ jsx6(
860
- Box,
861
- {
862
- borderWidth: 1.5,
863
- borderColor: "textPrimary",
864
- backgroundColor: "bgSecondary",
865
- style: styles3.front
866
- }
867
- )
868
- ] });
1909
+ // src/screens/QrCodeScreen.tsx
1910
+ import { useEffect as useEffect5, useRef as useRef2, useState as useState5 } from "react";
1911
+ import {
1912
+ Pressable as Pressable3,
1913
+ useWindowDimensions as useWindowDimensions2
1914
+ } from "react-native";
1915
+
1916
+ // src/icons/CopyAddressIcon.tsx
1917
+ import { SvgXml as SvgXml4 } from "react-native-svg";
1918
+ import { jsx as jsx12 } from "react/jsx-runtime";
1919
+ var COPY_ADDRESS_SVG = `<svg viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M10.2 5.8V4.26C10.2 3.64394 10.2 3.33591 10.0801 3.10061C9.97465 2.89363 9.80637 2.72535 9.59939 2.61989C9.36409 2.5 9.05606 2.5 8.44 2.5H4.26C3.64394 2.5 3.33591 2.5 3.10061 2.61989C2.89363 2.72535 2.72535 2.89363 2.61989 3.10061C2.5 3.33591 2.5 3.64394 2.5 4.26V8.44C2.5 9.05606 2.5 9.36409 2.61989 9.59939C2.72535 9.80637 2.89363 9.97465 3.10061 10.0801C3.33591 10.2 3.64394 10.2 4.26 10.2H5.8M7.56 13.5H11.74C12.3561 13.5 12.6641 13.5 12.8994 13.3801C13.1064 13.2746 13.2746 13.1064 13.3801 12.8994C13.5 12.6641 13.5 12.3561 13.5 11.74V7.56C13.5 6.94394 13.5 6.63591 13.3801 6.40061C13.2746 6.19363 13.1064 6.02535 12.8994 5.91989C12.6641 5.8 12.3561 5.8 11.74 5.8H7.56C6.94394 5.8 6.63591 5.8 6.40061 5.91989C6.19363 6.02535 6.02535 6.19363 5.91989 6.40061C5.8 6.63591 5.8 6.94394 5.8 7.56V11.74C5.8 12.3561 5.8 12.6641 5.91989 12.8994C6.02535 13.1064 6.19363 13.2746 6.40061 13.3801C6.63591 13.5 6.94394 13.5 7.56 13.5Z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/></svg>`;
1920
+ function CopyAddressIcon({ size = 16 }) {
1921
+ const theme = useTheme();
1922
+ return /* @__PURE__ */ jsx12(
1923
+ SvgXml4,
1924
+ {
1925
+ xml: COPY_ADDRESS_SVG,
1926
+ width: size,
1927
+ height: size,
1928
+ color: theme.colors.onBtnSecondary
1929
+ }
1930
+ );
869
1931
  }
870
- var styles3 = StyleSheet3.create({
871
- back: {
872
- position: "absolute",
873
- right: 0,
874
- top: 0,
875
- width: 13,
876
- height: 13,
877
- borderRadius: 3
878
- },
879
- front: {
880
- position: "absolute",
881
- left: 0,
882
- bottom: 0,
883
- width: 13,
884
- height: 13,
885
- borderRadius: 3
886
- }
887
- });
888
1932
 
889
- // src/icons/NetworkIconFallback.tsx
890
- import { jsx as jsx7 } from "react/jsx-runtime";
891
- function NetworkIconFallback() {
892
- return /* @__PURE__ */ jsx7(
1933
+ // src/screens/QrCodeScreen.tsx
1934
+ import { jsx as jsx13, jsxs as jsxs7 } from "react/jsx-runtime";
1935
+ function QrCodeScreen({
1936
+ qrCode,
1937
+ centerIcon,
1938
+ address,
1939
+ title = "QR Code",
1940
+ copyLabel = "Copy address",
1941
+ copiedLabel = "Copied!",
1942
+ copiedFeedbackMs = 1800,
1943
+ onClose,
1944
+ onCopyAddress
1945
+ }) {
1946
+ const { height } = useWindowDimensions2();
1947
+ const [copied, setCopied] = useState5(false);
1948
+ const copyTimer = useRef2(void 0);
1949
+ useEffect5(() => () => clearTimeout(copyTimer.current), []);
1950
+ const handleCopy = async () => {
1951
+ const ok = await onCopyAddress?.();
1952
+ if (ok === false) return;
1953
+ setCopied(true);
1954
+ clearTimeout(copyTimer.current);
1955
+ copyTimer.current = setTimeout(() => setCopied(false), copiedFeedbackMs);
1956
+ };
1957
+ return /* @__PURE__ */ jsxs7(
893
1958
  Box,
894
1959
  {
895
- width: 32,
896
- height: 32,
897
- borderRadius: "rounded",
898
- backgroundColor: "pillPressed"
1960
+ backgroundColor: "bgModal",
1961
+ borderTopLeftRadius: "modal",
1962
+ borderTopRightRadius: "modal",
1963
+ style: sheet2,
1964
+ children: [
1965
+ /* @__PURE__ */ jsxs7(Box, { flexDirection: "row", alignItems: "center", style: topBar3, children: [
1966
+ /* @__PURE__ */ jsx13(
1967
+ Pressable3,
1968
+ {
1969
+ onPress: onClose,
1970
+ hitSlop: 12,
1971
+ accessibilityRole: "button",
1972
+ accessibilityLabel: "Close",
1973
+ children: /* @__PURE__ */ jsx13(Text, { color: "textPrimary", style: closeGlyph, children: "\u2715" })
1974
+ }
1975
+ ),
1976
+ /* @__PURE__ */ jsx13(Box, { flex: 1, alignItems: "center", children: /* @__PURE__ */ jsx13(Text, { variant: "bodyMedium", color: "textPrimary", children: title }) }),
1977
+ /* @__PURE__ */ jsx13(Box, { style: topBarSpacer2 })
1978
+ ] }),
1979
+ /* @__PURE__ */ jsxs7(
1980
+ Box,
1981
+ {
1982
+ alignItems: "center",
1983
+ justifyContent: "center",
1984
+ style: [content2, { minHeight: height * 0.5 }],
1985
+ children: [
1986
+ /* @__PURE__ */ jsxs7(
1987
+ Box,
1988
+ {
1989
+ backgroundColor: "bgModal",
1990
+ borderColor: "borderDefault",
1991
+ borderWidth: 1.5,
1992
+ alignItems: "center",
1993
+ justifyContent: "center",
1994
+ style: qrFrame,
1995
+ children: [
1996
+ qrCode,
1997
+ centerIcon ? /* @__PURE__ */ jsx13(
1998
+ Box,
1999
+ {
2000
+ alignItems: "center",
2001
+ justifyContent: "center",
2002
+ style: centerOverlay,
2003
+ children: centerIcon
2004
+ }
2005
+ ) : null
2006
+ ]
2007
+ }
2008
+ ),
2009
+ address ? /* @__PURE__ */ jsxs7(Box, { alignItems: "center", style: addressGroup, children: [
2010
+ /* @__PURE__ */ jsx13(Text, { variant: "body", color: "textSecondary", style: addressText, children: address }),
2011
+ onCopyAddress ? /* @__PURE__ */ jsx13(
2012
+ Pressable3,
2013
+ {
2014
+ onPress: handleCopy,
2015
+ accessibilityRole: "button",
2016
+ accessibilityLabel: copied ? "Address copied" : "Copy address",
2017
+ children: /* @__PURE__ */ jsxs7(
2018
+ Box,
2019
+ {
2020
+ flexDirection: "row",
2021
+ alignItems: "center",
2022
+ justifyContent: "center",
2023
+ backgroundColor: "btnSecondary",
2024
+ borderColor: "btnSecondary",
2025
+ borderWidth: 1,
2026
+ borderRadius: "element",
2027
+ style: copyButton,
2028
+ children: [
2029
+ /* @__PURE__ */ jsx13(CopyAddressIcon, {}),
2030
+ /* @__PURE__ */ jsx13(Text, { variant: "bodyMedium", color: "onBtnSecondary", children: copied ? copiedLabel : copyLabel })
2031
+ ]
2032
+ }
2033
+ )
2034
+ }
2035
+ ) : null
2036
+ ] }) : null
2037
+ ]
2038
+ }
2039
+ )
2040
+ ]
899
2041
  }
900
2042
  );
901
2043
  }
2044
+ var sheet2 = { paddingBottom: 32 };
2045
+ var topBar3 = {
2046
+ paddingVertical: 16,
2047
+ paddingHorizontal: 24,
2048
+ gap: 4
2049
+ };
2050
+ var closeGlyph = {
2051
+ fontSize: 20,
2052
+ lineHeight: 24,
2053
+ width: 32,
2054
+ textAlign: "center"
2055
+ };
2056
+ var topBarSpacer2 = { width: 32, height: 32 };
2057
+ var content2 = {
2058
+ paddingHorizontal: 20,
2059
+ paddingVertical: 45,
2060
+ gap: 40
2061
+ };
2062
+ var qrFrame = {
2063
+ width: 275,
2064
+ height: 275,
2065
+ borderRadius: 20,
2066
+ padding: 18,
2067
+ // Figma shadow/md: a soft lift under the card.
2068
+ shadowColor: "#000",
2069
+ shadowOpacity: 0.1,
2070
+ shadowOffset: { width: 0, height: 4 },
2071
+ shadowRadius: 16,
2072
+ elevation: 3
2073
+ };
2074
+ var centerOverlay = {
2075
+ position: "absolute",
2076
+ top: 0,
2077
+ left: 0,
2078
+ right: 0,
2079
+ bottom: 0,
2080
+ pointerEvents: "none"
2081
+ };
2082
+ var addressGroup = { gap: 16 };
2083
+ var addressText = { textAlign: "center", maxWidth: 220 };
2084
+ var copyButton = {
2085
+ height: 48,
2086
+ paddingHorizontal: 20,
2087
+ gap: 8
2088
+ };
2089
+
2090
+ // src/screens/TransferCryptoScreen.tsx
2091
+ import { useEffect as useEffect7, useRef as useRef3, useState as useState7 } from "react";
2092
+ import { Pressable as Pressable5 } from "react-native";
902
2093
 
903
- // src/icons/QrCodeIcon.tsx
904
- import { StyleSheet as StyleSheet4 } from "react-native";
905
- import { jsx as jsx8 } from "react/jsx-runtime";
906
- function QrCodeIcon() {
907
- return /* @__PURE__ */ jsx8(
2094
+ // src/screens/NetworkSelector.tsx
2095
+ import { useEffect as useEffect6, useState as useState6 } from "react";
2096
+ import { Pressable as Pressable4 } from "react-native";
2097
+ import Animated3, {
2098
+ Easing as Easing3,
2099
+ FadeIn,
2100
+ FadeOut,
2101
+ LinearTransition
2102
+ } from "react-native-reanimated";
2103
+ import { jsx as jsx14, jsxs as jsxs8 } from "react/jsx-runtime";
2104
+ function toIconUri3(icon) {
2105
+ return icon.startsWith("http") ? icon : chainIconUri(icon);
2106
+ }
2107
+ function NetworkSelector({
2108
+ networks,
2109
+ selectedId,
2110
+ onSelect
2111
+ }) {
2112
+ const [animate, setAnimate] = useState6(false);
2113
+ useEffect6(() => setAnimate(true), []);
2114
+ return /* @__PURE__ */ jsx14(
908
2115
  Box,
909
2116
  {
910
- width: 20,
911
- height: 20,
912
2117
  flexDirection: "row",
913
- flexWrap: "wrap",
914
- style: styles4.grid,
915
- children: [0, 1, 2, 3].map((i) => /* @__PURE__ */ jsx8(
916
- Box,
917
- {
918
- width: 8,
919
- height: 8,
920
- backgroundColor: "textPrimary",
921
- borderRadius: "elementInner"
922
- },
923
- i
924
- ))
2118
+ alignItems: "center",
2119
+ backgroundColor: "bgSecondary",
2120
+ borderColor: "borderDefault",
2121
+ borderWidth: 1,
2122
+ borderRadius: "rounded",
2123
+ style: track,
2124
+ children: networks.map((network) => {
2125
+ const selected = network.id === selectedId;
2126
+ return /* @__PURE__ */ jsx14(
2127
+ AnimatedPressable2,
2128
+ {
2129
+ onPress: () => onSelect(network.id),
2130
+ accessibilityRole: "button",
2131
+ accessibilityState: { selected },
2132
+ accessibilityLabel: network.label,
2133
+ style: selected ? selectedPress : iconPress,
2134
+ layout: animate ? segmentLayout : void 0,
2135
+ children: selected ? /* @__PURE__ */ jsx14(
2136
+ Animated3.View,
2137
+ {
2138
+ entering: animate ? FadeIn.duration(SLIDE_MS) : void 0,
2139
+ exiting: FadeOut.duration(COLLAPSE_MS),
2140
+ style: selectedFill,
2141
+ children: /* @__PURE__ */ jsxs8(
2142
+ Box,
2143
+ {
2144
+ flexDirection: "row",
2145
+ alignItems: "center",
2146
+ justifyContent: "center",
2147
+ backgroundColor: "bgModal",
2148
+ borderColor: "borderDefault",
2149
+ borderWidth: 1,
2150
+ borderRadius: "rounded",
2151
+ style: selectedPill,
2152
+ children: [
2153
+ /* @__PURE__ */ jsx14(ChainGlyph, { iconKeys: network.iconKeys }),
2154
+ /* @__PURE__ */ jsx14(Text, { variant: "bodyMedium", color: "textPrimary", children: network.label })
2155
+ ]
2156
+ }
2157
+ )
2158
+ }
2159
+ ) : /* @__PURE__ */ jsx14(ChainGlyph, { iconKeys: network.iconKeys })
2160
+ },
2161
+ network.id
2162
+ );
2163
+ })
925
2164
  }
926
2165
  );
927
2166
  }
928
- var styles4 = StyleSheet4.create({
929
- grid: { gap: 2 }
930
- });
2167
+ var AnimatedPressable2 = Animated3.createAnimatedComponent(Pressable4);
2168
+ var SLIDE_MS = 250;
2169
+ var COLLAPSE_MS = 150;
2170
+ var segmentLayout = LinearTransition.duration(SLIDE_MS).easing(
2171
+ Easing3.bezier(0.22, 1, 0.36, 1)
2172
+ );
2173
+ function ChainGlyph({ iconKeys }) {
2174
+ if (iconKeys.length <= 1) {
2175
+ return /* @__PURE__ */ jsx14(
2176
+ FunIcon,
2177
+ {
2178
+ uri: toIconUri3(iconKeys[0] ?? ""),
2179
+ size: 24,
2180
+ fallbackUri: FALLBACK_ASSET_LOGO
2181
+ }
2182
+ );
2183
+ }
2184
+ return /* @__PURE__ */ jsx14(Box, { width: 24, height: 24, alignItems: "center", justifyContent: "center", children: /* @__PURE__ */ jsx14(Box, { flexDirection: "row", flexWrap: "wrap", style: miniGrid, children: iconKeys.slice(0, 4).map((key) => /* @__PURE__ */ jsx14(
2185
+ FunIcon,
2186
+ {
2187
+ uri: toIconUri3(key),
2188
+ size: 11,
2189
+ fallbackUri: FALLBACK_ASSET_LOGO
2190
+ },
2191
+ key
2192
+ )) }) });
2193
+ }
2194
+ var track = { height: 54, padding: 2 };
2195
+ var selectedPress = { flex: 1, height: "100%" };
2196
+ var selectedFill = { flex: 1 };
2197
+ var selectedPill = {
2198
+ height: "100%",
2199
+ paddingHorizontal: 16,
2200
+ gap: 10
2201
+ };
2202
+ var iconPress = {
2203
+ width: 50,
2204
+ height: "100%",
2205
+ alignItems: "center",
2206
+ justifyContent: "center"
2207
+ };
2208
+ var miniGrid = { width: 23.5, gap: 1.5 };
931
2209
 
932
2210
  // src/screens/TransferCryptoScreen.tsx
933
- import { jsx as jsx9, jsxs as jsxs4 } from "react/jsx-runtime";
2211
+ import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
934
2212
  function TransferCryptoScreen({
935
2213
  depositAddress,
936
- networkLabel,
937
- networkIcon,
2214
+ networks,
2215
+ selectedNetworkId,
2216
+ onSelectNetwork,
2217
+ supportedTokenIcons,
2218
+ minimumDepositLabel,
938
2219
  title = "Transfer Crypto",
939
2220
  depositAddressLabel = "Your deposit address",
2221
+ copyLabel = "Copy",
2222
+ copiedLabel = "Copied!",
2223
+ shareLabel = "Share",
940
2224
  copiedFeedbackMs = 1800,
941
2225
  onBack,
942
2226
  onShowQrCode,
943
- onChangeNetwork,
2227
+ onShowChains,
944
2228
  onCopyAddress,
945
2229
  onShareAddress
946
2230
  }) {
947
- const [copied, setCopied] = useState3(false);
948
- const copyTimer = useRef(void 0);
949
- useEffect2(() => () => clearTimeout(copyTimer.current), []);
2231
+ const theme = useTheme();
2232
+ const [copied, setCopied] = useState7(false);
2233
+ const copyTimer = useRef3(void 0);
2234
+ useEffect7(() => () => clearTimeout(copyTimer.current), []);
950
2235
  const handleCopy = () => {
951
2236
  onCopyAddress?.();
952
2237
  setCopied(true);
953
2238
  clearTimeout(copyTimer.current);
954
2239
  copyTimer.current = setTimeout(() => setCopied(false), copiedFeedbackMs);
955
2240
  };
956
- return /* @__PURE__ */ jsxs4(
2241
+ const showPreview = supportedTokenIcons != null && supportedTokenIcons.length > 0;
2242
+ const selectedNetwork = networks.find(
2243
+ (network) => network.id === selectedNetworkId
2244
+ );
2245
+ return /* @__PURE__ */ jsxs9(
957
2246
  Box,
958
2247
  {
959
2248
  backgroundColor: "bgModal",
960
2249
  borderTopLeftRadius: "modal",
961
2250
  borderTopRightRadius: "modal",
962
2251
  children: [
963
- /* @__PURE__ */ jsxs4(
964
- Box,
965
- {
966
- flexDirection: "row",
967
- alignItems: "center",
968
- gap: "none",
969
- style: styles5.topBar,
970
- children: [
971
- /* @__PURE__ */ jsx9(
972
- Box,
973
- {
974
- backgroundColor: "borderFocused",
975
- borderRadius: "rounded",
976
- style: styles5.grabber
977
- }
978
- ),
979
- /* @__PURE__ */ jsx9(
980
- Pressable3,
981
- {
982
- onPress: onBack,
983
- hitSlop: 12,
984
- accessibilityRole: "button",
985
- accessibilityLabel: "Back",
986
- children: /* @__PURE__ */ jsx9(Text, { color: "textPrimary", style: styles5.chevron, children: "\u2039" })
987
- }
988
- ),
989
- /* @__PURE__ */ jsx9(Box, { flex: 1, alignItems: "center", children: /* @__PURE__ */ jsx9(Text, { variant: "bodyMedium", color: "textPrimary", children: title }) }),
990
- /* @__PURE__ */ jsx9(
991
- Pressable3,
992
- {
993
- onPress: onShowQrCode,
994
- hitSlop: 12,
995
- accessibilityRole: "button",
996
- accessibilityLabel: "Show QR code",
997
- style: styles5.qrButton,
998
- children: /* @__PURE__ */ jsx9(QrCodeIcon, {})
999
- }
1000
- )
1001
- ]
1002
- }
1003
- ),
1004
- /* @__PURE__ */ jsxs4(Box, { style: styles5.content, children: [
1005
- /* @__PURE__ */ jsx9(
1006
- Pressable3,
2252
+ /* @__PURE__ */ jsxs9(Box, { flexDirection: "row", alignItems: "center", style: topBar4, children: [
2253
+ /* @__PURE__ */ jsx15(
2254
+ Pressable5,
1007
2255
  {
1008
- onPress: onChangeNetwork,
2256
+ onPress: onBack,
2257
+ hitSlop: 12,
1009
2258
  accessibilityRole: "button",
1010
- accessibilityLabel: "Change network",
1011
- children: /* @__PURE__ */ jsxs4(
1012
- Box,
1013
- {
1014
- flexDirection: "row",
1015
- alignItems: "center",
1016
- justifyContent: "space-between",
1017
- backgroundColor: "bgSecondary",
1018
- borderColor: "borderDefault",
1019
- borderWidth: 1,
1020
- borderRadius: "button",
1021
- style: styles5.networkRow,
1022
- children: [
1023
- /* @__PURE__ */ jsxs4(
1024
- Box,
1025
- {
1026
- flexDirection: "row",
1027
- alignItems: "center",
1028
- gap: "elementsHorizontal",
1029
- children: [
1030
- networkIcon ?? /* @__PURE__ */ jsx9(NetworkIconFallback, {}),
1031
- /* @__PURE__ */ jsx9(Text, { variant: "bodyMedium", color: "textPrimary", children: networkLabel })
1032
- ]
1033
- }
1034
- ),
1035
- /* @__PURE__ */ jsx9(Text, { variant: "bodyMedium", color: "textSecondary", children: "Change" })
1036
- ]
1037
- }
1038
- )
2259
+ accessibilityLabel: "Back",
2260
+ children: /* @__PURE__ */ jsx15(Box, { alignItems: "center", justifyContent: "center", style: iconButton2, children: /* @__PURE__ */ jsx15(FigmaChevronLeftIcon, {}) })
2261
+ }
2262
+ ),
2263
+ /* @__PURE__ */ jsx15(Box, { flex: 1, alignItems: "center", children: /* @__PURE__ */ jsx15(Text, { variant: "bodyMedium", color: "textPrimary", children: title }) }),
2264
+ /* @__PURE__ */ jsx15(
2265
+ Pressable5,
2266
+ {
2267
+ onPress: onShowQrCode,
2268
+ hitSlop: 12,
2269
+ accessibilityRole: "button",
2270
+ accessibilityLabel: "Show QR code",
2271
+ children: /* @__PURE__ */ jsx15(Box, { alignItems: "center", justifyContent: "center", style: iconButton2, children: /* @__PURE__ */ jsx15(FigmaQrScanIcon, {}) })
2272
+ }
2273
+ )
2274
+ ] }),
2275
+ /* @__PURE__ */ jsxs9(Box, { style: content3, children: [
2276
+ /* @__PURE__ */ jsx15(
2277
+ NetworkSelector,
2278
+ {
2279
+ networks,
2280
+ selectedId: selectedNetworkId,
2281
+ onSelect: onSelectNetwork
1039
2282
  }
1040
2283
  ),
1041
- /* @__PURE__ */ jsxs4(
2284
+ /* @__PURE__ */ jsxs9(
1042
2285
  Box,
1043
2286
  {
1044
- flexDirection: "row",
1045
2287
  alignItems: "center",
1046
- gap: "elementsHorizontal",
1047
- borderColor: "borderDefault",
1048
- borderWidth: 1,
1049
- borderRadius: "button",
1050
- style: styles5.addressCard,
2288
+ justifyContent: "flex-end",
2289
+ style: addressRegion,
1051
2290
  children: [
1052
- /* @__PURE__ */ jsxs4(Box, { flex: 1, style: styles5.addressDetails, children: [
1053
- /* @__PURE__ */ jsx9(
1054
- Text,
2291
+ /* @__PURE__ */ jsx15(
2292
+ Box,
2293
+ {
2294
+ flex: 1,
2295
+ alignItems: "center",
2296
+ justifyContent: "center",
2297
+ backgroundColor: "bgModal",
2298
+ borderColor: "borderDefault",
2299
+ borderWidth: 1,
2300
+ borderRadius: "element",
2301
+ style: addressCard,
2302
+ children: /* @__PURE__ */ jsxs9(Box, { alignItems: "center", style: addressColumn, children: [
2303
+ /* @__PURE__ */ jsxs9(Box, { alignItems: "center", style: addressGroup2, children: [
2304
+ /* @__PURE__ */ jsx15(Text, { variant: "body", color: "textSecondary", children: depositAddressLabel }),
2305
+ /* @__PURE__ */ jsx15(
2306
+ Text,
2307
+ {
2308
+ variant: "bodyMedium",
2309
+ color: "textPrimary",
2310
+ style: addressText2,
2311
+ children: depositAddress
2312
+ }
2313
+ )
2314
+ ] }),
2315
+ showPreview ? /* @__PURE__ */ jsx15(
2316
+ Pressable5,
2317
+ {
2318
+ onPress: onShowChains,
2319
+ accessibilityRole: "button",
2320
+ accessibilityLabel: "Available chains",
2321
+ children: /* @__PURE__ */ jsxs9(
2322
+ Box,
2323
+ {
2324
+ flexDirection: "row",
2325
+ alignItems: "center",
2326
+ backgroundColor: "bgSecondary",
2327
+ style: previewPill,
2328
+ children: [
2329
+ /* @__PURE__ */ jsx15(
2330
+ SourceTokenCluster,
2331
+ {
2332
+ icons: supportedTokenIcons,
2333
+ size: 20,
2334
+ gap: 4
2335
+ }
2336
+ ),
2337
+ /* @__PURE__ */ jsx15(
2338
+ FigmaChevronRightIcon,
2339
+ {
2340
+ size: 16,
2341
+ color: theme.colors.textSecondary
2342
+ }
2343
+ )
2344
+ ]
2345
+ }
2346
+ )
2347
+ }
2348
+ ) : minimumDepositLabel ? /* @__PURE__ */ jsx15(
2349
+ MinimumDepositPill,
2350
+ {
2351
+ label: minimumDepositLabel,
2352
+ iconKey: selectedNetwork?.iconKeys[0]
2353
+ }
2354
+ ) : null
2355
+ ] })
2356
+ }
2357
+ ),
2358
+ /* @__PURE__ */ jsxs9(Box, { flexDirection: "row", style: buttonsRow, children: [
2359
+ /* @__PURE__ */ jsx15(
2360
+ PillButton,
1055
2361
  {
1056
- variant: "detail",
1057
- color: copied ? "textSuccess" : "textSecondary",
1058
- children: copied ? "Copied!" : depositAddressLabel
2362
+ label: copied ? copiedLabel : copyLabel,
2363
+ accessibilityLabel: copied ? "Address copied" : "Copy address",
2364
+ icon: /* @__PURE__ */ jsx15(FigmaCopyIcon, { color: theme.colors.onBtnPrimary }),
2365
+ onPress: handleCopy
1059
2366
  }
1060
2367
  ),
1061
- /* @__PURE__ */ jsx9(
1062
- Text,
2368
+ /* @__PURE__ */ jsx15(
2369
+ PillButton,
1063
2370
  {
1064
- variant: "bodyMedium",
1065
- color: "textPrimary",
1066
- numberOfLines: 1,
1067
- ellipsizeMode: "middle",
1068
- children: depositAddress
2371
+ label: shareLabel,
2372
+ accessibilityLabel: "Share address",
2373
+ icon: /* @__PURE__ */ jsx15(FigmaShareIcon, { color: theme.colors.onBtnPrimary }),
2374
+ onPress: onShareAddress
1069
2375
  }
1070
2376
  )
1071
- ] }),
1072
- /* @__PURE__ */ jsx9(
1073
- CircleIconButton,
1074
- {
1075
- label: copied ? "Address copied" : "Copy address",
1076
- onPress: handleCopy,
1077
- children: copied ? /* @__PURE__ */ jsx9(Text, { color: "textSuccess", style: styles5.actionGlyph, children: "\u2713" }) : /* @__PURE__ */ jsx9(CopyIcon, {})
1078
- }
1079
- ),
1080
- /* @__PURE__ */ jsx9(CircleIconButton, { label: "Share address", onPress: onShareAddress, children: /* @__PURE__ */ jsx9(Text, { color: "textPrimary", style: styles5.actionGlyph, children: "\u2191" }) })
2377
+ ] })
1081
2378
  ]
1082
2379
  }
1083
2380
  )
@@ -1086,80 +2383,1766 @@ function TransferCryptoScreen({
1086
2383
  }
1087
2384
  );
1088
2385
  }
1089
- function CircleIconButton({
1090
- children,
1091
- label,
2386
+ function MinimumDepositPill({
2387
+ label: label2,
2388
+ iconKey
2389
+ }) {
2390
+ return /* @__PURE__ */ jsx15(Box, { alignItems: "center", justifyContent: "flex-start", style: minimumPill, children: /* @__PURE__ */ jsxs9(Box, { flexDirection: "row", alignItems: "center", style: minimumPillRow, children: [
2391
+ iconKey ? /* @__PURE__ */ jsx15(
2392
+ FunIcon,
2393
+ {
2394
+ uri: iconKey.startsWith("http") ? iconKey : chainIconUri(iconKey),
2395
+ size: 16,
2396
+ fallbackUri: FALLBACK_ASSET_LOGO
2397
+ }
2398
+ ) : null,
2399
+ /* @__PURE__ */ jsx15(Text, { variant: "detail", color: "textSecondary", children: label2 })
2400
+ ] }) });
2401
+ }
2402
+ function PillButton({
2403
+ label: label2,
2404
+ accessibilityLabel,
2405
+ icon,
1092
2406
  onPress
1093
2407
  }) {
1094
- return /* @__PURE__ */ jsx9(
1095
- Pressable3,
2408
+ return /* @__PURE__ */ jsx15(
2409
+ Pressable5,
1096
2410
  {
1097
2411
  onPress,
1098
2412
  accessibilityRole: "button",
1099
- accessibilityLabel: label,
1100
- children: /* @__PURE__ */ jsx9(
2413
+ accessibilityLabel,
2414
+ style: pillButtonPress,
2415
+ children: /* @__PURE__ */ jsxs9(
1101
2416
  Box,
1102
2417
  {
1103
- width: 48,
1104
- height: 48,
1105
- borderRadius: "rounded",
1106
- backgroundColor: "bgSecondary",
2418
+ flexDirection: "row",
1107
2419
  alignItems: "center",
1108
2420
  justifyContent: "center",
1109
- children
2421
+ backgroundColor: "btnPrimary",
2422
+ borderRadius: "rounded",
2423
+ style: pillButton,
2424
+ children: [
2425
+ icon,
2426
+ /* @__PURE__ */ jsx15(Text, { variant: "bodyMedium", color: "onBtnPrimary", children: label2 })
2427
+ ]
1110
2428
  }
1111
2429
  )
1112
2430
  }
1113
2431
  );
1114
2432
  }
1115
- var styles5 = StyleSheet5.create({
1116
- topBar: {
1117
- paddingTop: 20,
1118
- paddingBottom: 12,
1119
- paddingHorizontal: 12
1120
- },
1121
- grabber: {
1122
- position: "absolute",
1123
- top: 8,
1124
- left: "50%",
1125
- marginLeft: -18,
1126
- width: 36,
1127
- height: 5
1128
- },
1129
- chevron: {
1130
- fontSize: 26,
1131
- lineHeight: 28,
1132
- width: 24,
1133
- textAlign: "center"
1134
- },
1135
- qrButton: { width: 24, alignItems: "center" },
1136
- content: {
1137
- paddingHorizontal: 20,
1138
- paddingBottom: 16,
1139
- paddingTop: 8,
1140
- gap: 8
1141
- },
1142
- networkRow: { paddingHorizontal: 16, paddingVertical: 10 },
1143
- addressCard: { padding: 16 },
1144
- addressDetails: { gap: 4 },
1145
- actionGlyph: { fontSize: 18, lineHeight: 20, fontWeight: "500" }
1146
- });
2433
+ var topBar4 = {
2434
+ paddingTop: 16,
2435
+ paddingBottom: 16,
2436
+ paddingHorizontal: 24,
2437
+ gap: 4
2438
+ };
2439
+ var iconButton2 = { width: 32, height: 32 };
2440
+ var content3 = {
2441
+ paddingHorizontal: 20,
2442
+ // pb-16 in Figma + the iOS home-indicator space below the buttons, so the
2443
+ // sheet bottom sits flush with the 874px frame bottom.
2444
+ paddingBottom: 34,
2445
+ paddingTop: 8,
2446
+ gap: 16
2447
+ };
2448
+ var addressRegion = { height: 320, gap: 16, width: "100%" };
2449
+ var addressCard = {
2450
+ width: "100%",
2451
+ paddingVertical: 64,
2452
+ paddingHorizontal: 20,
2453
+ // Subtle card shadow (Figma shadow/lg at 2% — a faint lift). The card MUST
2454
+ // keep an opaque `backgroundColor`: on Android `elevation` draws its shadow
2455
+ // from the view outline, and without a solid background it can't clip to the
2456
+ // rounded corners — it bleeds as a gray rectangular border around the card.
2457
+ shadowColor: "#000",
2458
+ shadowOpacity: 0.02,
2459
+ shadowOffset: { width: 0, height: 8 },
2460
+ shadowRadius: 32,
2461
+ elevation: 1
2462
+ };
2463
+ var addressColumn = { gap: 6 };
2464
+ var addressGroup2 = { gap: 6 };
2465
+ var addressText2 = { fontSize: 24, lineHeight: 34 };
2466
+ var previewPill = {
2467
+ gap: 4,
2468
+ paddingHorizontal: 8,
2469
+ paddingVertical: 8,
2470
+ borderRadius: 999
2471
+ };
2472
+ var minimumPill = { height: 36, paddingTop: 2 };
2473
+ var minimumPillRow = { gap: 4, height: 20 };
2474
+ var buttonsRow = { gap: 10, width: "100%" };
2475
+ var pillButtonPress = { flex: 1 };
2476
+ var pillButton = { height: 56, paddingHorizontal: 24, gap: 8 };
2477
+
2478
+ // src/swapped/SwappedScreen.tsx
2479
+ import { useCallback as useCallback3 } from "react";
2480
+
2481
+ // src/swapped/SwappedWebView.tsx
2482
+ import { useTheme as useTheme2 } from "@shopify/restyle";
2483
+ import { useCallback as useCallback2, useEffect as useEffect8, useMemo as useMemo4, useRef as useRef4 } from "react";
2484
+ import { ActivityIndicator, View } from "react-native";
2485
+ import { WebView } from "react-native-webview";
2486
+
2487
+ // src/swapped/buildSwappedTheme.ts
2488
+ var px = (value) => `${value}px`;
2489
+ var toRawHex = (color) => color.replace(/^#/, "");
2490
+ function buildSwappedThemeQueryParamsRN(theme) {
2491
+ const { colors, borderRadii } = theme;
2492
+ return {
2493
+ iframeBackground: toRawHex(colors.bgModal),
2494
+ widgetBackground: toRawHex(colors.bgModal),
2495
+ textColor: toRawHex(colors.textPrimary),
2496
+ spinnerColor: toRawHex(colors.textPrimary),
2497
+ modalRadii: px(borderRadii.modal),
2498
+ skeletonColor: toRawHex(colors.borderDefault),
2499
+ skeletonSecondaryColor: toRawHex(colors.bgSecondary)
2500
+ };
2501
+ }
2502
+ function buildSwappedThemeRN(theme, isDarkMode) {
2503
+ const { colors, borderRadii, sizes, spacing, textVariants } = theme;
2504
+ return {
2505
+ colors: {
2506
+ // ── Core text ─────────────────────────────────────────────────────
2507
+ primaryText: colors.textPrimary,
2508
+ secondaryText: colors.textSecondary,
2509
+ tertiaryText: colors.textSecondary,
2510
+ // ── Surfaces ──────────────────────────────────────────────────────
2511
+ modalBackground: colors.bgModal,
2512
+ offBackground: colors.bgSecondary,
2513
+ hoverState: colors.bgSecondary,
2514
+ lightStroke: colors.borderDefault,
2515
+ mediumStroke: colors.borderFocused,
2516
+ heavyStroke: colors.borderFocused,
2517
+ modalBorder: colors.borderModal,
2518
+ modalHeaderDivider: colors.borderDefault,
2519
+ modalFooterDivider: colors.borderDefault,
2520
+ // ── Accent / brand ────────────────────────────────────────────────
2521
+ actionColor: colors.brandPrimary,
2522
+ accentColor: colors.brandPrimary,
2523
+ accentColorForeground: colors.onBtnPrimary,
2524
+ // ── Status ────────────────────────────────────────────────────────
2525
+ error: colors.textError,
2526
+ success: colors.textSuccess,
2527
+ // ── Spinner ───────────────────────────────────────────────────────
2528
+ spinnerIndicator: colors.textPrimary,
2529
+ spinnerBackground: colors.borderFocused,
2530
+ // ── Primary button ────────────────────────────────────────────────
2531
+ // web spreads both `buttonBackground*` (ThemeVars) and `buttonPrimary*`
2532
+ // (widget aliases); the widget reads whichever is present.
2533
+ buttonBackground: colors.btnPrimary,
2534
+ buttonBackgroundHover: colors.btnPrimaryHover,
2535
+ buttonBackgroundPressed: colors.btnPrimaryPressed,
2536
+ buttonBackgroundDisabled: colors.btnPrimaryDisabled,
2537
+ buttonPrimary: colors.btnPrimary,
2538
+ buttonPrimaryHover: colors.btnPrimaryHover,
2539
+ buttonDisabled: colors.btnPrimaryDisabled,
2540
+ buttonTextPrimary: colors.onBtnPrimary,
2541
+ buttonTextHover: colors.onBtnPrimary,
2542
+ buttonTextDisabled: colors.onBtnPrimary,
2543
+ buttonTextSecondary: colors.onBtnSecondary,
2544
+ buttonTextSecondaryDisabled: colors.onBtnSecondary,
2545
+ buttonFocusedOutline: "none",
2546
+ buttonBorderGradient: "none",
2547
+ buttonHoverBorderGradient: "none",
2548
+ buttonDisabledBorderGradient: "none",
2549
+ // ── Tertiary button ───────────────────────────────────────────────
2550
+ buttonBackgroundTertiary: colors.btnTertiary,
2551
+ buttonBackgroundHoverTertiary: colors.btnTertiaryHover,
2552
+ buttonBackgroundDisabledTertiary: colors.btnTertiaryDisabled,
2553
+ buttonTextTertiary: colors.onBtnTertiary,
2554
+ buttonTextDisabledTertiary: colors.onBtnTertiary,
2555
+ buttonBorderTertiary: "transparent",
2556
+ buttonBorderFocusedTertiary: colors.borderFocused,
2557
+ // ── Icon button / top bar ─────────────────────────────────────────
2558
+ headerButtonBackground: colors.btnIcon,
2559
+ buttonIconBackgroundHover: colors.btnIconHover,
2560
+ buttonIconBackgroundPressed: colors.btnIconPressed,
2561
+ buttonIconStroke: colors.onBtnIcon,
2562
+ modalTopbarIcon: colors.onBtnIcon,
2563
+ modalTopbarIconBackground: colors.btnIcon,
2564
+ modalTopbarIconBackgroundHover: colors.btnIconHover,
2565
+ modalTopbarIconBackgroundPressed: colors.btnIconPressed,
2566
+ // ── Input ─────────────────────────────────────────────────────────
2567
+ inputBackground: colors.bgModal,
2568
+ inputBackgroundHover: colors.bgSecondary,
2569
+ inputBorderBase: colors.borderDefault,
2570
+ inputBorderHover: colors.borderFocused,
2571
+ inputLabel: colors.textPrimary,
2572
+ inputBorder: colors.borderDefault,
2573
+ inputBorderFocused: colors.textSecondary,
2574
+ inputBorderActive: colors.textSecondary,
2575
+ inputPlaceholder: colors.textSecondary,
2576
+ // ── Selection ─────────────────────────────────────────────────────
2577
+ selectedOptionBorder: colors.borderSelected,
2578
+ focusedOptionBorder: colors.borderFocused,
2579
+ // ── Widget aliases (mirrors web buildSwappedTheme) ────────────────
2580
+ boxBackground: colors.bgSecondary,
2581
+ secondaryButtonBg: colors.btnTertiary,
2582
+ secondaryButtonText: colors.onBtnTertiary,
2583
+ secondaryButtonHover: colors.btnTertiaryHover,
2584
+ secondaryButtonTextHover: colors.onBtnTertiary
2585
+ },
2586
+ radii: {
2587
+ modal: px(borderRadii.modal),
2588
+ actionButton: px(borderRadii.button),
2589
+ summaryBox: px(borderRadii.element),
2590
+ box: px(borderRadii.element),
2591
+ otpInput: px(borderRadii.button),
2592
+ calculatorInput: px(borderRadii.button),
2593
+ amountPill: px(borderRadii.button)
2594
+ },
2595
+ paymentMethodLightLogos: !isDarkMode,
2596
+ headerHeight: px(sizes.topBar),
2597
+ headerFontWeight: String(textVariants.headerTitle.fontWeight ?? "500"),
2598
+ // web: topbarIconColor ← modalTopbarIcon (the icon on the top-bar buttons)
2599
+ topbarIconColor: colors.onBtnIcon,
2600
+ topbarTextFontSize: px(textVariants.headerTitle.fontSize ?? 13),
2601
+ headerIconWrapperSize: px(sizes.buttonXs),
2602
+ headerIconSize: px(sizes.iconMd),
2603
+ buttonFontWeight: String(textVariants.bodyMedium.fontWeight ?? "500"),
2604
+ modalBottomBarButtonHeight: px(sizes.buttonHeight),
2605
+ iframeBackground: colors.bgModal,
2606
+ // Same fixed paddings web sends (web: modalBaseHorizontalPadding + 6px).
2607
+ topbarPaddingX: px(spacing.modalHorizontal + 6),
2608
+ topbarPaddingY: "12px",
2609
+ boxPaddingY: "16px",
2610
+ boxPaddingX: "16px",
2611
+ paddingPrimary: "20px",
2612
+ paddingSecondary: "12px",
2613
+ paddingTertiary: "20px"
2614
+ };
2615
+ }
2616
+
2617
+ // src/swapped/webViewSwappedTransport.ts
2618
+ import {
2619
+ getSwappedOrigin
2620
+ } from "@funkit/connect-core";
2621
+ var FUNKIT_ENVELOPE_KEY = "__funkitSwapped";
2622
+ var SWAPPED_WEBVIEW_INJECTED_JS = `(function () {
2623
+ if (window.${FUNKIT_ENVELOPE_KEY}Bridge) { return; }
2624
+ window.${FUNKIT_ENVELOPE_KEY}Bridge = true;
2625
+ // The REAL postMessage, captured before the override below.
2626
+ var postToPage = window.postMessage.bind(window);
2627
+ function forwardToNative(message) {
2628
+ try {
2629
+ var data = typeof message === 'string' ? message : JSON.stringify(message);
2630
+ window.ReactNativeWebView && window.ReactNativeWebView.postMessage(data);
2631
+ } catch (e) {}
2632
+ }
2633
+ function bridged(message) {
2634
+ // funkit envelope (host \u2192 embed): unwrap + deliver to the page's listeners.
2635
+ if (message && message.${FUNKIT_ENVELOPE_KEY}) {
2636
+ try { postToPage(message.payload, '*'); } catch (e) {}
2637
+ return;
2638
+ }
2639
+ // Anything else is the embed talking to its host \u2192 forward to native.
2640
+ forwardToNative(message);
2641
+ }
2642
+ // The embed posts to window.parent (and sometimes window) \u2014 both are this
2643
+ // window at the top level, so both assignments install the same bridge.
2644
+ try { if (window.parent) { window.parent.postMessage = bridged; } } catch (e) {}
2645
+ try { window.postMessage = bridged; } catch (e) {}
2646
+ // No parent frame \u2192 the widget posts lifecycle messages to window.opener.
2647
+ try { if (!window.opener) { window.opener = { postMessage: forwardToNative }; } } catch (e) {}
2648
+ true;
2649
+ })();
2650
+ true;`;
2651
+ function buildSwappedSendScript(msg) {
2652
+ const envelope = JSON.stringify({ [FUNKIT_ENVELOPE_KEY]: true, payload: msg });
2653
+ return `(function () {
2654
+ try { window.postMessage(${envelope}, '*'); } catch (e) {}
2655
+ })();
2656
+ true;`;
2657
+ }
2658
+ function handleWebViewMessage(rawData, url) {
2659
+ if (url != null && getSwappedOrigin(url) == null) {
2660
+ return null;
2661
+ }
2662
+ let parsed;
2663
+ if (typeof rawData === "string") {
2664
+ try {
2665
+ parsed = JSON.parse(rawData);
2666
+ } catch {
2667
+ return null;
2668
+ }
2669
+ } else {
2670
+ parsed = rawData;
2671
+ }
2672
+ const data = parsed;
2673
+ if (!data || typeof data.type !== "string") {
2674
+ return null;
2675
+ }
2676
+ return data;
2677
+ }
2678
+ function createWebViewSwappedTransport({
2679
+ getWebView
2680
+ }) {
2681
+ const handlers = /* @__PURE__ */ new Set();
2682
+ const transport = {
2683
+ send(msg) {
2684
+ const webView = getWebView();
2685
+ if (!webView) {
2686
+ return false;
2687
+ }
2688
+ webView.injectJavaScript(buildSwappedSendScript(msg));
2689
+ return true;
2690
+ },
2691
+ onMessage(handler) {
2692
+ handlers.add(handler);
2693
+ return () => {
2694
+ handlers.delete(handler);
2695
+ };
2696
+ }
2697
+ };
2698
+ function dispatch(rawData, url) {
2699
+ const msg = handleWebViewMessage(rawData, url);
2700
+ if (msg) {
2701
+ for (const handler of handlers) {
2702
+ handler(msg);
2703
+ }
2704
+ }
2705
+ }
2706
+ return { transport, dispatch };
2707
+ }
2708
+
2709
+ // src/swapped/SwappedWebView.tsx
2710
+ import { jsx as jsx16 } from "react/jsx-runtime";
2711
+ function SwappedWebView({ url, onMessage, style }) {
2712
+ const webViewRef = useRef4(null);
2713
+ const { transport, dispatch } = useMemo4(
2714
+ () => createWebViewSwappedTransport({
2715
+ getWebView: () => webViewRef.current
2716
+ }),
2717
+ []
2718
+ );
2719
+ const theme = useTheme2();
2720
+ const { colorScheme } = useFunkitColorScheme();
2721
+ const swappedTheme = useMemo4(
2722
+ () => buildSwappedThemeRN(theme, colorScheme === "dark"),
2723
+ [theme, colorScheme]
2724
+ );
2725
+ const swappedThemeRef = useRef4(swappedTheme);
2726
+ swappedThemeRef.current = swappedTheme;
2727
+ const colorSchemeRef = useRef4(colorScheme);
2728
+ colorSchemeRef.current = colorScheme;
2729
+ const handlerRef = useRef4(onMessage);
2730
+ handlerRef.current = onMessage;
2731
+ useEffect8(
2732
+ () => transport.onMessage((msg) => {
2733
+ if (msg.type === "SWAPPED_READY") {
2734
+ transport.send({
2735
+ type: "SWAPPED_THEME",
2736
+ data: swappedThemeRef.current
2737
+ });
2738
+ logger.info("connect-rn:swapped:theme_sent", {
2739
+ colorScheme: colorSchemeRef.current
2740
+ });
2741
+ }
2742
+ handlerRef.current(msg);
2743
+ }),
2744
+ [transport]
2745
+ );
2746
+ const handleMessage = (event) => {
2747
+ dispatch(event.nativeEvent.data, event.nativeEvent.url);
2748
+ };
2749
+ const renderLoading = useCallback2(
2750
+ () => /* @__PURE__ */ jsx16(View, { style: [loadingOverlay, { backgroundColor: theme.colors.bgModal }], children: /* @__PURE__ */ jsx16(ActivityIndicator, { color: theme.colors.textSecondary }) }),
2751
+ [theme.colors.bgModal, theme.colors.textSecondary]
2752
+ );
2753
+ const handleError = (event) => {
2754
+ logger.warn("connect-rn:swapped:webview:error", {
2755
+ code: String(event.nativeEvent.code),
2756
+ description: event.nativeEvent.description,
2757
+ url: event.nativeEvent.url
2758
+ });
2759
+ };
2760
+ const handleHttpError = (event) => {
2761
+ logger.warn("connect-rn:swapped:webview:httpError", {
2762
+ status: String(event.nativeEvent.statusCode),
2763
+ url: event.nativeEvent.url
2764
+ });
2765
+ };
2766
+ return /* @__PURE__ */ jsx16(
2767
+ WebView,
2768
+ {
2769
+ ref: webViewRef,
2770
+ source: { uri: url },
2771
+ onMessage: handleMessage,
2772
+ onError: handleError,
2773
+ onHttpError: handleHttpError,
2774
+ scrollEnabled: false,
2775
+ injectedJavaScriptBeforeContentLoaded: SWAPPED_WEBVIEW_INJECTED_JS,
2776
+ startInLoadingState: true,
2777
+ renderLoading,
2778
+ javaScriptEnabled: true,
2779
+ domStorageEnabled: true,
2780
+ sharedCookiesEnabled: true,
2781
+ thirdPartyCookiesEnabled: true,
2782
+ allowsInlineMediaPlayback: true,
2783
+ keyboardDisplayRequiresUserAction: false,
2784
+ hideKeyboardAccessoryView: true,
2785
+ automaticallyAdjustContentInsets: false,
2786
+ contentInsetAdjustmentBehavior: "never",
2787
+ setSupportMultipleWindows: false,
2788
+ originWhitelist: ["https://*"],
2789
+ style: [{ backgroundColor: theme.colors.bgModal }, style]
2790
+ }
2791
+ );
2792
+ }
2793
+ var loadingOverlay = {
2794
+ position: "absolute",
2795
+ top: 0,
2796
+ left: 0,
2797
+ right: 0,
2798
+ bottom: 0,
2799
+ alignItems: "center",
2800
+ justifyContent: "center"
2801
+ };
2802
+
2803
+ // src/swapped/SwappedScreen.tsx
2804
+ import { jsx as jsx17 } from "react/jsx-runtime";
2805
+ function SwappedScreen({
2806
+ url,
2807
+ onClose,
2808
+ onBack,
2809
+ onSuccess
2810
+ }) {
2811
+ const handleMessage = useCallback3(
2812
+ (msg) => {
2813
+ switch (msg.type) {
2814
+ case "SWAPPED_GO_BACK":
2815
+ case "SWAPPED_NEW_DEPOSIT":
2816
+ onBack();
2817
+ break;
2818
+ case "SWAPPED_CLOSE":
2819
+ onClose();
2820
+ break;
2821
+ case "SWAPPED_TRANSACTION_SUCCESSFUL":
2822
+ logger.info("connect-rn:swapped:transaction_successful");
2823
+ onSuccess?.();
2824
+ break;
2825
+ case "SWAPPED_ERROR":
2826
+ logger.warn("connect-rn:swapped:error", {
2827
+ data: JSON.stringify(msg.data ?? {})
2828
+ });
2829
+ break;
2830
+ default:
2831
+ break;
2832
+ }
2833
+ },
2834
+ [onBack, onClose, onSuccess]
2835
+ );
2836
+ return /* @__PURE__ */ jsx17(
2837
+ Box,
2838
+ {
2839
+ backgroundColor: "bgModal",
2840
+ borderTopLeftRadius: "modal",
2841
+ borderTopRightRadius: "modal",
2842
+ style: sheet3,
2843
+ children: /* @__PURE__ */ jsx17(SwappedWebView, { url, onMessage: handleMessage, style: fill })
2844
+ }
2845
+ );
2846
+ }
2847
+ var SHEET_HEIGHT = 550;
2848
+ var sheet3 = { height: SHEET_HEIGHT, overflow: "hidden" };
2849
+ var fill = { flex: 1 };
2850
+
2851
+ // src/transfer/availableChains.ts
2852
+ import {
2853
+ bitcoinChain,
2854
+ chainMetadataById,
2855
+ solanaChain,
2856
+ tronChain
2857
+ } from "@funkit/chains";
2858
+ import {
2859
+ getMinTransferValueForChain
2860
+ } from "@funkit/connect-core";
2861
+ var NON_EVM_CHAIN_IDS = /* @__PURE__ */ new Set([
2862
+ solanaChain.id,
2863
+ tronChain.id,
2864
+ bitcoinChain.id
2865
+ ]);
2866
+ var EVM_NETWORK_ID = "evm";
2867
+ var EVM_NETWORK_LABEL = "EVM Chains";
2868
+ function isNonEvmChainId(chainId) {
2869
+ return NON_EVM_CHAIN_IDS.has(chainId);
2870
+ }
2871
+ function belongsToNetwork(chainId, networkChainId) {
2872
+ if (networkChainId == null) return true;
2873
+ if (NON_EVM_CHAIN_IDS.has(networkChainId)) return chainId === networkChainId;
2874
+ return !NON_EVM_CHAIN_IDS.has(chainId);
2875
+ }
2876
+ function buildAvailableChains({
2877
+ chainFilters,
2878
+ networkChainId,
2879
+ minTransferLimits,
2880
+ target
2881
+ }) {
2882
+ const minDepositAddOn = target?.getMinDepositUSD?.({
2883
+ tokenChainId: target.targetChain,
2884
+ tokenAddress: target.targetAsset,
2885
+ dynamicRoutingId: target.dynamicRoutingId
2886
+ }) ?? 0;
2887
+ return chainFilters.filter((f) => f.id !== "all").map((f) => ({ chainId: Number(f.id), name: f.label })).filter(({ chainId }) => belongsToNetwork(chainId, networkChainId)).map(({ chainId, name }) => {
2888
+ const meta = chainMetadataById[chainId];
2889
+ const min = Math.ceil(
2890
+ getMinTransferValueForChain(chainId, minTransferLimits) + minDepositAddOn
2891
+ );
2892
+ return {
2893
+ id: String(chainId),
2894
+ name: name || meta?.name || `Chain ${chainId}`,
2895
+ iconUri: meta?.iconUrl ?? FALLBACK_ASSET_LOGO,
2896
+ minLabel: `Min $${min}`
2897
+ };
2898
+ });
2899
+ }
2900
+ function buildDepositNetworks(chainFilters) {
2901
+ const chains = chainFilters.filter((f) => f.id !== "all").map((f) => ({ chainId: Number(f.id), label: f.label }));
2902
+ const iconUrl = (chainId) => chainMetadataById[chainId]?.iconUrl ?? FALLBACK_ASSET_LOGO;
2903
+ const evmChains = chains.filter((c) => !isNonEvmChainId(c.chainId));
2904
+ const networks = [];
2905
+ if (evmChains.length > 0) {
2906
+ networks.push({
2907
+ id: EVM_NETWORK_ID,
2908
+ label: EVM_NETWORK_LABEL,
2909
+ iconKeys: evmChains.map((c) => iconUrl(c.chainId)),
2910
+ // Any EVM chain selects the shared EVM deposit address.
2911
+ chainId: evmChains[0].chainId
2912
+ });
2913
+ }
2914
+ for (const c of chains) {
2915
+ if (!isNonEvmChainId(c.chainId)) continue;
2916
+ const meta = chainMetadataById[c.chainId];
2917
+ networks.push({
2918
+ id: String(c.chainId),
2919
+ label: c.label || meta?.name || `Chain ${c.chainId}`,
2920
+ iconKeys: [iconUrl(c.chainId)],
2921
+ chainId: c.chainId
2922
+ });
2923
+ }
2924
+ return networks;
2925
+ }
2926
+
2927
+ // src/transfer/clipboard.ts
2928
+ async function copyToClipboard(value) {
2929
+ try {
2930
+ const { default: Clipboard } = await import("@react-native-clipboard/clipboard");
2931
+ Clipboard.setString(value);
2932
+ return true;
2933
+ } catch (error) {
2934
+ logger.warn(
2935
+ "connect-rn: clipboard write failed; address not copied. Inject FunkitProvider `copyToClipboard` to use your own clipboard module (e.g. expo-clipboard in Expo Go).",
2936
+ { error: error instanceof Error ? error.message : String(error) }
2937
+ );
2938
+ return false;
2939
+ }
2940
+ }
2941
+
2942
+ // src/transfer/fops.ts
2943
+ import {
2944
+ FormOfPaymentType
2945
+ } from "@funkit/api-base";
2946
+ import { getFopsLimit } from "@funkit/connect-core";
2947
+ var BANK_TRANSFER_TIME = "1-2 days";
2948
+ function toFopRows(fops, exchangeRates) {
2949
+ return fops.map((fop) => {
2950
+ const limit = `${getFopsLimit(fop, exchangeRates)} limit`;
2951
+ const subtitle = fop.fopType === FormOfPaymentType.BANK_TRANSFER ? `${limit} \xB7 ${BANK_TRANSFER_TIME}` : limit;
2952
+ return {
2953
+ id: `${fop.fopType}:${fop.name}`,
2954
+ name: fop.name,
2955
+ iconUri: fop.iconImageUrl,
2956
+ subtitle,
2957
+ disabled: !fop.embeddedFlowUrl
2958
+ };
2959
+ });
2960
+ }
2961
+
2962
+ // src/transfer/formatDepositAddress.ts
2963
+ function formatDepositAddress(address, leading = 6, trailing = 6) {
2964
+ if (!address) {
2965
+ return "";
2966
+ }
2967
+ if (address.length <= leading + trailing) {
2968
+ return address;
2969
+ }
2970
+ return `${address.slice(0, leading)}\u2026${address.slice(-trailing)}`;
2971
+ }
2972
+
2973
+ // src/transfer/hooks/useFops.ts
2974
+ import {
2975
+ getFops
2976
+ } from "@funkit/api-base";
2977
+ import {
2978
+ FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS,
2979
+ solanaChain as solanaChain2
2980
+ } from "@funkit/chains";
2981
+ import {
2982
+ DEFAULT_FIAT_CURRENCY,
2983
+ FOPS_STALE_TIME,
2984
+ getDepositAddressForChain,
2985
+ sortFops,
2986
+ useDynamicConfig as useDynamicConfig3,
2987
+ useSwappedDefaultCurrencyQuery
2988
+ } from "@funkit/connect-core";
2989
+ import { useTheme as useTheme3 } from "@shopify/restyle";
2990
+ import { useQuery as useQuery3 } from "@tanstack/react-query";
2991
+ import { useMemo as useMemo6 } from "react";
2992
+
2993
+ // src/identity/IdentityContext.tsx
2994
+ import { createContext as createContext2, useContext as useContext2 } from "react";
2995
+ import { jsx as jsx18 } from "react/jsx-runtime";
2996
+ function generateSyntheticUserId(apiKey, externalUserId) {
2997
+ return `${apiKey}|${externalUserId}`;
2998
+ }
2999
+ function resolveFunkitIdentity(config, walletAddress) {
3000
+ const address = walletAddress || "0x";
3001
+ const userId = config.externalUserId ? generateSyntheticUserId(config.apiKey, config.externalUserId) : address;
3002
+ return {
3003
+ apiKey: config.apiKey,
3004
+ userId,
3005
+ walletAddress: address,
3006
+ loginType: config.loginType
3007
+ };
3008
+ }
3009
+ var FunkitIdentityContext = createContext2(null);
3010
+ function FunkitIdentityProvider({
3011
+ identity,
3012
+ children
3013
+ }) {
3014
+ return /* @__PURE__ */ jsx18(FunkitIdentityContext.Provider, { value: identity, children });
3015
+ }
3016
+ function useFunkitIdentity() {
3017
+ const identity = useContext2(FunkitIdentityContext);
3018
+ if (identity == null) {
3019
+ throw new Error(
3020
+ "useFunkitIdentity must be used within a <FunkitIdentityProvider> (mounted by <FunkitProvider>)"
3021
+ );
3022
+ }
3023
+ return identity;
3024
+ }
3025
+
3026
+ // src/transfer/hooks/useTransferInit.ts
3027
+ import {
3028
+ initializeCheckoutTokenTransferAddress
3029
+ } from "@funkit/api-base";
3030
+ import {
3031
+ getCheckoutTokenTransferParams
3032
+ } from "@funkit/connect-core";
3033
+ import { useQuery as useQuery2 } from "@tanstack/react-query";
3034
+
3035
+ // src/transfer/hooks/useUDAParams.ts
3036
+ import { useDynamicConfig as useDynamicConfig2 } from "@funkit/connect-core";
3037
+ import { useMemo as useMemo5 } from "react";
3038
+ function useUDAParams(dynamicRoutingId) {
3039
+ const udaParams = useDynamicConfig2("uda_params");
3040
+ return useMemo5(
3041
+ () => udaParams.find((param) => param.dynamicRoutingId === dynamicRoutingId)?.params,
3042
+ [udaParams, dynamicRoutingId]
3043
+ );
3044
+ }
3045
+
3046
+ // src/transfer/hooks/useTransferInit.ts
3047
+ var TRANSFER_CLIENT_METADATA = {};
3048
+ function useTransferInit({
3049
+ checkoutConfig,
3050
+ recipientAddr,
3051
+ dynamicRoutingId,
3052
+ enabled = true
3053
+ }) {
3054
+ const { apiKey, userId, walletAddress } = useFunkitIdentity();
3055
+ const udaParams = useUDAParams(dynamicRoutingId);
3056
+ const resolvedRecipient = recipientAddr || walletAddress || "0x";
3057
+ const params = getCheckoutTokenTransferParams({
3058
+ checkoutConfig,
3059
+ userId,
3060
+ apiKey,
3061
+ recipientAddr: resolvedRecipient,
3062
+ udaParams
3063
+ });
3064
+ const { data, isLoading, isFetching } = useQuery2({
3065
+ queryKey: ["initializeCheckoutTokenTransferAddress", params],
3066
+ queryFn: ({ queryKey: [, queryParams] }) => queryParams ? initializeCheckoutTokenTransferAddress({
3067
+ ...queryParams,
3068
+ logger,
3069
+ clientMetadata: TRANSFER_CLIENT_METADATA
3070
+ }) : void 0,
3071
+ enabled: enabled && !!params,
3072
+ refetchOnWindowFocus: false,
3073
+ refetchOnMount: false
3074
+ });
3075
+ return {
3076
+ transferInit: isFetching ? void 0 : data,
3077
+ recipientAddr: resolvedRecipient,
3078
+ isLoading,
3079
+ isFetching
3080
+ };
3081
+ }
3082
+
3083
+ // src/transfer/hooks/useFops.ts
3084
+ var DEFAULT_COUNTRY_CODE = "US";
3085
+ function useFops({
3086
+ checkoutConfig,
3087
+ dynamicRoutingId,
3088
+ enabled = true
3089
+ }) {
3090
+ const { apiKey, userId } = useFunkitIdentity();
3091
+ const isSwappedEnabled = !!useDynamicConfig3("enableswappeddeposit");
3092
+ const fopPriority = useDynamicConfig3("foppriority");
3093
+ const { userIpInfo } = useUserIpInfo();
3094
+ const countryCode = userIpInfo?.alpha2 || DEFAULT_COUNTRY_CODE;
3095
+ const {
3096
+ data: swappedCurrencyCode = DEFAULT_FIAT_CURRENCY,
3097
+ isLoading: isSwappedCurrencyCodeLoading
3098
+ } = useSwappedDefaultCurrencyQuery({
3099
+ apiKey,
3100
+ countryCode: userIpInfo?.alpha2,
3101
+ logger
3102
+ });
3103
+ const theme = useTheme3();
3104
+ const themeConfig = useMemo6(
3105
+ () => buildSwappedThemeQueryParamsRN(theme),
3106
+ [theme]
3107
+ );
3108
+ const {
3109
+ transferInit,
3110
+ isLoading: isTransferInitLoading,
3111
+ isFetching: isTransferInitFetching
3112
+ } = useTransferInit({
3113
+ checkoutConfig,
3114
+ dynamicRoutingId,
3115
+ enabled: enabled && isSwappedEnabled
3116
+ });
3117
+ const targetAsset = checkoutConfig?.targetAsset;
3118
+ const targetChain = checkoutConfig?.targetChain;
3119
+ const recipientAddress = targetChain ? getDepositAddressForChain(Number(targetChain), transferInit) : void 0;
3120
+ const isEnabled = enabled && isSwappedEnabled && !!apiKey && !!targetAsset && !!targetChain && !!recipientAddress && !!transferInit && !isSwappedCurrencyCodeLoading;
3121
+ const query = useQuery3({
3122
+ queryKey: [
3123
+ "fops",
3124
+ userId,
3125
+ recipientAddress,
3126
+ targetAsset,
3127
+ targetChain,
3128
+ apiKey,
3129
+ countryCode,
3130
+ swappedCurrencyCode,
3131
+ fopPriority,
3132
+ themeConfig
3133
+ ],
3134
+ queryFn: async () => {
3135
+ if (!recipientAddress || !targetChain || !targetAsset) {
3136
+ return { genericFormsOfPayments: [], savedFormsOfPayments: [] };
3137
+ }
3138
+ const destinationToken = { chainId: targetChain, address: targetAsset };
3139
+ const recipientTargets = [
3140
+ { recipientAddress, destinationToken },
3141
+ ...transferInit?.solanaAddr ? [
3142
+ {
3143
+ recipientAddress: transferInit.solanaAddr,
3144
+ destinationToken: {
3145
+ chainId: solanaChain2.id.toString(),
3146
+ address: FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS
3147
+ }
3148
+ }
3149
+ ] : []
3150
+ ];
3151
+ const response = await getFops({
3152
+ apiKey,
3153
+ logger,
3154
+ params: {
3155
+ recipientAddress,
3156
+ userId,
3157
+ destinationToken,
3158
+ fiatCurrencyCode: swappedCurrencyCode,
3159
+ countryCode,
3160
+ recipientTargets,
3161
+ thirdPartyPaymentConfigs: { swapped: { themeConfig } }
3162
+ }
3163
+ });
3164
+ return {
3165
+ genericFormsOfPayments: sortFops(
3166
+ response.genericFormsOfPayments,
3167
+ fopPriority
3168
+ ),
3169
+ savedFormsOfPayments: sortFops(
3170
+ response.savedFormsOfPayments,
3171
+ fopPriority
3172
+ )
3173
+ };
3174
+ },
3175
+ enabled: isEnabled,
3176
+ staleTime: FOPS_STALE_TIME,
3177
+ refetchOnWindowFocus: false
3178
+ });
3179
+ return {
3180
+ savedFops: query.data?.savedFormsOfPayments ?? [],
3181
+ genericFops: query.data?.genericFormsOfPayments ?? [],
3182
+ isLoading: query.isLoading || isTransferInitLoading,
3183
+ isFetching: isTransferInitFetching,
3184
+ isError: query.isError,
3185
+ refetch: () => void query.refetch(),
3186
+ isSwappedEnabled
3187
+ };
3188
+ }
3189
+
3190
+ // src/transfer/hooks/useSupportedTokens.ts
3191
+ import { getSupportedAssets } from "@funkit/api-base";
3192
+ import {
3193
+ isTransferChainEnabled,
3194
+ resolveTokenTransferConfig,
3195
+ useDynamicConfig as useDynamicConfig4
3196
+ } from "@funkit/connect-core";
3197
+ import { useQuery as useQuery4 } from "@tanstack/react-query";
3198
+ import { useMemo as useMemo7 } from "react";
3199
+
3200
+ // src/transfer/supportedTokens.ts
3201
+ function buildSupportedTokenList(resolved) {
3202
+ const priorityIndex = new Map(
3203
+ resolved.priorityTokenSymbols.map((symbol, i) => [symbol, i])
3204
+ );
3205
+ const tokens = [];
3206
+ const chainFilters = [{ id: "all", label: "All" }];
3207
+ for (const chainId of resolved.chainIdSortOrder) {
3208
+ const assets = Object.values(resolved.supportedAssets[chainId] ?? {});
3209
+ if (assets.length === 0) {
3210
+ continue;
3211
+ }
3212
+ chainFilters.push({ id: String(chainId), label: assets[0].chainName });
3213
+ for (const asset of assets) {
3214
+ tokens.push({
3215
+ id: `${asset.chainId}:${asset.address}`,
3216
+ symbol: asset.symbol,
3217
+ chainLabel: asset.chainName,
3218
+ chainId: Number(asset.chainId),
3219
+ address: asset.address
3220
+ });
3221
+ }
3222
+ }
3223
+ const rank = (symbol) => priorityIndex.get(symbol) ?? Number.POSITIVE_INFINITY;
3224
+ tokens.sort((a, b) => rank(a.symbol) - rank(b.symbol));
3225
+ return { tokens, chainFilters };
3226
+ }
3227
+
3228
+ // src/transfer/hooks/useSupportedTokens.ts
3229
+ function useSupportedTokens({
3230
+ enabled = true,
3231
+ transferInit
3232
+ } = {}) {
3233
+ const { apiKey } = useFunkitIdentity();
3234
+ const tokenTransferConfig = useDynamicConfig4("tokentransferconfig");
3235
+ const disabledChainAssets = useDynamicConfig4(
3236
+ "disabletokentransferchainsandassets"
3237
+ );
3238
+ const { data, isLoading } = useQuery4({
3239
+ queryKey: ["getSupportedAssets", apiKey],
3240
+ queryFn: ({ queryKey: [, key] }) => getSupportedAssets({ apiKey: key, logger }),
3241
+ enabled: enabled && !!apiKey,
3242
+ staleTime: 5 * 6e4,
3243
+ refetchOnWindowFocus: false
3244
+ });
3245
+ const { tokens, chainFilters } = useMemo7(() => {
3246
+ if (!data) {
3247
+ return { tokens: [], chainFilters: [{ id: "all", label: "All" }] };
3248
+ }
3249
+ const resolved = resolveTokenTransferConfig({
3250
+ chainConfigs: tokenTransferConfig.chains ?? [],
3251
+ priorityTokens: tokenTransferConfig.priorityTokens ?? [],
3252
+ disabledChainAssets,
3253
+ supportedAssets: data,
3254
+ logger
3255
+ });
3256
+ const built = buildSupportedTokenList(resolved);
3257
+ const isEnabled = (chainId) => chainId == null || isTransferChainEnabled(chainId, transferInit);
3258
+ return {
3259
+ tokens: built.tokens.filter((t) => isEnabled(t.chainId)),
3260
+ chainFilters: built.chainFilters.filter(
3261
+ (c) => c.id === "all" || isEnabled(Number(c.id))
3262
+ )
3263
+ };
3264
+ }, [data, tokenTransferConfig, disabledChainAssets, transferInit]);
3265
+ return { tokens, chainFilters, isLoading };
3266
+ }
3267
+
3268
+ // src/transfer/hooks/useTokenTransfer.ts
3269
+ import { bitcoinChain as bitcoinChain2, solanaChain as solanaChain3, tronChain as tronChain2 } from "@funkit/chains";
3270
+ import {
3271
+ getDepositAddressForChain as getDepositAddressForChain2,
3272
+ getMinTransferValueForChain as getMinTransferValueForChain2,
3273
+ getTransferTokenQrCodeUri,
3274
+ useDynamicConfig as useDynamicConfig5
3275
+ } from "@funkit/connect-core";
3276
+ var DEFAULT_MAX_SLIPPAGE_PERCENT = 0.25;
3277
+ function resolveBlockchain(chainId) {
3278
+ if (chainId === solanaChain3.id) {
3279
+ return "solana";
3280
+ }
3281
+ if (chainId === bitcoinChain2.id) {
3282
+ return "bitcoin";
3283
+ }
3284
+ if (chainId === tronChain2.id) {
3285
+ return "tron";
3286
+ }
3287
+ return "ethereum";
3288
+ }
3289
+ function useTokenTransfer({
3290
+ checkoutConfig,
3291
+ selectedChainId,
3292
+ dynamicRoutingId,
3293
+ enabled
3294
+ }) {
3295
+ const { transferInit, recipientAddr, isLoading } = useTransferInit({
3296
+ checkoutConfig,
3297
+ dynamicRoutingId,
3298
+ enabled
3299
+ });
3300
+ const minTransferLimits = useDynamicConfig5("mintokentransfervalue");
3301
+ const minTransferUsd = selectedChainId !== void 0 ? Math.ceil(
3302
+ getMinTransferValueForChain2(selectedChainId, minTransferLimits)
3303
+ ) : 0;
3304
+ const depositAddress = selectedChainId !== void 0 ? getDepositAddressForChain2(selectedChainId, transferInit) : void 0;
3305
+ const blockchain = resolveBlockchain(selectedChainId);
3306
+ const qrCodeUri = depositAddress ? getTransferTokenQrCodeUri({ depositAddress, type: blockchain }) : void 0;
3307
+ return {
3308
+ depositAddress,
3309
+ transferInit,
3310
+ recipientAddr,
3311
+ minTransferUsd,
3312
+ maxSlippagePercent: DEFAULT_MAX_SLIPPAGE_PERCENT,
3313
+ qrCodeUri,
3314
+ blockchain,
3315
+ isLoading
3316
+ };
3317
+ }
3318
+
3319
+ // src/transfer/QrCode.tsx
3320
+ import QRCode from "react-native-qrcode-svg";
3321
+ import { jsx as jsx19 } from "react/jsx-runtime";
3322
+ function QrCode({ value, size = 220, ecl = "H" }) {
3323
+ return /* @__PURE__ */ jsx19(
3324
+ QRCode,
3325
+ {
3326
+ value,
3327
+ size,
3328
+ ecl,
3329
+ color: "#101010",
3330
+ backgroundColor: "#FFFFFF"
3331
+ }
3332
+ );
3333
+ }
3334
+
3335
+ // src/flow/depositFlowConfig.ts
3336
+ function getDefaultDynamicTargetAsset(candidates, dynamicRoutingId) {
3337
+ if (!candidates?.length) return void 0;
3338
+ if (candidates.length === 1) return candidates[0];
3339
+ const routingId = dynamicRoutingId ?? "";
3340
+ return candidates.find((c) => c.dynamicRoutingId === routingId) ?? candidates.find((c) => c.isDefault) ?? candidates[0];
3341
+ }
3342
+
3343
+ // src/flow/FlowSheet.tsx
3344
+ import {
3345
+ useCallback as useCallback4,
3346
+ useEffect as useEffect10,
3347
+ useRef as useRef5
3348
+ } from "react";
3349
+ import { View as View2 } from "react-native";
3350
+ import {
3351
+ BottomSheetBackdrop,
3352
+ BottomSheetModal,
3353
+ BottomSheetModalProvider,
3354
+ BottomSheetView,
3355
+ useBottomSheetTimingConfigs
3356
+ } from "@gorhom/bottom-sheet";
3357
+ import { Easing as Easing4 } from "react-native-reanimated";
3358
+
3359
+ // src/flow/useKeyboardHeight.ts
3360
+ import { useEffect as useEffect9, useState as useState8 } from "react";
3361
+ import { Keyboard, Platform } from "react-native";
3362
+ function useKeyboardHeight(enabled) {
3363
+ const [height, setHeight] = useState8(0);
3364
+ useEffect9(() => {
3365
+ if (!enabled) {
3366
+ setHeight(0);
3367
+ return;
3368
+ }
3369
+ const showEvent = Platform.OS === "ios" ? "keyboardWillShow" : "keyboardDidShow";
3370
+ const hideEvent = Platform.OS === "ios" ? "keyboardWillHide" : "keyboardDidHide";
3371
+ const show = Keyboard.addListener(
3372
+ showEvent,
3373
+ (e) => setHeight(e.endCoordinates.height)
3374
+ );
3375
+ const hide = Keyboard.addListener(hideEvent, () => setHeight(0));
3376
+ return () => {
3377
+ show.remove();
3378
+ hide.remove();
3379
+ };
3380
+ }, [enabled]);
3381
+ return height;
3382
+ }
3383
+
3384
+ // src/flow/FlowSheet.tsx
3385
+ import { jsx as jsx20, jsxs as jsxs10 } from "react/jsx-runtime";
3386
+ function FlowSheet({
3387
+ isOpen,
3388
+ session,
3389
+ onClose,
3390
+ content: content4,
3391
+ children,
3392
+ keyboardAvoidEnabled = false
3393
+ }) {
3394
+ const ref = useRef5(null);
3395
+ const setRef = useCallback4((instance) => {
3396
+ ref.current = instance;
3397
+ }, []);
3398
+ const keyboardHeight = useKeyboardHeight(keyboardAvoidEnabled);
3399
+ const hasPresented = useRef5(false);
3400
+ const sheetSelfDismissed = useRef5(false);
3401
+ useEffect10(() => {
3402
+ if (isOpen) {
3403
+ sheetSelfDismissed.current = false;
3404
+ ref.current?.present();
3405
+ hasPresented.current = true;
3406
+ return;
3407
+ }
3408
+ if (!hasPresented.current) return;
3409
+ hasPresented.current = false;
3410
+ if (sheetSelfDismissed.current) {
3411
+ sheetSelfDismissed.current = false;
3412
+ return;
3413
+ }
3414
+ ref.current?.dismiss();
3415
+ }, [isOpen, session]);
3416
+ const handleDismiss = useCallback4(() => {
3417
+ sheetSelfDismissed.current = true;
3418
+ onClose();
3419
+ }, [onClose]);
3420
+ const animationConfigs = useBottomSheetTimingConfigs({
3421
+ duration: 300,
3422
+ easing: Easing4.bezier(0.22, 1, 0.36, 1)
3423
+ });
3424
+ const renderBackdrop = useCallback4(
3425
+ (props) => /* @__PURE__ */ jsx20(
3426
+ BottomSheetBackdrop,
3427
+ {
3428
+ ...props,
3429
+ appearsOnIndex: 0,
3430
+ disappearsOnIndex: -1,
3431
+ pressBehavior: "close"
3432
+ }
3433
+ ),
3434
+ []
3435
+ );
3436
+ return /* @__PURE__ */ jsxs10(BottomSheetModalProvider, { children: [
3437
+ children,
3438
+ /* @__PURE__ */ jsx20(
3439
+ BottomSheetModal,
3440
+ {
3441
+ ref: setRef,
3442
+ enableDynamicSizing: true,
3443
+ keyboardBehavior: "extend",
3444
+ enableOverDrag: keyboardHeight === 0,
3445
+ animationConfigs,
3446
+ onDismiss: handleDismiss,
3447
+ backdropComponent: renderBackdrop,
3448
+ handleComponent: null,
3449
+ backgroundComponent: FlowSheetBackground,
3450
+ children: /* @__PURE__ */ jsxs10(BottomSheetView, { children: [
3451
+ content4,
3452
+ keyboardHeight > 0 ? /* @__PURE__ */ jsx20(View2, { style: { height: keyboardHeight } }) : null
3453
+ ] })
3454
+ }
3455
+ )
3456
+ ] });
3457
+ }
3458
+ function FlowSheetBackground({
3459
+ pointerEvents,
3460
+ style
3461
+ }) {
3462
+ const theme = useTheme();
3463
+ const surface = {
3464
+ backgroundColor: theme.colors.bgModal,
3465
+ borderTopLeftRadius: theme.borderRadii.modal,
3466
+ borderTopRightRadius: theme.borderRadii.modal
3467
+ };
3468
+ const extension = {
3469
+ ...bottomExtension,
3470
+ backgroundColor: theme.colors.bgModal
3471
+ };
3472
+ return /* @__PURE__ */ jsx20(View2, { pointerEvents, style: [style, surface], children: /* @__PURE__ */ jsx20(View2, { style: extension }) });
3473
+ }
3474
+ var bottomExtension = {
3475
+ position: "absolute",
3476
+ top: "100%",
3477
+ left: 0,
3478
+ right: 0,
3479
+ height: 1e3
3480
+ };
3481
+
3482
+ // src/flow/FunkitFlowProvider.tsx
3483
+ import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
3484
+ var CLOSED = {
3485
+ isOpen: false,
3486
+ stack: [],
3487
+ config: null,
3488
+ callbacks: {},
3489
+ session: 0
3490
+ };
3491
+ var FunkitFlowContext = createContext3(null);
3492
+ function FunkitFlowProvider({
3493
+ children,
3494
+ copyToClipboard: copyToClipboard2 = copyToClipboard
3495
+ }) {
3496
+ const [state, setState] = useState9(CLOSED);
3497
+ const beginDeposit = useCallback5(
3498
+ (config, callbacks = {}) => {
3499
+ callbacks.onOpen?.();
3500
+ setState((prev) => ({
3501
+ isOpen: true,
3502
+ stack: ["addMoney"],
3503
+ config,
3504
+ callbacks,
3505
+ session: prev.session + 1
3506
+ }));
3507
+ },
3508
+ []
3509
+ );
3510
+ const clearToast = useCallback5(() => {
3511
+ if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
3512
+ if (unmountTimerRef.current) clearTimeout(unmountTimerRef.current);
3513
+ setCopiedToastShown(false);
3514
+ setToastMounted(false);
3515
+ }, []);
3516
+ const closeFlow = useCallback5(() => {
3517
+ setState((prev) => {
3518
+ if (!prev.isOpen) return prev;
3519
+ prev.callbacks.onClose?.();
3520
+ return CLOSED;
3521
+ });
3522
+ clearToast();
3523
+ }, [clearToast]);
3524
+ const navigate = useCallback5((screen) => {
3525
+ setState((prev) => ({ ...prev, stack: [...prev.stack, screen] }));
3526
+ }, []);
3527
+ const back = useCallback5(() => {
3528
+ setState((prev) => {
3529
+ if (!prev.isOpen) return prev;
3530
+ if (prev.stack.length <= 1) {
3531
+ prev.callbacks.onClose?.();
3532
+ return CLOSED;
3533
+ }
3534
+ return { ...prev, stack: prev.stack.slice(0, -1) };
3535
+ });
3536
+ }, []);
3537
+ const value = useMemo8(
3538
+ () => ({ beginDeposit, closeFlow }),
3539
+ [beginDeposit, closeFlow]
3540
+ );
3541
+ const current = state.stack[state.stack.length - 1];
3542
+ const nav = useMemo8(
3543
+ () => ({ navigate, back, closeFlow }),
3544
+ [navigate, back, closeFlow]
3545
+ );
3546
+ const [toastMounted, setToastMounted] = useState9(false);
3547
+ const [copiedToastShown, setCopiedToastShown] = useState9(false);
3548
+ const hideTimerRef = useRef6(
3549
+ void 0
3550
+ );
3551
+ const unmountTimerRef = useRef6(
3552
+ void 0
3553
+ );
3554
+ const showCopiedToast = useCallback5(() => {
3555
+ if (hideTimerRef.current) clearTimeout(hideTimerRef.current);
3556
+ if (unmountTimerRef.current) clearTimeout(unmountTimerRef.current);
3557
+ setToastMounted(true);
3558
+ setCopiedToastShown(true);
3559
+ hideTimerRef.current = setTimeout(() => {
3560
+ setCopiedToastShown(false);
3561
+ unmountTimerRef.current = setTimeout(
3562
+ () => setToastMounted(false),
3563
+ TOAST_EXIT_MS
3564
+ );
3565
+ }, TOAST_VISIBLE_MS);
3566
+ }, []);
3567
+ useEffect11(() => () => clearToast(), [clearToast]);
3568
+ return /* @__PURE__ */ jsx21(FunkitFlowContext.Provider, { value, children: /* @__PURE__ */ jsxs11(View3, { style: rootContainer, children: [
3569
+ /* @__PURE__ */ jsx21(
3570
+ FlowSheet,
3571
+ {
3572
+ isOpen: state.isOpen,
3573
+ session: state.session,
3574
+ onClose: closeFlow,
3575
+ keyboardAvoidEnabled: current === "swapped",
3576
+ content: (
3577
+ // Mounted only while open so the transfer query runs only then.
3578
+ state.isOpen && state.config ? /* @__PURE__ */ jsx21(
3579
+ FlowContent,
3580
+ {
3581
+ config: state.config,
3582
+ current,
3583
+ nav,
3584
+ copyToClipboard: copyToClipboard2,
3585
+ onCopySuccess: showCopiedToast,
3586
+ callbacks: state.callbacks
3587
+ }
3588
+ ) : null
3589
+ ),
3590
+ children
3591
+ }
3592
+ ),
3593
+ toastMounted ? /* @__PURE__ */ jsx21(View3, { style: screenTopOverlay, pointerEvents: "none", children: copiedToastShown ? /* @__PURE__ */ jsx21(AddressCopiedToast, {}) : null }) : null
3594
+ ] }) });
3595
+ }
3596
+ var DEFAULT_EVM_CHAIN_ID = 1;
3597
+ var CRYPTO_METHOD_ID = "crypto";
3598
+ function resolveSelectedChainId(selectedNetworkId, initialChainId, evmRepresentativeChainId) {
3599
+ if (selectedNetworkId == null) return initialChainId;
3600
+ if (selectedNetworkId === EVM_NETWORK_ID) return evmRepresentativeChainId;
3601
+ const id = Number(selectedNetworkId);
3602
+ return Number.isFinite(id) ? id : initialChainId;
3603
+ }
3604
+ function FlowContent({
3605
+ config,
3606
+ current,
3607
+ nav,
3608
+ copyToClipboard: copyToClipboard2,
3609
+ onCopySuccess,
3610
+ callbacks
3611
+ }) {
3612
+ const { isGeoblocked, isLoadingGeoCheck } = useCheckoutBlocked({
3613
+ onCheckoutBlocked: callbacks.onCheckoutBlocked
3614
+ });
3615
+ const [selectedNetworkId, setSelectedNetworkId] = useState9();
3616
+ const [selectedCandidate, setSelectedCandidate] = useState9(
3617
+ () => getDefaultDynamicTargetAsset(
3618
+ config.dynamicTargetAssetCandidates,
3619
+ config.dynamicRoutingId
3620
+ )
3621
+ );
3622
+ const activeCheckoutConfig = selectedCandidate ? {
3623
+ ...config.checkoutConfig,
3624
+ targetChain: selectedCandidate.tokenChainId,
3625
+ targetAsset: selectedCandidate.tokenAddress
3626
+ } : config.checkoutConfig;
3627
+ const activeDynamicRoutingId = selectedCandidate?.dynamicRoutingId ?? config.dynamicRoutingId;
3628
+ const parsedSourceChain = config.sourceChain ? Number(config.sourceChain) : void 0;
3629
+ const initialChainId = parsedSourceChain != null && Number.isFinite(parsedSourceChain) ? parsedSourceChain : void 0;
3630
+ const evmRepresentativeChainId = initialChainId != null && !isNonEvmChainId(initialChainId) ? initialChainId : DEFAULT_EVM_CHAIN_ID;
3631
+ const selectedChainId = resolveSelectedChainId(
3632
+ selectedNetworkId,
3633
+ initialChainId,
3634
+ evmRepresentativeChainId
3635
+ );
3636
+ const {
3637
+ depositAddress: generatedAddress,
3638
+ qrCodeUri,
3639
+ transferInit,
3640
+ isLoading: isAddressLoading
3641
+ } = useTokenTransfer({
3642
+ checkoutConfig: activeCheckoutConfig,
3643
+ selectedChainId,
3644
+ dynamicRoutingId: activeDynamicRoutingId,
3645
+ enabled: true
3646
+ });
3647
+ const fetched = useSupportedTokens({ transferInit });
3648
+ const tokenChainFilters = config.tokenChainFilters ?? fetched.chainFilters;
3649
+ const depositNetworks = useMemo8(
3650
+ () => buildDepositNetworks(tokenChainFilters),
3651
+ [tokenChainFilters]
3652
+ );
3653
+ const initialNetwork = initialChainId == null ? void 0 : depositNetworks.find(
3654
+ (n) => n.chainId != null && belongsToNetwork(initialChainId, n.chainId)
3655
+ );
3656
+ const selectedChain = depositNetworks.find((n) => n.id === selectedNetworkId) ?? initialNetwork ?? depositNetworks[0];
3657
+ const minTransferLimits = useDynamicConfig6("mintokentransfervalue");
3658
+ const {
3659
+ savedFops,
3660
+ genericFops,
3661
+ isSwappedEnabled,
3662
+ isLoading: isFopsLoading,
3663
+ isError: isFopsError,
3664
+ refetch: refetchFops
3665
+ } = useFops({
3666
+ checkoutConfig: activeCheckoutConfig,
3667
+ dynamicRoutingId: activeDynamicRoutingId
3668
+ });
3669
+ const [selectedSwappedUrl, setSelectedSwappedUrl] = useState9();
3670
+ const availableChains = buildAvailableChains({
3671
+ chainFilters: tokenChainFilters,
3672
+ networkChainId: selectedChainId,
3673
+ minTransferLimits,
3674
+ target: {
3675
+ targetChain: activeCheckoutConfig?.targetChain,
3676
+ targetAsset: activeCheckoutConfig?.targetAsset,
3677
+ dynamicRoutingId: activeDynamicRoutingId,
3678
+ getMinDepositUSD: config.checkoutConfig?.getMinDepositUSD
3679
+ }
3680
+ });
3681
+ const singleChain = availableChains.length === 1 ? availableChains[0] : void 0;
3682
+ const rawAddress = generatedAddress ?? config.depositAddress;
3683
+ const displayAddress = rawAddress ? formatDepositAddress(rawAddress) : "Generating\u2026";
3684
+ const copyAddressAndToast = useCallback5(
3685
+ async (value) => {
3686
+ const ok = await copyToClipboard2(value) !== false;
3687
+ if (ok) onCopySuccess();
3688
+ return ok;
3689
+ },
3690
+ [copyToClipboard2, onCopySuccess]
3691
+ );
3692
+ const screen = (() => {
3693
+ switch (current) {
3694
+ case "addMoney": {
3695
+ const cryptoSourceIcons = [
3696
+ ...new Set(depositNetworks.flatMap((n) => n.iconKeys ?? []))
3697
+ ];
3698
+ const cryptoMethod = [
3699
+ {
3700
+ id: CRYPTO_METHOD_ID,
3701
+ title: "Crypto",
3702
+ subtitle: "No limit",
3703
+ icon: /* @__PURE__ */ jsx21(CryptoBitcoinIcon, {}),
3704
+ trailing: cryptoSourceIcons.length ? /* @__PURE__ */ jsx21(
3705
+ SourceTokenCluster,
3706
+ {
3707
+ icons: cryptoSourceIcons,
3708
+ overflowMode: "plus"
3709
+ }
3710
+ ) : void 0
3711
+ }
3712
+ ];
3713
+ const toCashRows = (fops) => toFopRows(fops).map((row3) => ({
3714
+ id: row3.id,
3715
+ title: row3.name,
3716
+ subtitle: row3.subtitle,
3717
+ icon: /* @__PURE__ */ jsx21(FunIcon, { uri: row3.iconUri, fallbackUri: FALLBACK_ASSET_LOGO })
3718
+ }));
3719
+ const methods = isSwappedEnabled ? [
3720
+ ...toCashRows(savedFops),
3721
+ ...cryptoMethod,
3722
+ ...toCashRows(genericFops)
3723
+ ] : cryptoMethod;
3724
+ const candidates = config.dynamicTargetAssetCandidates;
3725
+ const receiveTokens = candidates?.map(
3726
+ (c, i) => ({
3727
+ id: String(i),
3728
+ label: c.badgeText ? `${c.tokenSymbol} (${c.badgeText})` : c.tokenSymbol,
3729
+ icon: /* @__PURE__ */ jsx21(TokenChainIcon, { symbol: c.tokenSymbol, iconSrc: c.iconSrc })
3730
+ })
3731
+ );
3732
+ const selectedReceiveTokenId = selectedCandidate && candidates ? String(candidates.indexOf(selectedCandidate)) : void 0;
3733
+ return /* @__PURE__ */ jsx21(
3734
+ AddMoneyScreen,
3735
+ {
3736
+ methods,
3737
+ receiveTokens,
3738
+ selectedReceiveTokenId,
3739
+ onSelectReceiveToken: (id) => {
3740
+ const picked = candidates?.[Number(id)];
3741
+ if (picked) {
3742
+ setSelectedCandidate(picked);
3743
+ }
3744
+ },
3745
+ loading: isLoadingGeoCheck || isAddressLoading || isSwappedEnabled && isFopsLoading,
3746
+ error: isSwappedEnabled && isFopsError,
3747
+ onRetry: refetchFops,
3748
+ onSelectMethod: (id) => {
3749
+ if (id === CRYPTO_METHOD_ID) {
3750
+ nav.navigate("transfer");
3751
+ return;
3752
+ }
3753
+ if (id.includes(":")) {
3754
+ const fop = [...savedFops, ...genericFops].find(
3755
+ (f) => `${f.fopType}:${f.name}` === id
3756
+ );
3757
+ if (fop?.embeddedFlowUrl) {
3758
+ setSelectedSwappedUrl(fop.embeddedFlowUrl);
3759
+ nav.navigate("swapped");
3760
+ }
3761
+ return;
3762
+ }
3763
+ }
3764
+ }
3765
+ );
3766
+ }
3767
+ case "transfer": {
3768
+ const networks = depositNetworks.map((chain) => ({
3769
+ id: chain.id,
3770
+ label: chain.label,
3771
+ iconKeys: chain.iconKeys ?? []
3772
+ }));
3773
+ return /* @__PURE__ */ jsx21(
3774
+ TransferCryptoScreen,
3775
+ {
3776
+ depositAddress: displayAddress,
3777
+ networks,
3778
+ selectedNetworkId: selectedChain?.id ?? networks[0]?.id ?? "",
3779
+ onSelectNetwork: setSelectedNetworkId,
3780
+ supportedTokenIcons: singleChain ? void 0 : availableChains.length ? availableChains.map((c) => c.iconUri) : selectedChain?.iconKeys ?? [],
3781
+ minimumDepositLabel: singleChain?.minLabel,
3782
+ onBack: nav.back,
3783
+ onShowChains: availableChains.length > 1 ? () => nav.navigate("availableChains") : void 0,
3784
+ onShowQrCode: () => nav.navigate("qrCode"),
3785
+ onCopyAddress: rawAddress ? () => void copyAddressAndToast(rawAddress) : void 0,
3786
+ onShareAddress: rawAddress ? () => void Share.share({ message: rawAddress }) : void 0
3787
+ }
3788
+ );
3789
+ }
3790
+ case "availableChains":
3791
+ return /* @__PURE__ */ jsx21(
3792
+ AvailableChainsScreen,
3793
+ {
3794
+ networkLabel: selectedChain?.label ?? "",
3795
+ chains: availableChains,
3796
+ onClose: nav.back
3797
+ }
3798
+ );
3799
+ case "qrCode":
3800
+ return /* @__PURE__ */ jsx21(
3801
+ QrCodeScreen,
3802
+ {
3803
+ qrCode: config.qrCode ?? (qrCodeUri ? /* @__PURE__ */ jsx21(QrCode, { value: qrCodeUri, size: 235 }) : null),
3804
+ centerIcon: /* @__PURE__ */ jsx21(QrChainCluster, { iconKeys: selectedChain?.iconKeys ?? [] }),
3805
+ address: rawAddress,
3806
+ onCopyAddress: rawAddress ? () => copyAddressAndToast(rawAddress) : void 0,
3807
+ onClose: nav.back
3808
+ }
3809
+ );
3810
+ case "swapped":
3811
+ return selectedSwappedUrl ? /* @__PURE__ */ jsx21(
3812
+ SwappedScreen,
3813
+ {
3814
+ url: selectedSwappedUrl,
3815
+ onBack: nav.back,
3816
+ onClose: nav.closeFlow
3817
+ }
3818
+ ) : null;
3819
+ default:
3820
+ return null;
3821
+ }
3822
+ })();
3823
+ if (isGeoblocked) {
3824
+ return /* @__PURE__ */ jsx21(CheckoutBlockedScreen, {});
3825
+ }
3826
+ return screen;
3827
+ }
3828
+ var TOAST_VISIBLE_MS = 1800;
3829
+ var TOAST_EXIT_MS = 350;
3830
+ var rootContainer = { flex: 1 };
3831
+ var screenTopOverlay = {
3832
+ ...StyleSheet3.absoluteFill,
3833
+ zIndex: 1,
3834
+ alignItems: "center",
3835
+ paddingTop: Platform2.select({
3836
+ ios: 60,
3837
+ android: (StatusBar?.currentHeight ?? 0) + 16,
3838
+ default: 16
3839
+ }) ?? 16
3840
+ };
3841
+ function useFunkitFlow() {
3842
+ const value = useContext3(FunkitFlowContext);
3843
+ if (value == null) {
3844
+ throw new Error("useFunkitFlow must be used within <FunkitProvider>");
3845
+ }
3846
+ return value;
3847
+ }
3848
+
3849
+ // src/version.ts
3850
+ var CONNECT_RN_VERSION = true ? "1.0.2" : "0.0.0-dev";
3851
+
3852
+ // src/providers/FunkitStatsigProvider.tsx
3853
+ import {
3854
+ LogEventCompressionMode,
3855
+ LogLevel,
3856
+ StatsigProvider
3857
+ } from "@statsig/react-bindings";
3858
+ import { useMemo as useMemo9 } from "react";
3859
+
3860
+ // src/statsig/useClientAsyncInitRN.ts
3861
+ import {
3862
+ useStatsigInternalClientFactoryAsync
3863
+ } from "@statsig/react-bindings";
3864
+
3865
+ // src/statsig/StatsigClientRN.ts
3866
+ import {
3867
+ StatsigClient
3868
+ } from "@statsig/react-bindings";
3869
+
3870
+ // src/statsig/rnSetup.ts
3871
+ import {
3872
+ SDKType,
3873
+ StatsigMetadataProvider
3874
+ } from "@statsig/react-bindings";
3875
+
3876
+ // src/statsig/appVisibilityShim.ts
3877
+ import { _notifyVisibilityChanged } from "@statsig/react-bindings";
3878
+ import { AppState } from "react-native";
3879
+ var isApplied = false;
3880
+ function applyAppStateVisibilityShim() {
3881
+ if (isApplied) {
3882
+ return;
3883
+ }
3884
+ isApplied = true;
3885
+ AppState.addEventListener(
3886
+ "change",
3887
+ (nextAppState) => _notifyVisibilityChanged(
3888
+ nextAppState === "active" ? "foreground" : "background"
3889
+ )
3890
+ );
3891
+ }
3892
+
3893
+ // src/statsig/preloadedAsyncStorage.ts
3894
+ import AsyncStorage from "@react-native-async-storage/async-storage";
3895
+ import { Log } from "@statsig/react-bindings";
3896
+ var NOT_READY_ERROR = "Attempting to alter AsyncStorage before it is ready. Values will not be persisted.";
3897
+ function createPreloadedAsyncStorage() {
3898
+ const inMemoryStore = {};
3899
+ let isResolved = false;
3900
+ let readyPromise = null;
3901
+ const enforceIsResolved = () => {
3902
+ if (!isResolved) {
3903
+ Log.error(NOT_READY_ERROR);
3904
+ }
3905
+ return isResolved;
3906
+ };
3907
+ const provider = {
3908
+ getProviderName: () => "AsyncStorage",
3909
+ isReady: () => isResolved,
3910
+ isReadyResolver: () => {
3911
+ if (!readyPromise) {
3912
+ readyPromise = prefetchFromAsyncStorage(inMemoryStore).finally(() => {
3913
+ isResolved = true;
3914
+ });
3915
+ }
3916
+ return readyPromise;
3917
+ },
3918
+ getItem: (key) => {
3919
+ if (!enforceIsResolved()) {
3920
+ return null;
3921
+ }
3922
+ return inMemoryStore[key] ?? null;
3923
+ },
3924
+ setItem: (key, value) => {
3925
+ inMemoryStore[key] = value;
3926
+ if (!enforceIsResolved()) {
3927
+ return;
3928
+ }
3929
+ AsyncStorage.setItem(key, value).catch(Log.error);
3930
+ },
3931
+ removeItem: (key) => {
3932
+ delete inMemoryStore[key];
3933
+ if (!enforceIsResolved()) {
3934
+ return;
3935
+ }
3936
+ AsyncStorage.removeItem(key).catch(Log.error);
3937
+ },
3938
+ getAllKeys: () => {
3939
+ if (!enforceIsResolved()) {
3940
+ return [];
3941
+ }
3942
+ return Object.keys(inMemoryStore);
3943
+ }
3944
+ };
3945
+ return provider;
3946
+ }
3947
+ async function prefetchFromAsyncStorage(inMemoryStore) {
3948
+ const keys = await AsyncStorage.getAllKeys();
3949
+ await Promise.all(
3950
+ keys.map(async (key) => {
3951
+ if (!key.startsWith("statsig.")) {
3952
+ return;
3953
+ }
3954
+ const cache = await AsyncStorage.getItem(key);
3955
+ if (!cache) {
3956
+ return;
3957
+ }
3958
+ inMemoryStore[key] = cache;
3959
+ })
3960
+ );
3961
+ }
3962
+
3963
+ // src/statsig/rnSetup.ts
3964
+ function setupStatsigForReactNative(statsigMetadataAdditions, options) {
3965
+ applyAppStateVisibilityShim();
3966
+ SDKType._setBindingType("rn");
3967
+ if (statsigMetadataAdditions) {
3968
+ StatsigMetadataProvider.add(statsigMetadataAdditions);
3969
+ }
3970
+ if (options.storageProvider == null) {
3971
+ options.storageProvider = createPreloadedAsyncStorage();
3972
+ }
3973
+ applyNetworkFix(options);
3974
+ }
3975
+ function applyNetworkFix(options) {
3976
+ if (options.networkConfig?.networkOverrideFunc != null) {
3977
+ return;
3978
+ }
3979
+ const networkOverrideFunc = (url, args) => {
3980
+ if (args.body != null && args.method === "POST") {
3981
+ args.headers = {
3982
+ "Content-Type": "application/json",
3983
+ ...args.headers
3984
+ };
3985
+ }
3986
+ return fetch(url, args);
3987
+ };
3988
+ options.networkConfig = {
3989
+ networkOverrideFunc,
3990
+ ...options.networkConfig
3991
+ };
3992
+ }
3993
+
3994
+ // src/statsig/statsigMetadata.ts
3995
+ import { NativeModules, Platform as Platform3 } from "react-native";
3996
+ function resolveLocale() {
3997
+ if (Platform3.OS === "android") {
3998
+ const i18nManager = NativeModules.I18nManager;
3999
+ return i18nManager?.localeIdentifier ?? void 0;
4000
+ }
4001
+ if (Platform3.OS === "ios") {
4002
+ const settings = NativeModules.SettingsManager?.settings;
4003
+ return settings?.AppLocale ?? settings?.AppleLanguages?.[0] ?? void 0;
4004
+ }
4005
+ return void 0;
4006
+ }
4007
+ function getStatsigMetadataAdditions() {
4008
+ return {
4009
+ // Device-info-derived fields are dropped (no react-native-device-info).
4010
+ appVersion: void 0,
4011
+ systemVersion: void 0,
4012
+ deviceModelName: void 0,
4013
+ deviceModel: void 0,
4014
+ // Available without any native module:
4015
+ systemName: Platform3.OS,
4016
+ locale: resolveLocale()
4017
+ };
4018
+ }
4019
+
4020
+ // src/statsig/StatsigClientRN.ts
4021
+ var StatsigClientRN = class extends StatsigClient {
4022
+ constructor(sdkKey, user, options = null) {
4023
+ const opts = options ?? {};
4024
+ setupStatsigForReactNative(getStatsigMetadataAdditions(), opts);
4025
+ super(sdkKey, user, opts);
4026
+ this.__isRnClient = true;
4027
+ }
4028
+ };
4029
+
4030
+ // src/statsig/useClientAsyncInitRN.ts
4031
+ function useClientAsyncInitRN(sdkKey, initialUser, statsigOptions = null) {
4032
+ return useStatsigInternalClientFactoryAsync(
4033
+ (args) => new StatsigClientRN(args.sdkKey, args.initialUser, args.statsigOptions),
4034
+ {
4035
+ sdkKey,
4036
+ initialUser,
4037
+ statsigOptions
4038
+ }
4039
+ );
4040
+ }
4041
+
4042
+ // src/providers/FunkitStatsigProvider.tsx
4043
+ import { jsx as jsx22 } from "react/jsx-runtime";
4044
+ var STATSIG_API = "https://data-api.fun.xyz/v1";
4045
+ var STATSIG_CLIENT_KEY = "client-UmFd8WIJljA7cLmZuDqs3X25M8sKd5WIQP4BSC2bRbM";
4046
+ function FunkitStatsigProvider({
4047
+ children,
4048
+ apiKey,
4049
+ userId,
4050
+ isDevelopment = false
4051
+ }) {
4052
+ const user = useMemo9(
4053
+ () => ({ userID: userId, customIDs: { apiKey } }),
4054
+ [userId, apiKey]
4055
+ );
4056
+ const { client } = useClientAsyncInitRN(STATSIG_CLIENT_KEY, user, {
4057
+ networkConfig: {
4058
+ api: STATSIG_API,
4059
+ // default timeout (10s) is too large; statsig usually responds <200ms
4060
+ networkTimeoutMs: 5e3
4061
+ },
4062
+ // Our proxy supports compression; force it on to save bandwidth.
4063
+ logEventCompressionMode: LogEventCompressionMode.Forced,
4064
+ // Silence harmless warnings from hooks running before async init (we have
4065
+ // bootstrap fallbacks).
4066
+ logLevel: isDevelopment ? void 0 : LogLevel.Error,
4067
+ environment: {
4068
+ tier: isDevelopment ? "development" : "production"
4069
+ }
4070
+ });
4071
+ return /* @__PURE__ */ jsx22(StatsigProvider, { client, children });
4072
+ }
4073
+
4074
+ // src/providers/FunkitProvider.tsx
4075
+ import { jsx as jsx23 } from "react/jsx-runtime";
4076
+ var ANONYMOUS_CONFIG = { apiKey: "" };
4077
+ function FunkitProvider({
4078
+ children,
4079
+ config,
4080
+ walletAddress,
4081
+ queryClient,
4082
+ themes,
4083
+ colorScheme,
4084
+ debug = false,
4085
+ copyToClipboard: copyToClipboard2
4086
+ }) {
4087
+ const fallbackClient = useRef7(void 0);
4088
+ fallbackClient.current ??= new QueryClient();
4089
+ const client = queryClient ?? fallbackClient.current;
4090
+ const identity = useMemo10(
4091
+ () => resolveFunkitIdentity(config ?? ANONYMOUS_CONFIG, walletAddress),
4092
+ [config, walletAddress]
4093
+ );
4094
+ useEffect12(() => {
4095
+ if (!config?.apiKey) {
4096
+ return;
4097
+ }
4098
+ logger.configure(config.apiKey, debug, CONNECT_RN_VERSION);
4099
+ }, [config?.apiKey, debug]);
4100
+ useEffect12(() => {
4101
+ logger.setUserInfo(
4102
+ identity.userId,
4103
+ identity.walletAddress,
4104
+ "",
4105
+ identity.loginType ?? "",
4106
+ ""
4107
+ );
4108
+ }, [identity]);
4109
+ return /* @__PURE__ */ jsx23(
4110
+ FunkitStatsigProvider,
4111
+ {
4112
+ apiKey: identity.apiKey,
4113
+ userId: identity.userId,
4114
+ isDevelopment: debug,
4115
+ children: /* @__PURE__ */ jsx23(QueryClientProvider, { client, children: /* @__PURE__ */ jsx23(FunkitIdentityProvider, { identity, children: /* @__PURE__ */ jsx23(FunkitThemeProvider, { themes, colorScheme, children: /* @__PURE__ */ jsx23(FunkitFlowProvider, { copyToClipboard: copyToClipboard2, children }) }) }) })
4116
+ }
4117
+ );
4118
+ }
4119
+
4120
+ // src/providers/useFunkitCheckout.ts
4121
+ import { useCallback as useCallback6 } from "react";
4122
+ function useFunkitCheckout(callbacks = {}) {
4123
+ const { beginDeposit: begin } = useFunkitFlow();
4124
+ const beginDeposit = useCallback6(
4125
+ (config) => begin(config, callbacks),
4126
+ [begin, callbacks]
4127
+ );
4128
+ return { beginDeposit };
4129
+ }
1147
4130
  export {
1148
- AddMoneyScreen,
4131
+ AddressCopiedToast,
1149
4132
  Box,
1150
4133
  FunkitProvider,
1151
4134
  FunkitThemeProvider,
1152
- QrCodeScreen,
1153
4135
  Text,
1154
- TransferCryptoScreen,
1155
4136
  darkTokens,
1156
4137
  defaultDarkTheme,
1157
4138
  defaultLightTheme,
4139
+ fontFamilyForWeight,
1158
4140
  lightTokens,
1159
4141
  normalizeColorScheme,
1160
4142
  resolveColorScheme,
1161
4143
  toRestyleTheme,
1162
4144
  useColorScheme,
4145
+ useFunkitCheckout,
1163
4146
  useFunkitColorScheme,
1164
4147
  useFunkitTheme
1165
4148
  };