@funkit/connect 10.6.0 → 11.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +27 -0
  2. package/dist/clients/chunk-2FSEE3AW.js +277 -0
  3. package/dist/clients/chunk-5MY7WMEJ.js +20 -0
  4. package/dist/clients/chunk-6CYZKITE.js +33 -0
  5. package/dist/clients/{chunk-TG2AACP2.js → chunk-C4SHJFOV.js} +2 -2
  6. package/dist/clients/{chunk-3LJQTM37.js → chunk-FNB7OPJI.js} +12 -198
  7. package/dist/clients/{chunk-2NBYHUIW.js → chunk-HZP4DXIZ.js} +1 -0
  8. package/dist/clients/{chunk-F6P4CN27.js → chunk-JD2J5K6S.js} +16 -8
  9. package/dist/clients/chunk-LT4EWLDA.js +30 -0
  10. package/dist/clients/chunk-MGQLVTSH.js +100 -0
  11. package/dist/clients/{chunk-FJ6GCMJ4.js → chunk-OODIKHYE.js} +3 -1
  12. package/dist/clients/chunk-SFDEST63.js +18 -0
  13. package/dist/clients/{chunk-OZ3KD24N.js → chunk-ZCCLJW6F.js} +0 -8
  14. package/dist/clients/fanatics.js +5 -6
  15. package/dist/clients/internal/nado/encoding.js +4 -25
  16. package/dist/clients/internal/nado/gateway.d.ts +0 -21
  17. package/dist/clients/internal/nado/gateway.js +1 -5
  18. package/dist/clients/internal/nado/hooks.d.ts +0 -158
  19. package/dist/clients/internal/nado/hooks.js +10 -121
  20. package/dist/clients/internal/nado/withdrawalConfig.js +3 -13
  21. package/dist/clients/internal/nado/withdrawalForm.css +17529 -0
  22. package/dist/clients/internal/nado/withdrawalForm.d.ts +41 -0
  23. package/dist/clients/internal/nado/withdrawalForm.js +283 -0
  24. package/dist/clients/internal/nado/withdrawalTypes.d.ts +7 -2
  25. package/dist/clients/lighter.d.ts +29 -1
  26. package/dist/clients/lighter.js +105 -99
  27. package/dist/clients/mallard.js +24 -3
  28. package/dist/clients/polymarket/PolymarketDepositAccountDropdown.js +6 -3
  29. package/dist/clients/polymarket/index.js +6 -3
  30. package/dist/domains/swapped.d.ts +1 -10
  31. package/dist/hooks/useTokenAndChainDropdown.d.ts +8 -1
  32. package/dist/index.d.ts +1 -1
  33. package/dist/index.js +1369 -892
  34. package/dist/modals/WithdrawalModal/LighterWithdrawal.d.ts +20 -31
  35. package/dist/modals/WithdrawalModal/WithdrawAmountInput.d.ts +5 -9
  36. package/dist/providers/FunkitCheckoutContext/types.d.ts +61 -4
  37. package/dist/utils/customer.d.ts +349 -0
  38. package/dist/utils/withdrawal.d.ts +13 -6
  39. package/dist/wagmi/actions.d.ts +1 -1
  40. package/dist/wallets/Wallet.d.ts +21 -1
  41. package/dist/wallets/walletConnectors/index.js +11 -11
  42. package/package.json +3 -3
  43. package/dist/clients/chunk-A4WQS6QG.js +0 -207
  44. package/dist/clients/internal/nado/products.d.ts +0 -36
  45. package/dist/clients/internal/nado/products.js +0 -19
package/CHANGELOG.md CHANGED
@@ -1,5 +1,32 @@
1
1
  # @funkit/connect
2
2
 
3
+ ## 11.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 40b25c4: Lighter withdrawal balances are now supplied by the integrator via `withdrawalSourceTokenBalance` instead of derived by the SDK
8
+
9
+ Migration: pass `withdrawalSourceTokenBalance` to `useLighterWithdrawalConfig`. It receives `{ sourceAsset, customData }` — `sourceAsset.tokenAddress` is the L2 asset index padded into an address, and `customData.routeType` (`LIGHTER_ROUTE_TYPE`) separates perps collateral from spot. Without it the withdrawal amount field reads 0. The selectable source-token list is unchanged and still built by the SDK.
10
+
11
+ ### Minor Changes
12
+
13
+ - 080f00c: Support gasless (permit / EIP-3009) relay signature steps in the withdrawal flow via new optional `WithdrawalClient.signTypedData` / `signMessage`.
14
+ - be54ad3: `withdrawalSourceTokenBalance` now takes precedence over the SDK's own balance for the withdrawal amount field
15
+ - cec0c75: Withdrawal source token options can now carry `decimals` and flow-specific `customData`, so Nado's products are declared on the config instead of fetched by the SDK
16
+ - efc8ef7: Add the Nado withdrawal enter-amount flow to the withdrawal modal.
17
+ - 23a3be4: Withdrawal configs can declare selectable source tokens via `sourceTokens`, so any integrator can offer a source-token dropdown
18
+ - d255ff4: `withdrawalSourceTokenBalance` now receives the source asset it is being asked about, plus flow-specific data identifying Lighter spot vs perps balances
19
+
20
+ ### Patch Changes
21
+
22
+ - 1000acb: feat(connect): add Lightning chain to Transfer Crypto dropdown
23
+ - df4e7d8: fix: treat Bitcoin, Lightning and HyperCore consistently as non-EVM chains across web and RN
24
+ - 4235f2f: refactor(connect-core): share the Swapped `thirdPartyPaymentConfigs` builder across platforms
25
+ - Updated dependencies [df4e7d8]
26
+ - Updated dependencies [4235f2f]
27
+ - @funkit/chains@2.2.0
28
+ - @funkit/connect-core@2.4.0
29
+
3
30
  ## 10.6.0
4
31
 
5
32
  ### Minor Changes
@@ -0,0 +1,277 @@
1
+ "use client";
2
+ import {
3
+ useFunkitTranslation
4
+ } from "./chunk-JD2J5K6S.js";
5
+
6
+ // src/utils/customer.ts
7
+ import { useQuery, useQueryClient } from "@tanstack/react-query";
8
+ import { useCallback } from "react";
9
+
10
+ // src/providers/FunkitConfigContext.tsx
11
+ import {
12
+ createContext,
13
+ useContext,
14
+ useMemo
15
+ } from "react";
16
+ var DEFAULT_TEXT_CUSTOMIZATIONS = {
17
+ virtualFiat: "Deposit with SEPA",
18
+ brokerageOrExchange: "Connect Exchange",
19
+ debitOrCredit: "Deposit with Card",
20
+ accountBalance: "Wallet",
21
+ selectAccount: "Select an exchange",
22
+ perpsTransferTitle: "Transfer",
23
+ sourceMethodTitle: "Your source",
24
+ tokensListTitle: "Your tokens",
25
+ transferTokens: "Transfer Crypto",
26
+ bitcoinLightning: "Bitcoin Lightning",
27
+ cashAppLightning: "Cash App",
28
+ receiveDropdownTitle: "",
29
+ // Default to empty
30
+ receiveDropdownLabel: "Asset to Receive",
31
+ confirmationScreen: {
32
+ payAmountLabel: "You send",
33
+ receiveAmountLabel: "You receive"
34
+ },
35
+ paymentMethodSubtitles: {}
36
+ };
37
+ var DEFAULT_UI_CUSTOMIZATIONS = {
38
+ alignTitle: "center",
39
+ alwaysShowTopDivider: false,
40
+ showModalTitle: true,
41
+ callToActionsUppercase: false,
42
+ enableCompactList: false,
43
+ checkoutHistory: {
44
+ showGetHelpAsAlert: true,
45
+ simplifiedUi: false
46
+ },
47
+ confirmationScreen: {
48
+ autoExpandFeesSummary: false,
49
+ preferDestinationWhenSame: false,
50
+ showAmountSummaryAbovePaymentMethod: false,
51
+ showDisclaimerAsAlert: true,
52
+ showInstantTimeEstimate: false,
53
+ showLeftAlignedDollarValueWithLabel: false,
54
+ showPaymentAmountUsd: false,
55
+ showReceiveAmountUsd: false,
56
+ showSelectedRoute: false,
57
+ stepIndicatorType: "spinner",
58
+ showTransactionDigest: "none"
59
+ },
60
+ sourceChangeScreen: {
61
+ bottomBarCloseButton: {
62
+ enabled: false,
63
+ labelKey: "common.close"
64
+ },
65
+ showTargetAssetSelection: false,
66
+ showWalletOnInsufficientBalance: false,
67
+ showWalletConnect: true,
68
+ showCustomTopComponentDivider: false,
69
+ paymentMethodIcons: {}
70
+ },
71
+ inputAmountScreen: {
72
+ allowTokenAmountInput: true
73
+ },
74
+ selectAssetScreen: {
75
+ isSecondaryTokenSymbolVisible: true,
76
+ navigateOnAssetClick: false
77
+ },
78
+ transferCryptoScreen: {
79
+ showYouSendYouReceive: false
80
+ },
81
+ withdrawalScreen: {
82
+ autoExpandFeesSummary: false
83
+ },
84
+ selectBrokerageScreen: {},
85
+ connectExchangeScreen: {},
86
+ customIcons: {},
87
+ customFontFamily: {
88
+ primary: "",
89
+ secondary: "",
90
+ tertiary: ""
91
+ }
92
+ };
93
+ var DEFAULT_FUNKIT_CONFIG = {
94
+ apiKey: "",
95
+ appName: "",
96
+ textCustomizations: DEFAULT_TEXT_CUSTOMIZATIONS,
97
+ uiCustomizations: DEFAULT_UI_CUSTOMIZATIONS
98
+ };
99
+ var FunkitConfigContext = createContext(
100
+ DEFAULT_FUNKIT_CONFIG
101
+ );
102
+ function useFunkitConfig() {
103
+ const originalFunkitConfig = useContext(FunkitConfigContext);
104
+ const { t } = useFunkitTranslation();
105
+ const translatedDefaults = useMemo(() => {
106
+ return {
107
+ virtualFiat: t("textCustomizations.virtualFiat"),
108
+ brokerageOrExchange: t("textCustomizations.brokerageOrExchange"),
109
+ debitOrCredit: t("textCustomizations.debitOrCredit"),
110
+ accountBalance: t("textCustomizations.accountBalance"),
111
+ selectAccount: t("textCustomizations.selectAccount"),
112
+ perpsTransferTitle: t("perpsTransfer.title"),
113
+ sourceMethodTitle: t("textCustomizations.sourceMethodTitle"),
114
+ tokensListTitle: t("textCustomizations.tokensListTitle"),
115
+ transferTokens: t("textCustomizations.transferTokens"),
116
+ bitcoinLightning: t("textCustomizations.bitcoinLightning"),
117
+ cashAppLightning: t("textCustomizations.cashAppLightning"),
118
+ receiveDropdownTitle: t("textCustomizations.receiveDropdownTitle"),
119
+ receiveDropdownLabel: t("textCustomizations.receiveDropdownLabel"),
120
+ confirmationScreen: {
121
+ payAmountLabel: t("textCustomizations.payAmountLabel"),
122
+ receiveAmountLabel: t("textCustomizations.receiveAmountLabel")
123
+ },
124
+ paymentMethodSubtitles: {}
125
+ };
126
+ }, [t]);
127
+ const finalFunkitConfig = useMemo(() => {
128
+ return {
129
+ ...DEFAULT_FUNKIT_CONFIG,
130
+ ...originalFunkitConfig,
131
+ textCustomizations: {
132
+ ...translatedDefaults,
133
+ ...originalFunkitConfig.textCustomizations,
134
+ confirmationScreen: {
135
+ ...translatedDefaults.confirmationScreen,
136
+ ...originalFunkitConfig.textCustomizations?.confirmationScreen
137
+ },
138
+ paymentMethodSubtitles: {
139
+ ...translatedDefaults.paymentMethodSubtitles,
140
+ ...originalFunkitConfig.textCustomizations?.paymentMethodSubtitles
141
+ }
142
+ },
143
+ uiCustomizations: {
144
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations,
145
+ ...originalFunkitConfig.uiCustomizations,
146
+ checkoutHistory: {
147
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.checkoutHistory,
148
+ ...originalFunkitConfig.uiCustomizations?.checkoutHistory
149
+ },
150
+ confirmationScreen: {
151
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.confirmationScreen,
152
+ ...originalFunkitConfig.uiCustomizations?.confirmationScreen
153
+ },
154
+ connectExchangeScreen: {
155
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.connectExchangeScreen,
156
+ ...originalFunkitConfig.uiCustomizations?.connectExchangeScreen
157
+ },
158
+ inputAmountScreen: {
159
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.inputAmountScreen,
160
+ ...originalFunkitConfig.uiCustomizations?.inputAmountScreen
161
+ },
162
+ selectAssetScreen: {
163
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.selectAssetScreen,
164
+ ...originalFunkitConfig.uiCustomizations?.selectAssetScreen
165
+ },
166
+ selectBrokerageScreen: {
167
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.selectBrokerageScreen,
168
+ ...originalFunkitConfig.uiCustomizations?.selectBrokerageScreen
169
+ },
170
+ sourceChangeScreen: {
171
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.sourceChangeScreen,
172
+ ...originalFunkitConfig.uiCustomizations?.sourceChangeScreen,
173
+ bottomBarCloseButton: {
174
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.sourceChangeScreen.bottomBarCloseButton,
175
+ ...originalFunkitConfig.uiCustomizations?.sourceChangeScreen?.bottomBarCloseButton
176
+ }
177
+ },
178
+ transferCryptoScreen: {
179
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.transferCryptoScreen,
180
+ ...originalFunkitConfig.uiCustomizations?.transferCryptoScreen
181
+ },
182
+ withdrawalScreen: {
183
+ ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.withdrawalScreen,
184
+ ...originalFunkitConfig.uiCustomizations?.withdrawalScreen
185
+ }
186
+ }
187
+ };
188
+ }, [originalFunkitConfig, translatedDefaults]);
189
+ return finalFunkitConfig;
190
+ }
191
+
192
+ // src/utils/customer.ts
193
+ var LIGHTER_MAIN_ACCOUNT_TYPE = 0;
194
+ var LIGHTER_TRADING_MODE = {
195
+ SIMPLE: 0,
196
+ UNIFIED: 1
197
+ };
198
+ async function getLighterAccountsByL1Address(address) {
199
+ const response = await fetch(
200
+ `https://mainnet.zklighter.elliot.ai/api/v1/accountsByL1Address?l1_address=${address}`
201
+ );
202
+ if (!response.ok) {
203
+ throw new Error(`Failed to fetch lighter accounts: ${response.statusText}`);
204
+ }
205
+ const data = await response.json();
206
+ return data;
207
+ }
208
+ async function getLighterAccount(lookup, activeOnly) {
209
+ const params = new URLSearchParams({
210
+ by: lookup.by,
211
+ value: String(lookup.value),
212
+ ...activeOnly !== void 0 && { active_only: String(activeOnly) }
213
+ });
214
+ const response = await fetch(
215
+ `https://mainnet.zklighter.elliot.ai/api/v1/account?${params}`
216
+ );
217
+ if (!response.ok) {
218
+ throw new Error(`Failed to fetch lighter account: ${response.statusText}`);
219
+ }
220
+ return response.json();
221
+ }
222
+ function useLighterAccountQuery(lookup, options) {
223
+ const enabled = lookup !== null && (lookup.by === "index" ? true : !!lookup.value && lookup.value !== "0x");
224
+ const query = useQuery({
225
+ queryKey: [
226
+ "lighterAccount",
227
+ lookup?.by,
228
+ lookup?.value,
229
+ options?.activeOnly
230
+ ],
231
+ // biome-ignore lint/style/noNonNullAssertion: already checked for null
232
+ queryFn: () => getLighterAccount(lookup, options?.activeOnly),
233
+ enabled,
234
+ // Refetch on every (re)mount so reopening the withdraw widget shows a fresh
235
+ // balance after a spot→perps transfer; 10s stale window keeps it current.
236
+ staleTime: 1e4,
237
+ refetchOnMount: "always",
238
+ retry: false
239
+ });
240
+ return {
241
+ ...query,
242
+ account: query.data?.accounts?.[0]
243
+ };
244
+ }
245
+ function useLighterAccountsQuery({
246
+ address
247
+ }) {
248
+ const enabled = !!address && address !== "0x";
249
+ const query = useQuery({
250
+ queryKey: ["lighterAccounts", address],
251
+ queryFn: () => getLighterAccountsByL1Address(address),
252
+ enabled,
253
+ staleTime: Number.POSITIVE_INFINITY,
254
+ gcTime: Number.POSITIVE_INFINITY,
255
+ retry: false,
256
+ // allows us to always refetch the data but return the previous data until the new data is fetched
257
+ refetchOnMount: "always"
258
+ });
259
+ const subAccounts = query.data?.sub_accounts;
260
+ const mainAccount = subAccounts?.find(
261
+ (account) => account.account_type === LIGHTER_MAIN_ACCOUNT_TYPE
262
+ );
263
+ return {
264
+ ...query,
265
+ mainAccountIndex: mainAccount?.index?.toString(),
266
+ // False until the accounts load — consumers fall back to the simple-mode
267
+ // UI (both USDC variants shown) while the trading mode is unknown.
268
+ isUnifiedTradingMode: mainAccount?.account_trading_mode === LIGHTER_TRADING_MODE.UNIFIED,
269
+ subAccounts
270
+ };
271
+ }
272
+
273
+ export {
274
+ useFunkitConfig,
275
+ useLighterAccountQuery,
276
+ useLighterAccountsQuery
277
+ };
@@ -0,0 +1,20 @@
1
+ "use client";
2
+
3
+ // src/consts/funkit.ts
4
+ import { FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS } from "@funkit/chains";
5
+ var FUN_ORG_NAME = "Fun.xyz";
6
+ var PLACEHOLDER_FUNKIT_USER_INFO = {
7
+ id: "0x",
8
+ address: "0x",
9
+ name: "Guest",
10
+ nameTruncated: "Guest",
11
+ type: "unknown",
12
+ typeLabel: "",
13
+ iconSrc: "",
14
+ isConnected: false
15
+ };
16
+
17
+ export {
18
+ FUN_ORG_NAME,
19
+ PLACEHOLDER_FUNKIT_USER_INFO
20
+ };
@@ -0,0 +1,33 @@
1
+ "use client";
2
+
3
+ // src/clients/internal/nado/encoding.ts
4
+ import {
5
+ concatHex,
6
+ formatUnits,
7
+ pad,
8
+ stringToHex
9
+ } from "viem";
10
+ var SUBACCOUNT_NAME_BYTES = 12;
11
+ var X18_DECIMALS = 18;
12
+ function buildNadoSubaccountId(owner, name = "default") {
13
+ const nameHex = stringToHex(name);
14
+ if ((nameHex.length - 2) / 2 > SUBACCOUNT_NAME_BYTES) {
15
+ throw new Error("Nado subaccount name must be 12 bytes or fewer");
16
+ }
17
+ return concatHex([
18
+ owner,
19
+ pad(nameHex, { dir: "right", size: SUBACCOUNT_NAME_BYTES })
20
+ ]);
21
+ }
22
+ function x18ToRawBaseUnit(x18Amount, decimals) {
23
+ return BigInt(x18Amount) * 10n ** BigInt(decimals) / 10n ** BigInt(X18_DECIMALS);
24
+ }
25
+ function x18ToTokenUnits(x18Amount, decimals) {
26
+ return formatUnits(x18ToRawBaseUnit(x18Amount, decimals), decimals);
27
+ }
28
+
29
+ export {
30
+ buildNadoSubaccountId,
31
+ x18ToRawBaseUnit,
32
+ x18ToTokenUnits
33
+ };
@@ -3,7 +3,7 @@ import {
3
3
  FunInput,
4
4
  FunSkeletonBlock,
5
5
  TooltipAnchorRefContext
6
- } from "./chunk-3LJQTM37.js";
6
+ } from "./chunk-FNB7OPJI.js";
7
7
  import {
8
8
  Box,
9
9
  Text,
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-LUHEVXPD.js";
12
12
  import {
13
13
  useFunkitTranslation
14
- } from "./chunk-F6P4CN27.js";
14
+ } from "./chunk-JD2J5K6S.js";
15
15
  import {
16
16
  POLYMARKET_PERPS_ROUTING_ID,
17
17
  POLYMARKET_PREDICTIONS_ROUTING_ID
@@ -4,200 +4,15 @@ import {
4
4
  Text,
5
5
  themeVars
6
6
  } from "./chunk-LUHEVXPD.js";
7
- import {
8
- useFunkitTranslation
9
- } from "./chunk-F6P4CN27.js";
10
-
11
- // src/providers/FunkitConfigContext.tsx
12
- import {
13
- createContext,
14
- useContext,
15
- useMemo
16
- } from "react";
17
- var DEFAULT_TEXT_CUSTOMIZATIONS = {
18
- virtualFiat: "Deposit with SEPA",
19
- brokerageOrExchange: "Connect Exchange",
20
- debitOrCredit: "Deposit with Card",
21
- accountBalance: "Wallet",
22
- selectAccount: "Select an exchange",
23
- perpsTransferTitle: "Transfer",
24
- sourceMethodTitle: "Your source",
25
- tokensListTitle: "Your tokens",
26
- transferTokens: "Transfer Crypto",
27
- bitcoinLightning: "Bitcoin Lightning",
28
- cashAppLightning: "Cash App",
29
- receiveDropdownTitle: "",
30
- // Default to empty
31
- receiveDropdownLabel: "Asset to Receive",
32
- confirmationScreen: {
33
- payAmountLabel: "You send",
34
- receiveAmountLabel: "You receive"
35
- },
36
- paymentMethodSubtitles: {}
37
- };
38
- var DEFAULT_UI_CUSTOMIZATIONS = {
39
- alignTitle: "center",
40
- alwaysShowTopDivider: false,
41
- showModalTitle: true,
42
- callToActionsUppercase: false,
43
- enableCompactList: false,
44
- checkoutHistory: {
45
- showGetHelpAsAlert: true,
46
- simplifiedUi: false
47
- },
48
- confirmationScreen: {
49
- autoExpandFeesSummary: false,
50
- preferDestinationWhenSame: false,
51
- showAmountSummaryAbovePaymentMethod: false,
52
- showDisclaimerAsAlert: true,
53
- showInstantTimeEstimate: false,
54
- showLeftAlignedDollarValueWithLabel: false,
55
- showPaymentAmountUsd: false,
56
- showReceiveAmountUsd: false,
57
- showSelectedRoute: false,
58
- stepIndicatorType: "spinner",
59
- showTransactionDigest: "none"
60
- },
61
- sourceChangeScreen: {
62
- bottomBarCloseButton: {
63
- enabled: false,
64
- labelKey: "common.close"
65
- },
66
- showTargetAssetSelection: false,
67
- showWalletOnInsufficientBalance: false,
68
- showWalletConnect: true,
69
- showCustomTopComponentDivider: false,
70
- paymentMethodIcons: {}
71
- },
72
- inputAmountScreen: {
73
- allowTokenAmountInput: true
74
- },
75
- selectAssetScreen: {
76
- isSecondaryTokenSymbolVisible: true,
77
- navigateOnAssetClick: false
78
- },
79
- transferCryptoScreen: {
80
- showYouSendYouReceive: false
81
- },
82
- withdrawalScreen: {
83
- autoExpandFeesSummary: false
84
- },
85
- selectBrokerageScreen: {},
86
- connectExchangeScreen: {},
87
- customIcons: {},
88
- customFontFamily: {
89
- primary: "",
90
- secondary: "",
91
- tertiary: ""
92
- }
93
- };
94
- var DEFAULT_FUNKIT_CONFIG = {
95
- apiKey: "",
96
- appName: "",
97
- textCustomizations: DEFAULT_TEXT_CUSTOMIZATIONS,
98
- uiCustomizations: DEFAULT_UI_CUSTOMIZATIONS
99
- };
100
- var FunkitConfigContext = createContext(
101
- DEFAULT_FUNKIT_CONFIG
102
- );
103
- function useFunkitConfig() {
104
- const originalFunkitConfig = useContext(FunkitConfigContext);
105
- const { t } = useFunkitTranslation();
106
- const translatedDefaults = useMemo(() => {
107
- return {
108
- virtualFiat: t("textCustomizations.virtualFiat"),
109
- brokerageOrExchange: t("textCustomizations.brokerageOrExchange"),
110
- debitOrCredit: t("textCustomizations.debitOrCredit"),
111
- accountBalance: t("textCustomizations.accountBalance"),
112
- selectAccount: t("textCustomizations.selectAccount"),
113
- perpsTransferTitle: t("perpsTransfer.title"),
114
- sourceMethodTitle: t("textCustomizations.sourceMethodTitle"),
115
- tokensListTitle: t("textCustomizations.tokensListTitle"),
116
- transferTokens: t("textCustomizations.transferTokens"),
117
- bitcoinLightning: t("textCustomizations.bitcoinLightning"),
118
- cashAppLightning: t("textCustomizations.cashAppLightning"),
119
- receiveDropdownTitle: t("textCustomizations.receiveDropdownTitle"),
120
- receiveDropdownLabel: t("textCustomizations.receiveDropdownLabel"),
121
- confirmationScreen: {
122
- payAmountLabel: t("textCustomizations.payAmountLabel"),
123
- receiveAmountLabel: t("textCustomizations.receiveAmountLabel")
124
- },
125
- paymentMethodSubtitles: {}
126
- };
127
- }, [t]);
128
- const finalFunkitConfig = useMemo(() => {
129
- return {
130
- ...DEFAULT_FUNKIT_CONFIG,
131
- ...originalFunkitConfig,
132
- textCustomizations: {
133
- ...translatedDefaults,
134
- ...originalFunkitConfig.textCustomizations,
135
- confirmationScreen: {
136
- ...translatedDefaults.confirmationScreen,
137
- ...originalFunkitConfig.textCustomizations?.confirmationScreen
138
- },
139
- paymentMethodSubtitles: {
140
- ...translatedDefaults.paymentMethodSubtitles,
141
- ...originalFunkitConfig.textCustomizations?.paymentMethodSubtitles
142
- }
143
- },
144
- uiCustomizations: {
145
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations,
146
- ...originalFunkitConfig.uiCustomizations,
147
- checkoutHistory: {
148
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.checkoutHistory,
149
- ...originalFunkitConfig.uiCustomizations?.checkoutHistory
150
- },
151
- confirmationScreen: {
152
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.confirmationScreen,
153
- ...originalFunkitConfig.uiCustomizations?.confirmationScreen
154
- },
155
- connectExchangeScreen: {
156
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.connectExchangeScreen,
157
- ...originalFunkitConfig.uiCustomizations?.connectExchangeScreen
158
- },
159
- inputAmountScreen: {
160
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.inputAmountScreen,
161
- ...originalFunkitConfig.uiCustomizations?.inputAmountScreen
162
- },
163
- selectAssetScreen: {
164
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.selectAssetScreen,
165
- ...originalFunkitConfig.uiCustomizations?.selectAssetScreen
166
- },
167
- selectBrokerageScreen: {
168
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.selectBrokerageScreen,
169
- ...originalFunkitConfig.uiCustomizations?.selectBrokerageScreen
170
- },
171
- sourceChangeScreen: {
172
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.sourceChangeScreen,
173
- ...originalFunkitConfig.uiCustomizations?.sourceChangeScreen,
174
- bottomBarCloseButton: {
175
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.sourceChangeScreen.bottomBarCloseButton,
176
- ...originalFunkitConfig.uiCustomizations?.sourceChangeScreen?.bottomBarCloseButton
177
- }
178
- },
179
- transferCryptoScreen: {
180
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.transferCryptoScreen,
181
- ...originalFunkitConfig.uiCustomizations?.transferCryptoScreen
182
- },
183
- withdrawalScreen: {
184
- ...DEFAULT_FUNKIT_CONFIG.uiCustomizations.withdrawalScreen,
185
- ...originalFunkitConfig.uiCustomizations?.withdrawalScreen
186
- }
187
- }
188
- };
189
- }, [originalFunkitConfig, translatedDefaults]);
190
- return finalFunkitConfig;
191
- }
192
7
 
193
8
  // src/components/FunTooltip/FunTooltip.tsx
194
9
  import * as Tooltip from "@radix-ui/react-tooltip";
195
10
  import React, {
196
- createContext as createContext2,
197
- useContext as useContext2,
11
+ createContext,
12
+ useContext,
198
13
  useState
199
14
  } from "react";
200
- var TooltipAnchorRefContext = createContext2(null);
15
+ var TooltipAnchorRefContext = createContext(null);
201
16
 
202
17
  // src/components/FunInput/FunInput.tsx
203
18
  import React5, {
@@ -208,7 +23,7 @@ import React5, {
208
23
  import clsx from "clsx";
209
24
 
210
25
  // src/providers/FunkitThemeProvider.tsx
211
- import React2, { createContext as createContext3, useContext as useContext3, useEffect, useState as useState2 } from "react";
26
+ import React2, { createContext as createContext2, useContext as useContext2, useEffect, useState as useState2 } from "react";
212
27
 
213
28
  // src/themes/baseTheme.ts
214
29
  var systemFontStack = '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol"';
@@ -1078,8 +893,8 @@ var DEFAULT_THEME_SET = {
1078
893
  darkTheme: darkTheme()
1079
894
  };
1080
895
  var DEFAULT_THEME = DEFAULT_THEME_SET.darkTheme;
1081
- var ThemeIdContext = createContext3(void 0);
1082
- var ThemeContext = createContext3({
896
+ var ThemeIdContext = createContext2(void 0);
897
+ var ThemeContext = createContext2({
1083
898
  activeTheme: DEFAULT_THEME,
1084
899
  lightTheme: void 0,
1085
900
  darkTheme: void 0,
@@ -1099,7 +914,7 @@ var useActiveTheme = () => {
1099
914
  darkTheme: darkTheme2,
1100
915
  toggleTheme,
1101
916
  themeColorScheme
1102
- } = useContext3(ThemeContext);
917
+ } = useContext2(ThemeContext);
1103
918
  return {
1104
919
  activeTheme,
1105
920
  /** Overrides the currently active `theme` with disregard to the `theme` provided to the `FunkitProvider`, ie. `toggleTheme` will switch to the `theme` provided to the `FunkitProvider`, not the theme set by `setTheme` */
@@ -1480,22 +1295,21 @@ var groupChainsById = (chains) => {
1480
1295
 
1481
1296
  // src/providers/FunkitConnectChainContext.tsx
1482
1297
  import React6, {
1483
- createContext as createContext4,
1484
- useContext as useContext4,
1485
- useMemo as useMemo2
1298
+ createContext as createContext3,
1299
+ useContext as useContext3,
1300
+ useMemo
1486
1301
  } from "react";
1487
- var FunkitConnectChainContext = createContext4(
1302
+ var FunkitConnectChainContext = createContext3(
1488
1303
  {
1489
1304
  chains: []
1490
1305
  }
1491
1306
  );
1492
- var useFunkitConnectChains = () => useContext4(FunkitConnectChainContext).chains;
1307
+ var useFunkitConnectChains = () => useContext3(FunkitConnectChainContext).chains;
1493
1308
  var useFunkitConnectChainsById = () => groupChainsById(useFunkitConnectChains());
1494
1309
 
1495
1310
  export {
1496
1311
  chainMetadataById,
1497
1312
  useFunkitConnectChainsById,
1498
- useFunkitConfig,
1499
1313
  TooltipAnchorRefContext,
1500
1314
  FunSkeletonBlock,
1501
1315
  FunInput
@@ -225,6 +225,7 @@ var getRemoteImageStyles = (isRemoteImage, isRemoteImageLoaded, src) => {
225
225
  };
226
226
 
227
227
  export {
228
+ sanitizeUrl,
228
229
  preloadRemoteImages,
229
230
  AsyncImage
230
231
  };