@funkit/connect-rn 0.2.0 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +72 -0
- package/dist/index.d.ts +11 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3595 -612
- 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 +23 -0
- package/dist/src/flow/FunkitFlowProvider.d.ts.map +1 -0
- package/dist/src/flow/depositFlowConfig.d.ts +101 -0
- package/dist/src/flow/depositFlowConfig.d.ts.map +1 -0
- 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/geo/useUserIpInfo.d.ts +22 -0
- package/dist/src/geo/useUserIpInfo.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 +18 -0
- package/dist/src/icons/FunIcon.d.ts.map +1 -0
- 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/icons/assetLogos.d.ts +12 -0
- package/dist/src/icons/assetLogos.d.ts.map +1 -0
- package/dist/src/icons/funIconUri.d.ts +16 -0
- package/dist/src/icons/funIconUri.d.ts.map +1 -0
- package/dist/src/identity/IdentityContext.d.ts +30 -1
- package/dist/src/identity/IdentityContext.d.ts.map +1 -1
- package/dist/src/logging/datadogHttpLogTransport.d.ts +0 -7
- package/dist/src/logging/datadogHttpLogTransport.d.ts.map +1 -1
- package/dist/src/providers/FunkitProvider.d.ts +37 -6
- package/dist/src/providers/FunkitProvider.d.ts.map +1 -1
- package/dist/src/providers/FunkitStatsigProvider.d.ts +6 -2
- package/dist/src/providers/FunkitStatsigProvider.d.ts.map +1 -1
- package/dist/src/providers/useFunkitCheckout.d.ts +14 -0
- package/dist/src/providers/useFunkitCheckout.d.ts.map +1 -0
- 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 -12
- package/dist/src/screens/TransferCryptoScreen.d.ts.map +1 -1
- package/dist/src/statsig/statsigMetadata.d.ts.map +1 -1
- package/dist/src/swapped/SwappedScreen.d.ts +21 -0
- package/dist/src/swapped/SwappedScreen.d.ts.map +1 -0
- package/dist/src/swapped/SwappedWebView.d.ts +18 -0
- package/dist/src/swapped/SwappedWebView.d.ts.map +1 -0
- 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 +74 -0
- package/dist/src/swapped/webViewSwappedTransport.d.ts.map +1 -0
- package/dist/src/theme/FunkitThemeProvider.d.ts +14 -2
- package/dist/src/theme/FunkitThemeProvider.d.ts.map +1 -1
- package/dist/src/theme/restyle.d.ts +1140 -513
- 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/theme/useFunkitTheme.d.ts +4 -10
- package/dist/src/theme/useFunkitTheme.d.ts.map +1 -1
- package/dist/src/transfer/QrCode.d.ts +24 -0
- package/dist/src/transfer/QrCode.d.ts.map +1 -0
- 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 +23 -0
- package/dist/src/transfer/clipboard.d.ts.map +1 -0
- package/dist/src/transfer/fops.d.ts +26 -0
- package/dist/src/transfer/fops.d.ts.map +1 -0
- package/dist/src/transfer/formatDepositAddress.d.ts +9 -0
- package/dist/src/transfer/formatDepositAddress.d.ts.map +1 -0
- package/dist/src/transfer/hooks/useFops.d.ts +47 -0
- package/dist/src/transfer/hooks/useFops.d.ts.map +1 -0
- package/dist/src/transfer/hooks/useSupportedTokens.d.ts +26 -0
- package/dist/src/transfer/hooks/useSupportedTokens.d.ts.map +1 -0
- package/dist/src/transfer/hooks/useTokenTransfer.d.ts +4 -2
- package/dist/src/transfer/hooks/useTokenTransfer.d.ts.map +1 -1
- package/dist/src/transfer/hooks/useTransferInit.d.ts +1 -1
- package/dist/src/transfer/hooks/useTransferInit.d.ts.map +1 -1
- package/dist/src/transfer/hooks/useUDAParams.d.ts +1 -1
- package/dist/src/transfer/hooks/useUDAParams.d.ts.map +1 -1
- package/dist/src/transfer/supportedTokens.d.ts +34 -0
- package/dist/src/transfer/supportedTokens.d.ts.map +1 -0
- package/dist/src/version.d.ts +2 -0
- package/dist/src/version.d.ts.map +1 -0
- package/package.json +31 -4
- package/dist/src/icons/CopyIcon.d.ts +0 -3
- package/dist/src/icons/CopyIcon.d.ts.map +0 -1
- package/dist/src/icons/NetworkIconFallback.d.ts +0 -3
- package/dist/src/icons/NetworkIconFallback.d.ts.map +0 -1
- package/dist/src/icons/QrCodeIcon.d.ts +0 -3
- package/dist/src/icons/QrCodeIcon.d.ts.map +0 -1
- package/dist/src/theme/colorSchemeContext.d.ts +0 -22
- package/dist/src/theme/colorSchemeContext.d.ts.map +0 -1
|
@@ -1,7 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { QueryClient } from '@tanstack/react-query';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
import { type FunkitConfig } from '../identity/IdentityContext';
|
|
2
4
|
import { type FunkitThemeProviderProps } from '../theme/FunkitThemeProvider';
|
|
5
|
+
import type { ClipboardWriter } from '../transfer/clipboard';
|
|
3
6
|
export interface FunkitProviderProps {
|
|
4
7
|
children: ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Identity config — `apiKey` (+ optional `externalUserId`). Mirrors the
|
|
10
|
+
* identity-relevant subset of the web SDK's `funkitConfig`. Required for the
|
|
11
|
+
* SDK to generate deposit addresses; when omitted, the deposit flow falls
|
|
12
|
+
* back to any host-supplied `depositAddress` on the flow config.
|
|
13
|
+
*/
|
|
14
|
+
config?: FunkitConfig;
|
|
15
|
+
/**
|
|
16
|
+
* The connected wallet address (default transfer recipient). On web this
|
|
17
|
+
* comes from wagmi; RN has no wallet provider, so the host passes it here.
|
|
18
|
+
*/
|
|
19
|
+
walletAddress?: string;
|
|
20
|
+
/**
|
|
21
|
+
* React Query client. Web requires the host to supply one; for single-provider
|
|
22
|
+
* RN ergonomics we default to an internally-created client when omitted (pass
|
|
23
|
+
* your own to share a cache with the rest of the app).
|
|
24
|
+
*/
|
|
25
|
+
queryClient?: QueryClient;
|
|
5
26
|
/**
|
|
6
27
|
* Light/dark Restyle theme set. Defaults to the built-in Fun Mobile themes.
|
|
7
28
|
* Forwarded to {@link FunkitThemeProvider}.
|
|
@@ -19,16 +40,26 @@ export interface FunkitProviderProps {
|
|
|
19
40
|
* Mirrors `@funkit/connect`'s `debug`.
|
|
20
41
|
*/
|
|
21
42
|
debug?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Clipboard write used by the deposit flow's "Copy address" buttons. Defaults
|
|
45
|
+
* to the bare-RN `@react-native-clipboard/clipboard` peer (lazily loaded).
|
|
46
|
+
* Inject your own to use a different module — e.g. pass `setStringAsync` from
|
|
47
|
+
* `expo-clipboard` when running in **Expo Go**, where the native module isn't
|
|
48
|
+
* linked. Return the write's success to drive the "Copied!" confirmation; a
|
|
49
|
+
* `void` return is treated as success.
|
|
50
|
+
*/
|
|
51
|
+
copyToClipboard?: ClipboardWriter;
|
|
22
52
|
}
|
|
23
53
|
/**
|
|
24
54
|
* Top-level, user-facing provider for `@funkit/connect-rn` — the single
|
|
25
55
|
* provider host apps mount around their tree.
|
|
26
56
|
*
|
|
27
|
-
* Composes the platform halves
|
|
28
|
-
*
|
|
29
|
-
*
|
|
30
|
-
*
|
|
57
|
+
* Composes the platform halves, mirroring the web `FunkitProvider` nesting
|
|
58
|
+
* (Statsig flags → React Query → identity → theme → the managed flow). Statsig
|
|
59
|
+
* stays outermost so flags are available everywhere; the deposit-flow query
|
|
60
|
+
* hooks below it read identity from {@link FunkitIdentityProvider} and run on
|
|
61
|
+
* the {@link QueryClientProvider}. Host integration stays a single
|
|
31
62
|
* `<FunkitProvider>`.
|
|
32
63
|
*/
|
|
33
|
-
export declare function FunkitProvider({ children, themes, colorScheme, debug, }: FunkitProviderProps): import("react
|
|
64
|
+
export declare function FunkitProvider({ children, config, walletAddress, queryClient, themes, colorScheme, debug, copyToClipboard, }: FunkitProviderProps): import("react").JSX.Element;
|
|
34
65
|
//# sourceMappingURL=FunkitProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunkitProvider.d.ts","sourceRoot":"","sources":["../../../src/providers/FunkitProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"FunkitProvider.d.ts","sourceRoot":"","sources":["../../../src/providers/FunkitProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAuB,MAAM,uBAAuB,CAAA;AACxE,OAAO,EAAE,KAAK,SAAS,EAA8B,MAAM,OAAO,CAAA;AAGlE,OAAO,EACL,KAAK,YAAY,EAGlB,MAAM,6BAA6B,CAAA;AAEpC,OAAO,EAEL,KAAK,wBAAwB,EAC9B,MAAM,8BAA8B,CAAA;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAI5D,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,SAAS,CAAA;IACnB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,YAAY,CAAA;IACrB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAA;IACzB;;;OAGG;IACH,MAAM,CAAC,EAAE,wBAAwB,CAAC,QAAQ,CAAC,CAAA;IAC3C;;;;;OAKG;IACH,WAAW,CAAC,EAAE,wBAAwB,CAAC,aAAa,CAAC,CAAA;IACrD;;;OAGG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf;;;;;;;OAOG;IACH,eAAe,CAAC,EAAE,eAAe,CAAA;CAClC;AAQD;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAAC,EAC7B,QAAQ,EACR,MAAM,EACN,aAAa,EACb,WAAW,EACX,MAAM,EACN,WAAW,EACX,KAAa,EACb,eAAe,GAChB,EAAE,mBAAmB,+BAmDrB"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
2
|
export declare const STATSIG_CLIENT_KEY: "client-UmFd8WIJljA7cLmZuDqs3X25M8sKd5WIQP4BSC2bRbM";
|
|
3
3
|
interface FunkitStatsigProviderProps {
|
|
4
4
|
children: ReactNode;
|
|
5
|
+
/** Customer apiKey — gates customer-scoped configs (e.g. `enableswappeddeposit`). */
|
|
6
|
+
apiKey: string;
|
|
7
|
+
/** Resolved funkit user id (apiKey|externalUserId, else wallet address). */
|
|
8
|
+
userId: string;
|
|
5
9
|
isDevelopment?: boolean;
|
|
6
10
|
}
|
|
7
|
-
export declare function FunkitStatsigProvider({ children, isDevelopment, }: FunkitStatsigProviderProps): import("react
|
|
11
|
+
export declare function FunkitStatsigProvider({ children, apiKey, userId, isDevelopment, }: FunkitStatsigProviderProps): import("react").JSX.Element;
|
|
8
12
|
export {};
|
|
9
13
|
//# sourceMappingURL=FunkitStatsigProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunkitStatsigProvider.d.ts","sourceRoot":"","sources":["../../../src/providers/FunkitStatsigProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"FunkitStatsigProvider.d.ts","sourceRoot":"","sources":["../../../src/providers/FunkitStatsigProvider.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAA;AAW/C,eAAO,MAAM,kBAAkB,EAC7B,oDAA6D,CAAA;AAE/D,UAAU,0BAA0B;IAClC,QAAQ,EAAE,SAAS,CAAA;IACnB,qFAAqF;IACrF,MAAM,EAAE,MAAM,CAAA;IACd,4EAA4E;IAC5E,MAAM,EAAE,MAAM,CAAA;IACd,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;AAED,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,MAAM,EACN,MAAM,EACN,aAAqB,GACtB,EAAE,0BAA0B,+BA2B5B"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { DepositFlowCallbacks, DepositFlowConfig } from '../flow/depositFlowConfig';
|
|
2
|
+
/**
|
|
3
|
+
* The connect-rn entry hook, mirroring `@funkit/connect`'s `useFunkitCheckout`.
|
|
4
|
+
* Returns imperative `begin*` calls that open the SDK's managed modal flow — the
|
|
5
|
+
* host renders no screens itself.
|
|
6
|
+
*
|
|
7
|
+
* `beginDeposit(config)` opens the deposit flow (Add money → Transfer/UDA →
|
|
8
|
+
* Choose chain / Supported tokens / QR). `beginCheckout` / `beginWithdrawal`
|
|
9
|
+
* will be added here as those flows land, matching the web surface.
|
|
10
|
+
*/
|
|
11
|
+
export declare function useFunkitCheckout(callbacks?: DepositFlowCallbacks): {
|
|
12
|
+
beginDeposit: (config: DepositFlowConfig) => void;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=useFunkitCheckout.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFunkitCheckout.d.ts","sourceRoot":"","sources":["../../../src/providers/useFunkitCheckout.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,oBAAoB,EACpB,iBAAiB,EAClB,MAAM,2BAA2B,CAAA;AAGlC;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,SAAS,GAAE,oBAAyB;2BAIzD,iBAAiB;EAK7B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* One selectable funding source in {@link AddMoneyScreen}. Brand icons are
|
|
4
4
|
* host-supplied (`icon` / `trailing`) so the package stays asset- and
|
|
@@ -15,10 +15,60 @@ export interface PaymentMethodOption {
|
|
|
15
15
|
/** Trailing accessory, e.g. a token cluster for the Crypto row. */
|
|
16
16
|
trailing?: ReactNode;
|
|
17
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* One option in the "Deposit to" receive-token dropdown (Figma: Fun Mobile /
|
|
20
|
+
* Add money). Mirrors web's `ReceiveTokenDropdown` items. The icon is supplied
|
|
21
|
+
* by the flow (keeping this screen asset-free) and `label` is the composed
|
|
22
|
+
* destination text, e.g. `"USDG (Perps)"`.
|
|
23
|
+
*/
|
|
24
|
+
export interface ReceiveTokenOption {
|
|
25
|
+
id: string;
|
|
26
|
+
label: string;
|
|
27
|
+
icon?: ReactNode;
|
|
28
|
+
}
|
|
18
29
|
export interface AddMoneyScreenProps {
|
|
19
30
|
methods: PaymentMethodOption[];
|
|
20
31
|
onSelectMethod: (id: string) => void;
|
|
21
32
|
title?: string;
|
|
33
|
+
/**
|
|
34
|
+
* Receive-token candidates shown in the "Deposit to" dropdown above the
|
|
35
|
+
* payment methods (web: `ReceiveTokenDropdown`). When set, the screen shows
|
|
36
|
+
* the dropdown + a "Pay with" section label. Omit to render just the
|
|
37
|
+
* methods list (back-compat with hosts that don't pass candidates).
|
|
38
|
+
*/
|
|
39
|
+
receiveTokens?: ReceiveTokenOption[];
|
|
40
|
+
selectedReceiveTokenId?: string;
|
|
41
|
+
onSelectReceiveToken?: (id: string) => void;
|
|
42
|
+
depositToLabel?: string;
|
|
43
|
+
payWithLabel?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Show the loading skeleton instead of the method list (Figma: Fun Mobile /
|
|
46
|
+
* Add money, loading). Set while the funding sources are still being fetched
|
|
47
|
+
* (e.g. the Swapped cash methods) so the list doesn't pop in row-by-row.
|
|
48
|
+
*/
|
|
49
|
+
loading?: boolean;
|
|
50
|
+
/**
|
|
51
|
+
* Number of skeleton rows rendered while `loading`. Defaults to 5 when the
|
|
52
|
+
* deposit selector shows, 6 otherwise (it reclaims the selector's room).
|
|
53
|
+
*/
|
|
54
|
+
skeletonCount?: number;
|
|
55
|
+
/**
|
|
56
|
+
* Show the error state instead of the list (Figma: Fun Mobile / Add money,
|
|
57
|
+
* error) — a "Something went wrong" message + a "Try again" button. Takes
|
|
58
|
+
* precedence over `loading`. Set when fetching the funding sources failed.
|
|
59
|
+
*/
|
|
60
|
+
error?: boolean;
|
|
61
|
+
/** "Try again" handler shown with the error state. */
|
|
62
|
+
onRetry?: () => void;
|
|
63
|
+
errorTitle?: string;
|
|
64
|
+
errorMessage?: string;
|
|
65
|
+
retryLabel?: string;
|
|
66
|
+
/**
|
|
67
|
+
* Open the "Deposit to" dropdown on mount. For previews/tests of the expanded
|
|
68
|
+
* state (Figma node 11200:8055); hosts leave this `false` and let the user
|
|
69
|
+
* tap the trigger.
|
|
70
|
+
*/
|
|
71
|
+
initialDropdownOpen?: boolean;
|
|
22
72
|
}
|
|
23
73
|
/**
|
|
24
74
|
* The "Add money" funding-source picker (Figma: Fun Mobile / Add money). A
|
|
@@ -26,6 +76,11 @@ export interface AddMoneyScreenProps {
|
|
|
26
76
|
* payment methods — built from the connect-rn Restyle theme so it tracks the
|
|
27
77
|
* active light/dark scheme. Selecting a method (e.g. Crypto) routes the host to
|
|
28
78
|
* the next screen (Transfer/UDA).
|
|
79
|
+
*
|
|
80
|
+
* When `receiveTokens` are given, a fixed "Deposit to" selector sits above the
|
|
81
|
+
* scrollable list. Opening it floats the option list as an overlay (it does
|
|
82
|
+
* NOT reflow the list) over a dimming scrim — matching web's
|
|
83
|
+
* `ReceiveTokenDropdown`.
|
|
29
84
|
*/
|
|
30
|
-
export declare function AddMoneyScreen({ methods, onSelectMethod, title, }: AddMoneyScreenProps): import("react
|
|
85
|
+
export declare function AddMoneyScreen({ methods, onSelectMethod, title, loading, skeletonCount, error, onRetry, errorTitle, errorMessage, retryLabel, receiveTokens, selectedReceiveTokenId, onSelectReceiveToken, depositToLabel, payWithLabel, initialDropdownOpen, }: AddMoneyScreenProps): import("react").JSX.Element;
|
|
31
86
|
//# sourceMappingURL=AddMoneyScreen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AddMoneyScreen.d.ts","sourceRoot":"","sources":["../../../src/screens/AddMoneyScreen.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AddMoneyScreen.d.ts","sourceRoot":"","sources":["../../../src/screens/AddMoneyScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,OAAO,CAAA;AAyEnE;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,iDAAiD;IACjD,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,mDAAmD;IACnD,IAAI,CAAC,EAAE,SAAS,CAAA;IAChB,mEAAmE;IACnE,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAED;;;;;GAKG;AACH,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,SAAS,CAAA;CACjB;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,mBAAmB,EAAE,CAAA;IAC9B,cAAc,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd;;;;;OAKG;IACH,aAAa,CAAC,EAAE,kBAAkB,EAAE,CAAA;IACpC,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,oBAAoB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAA;CAC9B;AAOD;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAAC,EAC7B,OAAO,EACP,cAAc,EACd,KAAmB,EACnB,OAAe,EACf,aAAa,EACb,KAAa,EACb,OAAO,EACP,UAAgC,EAChC,YAAoC,EACpC,UAAgC,EAChC,aAAa,EACb,sBAAsB,EACtB,oBAAoB,EACpB,cAA6B,EAC7B,YAAyB,EACzB,mBAA2B,GAC5B,EAAE,mBAAmB,+BAiIrB"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One chain row in {@link AvailableChainsScreen} — a member chain of the
|
|
3
|
+
* selected deposit network (e.g. Ethereum within the EVM group). The SDK
|
|
4
|
+
* derives these from the curated `tokentransferconfig` + `@funkit/chains`
|
|
5
|
+
* metadata + the `mintokentransfervalue` config (see `buildAvailableChains`).
|
|
6
|
+
*/
|
|
7
|
+
export interface AvailableChain {
|
|
8
|
+
id: string;
|
|
9
|
+
/** Display name, e.g. `Ethereum`, `Binance Smart Chain`. */
|
|
10
|
+
name: string;
|
|
11
|
+
/** Full CDN logo URL for the 36px chain icon. */
|
|
12
|
+
iconUri: string;
|
|
13
|
+
/** Minimum-deposit label shown on the trailing side, e.g. `Min $10`. */
|
|
14
|
+
minLabel?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* The "Available {network} Chains" screen (Figma: qr-code-modal variant, node
|
|
18
|
+
* 11238:25322) — reached by tapping the chain-logo cluster on the Transfer
|
|
19
|
+
* screen. An X-close + centered title bar, then a read-only list of the
|
|
20
|
+
* network's member chains with their minimum-deposit amounts. Presentational:
|
|
21
|
+
* the host supplies the chain rows.
|
|
22
|
+
*/
|
|
23
|
+
export interface AvailableChainsScreenProps {
|
|
24
|
+
/** Network whose chains are listed; the title reads `Available {networkLabel}`. */
|
|
25
|
+
networkLabel: string;
|
|
26
|
+
chains: AvailableChain[];
|
|
27
|
+
title?: string;
|
|
28
|
+
loading?: boolean;
|
|
29
|
+
skeletonCount?: number;
|
|
30
|
+
onClose?: () => void;
|
|
31
|
+
}
|
|
32
|
+
export declare function AvailableChainsScreen({ networkLabel, chains, title, loading, skeletonCount, onClose, }: AvailableChainsScreenProps): import("react").JSX.Element;
|
|
33
|
+
//# sourceMappingURL=AvailableChainsScreen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AvailableChainsScreen.d.ts","sourceRoot":"","sources":["../../../src/screens/AvailableChainsScreen.tsx"],"names":[],"mappings":"AAYA;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC7B,EAAE,EAAE,MAAM,CAAA;IACV,4DAA4D;IAC5D,IAAI,EAAE,MAAM,CAAA;IACZ,iDAAiD;IACjD,OAAO,EAAE,MAAM,CAAA;IACf,wEAAwE;IACxE,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,0BAA0B;IACzC,mFAAmF;IACnF,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;CACrB;AAED,wBAAgB,qBAAqB,CAAC,EACpC,YAAY,EACZ,MAAM,EACN,KAAmC,EACnC,OAAe,EACf,aAAiB,EACjB,OAAO,GACR,EAAE,0BAA0B,+BAmE5B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CheckoutBlockedScreen.d.ts","sourceRoot":"","sources":["../../../src/screens/CheckoutBlockedScreen.tsx"],"names":[],"mappings":"AAKA,wBAAgB,qBAAqB,gCAoCpC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One network in {@link NetworkSelector}. The leading glyph is built from chain
|
|
3
|
+
* logos (asset-free): a single entry renders one logo, several render a 2×2
|
|
4
|
+
* cluster (e.g. the EVM group).
|
|
5
|
+
*/
|
|
6
|
+
export interface NetworkOption {
|
|
7
|
+
/** Stable id passed back to `onSelect` (e.g. the deposit-chain id). */
|
|
8
|
+
id: string;
|
|
9
|
+
/** Label shown when this network is selected, e.g. `"EVM Chains"`. */
|
|
10
|
+
label: string;
|
|
11
|
+
/**
|
|
12
|
+
* Chain logos — either CDN chain **keys** (e.g. `['ethereum']`) or full image
|
|
13
|
+
* **URLs** (`@funkit/chains` `iconUrl`s). One → single logo, several → a 2×2
|
|
14
|
+
* cluster.
|
|
15
|
+
*/
|
|
16
|
+
iconKeys: string[];
|
|
17
|
+
}
|
|
18
|
+
export interface NetworkSelectorProps {
|
|
19
|
+
networks: NetworkOption[];
|
|
20
|
+
selectedId: string;
|
|
21
|
+
onSelect: (id: string) => void;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The Transfer Crypto network switcher (Figma: Fun Mobile / Transfer Crypto
|
|
25
|
+
* `selector-v2`). A pill-shaped segmented control: the selected network expands
|
|
26
|
+
* to a white pill with its glyph + label, the rest collapse to icon-only
|
|
27
|
+
* buttons. Built from the connect-rn Restyle theme; chain glyphs resolve from
|
|
28
|
+
* the CDN so the package stays asset-free.
|
|
29
|
+
*/
|
|
30
|
+
export declare function NetworkSelector({ networks, selectedId, onSelect, }: NetworkSelectorProps): import("react").JSX.Element;
|
|
31
|
+
//# sourceMappingURL=NetworkSelector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NetworkSelector.d.ts","sourceRoot":"","sources":["../../../src/screens/NetworkSelector.tsx"],"names":[],"mappings":"AAeA;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B,uEAAuE;IACvE,EAAE,EAAE,MAAM,CAAA;IACV,sEAAsE;IACtE,KAAK,EAAE,MAAM,CAAA;IACb;;;;OAIG;IACH,QAAQ,EAAE,MAAM,EAAE,CAAA;CACnB;AAOD,MAAM,WAAW,oBAAoB;IACnC,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB,UAAU,EAAE,MAAM,CAAA;IAClB,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;CAC/B;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,EAC9B,QAAQ,EACR,UAAU,EACV,QAAQ,GACT,EAAE,oBAAoB,+BAkEtB"}
|
|
@@ -1,26 +1,42 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
2
|
/**
|
|
3
|
-
* The deposit QR-code screen (Figma: Fun Mobile / qr-code-modal
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* The deposit QR-code screen (Figma: Fun Mobile / qr-code-modal, node
|
|
4
|
+
* 11636:2663). A minimal sheet: an X-close + centered "QR Code" title bar, the
|
|
5
|
+
* framed QR with the selected network's chain logos overlaid in its center, and
|
|
6
|
+
* — below it — the full deposit address with a "Copy address" button.
|
|
6
7
|
*
|
|
7
|
-
* Rendered as a
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* Rendered as a bottom sheet that fills at least half the screen (a `minHeight`
|
|
9
|
+
* derived from the window, NOT `flex: 1` — a flex-filled layout collapses to
|
|
10
|
+
* nothing inside the flow's content-sized modal wrapper). The QR + address group
|
|
11
|
+
* center vertically in whatever height results.
|
|
10
12
|
*
|
|
11
13
|
* The scannable QR itself is host-supplied (`qrCode`, e.g.
|
|
12
14
|
* `react-native-qrcode-svg`) so the package stays `react-native-svg`-free; this
|
|
13
|
-
* screen renders the themed frame
|
|
15
|
+
* screen renders the themed frame and the centered chain-logo overlay.
|
|
14
16
|
*/
|
|
15
17
|
export interface QrCodeScreenProps {
|
|
16
18
|
/** The rendered QR code node (host-supplied). */
|
|
17
19
|
qrCode: ReactNode;
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Chain logos centered on the QR — the selected network's icons (see
|
|
22
|
+
* {@link QrChainCluster}). Omit to render the QR with no center overlay.
|
|
23
|
+
*/
|
|
24
|
+
centerIcon?: ReactNode;
|
|
25
|
+
/** The full deposit address shown (wrapping) below the QR. */
|
|
26
|
+
address?: string;
|
|
27
|
+
title?: string;
|
|
28
|
+
copyLabel?: string;
|
|
29
|
+
copiedLabel?: string;
|
|
30
|
+
/** How long the "Copied" confirmation stays on the Copy button (ms). */
|
|
31
|
+
copiedFeedbackMs?: number;
|
|
20
32
|
onClose?: () => void;
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
33
|
+
/**
|
|
34
|
+
* Copy the full address to the clipboard. Omit to hide the Copy button.
|
|
35
|
+
* May return whether the copy succeeded; when it resolves `false` the
|
|
36
|
+
* "Copied!" confirmation is suppressed (a `void` return is treated as
|
|
37
|
+
* success).
|
|
38
|
+
*/
|
|
39
|
+
onCopyAddress?: () => void | Promise<boolean>;
|
|
24
40
|
}
|
|
25
|
-
export declare function QrCodeScreen({ qrCode,
|
|
41
|
+
export declare function QrCodeScreen({ qrCode, centerIcon, address, title, copyLabel, copiedLabel, copiedFeedbackMs, onClose, onCopyAddress, }: QrCodeScreenProps): import("react").JSX.Element;
|
|
26
42
|
//# sourceMappingURL=QrCodeScreen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"QrCodeScreen.d.ts","sourceRoot":"","sources":["../../../src/screens/QrCodeScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"QrCodeScreen.d.ts","sourceRoot":"","sources":["../../../src/screens/QrCodeScreen.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAA+B,MAAM,OAAO,CAAA;AAWnE;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,iBAAiB;IAChC,iDAAiD;IACjD,MAAM,EAAE,SAAS,CAAA;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,SAAS,CAAA;IACtB,8DAA8D;IAC9D,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAA;IACpB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;CAC9C;AAED,wBAAgB,YAAY,CAAC,EAC3B,MAAM,EACN,UAAU,EACV,OAAO,EACP,KAAiB,EACjB,SAA0B,EAC1B,WAAuB,EACvB,gBAAuB,EACvB,OAAO,EACP,aAAa,GACd,EAAE,iBAAiB,+BA2GnB"}
|
|
@@ -1,27 +1,40 @@
|
|
|
1
|
-
import { type
|
|
1
|
+
import { type NetworkOption } from './NetworkSelector';
|
|
2
2
|
/**
|
|
3
3
|
* The Transfer Crypto / Universal-Deposit-Address screen (Figma: Fun Mobile /
|
|
4
|
-
* Transfer Crypto). A themed bottom-sheet surface
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Transfer Crypto, node 10952:9834). A themed bottom-sheet surface: an X-close
|
|
5
|
+
* + QR top bar, the inline {@link NetworkSelector}, a centered deposit-address
|
|
6
|
+
* card with a tappable supported-token preview (→ supported tokens), and
|
|
7
|
+
* full-width Copy / Share buttons. UI only — the host wires the data + callbacks
|
|
8
|
+
* (the deposit-address resolution lives in the transfer hooks).
|
|
8
9
|
*/
|
|
9
10
|
export interface TransferCryptoScreenProps {
|
|
10
11
|
/** Pre-formatted deposit address, e.g. `0x7854...5139F0`. */
|
|
11
12
|
depositAddress: string;
|
|
12
|
-
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
13
|
+
/** Networks for the inline switcher; the selected one expands with its label. */
|
|
14
|
+
networks: NetworkOption[];
|
|
15
|
+
selectedNetworkId: string;
|
|
16
|
+
onSelectNetwork: (id: string) => void;
|
|
17
|
+
/**
|
|
18
|
+
* CDN chain keys for the chain-logo preview under the address (tapping it
|
|
19
|
+
* opens the "Available chains" screen). Omit to hide the preview.
|
|
20
|
+
*/
|
|
21
|
+
supportedTokenIcons?: string[];
|
|
22
|
+
/** Single-network minimum deposit text, e.g. `Min $3` for Solana. */
|
|
23
|
+
minimumDepositLabel?: string;
|
|
16
24
|
title?: string;
|
|
17
25
|
depositAddressLabel?: string;
|
|
18
|
-
|
|
26
|
+
copyLabel?: string;
|
|
27
|
+
copiedLabel?: string;
|
|
28
|
+
shareLabel?: string;
|
|
29
|
+
/** How long the "Copied" confirmation stays on the Copy button (ms). */
|
|
19
30
|
copiedFeedbackMs?: number;
|
|
31
|
+
/** Leading top-bar action — returns to the Add money screen. */
|
|
20
32
|
onBack?: () => void;
|
|
21
33
|
onShowQrCode?: () => void;
|
|
22
|
-
|
|
34
|
+
/** Tapping the chain-logo preview cluster (opens "Available chains"). */
|
|
35
|
+
onShowChains?: () => void;
|
|
23
36
|
onCopyAddress?: () => void;
|
|
24
37
|
onShareAddress?: () => void;
|
|
25
38
|
}
|
|
26
|
-
export declare function TransferCryptoScreen({ depositAddress,
|
|
39
|
+
export declare function TransferCryptoScreen({ depositAddress, networks, selectedNetworkId, onSelectNetwork, supportedTokenIcons, minimumDepositLabel, title, depositAddressLabel, copyLabel, copiedLabel, shareLabel, copiedFeedbackMs, onBack, onShowQrCode, onShowChains, onCopyAddress, onShareAddress, }: TransferCryptoScreenProps): import("react").JSX.Element;
|
|
27
40
|
//# sourceMappingURL=TransferCryptoScreen.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TransferCryptoScreen.d.ts","sourceRoot":"","sources":["../../../src/screens/TransferCryptoScreen.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TransferCryptoScreen.d.ts","sourceRoot":"","sources":["../../../src/screens/TransferCryptoScreen.tsx"],"names":[],"mappings":"AAeA,OAAO,EAAE,KAAK,aAAa,EAAmB,MAAM,mBAAmB,CAAA;AAEvE;;;;;;;GAOG;AACH,MAAM,WAAW,yBAAyB;IACxC,6DAA6D;IAC7D,cAAc,EAAE,MAAM,CAAA;IACtB,iFAAiF;IACjF,QAAQ,EAAE,aAAa,EAAE,CAAA;IACzB,iBAAiB,EAAE,MAAM,CAAA;IACzB,eAAe,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAA;IACrC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;IAC9B,qEAAqE;IACrE,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,wEAAwE;IACxE,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,gEAAgE;IAChE,MAAM,CAAC,EAAE,MAAM,IAAI,CAAA;IACnB,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;IACzB,yEAAyE;IACzE,YAAY,CAAC,EAAE,MAAM,IAAI,CAAA;IACzB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAA;IAC1B,cAAc,CAAC,EAAE,MAAM,IAAI,CAAA;CAC5B;AAED,wBAAgB,oBAAoB,CAAC,EACnC,cAAc,EACd,QAAQ,EACR,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,KAAyB,EACzB,mBAA4C,EAC5C,SAAkB,EAClB,WAAuB,EACvB,UAAoB,EACpB,gBAAuB,EACvB,MAAM,EACN,YAAY,EACZ,YAAY,EACZ,aAAa,EACb,cAAc,GACf,EAAE,yBAAyB,+BA+I3B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"statsigMetadata.d.ts","sourceRoot":"","sources":["../../../src/statsig/statsigMetadata.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"statsigMetadata.d.ts","sourceRoot":"","sources":["../../../src/statsig/statsigMetadata.ts"],"names":[],"mappings":"AAgCA,wBAAgB,2BAA2B,IAAI,MAAM,CACnD,MAAM,EACN,MAAM,GAAG,SAAS,CACnB,CAWA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface SwappedScreenProps {
|
|
2
|
+
/** The selected FOP's `embeddedFlowUrl` to load in the embed. */
|
|
3
|
+
url: string;
|
|
4
|
+
/** Close the whole flow (embed asked to exit, e.g. its own ✕). */
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
/** Go back to the Add money list (embed's own back, or a new deposit). */
|
|
7
|
+
onBack: () => void;
|
|
8
|
+
/** Fired when the embed reports a successful transaction. */
|
|
9
|
+
onSuccess?: () => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Full-screen host for the Swapped embedded payment flow ({@link SwappedWebView})
|
|
13
|
+
* — reached when the user picks a cash method (Card / Apple Pay / …) on Add
|
|
14
|
+
* money. The embed ships its **own** top bar (back / title / close), so we
|
|
15
|
+
* render no React Native header here (avoids a double nav bar) and instead drive
|
|
16
|
+
* flow navigation from the embed's messages, mirroring web's
|
|
17
|
+
* `SwappedIframeController`: back / new-deposit → {@link onBack}, close →
|
|
18
|
+
* {@link onClose}, transaction-successful → {@link onSuccess}. Others log only.
|
|
19
|
+
*/
|
|
20
|
+
export declare function SwappedScreen({ url, onClose, onBack, onSuccess, }: SwappedScreenProps): import("react").JSX.Element;
|
|
21
|
+
//# sourceMappingURL=SwappedScreen.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwappedScreen.d.ts","sourceRoot":"","sources":["../../../src/swapped/SwappedScreen.tsx"],"names":[],"mappings":"AAQA,MAAM,WAAW,kBAAkB;IACjC,iEAAiE;IACjE,GAAG,EAAE,MAAM,CAAA;IACX,kEAAkE;IAClE,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,0EAA0E;IAC1E,MAAM,EAAE,MAAM,IAAI,CAAA;IAClB,6DAA6D;IAC7D,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,EAC5B,GAAG,EACH,OAAO,EACP,MAAM,EACN,SAAS,GACV,EAAE,kBAAkB,+BAuCpB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SwappedInboundMessage } from '@funkit/connect-core';
|
|
2
|
+
import { type ViewStyle } from 'react-native';
|
|
3
|
+
export interface SwappedWebViewProps {
|
|
4
|
+
/** The selected FOP's `embeddedFlowUrl` (a swapped.com/.dev widget URL). */
|
|
5
|
+
url: string;
|
|
6
|
+
/** Typed, origin-validated inbound messages from the embed. */
|
|
7
|
+
onMessage: (msg: SwappedInboundMessage) => void;
|
|
8
|
+
style?: ViewStyle;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Renders the Swapped embedded payment flow in a `WebView` and bridges its
|
|
12
|
+
* messages to the typed {@link SwappedTransport} contract — the React Native
|
|
13
|
+
* counterpart of web's iframe. The {@link SWAPPED_WEBVIEW_INJECTED_JS} bridge
|
|
14
|
+
* redirects the embed's `postMessage` to the native channel; `onMessage` is
|
|
15
|
+
* parsed + origin-validated before reaching the handler.
|
|
16
|
+
*/
|
|
17
|
+
export declare function SwappedWebView({ url, onMessage, style }: SwappedWebViewProps): import("react").JSX.Element;
|
|
18
|
+
//# sourceMappingURL=SwappedWebView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SwappedWebView.d.ts","sourceRoot":"","sources":["../../../src/swapped/SwappedWebView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAA;AAGjE,OAAO,EAA2B,KAAK,SAAS,EAAE,MAAM,cAAc,CAAA;AAYtE,MAAM,WAAW,mBAAmB;IAClC,4EAA4E;IAC5E,GAAG,EAAE,MAAM,CAAA;IACX,+DAA+D;IAC/D,SAAS,EAAE,CAAC,GAAG,EAAE,qBAAqB,KAAK,IAAI,CAAA;IAC/C,KAAK,CAAC,EAAE,SAAS,CAAA;CAClB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAAC,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,mBAAmB,+BA+H5E"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { SwappedTheme } from '@funkit/connect-core';
|
|
2
|
+
import type { FunkitTheme } from '../theme/toRestyleTheme';
|
|
3
|
+
/**
|
|
4
|
+
* Loading-state theme for the Swapped embed: the query params sent to `/fops`
|
|
5
|
+
* (`thirdPartyPaymentConfigs.swapped.themeConfig`) that the API bakes into the
|
|
6
|
+
* returned `embeddedFlowUrl` (e.g. `…&iframeBackground=fbf9f4&textColor=282828`)
|
|
7
|
+
* — the widget themes its boot spinner / skeleton straight from the URL, before
|
|
8
|
+
* its message listener is up and any `SWAPPED_THEME` postMessage can land.
|
|
9
|
+
* Mirrors web's `buildSwappedThemeQueryParams(resolvedTheme)`; colors are raw
|
|
10
|
+
* hex (no `#`, they travel in a URL).
|
|
11
|
+
*
|
|
12
|
+
* Web also pins `height`/`width` to its dialog constants; omitted here — the
|
|
13
|
+
* widget sizes to the WebView's real viewport.
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildSwappedThemeQueryParamsRN(theme: FunkitTheme): Record<string, string>;
|
|
16
|
+
/**
|
|
17
|
+
* Builds the {@link SwappedTheme} payload for the embedded Swapped flow from
|
|
18
|
+
* the active Restyle theme — the React Native counterpart of web's
|
|
19
|
+
* `buildSwappedTheme(ThemeVars)`. RN tokens are concrete hex / numbers (no
|
|
20
|
+
* CSS-var indirection), so unlike web no `resolveObjectCssVars` pass is needed.
|
|
21
|
+
*
|
|
22
|
+
* The color/radius keys mirror the vocabulary the Swapped widget reads (the
|
|
23
|
+
* same keys web sends — web ThemeVars names like `primaryText` /
|
|
24
|
+
* `modalBackground` plus the widget-specific aliases like `secondaryButtonBg`);
|
|
25
|
+
* connect-rn's `Funkit*Tokens` are projected onto them.
|
|
26
|
+
*
|
|
27
|
+
* Fonts are intentionally omitted: Swapped expects a slug from its hosted
|
|
28
|
+
* webfont set, and RN font families (system/native names) don't map onto it.
|
|
29
|
+
*/
|
|
30
|
+
export declare function buildSwappedThemeRN(theme: FunkitTheme, isDarkMode: boolean): SwappedTheme;
|
|
31
|
+
//# sourceMappingURL=buildSwappedTheme.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildSwappedTheme.d.ts","sourceRoot":"","sources":["../../../src/swapped/buildSwappedTheme.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAExD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AAK1D;;;;;;;;;;;GAWG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,WAAW,GACjB,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAWxB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,WAAW,EAClB,UAAU,EAAE,OAAO,GAClB,YAAY,CA2Hd"}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { type SwappedInboundMessage, type SwappedOutboundMessage, type SwappedTransport } from '@funkit/connect-core';
|
|
2
|
+
/**
|
|
3
|
+
* Marker key on host → embed envelopes (see {@link buildSwappedSendScript}).
|
|
4
|
+
* The injected bridge recognizes the mark, unwraps the payload, and delivers it
|
|
5
|
+
* to the page; everything unmarked is embed traffic and goes to native.
|
|
6
|
+
*/
|
|
7
|
+
export declare const FUNKIT_ENVELOPE_KEY = "__funkitSwapped";
|
|
8
|
+
/**
|
|
9
|
+
* Injected into the Swapped WebView before its content loads. Installs one
|
|
10
|
+
* bridged `postMessage` that routes BOTH directions:
|
|
11
|
+
*
|
|
12
|
+
* - **embed → native**: the embed talks to its host by calling
|
|
13
|
+
* `window.parent.postMessage(obj, origin)` (the web iframe contract); at the
|
|
14
|
+
* top level `window.parent === window`, so overriding `window.postMessage`
|
|
15
|
+
* intercepts those calls and forwards them — JSON-stringified — to React
|
|
16
|
+
* Native via `window.ReactNativeWebView.postMessage`. The RN side parses +
|
|
17
|
+
* origin-validates via {@link handleWebViewMessage}.
|
|
18
|
+
* - **native → embed**: messages injected by {@link buildSwappedSendScript}
|
|
19
|
+
* arrive at the same bridged function wrapped in a funkit-marked envelope
|
|
20
|
+
* ({@link FUNKIT_ENVELOPE_KEY}); the bridge unwraps them and re-dispatches
|
|
21
|
+
* the payload through the REAL `postMessage` (captured before the override),
|
|
22
|
+
* so the embed's `message` listeners receive a genuine, trusted MessageEvent
|
|
23
|
+
* with an object `event.data` — exactly what they get from an iframe parent.
|
|
24
|
+
*
|
|
25
|
+
* It also installs a fake `window.opener` wired to the native channel: with no
|
|
26
|
+
* parent frame the widget posts its lifecycle messages (`SWAPPED_READY`, …) to
|
|
27
|
+
* `opener` instead of `parent`, and a top-level WebView has neither — without
|
|
28
|
+
* the shim those messages are silently dropped.
|
|
29
|
+
*/
|
|
30
|
+
export declare const SWAPPED_WEBVIEW_INJECTED_JS = "(function () {\n if (window.__funkitSwappedBridge) { return; }\n window.__funkitSwappedBridge = true;\n // The REAL postMessage, captured before the override below.\n var postToPage = window.postMessage.bind(window);\n function forwardToNative(message) {\n try {\n var data = typeof message === 'string' ? message : JSON.stringify(message);\n window.ReactNativeWebView && window.ReactNativeWebView.postMessage(data);\n } catch (e) {}\n }\n function bridged(message) {\n // funkit envelope (host \u2192 embed): unwrap + deliver to the page's listeners.\n if (message && message.__funkitSwapped) {\n try { postToPage(message.payload, '*'); } catch (e) {}\n return;\n }\n // Anything else is the embed talking to its host \u2192 forward to native.\n forwardToNative(message);\n }\n // The embed posts to window.parent (and sometimes window) \u2014 both are this\n // window at the top level, so both assignments install the same bridge.\n try { if (window.parent) { window.parent.postMessage = bridged; } } catch (e) {}\n try { window.postMessage = bridged; } catch (e) {}\n // No parent frame \u2192 the widget posts lifecycle messages to window.opener.\n try { if (!window.opener) { window.opener = { postMessage: forwardToNative }; } } catch (e) {}\n true;\n})();\ntrue;";
|
|
31
|
+
/**
|
|
32
|
+
* Build the JS snippet that delivers an outbound message INTO the embed, run
|
|
33
|
+
* via `webView.injectJavaScript`. One shape for every message type: the payload
|
|
34
|
+
* is wrapped in a funkit-marked envelope and handed to the (bridged)
|
|
35
|
+
* `window.postMessage` — the bridge unwraps it and re-dispatches via the real
|
|
36
|
+
* `postMessage` (see {@link SWAPPED_WEBVIEW_INJECTED_JS}). If the bridge isn't
|
|
37
|
+
* installed, the envelope dispatches as-is and the embed ignores it (no `type`).
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildSwappedSendScript(msg: SwappedOutboundMessage): string;
|
|
40
|
+
/**
|
|
41
|
+
* Parse + validate a raw WebView `onMessage` payload into a typed inbound
|
|
42
|
+
* Swapped message. Returns `null` (drop the message) when:
|
|
43
|
+
* - the payload isn't valid JSON with a string `type`, or
|
|
44
|
+
* - a `url` is supplied whose origin isn't a Swapped origin (mirrors web's
|
|
45
|
+
* `isSwappedOrigin(event.origin)` guard in the iframe transport).
|
|
46
|
+
*
|
|
47
|
+
* `url` is the WebView's current page URL (`nativeEvent.url`); when omitted the
|
|
48
|
+
* origin check is skipped (the caller already trusts the source).
|
|
49
|
+
*/
|
|
50
|
+
export declare function handleWebViewMessage(rawData: unknown, url?: string): SwappedInboundMessage | null;
|
|
51
|
+
/** Minimal surface of `react-native-webview`'s ref the transport needs. */
|
|
52
|
+
export interface WebViewLike {
|
|
53
|
+
injectJavaScript(script: string): void;
|
|
54
|
+
}
|
|
55
|
+
export interface WebViewSwappedTransport {
|
|
56
|
+
/** Implements the shared {@link SwappedTransport} contract. */
|
|
57
|
+
transport: SwappedTransport;
|
|
58
|
+
/**
|
|
59
|
+
* Feed a raw WebView `onMessage` payload (+ optional page url) through origin
|
|
60
|
+
* validation and fan it out to `transport.onMessage` subscribers.
|
|
61
|
+
*/
|
|
62
|
+
dispatch(rawData: unknown, url?: string): void;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* React Native {@link SwappedTransport}: bridges the typed Swapped message
|
|
66
|
+
* contract over a `WebView` instead of web's `<iframe>` + `window.postMessage`.
|
|
67
|
+
* `send` delivers into the embed by injecting an in-page `postMessage` call
|
|
68
|
+
* ({@link buildSwappedSendScript}); inbound messages arrive through
|
|
69
|
+
* {@link dispatch} (wired to the WebView's `onMessage`).
|
|
70
|
+
*/
|
|
71
|
+
export declare function createWebViewSwappedTransport({ getWebView, }: {
|
|
72
|
+
getWebView: () => WebViewLike | null;
|
|
73
|
+
}): WebViewSwappedTransport;
|
|
74
|
+
//# sourceMappingURL=webViewSwappedTransport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"webViewSwappedTransport.d.ts","sourceRoot":"","sources":["../../../src/swapped/webViewSwappedTransport.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,qBAAqB,EAC1B,KAAK,sBAAsB,EAC3B,KAAK,gBAAgB,EAEtB,MAAM,sBAAsB,CAAA;AAE7B;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,oBAAoB,CAAA;AAEpD;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,2BAA2B,mzCA4BlC,CAAA;AAEN;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,sBAAsB,GAAG,MAAM,CAM1E;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,OAAO,EAChB,GAAG,CAAC,EAAE,MAAM,GACX,qBAAqB,GAAG,IAAI,CAmB9B;AAED,2EAA2E;AAC3E,MAAM,WAAW,WAAW;IAC1B,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CACvC;AAED,MAAM,WAAW,uBAAuB;IACtC,+DAA+D;IAC/D,SAAS,EAAE,gBAAgB,CAAA;IAC3B;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;CAC/C;AAED;;;;;;GAMG;AACH,wBAAgB,6BAA6B,CAAC,EAC5C,UAAU,GACX,EAAE;IACD,UAAU,EAAE,MAAM,WAAW,GAAG,IAAI,CAAA;CACrC,GAAG,uBAAuB,CA8B1B"}
|
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
import { type FunkitColorSchemeValue } from './colorSchemeContext';
|
|
3
2
|
import { type ColorScheme } from './useColorScheme';
|
|
4
3
|
import { type FunkitThemeSet } from './useFunkitTheme';
|
|
4
|
+
interface FunkitColorSchemeValue {
|
|
5
|
+
/** The active, resolved color scheme. */
|
|
6
|
+
colorScheme: ColorScheme;
|
|
7
|
+
/**
|
|
8
|
+
* Flip light↔dark, or set a specific scheme when an argument is given.
|
|
9
|
+
* **No-op when the provider's `colorScheme` prop is set** (controlled mode) —
|
|
10
|
+
* the host owns the scheme in that case.
|
|
11
|
+
*/
|
|
12
|
+
toggleColorScheme: (next?: ColorScheme) => void;
|
|
13
|
+
/** True when the scheme is forced by the `colorScheme` prop (uncontrolled toggle disabled). */
|
|
14
|
+
isControlled: boolean;
|
|
15
|
+
}
|
|
5
16
|
export interface FunkitThemeProviderProps {
|
|
6
17
|
children: ReactNode;
|
|
7
18
|
/**
|
|
@@ -27,7 +38,7 @@ export interface FunkitThemeProviderProps {
|
|
|
27
38
|
* This is an internal-ish provider — host apps mount the user-facing
|
|
28
39
|
* {@link FunkitProvider}, which passes `themes` / `colorScheme` down to this.
|
|
29
40
|
*/
|
|
30
|
-
export declare function FunkitThemeProvider({ children, themes, colorScheme, }: FunkitThemeProviderProps): import("react
|
|
41
|
+
export declare function FunkitThemeProvider({ children, themes, colorScheme, }: FunkitThemeProviderProps): import("react").JSX.Element;
|
|
31
42
|
/**
|
|
32
43
|
* Read the active color scheme and toggle it. Must be used within a
|
|
33
44
|
* {@link FunkitProvider} (which mounts {@link FunkitThemeProvider}).
|
|
@@ -35,4 +46,5 @@ export declare function FunkitThemeProvider({ children, themes, colorScheme, }:
|
|
|
35
46
|
* `colorScheme` prop was passed).
|
|
36
47
|
*/
|
|
37
48
|
export declare function useFunkitColorScheme(): FunkitColorSchemeValue;
|
|
49
|
+
export {};
|
|
38
50
|
//# sourceMappingURL=FunkitThemeProvider.d.ts.map
|