@funkit/connect-rn 0.2.0-next.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -0
- package/dist/index.d.ts +9 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2622 -1167
- package/dist/index.js.map +4 -4
- package/dist/src/flow/AddressCopiedToast.d.ts +18 -0
- package/dist/src/flow/AddressCopiedToast.d.ts.map +1 -0
- package/dist/src/flow/FlowSheet.d.ts +47 -0
- package/dist/src/flow/FlowSheet.d.ts.map +1 -0
- package/dist/src/flow/FunkitFlowProvider.d.ts +5 -2
- package/dist/src/flow/FunkitFlowProvider.d.ts.map +1 -1
- package/dist/src/flow/depositFlowConfig.d.ts +57 -26
- package/dist/src/flow/depositFlowConfig.d.ts.map +1 -1
- package/dist/src/flow/useKeyboardHeight.d.ts +21 -0
- package/dist/src/flow/useKeyboardHeight.d.ts.map +1 -0
- package/dist/src/geo/isCountryBlocked.d.ts +3 -0
- package/dist/src/geo/isCountryBlocked.d.ts.map +1 -0
- package/dist/src/geo/useCheckoutBlocked.d.ts +10 -0
- package/dist/src/geo/useCheckoutBlocked.d.ts.map +1 -0
- package/dist/src/icons/CopyAddressIcon.d.ts +9 -0
- package/dist/src/icons/CopyAddressIcon.d.ts.map +1 -0
- package/dist/src/icons/CryptoBitcoinIcon.d.ts +9 -0
- package/dist/src/icons/CryptoBitcoinIcon.d.ts.map +1 -0
- package/dist/src/icons/CryptoTransferQRIcon.d.ts +9 -0
- package/dist/src/icons/CryptoTransferQRIcon.d.ts.map +1 -0
- package/dist/src/icons/FigmaSystemIcons.d.ts +19 -0
- package/dist/src/icons/FigmaSystemIcons.d.ts.map +1 -0
- package/dist/src/icons/FunIcon.d.ts +1 -1
- package/dist/src/icons/FunIcon.d.ts.map +1 -1
- package/dist/src/icons/PaymentBrandIcons.d.ts +24 -0
- package/dist/src/icons/PaymentBrandIcons.d.ts.map +1 -0
- package/dist/src/icons/QrChainCluster.d.ts +22 -0
- package/dist/src/icons/QrChainCluster.d.ts.map +1 -0
- package/dist/src/icons/SourceTokenCluster.d.ts +31 -0
- package/dist/src/icons/SourceTokenCluster.d.ts.map +1 -0
- package/dist/src/icons/TokenChainIcon.d.ts +19 -0
- package/dist/src/icons/TokenChainIcon.d.ts.map +1 -0
- package/dist/src/identity/IdentityContext.d.ts +1 -1
- package/dist/src/identity/IdentityContext.d.ts.map +1 -1
- package/dist/src/logging/datadogHttpLogTransport.d.ts.map +1 -1
- package/dist/src/providers/FunkitProvider.d.ts +11 -1
- package/dist/src/providers/FunkitProvider.d.ts.map +1 -1
- package/dist/src/providers/FunkitStatsigProvider.d.ts +1 -1
- package/dist/src/providers/FunkitStatsigProvider.d.ts.map +1 -1
- package/dist/src/screens/AddMoneyScreen.d.ts +57 -2
- package/dist/src/screens/AddMoneyScreen.d.ts.map +1 -1
- package/dist/src/screens/AvailableChainsScreen.d.ts +33 -0
- package/dist/src/screens/AvailableChainsScreen.d.ts.map +1 -0
- package/dist/src/screens/CheckoutBlockedScreen.d.ts +2 -0
- package/dist/src/screens/CheckoutBlockedScreen.d.ts.map +1 -0
- package/dist/src/screens/NetworkSelector.d.ts +31 -0
- package/dist/src/screens/NetworkSelector.d.ts.map +1 -0
- package/dist/src/screens/QrCodeScreen.d.ts +30 -14
- package/dist/src/screens/QrCodeScreen.d.ts.map +1 -1
- package/dist/src/screens/TransferCryptoScreen.d.ts +25 -14
- package/dist/src/screens/TransferCryptoScreen.d.ts.map +1 -1
- package/dist/src/swapped/SwappedScreen.d.ts +1 -1
- package/dist/src/swapped/SwappedScreen.d.ts.map +1 -1
- package/dist/src/swapped/SwappedWebView.d.ts +2 -2
- package/dist/src/swapped/SwappedWebView.d.ts.map +1 -1
- package/dist/src/swapped/buildSwappedTheme.d.ts +31 -0
- package/dist/src/swapped/buildSwappedTheme.d.ts.map +1 -0
- package/dist/src/swapped/webViewSwappedTransport.d.ts +40 -13
- package/dist/src/swapped/webViewSwappedTransport.d.ts.map +1 -1
- package/dist/src/theme/FunkitThemeProvider.d.ts +1 -1
- package/dist/src/theme/FunkitThemeProvider.d.ts.map +1 -1
- package/dist/src/theme/restyle.d.ts +1010 -529
- package/dist/src/theme/restyle.d.ts.map +1 -1
- package/dist/src/theme/toRestyleTheme.d.ts +90 -48
- package/dist/src/theme/toRestyleTheme.d.ts.map +1 -1
- package/dist/src/theme/tokens.d.ts +52 -8
- package/dist/src/theme/tokens.d.ts.map +1 -1
- package/dist/src/transfer/QrCode.d.ts +12 -3
- package/dist/src/transfer/QrCode.d.ts.map +1 -1
- package/dist/src/transfer/availableChains.d.ts +53 -0
- package/dist/src/transfer/availableChains.d.ts.map +1 -0
- package/dist/src/transfer/clipboard.d.ts +16 -8
- package/dist/src/transfer/clipboard.d.ts.map +1 -1
- package/dist/src/transfer/hooks/useFops.d.ts +12 -3
- package/dist/src/transfer/hooks/useFops.d.ts.map +1 -1
- package/dist/src/transfer/hooks/useSupportedTokens.d.ts +1 -1
- package/dist/src/transfer/hooks/useSupportedTokens.d.ts.map +1 -1
- package/dist/src/transfer/supportedTokens.d.ts +20 -9
- package/dist/src/transfer/supportedTokens.d.ts.map +1 -1
- package/package.json +23 -4
- package/dist/src/icons/ChainClusterIcon.d.ts +0 -12
- package/dist/src/icons/ChainClusterIcon.d.ts.map +0 -1
- package/dist/src/providers/index.d.ts +0 -2
- package/dist/src/providers/index.d.ts.map +0 -1
- package/dist/src/screens/ChooseChainScreen.d.ts +0 -35
- package/dist/src/screens/ChooseChainScreen.d.ts.map +0 -1
- package/dist/src/screens/CryptoCashToggle.d.ts +0 -17
- package/dist/src/screens/CryptoCashToggle.d.ts.map +0 -1
- package/dist/src/screens/SupportedTokensScreen.d.ts +0 -44
- package/dist/src/screens/SupportedTokensScreen.d.ts.map +0 -1
- package/dist/src/theme/FunkitProvider.d.ts +0 -45
- package/dist/src/theme/FunkitProvider.d.ts.map +0 -1
- package/dist/src/theme/index.d.ts +0 -7
- package/dist/src/theme/index.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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
271
|
-
fontWeight: tokens.fontWeights.medium,
|
|
283
|
+
...medium,
|
|
272
284
|
fontSize: tokens.fontSizes.amountInput,
|
|
273
285
|
color: "textPrimary"
|
|
274
286
|
},
|
|
275
287
|
amountSummary: {
|
|
276
|
-
|
|
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
|
}
|
|
@@ -342,10 +362,143 @@ import {
|
|
|
342
362
|
createText,
|
|
343
363
|
useTheme as useRestyleTheme
|
|
344
364
|
} from "@shopify/restyle";
|
|
365
|
+
import {
|
|
366
|
+
createElement,
|
|
367
|
+
forwardRef
|
|
368
|
+
} from "react";
|
|
345
369
|
var Box = createBox();
|
|
346
|
-
var
|
|
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
|
+
);
|
|
347
382
|
var useTheme = () => useRestyleTheme();
|
|
348
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 });
|
|
501
|
+
|
|
349
502
|
// src/theme/FunkitThemeProvider.tsx
|
|
350
503
|
import { ThemeProvider } from "@shopify/restyle";
|
|
351
504
|
import {
|
|
@@ -355,7 +508,7 @@ import {
|
|
|
355
508
|
useMemo as useMemo2,
|
|
356
509
|
useState as useState2
|
|
357
510
|
} from "react";
|
|
358
|
-
import { jsx } from "react/jsx-runtime";
|
|
511
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
359
512
|
var DEFAULT_THEMES = {
|
|
360
513
|
light: defaultLightTheme,
|
|
361
514
|
dark: defaultDarkTheme
|
|
@@ -392,7 +545,7 @@ function FunkitThemeProvider({
|
|
|
392
545
|
() => ({ colorScheme: activeScheme, toggleColorScheme, isControlled }),
|
|
393
546
|
[activeScheme, toggleColorScheme, isControlled]
|
|
394
547
|
);
|
|
395
|
-
return /* @__PURE__ */
|
|
548
|
+
return /* @__PURE__ */ jsx3(FunkitColorSchemeContext.Provider, { value, children: /* @__PURE__ */ jsx3(ThemeProvider, { theme, children }) });
|
|
396
549
|
}
|
|
397
550
|
function useFunkitColorScheme() {
|
|
398
551
|
const value = useContext(FunkitColorSchemeContext);
|
|
@@ -404,139 +557,264 @@ function useFunkitColorScheme() {
|
|
|
404
557
|
|
|
405
558
|
// src/providers/FunkitProvider.tsx
|
|
406
559
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
407
|
-
import { useEffect as
|
|
560
|
+
import { useEffect as useEffect12, useMemo as useMemo10, useRef as useRef7 } from "react";
|
|
408
561
|
|
|
409
562
|
// src/flow/FunkitFlowProvider.tsx
|
|
563
|
+
import { useDynamicConfig as useDynamicConfig6 } from "@funkit/connect-core";
|
|
410
564
|
import {
|
|
411
565
|
createContext as createContext3,
|
|
412
|
-
useCallback as
|
|
566
|
+
useCallback as useCallback5,
|
|
413
567
|
useContext as useContext3,
|
|
414
|
-
|
|
415
|
-
|
|
568
|
+
useEffect as useEffect11,
|
|
569
|
+
useMemo as useMemo8,
|
|
570
|
+
useRef as useRef6,
|
|
571
|
+
useState as useState9
|
|
416
572
|
} from "react";
|
|
417
|
-
import {
|
|
573
|
+
import {
|
|
574
|
+
Platform as Platform2,
|
|
575
|
+
Share,
|
|
576
|
+
StatusBar,
|
|
577
|
+
StyleSheet as StyleSheet3,
|
|
578
|
+
View as View3
|
|
579
|
+
} from "react-native";
|
|
418
580
|
|
|
419
|
-
// src/
|
|
420
|
-
import { useEffect as useEffect2,
|
|
421
|
-
import {
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
581
|
+
// src/geo/useCheckoutBlocked.ts
|
|
582
|
+
import { useEffect as useEffect2, useMemo as useMemo3 } from "react";
|
|
583
|
+
import { useDynamicConfig, useEffectEvent } from "@funkit/connect-core";
|
|
584
|
+
|
|
585
|
+
// src/logging/logger.ts
|
|
586
|
+
import { FunLogger } from "@funkit/connect-core";
|
|
587
|
+
|
|
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`;
|
|
428
604
|
}
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
if (!width || !height) {
|
|
432
|
-
return svg;
|
|
605
|
+
setEnv(environment) {
|
|
606
|
+
this.env = environment;
|
|
433
607
|
}
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
const [xml, setXml] = useState3(
|
|
440
|
-
() => svgCache.get(currentUri) ?? null
|
|
441
|
-
);
|
|
442
|
-
const [rasterLoaded, setRasterLoaded] = useState3(false);
|
|
443
|
-
useEffect2(() => {
|
|
444
|
-
setCurrentUri(uri);
|
|
445
|
-
setRasterLoaded(false);
|
|
446
|
-
setXml(svgCache.get(uri) ?? null);
|
|
447
|
-
}, [uri]);
|
|
448
|
-
const onFailure = () => {
|
|
449
|
-
if (fallbackUri && currentUri !== fallbackUri) {
|
|
450
|
-
setCurrentUri(fallbackUri);
|
|
451
|
-
setRasterLoaded(false);
|
|
452
|
-
setXml(svgCache.get(fallbackUri) ?? null);
|
|
608
|
+
setTrackingConsent(consent) {
|
|
609
|
+
this.consent = consent;
|
|
610
|
+
if (consent !== "granted") {
|
|
611
|
+
this.queue = [];
|
|
612
|
+
this.clearTimer();
|
|
453
613
|
}
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
if (
|
|
614
|
+
}
|
|
615
|
+
log({ level, title, context, error }) {
|
|
616
|
+
if (this.consent !== "granted") {
|
|
457
617
|
return;
|
|
458
618
|
}
|
|
459
|
-
const
|
|
460
|
-
|
|
461
|
-
|
|
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();
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
/** Send the buffered batch. Fire-and-forget; network errors are swallowed. */
|
|
645
|
+
flush() {
|
|
646
|
+
this.clearTimer();
|
|
647
|
+
if (this.queue.length === 0) {
|
|
462
648
|
return;
|
|
463
649
|
}
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
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)
|
|
471
660
|
}).catch(() => {
|
|
472
|
-
if (active) {
|
|
473
|
-
onFailure();
|
|
474
|
-
}
|
|
475
661
|
});
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
const ready = isSvg ? xml != null : rasterLoaded;
|
|
481
|
-
const clip = { overflow: "hidden" };
|
|
482
|
-
return /* @__PURE__ */ jsx2(
|
|
483
|
-
Box,
|
|
484
|
-
{
|
|
485
|
-
width: size,
|
|
486
|
-
height: size,
|
|
487
|
-
borderRadius: "rounded",
|
|
488
|
-
backgroundColor: ready ? void 0 : "bgSecondary",
|
|
489
|
-
style: clip,
|
|
490
|
-
children: isSvg ? xml != null ? /* @__PURE__ */ jsx2(SvgXml, { xml, width: size, height: size }) : null : /* @__PURE__ */ jsx2(
|
|
491
|
-
Image,
|
|
492
|
-
{
|
|
493
|
-
source: { uri: currentUri },
|
|
494
|
-
style: { width: size, height: size },
|
|
495
|
-
onLoad: () => setRasterLoaded(true),
|
|
496
|
-
onError: onFailure
|
|
497
|
-
}
|
|
498
|
-
)
|
|
662
|
+
}
|
|
663
|
+
scheduleFlush() {
|
|
664
|
+
if (this.flushTimer != null) {
|
|
665
|
+
return;
|
|
499
666
|
}
|
|
500
|
-
|
|
667
|
+
this.flushTimer = setTimeout(() => {
|
|
668
|
+
this.flushTimer = null;
|
|
669
|
+
this.flush();
|
|
670
|
+
}, this.flushIntervalMs);
|
|
671
|
+
}
|
|
672
|
+
clearTimer() {
|
|
673
|
+
if (this.flushTimer != null) {
|
|
674
|
+
clearTimeout(this.flushTimer);
|
|
675
|
+
this.flushTimer = null;
|
|
676
|
+
}
|
|
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;
|
|
501
703
|
}
|
|
502
704
|
|
|
503
|
-
// src/
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
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);
|
|
717
|
+
}
|
|
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);
|
|
725
|
+
}
|
|
726
|
+
const data = await res.json();
|
|
727
|
+
return { alpha2: data.country_code, state: data.region_code };
|
|
728
|
+
}
|
|
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 };
|
|
755
|
+
}
|
|
756
|
+
|
|
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",
|
|
540
818
|
PYUSD: "https://sdk-cdn.fun.xyz/images/pyusd.svg",
|
|
541
819
|
QNT: "https://sdk-cdn.fun.xyz/images/qnt.svg",
|
|
542
820
|
RNDR: "https://sdk-cdn.fun.xyz/images/rndr.svg",
|
|
@@ -598,116 +876,792 @@ var ASSET_LOGO_SRCS = {
|
|
|
598
876
|
};
|
|
599
877
|
var FALLBACK_ASSET_LOGO = "https://sdk-cdn.fun.xyz/images/dollar_circle.png";
|
|
600
878
|
|
|
601
|
-
// src/icons/
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
var
|
|
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,
|
|
887
|
+
{
|
|
888
|
+
xml: CIRCLE_BITCOIN_SVG,
|
|
889
|
+
width: size,
|
|
890
|
+
height: size,
|
|
891
|
+
color: theme.colors.textPrimary
|
|
892
|
+
}
|
|
893
|
+
);
|
|
894
|
+
}
|
|
605
895
|
|
|
606
|
-
// src/icons/
|
|
607
|
-
import {
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
borderRadius: "rounded",
|
|
616
|
-
backgroundColor: "pillPressed"
|
|
617
|
-
}
|
|
618
|
-
);
|
|
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;
|
|
619
905
|
}
|
|
620
|
-
|
|
621
|
-
|
|
906
|
+
const width = svg.match(/\bwidth="([\d.]+)"/)?.[1];
|
|
907
|
+
const height = svg.match(/\bheight="([\d.]+)"/)?.[1];
|
|
908
|
+
if (!width || !height) {
|
|
909
|
+
return svg;
|
|
622
910
|
}
|
|
623
|
-
|
|
624
|
-
|
|
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(
|
|
625
968
|
Box,
|
|
626
969
|
{
|
|
627
970
|
width: size,
|
|
628
971
|
height: size,
|
|
629
972
|
borderRadius: "rounded",
|
|
630
|
-
backgroundColor: "
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
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
|
+
)
|
|
634
984
|
}
|
|
635
985
|
);
|
|
636
986
|
}
|
|
637
|
-
|
|
987
|
+
|
|
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
|
|
1126
|
+
}) {
|
|
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
|
+
] });
|
|
1156
|
+
}
|
|
1157
|
+
var badgeRing = (badge) => ({
|
|
1158
|
+
position: "absolute",
|
|
1159
|
+
right: -1,
|
|
1160
|
+
bottom: -1,
|
|
1161
|
+
width: badge + 2,
|
|
1162
|
+
height: badge + 2
|
|
1163
|
+
});
|
|
638
1164
|
|
|
639
1165
|
// src/screens/AddMoneyScreen.tsx
|
|
640
|
-
import {
|
|
641
|
-
import {
|
|
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";
|
|
642
1221
|
function AddMoneyScreen({
|
|
643
1222
|
methods,
|
|
644
1223
|
onSelectMethod,
|
|
645
|
-
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
|
|
646
1238
|
}) {
|
|
647
|
-
|
|
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(
|
|
648
1244
|
Box,
|
|
649
1245
|
{
|
|
650
1246
|
backgroundColor: "bgModal",
|
|
651
1247
|
borderTopLeftRadius: "modal",
|
|
652
1248
|
borderTopRightRadius: "modal",
|
|
653
1249
|
children: [
|
|
654
|
-
/* @__PURE__ */
|
|
655
|
-
/* @__PURE__ */
|
|
656
|
-
/* @__PURE__ */
|
|
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 })
|
|
657
1253
|
] }),
|
|
658
|
-
/* @__PURE__ */
|
|
659
|
-
|
|
1254
|
+
error ? /* @__PURE__ */ jsx9(
|
|
1255
|
+
AddMoneyError,
|
|
660
1256
|
{
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
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,
|
|
1275
|
+
{
|
|
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"
|
|
1348
|
+
}
|
|
1349
|
+
) : null
|
|
1350
|
+
]
|
|
1351
|
+
}
|
|
1352
|
+
);
|
|
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
|
+
}
|
|
1386
|
+
function PaymentMethodRow({ method }) {
|
|
1387
|
+
return /* @__PURE__ */ jsxs4(
|
|
1388
|
+
Box,
|
|
1389
|
+
{
|
|
1390
|
+
flexDirection: "row",
|
|
1391
|
+
alignItems: "center",
|
|
1392
|
+
gap: "elementsHorizontal",
|
|
1393
|
+
style: row,
|
|
1394
|
+
children: [
|
|
1395
|
+
/* @__PURE__ */ jsx9(
|
|
1396
|
+
Box,
|
|
1397
|
+
{
|
|
1398
|
+
width: 48,
|
|
1399
|
+
height: 48,
|
|
1400
|
+
borderRadius: "rounded",
|
|
1401
|
+
backgroundColor: "bgSecondary",
|
|
1402
|
+
alignItems: "center",
|
|
1403
|
+
justifyContent: "center",
|
|
1404
|
+
children: method.icon
|
|
1405
|
+
}
|
|
1406
|
+
),
|
|
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
|
|
1410
|
+
] }),
|
|
1411
|
+
method.trailing
|
|
1412
|
+
]
|
|
1413
|
+
}
|
|
1414
|
+
);
|
|
1415
|
+
}
|
|
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(
|
|
664
1478
|
Pressable,
|
|
665
1479
|
{
|
|
666
|
-
onPress: () =>
|
|
667
|
-
accessibilityRole: "
|
|
668
|
-
accessibilityLabel:
|
|
669
|
-
children: /* @__PURE__ */
|
|
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
|
+
)
|
|
670
1507
|
},
|
|
671
|
-
|
|
1508
|
+
token.id
|
|
672
1509
|
))
|
|
673
1510
|
}
|
|
674
1511
|
)
|
|
675
|
-
|
|
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"
|
|
676
1524
|
}
|
|
677
1525
|
);
|
|
678
1526
|
}
|
|
679
|
-
function
|
|
680
|
-
return /* @__PURE__ */
|
|
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(
|
|
681
1618
|
Box,
|
|
682
1619
|
{
|
|
683
1620
|
flexDirection: "row",
|
|
684
1621
|
alignItems: "center",
|
|
685
1622
|
gap: "elementsHorizontal",
|
|
686
|
-
|
|
687
|
-
style: row,
|
|
1623
|
+
style: skeletonRow,
|
|
688
1624
|
children: [
|
|
689
|
-
/* @__PURE__ */
|
|
1625
|
+
/* @__PURE__ */ jsx9(
|
|
690
1626
|
Box,
|
|
691
1627
|
{
|
|
692
1628
|
width: 48,
|
|
693
1629
|
height: 48,
|
|
694
1630
|
borderRadius: "rounded",
|
|
695
|
-
backgroundColor: "
|
|
696
|
-
alignItems: "center",
|
|
697
|
-
justifyContent: "center",
|
|
698
|
-
children: method.icon
|
|
1631
|
+
backgroundColor: "pillPressed"
|
|
699
1632
|
}
|
|
700
1633
|
),
|
|
701
|
-
/* @__PURE__ */
|
|
702
|
-
/* @__PURE__ */
|
|
703
|
-
|
|
704
|
-
] })
|
|
705
|
-
method.trailing
|
|
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
|
+
] })
|
|
706
1638
|
]
|
|
707
1639
|
}
|
|
708
1640
|
);
|
|
709
1641
|
}
|
|
710
|
-
|
|
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 };
|
|
711
1665
|
var grabber = {
|
|
712
1666
|
position: "absolute",
|
|
713
1667
|
top: 8,
|
|
@@ -717,560 +1671,710 @@ var grabber = {
|
|
|
717
1671
|
};
|
|
718
1672
|
var listContent = {
|
|
719
1673
|
paddingHorizontal: 16,
|
|
720
|
-
paddingBottom: 16
|
|
721
|
-
gap: 6
|
|
1674
|
+
paddingBottom: 16
|
|
722
1675
|
};
|
|
723
|
-
var row = {
|
|
1676
|
+
var row = { padding: 12 };
|
|
724
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
|
+
};
|
|
725
1745
|
|
|
726
|
-
// src/screens/
|
|
727
|
-
import {
|
|
728
|
-
|
|
729
|
-
|
|
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,
|
|
730
1755
|
chains,
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
1756
|
+
title = `Available ${networkLabel}`,
|
|
1757
|
+
loading = false,
|
|
1758
|
+
skeletonCount = 8,
|
|
1759
|
+
onClose
|
|
734
1760
|
}) {
|
|
735
|
-
|
|
1761
|
+
const { height } = useWindowDimensions();
|
|
1762
|
+
return /* @__PURE__ */ jsxs5(
|
|
736
1763
|
Box,
|
|
737
1764
|
{
|
|
738
1765
|
backgroundColor: "bgModal",
|
|
739
1766
|
borderTopLeftRadius: "modal",
|
|
740
1767
|
borderTopRightRadius: "modal",
|
|
1768
|
+
style: sheet,
|
|
741
1769
|
children: [
|
|
742
|
-
/* @__PURE__ */
|
|
743
|
-
/* @__PURE__ */
|
|
744
|
-
/* @__PURE__ */ jsx5(
|
|
1770
|
+
/* @__PURE__ */ jsxs5(Box, { flexDirection: "row", alignItems: "center", style: topBar2, children: [
|
|
1771
|
+
/* @__PURE__ */ jsx10(
|
|
745
1772
|
Pressable2,
|
|
746
1773
|
{
|
|
747
|
-
onPress:
|
|
1774
|
+
onPress: onClose,
|
|
748
1775
|
hitSlop: 12,
|
|
749
1776
|
accessibilityRole: "button",
|
|
750
|
-
accessibilityLabel: "
|
|
751
|
-
children: /* @__PURE__ */
|
|
1777
|
+
accessibilityLabel: "Close",
|
|
1778
|
+
children: /* @__PURE__ */ jsx10(Box, { alignItems: "center", justifyContent: "center", style: iconButton, children: /* @__PURE__ */ jsx10(FigmaCloseIcon, {}) })
|
|
752
1779
|
}
|
|
753
1780
|
),
|
|
754
|
-
/* @__PURE__ */
|
|
755
|
-
/* @__PURE__ */
|
|
1781
|
+
/* @__PURE__ */ jsx10(Box, { flex: 1, alignItems: "center", children: /* @__PURE__ */ jsx10(Text, { variant: "bodyMedium", color: "textPrimary", children: title }) }),
|
|
1782
|
+
/* @__PURE__ */ jsx10(Box, { style: topBarSpacer })
|
|
756
1783
|
] }),
|
|
757
|
-
/* @__PURE__ */
|
|
758
|
-
|
|
1784
|
+
/* @__PURE__ */ jsx10(
|
|
1785
|
+
ScrollView2,
|
|
759
1786
|
{
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
children: /* @__PURE__ */
|
|
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(
|
|
764
1791
|
Box,
|
|
765
1792
|
{
|
|
766
1793
|
flexDirection: "row",
|
|
767
1794
|
alignItems: "center",
|
|
768
|
-
gap: "elementsHorizontal",
|
|
769
|
-
borderRadius: "button",
|
|
770
1795
|
style: row2,
|
|
771
1796
|
children: [
|
|
772
|
-
|
|
773
|
-
|
|
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
|
|
774
1807
|
]
|
|
775
|
-
}
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
)
|
|
1808
|
+
},
|
|
1809
|
+
chain.id
|
|
1810
|
+
))
|
|
1811
|
+
}
|
|
1812
|
+
)
|
|
780
1813
|
]
|
|
781
1814
|
}
|
|
782
1815
|
);
|
|
783
1816
|
}
|
|
784
|
-
function
|
|
785
|
-
return /* @__PURE__ */
|
|
786
|
-
Box,
|
|
787
|
-
{
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
borderRadius: "rounded",
|
|
791
|
-
backgroundColor: "pillPressed"
|
|
792
|
-
}
|
|
793
|
-
);
|
|
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
|
+
] });
|
|
794
1823
|
}
|
|
1824
|
+
var sheet = { paddingBottom: 20 };
|
|
795
1825
|
var topBar2 = {
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
1826
|
+
paddingVertical: 16,
|
|
1827
|
+
paddingHorizontal: 24,
|
|
1828
|
+
gap: 4
|
|
799
1829
|
};
|
|
1830
|
+
var iconButton = { width: 32, height: 32 };
|
|
800
1831
|
var topBarSpacer = { width: 32, height: 32 };
|
|
801
|
-
var
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
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 = {
|
|
806
1839
|
width: 36,
|
|
807
|
-
height:
|
|
808
|
-
borderRadius: 999
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
textAlign: "center"
|
|
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"
|
|
815
1847
|
};
|
|
816
|
-
var content = { paddingHorizontal: 16, paddingBottom: 16 };
|
|
817
|
-
var row2 = { paddingHorizontal: 16, paddingVertical: 10 };
|
|
818
1848
|
|
|
819
|
-
// src/screens/
|
|
820
|
-
import {
|
|
821
|
-
import { jsx as
|
|
822
|
-
function
|
|
823
|
-
|
|
824
|
-
accountName,
|
|
825
|
-
onClose,
|
|
826
|
-
onShare,
|
|
827
|
-
onSupportedChainsPress
|
|
828
|
-
}) {
|
|
829
|
-
return /* @__PURE__ */ jsxs3(
|
|
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(
|
|
830
1854
|
Box,
|
|
831
1855
|
{
|
|
832
1856
|
backgroundColor: "bgModal",
|
|
833
1857
|
borderTopLeftRadius: "modal",
|
|
834
1858
|
borderTopRightRadius: "modal",
|
|
835
|
-
style: sheet,
|
|
836
1859
|
children: [
|
|
837
|
-
/* @__PURE__ */
|
|
838
|
-
|
|
839
|
-
/* @__PURE__ */
|
|
840
|
-
|
|
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,
|
|
841
1864
|
{
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
1865
|
+
backgroundColor: "bgSecondary",
|
|
1866
|
+
borderRadius: "rounded",
|
|
1867
|
+
alignItems: "center",
|
|
1868
|
+
justifyContent: "center",
|
|
1869
|
+
style: styles2.iconCircle,
|
|
1870
|
+
children: /* @__PURE__ */ jsx11(FigmaInfoCircleIcon, { size: 24 })
|
|
847
1871
|
}
|
|
848
1872
|
),
|
|
849
|
-
/* @__PURE__ */
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
/* @__PURE__ */ jsxs3(Box, { alignItems: "center", style: content2, children: [
|
|
853
|
-
/* @__PURE__ */ jsxs3(Text, { variant: "body", color: "textSecondary", style: caption, children: [
|
|
854
|
-
`Scan to deposit to this ${accountName ? `${accountName} ` : ""}account.
|
|
855
|
-
`,
|
|
856
|
-
"Use it only for",
|
|
857
|
-
" ",
|
|
858
|
-
/* @__PURE__ */ jsx6(
|
|
1873
|
+
/* @__PURE__ */ jsxs6(Box, { alignItems: "center", style: styles2.textGroup, children: [
|
|
1874
|
+
/* @__PURE__ */ jsx11(Text, { variant: "bodyMedium", color: "textPrimary", children: "Not available" }),
|
|
1875
|
+
/* @__PURE__ */ jsx11(
|
|
859
1876
|
Text,
|
|
860
1877
|
{
|
|
861
|
-
variant: "
|
|
1878
|
+
variant: "detail",
|
|
862
1879
|
color: "textSecondary",
|
|
863
|
-
style:
|
|
864
|
-
|
|
865
|
-
accessibilityRole: "link",
|
|
866
|
-
accessibilityLabel: "supported chains",
|
|
867
|
-
children: "supported chains"
|
|
1880
|
+
style: styles2.descriptionText,
|
|
1881
|
+
children: "This service is not available in your region."
|
|
868
1882
|
}
|
|
869
1883
|
)
|
|
870
|
-
] })
|
|
871
|
-
/* @__PURE__ */ jsx6(
|
|
872
|
-
Box,
|
|
873
|
-
{
|
|
874
|
-
backgroundColor: "bgModal",
|
|
875
|
-
borderColor: "borderDefault",
|
|
876
|
-
borderWidth: 2,
|
|
877
|
-
alignItems: "center",
|
|
878
|
-
justifyContent: "center",
|
|
879
|
-
style: qrFrame,
|
|
880
|
-
children: qrCode
|
|
881
|
-
}
|
|
882
|
-
),
|
|
883
|
-
/* @__PURE__ */ jsx6(
|
|
884
|
-
Pressable3,
|
|
885
|
-
{
|
|
886
|
-
onPress: onShare,
|
|
887
|
-
accessibilityRole: "button",
|
|
888
|
-
accessibilityLabel: "Share",
|
|
889
|
-
children: /* @__PURE__ */ jsx6(
|
|
890
|
-
Box,
|
|
891
|
-
{
|
|
892
|
-
width: 68,
|
|
893
|
-
height: 68,
|
|
894
|
-
borderRadius: "rounded",
|
|
895
|
-
backgroundColor: "bgSecondary",
|
|
896
|
-
alignItems: "center",
|
|
897
|
-
justifyContent: "center",
|
|
898
|
-
children: /* @__PURE__ */ jsx6(Text, { color: "textPrimary", style: shareGlyph, children: "\u2191" })
|
|
899
|
-
}
|
|
900
|
-
)
|
|
901
|
-
}
|
|
902
|
-
)
|
|
1884
|
+
] })
|
|
903
1885
|
] })
|
|
904
1886
|
]
|
|
905
1887
|
}
|
|
906
1888
|
);
|
|
907
1889
|
}
|
|
908
|
-
var
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
}
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
var link = { textDecorationLine: "underline" };
|
|
927
|
-
var qrFrame = {
|
|
928
|
-
width: 275,
|
|
929
|
-
height: 275,
|
|
930
|
-
borderRadius: 20,
|
|
931
|
-
padding: 16
|
|
932
|
-
};
|
|
933
|
-
var closeGlyph = { fontSize: 18, lineHeight: 22 };
|
|
934
|
-
var shareGlyph = { fontSize: 28, lineHeight: 32, fontWeight: "500" };
|
|
1890
|
+
var styles2 = StyleSheet2.create({
|
|
1891
|
+
topBar: { paddingTop: 20, paddingBottom: 12 },
|
|
1892
|
+
grabber: {
|
|
1893
|
+
position: "absolute",
|
|
1894
|
+
top: 8,
|
|
1895
|
+
width: 36,
|
|
1896
|
+
height: 5,
|
|
1897
|
+
borderRadius: 999
|
|
1898
|
+
},
|
|
1899
|
+
content: {
|
|
1900
|
+
height: 468,
|
|
1901
|
+
gap: 16,
|
|
1902
|
+
paddingHorizontal: 16
|
|
1903
|
+
},
|
|
1904
|
+
iconCircle: { width: 48, height: 48 },
|
|
1905
|
+
textGroup: { gap: 8 },
|
|
1906
|
+
descriptionText: { textAlign: "center" }
|
|
1907
|
+
});
|
|
935
1908
|
|
|
936
|
-
// src/screens/
|
|
937
|
-
import {
|
|
938
|
-
import {
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
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
|
+
);
|
|
1931
|
+
}
|
|
1932
|
+
|
|
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
|
|
951
1945
|
}) {
|
|
952
|
-
const
|
|
953
|
-
|
|
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(
|
|
954
1958
|
Box,
|
|
955
1959
|
{
|
|
956
1960
|
backgroundColor: "bgModal",
|
|
957
1961
|
borderTopLeftRadius: "modal",
|
|
958
1962
|
borderTopRightRadius: "modal",
|
|
1963
|
+
style: sheet2,
|
|
959
1964
|
children: [
|
|
960
|
-
/* @__PURE__ */
|
|
961
|
-
/* @__PURE__ */
|
|
962
|
-
|
|
963
|
-
Pressable4,
|
|
1965
|
+
/* @__PURE__ */ jsxs7(Box, { flexDirection: "row", alignItems: "center", style: topBar3, children: [
|
|
1966
|
+
/* @__PURE__ */ jsx13(
|
|
1967
|
+
Pressable3,
|
|
964
1968
|
{
|
|
965
|
-
onPress:
|
|
1969
|
+
onPress: onClose,
|
|
966
1970
|
hitSlop: 12,
|
|
967
1971
|
accessibilityRole: "button",
|
|
968
|
-
accessibilityLabel: "
|
|
969
|
-
children: /* @__PURE__ */
|
|
1972
|
+
accessibilityLabel: "Close",
|
|
1973
|
+
children: /* @__PURE__ */ jsx13(Text, { color: "textPrimary", style: closeGlyph, children: "\u2715" })
|
|
970
1974
|
}
|
|
971
1975
|
),
|
|
972
|
-
/* @__PURE__ */
|
|
973
|
-
/* @__PURE__ */
|
|
1976
|
+
/* @__PURE__ */ jsx13(Box, { flex: 1, alignItems: "center", children: /* @__PURE__ */ jsx13(Text, { variant: "bodyMedium", color: "textPrimary", children: title }) }),
|
|
1977
|
+
/* @__PURE__ */ jsx13(Box, { style: topBarSpacer2 })
|
|
974
1978
|
] }),
|
|
975
|
-
/* @__PURE__ */
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
borderColor: "borderDefault",
|
|
984
|
-
borderWidth: 1,
|
|
985
|
-
borderRadius: "element",
|
|
986
|
-
style: searchBox,
|
|
987
|
-
children: [
|
|
988
|
-
/* @__PURE__ */ jsx7(SearchGlyph, {}),
|
|
989
|
-
/* @__PURE__ */ jsx7(
|
|
990
|
-
TextInput,
|
|
991
|
-
{
|
|
992
|
-
value: searchValue,
|
|
993
|
-
onChangeText: onSearchChange,
|
|
994
|
-
placeholder: searchPlaceholder,
|
|
995
|
-
placeholderTextColor: theme.colors.textSecondary,
|
|
996
|
-
style: [searchInput, { color: theme.colors.textPrimary }]
|
|
997
|
-
}
|
|
998
|
-
)
|
|
999
|
-
]
|
|
1000
|
-
}
|
|
1001
|
-
),
|
|
1002
|
-
chainFilters.length > 0 ? /* @__PURE__ */ jsx7(
|
|
1003
|
-
ScrollView2,
|
|
1004
|
-
{
|
|
1005
|
-
horizontal: true,
|
|
1006
|
-
showsHorizontalScrollIndicator: false,
|
|
1007
|
-
contentContainerStyle: chipRow,
|
|
1008
|
-
children: chainFilters.map((filter) => {
|
|
1009
|
-
const selected = filter.id === selectedChainFilterId;
|
|
1010
|
-
return /* @__PURE__ */ jsx7(
|
|
1011
|
-
Pressable4,
|
|
1012
|
-
{
|
|
1013
|
-
onPress: () => onSelectChainFilter?.(filter.id),
|
|
1014
|
-
accessibilityRole: "button",
|
|
1015
|
-
accessibilityLabel: filter.label,
|
|
1016
|
-
accessibilityState: { selected },
|
|
1017
|
-
children: /* @__PURE__ */ jsx7(
|
|
1018
|
-
Box,
|
|
1019
|
-
{
|
|
1020
|
-
backgroundColor: selected ? "btnPrimary" : "bgSecondary",
|
|
1021
|
-
borderRadius: "rounded",
|
|
1022
|
-
style: chip,
|
|
1023
|
-
children: /* @__PURE__ */ jsx7(
|
|
1024
|
-
Text,
|
|
1025
|
-
{
|
|
1026
|
-
variant: "bodyMedium",
|
|
1027
|
-
color: selected ? "onBtnPrimary" : "textPrimary",
|
|
1028
|
-
children: filter.label
|
|
1029
|
-
}
|
|
1030
|
-
)
|
|
1031
|
-
}
|
|
1032
|
-
)
|
|
1033
|
-
},
|
|
1034
|
-
filter.id
|
|
1035
|
-
);
|
|
1036
|
-
})
|
|
1037
|
-
}
|
|
1038
|
-
) : null,
|
|
1039
|
-
/* @__PURE__ */ jsx7(ScrollView2, { style: list, showsVerticalScrollIndicator: false, children: tokens.map((token) => /* @__PURE__ */ jsx7(
|
|
1040
|
-
Pressable4,
|
|
1041
|
-
{
|
|
1042
|
-
onPress: () => onSelectToken?.(token.id),
|
|
1043
|
-
accessibilityRole: "button",
|
|
1044
|
-
accessibilityLabel: `${token.symbol} on ${token.chainLabel}`,
|
|
1045
|
-
children: /* @__PURE__ */ jsxs4(
|
|
1979
|
+
/* @__PURE__ */ jsxs7(
|
|
1980
|
+
Box,
|
|
1981
|
+
{
|
|
1982
|
+
alignItems: "center",
|
|
1983
|
+
justifyContent: "center",
|
|
1984
|
+
style: [content2, { minHeight: height * 0.5 }],
|
|
1985
|
+
children: [
|
|
1986
|
+
/* @__PURE__ */ jsxs7(
|
|
1046
1987
|
Box,
|
|
1047
1988
|
{
|
|
1048
|
-
|
|
1989
|
+
backgroundColor: "bgModal",
|
|
1990
|
+
borderColor: "borderDefault",
|
|
1991
|
+
borderWidth: 1.5,
|
|
1049
1992
|
alignItems: "center",
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
style: row3,
|
|
1993
|
+
justifyContent: "center",
|
|
1994
|
+
style: qrFrame,
|
|
1053
1995
|
children: [
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1996
|
+
qrCode,
|
|
1997
|
+
centerIcon ? /* @__PURE__ */ jsx13(
|
|
1998
|
+
Box,
|
|
1999
|
+
{
|
|
2000
|
+
alignItems: "center",
|
|
2001
|
+
justifyContent: "center",
|
|
2002
|
+
style: centerOverlay,
|
|
2003
|
+
children: centerIcon
|
|
2004
|
+
}
|
|
2005
|
+
) : null
|
|
1057
2006
|
]
|
|
1058
2007
|
}
|
|
1059
|
-
)
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
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
|
+
)
|
|
1064
2040
|
]
|
|
1065
2041
|
}
|
|
1066
2042
|
);
|
|
1067
2043
|
}
|
|
1068
|
-
|
|
1069
|
-
|
|
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";
|
|
2093
|
+
|
|
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(
|
|
1070
2115
|
Box,
|
|
1071
2116
|
{
|
|
1072
|
-
|
|
1073
|
-
|
|
2117
|
+
flexDirection: "row",
|
|
2118
|
+
alignItems: "center",
|
|
2119
|
+
backgroundColor: "bgSecondary",
|
|
2120
|
+
borderColor: "borderDefault",
|
|
2121
|
+
borderWidth: 1,
|
|
1074
2122
|
borderRadius: "rounded",
|
|
1075
|
-
|
|
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
|
+
})
|
|
1076
2164
|
}
|
|
1077
2165
|
);
|
|
1078
2166
|
}
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
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
|
+
)) }) });
|
|
1084
2193
|
}
|
|
1085
|
-
var
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
position: "absolute",
|
|
1093
|
-
top: 8,
|
|
1094
|
-
left: "50%",
|
|
1095
|
-
marginLeft: -18,
|
|
1096
|
-
width: 36,
|
|
1097
|
-
height: 5,
|
|
1098
|
-
borderRadius: 999
|
|
1099
|
-
};
|
|
1100
|
-
var chevron2 = {
|
|
1101
|
-
fontSize: 26,
|
|
1102
|
-
lineHeight: 28,
|
|
1103
|
-
width: 24,
|
|
1104
|
-
textAlign: "center"
|
|
1105
|
-
};
|
|
1106
|
-
var content3 = { paddingHorizontal: 16, paddingBottom: 16, gap: 12 };
|
|
1107
|
-
var searchBox = {
|
|
1108
|
-
height: 44,
|
|
1109
|
-
paddingHorizontal: 12
|
|
1110
|
-
};
|
|
1111
|
-
var searchInput = {
|
|
1112
|
-
flex: 1,
|
|
1113
|
-
fontFamily: "Inter",
|
|
1114
|
-
fontSize: 16,
|
|
1115
|
-
padding: 0
|
|
1116
|
-
};
|
|
1117
|
-
var chipRow = { gap: 8 };
|
|
1118
|
-
var chip = { paddingHorizontal: 16, paddingVertical: 10 };
|
|
1119
|
-
var list = { maxHeight: 360 };
|
|
1120
|
-
var row3 = { padding: 16 };
|
|
1121
|
-
var searchLens = {
|
|
1122
|
-
width: 11,
|
|
1123
|
-
height: 11,
|
|
1124
|
-
borderRadius: 999
|
|
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
|
|
1125
2201
|
};
|
|
1126
|
-
var
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
height: 1.5,
|
|
1132
|
-
transform: [{ rotate: "45deg" }]
|
|
2202
|
+
var iconPress = {
|
|
2203
|
+
width: 50,
|
|
2204
|
+
height: "100%",
|
|
2205
|
+
alignItems: "center",
|
|
2206
|
+
justifyContent: "center"
|
|
1133
2207
|
};
|
|
2208
|
+
var miniGrid = { width: 23.5, gap: 1.5 };
|
|
1134
2209
|
|
|
1135
2210
|
// src/screens/TransferCryptoScreen.tsx
|
|
1136
|
-
import {
|
|
1137
|
-
import { Pressable as Pressable5 } from "react-native";
|
|
1138
|
-
import { jsx as jsx8, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
2211
|
+
import { jsx as jsx15, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
1139
2212
|
function TransferCryptoScreen({
|
|
1140
2213
|
depositAddress,
|
|
1141
|
-
|
|
1142
|
-
|
|
2214
|
+
networks,
|
|
2215
|
+
selectedNetworkId,
|
|
2216
|
+
onSelectNetwork,
|
|
2217
|
+
supportedTokenIcons,
|
|
2218
|
+
minimumDepositLabel,
|
|
1143
2219
|
title = "Transfer Crypto",
|
|
1144
2220
|
depositAddressLabel = "Your deposit address",
|
|
2221
|
+
copyLabel = "Copy",
|
|
2222
|
+
copiedLabel = "Copied!",
|
|
2223
|
+
shareLabel = "Share",
|
|
1145
2224
|
copiedFeedbackMs = 1800,
|
|
1146
2225
|
onBack,
|
|
1147
2226
|
onShowQrCode,
|
|
1148
|
-
|
|
1149
|
-
onShowSupportedTokens,
|
|
2227
|
+
onShowChains,
|
|
1150
2228
|
onCopyAddress,
|
|
1151
2229
|
onShareAddress
|
|
1152
2230
|
}) {
|
|
1153
|
-
const
|
|
1154
|
-
const
|
|
1155
|
-
|
|
2231
|
+
const theme = useTheme();
|
|
2232
|
+
const [copied, setCopied] = useState7(false);
|
|
2233
|
+
const copyTimer = useRef3(void 0);
|
|
2234
|
+
useEffect7(() => () => clearTimeout(copyTimer.current), []);
|
|
1156
2235
|
const handleCopy = () => {
|
|
1157
2236
|
onCopyAddress?.();
|
|
1158
2237
|
setCopied(true);
|
|
1159
2238
|
clearTimeout(copyTimer.current);
|
|
1160
2239
|
copyTimer.current = setTimeout(() => setCopied(false), copiedFeedbackMs);
|
|
1161
2240
|
};
|
|
1162
|
-
|
|
2241
|
+
const showPreview = supportedTokenIcons != null && supportedTokenIcons.length > 0;
|
|
2242
|
+
const selectedNetwork = networks.find(
|
|
2243
|
+
(network) => network.id === selectedNetworkId
|
|
2244
|
+
);
|
|
2245
|
+
return /* @__PURE__ */ jsxs9(
|
|
1163
2246
|
Box,
|
|
1164
2247
|
{
|
|
1165
2248
|
backgroundColor: "bgModal",
|
|
1166
2249
|
borderTopLeftRadius: "modal",
|
|
1167
2250
|
borderTopRightRadius: "modal",
|
|
1168
2251
|
children: [
|
|
1169
|
-
/* @__PURE__ */
|
|
1170
|
-
/* @__PURE__ */
|
|
1171
|
-
/* @__PURE__ */ jsx8(
|
|
2252
|
+
/* @__PURE__ */ jsxs9(Box, { flexDirection: "row", alignItems: "center", style: topBar4, children: [
|
|
2253
|
+
/* @__PURE__ */ jsx15(
|
|
1172
2254
|
Pressable5,
|
|
1173
2255
|
{
|
|
1174
2256
|
onPress: onBack,
|
|
1175
2257
|
hitSlop: 12,
|
|
1176
2258
|
accessibilityRole: "button",
|
|
1177
2259
|
accessibilityLabel: "Back",
|
|
1178
|
-
children: /* @__PURE__ */
|
|
2260
|
+
children: /* @__PURE__ */ jsx15(Box, { alignItems: "center", justifyContent: "center", style: iconButton2, children: /* @__PURE__ */ jsx15(FigmaChevronLeftIcon, {}) })
|
|
1179
2261
|
}
|
|
1180
2262
|
),
|
|
1181
|
-
/* @__PURE__ */
|
|
1182
|
-
/* @__PURE__ */
|
|
2263
|
+
/* @__PURE__ */ jsx15(Box, { flex: 1, alignItems: "center", children: /* @__PURE__ */ jsx15(Text, { variant: "bodyMedium", color: "textPrimary", children: title }) }),
|
|
2264
|
+
/* @__PURE__ */ jsx15(
|
|
1183
2265
|
Pressable5,
|
|
1184
2266
|
{
|
|
1185
2267
|
onPress: onShowQrCode,
|
|
1186
2268
|
hitSlop: 12,
|
|
1187
2269
|
accessibilityRole: "button",
|
|
1188
2270
|
accessibilityLabel: "Show QR code",
|
|
1189
|
-
children: /* @__PURE__ */
|
|
2271
|
+
children: /* @__PURE__ */ jsx15(Box, { alignItems: "center", justifyContent: "center", style: iconButton2, children: /* @__PURE__ */ jsx15(FigmaQrScanIcon, {}) })
|
|
1190
2272
|
}
|
|
1191
2273
|
)
|
|
1192
2274
|
] }),
|
|
1193
|
-
/* @__PURE__ */
|
|
1194
|
-
/* @__PURE__ */
|
|
1195
|
-
|
|
2275
|
+
/* @__PURE__ */ jsxs9(Box, { style: content3, children: [
|
|
2276
|
+
/* @__PURE__ */ jsx15(
|
|
2277
|
+
NetworkSelector,
|
|
1196
2278
|
{
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
backgroundColor: "bgSecondary",
|
|
1201
|
-
borderColor: "borderDefault",
|
|
1202
|
-
borderWidth: 1,
|
|
1203
|
-
borderRadius: "button",
|
|
1204
|
-
style: networkRow,
|
|
1205
|
-
children: [
|
|
1206
|
-
/* @__PURE__ */ jsx8(
|
|
1207
|
-
Pressable5,
|
|
1208
|
-
{
|
|
1209
|
-
onPress: onShowSupportedTokens,
|
|
1210
|
-
accessibilityRole: "button",
|
|
1211
|
-
accessibilityLabel: "Supported tokens",
|
|
1212
|
-
style: networkInfoPress,
|
|
1213
|
-
children: /* @__PURE__ */ jsxs5(
|
|
1214
|
-
Box,
|
|
1215
|
-
{
|
|
1216
|
-
flexDirection: "row",
|
|
1217
|
-
alignItems: "center",
|
|
1218
|
-
gap: "elementsHorizontal",
|
|
1219
|
-
children: [
|
|
1220
|
-
networkIcon ?? /* @__PURE__ */ jsx8(NetworkIconFallback, {}),
|
|
1221
|
-
/* @__PURE__ */ jsxs5(Box, { flexDirection: "row", alignItems: "center", style: labelInfo, children: [
|
|
1222
|
-
/* @__PURE__ */ jsx8(Text, { variant: "bodyMedium", color: "textPrimary", children: networkLabel }),
|
|
1223
|
-
/* @__PURE__ */ jsx8(InfoGlyph, {})
|
|
1224
|
-
] })
|
|
1225
|
-
]
|
|
1226
|
-
}
|
|
1227
|
-
)
|
|
1228
|
-
}
|
|
1229
|
-
),
|
|
1230
|
-
/* @__PURE__ */ jsx8(
|
|
1231
|
-
Pressable5,
|
|
1232
|
-
{
|
|
1233
|
-
onPress: onChangeNetwork,
|
|
1234
|
-
accessibilityRole: "button",
|
|
1235
|
-
accessibilityLabel: "Change network",
|
|
1236
|
-
hitSlop: 8,
|
|
1237
|
-
children: /* @__PURE__ */ jsx8(Text, { variant: "bodyMedium", color: "textSecondary", children: "Change" })
|
|
1238
|
-
}
|
|
1239
|
-
)
|
|
1240
|
-
]
|
|
2279
|
+
networks,
|
|
2280
|
+
selectedId: selectedNetworkId,
|
|
2281
|
+
onSelect: onSelectNetwork
|
|
1241
2282
|
}
|
|
1242
2283
|
),
|
|
1243
|
-
/* @__PURE__ */
|
|
2284
|
+
/* @__PURE__ */ jsxs9(
|
|
1244
2285
|
Box,
|
|
1245
2286
|
{
|
|
1246
|
-
flexDirection: "row",
|
|
1247
2287
|
alignItems: "center",
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
borderWidth: 1,
|
|
1251
|
-
borderRadius: "button",
|
|
1252
|
-
style: addressCard,
|
|
2288
|
+
justifyContent: "flex-end",
|
|
2289
|
+
style: addressRegion,
|
|
1253
2290
|
children: [
|
|
1254
|
-
/* @__PURE__ */
|
|
1255
|
-
|
|
1256
|
-
Text,
|
|
1257
|
-
{
|
|
1258
|
-
variant: "detail",
|
|
1259
|
-
color: copied ? "textSuccess" : "textSecondary",
|
|
1260
|
-
children: copied ? "Copied!" : depositAddressLabel
|
|
1261
|
-
}
|
|
1262
|
-
),
|
|
1263
|
-
/* @__PURE__ */ jsx8(Text, { variant: "bodyMedium", color: "textPrimary", children: depositAddress })
|
|
1264
|
-
] }),
|
|
1265
|
-
/* @__PURE__ */ jsx8(
|
|
1266
|
-
CircleIconButton,
|
|
2291
|
+
/* @__PURE__ */ jsx15(
|
|
2292
|
+
Box,
|
|
1267
2293
|
{
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
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
|
+
] })
|
|
1271
2356
|
}
|
|
1272
2357
|
),
|
|
1273
|
-
/* @__PURE__ */
|
|
2358
|
+
/* @__PURE__ */ jsxs9(Box, { flexDirection: "row", style: buttonsRow, children: [
|
|
2359
|
+
/* @__PURE__ */ jsx15(
|
|
2360
|
+
PillButton,
|
|
2361
|
+
{
|
|
2362
|
+
label: copied ? copiedLabel : copyLabel,
|
|
2363
|
+
accessibilityLabel: copied ? "Address copied" : "Copy address",
|
|
2364
|
+
icon: /* @__PURE__ */ jsx15(FigmaCopyIcon, { color: theme.colors.onBtnPrimary }),
|
|
2365
|
+
onPress: handleCopy
|
|
2366
|
+
}
|
|
2367
|
+
),
|
|
2368
|
+
/* @__PURE__ */ jsx15(
|
|
2369
|
+
PillButton,
|
|
2370
|
+
{
|
|
2371
|
+
label: shareLabel,
|
|
2372
|
+
accessibilityLabel: "Share address",
|
|
2373
|
+
icon: /* @__PURE__ */ jsx15(FigmaShareIcon, { color: theme.colors.onBtnPrimary }),
|
|
2374
|
+
onPress: onShareAddress
|
|
2375
|
+
}
|
|
2376
|
+
)
|
|
2377
|
+
] })
|
|
1274
2378
|
]
|
|
1275
2379
|
}
|
|
1276
2380
|
)
|
|
@@ -1279,270 +2383,278 @@ function TransferCryptoScreen({
|
|
|
1279
2383
|
}
|
|
1280
2384
|
);
|
|
1281
2385
|
}
|
|
1282
|
-
function
|
|
1283
|
-
|
|
1284
|
-
|
|
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,
|
|
1285
2406
|
onPress
|
|
1286
2407
|
}) {
|
|
1287
|
-
return /* @__PURE__ */
|
|
2408
|
+
return /* @__PURE__ */ jsx15(
|
|
1288
2409
|
Pressable5,
|
|
1289
2410
|
{
|
|
1290
2411
|
onPress,
|
|
1291
2412
|
accessibilityRole: "button",
|
|
1292
|
-
accessibilityLabel
|
|
1293
|
-
|
|
2413
|
+
accessibilityLabel,
|
|
2414
|
+
style: pillButtonPress,
|
|
2415
|
+
children: /* @__PURE__ */ jsxs9(
|
|
1294
2416
|
Box,
|
|
1295
2417
|
{
|
|
1296
|
-
|
|
1297
|
-
height: 48,
|
|
1298
|
-
borderRadius: "rounded",
|
|
1299
|
-
backgroundColor: "bgSecondary",
|
|
2418
|
+
flexDirection: "row",
|
|
1300
2419
|
alignItems: "center",
|
|
1301
2420
|
justifyContent: "center",
|
|
1302
|
-
|
|
2421
|
+
backgroundColor: "btnPrimary",
|
|
2422
|
+
borderRadius: "rounded",
|
|
2423
|
+
style: pillButton,
|
|
2424
|
+
children: [
|
|
2425
|
+
icon,
|
|
2426
|
+
/* @__PURE__ */ jsx15(Text, { variant: "bodyMedium", color: "onBtnPrimary", children: label2 })
|
|
2427
|
+
]
|
|
1303
2428
|
}
|
|
1304
2429
|
)
|
|
1305
2430
|
}
|
|
1306
2431
|
);
|
|
1307
2432
|
}
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
height: 16,
|
|
1314
|
-
borderRadius: "rounded",
|
|
1315
|
-
borderWidth: 1,
|
|
1316
|
-
borderColor: "textSecondary",
|
|
1317
|
-
alignItems: "center",
|
|
1318
|
-
justifyContent: "center",
|
|
1319
|
-
children: /* @__PURE__ */ jsx8(Text, { color: "textSecondary", style: infoChar, children: "i" })
|
|
1320
|
-
}
|
|
1321
|
-
);
|
|
1322
|
-
}
|
|
1323
|
-
function NetworkIconFallback() {
|
|
1324
|
-
return /* @__PURE__ */ jsx8(
|
|
1325
|
-
Box,
|
|
1326
|
-
{
|
|
1327
|
-
width: 32,
|
|
1328
|
-
height: 32,
|
|
1329
|
-
borderRadius: "rounded",
|
|
1330
|
-
backgroundColor: "pillPressed"
|
|
1331
|
-
}
|
|
1332
|
-
);
|
|
1333
|
-
}
|
|
1334
|
-
function QrGlyph() {
|
|
1335
|
-
return /* @__PURE__ */ jsx8(
|
|
1336
|
-
Box,
|
|
1337
|
-
{
|
|
1338
|
-
width: 20,
|
|
1339
|
-
height: 20,
|
|
1340
|
-
flexDirection: "row",
|
|
1341
|
-
flexWrap: "wrap",
|
|
1342
|
-
style: qrGrid,
|
|
1343
|
-
children: [0, 1, 2, 3].map((i) => /* @__PURE__ */ jsx8(
|
|
1344
|
-
Box,
|
|
1345
|
-
{
|
|
1346
|
-
width: 8,
|
|
1347
|
-
height: 8,
|
|
1348
|
-
backgroundColor: "textPrimary",
|
|
1349
|
-
borderRadius: "elementInner"
|
|
1350
|
-
},
|
|
1351
|
-
i
|
|
1352
|
-
))
|
|
1353
|
-
}
|
|
1354
|
-
);
|
|
1355
|
-
}
|
|
1356
|
-
function CopyGlyph() {
|
|
1357
|
-
return /* @__PURE__ */ jsxs5(Box, { width: 18, height: 18, children: [
|
|
1358
|
-
/* @__PURE__ */ jsx8(Box, { borderWidth: 1.5, borderColor: "textPrimary", style: copyBack }),
|
|
1359
|
-
/* @__PURE__ */ jsx8(
|
|
1360
|
-
Box,
|
|
1361
|
-
{
|
|
1362
|
-
borderWidth: 1.5,
|
|
1363
|
-
borderColor: "textPrimary",
|
|
1364
|
-
backgroundColor: "bgSecondary",
|
|
1365
|
-
style: copyFront
|
|
1366
|
-
}
|
|
1367
|
-
)
|
|
1368
|
-
] });
|
|
1369
|
-
}
|
|
1370
|
-
var topBar5 = {
|
|
1371
|
-
paddingTop: 20,
|
|
1372
|
-
paddingBottom: 12,
|
|
1373
|
-
paddingHorizontal: 12
|
|
1374
|
-
};
|
|
1375
|
-
var grabber5 = {
|
|
1376
|
-
position: "absolute",
|
|
1377
|
-
top: 8,
|
|
1378
|
-
left: "50%",
|
|
1379
|
-
marginLeft: -18,
|
|
1380
|
-
width: 36,
|
|
1381
|
-
height: 5,
|
|
1382
|
-
borderRadius: 999
|
|
1383
|
-
};
|
|
1384
|
-
var chevron3 = {
|
|
1385
|
-
fontSize: 26,
|
|
1386
|
-
lineHeight: 28,
|
|
1387
|
-
width: 24,
|
|
1388
|
-
textAlign: "center"
|
|
2433
|
+
var topBar4 = {
|
|
2434
|
+
paddingTop: 16,
|
|
2435
|
+
paddingBottom: 16,
|
|
2436
|
+
paddingHorizontal: 24,
|
|
2437
|
+
gap: 4
|
|
1389
2438
|
};
|
|
1390
|
-
var
|
|
2439
|
+
var iconButton2 = { width: 32, height: 32 };
|
|
2440
|
+
var content3 = {
|
|
1391
2441
|
paddingHorizontal: 20,
|
|
1392
|
-
|
|
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,
|
|
1393
2445
|
paddingTop: 8,
|
|
1394
|
-
gap:
|
|
2446
|
+
gap: 16
|
|
1395
2447
|
};
|
|
1396
|
-
var
|
|
1397
|
-
var
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
borderRadius: 3
|
|
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
|
|
1411
2462
|
};
|
|
1412
|
-
var
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
2463
|
+
var addressColumn = { gap: 4 };
|
|
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
|
|
1419
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 };
|
|
1420
2477
|
|
|
1421
2478
|
// src/swapped/SwappedScreen.tsx
|
|
1422
|
-
import { useCallback as
|
|
1423
|
-
|
|
1424
|
-
// src/logging/logger.ts
|
|
1425
|
-
import { FunLogger } from "@funkit/connect-core";
|
|
1426
|
-
|
|
1427
|
-
// src/logging/datadogHttpLogTransport.ts
|
|
1428
|
-
var DEFAULT_SERVICE = "connect-rn";
|
|
1429
|
-
var DEFAULT_SITE = "datadoghq.com";
|
|
1430
|
-
var DEFAULT_FLUSH_INTERVAL_MS = 5e3;
|
|
1431
|
-
var DEFAULT_MAX_BATCH_SIZE = 50;
|
|
1432
|
-
var DatadogHttpLogTransport = class {
|
|
1433
|
-
constructor(options) {
|
|
1434
|
-
this.consent = "granted";
|
|
1435
|
-
this.queue = [];
|
|
1436
|
-
this.flushTimer = null;
|
|
1437
|
-
const site = options.site ?? DEFAULT_SITE;
|
|
1438
|
-
this.service = options.service ?? DEFAULT_SERVICE;
|
|
1439
|
-
this.env = options.env;
|
|
1440
|
-
this.flushIntervalMs = options.flushIntervalMs ?? DEFAULT_FLUSH_INTERVAL_MS;
|
|
1441
|
-
this.maxBatchSize = options.maxBatchSize ?? DEFAULT_MAX_BATCH_SIZE;
|
|
1442
|
-
this.intakeUrl = `https://browser-intake-${site}/api/v2/logs?dd-api-key=${encodeURIComponent(options.clientToken)}&ddsource=react-native&dd-evp-origin=react-native`;
|
|
1443
|
-
}
|
|
1444
|
-
setEnv(environment) {
|
|
1445
|
-
this.env = environment;
|
|
1446
|
-
}
|
|
1447
|
-
setTrackingConsent(consent) {
|
|
1448
|
-
this.consent = consent;
|
|
1449
|
-
if (consent !== "granted") {
|
|
1450
|
-
this.queue = [];
|
|
1451
|
-
this.clearTimer();
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
log({ level, title, context, error }) {
|
|
1455
|
-
if (this.consent !== "granted") {
|
|
1456
|
-
return;
|
|
1457
|
-
}
|
|
1458
|
-
const entry = {
|
|
1459
|
-
ddsource: "react-native",
|
|
1460
|
-
service: this.service,
|
|
1461
|
-
status: level,
|
|
1462
|
-
message: title,
|
|
1463
|
-
...this.env ? { ddtags: `env:${this.env}` } : {},
|
|
1464
|
-
...context,
|
|
1465
|
-
...error ? {
|
|
1466
|
-
error: {
|
|
1467
|
-
message: error.message,
|
|
1468
|
-
stack: error.stack,
|
|
1469
|
-
kind: error.name
|
|
1470
|
-
}
|
|
1471
|
-
} : {}
|
|
1472
|
-
};
|
|
1473
|
-
this.queue.push(entry);
|
|
1474
|
-
if (this.queue.length >= this.maxBatchSize) {
|
|
1475
|
-
this.flush();
|
|
1476
|
-
} else {
|
|
1477
|
-
this.scheduleFlush();
|
|
1478
|
-
}
|
|
1479
|
-
}
|
|
1480
|
-
/** Send the buffered batch. Fire-and-forget; network errors are swallowed. */
|
|
1481
|
-
flush() {
|
|
1482
|
-
this.clearTimer();
|
|
1483
|
-
if (this.queue.length === 0) {
|
|
1484
|
-
return;
|
|
1485
|
-
}
|
|
1486
|
-
if (typeof fetch !== "function") {
|
|
1487
|
-
this.queue = [];
|
|
1488
|
-
return;
|
|
1489
|
-
}
|
|
1490
|
-
const batch = this.queue;
|
|
1491
|
-
this.queue = [];
|
|
1492
|
-
fetch(this.intakeUrl, {
|
|
1493
|
-
method: "POST",
|
|
1494
|
-
headers: { "Content-Type": "application/json" },
|
|
1495
|
-
body: JSON.stringify(batch)
|
|
1496
|
-
}).catch(() => {
|
|
1497
|
-
});
|
|
1498
|
-
}
|
|
1499
|
-
scheduleFlush() {
|
|
1500
|
-
if (this.flushTimer != null) {
|
|
1501
|
-
return;
|
|
1502
|
-
}
|
|
1503
|
-
this.flushTimer = setTimeout(() => {
|
|
1504
|
-
this.flushTimer = null;
|
|
1505
|
-
this.flush();
|
|
1506
|
-
}, this.flushIntervalMs);
|
|
1507
|
-
}
|
|
1508
|
-
clearTimer() {
|
|
1509
|
-
if (this.flushTimer != null) {
|
|
1510
|
-
clearTimeout(this.flushTimer);
|
|
1511
|
-
this.flushTimer = null;
|
|
1512
|
-
}
|
|
1513
|
-
}
|
|
1514
|
-
};
|
|
1515
|
-
|
|
1516
|
-
// src/logging/logger.ts
|
|
1517
|
-
var DDOG_CLIENT_TOKEN = "pub4f86c6be8c792cb48dc156a8c17d9a47";
|
|
1518
|
-
var logger = new FunLogger(
|
|
1519
|
-
new DatadogHttpLogTransport({
|
|
1520
|
-
clientToken: DDOG_CLIENT_TOKEN
|
|
1521
|
-
// service defaults to 'connect-rn' (see DatadogHttpLogTransport).
|
|
1522
|
-
})
|
|
1523
|
-
);
|
|
2479
|
+
import { useCallback as useCallback3 } from "react";
|
|
1524
2480
|
|
|
1525
2481
|
// src/swapped/SwappedWebView.tsx
|
|
1526
|
-
import {
|
|
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";
|
|
1527
2485
|
import { WebView } from "react-native-webview";
|
|
1528
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
|
+
|
|
1529
2617
|
// src/swapped/webViewSwappedTransport.ts
|
|
1530
2618
|
import {
|
|
1531
2619
|
getSwappedOrigin
|
|
1532
2620
|
} from "@funkit/connect-core";
|
|
2621
|
+
var FUNKIT_ENVELOPE_KEY = "__funkitSwapped";
|
|
1533
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);
|
|
1534
2627
|
function forwardToNative(message) {
|
|
1535
2628
|
try {
|
|
1536
2629
|
var data = typeof message === 'string' ? message : JSON.stringify(message);
|
|
1537
2630
|
window.ReactNativeWebView && window.ReactNativeWebView.postMessage(data);
|
|
1538
2631
|
} catch (e) {}
|
|
1539
2632
|
}
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
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) {}
|
|
1543
2648
|
true;
|
|
1544
2649
|
})();
|
|
1545
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
|
+
}
|
|
1546
2658
|
function handleWebViewMessage(rawData, url) {
|
|
1547
2659
|
if (url != null && getSwappedOrigin(url) == null) {
|
|
1548
2660
|
return null;
|
|
@@ -1573,7 +2685,7 @@ function createWebViewSwappedTransport({
|
|
|
1573
2685
|
if (!webView) {
|
|
1574
2686
|
return false;
|
|
1575
2687
|
}
|
|
1576
|
-
webView.
|
|
2688
|
+
webView.injectJavaScript(buildSwappedSendScript(msg));
|
|
1577
2689
|
return true;
|
|
1578
2690
|
},
|
|
1579
2691
|
onMessage(handler) {
|
|
@@ -1595,24 +2707,49 @@ function createWebViewSwappedTransport({
|
|
|
1595
2707
|
}
|
|
1596
2708
|
|
|
1597
2709
|
// src/swapped/SwappedWebView.tsx
|
|
1598
|
-
import { jsx as
|
|
2710
|
+
import { jsx as jsx16 } from "react/jsx-runtime";
|
|
1599
2711
|
function SwappedWebView({ url, onMessage, style }) {
|
|
1600
|
-
const webViewRef =
|
|
1601
|
-
const { transport, dispatch } =
|
|
2712
|
+
const webViewRef = useRef4(null);
|
|
2713
|
+
const { transport, dispatch } = useMemo4(
|
|
1602
2714
|
() => createWebViewSwappedTransport({
|
|
1603
2715
|
getWebView: () => webViewRef.current
|
|
1604
2716
|
}),
|
|
1605
2717
|
[]
|
|
1606
2718
|
);
|
|
1607
|
-
const
|
|
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);
|
|
1608
2730
|
handlerRef.current = onMessage;
|
|
1609
|
-
|
|
1610
|
-
() => transport.onMessage((msg) =>
|
|
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
|
+
}),
|
|
1611
2744
|
[transport]
|
|
1612
2745
|
);
|
|
1613
2746
|
const handleMessage = (event) => {
|
|
1614
2747
|
dispatch(event.nativeEvent.data, event.nativeEvent.url);
|
|
1615
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
|
+
);
|
|
1616
2753
|
const handleError = (event) => {
|
|
1617
2754
|
logger.warn("connect-rn:swapped:webview:error", {
|
|
1618
2755
|
code: String(event.nativeEvent.code),
|
|
@@ -1626,7 +2763,7 @@ function SwappedWebView({ url, onMessage, style }) {
|
|
|
1626
2763
|
url: event.nativeEvent.url
|
|
1627
2764
|
});
|
|
1628
2765
|
};
|
|
1629
|
-
return /* @__PURE__ */
|
|
2766
|
+
return /* @__PURE__ */ jsx16(
|
|
1630
2767
|
WebView,
|
|
1631
2768
|
{
|
|
1632
2769
|
ref: webViewRef,
|
|
@@ -1634,29 +2771,44 @@ function SwappedWebView({ url, onMessage, style }) {
|
|
|
1634
2771
|
onMessage: handleMessage,
|
|
1635
2772
|
onError: handleError,
|
|
1636
2773
|
onHttpError: handleHttpError,
|
|
2774
|
+
scrollEnabled: false,
|
|
1637
2775
|
injectedJavaScriptBeforeContentLoaded: SWAPPED_WEBVIEW_INJECTED_JS,
|
|
1638
2776
|
startInLoadingState: true,
|
|
2777
|
+
renderLoading,
|
|
1639
2778
|
javaScriptEnabled: true,
|
|
1640
2779
|
domStorageEnabled: true,
|
|
1641
2780
|
sharedCookiesEnabled: true,
|
|
1642
2781
|
thirdPartyCookiesEnabled: true,
|
|
1643
2782
|
allowsInlineMediaPlayback: true,
|
|
2783
|
+
keyboardDisplayRequiresUserAction: false,
|
|
2784
|
+
hideKeyboardAccessoryView: true,
|
|
2785
|
+
automaticallyAdjustContentInsets: false,
|
|
2786
|
+
contentInsetAdjustmentBehavior: "never",
|
|
1644
2787
|
setSupportMultipleWindows: false,
|
|
1645
2788
|
originWhitelist: ["https://*"],
|
|
1646
|
-
style
|
|
2789
|
+
style: [{ backgroundColor: theme.colors.bgModal }, style]
|
|
1647
2790
|
}
|
|
1648
2791
|
);
|
|
1649
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
|
+
};
|
|
1650
2802
|
|
|
1651
2803
|
// src/swapped/SwappedScreen.tsx
|
|
1652
|
-
import { jsx as
|
|
2804
|
+
import { jsx as jsx17 } from "react/jsx-runtime";
|
|
1653
2805
|
function SwappedScreen({
|
|
1654
2806
|
url,
|
|
1655
2807
|
onClose,
|
|
1656
2808
|
onBack,
|
|
1657
2809
|
onSuccess
|
|
1658
2810
|
}) {
|
|
1659
|
-
const handleMessage =
|
|
2811
|
+
const handleMessage = useCallback3(
|
|
1660
2812
|
(msg) => {
|
|
1661
2813
|
switch (msg.type) {
|
|
1662
2814
|
case "SWAPPED_GO_BACK":
|
|
@@ -1681,35 +2833,95 @@ function SwappedScreen({
|
|
|
1681
2833
|
},
|
|
1682
2834
|
[onBack, onClose, onSuccess]
|
|
1683
2835
|
);
|
|
1684
|
-
return /* @__PURE__ */
|
|
2836
|
+
return /* @__PURE__ */ jsx17(
|
|
1685
2837
|
Box,
|
|
1686
2838
|
{
|
|
1687
2839
|
backgroundColor: "bgModal",
|
|
1688
2840
|
borderTopLeftRadius: "modal",
|
|
1689
2841
|
borderTopRightRadius: "modal",
|
|
1690
|
-
style:
|
|
1691
|
-
children: /* @__PURE__ */
|
|
2842
|
+
style: sheet3,
|
|
2843
|
+
children: /* @__PURE__ */ jsx17(SwappedWebView, { url, onMessage: handleMessage, style: fill })
|
|
1692
2844
|
}
|
|
1693
2845
|
);
|
|
1694
2846
|
}
|
|
1695
2847
|
var SHEET_HEIGHT = 550;
|
|
1696
|
-
var
|
|
2848
|
+
var sheet3 = { height: SHEET_HEIGHT, overflow: "hidden" };
|
|
1697
2849
|
var fill = { flex: 1 };
|
|
1698
2850
|
|
|
1699
|
-
// src/transfer/
|
|
1700
|
-
import
|
|
1701
|
-
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
|
|
1707
|
-
|
|
1708
|
-
|
|
1709
|
-
|
|
1710
|
-
|
|
1711
|
-
|
|
1712
|
-
|
|
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;
|
|
1713
2925
|
}
|
|
1714
2926
|
|
|
1715
2927
|
// src/transfer/clipboard.ts
|
|
@@ -1720,7 +2932,7 @@ async function copyToClipboard(value) {
|
|
|
1720
2932
|
return true;
|
|
1721
2933
|
} catch (error) {
|
|
1722
2934
|
logger.warn(
|
|
1723
|
-
"connect-rn: clipboard
|
|
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).",
|
|
1724
2936
|
{ error: error instanceof Error ? error.message : String(error) }
|
|
1725
2937
|
);
|
|
1726
2938
|
return false;
|
|
@@ -1764,71 +2976,23 @@ import {
|
|
|
1764
2976
|
} from "@funkit/api-base";
|
|
1765
2977
|
import {
|
|
1766
2978
|
FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS,
|
|
1767
|
-
solanaChain
|
|
2979
|
+
solanaChain as solanaChain2
|
|
1768
2980
|
} from "@funkit/chains";
|
|
1769
2981
|
import {
|
|
2982
|
+
DEFAULT_FIAT_CURRENCY,
|
|
1770
2983
|
FOPS_STALE_TIME,
|
|
1771
2984
|
getDepositAddressForChain,
|
|
1772
2985
|
sortFops,
|
|
1773
|
-
useDynamicConfig as
|
|
2986
|
+
useDynamicConfig as useDynamicConfig3,
|
|
2987
|
+
useSwappedDefaultCurrencyQuery
|
|
1774
2988
|
} from "@funkit/connect-core";
|
|
2989
|
+
import { useTheme as useTheme3 } from "@shopify/restyle";
|
|
1775
2990
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
1776
|
-
|
|
1777
|
-
// src/geo/useUserIpInfo.ts
|
|
1778
|
-
import { useQuery } from "@tanstack/react-query";
|
|
1779
|
-
var MOONPAY_LIVE_API_KEY = "pk_live_IxayBRQuBC3RzpPZkbGPrwUsRWAaeO";
|
|
1780
|
-
function errData(error) {
|
|
1781
|
-
return { error: error instanceof Error ? error.message : String(error) };
|
|
1782
|
-
}
|
|
1783
|
-
async function getIpViaMoonpay() {
|
|
1784
|
-
const res = await fetch(
|
|
1785
|
-
`https://api.moonpay.com/v3/ip_address?apiKey=${MOONPAY_LIVE_API_KEY}`
|
|
1786
|
-
);
|
|
1787
|
-
if (!res.ok) {
|
|
1788
|
-
throw new Error(res.statusText);
|
|
1789
|
-
}
|
|
1790
|
-
const data = await res.json();
|
|
1791
|
-
return { alpha2: data.alpha2, state: data.state };
|
|
1792
|
-
}
|
|
1793
|
-
async function getIpViaIpApi() {
|
|
1794
|
-
const res = await fetch("https://ipapi.co/json");
|
|
1795
|
-
if (!res.ok) {
|
|
1796
|
-
throw new Error(res.statusText);
|
|
1797
|
-
}
|
|
1798
|
-
const data = await res.json();
|
|
1799
|
-
return { alpha2: data.country_code, state: data.region_code };
|
|
1800
|
-
}
|
|
1801
|
-
function useUserIpInfo() {
|
|
1802
|
-
const { data: userIpInfo, isLoading: isLoadingGeoCheck } = useQuery({
|
|
1803
|
-
queryKey: ["getUserIpInfo"],
|
|
1804
|
-
queryFn: async () => {
|
|
1805
|
-
try {
|
|
1806
|
-
return await getIpViaMoonpay();
|
|
1807
|
-
} catch (moonpayError) {
|
|
1808
|
-
logger.warn(
|
|
1809
|
-
"connect-rn:getUserIpViaMoonpay:error",
|
|
1810
|
-
errData(moonpayError)
|
|
1811
|
-
);
|
|
1812
|
-
try {
|
|
1813
|
-
return await getIpViaIpApi();
|
|
1814
|
-
} catch (ipApiError) {
|
|
1815
|
-
logger.warn("connect-rn:getUserIpViaIpApi:error", errData(ipApiError));
|
|
1816
|
-
throw ipApiError;
|
|
1817
|
-
}
|
|
1818
|
-
}
|
|
1819
|
-
},
|
|
1820
|
-
// Location is stable within a session; don't refetch aggressively.
|
|
1821
|
-
staleTime: Number.POSITIVE_INFINITY,
|
|
1822
|
-
refetchOnMount: false,
|
|
1823
|
-
refetchOnReconnect: true,
|
|
1824
|
-
refetchOnWindowFocus: false
|
|
1825
|
-
});
|
|
1826
|
-
return { userIpInfo, isLoadingGeoCheck };
|
|
1827
|
-
}
|
|
2991
|
+
import { useMemo as useMemo6 } from "react";
|
|
1828
2992
|
|
|
1829
2993
|
// src/identity/IdentityContext.tsx
|
|
1830
2994
|
import { createContext as createContext2, useContext as useContext2 } from "react";
|
|
1831
|
-
import { jsx as
|
|
2995
|
+
import { jsx as jsx18 } from "react/jsx-runtime";
|
|
1832
2996
|
function generateSyntheticUserId(apiKey, externalUserId) {
|
|
1833
2997
|
return `${apiKey}|${externalUserId}`;
|
|
1834
2998
|
}
|
|
@@ -1847,7 +3011,7 @@ function FunkitIdentityProvider({
|
|
|
1847
3011
|
identity,
|
|
1848
3012
|
children
|
|
1849
3013
|
}) {
|
|
1850
|
-
return /* @__PURE__ */
|
|
3014
|
+
return /* @__PURE__ */ jsx18(FunkitIdentityContext.Provider, { value: identity, children });
|
|
1851
3015
|
}
|
|
1852
3016
|
function useFunkitIdentity() {
|
|
1853
3017
|
const identity = useContext2(FunkitIdentityContext);
|
|
@@ -1869,11 +3033,11 @@ import {
|
|
|
1869
3033
|
import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
1870
3034
|
|
|
1871
3035
|
// src/transfer/hooks/useUDAParams.ts
|
|
1872
|
-
import { useDynamicConfig } from "@funkit/connect-core";
|
|
1873
|
-
import { useMemo as
|
|
3036
|
+
import { useDynamicConfig as useDynamicConfig2 } from "@funkit/connect-core";
|
|
3037
|
+
import { useMemo as useMemo5 } from "react";
|
|
1874
3038
|
function useUDAParams(dynamicRoutingId) {
|
|
1875
|
-
const udaParams =
|
|
1876
|
-
return
|
|
3039
|
+
const udaParams = useDynamicConfig2("uda_params");
|
|
3040
|
+
return useMemo5(
|
|
1877
3041
|
() => udaParams.find((param) => param.dynamicRoutingId === dynamicRoutingId)?.params,
|
|
1878
3042
|
[udaParams, dynamicRoutingId]
|
|
1879
3043
|
);
|
|
@@ -1917,7 +3081,6 @@ function useTransferInit({
|
|
|
1917
3081
|
}
|
|
1918
3082
|
|
|
1919
3083
|
// src/transfer/hooks/useFops.ts
|
|
1920
|
-
var DEFAULT_FIAT_CURRENCY = "USD";
|
|
1921
3084
|
var DEFAULT_COUNTRY_CODE = "US";
|
|
1922
3085
|
function useFops({
|
|
1923
3086
|
checkoutConfig,
|
|
@@ -1925,10 +3088,23 @@ function useFops({
|
|
|
1925
3088
|
enabled = true
|
|
1926
3089
|
}) {
|
|
1927
3090
|
const { apiKey, userId } = useFunkitIdentity();
|
|
1928
|
-
const isSwappedEnabled = !!
|
|
1929
|
-
const fopPriority =
|
|
3091
|
+
const isSwappedEnabled = !!useDynamicConfig3("enableswappeddeposit");
|
|
3092
|
+
const fopPriority = useDynamicConfig3("foppriority");
|
|
1930
3093
|
const { userIpInfo } = useUserIpInfo();
|
|
1931
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
|
+
);
|
|
1932
3108
|
const {
|
|
1933
3109
|
transferInit,
|
|
1934
3110
|
isLoading: isTransferInitLoading,
|
|
@@ -1941,7 +3117,7 @@ function useFops({
|
|
|
1941
3117
|
const targetAsset = checkoutConfig?.targetAsset;
|
|
1942
3118
|
const targetChain = checkoutConfig?.targetChain;
|
|
1943
3119
|
const recipientAddress = targetChain ? getDepositAddressForChain(Number(targetChain), transferInit) : void 0;
|
|
1944
|
-
const isEnabled = enabled && isSwappedEnabled && !!apiKey && !!targetAsset && !!targetChain && !!recipientAddress && !!transferInit;
|
|
3120
|
+
const isEnabled = enabled && isSwappedEnabled && !!apiKey && !!targetAsset && !!targetChain && !!recipientAddress && !!transferInit && !isSwappedCurrencyCodeLoading;
|
|
1945
3121
|
const query = useQuery3({
|
|
1946
3122
|
queryKey: [
|
|
1947
3123
|
"fops",
|
|
@@ -1951,7 +3127,9 @@ function useFops({
|
|
|
1951
3127
|
targetChain,
|
|
1952
3128
|
apiKey,
|
|
1953
3129
|
countryCode,
|
|
1954
|
-
|
|
3130
|
+
swappedCurrencyCode,
|
|
3131
|
+
fopPriority,
|
|
3132
|
+
themeConfig
|
|
1955
3133
|
],
|
|
1956
3134
|
queryFn: async () => {
|
|
1957
3135
|
if (!recipientAddress || !targetChain || !targetAsset) {
|
|
@@ -1964,7 +3142,7 @@ function useFops({
|
|
|
1964
3142
|
{
|
|
1965
3143
|
recipientAddress: transferInit.solanaAddr,
|
|
1966
3144
|
destinationToken: {
|
|
1967
|
-
chainId:
|
|
3145
|
+
chainId: solanaChain2.id.toString(),
|
|
1968
3146
|
address: FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS
|
|
1969
3147
|
}
|
|
1970
3148
|
}
|
|
@@ -1977,9 +3155,10 @@ function useFops({
|
|
|
1977
3155
|
recipientAddress,
|
|
1978
3156
|
userId,
|
|
1979
3157
|
destinationToken,
|
|
1980
|
-
fiatCurrencyCode:
|
|
3158
|
+
fiatCurrencyCode: swappedCurrencyCode,
|
|
1981
3159
|
countryCode,
|
|
1982
|
-
recipientTargets
|
|
3160
|
+
recipientTargets,
|
|
3161
|
+
thirdPartyPaymentConfigs: { swapped: { themeConfig } }
|
|
1983
3162
|
}
|
|
1984
3163
|
});
|
|
1985
3164
|
return {
|
|
@@ -2002,6 +3181,8 @@ function useFops({
|
|
|
2002
3181
|
genericFops: query.data?.genericFormsOfPayments ?? [],
|
|
2003
3182
|
isLoading: query.isLoading || isTransferInitLoading,
|
|
2004
3183
|
isFetching: isTransferInitFetching,
|
|
3184
|
+
isError: query.isError,
|
|
3185
|
+
refetch: () => void query.refetch(),
|
|
2005
3186
|
isSwappedEnabled
|
|
2006
3187
|
};
|
|
2007
3188
|
}
|
|
@@ -2011,10 +3192,10 @@ import { getSupportedAssets } from "@funkit/api-base";
|
|
|
2011
3192
|
import {
|
|
2012
3193
|
isTransferChainEnabled,
|
|
2013
3194
|
resolveTokenTransferConfig,
|
|
2014
|
-
useDynamicConfig as
|
|
3195
|
+
useDynamicConfig as useDynamicConfig4
|
|
2015
3196
|
} from "@funkit/connect-core";
|
|
2016
3197
|
import { useQuery as useQuery4 } from "@tanstack/react-query";
|
|
2017
|
-
import { useMemo as
|
|
3198
|
+
import { useMemo as useMemo7 } from "react";
|
|
2018
3199
|
|
|
2019
3200
|
// src/transfer/supportedTokens.ts
|
|
2020
3201
|
function buildSupportedTokenList(resolved) {
|
|
@@ -2043,21 +3224,6 @@ function buildSupportedTokenList(resolved) {
|
|
|
2043
3224
|
tokens.sort((a, b) => rank(a.symbol) - rank(b.symbol));
|
|
2044
3225
|
return { tokens, chainFilters };
|
|
2045
3226
|
}
|
|
2046
|
-
function filterSupportedTokens(tokens, {
|
|
2047
|
-
search = "",
|
|
2048
|
-
chainFilterId = "all"
|
|
2049
|
-
}) {
|
|
2050
|
-
const query = search.trim().toLowerCase();
|
|
2051
|
-
return tokens.filter((token) => {
|
|
2052
|
-
if (chainFilterId !== "all" && String(token.chainId) !== chainFilterId) {
|
|
2053
|
-
return false;
|
|
2054
|
-
}
|
|
2055
|
-
if (!query) {
|
|
2056
|
-
return true;
|
|
2057
|
-
}
|
|
2058
|
-
return token.symbol.toLowerCase().includes(query) || token.chainLabel.toLowerCase().includes(query);
|
|
2059
|
-
});
|
|
2060
|
-
}
|
|
2061
3227
|
|
|
2062
3228
|
// src/transfer/hooks/useSupportedTokens.ts
|
|
2063
3229
|
function useSupportedTokens({
|
|
@@ -2065,8 +3231,8 @@ function useSupportedTokens({
|
|
|
2065
3231
|
transferInit
|
|
2066
3232
|
} = {}) {
|
|
2067
3233
|
const { apiKey } = useFunkitIdentity();
|
|
2068
|
-
const tokenTransferConfig =
|
|
2069
|
-
const disabledChainAssets =
|
|
3234
|
+
const tokenTransferConfig = useDynamicConfig4("tokentransferconfig");
|
|
3235
|
+
const disabledChainAssets = useDynamicConfig4(
|
|
2070
3236
|
"disabletokentransferchainsandassets"
|
|
2071
3237
|
);
|
|
2072
3238
|
const { data, isLoading } = useQuery4({
|
|
@@ -2076,7 +3242,7 @@ function useSupportedTokens({
|
|
|
2076
3242
|
staleTime: 5 * 6e4,
|
|
2077
3243
|
refetchOnWindowFocus: false
|
|
2078
3244
|
});
|
|
2079
|
-
const { tokens, chainFilters } =
|
|
3245
|
+
const { tokens, chainFilters } = useMemo7(() => {
|
|
2080
3246
|
if (!data) {
|
|
2081
3247
|
return { tokens: [], chainFilters: [{ id: "all", label: "All" }] };
|
|
2082
3248
|
}
|
|
@@ -2100,22 +3266,22 @@ function useSupportedTokens({
|
|
|
2100
3266
|
}
|
|
2101
3267
|
|
|
2102
3268
|
// src/transfer/hooks/useTokenTransfer.ts
|
|
2103
|
-
import { bitcoinChain, solanaChain as
|
|
3269
|
+
import { bitcoinChain as bitcoinChain2, solanaChain as solanaChain3, tronChain as tronChain2 } from "@funkit/chains";
|
|
2104
3270
|
import {
|
|
2105
3271
|
getDepositAddressForChain as getDepositAddressForChain2,
|
|
2106
|
-
getMinTransferValueForChain,
|
|
3272
|
+
getMinTransferValueForChain as getMinTransferValueForChain2,
|
|
2107
3273
|
getTransferTokenQrCodeUri,
|
|
2108
|
-
useDynamicConfig as
|
|
3274
|
+
useDynamicConfig as useDynamicConfig5
|
|
2109
3275
|
} from "@funkit/connect-core";
|
|
2110
3276
|
var DEFAULT_MAX_SLIPPAGE_PERCENT = 0.25;
|
|
2111
3277
|
function resolveBlockchain(chainId) {
|
|
2112
|
-
if (chainId ===
|
|
3278
|
+
if (chainId === solanaChain3.id) {
|
|
2113
3279
|
return "solana";
|
|
2114
3280
|
}
|
|
2115
|
-
if (chainId ===
|
|
3281
|
+
if (chainId === bitcoinChain2.id) {
|
|
2116
3282
|
return "bitcoin";
|
|
2117
3283
|
}
|
|
2118
|
-
if (chainId ===
|
|
3284
|
+
if (chainId === tronChain2.id) {
|
|
2119
3285
|
return "tron";
|
|
2120
3286
|
}
|
|
2121
3287
|
return "ethereum";
|
|
@@ -2131,9 +3297,9 @@ function useTokenTransfer({
|
|
|
2131
3297
|
dynamicRoutingId,
|
|
2132
3298
|
enabled
|
|
2133
3299
|
});
|
|
2134
|
-
const minTransferLimits =
|
|
3300
|
+
const minTransferLimits = useDynamicConfig5("mintokentransfervalue");
|
|
2135
3301
|
const minTransferUsd = selectedChainId !== void 0 ? Math.ceil(
|
|
2136
|
-
|
|
3302
|
+
getMinTransferValueForChain2(selectedChainId, minTransferLimits)
|
|
2137
3303
|
) : 0;
|
|
2138
3304
|
const depositAddress = selectedChainId !== void 0 ? getDepositAddressForChain2(selectedChainId, transferInit) : void 0;
|
|
2139
3305
|
const blockchain = resolveBlockchain(selectedChainId);
|
|
@@ -2150,35 +3316,217 @@ function useTokenTransfer({
|
|
|
2150
3316
|
};
|
|
2151
3317
|
}
|
|
2152
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
|
+
|
|
2153
3482
|
// src/flow/FunkitFlowProvider.tsx
|
|
2154
|
-
import { jsx as
|
|
3483
|
+
import { jsx as jsx21, jsxs as jsxs11 } from "react/jsx-runtime";
|
|
2155
3484
|
var CLOSED = {
|
|
2156
3485
|
isOpen: false,
|
|
2157
3486
|
stack: [],
|
|
2158
3487
|
config: null,
|
|
2159
|
-
callbacks: {}
|
|
3488
|
+
callbacks: {},
|
|
3489
|
+
session: 0
|
|
2160
3490
|
};
|
|
2161
3491
|
var FunkitFlowContext = createContext3(null);
|
|
2162
|
-
function FunkitFlowProvider({
|
|
2163
|
-
|
|
2164
|
-
|
|
3492
|
+
function FunkitFlowProvider({
|
|
3493
|
+
children,
|
|
3494
|
+
copyToClipboard: copyToClipboard2 = copyToClipboard
|
|
3495
|
+
}) {
|
|
3496
|
+
const [state, setState] = useState9(CLOSED);
|
|
3497
|
+
const beginDeposit = useCallback5(
|
|
2165
3498
|
(config, callbacks = {}) => {
|
|
2166
3499
|
callbacks.onOpen?.();
|
|
2167
|
-
setState(
|
|
3500
|
+
setState((prev) => ({
|
|
3501
|
+
isOpen: true,
|
|
3502
|
+
stack: ["addMoney"],
|
|
3503
|
+
config,
|
|
3504
|
+
callbacks,
|
|
3505
|
+
session: prev.session + 1
|
|
3506
|
+
}));
|
|
2168
3507
|
},
|
|
2169
3508
|
[]
|
|
2170
3509
|
);
|
|
2171
|
-
const
|
|
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(() => {
|
|
2172
3517
|
setState((prev) => {
|
|
3518
|
+
if (!prev.isOpen) return prev;
|
|
2173
3519
|
prev.callbacks.onClose?.();
|
|
2174
3520
|
return CLOSED;
|
|
2175
3521
|
});
|
|
2176
|
-
|
|
2177
|
-
|
|
3522
|
+
clearToast();
|
|
3523
|
+
}, [clearToast]);
|
|
3524
|
+
const navigate = useCallback5((screen) => {
|
|
2178
3525
|
setState((prev) => ({ ...prev, stack: [...prev.stack, screen] }));
|
|
2179
3526
|
}, []);
|
|
2180
|
-
const back =
|
|
3527
|
+
const back = useCallback5(() => {
|
|
2181
3528
|
setState((prev) => {
|
|
3529
|
+
if (!prev.isOpen) return prev;
|
|
2182
3530
|
if (prev.stack.length <= 1) {
|
|
2183
3531
|
prev.callbacks.onClose?.();
|
|
2184
3532
|
return CLOSED;
|
|
@@ -2186,201 +3534,310 @@ function FunkitFlowProvider({ children }) {
|
|
|
2186
3534
|
return { ...prev, stack: prev.stack.slice(0, -1) };
|
|
2187
3535
|
});
|
|
2188
3536
|
}, []);
|
|
2189
|
-
const value =
|
|
3537
|
+
const value = useMemo8(
|
|
2190
3538
|
() => ({ beginDeposit, closeFlow }),
|
|
2191
3539
|
[beginDeposit, closeFlow]
|
|
2192
3540
|
);
|
|
2193
3541
|
const current = state.stack[state.stack.length - 1];
|
|
2194
|
-
const nav =
|
|
3542
|
+
const nav = useMemo8(
|
|
2195
3543
|
() => ({ navigate, back, closeFlow }),
|
|
2196
3544
|
[navigate, back, closeFlow]
|
|
2197
3545
|
);
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
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,
|
|
2202
3571
|
{
|
|
2203
|
-
|
|
2204
|
-
|
|
2205
|
-
|
|
2206
|
-
|
|
2207
|
-
|
|
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
|
|
2208
3591
|
}
|
|
2209
|
-
)
|
|
2210
|
-
|
|
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;
|
|
2211
3603
|
}
|
|
2212
3604
|
function FlowContent({
|
|
2213
3605
|
config,
|
|
2214
3606
|
current,
|
|
2215
|
-
nav
|
|
3607
|
+
nav,
|
|
3608
|
+
copyToClipboard: copyToClipboard2,
|
|
3609
|
+
onCopySuccess,
|
|
3610
|
+
callbacks
|
|
2216
3611
|
}) {
|
|
2217
|
-
const
|
|
2218
|
-
|
|
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
|
|
2219
3635
|
);
|
|
2220
|
-
const selectedChainId = selectedChain?.chainId ?? config.selectedChainId;
|
|
2221
|
-
const networkLabel = selectedChain?.label ?? config.networkLabel;
|
|
2222
|
-
const networkIconKeys = selectedChain?.iconKeys ?? config.networkIconChains ?? [];
|
|
2223
3636
|
const {
|
|
2224
3637
|
depositAddress: generatedAddress,
|
|
2225
3638
|
qrCodeUri,
|
|
2226
|
-
transferInit
|
|
3639
|
+
transferInit,
|
|
3640
|
+
isLoading: isAddressLoading
|
|
2227
3641
|
} = useTokenTransfer({
|
|
2228
|
-
checkoutConfig:
|
|
3642
|
+
checkoutConfig: activeCheckoutConfig,
|
|
2229
3643
|
selectedChainId,
|
|
2230
|
-
dynamicRoutingId:
|
|
3644
|
+
dynamicRoutingId: activeDynamicRoutingId,
|
|
2231
3645
|
enabled: true
|
|
2232
3646
|
});
|
|
2233
3647
|
const fetched = useSupportedTokens({ transferInit });
|
|
2234
|
-
const supportedTokens = config.supportedTokens ?? fetched.tokens;
|
|
2235
3648
|
const tokenChainFilters = config.tokenChainFilters ?? fetched.chainFilters;
|
|
2236
|
-
const
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
const
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
const
|
|
2244
|
-
|
|
2245
|
-
|
|
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
|
|
2246
3668
|
});
|
|
2247
|
-
const
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
chainId: token.chainId
|
|
2258
|
-
}
|
|
2259
|
-
);
|
|
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
|
|
2260
3679
|
}
|
|
2261
|
-
|
|
2262
|
-
|
|
3680
|
+
});
|
|
3681
|
+
const singleChain = availableChains.length === 1 ? availableChains[0] : void 0;
|
|
2263
3682
|
const rawAddress = generatedAddress ?? config.depositAddress;
|
|
2264
3683
|
const displayAddress = rawAddress ? formatDepositAddress(rawAddress) : "Generating\u2026";
|
|
2265
|
-
const
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2282
|
-
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
}
|
|
2291
|
-
if (id.includes(":")) {
|
|
2292
|
-
const fop = [...savedFops, ...genericFops].find(
|
|
2293
|
-
(f) => `${f.fopType}:${f.name}` === id
|
|
2294
|
-
);
|
|
2295
|
-
if (fop?.embeddedFlowUrl) {
|
|
2296
|
-
setSelectedSwappedUrl(fop.embeddedFlowUrl);
|
|
2297
|
-
nav.navigate("swapped");
|
|
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"
|
|
2298
3709
|
}
|
|
2299
|
-
|
|
2300
|
-
}
|
|
3710
|
+
) : void 0
|
|
2301
3711
|
}
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2314
|
-
|
|
2315
|
-
|
|
2316
|
-
|
|
2317
|
-
|
|
2318
|
-
|
|
2319
|
-
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
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
|
+
}
|
|
2332
3763
|
}
|
|
2333
|
-
nav.back();
|
|
2334
3764
|
}
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
|
|
2353
|
-
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
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, {});
|
|
2382
3825
|
}
|
|
3826
|
+
return screen;
|
|
2383
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
|
+
};
|
|
2384
3841
|
function useFunkitFlow() {
|
|
2385
3842
|
const value = useContext3(FunkitFlowContext);
|
|
2386
3843
|
if (value == null) {
|
|
@@ -2388,14 +3845,9 @@ function useFunkitFlow() {
|
|
|
2388
3845
|
}
|
|
2389
3846
|
return value;
|
|
2390
3847
|
}
|
|
2391
|
-
var backdrop = {
|
|
2392
|
-
flex: 1,
|
|
2393
|
-
backgroundColor: "rgba(0,0,0,0.45)",
|
|
2394
|
-
justifyContent: "flex-end"
|
|
2395
|
-
};
|
|
2396
3848
|
|
|
2397
3849
|
// src/version.ts
|
|
2398
|
-
var CONNECT_RN_VERSION = true ? "
|
|
3850
|
+
var CONNECT_RN_VERSION = true ? "1.0.0" : "0.0.0-dev";
|
|
2399
3851
|
|
|
2400
3852
|
// src/providers/FunkitStatsigProvider.tsx
|
|
2401
3853
|
import {
|
|
@@ -2403,7 +3855,7 @@ import {
|
|
|
2403
3855
|
LogLevel,
|
|
2404
3856
|
StatsigProvider
|
|
2405
3857
|
} from "@statsig/react-bindings";
|
|
2406
|
-
import { useMemo as
|
|
3858
|
+
import { useMemo as useMemo9 } from "react";
|
|
2407
3859
|
|
|
2408
3860
|
// src/statsig/useClientAsyncInitRN.ts
|
|
2409
3861
|
import {
|
|
@@ -2540,13 +3992,13 @@ function applyNetworkFix(options) {
|
|
|
2540
3992
|
}
|
|
2541
3993
|
|
|
2542
3994
|
// src/statsig/statsigMetadata.ts
|
|
2543
|
-
import { NativeModules, Platform } from "react-native";
|
|
3995
|
+
import { NativeModules, Platform as Platform3 } from "react-native";
|
|
2544
3996
|
function resolveLocale() {
|
|
2545
|
-
if (
|
|
3997
|
+
if (Platform3.OS === "android") {
|
|
2546
3998
|
const i18nManager = NativeModules.I18nManager;
|
|
2547
|
-
return i18nManager?.
|
|
3999
|
+
return i18nManager?.localeIdentifier ?? void 0;
|
|
2548
4000
|
}
|
|
2549
|
-
if (
|
|
4001
|
+
if (Platform3.OS === "ios") {
|
|
2550
4002
|
const settings = NativeModules.SettingsManager?.settings;
|
|
2551
4003
|
return settings?.AppLocale ?? settings?.AppleLanguages?.[0] ?? void 0;
|
|
2552
4004
|
}
|
|
@@ -2560,7 +4012,7 @@ function getStatsigMetadataAdditions() {
|
|
|
2560
4012
|
deviceModelName: void 0,
|
|
2561
4013
|
deviceModel: void 0,
|
|
2562
4014
|
// Available without any native module:
|
|
2563
|
-
systemName:
|
|
4015
|
+
systemName: Platform3.OS,
|
|
2564
4016
|
locale: resolveLocale()
|
|
2565
4017
|
};
|
|
2566
4018
|
}
|
|
@@ -2588,7 +4040,7 @@ function useClientAsyncInitRN(sdkKey, initialUser, statsigOptions = null) {
|
|
|
2588
4040
|
}
|
|
2589
4041
|
|
|
2590
4042
|
// src/providers/FunkitStatsigProvider.tsx
|
|
2591
|
-
import { jsx as
|
|
4043
|
+
import { jsx as jsx22 } from "react/jsx-runtime";
|
|
2592
4044
|
var STATSIG_API = "https://data-api.fun.xyz/v1";
|
|
2593
4045
|
var STATSIG_CLIENT_KEY = "client-UmFd8WIJljA7cLmZuDqs3X25M8sKd5WIQP4BSC2bRbM";
|
|
2594
4046
|
function FunkitStatsigProvider({
|
|
@@ -2597,7 +4049,7 @@ function FunkitStatsigProvider({
|
|
|
2597
4049
|
userId,
|
|
2598
4050
|
isDevelopment = false
|
|
2599
4051
|
}) {
|
|
2600
|
-
const user =
|
|
4052
|
+
const user = useMemo9(
|
|
2601
4053
|
() => ({ userID: userId, customIDs: { apiKey } }),
|
|
2602
4054
|
[userId, apiKey]
|
|
2603
4055
|
);
|
|
@@ -2616,11 +4068,11 @@ function FunkitStatsigProvider({
|
|
|
2616
4068
|
tier: isDevelopment ? "development" : "production"
|
|
2617
4069
|
}
|
|
2618
4070
|
});
|
|
2619
|
-
return /* @__PURE__ */
|
|
4071
|
+
return /* @__PURE__ */ jsx22(StatsigProvider, { client, children });
|
|
2620
4072
|
}
|
|
2621
4073
|
|
|
2622
4074
|
// src/providers/FunkitProvider.tsx
|
|
2623
|
-
import { jsx as
|
|
4075
|
+
import { jsx as jsx23 } from "react/jsx-runtime";
|
|
2624
4076
|
var ANONYMOUS_CONFIG = { apiKey: "" };
|
|
2625
4077
|
function FunkitProvider({
|
|
2626
4078
|
children,
|
|
@@ -2629,22 +4081,23 @@ function FunkitProvider({
|
|
|
2629
4081
|
queryClient,
|
|
2630
4082
|
themes,
|
|
2631
4083
|
colorScheme,
|
|
2632
|
-
debug = false
|
|
4084
|
+
debug = false,
|
|
4085
|
+
copyToClipboard: copyToClipboard2
|
|
2633
4086
|
}) {
|
|
2634
|
-
const fallbackClient =
|
|
4087
|
+
const fallbackClient = useRef7(void 0);
|
|
2635
4088
|
fallbackClient.current ??= new QueryClient();
|
|
2636
4089
|
const client = queryClient ?? fallbackClient.current;
|
|
2637
|
-
const identity =
|
|
4090
|
+
const identity = useMemo10(
|
|
2638
4091
|
() => resolveFunkitIdentity(config ?? ANONYMOUS_CONFIG, walletAddress),
|
|
2639
4092
|
[config, walletAddress]
|
|
2640
4093
|
);
|
|
2641
|
-
|
|
4094
|
+
useEffect12(() => {
|
|
2642
4095
|
if (!config?.apiKey) {
|
|
2643
4096
|
return;
|
|
2644
4097
|
}
|
|
2645
4098
|
logger.configure(config.apiKey, debug, CONNECT_RN_VERSION);
|
|
2646
4099
|
}, [config?.apiKey, debug]);
|
|
2647
|
-
|
|
4100
|
+
useEffect12(() => {
|
|
2648
4101
|
logger.setUserInfo(
|
|
2649
4102
|
identity.userId,
|
|
2650
4103
|
identity.walletAddress,
|
|
@@ -2653,28 +4106,29 @@ function FunkitProvider({
|
|
|
2653
4106
|
""
|
|
2654
4107
|
);
|
|
2655
4108
|
}, [identity]);
|
|
2656
|
-
return /* @__PURE__ */
|
|
4109
|
+
return /* @__PURE__ */ jsx23(
|
|
2657
4110
|
FunkitStatsigProvider,
|
|
2658
4111
|
{
|
|
2659
4112
|
apiKey: identity.apiKey,
|
|
2660
4113
|
userId: identity.userId,
|
|
2661
4114
|
isDevelopment: debug,
|
|
2662
|
-
children: /* @__PURE__ */
|
|
4115
|
+
children: /* @__PURE__ */ jsx23(QueryClientProvider, { client, children: /* @__PURE__ */ jsx23(FunkitIdentityProvider, { identity, children: /* @__PURE__ */ jsx23(FunkitThemeProvider, { themes, colorScheme, children: /* @__PURE__ */ jsx23(FunkitFlowProvider, { copyToClipboard: copyToClipboard2, children }) }) }) })
|
|
2663
4116
|
}
|
|
2664
4117
|
);
|
|
2665
4118
|
}
|
|
2666
4119
|
|
|
2667
4120
|
// src/providers/useFunkitCheckout.ts
|
|
2668
|
-
import { useCallback as
|
|
4121
|
+
import { useCallback as useCallback6 } from "react";
|
|
2669
4122
|
function useFunkitCheckout(callbacks = {}) {
|
|
2670
4123
|
const { beginDeposit: begin } = useFunkitFlow();
|
|
2671
|
-
const beginDeposit =
|
|
4124
|
+
const beginDeposit = useCallback6(
|
|
2672
4125
|
(config) => begin(config, callbacks),
|
|
2673
4126
|
[begin, callbacks]
|
|
2674
4127
|
);
|
|
2675
4128
|
return { beginDeposit };
|
|
2676
4129
|
}
|
|
2677
4130
|
export {
|
|
4131
|
+
AddressCopiedToast,
|
|
2678
4132
|
Box,
|
|
2679
4133
|
FunkitProvider,
|
|
2680
4134
|
FunkitThemeProvider,
|
|
@@ -2682,6 +4136,7 @@ export {
|
|
|
2682
4136
|
darkTokens,
|
|
2683
4137
|
defaultDarkTheme,
|
|
2684
4138
|
defaultLightTheme,
|
|
4139
|
+
fontFamilyForWeight,
|
|
2685
4140
|
lightTokens,
|
|
2686
4141
|
normalizeColorScheme,
|
|
2687
4142
|
resolveColorScheme,
|