@funkit/connect 6.14.8 → 6.14.9
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/CHANGELOG.md +23 -0
- package/dist/hooks/track/useTrack.d.ts +36 -0
- package/dist/hooks/useCheckoutAccountBalanceTransfer.d.ts +1 -1
- package/dist/hooks/useCheckoutDirectExecution.d.ts +2 -1
- package/dist/hooks/useIsUsUser.d.ts +0 -2
- package/dist/hooks/useOnNewNotification.d.ts +8 -0
- package/dist/index.js +748 -348
- package/dist/modals/CheckoutModal/FunCheckoutStep.d.ts +20 -0
- package/dist/modals/CheckoutModal/TransferToken/CheckoutNotifications.track.d.ts +3 -0
- package/dist/modals/CheckoutModal/stepTransition.d.ts +3 -22
- package/dist/modals/CheckoutModal/stepTransition.track.d.ts +4 -0
- package/dist/providers/FunkitCheckoutContext.track.d.ts +10 -0
- package/dist/providers/FunkitQuoteContext.track.d.ts +4 -0
- package/dist/providers/FunkitStatsigProvider.d.ts +8 -0
- package/dist/utils/checkout.d.ts +1 -1
- package/dist/utils/flags/config.d.ts +4 -3
- package/dist/utils/flags/types.d.ts +1 -1
- package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
- package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
- package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
- package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
- package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
- package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
- package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
- package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
- package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
- package/dist/wallets/walletConnectors/index.js +68 -68
- package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
- package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
- package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
- package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
- package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
- package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
- package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
- package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
- package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
- package/package.json +8 -7
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
lightTheme
|
|
4
|
-
} from "./chunk-XH2UUILF.js";
|
|
5
2
|
import {
|
|
6
3
|
darkTheme
|
|
7
4
|
} from "./chunk-3SMGLDNF.js";
|
|
5
|
+
import {
|
|
6
|
+
lightTheme
|
|
7
|
+
} from "./chunk-XH2UUILF.js";
|
|
8
8
|
import {
|
|
9
9
|
systemFontStack
|
|
10
10
|
} from "./chunk-WCUXJAGT.js";
|
|
@@ -413,7 +413,7 @@ function Avatar({ address, imageUrl, loading, size }) {
|
|
|
413
413
|
}
|
|
414
414
|
|
|
415
415
|
// src/components/ConnectButton/ConnectButton.tsx
|
|
416
|
-
import React231, { useEffect as
|
|
416
|
+
import React231, { useEffect as useEffect57, useState as useState74 } from "react";
|
|
417
417
|
|
|
418
418
|
// src/css/touchableStyles.css.ts
|
|
419
419
|
var active = { shrink: "_7rkubb8", shrinkSm: "_7rkubb9" };
|
|
@@ -519,9 +519,9 @@ import PrivyJS, {
|
|
|
519
519
|
} from "@privy-io/js-sdk-core";
|
|
520
520
|
import React228, {
|
|
521
521
|
createContext as createContext17,
|
|
522
|
-
useCallback as
|
|
522
|
+
useCallback as useCallback53,
|
|
523
523
|
useContext as useContext17,
|
|
524
|
-
useEffect as
|
|
524
|
+
useEffect as useEffect55,
|
|
525
525
|
useMemo as useMemo42,
|
|
526
526
|
useState as useState71
|
|
527
527
|
} from "react";
|
|
@@ -1087,9 +1087,9 @@ var useInitialChainId = () => useContext4(FunkitConnectChainContext).initialChai
|
|
|
1087
1087
|
// src/providers/ModalContext.tsx
|
|
1088
1088
|
import React227, {
|
|
1089
1089
|
createContext as createContext16,
|
|
1090
|
-
useCallback as
|
|
1090
|
+
useCallback as useCallback52,
|
|
1091
1091
|
useContext as useContext16,
|
|
1092
|
-
useEffect as
|
|
1092
|
+
useEffect as useEffect54,
|
|
1093
1093
|
useMemo as useMemo41,
|
|
1094
1094
|
useState as useState70
|
|
1095
1095
|
} from "react";
|
|
@@ -1179,9 +1179,9 @@ import {
|
|
|
1179
1179
|
import { isNotNullish as isNotNullish3 } from "@funkit/utils";
|
|
1180
1180
|
import React14, {
|
|
1181
1181
|
createContext as createContext10,
|
|
1182
|
-
useCallback as
|
|
1182
|
+
useCallback as useCallback11,
|
|
1183
1183
|
useContext as useContext10,
|
|
1184
|
-
useEffect as
|
|
1184
|
+
useEffect as useEffect9,
|
|
1185
1185
|
useRef as useRef2,
|
|
1186
1186
|
useState as useState7
|
|
1187
1187
|
} from "react";
|
|
@@ -1500,9 +1500,9 @@ import { Auth, Chain, FunWallet, configureEnvironment as configureEnvironment2 }
|
|
|
1500
1500
|
import { formatAddress as formatAddress2 } from "@funkit/utils";
|
|
1501
1501
|
import React10, {
|
|
1502
1502
|
createContext as createContext5,
|
|
1503
|
-
useCallback as
|
|
1503
|
+
useCallback as useCallback4,
|
|
1504
1504
|
useContext as useContext5,
|
|
1505
|
-
useEffect as
|
|
1505
|
+
useEffect as useEffect5,
|
|
1506
1506
|
useMemo as useMemo4,
|
|
1507
1507
|
useState as useState4
|
|
1508
1508
|
} from "react";
|
|
@@ -1513,6 +1513,91 @@ import {
|
|
|
1513
1513
|
useSwitchChain
|
|
1514
1514
|
} from "wagmi";
|
|
1515
1515
|
|
|
1516
|
+
// src/hooks/track/useTrack.ts
|
|
1517
|
+
import { flatten } from "@funkit/utils";
|
|
1518
|
+
import {
|
|
1519
|
+
useStatsigClient,
|
|
1520
|
+
useStatsigUser
|
|
1521
|
+
} from "@statsig/react-bindings";
|
|
1522
|
+
import { useCallback as useCallback3 } from "react";
|
|
1523
|
+
|
|
1524
|
+
// src/providers/useFingerprint.ts
|
|
1525
|
+
import { useCallback as useCallback2, useEffect as useEffect4 } from "react";
|
|
1526
|
+
var storageKey = "funkit-connect-version";
|
|
1527
|
+
function setFunkitConnectVersion({ version }) {
|
|
1528
|
+
localStorage.setItem(storageKey, version);
|
|
1529
|
+
}
|
|
1530
|
+
function getCurrentSdkVersion() {
|
|
1531
|
+
return "6.14.9";
|
|
1532
|
+
}
|
|
1533
|
+
function useFingerprint() {
|
|
1534
|
+
const fingerprint = useCallback2(() => {
|
|
1535
|
+
setFunkitConnectVersion({ version: getCurrentSdkVersion() });
|
|
1536
|
+
}, []);
|
|
1537
|
+
useEffect4(() => {
|
|
1538
|
+
fingerprint();
|
|
1539
|
+
}, [fingerprint]);
|
|
1540
|
+
}
|
|
1541
|
+
|
|
1542
|
+
// src/hooks/track/useTrack.ts
|
|
1543
|
+
var stringifyValues = (metadata) => {
|
|
1544
|
+
const normalizedMetadata = {};
|
|
1545
|
+
for (const [key, value] of Object.entries(metadata)) {
|
|
1546
|
+
if (value === void 0 || value === null) {
|
|
1547
|
+
continue;
|
|
1548
|
+
}
|
|
1549
|
+
normalizedMetadata[key] = JSON.stringify(value);
|
|
1550
|
+
}
|
|
1551
|
+
return normalizedMetadata;
|
|
1552
|
+
};
|
|
1553
|
+
var useTrack = () => {
|
|
1554
|
+
const { logEvent: logStatsigEvent } = useStatsigClient();
|
|
1555
|
+
const { updateUserAsync: updateStatsigUserAsync } = useStatsigUser();
|
|
1556
|
+
const logEvent = useCallback3(
|
|
1557
|
+
(eventNameOrTrackEventData) => {
|
|
1558
|
+
try {
|
|
1559
|
+
const isString = typeof eventNameOrTrackEventData === "string";
|
|
1560
|
+
if (isString) {
|
|
1561
|
+
logStatsigEvent(eventNameOrTrackEventData);
|
|
1562
|
+
} else {
|
|
1563
|
+
const {
|
|
1564
|
+
eventName,
|
|
1565
|
+
value,
|
|
1566
|
+
metadata: rawMetadata
|
|
1567
|
+
} = eventNameOrTrackEventData;
|
|
1568
|
+
const metadata = rawMetadata && stringifyValues(flatten(rawMetadata));
|
|
1569
|
+
logStatsigEvent(eventName, value, metadata);
|
|
1570
|
+
}
|
|
1571
|
+
} catch (error) {
|
|
1572
|
+
logger.error("useTrack:error", error);
|
|
1573
|
+
}
|
|
1574
|
+
},
|
|
1575
|
+
[logStatsigEvent]
|
|
1576
|
+
);
|
|
1577
|
+
const updateUserAsync = useCallback3(
|
|
1578
|
+
(userInfo, apiKey) => {
|
|
1579
|
+
const appVersion = getCurrentSdkVersion();
|
|
1580
|
+
const userAgent = navigator.userAgent;
|
|
1581
|
+
const statsigUser = {
|
|
1582
|
+
userID: userInfo.id,
|
|
1583
|
+
userAgent,
|
|
1584
|
+
appVersion,
|
|
1585
|
+
custom: {
|
|
1586
|
+
name: userInfo.name,
|
|
1587
|
+
type: userInfo.type,
|
|
1588
|
+
apiKey
|
|
1589
|
+
}
|
|
1590
|
+
};
|
|
1591
|
+
return updateStatsigUserAsync(statsigUser);
|
|
1592
|
+
},
|
|
1593
|
+
[updateStatsigUserAsync]
|
|
1594
|
+
);
|
|
1595
|
+
return {
|
|
1596
|
+
logEvent,
|
|
1597
|
+
updateUserAsync
|
|
1598
|
+
};
|
|
1599
|
+
};
|
|
1600
|
+
|
|
1516
1601
|
// src/utils/funkitProvider.ts
|
|
1517
1602
|
function getInitialChainIdFromFunkitProviderProps(props) {
|
|
1518
1603
|
if (!props.wagmiConfig) {
|
|
@@ -1669,6 +1754,7 @@ function GeneralWalletProvider({ children }) {
|
|
|
1669
1754
|
const ensAvatar = useMainnetEnsAvatar(ensName);
|
|
1670
1755
|
const { web2UserInfo, handleFunkitWeb2Logout } = useFunkitWeb2Login();
|
|
1671
1756
|
const { externalUserId, apiKey } = useFunkitConfig();
|
|
1757
|
+
const { updateUserAsync } = useTrack();
|
|
1672
1758
|
const loginType = !connector ? "guest" /* Guest */ : connector.id === FUNKIT_CONNECT_WALLET_ID ? "web2" /* Web2 */ : "web3" /* Web3 */;
|
|
1673
1759
|
const isUserLoggedIn = loginType !== "guest" /* Guest */ || !!externalUserId;
|
|
1674
1760
|
const userInfo = useMemo4(() => {
|
|
@@ -1709,9 +1795,12 @@ function GeneralWalletProvider({ children }) {
|
|
|
1709
1795
|
apiKey,
|
|
1710
1796
|
externalUserId
|
|
1711
1797
|
]);
|
|
1712
|
-
|
|
1798
|
+
useEffect5(() => {
|
|
1713
1799
|
if (userInfo.id !== logger.getUserId() || userInfo.address !== logger.getUserAddress() || userInfo.name !== logger.getUserName() || userInfo.type !== logger.getUserLoginType()) {
|
|
1714
1800
|
logger.log("settingUserInfo", userInfo);
|
|
1801
|
+
updateUserAsync(userInfo, apiKey).catch(
|
|
1802
|
+
(error) => logger.error("updateUserAsync:error", error)
|
|
1803
|
+
);
|
|
1715
1804
|
logger.setUserInfo(
|
|
1716
1805
|
userInfo.id,
|
|
1717
1806
|
userInfo.address,
|
|
@@ -1719,10 +1808,10 @@ function GeneralWalletProvider({ children }) {
|
|
|
1719
1808
|
userInfo.type
|
|
1720
1809
|
);
|
|
1721
1810
|
}
|
|
1722
|
-
}, [userInfo]);
|
|
1811
|
+
}, [userInfo, updateUserAsync, apiKey]);
|
|
1723
1812
|
const [funWalletAuth, setFunWalletAuth] = useState4(null);
|
|
1724
1813
|
const [funWallet, setFunWallet] = useState4(null);
|
|
1725
|
-
|
|
1814
|
+
useEffect5(() => {
|
|
1726
1815
|
async function setupFunWallet() {
|
|
1727
1816
|
let newFunWalletAuth = null;
|
|
1728
1817
|
let newFunWallet = null;
|
|
@@ -1762,7 +1851,7 @@ function GeneralWalletProvider({ children }) {
|
|
|
1762
1851
|
);
|
|
1763
1852
|
}, [connector, loginType, activeChain]);
|
|
1764
1853
|
const [logoutSymbol, triggerLogoutSymbol] = useSymbolRefresh_default();
|
|
1765
|
-
const handleLogout =
|
|
1854
|
+
const handleLogout = useCallback4(async () => {
|
|
1766
1855
|
logger.log("handleLogout_called");
|
|
1767
1856
|
singletonAssetAbort.abort("Abort on logout");
|
|
1768
1857
|
singletonAssetAbort.setAbortController(new AbortController());
|
|
@@ -1859,7 +1948,7 @@ var useFunkitSwitchChains = ({
|
|
|
1859
1948
|
}
|
|
1860
1949
|
}
|
|
1861
1950
|
});
|
|
1862
|
-
const canSwitchChain =
|
|
1951
|
+
const canSwitchChain = useCallback4(
|
|
1863
1952
|
(params) => {
|
|
1864
1953
|
if (loginType === "web2" /* Web2 */ && !FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO[params.chainId]?.isFunWalletSupported) {
|
|
1865
1954
|
logger.warn(
|
|
@@ -1871,7 +1960,7 @@ var useFunkitSwitchChains = ({
|
|
|
1871
1960
|
},
|
|
1872
1961
|
[loginType]
|
|
1873
1962
|
);
|
|
1874
|
-
const switchChainWithGuard =
|
|
1963
|
+
const switchChainWithGuard = useCallback4(
|
|
1875
1964
|
(params) => {
|
|
1876
1965
|
if (canSwitchChain(params)) {
|
|
1877
1966
|
switchChain(params);
|
|
@@ -1879,7 +1968,7 @@ var useFunkitSwitchChains = ({
|
|
|
1879
1968
|
},
|
|
1880
1969
|
[canSwitchChain, switchChain]
|
|
1881
1970
|
);
|
|
1882
|
-
const switchChainAsyncWithGuard =
|
|
1971
|
+
const switchChainAsyncWithGuard = useCallback4(
|
|
1883
1972
|
async (params) => {
|
|
1884
1973
|
if (canSwitchChain(params)) {
|
|
1885
1974
|
await switchChainAsync(params);
|
|
@@ -2148,9 +2237,9 @@ import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS
|
|
|
2148
2237
|
import { FlagKey as FlagKey6, isNotNullish as isNotNullish2 } from "@funkit/utils";
|
|
2149
2238
|
import React13, {
|
|
2150
2239
|
createContext as createContext9,
|
|
2151
|
-
useCallback as
|
|
2240
|
+
useCallback as useCallback10,
|
|
2152
2241
|
useContext as useContext9,
|
|
2153
|
-
useEffect as
|
|
2242
|
+
useEffect as useEffect8,
|
|
2154
2243
|
useState as useState6
|
|
2155
2244
|
} from "react";
|
|
2156
2245
|
import { flushSync } from "react-dom";
|
|
@@ -2160,7 +2249,7 @@ import { v4 as uuid } from "uuid";
|
|
|
2160
2249
|
import { DirectExecutionType, getCheckoutQuoteV2 } from "@funkit/api-base";
|
|
2161
2250
|
import { executeRelayQuote } from "@funkit/fun-relay";
|
|
2162
2251
|
import { FlagKey as FlagKey4 } from "@funkit/utils";
|
|
2163
|
-
import { useCallback as
|
|
2252
|
+
import { useCallback as useCallback7 } from "react";
|
|
2164
2253
|
import { useConfig as useConfig2, useWalletClient } from "wagmi";
|
|
2165
2254
|
|
|
2166
2255
|
// src/consts/checkout.ts
|
|
@@ -2180,7 +2269,7 @@ var WEB3_ACCOUNT_BALANCE_MESSAGE = {
|
|
|
2180
2269
|
|
|
2181
2270
|
// src/hooks/useIsTokenWhitelisted.ts
|
|
2182
2271
|
import { isTokenAddressEquivalent as isTokenAddressEquivalent2 } from "@funkit/utils";
|
|
2183
|
-
import { useCallback as
|
|
2272
|
+
import { useCallback as useCallback5, useMemo as useMemo7 } from "react";
|
|
2184
2273
|
|
|
2185
2274
|
// src/providers/FunkitFlagsProvider.tsx
|
|
2186
2275
|
import { datadogLogs as datadogLogs2 } from "@datadog/browser-logs";
|
|
@@ -2188,7 +2277,7 @@ import { useQuery as useQuery2 } from "@tanstack/react-query";
|
|
|
2188
2277
|
import React12, {
|
|
2189
2278
|
createContext as createContext8,
|
|
2190
2279
|
useContext as useContext8,
|
|
2191
|
-
useEffect as
|
|
2280
|
+
useEffect as useEffect7,
|
|
2192
2281
|
useMemo as useMemo6
|
|
2193
2282
|
} from "react";
|
|
2194
2283
|
|
|
@@ -2279,6 +2368,30 @@ var WITHDRAWAL_CHAINS_AND_ASSETS = {
|
|
|
2279
2368
|
// solana
|
|
2280
2369
|
1151111081099710: ["SOL", "USDC", "USDT"]
|
|
2281
2370
|
};
|
|
2371
|
+
var createConditionalOverride = (blockedCountry, apiKeys, value) => {
|
|
2372
|
+
return {
|
|
2373
|
+
if_all: [
|
|
2374
|
+
{
|
|
2375
|
+
key: "ipCountry",
|
|
2376
|
+
type: "isAnyOf",
|
|
2377
|
+
values: [blockedCountry]
|
|
2378
|
+
},
|
|
2379
|
+
{
|
|
2380
|
+
key: "apiKey",
|
|
2381
|
+
type: "isAnyOf",
|
|
2382
|
+
values: apiKeys
|
|
2383
|
+
}
|
|
2384
|
+
],
|
|
2385
|
+
if_any: [
|
|
2386
|
+
{
|
|
2387
|
+
key: "userId",
|
|
2388
|
+
type: "pctRollout",
|
|
2389
|
+
pct: 100
|
|
2390
|
+
}
|
|
2391
|
+
],
|
|
2392
|
+
value
|
|
2393
|
+
};
|
|
2394
|
+
};
|
|
2282
2395
|
var flagConfig = {
|
|
2283
2396
|
[FlagKey.SupportedExchangesV2]: {
|
|
2284
2397
|
type: "string",
|
|
@@ -2351,6 +2464,11 @@ var flagConfig = {
|
|
|
2351
2464
|
type: "boolean",
|
|
2352
2465
|
default_value: false,
|
|
2353
2466
|
overrides: [
|
|
2467
|
+
createConditionalOverride(
|
|
2468
|
+
"US",
|
|
2469
|
+
[HYPERDASH_API_KEY, KATANA_API_KEY],
|
|
2470
|
+
false
|
|
2471
|
+
),
|
|
2354
2472
|
{
|
|
2355
2473
|
if_any: [
|
|
2356
2474
|
{
|
|
@@ -2379,6 +2497,7 @@ var flagConfig = {
|
|
|
2379
2497
|
type: "boolean",
|
|
2380
2498
|
default_value: false,
|
|
2381
2499
|
overrides: [
|
|
2500
|
+
createConditionalOverride("US", [HYPERDASH_API_KEY], false),
|
|
2382
2501
|
{
|
|
2383
2502
|
if_any: [
|
|
2384
2503
|
{
|
|
@@ -2625,6 +2744,7 @@ var flagConfig = {
|
|
|
2625
2744
|
type: "boolean",
|
|
2626
2745
|
default_value: true,
|
|
2627
2746
|
overrides: [
|
|
2747
|
+
createConditionalOverride("US", [HYPERDASH_API_KEY], false),
|
|
2628
2748
|
{
|
|
2629
2749
|
if_any: [
|
|
2630
2750
|
{
|
|
@@ -3000,7 +3120,7 @@ import { useQuery } from "@tanstack/react-query";
|
|
|
3000
3120
|
import React11, {
|
|
3001
3121
|
createContext as createContext7,
|
|
3002
3122
|
useContext as useContext7,
|
|
3003
|
-
useEffect as
|
|
3123
|
+
useEffect as useEffect6,
|
|
3004
3124
|
useMemo as useMemo5,
|
|
3005
3125
|
useState as useState5
|
|
3006
3126
|
} from "react";
|
|
@@ -3035,9 +3155,6 @@ function isEtherealCustomer(apiKey) {
|
|
|
3035
3155
|
function isKatanaCustomer(apiKey) {
|
|
3036
3156
|
return apiKey === KATANA_API_KEY2;
|
|
3037
3157
|
}
|
|
3038
|
-
function isHyperdashCustomer(apiKey) {
|
|
3039
|
-
return apiKey === HYPERDASH_API_KEY2;
|
|
3040
|
-
}
|
|
3041
3158
|
function isBasedCustomer(apiKey) {
|
|
3042
3159
|
return apiKey === BASED_API_KEY2;
|
|
3043
3160
|
}
|
|
@@ -3053,7 +3170,7 @@ var useIsFunkitSandboxMode = () => useContext6(FunkitSandboxContext);
|
|
|
3053
3170
|
// src/providers/FunkitMoonpayProvider.tsx
|
|
3054
3171
|
var LazyMoonPayProvider = (props) => {
|
|
3055
3172
|
const [MoonPayProvider, setMoonPayProvider] = useState5(null);
|
|
3056
|
-
|
|
3173
|
+
useEffect6(() => {
|
|
3057
3174
|
const loadMoonPayProvider = async () => {
|
|
3058
3175
|
const module = await import("@moonpay/moonpay-react");
|
|
3059
3176
|
setMoonPayProvider(() => module.MoonPayProvider);
|
|
@@ -3216,12 +3333,12 @@ function FunkitFlagsProvider({ children }) {
|
|
|
3216
3333
|
isLoading
|
|
3217
3334
|
};
|
|
3218
3335
|
}, [error, flags, isLoading]);
|
|
3219
|
-
|
|
3336
|
+
useEffect7(() => {
|
|
3220
3337
|
if (!isLoading) {
|
|
3221
3338
|
datadogLogs2.setGlobalContextProperty("flags", flags);
|
|
3222
3339
|
}
|
|
3223
3340
|
}, [flags, isLoading]);
|
|
3224
|
-
|
|
3341
|
+
useEffect7(() => {
|
|
3225
3342
|
if (error) {
|
|
3226
3343
|
logger.error("flag_initError", error);
|
|
3227
3344
|
}
|
|
@@ -3252,7 +3369,7 @@ var useIsTokenWhitelisted = (flagKey) => {
|
|
|
3252
3369
|
() => safeJSONParse(whitelistedTokensString),
|
|
3253
3370
|
[whitelistedTokensString]
|
|
3254
3371
|
);
|
|
3255
|
-
const isTokenWhitelisted =
|
|
3372
|
+
const isTokenWhitelisted = useCallback5(
|
|
3256
3373
|
(chainId, tokenAddress) => {
|
|
3257
3374
|
const tokensForChainId = toArrayIfString(whitelistedTokensByChainId?.[chainId]) ?? [];
|
|
3258
3375
|
const tokensForAllChains = toArrayIfString(whitelistedTokensByChainId?.[MATCH_ALL]) ?? [];
|
|
@@ -3288,7 +3405,7 @@ var toArrayIfString = (value) => {
|
|
|
3288
3405
|
|
|
3289
3406
|
// src/hooks/useRelayBypass.ts
|
|
3290
3407
|
import { FlagKey as FlagKey3, isTokenAddressEquivalent as isTokenAddressEquivalent3 } from "@funkit/utils";
|
|
3291
|
-
import { useCallback as
|
|
3408
|
+
import { useCallback as useCallback6, useMemo as useMemo8 } from "react";
|
|
3292
3409
|
var isTokenFlagEnabled = (tokenList, tokenAddress) => {
|
|
3293
3410
|
if (tokenList.includes("*")) {
|
|
3294
3411
|
return true;
|
|
@@ -3309,7 +3426,7 @@ function useSourceTokenRelayEnabled() {
|
|
|
3309
3426
|
() => safeJSONParse(sourceTokensJsonString),
|
|
3310
3427
|
[sourceTokensJsonString]
|
|
3311
3428
|
);
|
|
3312
|
-
const isAllowed =
|
|
3429
|
+
const isAllowed = useCallback6(
|
|
3313
3430
|
(chainId, tokenAddress) => {
|
|
3314
3431
|
return isRelayBypassEnabled && isTokenFlagEnabled(
|
|
3315
3432
|
sourceTokens?.[Number.parseInt(`${chainId}`)] || [],
|
|
@@ -3353,7 +3470,7 @@ function useRelayBypass() {
|
|
|
3353
3470
|
};
|
|
3354
3471
|
}, [apiKey]);
|
|
3355
3472
|
return {
|
|
3356
|
-
getIsRelayEnabled:
|
|
3473
|
+
getIsRelayEnabled: useCallback6(
|
|
3357
3474
|
({
|
|
3358
3475
|
fromChainId,
|
|
3359
3476
|
fromTokenAddress,
|
|
@@ -3402,7 +3519,7 @@ function useCheckoutDirectExecution() {
|
|
|
3402
3519
|
const { apiKey } = useFunkitConfig();
|
|
3403
3520
|
const isPermitEnabledForToken = useIsTokenWhitelisted(FlagKey4.Permit2Tokens);
|
|
3404
3521
|
const wagmiConfig = useConfig2();
|
|
3405
|
-
const getRelayDirectExecutionBaseQuote =
|
|
3522
|
+
const getRelayDirectExecutionBaseQuote = useCallback7(
|
|
3406
3523
|
async (params) => {
|
|
3407
3524
|
const {
|
|
3408
3525
|
actionParams,
|
|
@@ -3449,7 +3566,7 @@ function useCheckoutDirectExecution() {
|
|
|
3449
3566
|
},
|
|
3450
3567
|
[address, apiKey, isPermitEnabledForToken, wagmiConfig]
|
|
3451
3568
|
);
|
|
3452
|
-
const checkAndSwitchChains =
|
|
3569
|
+
const checkAndSwitchChains = useCallback7(
|
|
3453
3570
|
async ({
|
|
3454
3571
|
executionChainId,
|
|
3455
3572
|
stepMessageSetter
|
|
@@ -3473,7 +3590,7 @@ function useCheckoutDirectExecution() {
|
|
|
3473
3590
|
},
|
|
3474
3591
|
[connector, switchChainAsync]
|
|
3475
3592
|
);
|
|
3476
|
-
const startRelayDirectExecution =
|
|
3593
|
+
const startRelayDirectExecution = useCallback7(
|
|
3477
3594
|
async ({
|
|
3478
3595
|
checkoutItem,
|
|
3479
3596
|
latestQuote,
|
|
@@ -3508,7 +3625,7 @@ function useCheckoutDirectExecution() {
|
|
|
3508
3625
|
logger.info("executeRelayQuote:onTransactionConfirmed", {
|
|
3509
3626
|
txHash
|
|
3510
3627
|
});
|
|
3511
|
-
onTransactionConfirmed();
|
|
3628
|
+
onTransactionConfirmed(txHash);
|
|
3512
3629
|
},
|
|
3513
3630
|
onUserActionsCompleted: async (txHash) => {
|
|
3514
3631
|
logger.info("executeRelayQuote:onUserActionsCompleted", {
|
|
@@ -3550,7 +3667,7 @@ function useCheckoutDirectExecution() {
|
|
|
3550
3667
|
},
|
|
3551
3668
|
[walletClient, checkAndSwitchChains]
|
|
3552
3669
|
);
|
|
3553
|
-
const getDirectExecutionInfo =
|
|
3670
|
+
const getDirectExecutionInfo = useCallback7(
|
|
3554
3671
|
(checkoutItem) => {
|
|
3555
3672
|
const noop10 = {
|
|
3556
3673
|
isDirectExecution: false,
|
|
@@ -3588,7 +3705,7 @@ function useCheckoutDirectExecution() {
|
|
|
3588
3705
|
startRelayDirectExecution
|
|
3589
3706
|
]
|
|
3590
3707
|
);
|
|
3591
|
-
const getWithdrawalDirectExecution =
|
|
3708
|
+
const getWithdrawalDirectExecution = useCallback7(() => {
|
|
3592
3709
|
const quoteAction = getRelayDirectExecutionBaseQuote;
|
|
3593
3710
|
const executeAction = startRelayDirectExecution;
|
|
3594
3711
|
return {
|
|
@@ -3610,7 +3727,7 @@ import {
|
|
|
3610
3727
|
} from "@funkit/api-base";
|
|
3611
3728
|
import { FlagKey as FlagKey5 } from "@funkit/utils";
|
|
3612
3729
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
3613
|
-
import { useCallback as
|
|
3730
|
+
import { useCallback as useCallback8 } from "react";
|
|
3614
3731
|
|
|
3615
3732
|
// src/domains/clientMetadata.ts
|
|
3616
3733
|
function generateClientMetadataForBackend({
|
|
@@ -3693,7 +3810,7 @@ var useCheckoutTransferInit = () => {
|
|
|
3693
3810
|
apiKey,
|
|
3694
3811
|
actionType: checkoutConfig?.qrcodeActionType
|
|
3695
3812
|
};
|
|
3696
|
-
const queryFunction =
|
|
3813
|
+
const queryFunction = useCallback8(
|
|
3697
3814
|
async (params) => {
|
|
3698
3815
|
return await initializeCheckoutTokenTransferAddress({
|
|
3699
3816
|
...params,
|
|
@@ -3725,13 +3842,13 @@ var useCheckoutTransferInit = () => {
|
|
|
3725
3842
|
};
|
|
3726
3843
|
|
|
3727
3844
|
// src/hooks/useEffectEvent.ts
|
|
3728
|
-
import { useCallback as
|
|
3845
|
+
import { useCallback as useCallback9, useInsertionEffect, useRef } from "react";
|
|
3729
3846
|
function useEffectEvent(fn) {
|
|
3730
3847
|
const savedCallback = useRef(fn);
|
|
3731
3848
|
useInsertionEffect(() => {
|
|
3732
3849
|
savedCallback.current = fn;
|
|
3733
3850
|
}, [fn]);
|
|
3734
|
-
return
|
|
3851
|
+
return useCallback9(
|
|
3735
3852
|
(...args) => {
|
|
3736
3853
|
const f = savedCallback.current;
|
|
3737
3854
|
return f(...args);
|
|
@@ -3760,6 +3877,48 @@ function generateSourceOfFundString({
|
|
|
3760
3877
|
return "";
|
|
3761
3878
|
}
|
|
3762
3879
|
|
|
3880
|
+
// src/providers/FunkitCheckoutContext.track.ts
|
|
3881
|
+
var trackEventFromActiveCheckoutItem = (activeCheckoutItem) => {
|
|
3882
|
+
const eventName = "fc::modal_opened" /* MODAL_OPENED */;
|
|
3883
|
+
const metadata = {
|
|
3884
|
+
...activeCheckoutItem,
|
|
3885
|
+
// rename id to checkoutId for consistency with `NAVIGATION_` events metadata format
|
|
3886
|
+
checkoutId: activeCheckoutItem.id,
|
|
3887
|
+
id: void 0
|
|
3888
|
+
};
|
|
3889
|
+
return {
|
|
3890
|
+
eventName,
|
|
3891
|
+
metadata
|
|
3892
|
+
};
|
|
3893
|
+
};
|
|
3894
|
+
var cleanupLatestQuote = (latestQuote) => {
|
|
3895
|
+
const { baseQuote, ...rest } = latestQuote;
|
|
3896
|
+
return {
|
|
3897
|
+
...rest,
|
|
3898
|
+
base: {
|
|
3899
|
+
...baseQuote,
|
|
3900
|
+
metadata: void 0
|
|
3901
|
+
},
|
|
3902
|
+
quoteId: baseQuote.quoteId
|
|
3903
|
+
};
|
|
3904
|
+
};
|
|
3905
|
+
var trackEventFromDirectExecutionConfirmed = ({
|
|
3906
|
+
txHash,
|
|
3907
|
+
checkoutItem,
|
|
3908
|
+
latestQuote
|
|
3909
|
+
}) => {
|
|
3910
|
+
return {
|
|
3911
|
+
// for PaymentMethod.ACCOUNT_BALANCE we always use direct execution
|
|
3912
|
+
eventName: "fc::success::account_balance" /* ACCOUNT_BALANCE_SUCCESS */,
|
|
3913
|
+
metadata: {
|
|
3914
|
+
txHash,
|
|
3915
|
+
checkoutItem,
|
|
3916
|
+
checkoutId: checkoutItem.id,
|
|
3917
|
+
quote: cleanupLatestQuote(latestQuote)
|
|
3918
|
+
}
|
|
3919
|
+
};
|
|
3920
|
+
};
|
|
3921
|
+
|
|
3763
3922
|
// src/providers/FunkitCheckoutContext.tsx
|
|
3764
3923
|
var FunCheckoutStartingStep = /* @__PURE__ */ ((FunCheckoutStartingStep2) => {
|
|
3765
3924
|
FunCheckoutStartingStep2["SOURCE_CHANGE"] = "source_change";
|
|
@@ -3798,22 +3957,23 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
3798
3957
|
const { refreshCheckoutHistory } = useCheckoutHistoryContext();
|
|
3799
3958
|
const { getDirectExecutionInfo, getWithdrawalDirectExecution } = useCheckoutDirectExecution();
|
|
3800
3959
|
const { manualFetch } = useCheckoutTransferInit();
|
|
3960
|
+
const { logEvent } = useTrack();
|
|
3801
3961
|
const [activeCheckout, setActiveCheckout] = useState6(null);
|
|
3802
3962
|
const [activeWithdrawal, setActiveWithdrawal] = useState6(null);
|
|
3803
3963
|
const [checkoutsProgress, setCheckoutsProgress] = useState6({});
|
|
3804
|
-
const getCheckoutProgress =
|
|
3964
|
+
const getCheckoutProgress = useCallback10(
|
|
3805
3965
|
(checkoutId) => {
|
|
3806
3966
|
return checkoutsProgress[checkoutId];
|
|
3807
3967
|
},
|
|
3808
3968
|
[checkoutsProgress]
|
|
3809
3969
|
);
|
|
3810
|
-
const setCheckoutProgress =
|
|
3970
|
+
const setCheckoutProgress = useCallback10(
|
|
3811
3971
|
(checkoutId, progress) => {
|
|
3812
3972
|
setCheckoutsProgress((data) => ({ ...data, [checkoutId]: progress }));
|
|
3813
3973
|
},
|
|
3814
3974
|
[]
|
|
3815
3975
|
);
|
|
3816
|
-
|
|
3976
|
+
useEffect8(() => {
|
|
3817
3977
|
if (isNotNullish2(logoutSymbol)) {
|
|
3818
3978
|
setActiveCheckout(null);
|
|
3819
3979
|
}
|
|
@@ -3829,7 +3989,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
3829
3989
|
});
|
|
3830
3990
|
}
|
|
3831
3991
|
);
|
|
3832
|
-
const initNewWithdrawal =
|
|
3992
|
+
const initNewWithdrawal = useCallback10(
|
|
3833
3993
|
(props) => {
|
|
3834
3994
|
const { onWithdrawalConfirmation, onWithdrawalError, config } = props;
|
|
3835
3995
|
const newWithdrawalId = uuid();
|
|
@@ -3847,7 +4007,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
3847
4007
|
},
|
|
3848
4008
|
[]
|
|
3849
4009
|
);
|
|
3850
|
-
const initNewCheckout =
|
|
4010
|
+
const initNewCheckout = useCallback10(
|
|
3851
4011
|
({ config, ...initSettings }) => {
|
|
3852
4012
|
const newCheckoutId = uuid();
|
|
3853
4013
|
const newActiveCheckoutItem = {
|
|
@@ -3877,9 +4037,11 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
3877
4037
|
};
|
|
3878
4038
|
setActiveCheckout(newActiveCheckoutItem);
|
|
3879
4039
|
logger.log("checkoutStarted", newActiveCheckoutItem);
|
|
4040
|
+
const trackEvent = trackEventFromActiveCheckoutItem(newActiveCheckoutItem);
|
|
4041
|
+
logEvent(trackEvent);
|
|
3880
4042
|
return newCheckoutId;
|
|
3881
4043
|
},
|
|
3882
|
-
[]
|
|
4044
|
+
[logEvent]
|
|
3883
4045
|
);
|
|
3884
4046
|
const updateSourceAsset = useEffectEvent(
|
|
3885
4047
|
(selectedSource) => {
|
|
@@ -3922,7 +4084,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
3922
4084
|
});
|
|
3923
4085
|
}
|
|
3924
4086
|
);
|
|
3925
|
-
const startDirectExecutionCheckout =
|
|
4087
|
+
const startDirectExecutionCheckout = useCallback10(
|
|
3926
4088
|
async ({
|
|
3927
4089
|
stepMessageSetter,
|
|
3928
4090
|
latestQuote,
|
|
@@ -3943,8 +4105,14 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
3943
4105
|
actionsParams,
|
|
3944
4106
|
checkoutItem,
|
|
3945
4107
|
latestQuote,
|
|
3946
|
-
onTransactionConfirmed: () => {
|
|
4108
|
+
onTransactionConfirmed: (txHash2) => {
|
|
3947
4109
|
setCheckoutProgress(checkoutItem.id, { step: 2 });
|
|
4110
|
+
const trackEvent = trackEventFromDirectExecutionConfirmed({
|
|
4111
|
+
txHash: txHash2,
|
|
4112
|
+
checkoutItem,
|
|
4113
|
+
latestQuote
|
|
4114
|
+
});
|
|
4115
|
+
logEvent(trackEvent);
|
|
3948
4116
|
},
|
|
3949
4117
|
stepMessageSetter,
|
|
3950
4118
|
withdrawalClient
|
|
@@ -4005,10 +4173,11 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
4005
4173
|
updateActiveCheckout,
|
|
4006
4174
|
walletAddress,
|
|
4007
4175
|
getWithdrawalDirectExecution,
|
|
4008
|
-
manualFetch
|
|
4176
|
+
manualFetch,
|
|
4177
|
+
logEvent
|
|
4009
4178
|
]
|
|
4010
4179
|
);
|
|
4011
|
-
const startRegularCheckout =
|
|
4180
|
+
const startRegularCheckout = useCallback10(
|
|
4012
4181
|
async ({
|
|
4013
4182
|
stepMessageSetter,
|
|
4014
4183
|
latestQuote,
|
|
@@ -4209,14 +4378,14 @@ function useFunkitCheckout(props) {
|
|
|
4209
4378
|
const { connectModalOpen, openConnectModal } = useConnectModal();
|
|
4210
4379
|
const { isUserLoggedIn } = useGeneralWallet();
|
|
4211
4380
|
const isCheckoutActivated = useFlag(FlagKey6.IsCheckoutActivated);
|
|
4212
|
-
const onErrorWrapper =
|
|
4381
|
+
const onErrorWrapper = useCallback10(
|
|
4213
4382
|
(payload) => {
|
|
4214
4383
|
logger.warn(payload.message, payload);
|
|
4215
4384
|
onError?.(payload);
|
|
4216
4385
|
},
|
|
4217
4386
|
[onError]
|
|
4218
4387
|
);
|
|
4219
|
-
const onOpenWrapper =
|
|
4388
|
+
const onOpenWrapper = useCallback10(
|
|
4220
4389
|
(newId) => {
|
|
4221
4390
|
props?.onOpen?.();
|
|
4222
4391
|
openFunCheckoutModal?.(newId);
|
|
@@ -4315,13 +4484,13 @@ function useFunkitCheckout(props) {
|
|
|
4315
4484
|
});
|
|
4316
4485
|
openWithdrawalModal?.({ withdrawalId, ...config });
|
|
4317
4486
|
});
|
|
4318
|
-
|
|
4487
|
+
useEffect8(() => {
|
|
4319
4488
|
if (isUserLoggedIn && pendingCheckoutConfig) {
|
|
4320
4489
|
setPendingCheckoutConfig(void 0);
|
|
4321
4490
|
beginCheckout(pendingCheckoutConfig);
|
|
4322
4491
|
}
|
|
4323
4492
|
}, [beginCheckout, isUserLoggedIn, pendingCheckoutConfig]);
|
|
4324
|
-
|
|
4493
|
+
useEffect8(() => {
|
|
4325
4494
|
if (pendingCheckoutConfig && !isUserLoggedIn && !connectModalOpen) {
|
|
4326
4495
|
setPendingCheckoutConfig(void 0);
|
|
4327
4496
|
}
|
|
@@ -4846,7 +5015,7 @@ function FunkitCheckoutHistoryProvider({
|
|
|
4846
5015
|
const [isInited, setIsInited] = useState7(false);
|
|
4847
5016
|
const [isRefreshing, setIsRefreshing] = useState7(true);
|
|
4848
5017
|
const isGuestUserOnCheckoutHistory = !isUserLoggedIn && !!historyDepositAddress;
|
|
4849
|
-
const _refreshCheckoutHistory =
|
|
5018
|
+
const _refreshCheckoutHistory = useCallback11(async () => {
|
|
4850
5019
|
if (!funkitConfig.apiKey) {
|
|
4851
5020
|
return;
|
|
4852
5021
|
}
|
|
@@ -4902,19 +5071,19 @@ function FunkitCheckoutHistoryProvider({
|
|
|
4902
5071
|
isUserLoggedIn,
|
|
4903
5072
|
userInfo
|
|
4904
5073
|
]);
|
|
4905
|
-
|
|
5074
|
+
useEffect9(() => {
|
|
4906
5075
|
if (isUserLoggedIn || isGuestUserOnCheckoutHistory) {
|
|
4907
5076
|
_refreshCheckoutHistory();
|
|
4908
5077
|
}
|
|
4909
5078
|
}, [refreshSymbol, isUserLoggedIn]);
|
|
4910
|
-
|
|
5079
|
+
useEffect9(() => {
|
|
4911
5080
|
if (isNotNullish3(logoutSymbol) && isInited) {
|
|
4912
5081
|
setIsInited(false);
|
|
4913
5082
|
setCheckoutHistoryList([]);
|
|
4914
5083
|
clearInterval(intervalRef.current);
|
|
4915
5084
|
}
|
|
4916
5085
|
}, [logoutSymbol]);
|
|
4917
|
-
const startCheckoutHistoryListener =
|
|
5086
|
+
const startCheckoutHistoryListener = useCallback11(
|
|
4918
5087
|
(singleDepositAddr, expedited = false) => {
|
|
4919
5088
|
setHistoryDepositAddress(singleDepositAddr);
|
|
4920
5089
|
clearInterval(intervalRef.current);
|
|
@@ -4930,7 +5099,7 @@ function FunkitCheckoutHistoryProvider({
|
|
|
4930
5099
|
},
|
|
4931
5100
|
[triggerRefreshSymbol]
|
|
4932
5101
|
);
|
|
4933
|
-
const stopCheckoutHistoryListener =
|
|
5102
|
+
const stopCheckoutHistoryListener = useCallback11(
|
|
4934
5103
|
(cancelIntervalId) => {
|
|
4935
5104
|
clearInterval(cancelIntervalId);
|
|
4936
5105
|
if (cancelIntervalId === intervalRef.current) {
|
|
@@ -5020,7 +5189,7 @@ var useFunkitPostCheckoutInternal = (checkoutId) => {
|
|
|
5020
5189
|
if (!checkoutId || !isHex(checkoutId)) {
|
|
5021
5190
|
throw new Error("Invalid checkout ID");
|
|
5022
5191
|
}
|
|
5023
|
-
|
|
5192
|
+
useEffect9(() => {
|
|
5024
5193
|
const setupCheckoutHistory = async () => {
|
|
5025
5194
|
if (checkoutId === "0x") {
|
|
5026
5195
|
return;
|
|
@@ -5082,7 +5251,7 @@ var useFunkitPostCheckoutInternal = (checkoutId) => {
|
|
|
5082
5251
|
};
|
|
5083
5252
|
|
|
5084
5253
|
// src/components/FunCheckoutHistory/FunCheckoutStatus.tsx
|
|
5085
|
-
import React22, { useEffect as
|
|
5254
|
+
import React22, { useEffect as useEffect12, useMemo as useMemo9, useState as useState10 } from "react";
|
|
5086
5255
|
|
|
5087
5256
|
// src/components/TransactionStatus/TransactionStatus.tsx
|
|
5088
5257
|
import {
|
|
@@ -5091,14 +5260,14 @@ import {
|
|
|
5091
5260
|
useAnimate
|
|
5092
5261
|
} from "motion/react";
|
|
5093
5262
|
import React21, {
|
|
5094
|
-
useCallback as
|
|
5095
|
-
useEffect as
|
|
5263
|
+
useCallback as useCallback12,
|
|
5264
|
+
useEffect as useEffect11,
|
|
5096
5265
|
useRef as useRef3,
|
|
5097
5266
|
useState as useState9
|
|
5098
5267
|
} from "react";
|
|
5099
5268
|
|
|
5100
5269
|
// src/providers/FunkitThemeProvider.tsx
|
|
5101
|
-
import React15, { createContext as createContext11, useContext as useContext11, useEffect as
|
|
5270
|
+
import React15, { createContext as createContext11, useContext as useContext11, useEffect as useEffect10, useState as useState8 } from "react";
|
|
5102
5271
|
var FUNKIT_THEME_CACHE_KEY = "funkit-connect-is-light";
|
|
5103
5272
|
var DEFAULT_THEME_SET = {
|
|
5104
5273
|
lightTheme: lightTheme(),
|
|
@@ -5181,7 +5350,7 @@ var FunkitThemeProvider = ({
|
|
|
5181
5350
|
const [activeTheme, setActiveTheme] = useState8(
|
|
5182
5351
|
getConfigTheme(themeOrThemeSet, systemColorScheme)
|
|
5183
5352
|
);
|
|
5184
|
-
|
|
5353
|
+
useEffect10(() => {
|
|
5185
5354
|
const handler = (e) => {
|
|
5186
5355
|
const colorScheme = e.matches ? "light" : "dark";
|
|
5187
5356
|
setSystemColorScheme(colorScheme);
|
|
@@ -5198,7 +5367,7 @@ var FunkitThemeProvider = ({
|
|
|
5198
5367
|
};
|
|
5199
5368
|
}
|
|
5200
5369
|
}, []);
|
|
5201
|
-
|
|
5370
|
+
useEffect10(() => {
|
|
5202
5371
|
setActiveTheme(getConfigTheme(themeOrThemeSet, systemColorScheme));
|
|
5203
5372
|
}, [systemColorScheme, themeOrThemeSet]);
|
|
5204
5373
|
const isFullThemeSet = isThemeSet(themeOrThemeSet);
|
|
@@ -5819,11 +5988,11 @@ function TransactionStatus({
|
|
|
5819
5988
|
const [transitioningToStatus, setTransitioningToStatus] = useState9(status);
|
|
5820
5989
|
const [transitioningToStep, setTransitioningToStep] = useState9(step);
|
|
5821
5990
|
const spinAnimationRef = useRef3();
|
|
5822
|
-
const stopSpinning =
|
|
5991
|
+
const stopSpinning = useCallback12(() => {
|
|
5823
5992
|
spinAnimationRef.current?.cancel();
|
|
5824
5993
|
spinAnimationRef.current = void 0;
|
|
5825
5994
|
}, []);
|
|
5826
|
-
const startSpinning =
|
|
5995
|
+
const startSpinning = useCallback12(
|
|
5827
5996
|
(step2) => {
|
|
5828
5997
|
stopSpinning();
|
|
5829
5998
|
spinAnimationRef.current = animate(
|
|
@@ -5841,7 +6010,7 @@ function TransactionStatus({
|
|
|
5841
6010
|
},
|
|
5842
6011
|
[animate, stopSpinning]
|
|
5843
6012
|
);
|
|
5844
|
-
const animateCircleToSuccess =
|
|
6013
|
+
const animateCircleToSuccess = useCallback12(
|
|
5845
6014
|
async (step2) => {
|
|
5846
6015
|
const durationMs = 300;
|
|
5847
6016
|
const checkmarkDelayMs = 50;
|
|
@@ -5881,12 +6050,12 @@ function TransactionStatus({
|
|
|
5881
6050
|
},
|
|
5882
6051
|
[animate]
|
|
5883
6052
|
);
|
|
5884
|
-
|
|
6053
|
+
useEffect11(() => {
|
|
5885
6054
|
if (initialStatus === "progress") {
|
|
5886
6055
|
startSpinning(initialStep);
|
|
5887
6056
|
}
|
|
5888
6057
|
}, [initialStatus, initialStep, startSpinning]);
|
|
5889
|
-
|
|
6058
|
+
useEffect11(() => {
|
|
5890
6059
|
if (transitioningToStatus !== currentStatus || transitioningToStep !== currentStep) {
|
|
5891
6060
|
return;
|
|
5892
6061
|
}
|
|
@@ -6246,14 +6415,14 @@ function FunCheckoutStatusLoaded({
|
|
|
6246
6415
|
[activeCheckoutItem, checkoutHistoryItem]
|
|
6247
6416
|
);
|
|
6248
6417
|
const [currentTimeMs, setCurrentTimeMs] = useState10(Date.now());
|
|
6249
|
-
|
|
6418
|
+
useEffect12(() => {
|
|
6250
6419
|
const interval = setInterval(() => setCurrentTimeMs(Date.now()), 1e3);
|
|
6251
6420
|
return () => clearInterval(interval);
|
|
6252
6421
|
}, []);
|
|
6253
6422
|
const onOrderDelayedEvent = useEffectEvent(() => onOrderDelayed?.());
|
|
6254
6423
|
const elapsedSeconds = (currentTimeMs - startTimeMs) / 1e3;
|
|
6255
6424
|
const isNewlyDelayed = isProcessing && elapsedSeconds >= 60;
|
|
6256
|
-
|
|
6425
|
+
useEffect12(() => {
|
|
6257
6426
|
if (isNewlyDelayed) {
|
|
6258
6427
|
onOrderDelayedEvent();
|
|
6259
6428
|
}
|
|
@@ -6284,7 +6453,7 @@ function extractStartTimeMs(historyCheckoutItemId, activeCheckoutItem, { created
|
|
|
6284
6453
|
}
|
|
6285
6454
|
|
|
6286
6455
|
// src/components/FunCheckoutHistory/FunDirectExecutionStatus.tsx
|
|
6287
|
-
import React23, { useEffect as
|
|
6456
|
+
import React23, { useEffect as useEffect13, useState as useState11 } from "react";
|
|
6288
6457
|
function FunDirectExecutionStatus({
|
|
6289
6458
|
directExecution,
|
|
6290
6459
|
isActiveCheckout
|
|
@@ -6307,7 +6476,7 @@ function FunDirectExecutionStatusLoaded({
|
|
|
6307
6476
|
const progress = getCheckoutProgress(directExecution.clientMetadata.id);
|
|
6308
6477
|
const startTimeMs = directExecution.createdTimeMs;
|
|
6309
6478
|
const [currentTimeMs, setCurrentTimeMs] = useState11(Date.now());
|
|
6310
|
-
|
|
6479
|
+
useEffect13(() => {
|
|
6311
6480
|
const interval = setInterval(() => setCurrentTimeMs(Date.now()), 1e3);
|
|
6312
6481
|
return () => clearInterval(interval);
|
|
6313
6482
|
}, []);
|
|
@@ -6493,9 +6662,9 @@ function isCustomWithdrawalConfig(config) {
|
|
|
6493
6662
|
import { isMobile as isMobile2, isSafari } from "@funkit/utils";
|
|
6494
6663
|
import clsx8 from "clsx";
|
|
6495
6664
|
import React43, {
|
|
6496
|
-
useCallback as
|
|
6665
|
+
useCallback as useCallback15,
|
|
6497
6666
|
useContext as useContext12,
|
|
6498
|
-
useEffect as
|
|
6667
|
+
useEffect as useEffect19,
|
|
6499
6668
|
useRef as useRef8
|
|
6500
6669
|
} from "react";
|
|
6501
6670
|
import { createPortal } from "react-dom";
|
|
@@ -6503,13 +6672,13 @@ import { RemoveScroll } from "react-remove-scroll";
|
|
|
6503
6672
|
import { AnimatePresence as AnimatePresence3, motion as motion4 } from "motion/react";
|
|
6504
6673
|
|
|
6505
6674
|
// src/hooks/useScrollDivider.ts
|
|
6506
|
-
import { useEffect as
|
|
6675
|
+
import { useEffect as useEffect14, useRef as useRef5, useState as useState13 } from "react";
|
|
6507
6676
|
var useScrollDivider = () => {
|
|
6508
6677
|
const ref = useRef5(null);
|
|
6509
6678
|
const [isTop, setIsTop] = useState13(true);
|
|
6510
6679
|
const [isScrollable, setIsScrollable] = useState13(false);
|
|
6511
6680
|
const [isScrolling, setIsScrolling] = useState13(false);
|
|
6512
|
-
|
|
6681
|
+
useEffect14(() => {
|
|
6513
6682
|
const content2 = ref.current;
|
|
6514
6683
|
if (!content2 || !window.ResizeObserver) {
|
|
6515
6684
|
return;
|
|
@@ -7255,8 +7424,8 @@ function FunDivider({
|
|
|
7255
7424
|
|
|
7256
7425
|
// src/components/FunTooltip/FunTooltip.tsx
|
|
7257
7426
|
import React40, {
|
|
7258
|
-
useCallback as
|
|
7259
|
-
useEffect as
|
|
7427
|
+
useCallback as useCallback13,
|
|
7428
|
+
useEffect as useEffect15,
|
|
7260
7429
|
useRef as useRef6,
|
|
7261
7430
|
useState as useState14
|
|
7262
7431
|
} from "react";
|
|
@@ -7346,7 +7515,7 @@ var FunTooltip = ({
|
|
|
7346
7515
|
const startDelayRef = useRef6();
|
|
7347
7516
|
const delayRef = useRef6();
|
|
7348
7517
|
const tooltipRef = useRef6(null);
|
|
7349
|
-
const show =
|
|
7518
|
+
const show = useCallback13(
|
|
7350
7519
|
(startHiding) => {
|
|
7351
7520
|
startDelayRef.current = setTimeout(() => {
|
|
7352
7521
|
setIsDisplayed(true);
|
|
@@ -7356,19 +7525,19 @@ var FunTooltip = ({
|
|
|
7356
7525
|
},
|
|
7357
7526
|
[startDelay]
|
|
7358
7527
|
);
|
|
7359
|
-
const hide =
|
|
7528
|
+
const hide = useCallback13(() => {
|
|
7360
7529
|
clearTimeout(startDelayRef.current);
|
|
7361
7530
|
delayRef.current = setTimeout(() => {
|
|
7362
7531
|
setIsDisplayed(false);
|
|
7363
7532
|
}, hideDelay);
|
|
7364
7533
|
}, [hideDelay]);
|
|
7365
|
-
|
|
7534
|
+
useEffect15(() => {
|
|
7366
7535
|
return () => {
|
|
7367
7536
|
clearTimeout(delayRef.current);
|
|
7368
7537
|
clearTimeout(startDelayRef.current);
|
|
7369
7538
|
};
|
|
7370
7539
|
}, []);
|
|
7371
|
-
|
|
7540
|
+
useEffect15(() => {
|
|
7372
7541
|
if (!wrapperElementRef?.current || !tooltipRef.current || !enableDynamicPositioning) {
|
|
7373
7542
|
return;
|
|
7374
7543
|
}
|
|
@@ -7469,7 +7638,7 @@ var HelpIcon = () => {
|
|
|
7469
7638
|
};
|
|
7470
7639
|
|
|
7471
7640
|
// src/components/Dialog/FocusTrap.tsx
|
|
7472
|
-
import React42, { useCallback as
|
|
7641
|
+
import React42, { useCallback as useCallback14, useEffect as useEffect16, useRef as useRef7 } from "react";
|
|
7473
7642
|
var moveFocusWithin = (element2, position) => {
|
|
7474
7643
|
const focusableElements = element2.querySelectorAll(
|
|
7475
7644
|
"button:not(:disabled), a[href]"
|
|
@@ -7481,14 +7650,14 @@ var moveFocusWithin = (element2, position) => {
|
|
|
7481
7650
|
};
|
|
7482
7651
|
function FocusTrap(props) {
|
|
7483
7652
|
const contentRef = useRef7(null);
|
|
7484
|
-
|
|
7653
|
+
useEffect16(() => {
|
|
7485
7654
|
const previouslyActiveElement = document.activeElement;
|
|
7486
7655
|
return () => {
|
|
7487
7656
|
;
|
|
7488
7657
|
previouslyActiveElement.focus?.();
|
|
7489
7658
|
};
|
|
7490
7659
|
}, []);
|
|
7491
|
-
|
|
7660
|
+
useEffect16(() => {
|
|
7492
7661
|
if (contentRef.current) {
|
|
7493
7662
|
const elementToFocus = contentRef.current.querySelector("[data-auto-focus]");
|
|
7494
7663
|
if (elementToFocus) {
|
|
@@ -7502,7 +7671,7 @@ function FocusTrap(props) {
|
|
|
7502
7671
|
return /* @__PURE__ */ React42.createElement(React42.Fragment, null, /* @__PURE__ */ React42.createElement(
|
|
7503
7672
|
"div",
|
|
7504
7673
|
{
|
|
7505
|
-
onFocus:
|
|
7674
|
+
onFocus: useCallback14(
|
|
7506
7675
|
() => contentRef.current && moveFocusWithin(contentRef.current, "end"),
|
|
7507
7676
|
[]
|
|
7508
7677
|
),
|
|
@@ -7519,7 +7688,7 @@ function FocusTrap(props) {
|
|
|
7519
7688
|
), /* @__PURE__ */ React42.createElement(
|
|
7520
7689
|
"div",
|
|
7521
7690
|
{
|
|
7522
|
-
onFocus:
|
|
7691
|
+
onFocus: useCallback14(
|
|
7523
7692
|
() => contentRef.current && moveFocusWithin(contentRef.current, "start"),
|
|
7524
7693
|
[]
|
|
7525
7694
|
),
|
|
@@ -7529,11 +7698,11 @@ function FocusTrap(props) {
|
|
|
7529
7698
|
}
|
|
7530
7699
|
|
|
7531
7700
|
// src/components/Dialog/hooks.ts
|
|
7532
|
-
import { useEffect as
|
|
7701
|
+
import { useEffect as useEffect18, useState as useState15 } from "react";
|
|
7533
7702
|
|
|
7534
7703
|
// src/hooks/useIsomorphicEffect.ts
|
|
7535
|
-
import { useEffect as
|
|
7536
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect :
|
|
7704
|
+
import { useEffect as useEffect17, useLayoutEffect } from "react";
|
|
7705
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect17;
|
|
7537
7706
|
|
|
7538
7707
|
// src/components/Dialog/hooks.ts
|
|
7539
7708
|
var MODAL_BOTTOM_BAR_WRAPPER_ID = "fun-modal-bottom-bar-wrapper";
|
|
@@ -7599,7 +7768,7 @@ function useBottomBarHasNoChildren() {
|
|
|
7599
7768
|
const checkoutBottomBarElement = useCheckoutBottomBarElement();
|
|
7600
7769
|
const withdrawalBottomBarElement = useWithdrawalBottomBarElement();
|
|
7601
7770
|
const [hasNoChildren, setHasNoChildren] = useState15(false);
|
|
7602
|
-
|
|
7771
|
+
useEffect18(() => {
|
|
7603
7772
|
const node = checkoutBottomBarElement || withdrawalBottomBarElement || generalBottomBarElement;
|
|
7604
7773
|
if (!node) {
|
|
7605
7774
|
return;
|
|
@@ -7649,14 +7818,14 @@ function Dialog({
|
|
|
7649
7818
|
withTransition = true,
|
|
7650
7819
|
testId
|
|
7651
7820
|
}) {
|
|
7652
|
-
|
|
7821
|
+
useEffect19(() => {
|
|
7653
7822
|
const handleEscape = (event) => open && event.key === "Escape" && onClose();
|
|
7654
7823
|
if (isSmartCloseable) {
|
|
7655
7824
|
document.addEventListener("keydown", handleEscape);
|
|
7656
7825
|
}
|
|
7657
7826
|
return () => document.removeEventListener("keydown", handleEscape);
|
|
7658
7827
|
}, [open, onClose, isSmartCloseable]);
|
|
7659
|
-
const handleBackdropClick =
|
|
7828
|
+
const handleBackdropClick = useCallback15(
|
|
7660
7829
|
() => isSmartCloseable ? onClose() : () => void 0,
|
|
7661
7830
|
[isSmartCloseable, onClose]
|
|
7662
7831
|
);
|
|
@@ -8018,7 +8187,7 @@ import {
|
|
|
8018
8187
|
formatCryptoAndStringify as formatCryptoAndStringify3,
|
|
8019
8188
|
formatCurrencyAndStringify as formatCurrencyAndStringify3
|
|
8020
8189
|
} from "@funkit/utils";
|
|
8021
|
-
import React67, { useEffect as
|
|
8190
|
+
import React67, { useEffect as useEffect28, useMemo as useMemo14, useState as useState26 } from "react";
|
|
8022
8191
|
import { createPortal as createPortal2 } from "react-dom";
|
|
8023
8192
|
import { useDebounce } from "use-debounce";
|
|
8024
8193
|
import { useAccount as useAccount3 } from "wagmi";
|
|
@@ -8027,7 +8196,7 @@ import { useAccount as useAccount3 } from "wagmi";
|
|
|
8027
8196
|
import React44, { useMemo as useMemo10, useReducer as useReducer2, useState as useState16 } from "react";
|
|
8028
8197
|
|
|
8029
8198
|
// src/components/AsyncImage/useAsyncImage.ts
|
|
8030
|
-
import { useEffect as
|
|
8199
|
+
import { useEffect as useEffect20, useReducer } from "react";
|
|
8031
8200
|
var cachedUrls = /* @__PURE__ */ new Map();
|
|
8032
8201
|
var cachedRequestPromises = /* @__PURE__ */ new Map();
|
|
8033
8202
|
async function loadAsyncImage(asyncImage) {
|
|
@@ -8060,7 +8229,7 @@ function useForceUpdate() {
|
|
|
8060
8229
|
function useAsyncImage(url) {
|
|
8061
8230
|
const cachedUrl = typeof url === "function" ? cachedUrls.get(url) : void 0;
|
|
8062
8231
|
const forceUpdate = useForceUpdate();
|
|
8063
|
-
|
|
8232
|
+
useEffect20(() => {
|
|
8064
8233
|
if (typeof url === "function" && !cachedUrl) {
|
|
8065
8234
|
loadAsyncImage(url).then(forceUpdate);
|
|
8066
8235
|
}
|
|
@@ -8200,7 +8369,7 @@ import React56 from "react";
|
|
|
8200
8369
|
// src/components/Dropdown/BaseDropdown.tsx
|
|
8201
8370
|
import { isMobile as isMobile3, noop as noop2 } from "@funkit/utils";
|
|
8202
8371
|
import { AnimatePresence as AnimatePresence4, motion as motion5 } from "motion/react";
|
|
8203
|
-
import React53, { useCallback as
|
|
8372
|
+
import React53, { useCallback as useCallback16, useEffect as useEffect23, useMemo as useMemo11, useRef as useRef10, useState as useState18 } from "react";
|
|
8204
8373
|
|
|
8205
8374
|
// src/consts/layout.ts
|
|
8206
8375
|
var VERTICAL_SECTION_GAP = "18";
|
|
@@ -8214,7 +8383,7 @@ var DROPDOWN_Z_INDEX = 10;
|
|
|
8214
8383
|
// src/components/FunInput/FunInput.tsx
|
|
8215
8384
|
import React46, {
|
|
8216
8385
|
forwardRef as forwardRef3,
|
|
8217
|
-
useEffect as
|
|
8386
|
+
useEffect as useEffect21,
|
|
8218
8387
|
useState as useState17
|
|
8219
8388
|
} from "react";
|
|
8220
8389
|
import clsx9 from "clsx";
|
|
@@ -8311,7 +8480,7 @@ var FunInput = forwardRef3(function FunInputWithRef({
|
|
|
8311
8480
|
};
|
|
8312
8481
|
};
|
|
8313
8482
|
const textareaRef = React46.useRef(null);
|
|
8314
|
-
|
|
8483
|
+
useEffect21(() => {
|
|
8315
8484
|
if (allowMultiline) {
|
|
8316
8485
|
adjustTextareaHeight(textareaRef.current);
|
|
8317
8486
|
}
|
|
@@ -8621,13 +8790,13 @@ var FunNoResults = ({
|
|
|
8621
8790
|
|
|
8622
8791
|
// src/components/FunSelect/FunClickOutside.tsx
|
|
8623
8792
|
import React50 from "react";
|
|
8624
|
-
import { useEffect as
|
|
8793
|
+
import { useEffect as useEffect22, useRef as useRef9 } from "react";
|
|
8625
8794
|
function FunClickOutside({
|
|
8626
8795
|
children,
|
|
8627
8796
|
onClick
|
|
8628
8797
|
}) {
|
|
8629
8798
|
const wrapperRef = useRef9(null);
|
|
8630
|
-
|
|
8799
|
+
useEffect22(() => {
|
|
8631
8800
|
const handleClickListener = (event) => {
|
|
8632
8801
|
const clickedInside = wrapperRef.current?.contains(
|
|
8633
8802
|
event.target
|
|
@@ -8833,7 +9002,7 @@ function BaseDropdown({
|
|
|
8833
9002
|
),
|
|
8834
9003
|
[options, searchInput]
|
|
8835
9004
|
);
|
|
8836
|
-
const closeDropdown =
|
|
9005
|
+
const closeDropdown = useCallback16(() => {
|
|
8837
9006
|
setIsOpened(false);
|
|
8838
9007
|
resetSearchOnClose && setSearchInput("");
|
|
8839
9008
|
}, [resetSearchOnClose]);
|
|
@@ -8841,7 +9010,7 @@ function BaseDropdown({
|
|
|
8841
9010
|
setIsOpened(true);
|
|
8842
9011
|
onOpen?.();
|
|
8843
9012
|
};
|
|
8844
|
-
|
|
9013
|
+
useEffect23(() => {
|
|
8845
9014
|
if (isOpened && !prevIsOpenedRef.current) {
|
|
8846
9015
|
prevIsOpenedRef.current = true;
|
|
8847
9016
|
if (selectedOption) {
|
|
@@ -9793,7 +9962,7 @@ import {
|
|
|
9793
9962
|
formatPercent,
|
|
9794
9963
|
noop as noop4
|
|
9795
9964
|
} from "@funkit/utils";
|
|
9796
|
-
import React64, { useEffect as
|
|
9965
|
+
import React64, { useEffect as useEffect24, useMemo as useMemo12, useState as useState20 } from "react";
|
|
9797
9966
|
import clsx14 from "clsx";
|
|
9798
9967
|
import { motion as motion6, useAnimationControls } from "motion/react";
|
|
9799
9968
|
import { mainnet as mainnet6 } from "viem/chains";
|
|
@@ -10229,7 +10398,7 @@ function PaymentFeesSummary({
|
|
|
10229
10398
|
setIsExpanded(true);
|
|
10230
10399
|
}
|
|
10231
10400
|
};
|
|
10232
|
-
|
|
10401
|
+
useEffect24(() => {
|
|
10233
10402
|
if (valuesNotAvailable && isExpanded) {
|
|
10234
10403
|
setIsExpanded(false);
|
|
10235
10404
|
}
|
|
@@ -11050,7 +11219,7 @@ var useAssetSymbolPrice = ({
|
|
|
11050
11219
|
|
|
11051
11220
|
// src/hooks/useTokenChain.ts
|
|
11052
11221
|
import { FlagKey as FlagKey11 } from "@funkit/utils";
|
|
11053
|
-
import { useEffect as
|
|
11222
|
+
import { useEffect as useEffect25, useState as useState21 } from "react";
|
|
11054
11223
|
import { polygon as polygon3 } from "viem/chains";
|
|
11055
11224
|
|
|
11056
11225
|
// src/hooks/useEnabledTokenTransferChainTokens.ts
|
|
@@ -11068,16 +11237,6 @@ function useIsUsBankrUser() {
|
|
|
11068
11237
|
const isUsUser = useIsUsUser();
|
|
11069
11238
|
return isUsUser && isBankrCustomer(apiKey);
|
|
11070
11239
|
}
|
|
11071
|
-
function useIsUsKatanaUser() {
|
|
11072
|
-
const { apiKey } = useFunkitConfig();
|
|
11073
|
-
const isUsUser = useIsUsUser();
|
|
11074
|
-
return isUsUser && isKatanaCustomer(apiKey);
|
|
11075
|
-
}
|
|
11076
|
-
function useIsUsHyperdashUser() {
|
|
11077
|
-
const { apiKey } = useFunkitConfig();
|
|
11078
|
-
const isUsUser = useIsUsUser();
|
|
11079
|
-
return isUsUser && isHyperdashCustomer(apiKey);
|
|
11080
|
-
}
|
|
11081
11240
|
|
|
11082
11241
|
// src/hooks/useEnabledTokenTransferChainTokens.ts
|
|
11083
11242
|
function useEnabledTokenTransferChainTokens(transferInit, isWithdrawal) {
|
|
@@ -11133,7 +11292,7 @@ var useTokenAndChainSelection = (transferInit, defaultValues, isWithdrawal) => {
|
|
|
11133
11292
|
const selectedChainName = chainMetadataById[selectedChainId]?.name ?? "";
|
|
11134
11293
|
const defaultSelectedToken = defaultValues?.token ?? filteredAssets?.[selectedChainId]?.[0] ?? "";
|
|
11135
11294
|
const [selectedToken, setSelectedToken] = useState21(defaultSelectedToken);
|
|
11136
|
-
|
|
11295
|
+
useEffect25(
|
|
11137
11296
|
() => setSelectedChainId(validDefaultChainId),
|
|
11138
11297
|
[validDefaultChainId]
|
|
11139
11298
|
);
|
|
@@ -11181,11 +11340,11 @@ var useTokenAndChainSelection = (transferInit, defaultValues, isWithdrawal) => {
|
|
|
11181
11340
|
import { useState as useState25 } from "react";
|
|
11182
11341
|
|
|
11183
11342
|
// src/hooks/useAutoClearState.ts
|
|
11184
|
-
import { useCallback as
|
|
11343
|
+
import { useCallback as useCallback17, useEffect as useEffect26, useRef as useRef11, useState as useState22 } from "react";
|
|
11185
11344
|
function useAutoClearState(initialValue = null) {
|
|
11186
11345
|
const [state, setState] = useState22(initialValue);
|
|
11187
11346
|
const timeoutRef = useRef11();
|
|
11188
|
-
|
|
11347
|
+
useEffect26(() => {
|
|
11189
11348
|
return () => {
|
|
11190
11349
|
if (timeoutRef.current !== void 0) {
|
|
11191
11350
|
clearTimeout(timeoutRef.current);
|
|
@@ -11194,7 +11353,7 @@ function useAutoClearState(initialValue = null) {
|
|
|
11194
11353
|
}, []);
|
|
11195
11354
|
return [
|
|
11196
11355
|
state,
|
|
11197
|
-
|
|
11356
|
+
useCallback17((newState, durationMs) => {
|
|
11198
11357
|
if (timeoutRef.current) {
|
|
11199
11358
|
clearTimeout(timeoutRef.current);
|
|
11200
11359
|
timeoutRef.current = void 0;
|
|
@@ -11230,9 +11389,9 @@ var useIsBlacklisted = (walletAddress, customRecipient) => {
|
|
|
11230
11389
|
import { FlagKey as FlagKey13, isNotNullish as isNotNullish4 } from "@funkit/utils";
|
|
11231
11390
|
import React66, {
|
|
11232
11391
|
createContext as createContext13,
|
|
11233
|
-
useCallback as
|
|
11392
|
+
useCallback as useCallback18,
|
|
11234
11393
|
useContext as useContext13,
|
|
11235
|
-
useEffect as
|
|
11394
|
+
useEffect as useEffect27,
|
|
11236
11395
|
useState as useState23
|
|
11237
11396
|
} from "react";
|
|
11238
11397
|
import { useConfig as useConfig4 } from "wagmi";
|
|
@@ -11310,6 +11469,40 @@ function generateQuoteApiErrorForDisplay(err) {
|
|
|
11310
11469
|
return foundItem?.display || DEFAULT_QUOTE_ERROR;
|
|
11311
11470
|
}
|
|
11312
11471
|
|
|
11472
|
+
// src/providers/FunkitQuoteContext.track.ts
|
|
11473
|
+
var cleanupBaseQuote = (baseQuote) => {
|
|
11474
|
+
return {
|
|
11475
|
+
...baseQuote,
|
|
11476
|
+
// omit metadata as we spread it below
|
|
11477
|
+
metadata: void 0,
|
|
11478
|
+
...baseQuote.metadata,
|
|
11479
|
+
// omit relay quote as it makes the event data too large to be processed by statsig and doesn't bring much value anyway
|
|
11480
|
+
relayQuote: void 0
|
|
11481
|
+
};
|
|
11482
|
+
};
|
|
11483
|
+
var cleanupFinalEstimation = (finalEstimation) => {
|
|
11484
|
+
return {
|
|
11485
|
+
...finalEstimation,
|
|
11486
|
+
// omit base quote as we spread it below
|
|
11487
|
+
baseQuote: void 0,
|
|
11488
|
+
...cleanupBaseQuote(finalEstimation.baseQuote)
|
|
11489
|
+
};
|
|
11490
|
+
};
|
|
11491
|
+
var trackEventFromFinalQuote = (finalEstimation, checkoutItem) => {
|
|
11492
|
+
const cleanedFinalEstimation = cleanupFinalEstimation(finalEstimation);
|
|
11493
|
+
const metadata = {
|
|
11494
|
+
...checkoutItem,
|
|
11495
|
+
// spread the final estimation to save space
|
|
11496
|
+
...cleanedFinalEstimation,
|
|
11497
|
+
id: void 0,
|
|
11498
|
+
checkoutId: checkoutItem.id
|
|
11499
|
+
};
|
|
11500
|
+
return {
|
|
11501
|
+
eventName: "fc::quote::final_quote" /* FINAL_QUOTE */,
|
|
11502
|
+
metadata
|
|
11503
|
+
};
|
|
11504
|
+
};
|
|
11505
|
+
|
|
11313
11506
|
// src/providers/FunkitQuoteContext.tsx
|
|
11314
11507
|
var FunkitQuoteContext = createContext13({
|
|
11315
11508
|
latestQuote: null,
|
|
@@ -11324,6 +11517,7 @@ var FunkitQuoteContext = createContext13({
|
|
|
11324
11517
|
setQuoteProgress: () => void 0
|
|
11325
11518
|
});
|
|
11326
11519
|
function FunkitQuoteProvider({ children }) {
|
|
11520
|
+
const { logEvent } = useTrack();
|
|
11327
11521
|
const { checkoutItem, setCheckout } = useCheckoutContext();
|
|
11328
11522
|
const funkitConfig = useFunkitConfig();
|
|
11329
11523
|
const wagmiConfig = useConfig4();
|
|
@@ -11334,7 +11528,7 @@ function FunkitQuoteProvider({ children }) {
|
|
|
11334
11528
|
const [isQuoting, setIsQuoting] = useState23(false);
|
|
11335
11529
|
const [quoteStepMessage, setQuoteStepMessage] = useState23("");
|
|
11336
11530
|
const [quoteErrorMessage, setQuoteErrorMessage] = useState23("");
|
|
11337
|
-
|
|
11531
|
+
useEffect27(() => {
|
|
11338
11532
|
if (isNotNullish4(logoutSymbol)) {
|
|
11339
11533
|
setLatestQuote(null);
|
|
11340
11534
|
setQuoteProgress({
|
|
@@ -11344,7 +11538,7 @@ function FunkitQuoteProvider({ children }) {
|
|
|
11344
11538
|
});
|
|
11345
11539
|
}
|
|
11346
11540
|
}, [logoutSymbol]);
|
|
11347
|
-
const setQuoteProgress =
|
|
11541
|
+
const setQuoteProgress = useCallback18(
|
|
11348
11542
|
(state) => {
|
|
11349
11543
|
setQuoteErrorMessage(state.quoteErrorMessage);
|
|
11350
11544
|
setQuoteStepMessage(state.quoteStepMessage);
|
|
@@ -11352,7 +11546,7 @@ function FunkitQuoteProvider({ children }) {
|
|
|
11352
11546
|
},
|
|
11353
11547
|
[]
|
|
11354
11548
|
);
|
|
11355
|
-
const clearCheckoutQuoteMessages =
|
|
11549
|
+
const clearCheckoutQuoteMessages = useCallback18(() => {
|
|
11356
11550
|
setQuoteStepMessage("");
|
|
11357
11551
|
setQuoteErrorMessage("");
|
|
11358
11552
|
}, []);
|
|
@@ -11410,6 +11604,11 @@ function FunkitQuoteProvider({ children }) {
|
|
|
11410
11604
|
loginType,
|
|
11411
11605
|
enableFrogProxyServer
|
|
11412
11606
|
);
|
|
11607
|
+
const trackEvent = trackEventFromFinalQuote(
|
|
11608
|
+
finalEstimation,
|
|
11609
|
+
newCheckoutItem
|
|
11610
|
+
);
|
|
11611
|
+
logEvent(trackEvent);
|
|
11413
11612
|
newCheckoutItem?.initSettings?.onEstimation?.(finalEstimation);
|
|
11414
11613
|
checkedAmount = await checkAssetAmount(
|
|
11415
11614
|
newCheckoutItem,
|
|
@@ -11885,7 +12084,7 @@ function useShowConnectWallet({
|
|
|
11885
12084
|
const withdrawalWalletAddress = "wallet" in config ? config.wallet.address() : "0x";
|
|
11886
12085
|
const { isConnected, address: connectedWalletAddress } = useAccount3();
|
|
11887
12086
|
const showUseConnected = !config.disableConnectedWallet && isConnected && connectedWalletAddress && withdrawalWalletAddress.toLowerCase() !== connectedWalletAddress.toLowerCase();
|
|
11888
|
-
|
|
12087
|
+
useEffect28(() => {
|
|
11889
12088
|
logger.debug("withdrawalContent:showUseConnected", {
|
|
11890
12089
|
isConnected,
|
|
11891
12090
|
connectedWalletAddress,
|
|
@@ -11951,12 +12150,12 @@ var WithdrawContent = ({
|
|
|
11951
12150
|
refetchInterval: PRICE_REFRESH_INTERVAL
|
|
11952
12151
|
});
|
|
11953
12152
|
const targetAssetAmount = targetUnitPrice ? Number(debouncedUSD) / targetUnitPrice : void 0;
|
|
11954
|
-
|
|
12153
|
+
useEffect28(() => {
|
|
11955
12154
|
setTimeout(() => {
|
|
11956
12155
|
updateTargetAssetAmount(targetAssetAmount ?? 0);
|
|
11957
12156
|
}, 0);
|
|
11958
12157
|
}, [targetAssetAmount, updateTargetAssetAmount]);
|
|
11959
|
-
|
|
12158
|
+
useEffect28(() => {
|
|
11960
12159
|
if (!targetAssetInfo) {
|
|
11961
12160
|
return;
|
|
11962
12161
|
}
|
|
@@ -11990,7 +12189,7 @@ var WithdrawContent = ({
|
|
|
11990
12189
|
onContinue(withdrawal, txHash);
|
|
11991
12190
|
}
|
|
11992
12191
|
});
|
|
11993
|
-
|
|
12192
|
+
useEffect28(() => {
|
|
11994
12193
|
if (!isPlaceholderData && !isQuoteLoading && isInstantQuoting && confirmingQuote) {
|
|
11995
12194
|
setTimeout(() => {
|
|
11996
12195
|
setConfirmingQuote(false);
|
|
@@ -12491,12 +12690,16 @@ function useCheckoutTimeEstimate(originalTimeEstimationMs, paymentMethod = "card
|
|
|
12491
12690
|
// src/hooks/useFrogAccount.ts
|
|
12492
12691
|
import {
|
|
12493
12692
|
createBridgeBankAccount,
|
|
12693
|
+
createBridgeBankAccountRequestChainNames,
|
|
12494
12694
|
getBridgeKycLink
|
|
12495
12695
|
} from "@funkit/api-base";
|
|
12496
|
-
import {
|
|
12696
|
+
import {
|
|
12697
|
+
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO9,
|
|
12698
|
+
hyperCoreChain
|
|
12699
|
+
} from "@funkit/chains";
|
|
12497
12700
|
import { FlagKey as FlagKey16 } from "@funkit/utils";
|
|
12498
12701
|
import { useQuery as useQuery10, useQueryClient } from "@tanstack/react-query";
|
|
12499
|
-
import { useCallback as
|
|
12702
|
+
import { useCallback as useCallback19 } from "react";
|
|
12500
12703
|
var sepaCountryCode = [
|
|
12501
12704
|
// EU countries that are part of SEPA
|
|
12502
12705
|
"AT",
|
|
@@ -12595,13 +12798,13 @@ function useFrogAccounts() {
|
|
|
12595
12798
|
function useClearFrogAccountsCache() {
|
|
12596
12799
|
const { walletAddress } = useGeneralWallet();
|
|
12597
12800
|
const queryClient = useQueryClient();
|
|
12598
|
-
const clearFrogAccounts =
|
|
12801
|
+
const clearFrogAccounts = useCallback19(() => {
|
|
12599
12802
|
queryClient.removeQueries({
|
|
12600
12803
|
queryKey: ["frogSubAccounts", walletAddress],
|
|
12601
12804
|
exact: true
|
|
12602
12805
|
});
|
|
12603
12806
|
}, [queryClient, walletAddress]);
|
|
12604
|
-
const clearVirtualFiatAccounts =
|
|
12807
|
+
const clearVirtualFiatAccounts = useCallback19(() => {
|
|
12605
12808
|
queryClient.removeQueries({
|
|
12606
12809
|
queryKey: ["useVirtualFiatAccounts"]
|
|
12607
12810
|
});
|
|
@@ -12665,6 +12868,16 @@ function useLoadKycLink(linkLoad) {
|
|
|
12665
12868
|
const fixedLink = query.data ? `${query.data.replace("/verify", "/widget")}&iframe-origin=${iframeOrigin}` : void 0;
|
|
12666
12869
|
return { ...query, data: fixedLink };
|
|
12667
12870
|
}
|
|
12871
|
+
var fallbackIfUnsupportedChain = (chainId) => {
|
|
12872
|
+
if (chainId === hyperCoreChain.id.toString()) {
|
|
12873
|
+
return "arbitrum";
|
|
12874
|
+
}
|
|
12875
|
+
const chainName = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO9[chainId]?.name.toLowerCase();
|
|
12876
|
+
if (createBridgeBankAccountRequestChainNames.includes(chainName)) {
|
|
12877
|
+
return chainName;
|
|
12878
|
+
}
|
|
12879
|
+
return "polygon";
|
|
12880
|
+
};
|
|
12668
12881
|
function useCreateVirtualBankAccount() {
|
|
12669
12882
|
const { apiKey } = useFunkitConfig();
|
|
12670
12883
|
const { checkoutItem } = useCheckoutContext();
|
|
@@ -12673,20 +12886,19 @@ function useCreateVirtualBankAccount() {
|
|
|
12673
12886
|
const targetChainId = checkoutConfig?.targetChain;
|
|
12674
12887
|
const { transferInit, recipientAddr } = useCheckoutTransferInit();
|
|
12675
12888
|
const destinationAddress = transferInit?.depositAddr || recipientAddr;
|
|
12676
|
-
const chainName = targetChainId && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO9[targetChainId]?.name?.toLowerCase();
|
|
12677
12889
|
const subAccountId = allFiatAccounts?.bridgeCustomer?.id;
|
|
12678
12890
|
const { clearVirtualFiatAccounts } = useClearFrogAccountsCache();
|
|
12679
|
-
const handleCreateVirtualFiatAccount =
|
|
12891
|
+
const handleCreateVirtualFiatAccount = useCallback19(async () => {
|
|
12680
12892
|
try {
|
|
12681
|
-
if (!subAccountId || !
|
|
12893
|
+
if (!subAccountId || !targetChainId) {
|
|
12682
12894
|
return {
|
|
12683
12895
|
type: "error",
|
|
12684
|
-
error: new Error("No subAccountId or
|
|
12896
|
+
error: new Error("No subAccountId or targetChainId")
|
|
12685
12897
|
};
|
|
12686
12898
|
}
|
|
12687
12899
|
const resp = await createBridgeBankAccount({
|
|
12688
12900
|
tokenName: "usdc",
|
|
12689
|
-
chainName,
|
|
12901
|
+
chainName: fallbackIfUnsupportedChain(targetChainId),
|
|
12690
12902
|
destinationAddress,
|
|
12691
12903
|
subAccountId,
|
|
12692
12904
|
sourceCurrency: "eur",
|
|
@@ -12703,7 +12915,7 @@ function useCreateVirtualBankAccount() {
|
|
|
12703
12915
|
destinationAddress,
|
|
12704
12916
|
apiKey,
|
|
12705
12917
|
subAccountId,
|
|
12706
|
-
|
|
12918
|
+
targetChainId,
|
|
12707
12919
|
clearVirtualFiatAccounts
|
|
12708
12920
|
]);
|
|
12709
12921
|
return handleCreateVirtualFiatAccount;
|
|
@@ -14391,16 +14603,16 @@ var BankIconActive = ({ size = 20 }) => {
|
|
|
14391
14603
|
|
|
14392
14604
|
// src/components/FunConnectOptions/FunSignInStep.tsx
|
|
14393
14605
|
import { groupBy, isMobile as isMobile8, isSafari as isSafari3, redirectInMobile as redirectInMobile2 } from "@funkit/utils";
|
|
14394
|
-
import React192, { Fragment as Fragment2, useCallback as
|
|
14606
|
+
import React192, { Fragment as Fragment2, useCallback as useCallback46, useMemo as useMemo38, useState as useState62 } from "react";
|
|
14395
14607
|
|
|
14396
14608
|
// src/providers/walletConnectDeepLink.ts
|
|
14397
|
-
var
|
|
14609
|
+
var storageKey2 = "WALLETCONNECT_DEEPLINK_CHOICE";
|
|
14398
14610
|
function setWalletConnectDeepLink({
|
|
14399
14611
|
mobileUri,
|
|
14400
14612
|
name
|
|
14401
14613
|
}) {
|
|
14402
14614
|
localStorage.setItem(
|
|
14403
|
-
|
|
14615
|
+
storageKey2,
|
|
14404
14616
|
JSON.stringify({
|
|
14405
14617
|
href: mobileUri.split("?")[0],
|
|
14406
14618
|
name
|
|
@@ -14408,13 +14620,13 @@ function setWalletConnectDeepLink({
|
|
|
14408
14620
|
);
|
|
14409
14621
|
}
|
|
14410
14622
|
function clearWalletConnectDeepLink() {
|
|
14411
|
-
localStorage.removeItem(
|
|
14623
|
+
localStorage.removeItem(storageKey2);
|
|
14412
14624
|
}
|
|
14413
14625
|
|
|
14414
14626
|
// src/wallets/latestWalletId.ts
|
|
14415
|
-
var
|
|
14627
|
+
var storageKey3 = "fkc-latest-id";
|
|
14416
14628
|
function addLatestWalletId(walletId) {
|
|
14417
|
-
localStorage.setItem(
|
|
14629
|
+
localStorage.setItem(storageKey3, walletId);
|
|
14418
14630
|
}
|
|
14419
14631
|
|
|
14420
14632
|
// src/components/FunButton/FunSignInButton.tsx
|
|
@@ -14809,10 +15021,10 @@ var SocialsIcon = () => {
|
|
|
14809
15021
|
};
|
|
14810
15022
|
|
|
14811
15023
|
// src/components/FunConnectOptions/FunConnectOptions.tsx
|
|
14812
|
-
import React191, { useCallback as
|
|
15024
|
+
import React191, { useCallback as useCallback45, useMemo as useMemo37, useState as useState61 } from "react";
|
|
14813
15025
|
|
|
14814
15026
|
// src/hooks/useAnimatedNavigation.ts
|
|
14815
|
-
import { useCallback as
|
|
15027
|
+
import { useCallback as useCallback20, useState as useState28 } from "react";
|
|
14816
15028
|
|
|
14817
15029
|
// src/css/modalTransitionStyles.css.ts
|
|
14818
15030
|
var animateContentInClass = "stgjxl2";
|
|
@@ -14840,7 +15052,7 @@ function useAnimatedNavigation(callback) {
|
|
|
14840
15052
|
const [animateOut, setAnimateOut] = useState28(false);
|
|
14841
15053
|
const [isSkipped, setIsSkipped] = useState28(false);
|
|
14842
15054
|
const [isReversed, setIsReversed] = useState28(false);
|
|
14843
|
-
const navigateTo =
|
|
15055
|
+
const navigateTo = useCallback20(
|
|
14844
15056
|
(page, params = {}) => {
|
|
14845
15057
|
setIsSkipped(!!params.skip);
|
|
14846
15058
|
if (params.skip) {
|
|
@@ -14855,7 +15067,7 @@ function useAnimatedNavigation(callback) {
|
|
|
14855
15067
|
},
|
|
14856
15068
|
[callback]
|
|
14857
15069
|
);
|
|
14858
|
-
const animate =
|
|
15070
|
+
const animate = useCallback20(
|
|
14859
15071
|
(callback2, params = {}) => {
|
|
14860
15072
|
setIsSkipped(!!params.skip);
|
|
14861
15073
|
if (params.skip) {
|
|
@@ -14879,11 +15091,11 @@ function useAnimatedNavigation(callback) {
|
|
|
14879
15091
|
|
|
14880
15092
|
// src/components/FunCheckoutModalHeightAnimationWrapper/FunCheckoutModalHeightAnimationWrapper.tsx
|
|
14881
15093
|
import { motion as motion11 } from "motion/react";
|
|
14882
|
-
import React181, { useEffect as
|
|
15094
|
+
import React181, { useEffect as useEffect45, useRef as useRef23, useState as useState58 } from "react";
|
|
14883
15095
|
|
|
14884
15096
|
// src/modals/CheckoutModal/stepTransition.ts
|
|
14885
15097
|
import {
|
|
14886
|
-
useCallback as
|
|
15098
|
+
useCallback as useCallback41,
|
|
14887
15099
|
useRef as useRef22,
|
|
14888
15100
|
useState as useState57
|
|
14889
15101
|
} from "react";
|
|
@@ -15177,7 +15389,7 @@ import {
|
|
|
15177
15389
|
BridgeCustomerStatus as BridgeCustomerStatus4
|
|
15178
15390
|
} from "@funkit/api-base";
|
|
15179
15391
|
import { exhaustiveCheck as exhaustiveCheck4 } from "@funkit/utils";
|
|
15180
|
-
import React92, { useCallback as
|
|
15392
|
+
import React92, { useCallback as useCallback21, useState as useState30 } from "react";
|
|
15181
15393
|
import { createPortal as createPortal4 } from "react-dom";
|
|
15182
15394
|
|
|
15183
15395
|
// src/components/Icons/HomeIcon.tsx
|
|
@@ -15779,7 +15991,7 @@ var VerifyAccountScreen = ({
|
|
|
15779
15991
|
const kycUninitialized = !isSoftRejected2 && customerStatus && isKycUninitialized(customerStatus);
|
|
15780
15992
|
const canStartKyc = kycUninitialized || isSoftRejected2;
|
|
15781
15993
|
const handleCreateVirtualFiatAccount = useCreateVirtualBankAccount();
|
|
15782
|
-
const onClick =
|
|
15994
|
+
const onClick = useCallback21(async () => {
|
|
15783
15995
|
if (customerStatus === BridgeCustomerStatus4.ACTIVE) {
|
|
15784
15996
|
setCreating(true);
|
|
15785
15997
|
const result = await handleCreateVirtualFiatAccount();
|
|
@@ -16294,12 +16506,12 @@ import { noop as noop5 } from "@funkit/utils";
|
|
|
16294
16506
|
import React114 from "react";
|
|
16295
16507
|
|
|
16296
16508
|
// src/utils/checkoutHistory.ts
|
|
16297
|
-
var
|
|
16509
|
+
var storageKey4 = "fkc-last-report-submit-time";
|
|
16298
16510
|
function getLatestReportSubmitTime() {
|
|
16299
|
-
return typeof localStorage !== "undefined" ? Number(localStorage.getItem(
|
|
16511
|
+
return typeof localStorage !== "undefined" ? Number(localStorage.getItem(storageKey4)) || -1 : -1;
|
|
16300
16512
|
}
|
|
16301
16513
|
function setLatestReportSubmitTime(timeMs) {
|
|
16302
|
-
localStorage.setItem(
|
|
16514
|
+
localStorage.setItem(storageKey4, JSON.stringify(timeMs));
|
|
16303
16515
|
}
|
|
16304
16516
|
function getCheckoutCompletionTime(checkout) {
|
|
16305
16517
|
if (!checkout.stateTimestampMs) {
|
|
@@ -16311,7 +16523,7 @@ function getCheckoutCompletionTime(checkout) {
|
|
|
16311
16523
|
}
|
|
16312
16524
|
|
|
16313
16525
|
// src/components/FunCheckoutHistory/FunCheckoutHistoryDetail.tsx
|
|
16314
|
-
import React108, { useCallback as
|
|
16526
|
+
import React108, { useCallback as useCallback23, useMemo as useMemo17, useState as useState32 } from "react";
|
|
16315
16527
|
import { createPortal as createPortal6 } from "react-dom";
|
|
16316
16528
|
|
|
16317
16529
|
// src/components/HelpAlert/HelpAlert.tsx
|
|
@@ -16327,11 +16539,11 @@ var HelpAlert = ({ onHelp: onHelp2 }) => {
|
|
|
16327
16539
|
};
|
|
16328
16540
|
|
|
16329
16541
|
// src/hooks/useFunListeners.ts
|
|
16330
|
-
import { useCallback as
|
|
16542
|
+
import { useCallback as useCallback22, useEffect as useEffect29, useRef as useRef13 } from "react";
|
|
16331
16543
|
function useCheckoutHistoryListener(activate = true, singleDepositAddr) {
|
|
16332
16544
|
const activeIntervalRef = useRef13();
|
|
16333
16545
|
const { startCheckoutHistoryListener, stopCheckoutHistoryListener } = useCheckoutHistoryContext();
|
|
16334
|
-
|
|
16546
|
+
useEffect29(() => {
|
|
16335
16547
|
if (activate) {
|
|
16336
16548
|
const createdIntervalId = startCheckoutHistoryListener(
|
|
16337
16549
|
/* singleDepositAddr */
|
|
@@ -16350,21 +16562,21 @@ function useSIWFarcasterListener(channelToken) {
|
|
|
16350
16562
|
const { getFcConnectionStatus, handleFunkitWeb2Login } = useFunkitWeb2Login();
|
|
16351
16563
|
const intervalRef = useRef13();
|
|
16352
16564
|
const [refreshSymbol, triggerRefreshSymbol] = useSymbolRefresh_default();
|
|
16353
|
-
const startStatusListener =
|
|
16565
|
+
const startStatusListener = useCallback22(() => {
|
|
16354
16566
|
clearInterval(intervalRef.current);
|
|
16355
16567
|
triggerRefreshSymbol();
|
|
16356
16568
|
intervalRef.current = setInterval(() => {
|
|
16357
16569
|
triggerRefreshSymbol();
|
|
16358
16570
|
}, FARCASTER_STATUS_INTERVAL);
|
|
16359
16571
|
}, [triggerRefreshSymbol]);
|
|
16360
|
-
const stopStatusListener =
|
|
16572
|
+
const stopStatusListener = useCallback22(() => {
|
|
16361
16573
|
clearInterval(intervalRef.current);
|
|
16362
16574
|
}, []);
|
|
16363
|
-
|
|
16575
|
+
useEffect29(() => {
|
|
16364
16576
|
startStatusListener();
|
|
16365
16577
|
return () => stopStatusListener();
|
|
16366
16578
|
}, []);
|
|
16367
|
-
const check =
|
|
16579
|
+
const check = useCallback22(async () => {
|
|
16368
16580
|
if (!channelToken || !initalChainid) {
|
|
16369
16581
|
return;
|
|
16370
16582
|
}
|
|
@@ -16390,7 +16602,7 @@ function useSIWFarcasterListener(channelToken) {
|
|
|
16390
16602
|
initalChainid,
|
|
16391
16603
|
stopStatusListener
|
|
16392
16604
|
]);
|
|
16393
|
-
|
|
16605
|
+
useEffect29(() => {
|
|
16394
16606
|
check();
|
|
16395
16607
|
}, [refreshSymbol]);
|
|
16396
16608
|
}
|
|
@@ -16403,7 +16615,7 @@ import {
|
|
|
16403
16615
|
formatSecondsToReadableForm as formatSecondsToReadableForm2,
|
|
16404
16616
|
formatTimestamp
|
|
16405
16617
|
} from "@funkit/utils";
|
|
16406
|
-
import React107, { useState as useState31, useRef as useRef14, useEffect as
|
|
16618
|
+
import React107, { useState as useState31, useRef as useRef14, useEffect as useEffect30 } from "react";
|
|
16407
16619
|
|
|
16408
16620
|
// src/components/FunButton/FunRedirectButton.tsx
|
|
16409
16621
|
import React105 from "react";
|
|
@@ -16532,7 +16744,7 @@ function StatusTag({ state, refundState, isDelayed: isDelayed2 }) {
|
|
|
16532
16744
|
const checkoutState = getCheckoutStateBooleans(state, refundState);
|
|
16533
16745
|
const [delayedCheckoutState, setDelayedCheckoutState] = useState31(checkoutState);
|
|
16534
16746
|
const { status, isCompleted, isRefundProceeded } = delayedCheckoutState;
|
|
16535
|
-
|
|
16747
|
+
useEffect30(() => {
|
|
16536
16748
|
const timeout = setTimeout(
|
|
16537
16749
|
() => {
|
|
16538
16750
|
setDelayedCheckoutState(getCheckoutStateBooleans(state, refundState));
|
|
@@ -16679,7 +16891,7 @@ function FunCheckoutHistoryDetail({
|
|
|
16679
16891
|
useCheckoutHistoryListener(isProcessing, checkoutHistoryInfo?.depositAddr);
|
|
16680
16892
|
useWalletAssets({ enableRefetchInterval: isProcessing || isCompleted });
|
|
16681
16893
|
const { beginCheckout } = useFunkitCheckout({});
|
|
16682
|
-
const handleNewCheckout =
|
|
16894
|
+
const handleNewCheckout = useCallback23(
|
|
16683
16895
|
(fromCheckout) => {
|
|
16684
16896
|
onClose({ isNewDeposit: true });
|
|
16685
16897
|
const historicalCheckout = fromCheckout.clientMetadata;
|
|
@@ -16787,7 +16999,7 @@ var CheckoutAlert = ({ state, refundState, onHelp: onHelp2 }) => {
|
|
|
16787
16999
|
|
|
16788
17000
|
// src/components/FunCheckoutHistory/FunCheckoutHistoryHelp.tsx
|
|
16789
17001
|
import { sendSupportMessage } from "@funkit/api-base";
|
|
16790
|
-
import React112, { useEffect as
|
|
17002
|
+
import React112, { useEffect as useEffect31, useMemo as useMemo18, useRef as useRef15, useState as useState33 } from "react";
|
|
16791
17003
|
import { createPortal as createPortal7 } from "react-dom";
|
|
16792
17004
|
|
|
16793
17005
|
// src/components/FunInput/FunTextAreaInput.tsx
|
|
@@ -16971,7 +17183,7 @@ function FunCheckoutHistoryHelp({
|
|
|
16971
17183
|
0 /* INPUT */
|
|
16972
17184
|
);
|
|
16973
17185
|
const wrapperRef = useRef15(null);
|
|
16974
|
-
|
|
17186
|
+
useEffect31(() => wrapperRef.current?.scrollIntoView(), []);
|
|
16975
17187
|
const handleShowErrorMessage = (message, timeMs = FIVE_SECONDS_MS) => {
|
|
16976
17188
|
setErrorMessage(message);
|
|
16977
17189
|
if (timeMs !== void 0) {
|
|
@@ -17156,7 +17368,7 @@ import {
|
|
|
17156
17368
|
formatTimestamp as formatTimestamp2,
|
|
17157
17369
|
isTokenEquivalent as isTokenEquivalent4
|
|
17158
17370
|
} from "@funkit/utils";
|
|
17159
|
-
import React113, { useCallback as
|
|
17371
|
+
import React113, { useCallback as useCallback24, useMemo as useMemo19, useRef as useRef16, useState as useState34 } from "react";
|
|
17160
17372
|
import { createPortal as createPortal8 } from "react-dom";
|
|
17161
17373
|
|
|
17162
17374
|
// src/hooks/useReceiveAmountLabel.ts
|
|
@@ -17185,7 +17397,7 @@ function FunDirectExecutionHistoryDetail({
|
|
|
17185
17397
|
const bottomSectionRef = document.getElementById(bottomBarId);
|
|
17186
17398
|
const { checkoutItem } = useCheckoutContext();
|
|
17187
17399
|
const { beginCheckout } = useFunkitCheckout({});
|
|
17188
|
-
const handleNewCheckout =
|
|
17400
|
+
const handleNewCheckout = useCallback24(
|
|
17189
17401
|
(fromCheckout) => {
|
|
17190
17402
|
onClose({ isNewDeposit: true });
|
|
17191
17403
|
const historicalCheckout = fromCheckout.clientMetadata;
|
|
@@ -17436,11 +17648,11 @@ function FunCheckoutHistoryContent({
|
|
|
17436
17648
|
}
|
|
17437
17649
|
|
|
17438
17650
|
// src/modals/CheckoutModal/CheckoutComplete/useLogCheckoutCompletion.ts
|
|
17439
|
-
import { useCallback as
|
|
17651
|
+
import { useCallback as useCallback25 } from "react";
|
|
17440
17652
|
function useLogCheckoutCompletion() {
|
|
17441
17653
|
const { latestQuote } = useQuoteContext();
|
|
17442
17654
|
const { checkoutItem } = useCheckoutContext();
|
|
17443
|
-
const logCheckoutCompletion =
|
|
17655
|
+
const logCheckoutCompletion = useCallback25(
|
|
17444
17656
|
(depositAddress) => {
|
|
17445
17657
|
if (depositAddress) {
|
|
17446
17658
|
logger.log("checkoutFundingCompleted", {
|
|
@@ -17536,11 +17748,11 @@ function CheckoutHelp({
|
|
|
17536
17748
|
}
|
|
17537
17749
|
|
|
17538
17750
|
// src/modals/CheckoutModal/ConfirmationStep/ConfirmationStep.tsx
|
|
17539
|
-
import React131, { useEffect as
|
|
17751
|
+
import React131, { useEffect as useEffect37, useMemo as useMemo24, useState as useState43 } from "react";
|
|
17540
17752
|
import { createPortal as createPortal10 } from "react-dom";
|
|
17541
17753
|
|
|
17542
17754
|
// src/providers/UserPresenceContext.tsx
|
|
17543
|
-
import React117, { useEffect as
|
|
17755
|
+
import React117, { useEffect as useEffect32 } from "react";
|
|
17544
17756
|
import {
|
|
17545
17757
|
createContext as createContext14,
|
|
17546
17758
|
useContext as useContext14,
|
|
@@ -17552,7 +17764,7 @@ var UserPresenceContext = createContext14({
|
|
|
17552
17764
|
});
|
|
17553
17765
|
var UserPresenceProvider = ({ children }) => {
|
|
17554
17766
|
const [isAway, setIsAway] = useState35(false);
|
|
17555
|
-
|
|
17767
|
+
useEffect32(() => {
|
|
17556
17768
|
let timeoutId;
|
|
17557
17769
|
const handleVisibilityChange = () => {
|
|
17558
17770
|
if (document.visibilityState === "visible") {
|
|
@@ -17583,13 +17795,13 @@ import { FlagKey as FlagKey18, safeParseJson as safeParseJson5 } from "@funkit/u
|
|
|
17583
17795
|
import React118, { useState as useState36 } from "react";
|
|
17584
17796
|
|
|
17585
17797
|
// src/hooks/useInterval.ts
|
|
17586
|
-
import { useEffect as
|
|
17798
|
+
import { useEffect as useEffect33, useRef as useRef17 } from "react";
|
|
17587
17799
|
function useInterval(callback, delay) {
|
|
17588
17800
|
const savedCallback = useRef17(callback);
|
|
17589
17801
|
useIsomorphicLayoutEffect(() => {
|
|
17590
17802
|
savedCallback.current = callback;
|
|
17591
17803
|
}, [callback]);
|
|
17592
|
-
|
|
17804
|
+
useEffect33(() => {
|
|
17593
17805
|
const id = setInterval(() => {
|
|
17594
17806
|
savedCallback.current();
|
|
17595
17807
|
}, delay);
|
|
@@ -18179,14 +18391,14 @@ function KatanaBridgeAlert() {
|
|
|
18179
18391
|
import { useState as useState38 } from "react";
|
|
18180
18392
|
|
|
18181
18393
|
// src/modals/CheckoutModal/useSourceAssetConfirm.tsx
|
|
18182
|
-
import { useEffect as
|
|
18394
|
+
import { useEffect as useEffect34, useState as useState37 } from "react";
|
|
18183
18395
|
|
|
18184
18396
|
// src/hooks/useCheckoutAccountBalanceTransfer.ts
|
|
18185
|
-
import { useCallback as
|
|
18397
|
+
import { useCallback as useCallback26 } from "react";
|
|
18186
18398
|
function useCheckoutAccountBalanceTransfer() {
|
|
18187
18399
|
const { checkoutItem } = useCheckoutContext();
|
|
18188
18400
|
const { funWallet, funWalletAuth } = useGeneralWallet();
|
|
18189
|
-
const generateCheckoutTransferOpItems =
|
|
18401
|
+
const generateCheckoutTransferOpItems = useCallback26(
|
|
18190
18402
|
async (toAddress, tokenAmount) => {
|
|
18191
18403
|
if (checkoutItem?.selectedSourceAssetInfo?.chainId) {
|
|
18192
18404
|
const newConfig = getFunkitEnvForCheckoutEstimation({
|
|
@@ -18317,7 +18529,7 @@ function useHackyTriggerWorkaroundReactDevBrainExplode() {
|
|
|
18317
18529
|
function useTriggerQuoteAndOtherStuffsWithExtremeCaution(onResult, setPreloadedQuoteData) {
|
|
18318
18530
|
const [assetRefresh, triggerAssetConfirm] = useHackyTriggerWorkaroundReactDevBrainExplode();
|
|
18319
18531
|
const { isSourceAssetConfirming, onSourceAssetConfirmed } = useSourceAssetConfirm(setPreloadedQuoteData);
|
|
18320
|
-
|
|
18532
|
+
useEffect34(() => {
|
|
18321
18533
|
if (assetRefresh === 0) {
|
|
18322
18534
|
return;
|
|
18323
18535
|
}
|
|
@@ -18396,7 +18608,7 @@ import React128, { useState as useState39 } from "react";
|
|
|
18396
18608
|
// src/modals/CheckoutModal/ConfirmationStep/useAccountBalanceTransfer.ts
|
|
18397
18609
|
import { getPaymasterDataForCheckoutSponsoredTransfer } from "@funkit/api-base";
|
|
18398
18610
|
import { ERC20_ABI, USDT_ABI } from "@funkit/core";
|
|
18399
|
-
import { useCallback as
|
|
18611
|
+
import { useCallback as useCallback27 } from "react";
|
|
18400
18612
|
import { useAccount as useAccount5, useSendTransaction, useWriteContract } from "wagmi";
|
|
18401
18613
|
|
|
18402
18614
|
// src/utils/isMainnetUsdt.ts
|
|
@@ -18420,7 +18632,7 @@ function useWeb3AccountBalancePostCheckout(setPostCheckoutStepMessage) {
|
|
|
18420
18632
|
const { sendTransactionAsync } = useSendTransaction();
|
|
18421
18633
|
const { cancelCheckout, checkoutItem } = useCheckoutContext();
|
|
18422
18634
|
const { latestQuote } = useQuoteContext();
|
|
18423
|
-
const handleWeb3AccountBalancePostCheckout =
|
|
18635
|
+
const handleWeb3AccountBalancePostCheckout = useCallback27(
|
|
18424
18636
|
async (depositAddress) => {
|
|
18425
18637
|
if (!latestQuote?.baseQuote.estTotalFromAmountBaseUnit) {
|
|
18426
18638
|
return;
|
|
@@ -18526,7 +18738,7 @@ function useWeb3AccountBalancePostCheckout(setPostCheckoutStepMessage) {
|
|
|
18526
18738
|
function useWeb2AccountBalancePostCheckout(apiKey) {
|
|
18527
18739
|
const { latestQuote } = useQuoteContext();
|
|
18528
18740
|
const { generateCheckoutTransferOpItems } = useCheckoutAccountBalanceTransfer();
|
|
18529
|
-
const handleWeb2AccountBalancePostCheckout =
|
|
18741
|
+
const handleWeb2AccountBalancePostCheckout = useCallback27(
|
|
18530
18742
|
async (depositAddress) => {
|
|
18531
18743
|
const { rFunWallet, rFunWalletAuth, transferOp, envConfig } = await generateCheckoutTransferOpItems(
|
|
18532
18744
|
depositAddress,
|
|
@@ -18575,7 +18787,7 @@ function useAccountBalancePostCheckout(setPostCheckoutStepMessage, apiKey) {
|
|
|
18575
18787
|
const { loginType } = useGeneralWallet();
|
|
18576
18788
|
const handleWeb2AccountBalancePostCheckout = useWeb2AccountBalancePostCheckout(apiKey);
|
|
18577
18789
|
const handleWeb3AccountBalancePostCheckout = useWeb3AccountBalancePostCheckout(setPostCheckoutStepMessage);
|
|
18578
|
-
const handleAccountBalancePostCheckout =
|
|
18790
|
+
const handleAccountBalancePostCheckout = useCallback27(
|
|
18579
18791
|
async (depositAddress) => {
|
|
18580
18792
|
if (loginType === "web2" /* Web2 */) {
|
|
18581
18793
|
await handleWeb2AccountBalancePostCheckout(depositAddress);
|
|
@@ -18726,15 +18938,15 @@ function usePostCheckout({
|
|
|
18726
18938
|
}
|
|
18727
18939
|
|
|
18728
18940
|
// src/modals/CheckoutModal/ConfirmationStep/useQuoteRefresh.ts
|
|
18729
|
-
import { useCallback as
|
|
18941
|
+
import { useCallback as useCallback30, useEffect as useEffect36, useMemo as useMemo23, useRef as useRef18, useState as useState42 } from "react";
|
|
18730
18942
|
|
|
18731
18943
|
// src/hooks/useCountdown.tsx
|
|
18732
18944
|
import React130 from "react";
|
|
18733
|
-
import { useCallback as
|
|
18945
|
+
import { useCallback as useCallback29, useState as useState41 } from "react";
|
|
18734
18946
|
|
|
18735
18947
|
// src/components/FunCountdown/FunCountdown.tsx
|
|
18736
18948
|
import { noop as noop7 } from "@funkit/utils";
|
|
18737
|
-
import React129, { useCallback as
|
|
18949
|
+
import React129, { useCallback as useCallback28, useEffect as useEffect35, useState as useState40 } from "react";
|
|
18738
18950
|
|
|
18739
18951
|
// src/components/FunCountdown/FunCountdown.css.ts
|
|
18740
18952
|
var backgroundRing = "_1t0bc111 _1rsrm2f1mm";
|
|
@@ -18770,14 +18982,14 @@ var FunCountdown = ({
|
|
|
18770
18982
|
const onCountdownEndedOnce = useEffectEvent(onCountdownEnded);
|
|
18771
18983
|
const onBeforeCountdownEndsOnce = useEffectEvent(onBeforeCountdownEnds);
|
|
18772
18984
|
const onCountdownLastSecondOnce = useEffectEvent(onCountdownLastSecond);
|
|
18773
|
-
const handleInterval =
|
|
18985
|
+
const handleInterval = useCallback28(() => {
|
|
18774
18986
|
if (isPaused) {
|
|
18775
18987
|
return;
|
|
18776
18988
|
}
|
|
18777
18989
|
setRemainingSeconds((prev) => prev > 0 ? prev - 1 : prev);
|
|
18778
18990
|
}, [isPaused]);
|
|
18779
18991
|
useInterval(handleInterval, 1e3);
|
|
18780
|
-
|
|
18992
|
+
useEffect35(() => {
|
|
18781
18993
|
if (remainingSeconds === onBeforeCountdownEndsSeconds) {
|
|
18782
18994
|
onBeforeCountdownEndsOnce();
|
|
18783
18995
|
}
|
|
@@ -18888,7 +19100,7 @@ function useCountdown({
|
|
|
18888
19100
|
}) {
|
|
18889
19101
|
const [countdownKey, setCountdownKey] = useState41(0);
|
|
18890
19102
|
const [isLastSecond, setIsLastSecond] = useState41(false);
|
|
18891
|
-
const restartCountdown =
|
|
19103
|
+
const restartCountdown = useCallback29(() => {
|
|
18892
19104
|
setIsLastSecond(false);
|
|
18893
19105
|
setCountdownKey((key) => key + 1);
|
|
18894
19106
|
}, []);
|
|
@@ -18943,7 +19155,7 @@ function useQuoteRefresh({
|
|
|
18943
19155
|
preloadedQuoteRef.current = data;
|
|
18944
19156
|
}
|
|
18945
19157
|
);
|
|
18946
|
-
const preloadQuote =
|
|
19158
|
+
const preloadQuote = useCallback30(() => {
|
|
18947
19159
|
if (!isSourceAssetConfirming) {
|
|
18948
19160
|
onSourceAssetConfirmed(true);
|
|
18949
19161
|
}
|
|
@@ -18957,7 +19169,7 @@ function useQuoteRefresh({
|
|
|
18957
19169
|
onBeforeCountdownEnds: preloadQuote,
|
|
18958
19170
|
onCountdownEnded: () => refreshQuote()
|
|
18959
19171
|
});
|
|
18960
|
-
const refreshQuote =
|
|
19172
|
+
const refreshQuote = useCallback30(
|
|
18961
19173
|
async (forceHardRefresh = false) => {
|
|
18962
19174
|
if (isOnHold) {
|
|
18963
19175
|
setIsPendingRefresh(true);
|
|
@@ -18998,7 +19210,7 @@ function useQuoteRefresh({
|
|
|
18998
19210
|
}
|
|
18999
19211
|
return null;
|
|
19000
19212
|
}, [isQuoting, quoteErrorMessage]);
|
|
19001
|
-
|
|
19213
|
+
useEffect36(() => {
|
|
19002
19214
|
if (isPendingRefresh && !isOnHold) {
|
|
19003
19215
|
setIsPendingRefresh(false);
|
|
19004
19216
|
refreshQuote();
|
|
@@ -19115,7 +19327,7 @@ function ConfirmationStep({
|
|
|
19115
19327
|
}
|
|
19116
19328
|
}
|
|
19117
19329
|
});
|
|
19118
|
-
|
|
19330
|
+
useEffect37(() => {
|
|
19119
19331
|
triggerNewQuote({ maxRetries: 1 });
|
|
19120
19332
|
}, []);
|
|
19121
19333
|
const isContinuing = isConfirming || isPostCheckoutLoading;
|
|
@@ -19429,7 +19641,7 @@ function DirectExecutionNotifCenter({
|
|
|
19429
19641
|
|
|
19430
19642
|
// src/modals/CheckoutModal/InputAmount/InputAmount.tsx
|
|
19431
19643
|
import { isMobile as isMobile6 } from "@funkit/utils";
|
|
19432
|
-
import React148, { useEffect as
|
|
19644
|
+
import React148, { useEffect as useEffect38 } from "react";
|
|
19433
19645
|
|
|
19434
19646
|
// src/hooks/queries/useMeldCurrencies.ts
|
|
19435
19647
|
import { getMeldSupportedFiat } from "@funkit/api-base";
|
|
@@ -20736,7 +20948,7 @@ var QuickOptions = ({
|
|
|
20736
20948
|
|
|
20737
20949
|
// src/modals/CheckoutModal/InputAmount/useAmountInput.ts
|
|
20738
20950
|
import {
|
|
20739
|
-
useCallback as
|
|
20951
|
+
useCallback as useCallback32,
|
|
20740
20952
|
useMemo as useMemo25,
|
|
20741
20953
|
useReducer as useReducer3,
|
|
20742
20954
|
useRef as useRef20,
|
|
@@ -20744,10 +20956,10 @@ import {
|
|
|
20744
20956
|
} from "react";
|
|
20745
20957
|
|
|
20746
20958
|
// src/hooks/useTextMeasurer.ts
|
|
20747
|
-
import { useCallback as
|
|
20959
|
+
import { useCallback as useCallback31, useRef as useRef19 } from "react";
|
|
20748
20960
|
function useTextMeasurer(inputRef) {
|
|
20749
20961
|
const canvasRef = useRef19(document.createElement("canvas"));
|
|
20750
|
-
const measureText =
|
|
20962
|
+
const measureText = useCallback31(
|
|
20751
20963
|
(text, fontSize) => {
|
|
20752
20964
|
if (!inputRef.current) {
|
|
20753
20965
|
return void 0;
|
|
@@ -21047,7 +21259,7 @@ function useAmountInput(options) {
|
|
|
21047
21259
|
const isCardCheckout = options.paymentMethod === "card" /* CARD */;
|
|
21048
21260
|
const isMeldFlow = isCardCheckout && isMeldEnabled;
|
|
21049
21261
|
const unitPrice = isStablecoin(checkoutConfig.targetAssetTicker) ? 1 : realUnitPrice;
|
|
21050
|
-
const dispatchAndGetNewState =
|
|
21262
|
+
const dispatchAndGetNewState = useCallback32(
|
|
21051
21263
|
(action) => {
|
|
21052
21264
|
dispatch(action);
|
|
21053
21265
|
return getDerivedState(
|
|
@@ -21238,7 +21450,7 @@ function useAmountInput(options) {
|
|
|
21238
21450
|
return () => element2.removeEventListener("beforeinput", onBeforeInput2);
|
|
21239
21451
|
}
|
|
21240
21452
|
}, [inputDecimals, locale]);
|
|
21241
|
-
const onChange =
|
|
21453
|
+
const onChange = useCallback32(
|
|
21242
21454
|
(event) => {
|
|
21243
21455
|
dispatch({
|
|
21244
21456
|
type: "setInputValue",
|
|
@@ -21273,7 +21485,7 @@ function useAmountInput(options) {
|
|
|
21273
21485
|
});
|
|
21274
21486
|
}
|
|
21275
21487
|
}, [defaultAmount]);
|
|
21276
|
-
const setFiatAmount =
|
|
21488
|
+
const setFiatAmount = useCallback32(
|
|
21277
21489
|
(fiatAmount) => {
|
|
21278
21490
|
const newState = dispatchAndGetNewState({
|
|
21279
21491
|
type: "setFiatAmount",
|
|
@@ -21285,7 +21497,7 @@ function useAmountInput(options) {
|
|
|
21285
21497
|
},
|
|
21286
21498
|
[dispatchAndGetNewState, unitPrice]
|
|
21287
21499
|
);
|
|
21288
|
-
const toggleInputInFiat =
|
|
21500
|
+
const toggleInputInFiat = useCallback32(() => {
|
|
21289
21501
|
dispatch({ type: "toggleInputInFiat" });
|
|
21290
21502
|
inputRef.current?.focus();
|
|
21291
21503
|
}, []);
|
|
@@ -21304,7 +21516,7 @@ function useAmountInput(options) {
|
|
|
21304
21516
|
|
|
21305
21517
|
// src/modals/CheckoutModal/InputAmount/useMeld.tsx
|
|
21306
21518
|
import { MeldServiceProvider as MeldServiceProvider2 } from "@funkit/api-base";
|
|
21307
|
-
import React145, { useCallback as
|
|
21519
|
+
import React145, { useCallback as useCallback34 } from "react";
|
|
21308
21520
|
|
|
21309
21521
|
// src/components/SourceMeldQuoteItem/SourceMeldQuoteItem.tsx
|
|
21310
21522
|
import React144 from "react";
|
|
@@ -21697,7 +21909,7 @@ import {
|
|
|
21697
21909
|
katanaChain
|
|
21698
21910
|
} from "@funkit/chains";
|
|
21699
21911
|
import { getTokenAddressBySymbolAndChainId as getTokenAddressBySymbolAndChainId2 } from "@funkit/core";
|
|
21700
|
-
import { useCallback as
|
|
21912
|
+
import { useCallback as useCallback33, useState as useState45 } from "react";
|
|
21701
21913
|
import { mainnet as mainnet8, mantle, zksync as zksync2 } from "viem/chains";
|
|
21702
21914
|
var pickSourceAssetForCard = async (checkoutItem, userIpInfo) => {
|
|
21703
21915
|
if (!checkoutItem?.initSettings.config.targetChain) {
|
|
@@ -21758,7 +21970,7 @@ function useUpdateCardSourceAsset() {
|
|
|
21758
21970
|
const { checkoutItem, updateSourceAsset } = useCheckoutContext();
|
|
21759
21971
|
const { userIpInfo } = useFunkitUserIp();
|
|
21760
21972
|
const [isUpdating, setIsUpdating] = useState45(false);
|
|
21761
|
-
const onSelectCard =
|
|
21973
|
+
const onSelectCard = useCallback33(async () => {
|
|
21762
21974
|
setIsUpdating(true);
|
|
21763
21975
|
try {
|
|
21764
21976
|
const source = await pickSourceAssetForCard(checkoutItem, userIpInfo);
|
|
@@ -21857,7 +22069,7 @@ function useMeld(meldEnabled, manuallySelectedQuote, usdAmount, fiatCurrency) {
|
|
|
21857
22069
|
);
|
|
21858
22070
|
const isMeldMoonpaySelected = selectedQuote?.serviceProvider === MeldServiceProvider2.MOONPAY;
|
|
21859
22071
|
const isMeldContinueDisabled = meldEnabled && (!!meldLimitError || isMeldLinkPending || !!meldQuotesQuery.error || meldQuotesQuery.isFetching || isSelectedQuoteUnavailable);
|
|
21860
|
-
const getMeldError =
|
|
22072
|
+
const getMeldError = useCallback34(
|
|
21861
22073
|
function getMeldError2() {
|
|
21862
22074
|
if (isSelectedQuoteUnavailable) {
|
|
21863
22075
|
return {
|
|
@@ -22459,7 +22671,7 @@ function InputAmount(props) {
|
|
|
22459
22671
|
const skipExchangeRates = paymentMethodInfo.paymentMethod !== "card" /* CARD */ || !isDefiMode;
|
|
22460
22672
|
const exchangeRatesLoaded = !isCurrencyExchangeRatesLoading && !!currencyExchangeRates;
|
|
22461
22673
|
const isLoaded = !!(checkoutItem && unitPrice && !sourceHoldingError && !isLoadingSourceHolding && !isMeldDefaultCurrencyLoading && (skipExchangeRates || exchangeRatesLoaded));
|
|
22462
|
-
|
|
22674
|
+
useEffect38(() => setCheckoutQuote(null), []);
|
|
22463
22675
|
if (isLoaded) {
|
|
22464
22676
|
return /* @__PURE__ */ React148.createElement(
|
|
22465
22677
|
InputAmountLoaded,
|
|
@@ -22485,7 +22697,7 @@ function InputAmount(props) {
|
|
|
22485
22697
|
}
|
|
22486
22698
|
|
|
22487
22699
|
// src/modals/CheckoutModal/LoadingAccount.tsx
|
|
22488
|
-
import React151, { useEffect as
|
|
22700
|
+
import React151, { useEffect as useEffect39 } from "react";
|
|
22489
22701
|
|
|
22490
22702
|
// src/domains/wallet.ts
|
|
22491
22703
|
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO14 } from "@funkit/chains";
|
|
@@ -22503,11 +22715,9 @@ function usePaymentMethodEnablement({
|
|
|
22503
22715
|
const isFiatFlagEnabled = useFiatEnabled();
|
|
22504
22716
|
const isCardFlagEnabled = useFlag(FlagKey23.EnableCard);
|
|
22505
22717
|
const isKatanaEarnFlowAction = isKatanaEarnFlow({ apiKey, checkoutConfig });
|
|
22506
|
-
const
|
|
22507
|
-
const
|
|
22508
|
-
const
|
|
22509
|
-
const isTokenTransferEnabled = isTokenTransferFlagEnabled && !isKatanaEarnFlowAction && !isUsKatanaUser && !isUsHyperdashUser;
|
|
22510
|
-
const isCardEnabled = isCardFlagEnabled && !isKatanaEarnFlowAction && !isUsHyperdashUser;
|
|
22718
|
+
const isFiatEnabled = isFiatFlagEnabled && !isKatanaEarnFlowAction;
|
|
22719
|
+
const isTokenTransferEnabled = isTokenTransferFlagEnabled && !isKatanaEarnFlowAction;
|
|
22720
|
+
const isCardEnabled = isCardFlagEnabled && !isKatanaEarnFlowAction;
|
|
22511
22721
|
return {
|
|
22512
22722
|
isFiatEnabled,
|
|
22513
22723
|
isTokenTransferEnabled,
|
|
@@ -22815,7 +23025,7 @@ function LoadingAccount({
|
|
|
22815
23025
|
const hasCustomStartingStep = !!checkoutConfig?.startingStep;
|
|
22816
23026
|
const startsOnConfirmationStep = checkoutConfig?.startingStep === "confirmation" /* CONFIRMATION */;
|
|
22817
23027
|
const startsOnSelectAssetStep = checkoutConfig?.startingStep === "select_asset" /* SELECT_ASSET */;
|
|
22818
|
-
|
|
23028
|
+
useEffect39(() => {
|
|
22819
23029
|
if (isLoadingFlags || isLoadingFiat || !checkoutConfig) {
|
|
22820
23030
|
return;
|
|
22821
23031
|
}
|
|
@@ -23065,7 +23275,7 @@ function MeldQuotes({
|
|
|
23065
23275
|
}
|
|
23066
23276
|
|
|
23067
23277
|
// src/modals/CheckoutModal/MoonpaySetup.tsx
|
|
23068
|
-
import React155, { useCallback as
|
|
23278
|
+
import React155, { useCallback as useCallback35, useMemo as useMemo31, useState as useState48 } from "react";
|
|
23069
23279
|
|
|
23070
23280
|
// src/components/FunPayments/FunPaymentMoonpayType.css.ts
|
|
23071
23281
|
var mpClass = "_1kmpeyf0";
|
|
@@ -23074,10 +23284,10 @@ var stretchStyle = "_1kmpeyf1";
|
|
|
23074
23284
|
// src/components/FunPayments/FunPaymentMoonpayType.tsx
|
|
23075
23285
|
import { getMoonpayUrlSignature } from "@funkit/api-base";
|
|
23076
23286
|
import { colorToHex } from "@funkit/utils";
|
|
23077
|
-
import React154, { Fragment, useEffect as
|
|
23287
|
+
import React154, { Fragment, useEffect as useEffect40, useMemo as useMemo30, useState as useState47 } from "react";
|
|
23078
23288
|
var LazyMoonPayBuyWidget = (props) => {
|
|
23079
23289
|
const [MoonPayBuyWidget, setMoonPayBuyWidget] = useState47(null);
|
|
23080
|
-
|
|
23290
|
+
useEffect40(() => {
|
|
23081
23291
|
const loadMoonPayBuyWidget = async () => {
|
|
23082
23292
|
const module = await import("@moonpay/moonpay-react");
|
|
23083
23293
|
setMoonPayBuyWidget(() => module.MoonPayBuyWidget);
|
|
@@ -23186,7 +23396,7 @@ function MoonpaySetup({
|
|
|
23186
23396
|
const { paymentAddress, token, tokenChainId, depositAmount } = modalState;
|
|
23187
23397
|
const [isSupportedRegion, setIsSupportedRegion] = useState48(true);
|
|
23188
23398
|
const [isContinueEnabled, setIsContinueEnabled] = useState48(false);
|
|
23189
|
-
const handleOnCompleted =
|
|
23399
|
+
const handleOnCompleted = useCallback35(() => {
|
|
23190
23400
|
onNext({
|
|
23191
23401
|
depositAddress: paymentAddress
|
|
23192
23402
|
});
|
|
@@ -23222,7 +23432,7 @@ function MoonpaySetup({
|
|
|
23222
23432
|
// src/modals/CheckoutModal/SelectAsset.tsx
|
|
23223
23433
|
import { FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST as FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST2 } from "@funkit/chains";
|
|
23224
23434
|
import { formatCurrencyAndStringify as formatCurrencyAndStringify11, isTokenEquivalent as isTokenEquivalent8 } from "@funkit/utils";
|
|
23225
|
-
import React158, { useEffect as
|
|
23435
|
+
import React158, { useEffect as useEffect41, useMemo as useMemo33, useState as useState49 } from "react";
|
|
23226
23436
|
import { createPortal as createPortal14 } from "react-dom";
|
|
23227
23437
|
|
|
23228
23438
|
// src/components/Dropdown/ReceiveTokenDropdown.tsx
|
|
@@ -23352,7 +23562,7 @@ var NewTokenDepositAlert = ({
|
|
|
23352
23562
|
// src/hooks/useAllowedAssets.ts
|
|
23353
23563
|
import { getAllowedAssets } from "@funkit/api-base";
|
|
23354
23564
|
import { useQuery as useQuery17 } from "@tanstack/react-query";
|
|
23355
|
-
import { useCallback as
|
|
23565
|
+
import { useCallback as useCallback36, useMemo as useMemo32 } from "react";
|
|
23356
23566
|
function useAllowedAssets() {
|
|
23357
23567
|
const { apiKey } = useFunkitConfig();
|
|
23358
23568
|
const { checkoutItem } = useCheckoutContext();
|
|
@@ -23377,7 +23587,7 @@ function useAllowedAssets() {
|
|
|
23377
23587
|
}
|
|
23378
23588
|
return ret;
|
|
23379
23589
|
}, [allowedAssets]);
|
|
23380
|
-
const isAllowed =
|
|
23590
|
+
const isAllowed = useCallback36(
|
|
23381
23591
|
(chainId, tokenAddress) => {
|
|
23382
23592
|
const disabledByCustomerList = checkoutItem?.initSettings.config.disabledSourceTokens?.some(
|
|
23383
23593
|
(token) => {
|
|
@@ -23538,7 +23748,7 @@ function useAssetOptions({
|
|
|
23538
23748
|
return assetOptions;
|
|
23539
23749
|
}
|
|
23540
23750
|
function useScrollToSelectedAsset(selectedChainTokenSymbol) {
|
|
23541
|
-
|
|
23751
|
+
useEffect41(() => {
|
|
23542
23752
|
const optionEl = document.getElementById(
|
|
23543
23753
|
`option-${selectedChainTokenSymbol}`
|
|
23544
23754
|
);
|
|
@@ -23921,7 +24131,7 @@ function SelectAsset({
|
|
|
23921
24131
|
|
|
23922
24132
|
// src/modals/CheckoutModal/SourceChange/SourceChange.tsx
|
|
23923
24133
|
import { BridgeCustomerStatus as BridgeCustomerStatus6, MeldServiceProvider as MeldServiceProvider4 } from "@funkit/api-base";
|
|
23924
|
-
import React160, { useCallback as
|
|
24134
|
+
import React160, { useCallback as useCallback37, useEffect as useEffect42, useState as useState50 } from "react";
|
|
23925
24135
|
import { createPortal as createPortal15 } from "react-dom";
|
|
23926
24136
|
|
|
23927
24137
|
// src/modals/CheckoutModal/SourceChange/DefiPurchaseSection.tsx
|
|
@@ -24057,7 +24267,7 @@ function PayPal() {
|
|
|
24057
24267
|
const isMeldEnabled = useIsMeldEnabled();
|
|
24058
24268
|
const { checkoutItem } = useCheckoutContext();
|
|
24059
24269
|
const isPaypalReady = false;
|
|
24060
|
-
const onClick =
|
|
24270
|
+
const onClick = useCallback37(() => {
|
|
24061
24271
|
if (isMeldEnabled && isPaypalReady) {
|
|
24062
24272
|
openMeldPopup(() => mutateAsync(MeldServiceProvider4.PAYPAL));
|
|
24063
24273
|
} else {
|
|
@@ -24099,7 +24309,7 @@ function SourceChange({
|
|
|
24099
24309
|
const userInfo = useFunkitUserInfo();
|
|
24100
24310
|
const isDefiMode = checkoutItem?.initSettings.config.isDefiMode;
|
|
24101
24311
|
const hasAutoContinue = !isOstiumCustomer(apiKey) && !isDefiMode;
|
|
24102
|
-
|
|
24312
|
+
useEffect42(() => {
|
|
24103
24313
|
if (!paymentMethodInfo) {
|
|
24104
24314
|
return;
|
|
24105
24315
|
}
|
|
@@ -24120,7 +24330,7 @@ function SourceChange({
|
|
|
24120
24330
|
brokerageFailed: false
|
|
24121
24331
|
});
|
|
24122
24332
|
};
|
|
24123
|
-
const onCloseConnectModal =
|
|
24333
|
+
const onCloseConnectModal = useCallback37(() => {
|
|
24124
24334
|
if (modalState.isSoftHidden) {
|
|
24125
24335
|
setModalState((state) => ({ ...state, isSoftHidden: false }));
|
|
24126
24336
|
}
|
|
@@ -24286,20 +24496,20 @@ import { createPortal as createPortal16 } from "react-dom";
|
|
|
24286
24496
|
|
|
24287
24497
|
// src/components/CopyAddress/CopyInputDisplayedAddress.tsx
|
|
24288
24498
|
import { truncateMiddleOfAddress } from "@funkit/utils";
|
|
24289
|
-
import React161, { useCallback as
|
|
24499
|
+
import React161, { useCallback as useCallback39, useState as useState52 } from "react";
|
|
24290
24500
|
|
|
24291
24501
|
// src/hooks/useCopyToClipboard.ts
|
|
24292
|
-
import { useCallback as
|
|
24502
|
+
import { useCallback as useCallback38, useEffect as useEffect43, useState as useState51 } from "react";
|
|
24293
24503
|
var useCopyToClipboard = (text, delay = 1500) => {
|
|
24294
24504
|
const [isCopied, setCopied] = useState51(false);
|
|
24295
|
-
const handleCopy =
|
|
24505
|
+
const handleCopy = useCallback38(() => {
|
|
24296
24506
|
if (!text) {
|
|
24297
24507
|
return;
|
|
24298
24508
|
}
|
|
24299
24509
|
navigator.clipboard.writeText(text);
|
|
24300
24510
|
setCopied(true);
|
|
24301
24511
|
}, [text]);
|
|
24302
|
-
|
|
24512
|
+
useEffect43(() => {
|
|
24303
24513
|
if (!isCopied) {
|
|
24304
24514
|
return;
|
|
24305
24515
|
}
|
|
@@ -24332,7 +24542,7 @@ function CopyInputDisplayedAddress({
|
|
|
24332
24542
|
const { handleCopy } = useCopyToClipboard(address);
|
|
24333
24543
|
const [isActive, setIsActive] = useState52(null);
|
|
24334
24544
|
const displayAddress = truncateAddress ? truncateMiddleOfAddress(address, 40, 24, 8) : address;
|
|
24335
|
-
const handleClick =
|
|
24545
|
+
const handleClick = useCallback39(() => {
|
|
24336
24546
|
if (isActive) {
|
|
24337
24547
|
return;
|
|
24338
24548
|
}
|
|
@@ -25800,9 +26010,9 @@ var FiatAccountDetail = {
|
|
|
25800
26010
|
|
|
25801
26011
|
// src/modals/CheckoutModal/VirtualFiatAccount/KycIframe.tsx
|
|
25802
26012
|
import { BridgeCustomerStatus as BridgeCustomerStatus7 } from "@funkit/api-base";
|
|
25803
|
-
import React180, { useCallback as
|
|
26013
|
+
import React180, { useCallback as useCallback40, useEffect as useEffect44, useMemo as useMemo36, useState as useState56 } from "react";
|
|
25804
26014
|
function useIframeListener(listeners) {
|
|
25805
|
-
const handleMessage =
|
|
26015
|
+
const handleMessage = useCallback40(
|
|
25806
26016
|
(event) => {
|
|
25807
26017
|
switch (event.data.name) {
|
|
25808
26018
|
case "load": {
|
|
@@ -25824,7 +26034,7 @@ function useIframeListener(listeners) {
|
|
|
25824
26034
|
},
|
|
25825
26035
|
[listeners]
|
|
25826
26036
|
);
|
|
25827
|
-
|
|
26037
|
+
useEffect44(() => {
|
|
25828
26038
|
window.addEventListener("message", handleMessage);
|
|
25829
26039
|
return () => {
|
|
25830
26040
|
window.removeEventListener("message", handleMessage);
|
|
@@ -25940,6 +26150,35 @@ function KycIframe({
|
|
|
25940
26150
|
);
|
|
25941
26151
|
}
|
|
25942
26152
|
|
|
26153
|
+
// src/modals/CheckoutModal/stepTransition.track.ts
|
|
26154
|
+
var CHECKOUT_STEP_TO_EVENT = {
|
|
26155
|
+
["select_asset" /* SELECT_ASSET */]: "fc::navigate::select_asset" /* NAVIGATE_SELECT_ASSET */,
|
|
26156
|
+
["source_change" /* SOURCE_CHANGE */]: "fc::navigate::source_change" /* NAVIGATE_SOURCE_CHANGE */,
|
|
26157
|
+
["confirmation" /* CONFIRMATION */]: "fc::navigate::confirmation" /* NAVIGATE_CONFIRMATION */,
|
|
26158
|
+
["checkout_complete" /* CHECKOUT_COMPLETE */]: "fc::navigate::checkout_complete" /* NAVIGATE_CHECKOUT_COMPLETE */,
|
|
26159
|
+
["transfer_token" /* TRANSFER_TOKEN */]: "fc::navigate::transfer_token" /* NAVIGATE_TRANSFER_TOKEN */,
|
|
26160
|
+
["input_amount" /* INPUT_AMOUNT */]: "fc::navigate::input_amount" /* NAVIGATE_INPUT_AMOUNT */,
|
|
26161
|
+
["error_screen" /* ERROR_SCREEN */]: "fc::navigate::error_screen" /* NAVIGATE_ERROR_SCREEN */,
|
|
26162
|
+
["fiat_account_detail" /* FIAT_ACCOUNT_DETAIL */]: "fc::navigate::fiat_account_detail" /* NAVIGATE_FIAT_ACCOUNT_DETAIL */,
|
|
26163
|
+
["bridge_kyc" /* BRIDGE_KYC */]: "fc::navigate::bridge_kyc" /* NAVIGATE_BRIDGE_KYC */,
|
|
26164
|
+
["bridge_customer" /* BRIDGE_CUSTOMER */]: "fc::navigate::bridge_customer" /* NAVIGATE_BRIDGE_CUSTOMER */,
|
|
26165
|
+
["payment_setup" /* MOONPAY_SETUP */]: "fc::navigate::moonpay_setup" /* NAVIGATE_MOONPAY_SETUP */,
|
|
26166
|
+
["meld_quotes" /* MELD_QUOTES */]: "fc::navigate::meld_quotes" /* NAVIGATE_MELD_QUOTES */,
|
|
26167
|
+
["meld_currency_select" /* MELD_CURRENCY_SELECT */]: "fc::navigate::meld_currency_select" /* NAVIGATE_MELD_CURRENCY_SELECT */,
|
|
26168
|
+
["direct_execution_notif_center" /* DIRECT_EXECUTION_NOTIF_CENTER */]: "fc::navigate::direct_execution_notif_center" /* NAVIGATE_DIRECT_EXECUTION_NOTIF_CENTER */,
|
|
26169
|
+
["KYC_IFRAME" /* KYC_IFRAME */]: "fc::navigate::kyc_iframe" /* NAVIGATE_KYC_IFRAME */,
|
|
26170
|
+
["create_fiat_account" /* CREATE_FIAT_ACCOUNT */]: "fc::navigate::create_fiat_account" /* NAVIGATE_CREATE_FIAT_ACCOUNT */,
|
|
26171
|
+
["loading_account" /* LOADING_ACCOUNT */]: "fc::navigate::loading_account" /* NAVIGATE_LOADING_ACCOUNT */,
|
|
26172
|
+
["checkout_help" /* CHECKOUT_HELP */]: "fc::navigate::checkout_help" /* NAVIGATE_CHECKOUT_HELP */
|
|
26173
|
+
};
|
|
26174
|
+
var trackEventFromNextState = (nextState) => {
|
|
26175
|
+
const eventName = CHECKOUT_STEP_TO_EVENT[nextState.step];
|
|
26176
|
+
return {
|
|
26177
|
+
eventName,
|
|
26178
|
+
metadata: nextState
|
|
26179
|
+
};
|
|
26180
|
+
};
|
|
26181
|
+
|
|
25943
26182
|
// src/modals/CheckoutModal/stepTransition.ts
|
|
25944
26183
|
function extractCommonState(state) {
|
|
25945
26184
|
return {
|
|
@@ -25990,29 +26229,42 @@ function initialState(checkoutItem) {
|
|
|
25990
26229
|
};
|
|
25991
26230
|
}
|
|
25992
26231
|
function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
26232
|
+
const { logEvent } = useTrack();
|
|
25993
26233
|
const [modalState, setModalState] = useState57(() => initialState(checkoutItem));
|
|
26234
|
+
const trackNextState = useCallback41(
|
|
26235
|
+
(nextState) => {
|
|
26236
|
+
const trackEvent = trackEventFromNextState(nextState);
|
|
26237
|
+
logEvent(trackEvent);
|
|
26238
|
+
},
|
|
26239
|
+
[logEvent]
|
|
26240
|
+
);
|
|
25994
26241
|
const { clearCheckoutQuoteMessages } = useCheckoutQuoteNotification();
|
|
25995
|
-
const onCloseWrapper =
|
|
26242
|
+
const onCloseWrapper = useCallback41(
|
|
25996
26243
|
(options) => {
|
|
25997
26244
|
const normalizedIsNewDeposit = !!options?.isNewDeposit;
|
|
25998
26245
|
checkoutItem.initSettings.onClose?.({
|
|
25999
26246
|
isNewDeposit: normalizedIsNewDeposit
|
|
26000
26247
|
});
|
|
26001
|
-
|
|
26248
|
+
const metadata = {
|
|
26002
26249
|
checkoutStep: modalState.step,
|
|
26003
26250
|
checkoutId: checkoutItem.id,
|
|
26004
26251
|
checkoutItem,
|
|
26005
26252
|
isNewDeposit: normalizedIsNewDeposit
|
|
26253
|
+
};
|
|
26254
|
+
logger.log("closingCheckoutModal", metadata);
|
|
26255
|
+
logEvent({
|
|
26256
|
+
eventName: "fc::modal_closed" /* MODAL_CLOSED */,
|
|
26257
|
+
metadata
|
|
26006
26258
|
});
|
|
26007
26259
|
onClose();
|
|
26008
26260
|
},
|
|
26009
|
-
[checkoutItem, modalState.step, onClose]
|
|
26261
|
+
[checkoutItem, modalState.step, onClose, logEvent]
|
|
26010
26262
|
);
|
|
26011
26263
|
const { animation, animate } = useAnimatedNavigation(void 0);
|
|
26012
26264
|
const [stateHistory, setHistory] = useState57([]);
|
|
26013
26265
|
const prevStep = useRef22(null);
|
|
26014
26266
|
const hasHistoryEntry = stateHistory.length > 1;
|
|
26015
|
-
const onNext =
|
|
26267
|
+
const onNext = useCallback41(
|
|
26016
26268
|
(payload) => {
|
|
26017
26269
|
if (prevStep.current === modalState.step) {
|
|
26018
26270
|
return;
|
|
@@ -26034,6 +26286,7 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
26034
26286
|
setHistory((prev) => [...prev, modalState]);
|
|
26035
26287
|
}
|
|
26036
26288
|
setModalState(nextState);
|
|
26289
|
+
trackNextState(nextState);
|
|
26037
26290
|
},
|
|
26038
26291
|
{
|
|
26039
26292
|
reverse: (!!payload.reverseAnimation || !!payload.navigateToHistoryStep) && hasHistoryEntry,
|
|
@@ -26043,9 +26296,15 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
26043
26296
|
);
|
|
26044
26297
|
prevStep.current = modalState.step;
|
|
26045
26298
|
},
|
|
26046
|
-
[
|
|
26299
|
+
[
|
|
26300
|
+
clearCheckoutQuoteMessages,
|
|
26301
|
+
modalState,
|
|
26302
|
+
animate,
|
|
26303
|
+
hasHistoryEntry,
|
|
26304
|
+
trackNextState
|
|
26305
|
+
]
|
|
26047
26306
|
);
|
|
26048
|
-
const onStepChange =
|
|
26307
|
+
const onStepChange = useCallback41(
|
|
26049
26308
|
(nextState) => {
|
|
26050
26309
|
if (prevStep.current === modalState.step) {
|
|
26051
26310
|
return;
|
|
@@ -26053,12 +26312,13 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
26053
26312
|
animate(() => {
|
|
26054
26313
|
setHistory((prev) => [...prev, modalState]);
|
|
26055
26314
|
setModalState(nextState);
|
|
26315
|
+
trackNextState(nextState);
|
|
26056
26316
|
});
|
|
26057
26317
|
prevStep.current = modalState.step;
|
|
26058
26318
|
},
|
|
26059
|
-
[modalState, animate]
|
|
26319
|
+
[modalState, animate, trackNextState]
|
|
26060
26320
|
);
|
|
26061
|
-
const onBack =
|
|
26321
|
+
const onBack = useCallback41(() => {
|
|
26062
26322
|
clearCheckoutQuoteMessages();
|
|
26063
26323
|
const backStepOverride = checkoutBackMap[modalState.step];
|
|
26064
26324
|
const prevState = [...stateHistory].reverse().find((s) => s.step === backStepOverride) ?? stateHistory[stateHistory.length - 1];
|
|
@@ -26073,12 +26333,20 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
26073
26333
|
prevStep.current = newHistory[newHistory.length - 1].step;
|
|
26074
26334
|
return newHistory;
|
|
26075
26335
|
});
|
|
26076
|
-
|
|
26336
|
+
const nextState = backWithStep(modalState, prevState);
|
|
26337
|
+
setModalState(nextState);
|
|
26338
|
+
trackNextState(nextState);
|
|
26077
26339
|
},
|
|
26078
26340
|
{ reverse: true }
|
|
26079
26341
|
);
|
|
26080
26342
|
}
|
|
26081
|
-
}, [
|
|
26343
|
+
}, [
|
|
26344
|
+
clearCheckoutQuoteMessages,
|
|
26345
|
+
modalState,
|
|
26346
|
+
animate,
|
|
26347
|
+
stateHistory,
|
|
26348
|
+
trackNextState
|
|
26349
|
+
]);
|
|
26082
26350
|
return {
|
|
26083
26351
|
animation,
|
|
26084
26352
|
modalState,
|
|
@@ -26135,7 +26403,7 @@ function FunCheckoutModalHeightAnimationWrapper({
|
|
|
26135
26403
|
const animationFrameRef = useRef23(null);
|
|
26136
26404
|
const resizeObserverRef = useRef23(null);
|
|
26137
26405
|
const [height, setHeight] = useState58("auto");
|
|
26138
|
-
|
|
26406
|
+
useEffect45(() => {
|
|
26139
26407
|
if (containerRef.current) {
|
|
26140
26408
|
resizeObserverRef.current = new ResizeObserver((entries) => {
|
|
26141
26409
|
animationFrameRef.current = requestAnimationFrame(() => {
|
|
@@ -26182,7 +26450,7 @@ function FunCheckoutModalHeightAnimationWrapper({
|
|
|
26182
26450
|
}
|
|
26183
26451
|
|
|
26184
26452
|
// src/components/FunConnectOptions/FunConnectResultStep.tsx
|
|
26185
|
-
import React182, { useEffect as
|
|
26453
|
+
import React182, { useEffect as useEffect46 } from "react";
|
|
26186
26454
|
var AUTO_CLOSE = 2e3;
|
|
26187
26455
|
var messageMap = (hasQrCode) => ({
|
|
26188
26456
|
error: {
|
|
@@ -26201,7 +26469,7 @@ var FunConnectResultStep = ({
|
|
|
26201
26469
|
qrCodeUri
|
|
26202
26470
|
}) => {
|
|
26203
26471
|
const hasAutoclose = type === "success";
|
|
26204
|
-
|
|
26472
|
+
useEffect46(() => {
|
|
26205
26473
|
if (!hasAutoclose) {
|
|
26206
26474
|
return;
|
|
26207
26475
|
}
|
|
@@ -26253,7 +26521,7 @@ var FunConnectResultStep = ({
|
|
|
26253
26521
|
|
|
26254
26522
|
// src/components/FunConnectOptions/FunFarcasterConnectingStep.tsx
|
|
26255
26523
|
import { isMobile as isMobile7, isSafari as isSafari2, redirectInMobile } from "@funkit/utils";
|
|
26256
|
-
import React185, { useCallback as
|
|
26524
|
+
import React185, { useCallback as useCallback42, useEffect as useEffect47 } from "react";
|
|
26257
26525
|
|
|
26258
26526
|
// src/components/CopyAddress/OldCopyAddressButton.tsx
|
|
26259
26527
|
import React184 from "react";
|
|
@@ -26300,13 +26568,13 @@ function FunFarcasterConnectingStep({
|
|
|
26300
26568
|
}) {
|
|
26301
26569
|
const mobile = isMobile7();
|
|
26302
26570
|
const safari = isSafari2();
|
|
26303
|
-
|
|
26571
|
+
useEffect47(() => {
|
|
26304
26572
|
if (farcasterUri && mobile && !safari) {
|
|
26305
26573
|
redirectInMobile(farcasterUri);
|
|
26306
26574
|
}
|
|
26307
26575
|
}, [farcasterUri, mobile, safari]);
|
|
26308
26576
|
useSIWFarcasterListener(farcasterToken);
|
|
26309
|
-
const svgUrl =
|
|
26577
|
+
const svgUrl = useCallback42(async () => {
|
|
26310
26578
|
return (await import("./farcaster-MF6WINBA.js")).default;
|
|
26311
26579
|
}, []);
|
|
26312
26580
|
const promptText = mobile ? "To sign in with Farcaster, please open the Warpcast app." : "Scan this QR code or open the link with your mobile phone.";
|
|
@@ -26354,12 +26622,12 @@ function FunFarcasterConnectingStep({
|
|
|
26354
26622
|
|
|
26355
26623
|
// src/components/FunConnectOptions/FunWeb2ConnectingStep.tsx
|
|
26356
26624
|
import { isNotNullish as isNotNullish9 } from "@funkit/utils";
|
|
26357
|
-
import React188, { useCallback as
|
|
26625
|
+
import React188, { useCallback as useCallback44, useEffect as useEffect49, useState as useState60 } from "react";
|
|
26358
26626
|
|
|
26359
26627
|
// src/components/FunInput/FunTwoFaInput.tsx
|
|
26360
26628
|
import React186, {
|
|
26361
|
-
useCallback as
|
|
26362
|
-
useEffect as
|
|
26629
|
+
useCallback as useCallback43,
|
|
26630
|
+
useEffect as useEffect48,
|
|
26363
26631
|
useRef as useRef24,
|
|
26364
26632
|
useState as useState59
|
|
26365
26633
|
} from "react";
|
|
@@ -26380,17 +26648,17 @@ var FunTwoFaInput = ({
|
|
|
26380
26648
|
const [currentLength, setCurrentLength] = useState59(initialInputLength);
|
|
26381
26649
|
const [focusIndex, setFocusIndex] = useState59(0);
|
|
26382
26650
|
const [isFocused, setIsFocused] = useState59(false);
|
|
26383
|
-
|
|
26651
|
+
useEffect48(() => {
|
|
26384
26652
|
if (!value) {
|
|
26385
26653
|
setFocusIndex(0);
|
|
26386
26654
|
}
|
|
26387
26655
|
}, [value]);
|
|
26388
|
-
const ensureFocus =
|
|
26656
|
+
const ensureFocus = useCallback43((nextIndex) => {
|
|
26389
26657
|
setTimeout(() => {
|
|
26390
26658
|
inputRefs.current[nextIndex]?.focus();
|
|
26391
26659
|
}, 10);
|
|
26392
26660
|
}, []);
|
|
26393
|
-
const handleBackspace =
|
|
26661
|
+
const handleBackspace = useCallback43(
|
|
26394
26662
|
(index) => {
|
|
26395
26663
|
if (index === maxInputLength - 1 && value.length === maxInputLength) {
|
|
26396
26664
|
onChange(value.slice(0, index));
|
|
@@ -26414,7 +26682,7 @@ var FunTwoFaInput = ({
|
|
|
26414
26682
|
},
|
|
26415
26683
|
[currentLength, initialInputLength, maxInputLength, onChange, value]
|
|
26416
26684
|
);
|
|
26417
|
-
const handleChange =
|
|
26685
|
+
const handleChange = useCallback43(
|
|
26418
26686
|
(changeEvent) => {
|
|
26419
26687
|
changeEvent.stopPropagation();
|
|
26420
26688
|
const nativeEvent = changeEvent.nativeEvent;
|
|
@@ -26580,10 +26848,10 @@ var FunWeb2ConnectingStep = ({
|
|
|
26580
26848
|
loginErrorMessage,
|
|
26581
26849
|
clearLoginError
|
|
26582
26850
|
} = useFunkitWeb2Login();
|
|
26583
|
-
|
|
26851
|
+
useEffect49(() => {
|
|
26584
26852
|
clearLoginError();
|
|
26585
26853
|
}, []);
|
|
26586
|
-
const handleOtpComplete =
|
|
26854
|
+
const handleOtpComplete = useCallback44(
|
|
26587
26855
|
async (finalOtpInput) => {
|
|
26588
26856
|
if (isNotNullish9(initialChainId)) {
|
|
26589
26857
|
await handleFunkitWeb2Login({
|
|
@@ -26730,7 +26998,7 @@ function FunConnectOptions({
|
|
|
26730
26998
|
const { loginConfig } = useFunkitConfig();
|
|
26731
26999
|
const prioritizedLoginType = loginConfig.prioritizedLogin;
|
|
26732
27000
|
const hasSecondarySignIn = prioritizedLoginType !== "none" && loginConfig.web2 && loginConfig.web3;
|
|
26733
|
-
const changeStep =
|
|
27001
|
+
const changeStep = useCallback45((newStep) => {
|
|
26734
27002
|
setStep(newStep);
|
|
26735
27003
|
if (isSignIn(newStep)) {
|
|
26736
27004
|
setSelectedWallet(void 0);
|
|
@@ -26738,7 +27006,7 @@ function FunConnectOptions({
|
|
|
26738
27006
|
}
|
|
26739
27007
|
}, []);
|
|
26740
27008
|
const { animation, navigateTo } = useAnimatedNavigation(changeStep);
|
|
26741
|
-
const handleBackToSignIn =
|
|
27009
|
+
const handleBackToSignIn = useCallback45(
|
|
26742
27010
|
(type) => {
|
|
26743
27011
|
const isPrimary = !hasSecondarySignIn || type === prioritizedLoginType;
|
|
26744
27012
|
navigateTo(
|
|
@@ -26749,7 +27017,7 @@ function FunConnectOptions({
|
|
|
26749
27017
|
[navigateTo, hasSecondarySignIn, prioritizedLoginType]
|
|
26750
27018
|
);
|
|
26751
27019
|
const walletConnectors = usePreparedWalletConnectors();
|
|
26752
|
-
const onRegenerateQrCode =
|
|
27020
|
+
const onRegenerateQrCode = useCallback45(
|
|
26753
27021
|
async (wallet) => {
|
|
26754
27022
|
const sWallet = walletConnectors.find((w) => wallet.id === w.id);
|
|
26755
27023
|
const uri = await sWallet?.getQrCodeUri?.();
|
|
@@ -26757,7 +27025,7 @@ function FunConnectOptions({
|
|
|
26757
27025
|
},
|
|
26758
27026
|
[walletConnectors]
|
|
26759
27027
|
);
|
|
26760
|
-
const connectToWallet =
|
|
27028
|
+
const connectToWallet = useCallback45(
|
|
26761
27029
|
async (wallet) => {
|
|
26762
27030
|
if (!wallet.ready) {
|
|
26763
27031
|
return;
|
|
@@ -26776,7 +27044,7 @@ function FunConnectOptions({
|
|
|
26776
27044
|
},
|
|
26777
27045
|
[changeStep, onRegenerateQrCode]
|
|
26778
27046
|
);
|
|
26779
|
-
const handleRetry =
|
|
27047
|
+
const handleRetry = useCallback45(() => {
|
|
26780
27048
|
if (!selectedWallet || selectedWallet.id === FUNKIT_CONNECT_WALLET_ID) {
|
|
26781
27049
|
handleBackToSignIn("web2");
|
|
26782
27050
|
} else {
|
|
@@ -27035,7 +27303,7 @@ function FunSignInStep({
|
|
|
27035
27303
|
changeStep(3 /* PENDING_WALLET */);
|
|
27036
27304
|
}
|
|
27037
27305
|
};
|
|
27038
|
-
const handleEmailSubmit =
|
|
27306
|
+
const handleEmailSubmit = useCallback46(async () => {
|
|
27039
27307
|
if (!isEmailInputValid) {
|
|
27040
27308
|
return;
|
|
27041
27309
|
}
|
|
@@ -27320,7 +27588,7 @@ var PaymentRouteSummary = ({
|
|
|
27320
27588
|
isWithdrawal
|
|
27321
27589
|
}
|
|
27322
27590
|
);
|
|
27323
|
-
const destinationComponent = customDestinationConfig && /* @__PURE__ */ React195.createElement(
|
|
27591
|
+
const destinationComponent = (!isSameDestination || customDestinationConfig) && /* @__PURE__ */ React195.createElement(
|
|
27324
27592
|
PaymentDestination,
|
|
27325
27593
|
{
|
|
27326
27594
|
destinationConfig: customDestinationConfig,
|
|
@@ -27330,7 +27598,7 @@ var PaymentRouteSummary = ({
|
|
|
27330
27598
|
}
|
|
27331
27599
|
);
|
|
27332
27600
|
const [firstComponent, secondComponent] = isWithdrawal ? [destinationComponent, sourceComponent] : [sourceComponent, destinationComponent];
|
|
27333
|
-
return /* @__PURE__ */ React195.createElement(React195.Fragment, null, firstComponent, firstComponent && secondComponent &&
|
|
27601
|
+
return /* @__PURE__ */ React195.createElement(React195.Fragment, null, firstComponent, firstComponent && secondComponent && /* @__PURE__ */ React195.createElement(FunDivider, { marginTop: "12", marginBottom: "12" }), secondComponent);
|
|
27334
27602
|
};
|
|
27335
27603
|
var PaymentRouteSummarySkeletonLoader = () => /* @__PURE__ */ React195.createElement(
|
|
27336
27604
|
Box,
|
|
@@ -27374,7 +27642,7 @@ function PaymentMethodSummary({
|
|
|
27374
27642
|
|
|
27375
27643
|
// src/modals/CheckoutModal/TransferToken/CheckoutNotifications.tsx
|
|
27376
27644
|
import clsx21 from "clsx";
|
|
27377
|
-
import React202, { useEffect as
|
|
27645
|
+
import React202, { useCallback as useCallback48, useEffect as useEffect52, useMemo as useMemo39, useState as useState64 } from "react";
|
|
27378
27646
|
|
|
27379
27647
|
// src/components/FunNotificationBanner/FunNotificationShowMoreButton.tsx
|
|
27380
27648
|
import React197 from "react";
|
|
@@ -27503,6 +27771,53 @@ var useRecentDirectExecutions = ({
|
|
|
27503
27771
|
return query;
|
|
27504
27772
|
};
|
|
27505
27773
|
|
|
27774
|
+
// src/hooks/useOnNewNotification.ts
|
|
27775
|
+
import { safeParseJson as safeParseJson8 } from "@funkit/utils";
|
|
27776
|
+
import { useEffect as useEffect50 } from "react";
|
|
27777
|
+
var storageKey5 = "fkc-processed-notifications";
|
|
27778
|
+
var useOnNewNotification = (combinedNotifications, cb) => {
|
|
27779
|
+
useEffect50(() => {
|
|
27780
|
+
const alreadyProcessed = safeParseJsonObject(
|
|
27781
|
+
sessionStorage.getItem(storageKey5)
|
|
27782
|
+
);
|
|
27783
|
+
for (const item of combinedNotifications) {
|
|
27784
|
+
const uniqueId = getUniqueId(item);
|
|
27785
|
+
if (uniqueId in alreadyProcessed) {
|
|
27786
|
+
continue;
|
|
27787
|
+
}
|
|
27788
|
+
try {
|
|
27789
|
+
cb(item);
|
|
27790
|
+
sessionStorage.setItem(
|
|
27791
|
+
storageKey5,
|
|
27792
|
+
JSON.stringify({ ...alreadyProcessed, [uniqueId]: 1 })
|
|
27793
|
+
);
|
|
27794
|
+
} catch (e) {
|
|
27795
|
+
logger.error("useOnNewNotification", e);
|
|
27796
|
+
}
|
|
27797
|
+
}
|
|
27798
|
+
}, [combinedNotifications, cb]);
|
|
27799
|
+
};
|
|
27800
|
+
function isPlainObject(value) {
|
|
27801
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
27802
|
+
}
|
|
27803
|
+
function safeParseJsonObject(src) {
|
|
27804
|
+
try {
|
|
27805
|
+
const value = src ? safeParseJson8(src) : {};
|
|
27806
|
+
if (!isPlainObject(value)) {
|
|
27807
|
+
return {};
|
|
27808
|
+
}
|
|
27809
|
+
return value;
|
|
27810
|
+
} catch {
|
|
27811
|
+
return {};
|
|
27812
|
+
}
|
|
27813
|
+
}
|
|
27814
|
+
var getUniqueId = (item) => {
|
|
27815
|
+
if (item.isDirectExecution) {
|
|
27816
|
+
return `de-${item.txHash}`;
|
|
27817
|
+
}
|
|
27818
|
+
return `checkout-${item.createdTimeMs}-${item.salt}`;
|
|
27819
|
+
};
|
|
27820
|
+
|
|
27506
27821
|
// src/modals/CheckoutModal/TransferToken/CheckoutNotification.tsx
|
|
27507
27822
|
import React200 from "react";
|
|
27508
27823
|
|
|
@@ -27518,7 +27833,7 @@ var showMoreButtonStyle = "_4yitd93 _1rsrm2f12a _1rsrm2f1f _1rsrm2f1c _1rsrm2fls
|
|
|
27518
27833
|
// src/components/FunNotificationBanner/FunNotificationBannerIcon.tsx
|
|
27519
27834
|
import clsx19 from "clsx";
|
|
27520
27835
|
import { motion as motion12, useAnimate as useAnimate3 } from "motion/react";
|
|
27521
|
-
import React198, { useCallback as
|
|
27836
|
+
import React198, { useCallback as useCallback47, useEffect as useEffect51, useRef as useRef25 } from "react";
|
|
27522
27837
|
|
|
27523
27838
|
// src/components/FunNotificationBanner/FunNotificationBannerIcon.css.ts
|
|
27524
27839
|
var STATUS_SPINNER_BOTTOM_POSITION = -5;
|
|
@@ -27767,7 +28082,7 @@ var FunNotificationBannerIcon = ({
|
|
|
27767
28082
|
fallbackIconUrl = FALLBACK_ASSET
|
|
27768
28083
|
}) => {
|
|
27769
28084
|
const [animationScope, animate] = useAnimate3();
|
|
27770
|
-
const triggerAnimationProcessingToCompleted =
|
|
28085
|
+
const triggerAnimationProcessingToCompleted = useCallback47(async () => {
|
|
27771
28086
|
const completedIconPath = document.querySelector(
|
|
27772
28087
|
`.${generateAnimationPrefixClassName("icon-wrapper-completed")} path`
|
|
27773
28088
|
);
|
|
@@ -27874,7 +28189,7 @@ var FunNotificationBannerIcon = ({
|
|
|
27874
28189
|
)
|
|
27875
28190
|
]);
|
|
27876
28191
|
}, [animate]);
|
|
27877
|
-
const triggerAnimationDelayedToFailed =
|
|
28192
|
+
const triggerAnimationDelayedToFailed = useCallback47(async () => {
|
|
27878
28193
|
await Promise.all([
|
|
27879
28194
|
animate(
|
|
27880
28195
|
`.${generateAnimationPrefixClassName("icon-wrapper")}`,
|
|
@@ -27968,7 +28283,7 @@ var FunNotificationBannerIcon = ({
|
|
|
27968
28283
|
]);
|
|
27969
28284
|
}, [animate]);
|
|
27970
28285
|
const statusRef = useRef25(status);
|
|
27971
|
-
|
|
28286
|
+
useEffect51(() => {
|
|
27972
28287
|
if (statusRef.current !== status) {
|
|
27973
28288
|
if (statusRef.current === "processing" && status === "completed") {
|
|
27974
28289
|
triggerAnimationProcessingToCompleted();
|
|
@@ -28314,6 +28629,69 @@ var parseDisclaimer = (checkout, onHelp2) => {
|
|
|
28314
28629
|
}
|
|
28315
28630
|
};
|
|
28316
28631
|
|
|
28632
|
+
// src/modals/CheckoutModal/TransferToken/CheckoutNotifications.track.ts
|
|
28633
|
+
var cleanupNotificationItem = (item) => {
|
|
28634
|
+
if (item.isDirectExecution) {
|
|
28635
|
+
return {
|
|
28636
|
+
isDirectExecution: true,
|
|
28637
|
+
createdTimeMs: item.createdTimeMs,
|
|
28638
|
+
customerId: item.customerId,
|
|
28639
|
+
estTotalUsd: item.estTotalUsd,
|
|
28640
|
+
fromAmountBaseUnit: item.fromAmountBaseUnit,
|
|
28641
|
+
fromChainId: item.fromChainId,
|
|
28642
|
+
fromTokenAddress: item.fromTokenAddress,
|
|
28643
|
+
toAmountBaseUnit: item.toAmountBaseUnit,
|
|
28644
|
+
toChainId: item.toChainId,
|
|
28645
|
+
toTokenAddress: item.toTokenAddress,
|
|
28646
|
+
type: item.type,
|
|
28647
|
+
userId: item.userId,
|
|
28648
|
+
recipientAddr: item.recipientAddr,
|
|
28649
|
+
sourceOfFund: item.sourceOfFund,
|
|
28650
|
+
txHash: item.txHash,
|
|
28651
|
+
isIntermediaryPhase: item.isIntermediaryPhase,
|
|
28652
|
+
toTxId: item.toTxId,
|
|
28653
|
+
triggeringTxHash: item.triggeringTxHash,
|
|
28654
|
+
updatedTimeMs: item.updatedTimeMs
|
|
28655
|
+
};
|
|
28656
|
+
}
|
|
28657
|
+
return {
|
|
28658
|
+
isDirectExecution: false,
|
|
28659
|
+
createdTimeMs: item.createdTimeMs,
|
|
28660
|
+
depositAddr: item.depositAddr,
|
|
28661
|
+
currentDepositAddr: item.currentDepositAddr,
|
|
28662
|
+
recipientAddr: item.recipientAddr,
|
|
28663
|
+
expirationTimestampSeconds: item.expirationTimestampSeconds,
|
|
28664
|
+
fromAmountBaseUnit: item.fromAmountBaseUnit,
|
|
28665
|
+
fromChainId: item.fromChainId,
|
|
28666
|
+
fromTokenAddress: item.fromTokenAddress,
|
|
28667
|
+
funWalletAddr: item.funWalletAddr,
|
|
28668
|
+
lastUpdatedTimeMs: item.lastUpdatedTimeMs,
|
|
28669
|
+
salt: item.salt,
|
|
28670
|
+
state: item.state,
|
|
28671
|
+
toAmountBaseUnit: item.toAmountBaseUnit,
|
|
28672
|
+
toChainId: item.toChainId,
|
|
28673
|
+
toTokenAddress: item.toTokenAddress,
|
|
28674
|
+
sourceOfFund: item.sourceOfFund,
|
|
28675
|
+
userOp: item.userOp,
|
|
28676
|
+
version: item.version,
|
|
28677
|
+
stateTimestampMs: item.stateTimestampMs,
|
|
28678
|
+
refundState: item.refundState
|
|
28679
|
+
};
|
|
28680
|
+
};
|
|
28681
|
+
var trackEventFromNotification = (item) => {
|
|
28682
|
+
const metadata = cleanupNotificationItem(item);
|
|
28683
|
+
if (item.isDirectExecution && isWithdrawalDirectExecution(item)) {
|
|
28684
|
+
return {
|
|
28685
|
+
eventName: "fc::success::withdrawal" /* WITHDRAWAL_SUCCESS */,
|
|
28686
|
+
metadata
|
|
28687
|
+
};
|
|
28688
|
+
}
|
|
28689
|
+
return {
|
|
28690
|
+
eventName: "fc::success::token_transfer" /* TOKEN_TRANSFER_SUCCESS */,
|
|
28691
|
+
metadata
|
|
28692
|
+
};
|
|
28693
|
+
};
|
|
28694
|
+
|
|
28317
28695
|
// src/modals/CheckoutModal/TransferToken/DirectExecutionNotification.tsx
|
|
28318
28696
|
import React201 from "react";
|
|
28319
28697
|
var mapDirectExecutionStateToNotificationStatus = (isProcessing, isDelayed2, isRefunded, isCompleted, isFailed) => {
|
|
@@ -28453,13 +28831,13 @@ var CheckoutNotifications = ({
|
|
|
28453
28831
|
withdrawal: isWithdrawalDirectExecution
|
|
28454
28832
|
}[variant]
|
|
28455
28833
|
});
|
|
28456
|
-
|
|
28834
|
+
useEffect52(() => {
|
|
28457
28835
|
if (initialCheckouts || !checkouts) {
|
|
28458
28836
|
return;
|
|
28459
28837
|
}
|
|
28460
28838
|
setInitialCheckouts(checkouts);
|
|
28461
28839
|
}, [initialCheckouts, checkouts]);
|
|
28462
|
-
|
|
28840
|
+
useEffect52(() => {
|
|
28463
28841
|
if (initialDirectExecutions || !directExecutions) {
|
|
28464
28842
|
return;
|
|
28465
28843
|
}
|
|
@@ -28491,6 +28869,15 @@ var CheckoutNotifications = ({
|
|
|
28491
28869
|
return isExpanded ? combinedNotifications : combinedNotifications.slice(0, COLLAPSED_COUNT);
|
|
28492
28870
|
}, [isExpanded, combinedNotifications]);
|
|
28493
28871
|
const handleNotificationClose = (id) => setClosedNotifications((prev) => [...prev, id]);
|
|
28872
|
+
const { logEvent } = useTrack();
|
|
28873
|
+
const handleNewNotification = useCallback48(
|
|
28874
|
+
(item) => {
|
|
28875
|
+
const trackEvent = trackEventFromNotification(item);
|
|
28876
|
+
logEvent(trackEvent);
|
|
28877
|
+
},
|
|
28878
|
+
[logEvent]
|
|
28879
|
+
);
|
|
28880
|
+
useOnNewNotification(combinedNotifications, handleNewNotification);
|
|
28494
28881
|
if (!isVisible) {
|
|
28495
28882
|
return null;
|
|
28496
28883
|
}
|
|
@@ -28764,7 +29151,7 @@ import React218 from "react";
|
|
|
28764
29151
|
// src/modals/ProfileDetails/ActivityTraversalContext.tsx
|
|
28765
29152
|
import React206, {
|
|
28766
29153
|
createContext as createContext15,
|
|
28767
|
-
useCallback as
|
|
29154
|
+
useCallback as useCallback49,
|
|
28768
29155
|
useContext as useContext15,
|
|
28769
29156
|
useState as useState66
|
|
28770
29157
|
} from "react";
|
|
@@ -28785,7 +29172,7 @@ var ActivityTraversalProvider = ({
|
|
|
28785
29172
|
const [returnViewPresets, setReturnViewPresets] = useState66(
|
|
28786
29173
|
{}
|
|
28787
29174
|
);
|
|
28788
|
-
const onSelectActivity =
|
|
29175
|
+
const onSelectActivity = useCallback49(
|
|
28789
29176
|
({
|
|
28790
29177
|
checkoutId,
|
|
28791
29178
|
initialPage,
|
|
@@ -28803,7 +29190,7 @@ var ActivityTraversalProvider = ({
|
|
|
28803
29190
|
},
|
|
28804
29191
|
[]
|
|
28805
29192
|
);
|
|
28806
|
-
const resetActivityTraversal =
|
|
29193
|
+
const resetActivityTraversal = useCallback49(() => {
|
|
28807
29194
|
setSelectedPurchaseId(void 0);
|
|
28808
29195
|
setSelectedPurchaseInitView(void 0);
|
|
28809
29196
|
setReturnView(void 0);
|
|
@@ -28823,7 +29210,7 @@ var useActivityTraversal = () => {
|
|
|
28823
29210
|
};
|
|
28824
29211
|
|
|
28825
29212
|
// src/modals/ProfileDetails/ProfileDetails.tsx
|
|
28826
|
-
import React217, { useCallback as
|
|
29213
|
+
import React217, { useCallback as useCallback51, useState as useState69 } from "react";
|
|
28827
29214
|
|
|
28828
29215
|
// src/hooks/useCheckoutModalTitle.ts
|
|
28829
29216
|
function useCheckoutModalTitle(depositAddress, defaultTitle) {
|
|
@@ -28837,7 +29224,7 @@ function useCheckoutModalTitle(depositAddress, defaultTitle) {
|
|
|
28837
29224
|
import { IN_PROGRESS_CHECKOUT_STATES as IN_PROGRESS_CHECKOUT_STATES2 } from "@funkit/api-base";
|
|
28838
29225
|
import { formatTimestampToDate, fullMonthNames } from "@funkit/utils";
|
|
28839
29226
|
import clsx23 from "clsx";
|
|
28840
|
-
import React215, { useEffect as
|
|
29227
|
+
import React215, { useEffect as useEffect53, useMemo as useMemo40, useRef as useRef26, useState as useState68 } from "react";
|
|
28841
29228
|
import { Virtuoso } from "react-virtuoso";
|
|
28842
29229
|
import { useAccount as useAccount7 } from "wagmi";
|
|
28843
29230
|
|
|
@@ -29211,7 +29598,7 @@ var HomeTokenBalanceDisplayRowSkeleton = () => {
|
|
|
29211
29598
|
|
|
29212
29599
|
// src/modals/ProfileDetails/FunProfileViews/Home/ProfileTitleSection.tsx
|
|
29213
29600
|
import React214 from "react";
|
|
29214
|
-
import { useCallback as
|
|
29601
|
+
import { useCallback as useCallback50, useState as useState67 } from "react";
|
|
29215
29602
|
|
|
29216
29603
|
// src/components/Icons/LogoutIcon.tsx
|
|
29217
29604
|
import React212 from "react";
|
|
@@ -29278,7 +29665,7 @@ var ProfileTitleSection = ({
|
|
|
29278
29665
|
onClose
|
|
29279
29666
|
}) => {
|
|
29280
29667
|
const [isDisconnectExpanded, setIsDisconnectExpanded] = useState67(false);
|
|
29281
|
-
const collapseDisconnect =
|
|
29668
|
+
const collapseDisconnect = useCallback50(
|
|
29282
29669
|
() => setIsDisconnectExpanded(false),
|
|
29283
29670
|
[]
|
|
29284
29671
|
);
|
|
@@ -29380,7 +29767,7 @@ function Home({
|
|
|
29380
29767
|
const { checkoutHistoryList, isCheckoutHistoryInited } = useCheckoutHistoryContext();
|
|
29381
29768
|
const { returnViewPresets } = useActivityTraversal();
|
|
29382
29769
|
const { animation: tabAnimation, navigateTo } = useAnimatedNavigation(setSelectedView);
|
|
29383
|
-
|
|
29770
|
+
useEffect53(() => {
|
|
29384
29771
|
const virtuosoDiv = virtuosoParentRef.current?.firstChild;
|
|
29385
29772
|
virtuosoDiv?.classList.add(animateVirtuosoInClass);
|
|
29386
29773
|
}, []);
|
|
@@ -29634,13 +30021,13 @@ function ProfileDetails({ onClose, defaultTab }) {
|
|
|
29634
30021
|
const [singleActivityPage, setSingleActivityPage] = useState69(
|
|
29635
30022
|
selectedPurchaseInitView ?? "detail" /* DETAIL */
|
|
29636
30023
|
);
|
|
29637
|
-
const resetView =
|
|
30024
|
+
const resetView = useCallback51(() => {
|
|
29638
30025
|
setView(returnView ?? 0 /* HOME */);
|
|
29639
30026
|
setSelectedHomeTab("checkouts" /* CHECKOUTS */);
|
|
29640
30027
|
resetActivityTraversal();
|
|
29641
30028
|
}, [resetActivityTraversal, returnView]);
|
|
29642
30029
|
const { animation, animate } = useAnimatedNavigation(void 0);
|
|
29643
|
-
const onSelectActivityWrapper =
|
|
30030
|
+
const onSelectActivityWrapper = useCallback51(
|
|
29644
30031
|
(activity) => {
|
|
29645
30032
|
onSelectActivity({
|
|
29646
30033
|
...activity,
|
|
@@ -29677,7 +30064,7 @@ function ProfileDetails({ onClose, defaultTab }) {
|
|
|
29677
30064
|
const isHelpPage = singleActivityPage === "help" /* HELP */;
|
|
29678
30065
|
const isCheckoutDetailView = isSingleActivityView && singleActivityPage === "detail" /* DETAIL */;
|
|
29679
30066
|
const withDivider = isSingleActivityView ? isHelpPage ? "scroll" : "always" : void 0;
|
|
29680
|
-
const handleHelp =
|
|
30067
|
+
const handleHelp = useCallback51(() => {
|
|
29681
30068
|
animate(() => setSingleActivityPage("help" /* HELP */));
|
|
29682
30069
|
}, [animate]);
|
|
29683
30070
|
const { onScroll, topbar, withTopDivider } = useCustomStatusAnimationAboveTopbar({
|
|
@@ -30288,16 +30675,16 @@ function ConnectModal({
|
|
|
30288
30675
|
function useModalStateValue() {
|
|
30289
30676
|
const [isModalOpen, setModalOpen] = useState70(false);
|
|
30290
30677
|
return {
|
|
30291
|
-
closeModal:
|
|
30678
|
+
closeModal: useCallback52(() => setModalOpen(false), []),
|
|
30292
30679
|
isModalOpen,
|
|
30293
|
-
openModal:
|
|
30680
|
+
openModal: useCallback52(() => setModalOpen(true), [])
|
|
30294
30681
|
};
|
|
30295
30682
|
}
|
|
30296
30683
|
function useModalStateValueWithProp() {
|
|
30297
30684
|
const [isModalOpen, setModalOpen] = useState70(false);
|
|
30298
30685
|
const [prop, setProp] = useState70(null);
|
|
30299
30686
|
return {
|
|
30300
|
-
closeModal:
|
|
30687
|
+
closeModal: useCallback52(() => {
|
|
30301
30688
|
setTimeout(
|
|
30302
30689
|
() => {
|
|
30303
30690
|
setProp(null);
|
|
@@ -30308,7 +30695,7 @@ function useModalStateValueWithProp() {
|
|
|
30308
30695
|
}, []),
|
|
30309
30696
|
isModalOpen,
|
|
30310
30697
|
prop,
|
|
30311
|
-
openModal:
|
|
30698
|
+
openModal: useCallback52((prop2) => {
|
|
30312
30699
|
if (prop2 != null) {
|
|
30313
30700
|
setProp(prop2);
|
|
30314
30701
|
}
|
|
@@ -30371,7 +30758,7 @@ function ModalProvider({ children }) {
|
|
|
30371
30758
|
onConnect: () => closeModals(isUnauthenticated),
|
|
30372
30759
|
onDisconnect: closeModals
|
|
30373
30760
|
});
|
|
30374
|
-
|
|
30761
|
+
useEffect54(() => {
|
|
30375
30762
|
if (isUnauthenticated) {
|
|
30376
30763
|
closeModals();
|
|
30377
30764
|
}
|
|
@@ -30476,7 +30863,7 @@ function useConnectModal(onClose) {
|
|
|
30476
30863
|
const { connectModalOpen, openConnectModal } = useContext16(ModalContext);
|
|
30477
30864
|
const { isWalletConnectModalOpen } = useWalletConnectOpenState();
|
|
30478
30865
|
const effectiveConnectModalOpen = connectModalOpen || isWalletConnectModalOpen;
|
|
30479
|
-
|
|
30866
|
+
useEffect54(() => {
|
|
30480
30867
|
if (!effectiveConnectModalOpen && onClose) {
|
|
30481
30868
|
onClose();
|
|
30482
30869
|
}
|
|
@@ -30584,16 +30971,16 @@ var connectorsWithRecentWallets = ({
|
|
|
30584
30971
|
|
|
30585
30972
|
// src/wallets/recentWalletIds.ts
|
|
30586
30973
|
import { safeParseJsonArray } from "@funkit/utils";
|
|
30587
|
-
var
|
|
30974
|
+
var storageKey6 = "fkc-recent";
|
|
30588
30975
|
function getRecentWalletIds() {
|
|
30589
|
-
return typeof localStorage !== "undefined" ? safeParseJsonArray(localStorage.getItem(
|
|
30976
|
+
return typeof localStorage !== "undefined" ? safeParseJsonArray(localStorage.getItem(storageKey6)) : [];
|
|
30590
30977
|
}
|
|
30591
30978
|
function dedupe(array) {
|
|
30592
30979
|
return [...new Set(array)];
|
|
30593
30980
|
}
|
|
30594
30981
|
function addRecentWalletId(walletId) {
|
|
30595
30982
|
const newValue = dedupe([walletId, ...getRecentWalletIds()]);
|
|
30596
|
-
localStorage.setItem(
|
|
30983
|
+
localStorage.setItem(storageKey6, JSON.stringify(newValue));
|
|
30597
30984
|
}
|
|
30598
30985
|
|
|
30599
30986
|
// src/wallets/useWalletConnectors.ts
|
|
@@ -30796,7 +31183,7 @@ var FunkitWeb2Provider = ({
|
|
|
30796
31183
|
const [isLoggingIn, setIsLoggingIn] = useState71(false);
|
|
30797
31184
|
const [loginErrorMessage, setLoginErrorMessage] = useState71("");
|
|
30798
31185
|
const [loggedInUser, setLoggedInUser] = useState71(null);
|
|
30799
|
-
const setLoginMethodAndCache =
|
|
31186
|
+
const setLoginMethodAndCache = useCallback53(
|
|
30800
31187
|
(method) => {
|
|
30801
31188
|
try {
|
|
30802
31189
|
setLoginMethod(method);
|
|
@@ -30811,7 +31198,7 @@ var FunkitWeb2Provider = ({
|
|
|
30811
31198
|
},
|
|
30812
31199
|
[]
|
|
30813
31200
|
);
|
|
30814
|
-
|
|
31201
|
+
useEffect55(() => {
|
|
30815
31202
|
const newPrivy = new PrivyJS({
|
|
30816
31203
|
appId: DEFAULT_PRIVY_APP_ID,
|
|
30817
31204
|
storage: new LocalStorage(),
|
|
@@ -30820,7 +31207,7 @@ var FunkitWeb2Provider = ({
|
|
|
30820
31207
|
setPrivyIframeUrl(newPrivy.embeddedWallet.getURL());
|
|
30821
31208
|
setPrivy(newPrivy);
|
|
30822
31209
|
}, [chains]);
|
|
30823
|
-
const handleIframeMessage =
|
|
31210
|
+
const handleIframeMessage = useCallback53(
|
|
30824
31211
|
(e) => {
|
|
30825
31212
|
if (e.origin === PRIVY_AUTH_URL && privy) {
|
|
30826
31213
|
const iframeHandler = privy.embeddedWallet.getMessageHandler();
|
|
@@ -30829,7 +31216,7 @@ var FunkitWeb2Provider = ({
|
|
|
30829
31216
|
},
|
|
30830
31217
|
[privy]
|
|
30831
31218
|
);
|
|
30832
|
-
const handleFunkitWeb2Logout =
|
|
31219
|
+
const handleFunkitWeb2Logout = useCallback53(async () => {
|
|
30833
31220
|
if (privy) {
|
|
30834
31221
|
logger.log("handleFunkitWeb2Logout_disconnecting_connectors", {
|
|
30835
31222
|
numConnectors: connectors.length
|
|
@@ -30842,7 +31229,7 @@ var FunkitWeb2Provider = ({
|
|
|
30842
31229
|
setLoginMethodAndCache(null);
|
|
30843
31230
|
}
|
|
30844
31231
|
}, [connectors, disconnectAsync, privy, setLoginMethodAndCache]);
|
|
30845
|
-
const handleFreshPrivyLogin =
|
|
31232
|
+
const handleFreshPrivyLogin = useCallback53(
|
|
30846
31233
|
async ({
|
|
30847
31234
|
firstLoginCode,
|
|
30848
31235
|
secondLoginCode,
|
|
@@ -30894,7 +31281,7 @@ var FunkitWeb2Provider = ({
|
|
|
30894
31281
|
},
|
|
30895
31282
|
[handleFunkitWeb2Logout, privy]
|
|
30896
31283
|
);
|
|
30897
|
-
const getPrivyUserEmbeddedWallet =
|
|
31284
|
+
const getPrivyUserEmbeddedWallet = useCallback53(
|
|
30898
31285
|
async (inputPrivyUser) => {
|
|
30899
31286
|
try {
|
|
30900
31287
|
if (!privy || !inputPrivyUser) {
|
|
@@ -30913,7 +31300,7 @@ var FunkitWeb2Provider = ({
|
|
|
30913
31300
|
},
|
|
30914
31301
|
[privy]
|
|
30915
31302
|
);
|
|
30916
|
-
const getExistingPrivySession =
|
|
31303
|
+
const getExistingPrivySession = useCallback53(async () => {
|
|
30917
31304
|
try {
|
|
30918
31305
|
if (!privy) {
|
|
30919
31306
|
throw new Error(ERROR_MESSAGES2.PRIVY_NOT_INITIALIZED);
|
|
@@ -30924,7 +31311,7 @@ var FunkitWeb2Provider = ({
|
|
|
30924
31311
|
return null;
|
|
30925
31312
|
}
|
|
30926
31313
|
}, [privy]);
|
|
30927
|
-
const handleFunkitWeb2Login =
|
|
31314
|
+
const handleFunkitWeb2Login = useCallback53(
|
|
30928
31315
|
async ({
|
|
30929
31316
|
chainId,
|
|
30930
31317
|
firstLoginCode,
|
|
@@ -31001,9 +31388,9 @@ var FunkitWeb2Provider = ({
|
|
|
31001
31388
|
wallets
|
|
31002
31389
|
]
|
|
31003
31390
|
);
|
|
31004
|
-
const clearLoginError =
|
|
31391
|
+
const clearLoginError = useCallback53(() => setLoginErrorMessage(""), []);
|
|
31005
31392
|
const initChainId = useInitialChainId();
|
|
31006
|
-
const handleAutoLoginFlows =
|
|
31393
|
+
const handleAutoLoginFlows = useCallback53(async () => {
|
|
31007
31394
|
if (isNotNullish11(loginMethod) && isNotNullish11(initChainId)) {
|
|
31008
31395
|
const queryParams = new URLSearchParams(window.location.search);
|
|
31009
31396
|
const oauthCode = queryParams.get(PRIVY_OAUTH_CODE_URL_PARAM);
|
|
@@ -31026,7 +31413,7 @@ var FunkitWeb2Provider = ({
|
|
|
31026
31413
|
}
|
|
31027
31414
|
}
|
|
31028
31415
|
}, [handleFunkitWeb2Login, initChainId, loginMethod]);
|
|
31029
|
-
|
|
31416
|
+
useEffect55(() => {
|
|
31030
31417
|
if (privy && privyIframeUrl && isNotNullish11(initChainId)) {
|
|
31031
31418
|
const iframe = document.getElementById(
|
|
31032
31419
|
PRIVY_IFRAME_ID
|
|
@@ -31047,7 +31434,7 @@ var FunkitWeb2Provider = ({
|
|
|
31047
31434
|
initChainId
|
|
31048
31435
|
// Do not include `handleAutoLoginFlows`,
|
|
31049
31436
|
]);
|
|
31050
|
-
const handleOauthRedirect =
|
|
31437
|
+
const handleOauthRedirect = useCallback53(
|
|
31051
31438
|
async (authProvider) => {
|
|
31052
31439
|
if (!privy) {
|
|
31053
31440
|
throw new Error(ERROR_MESSAGES2.PRIVY_NOT_INITIALIZED);
|
|
@@ -31073,7 +31460,7 @@ var FunkitWeb2Provider = ({
|
|
|
31073
31460
|
[privy, setLoginMethodAndCache]
|
|
31074
31461
|
);
|
|
31075
31462
|
const [isSendingOtpEmail, setIsSendingOtpEmail] = useState71(false);
|
|
31076
|
-
const handleSendOtpEmail =
|
|
31463
|
+
const handleSendOtpEmail = useCallback53(
|
|
31077
31464
|
async (emailAddress) => {
|
|
31078
31465
|
try {
|
|
31079
31466
|
if (!privy) {
|
|
@@ -31101,7 +31488,7 @@ var FunkitWeb2Provider = ({
|
|
|
31101
31488
|
[privy, setLoginMethodAndCache]
|
|
31102
31489
|
);
|
|
31103
31490
|
const [isGeneratingFcUri, setIsGeneratingFcUri] = useState71(false);
|
|
31104
|
-
const handleGenerateFcUri =
|
|
31491
|
+
const handleGenerateFcUri = useCallback53(async () => {
|
|
31105
31492
|
try {
|
|
31106
31493
|
if (!privy) {
|
|
31107
31494
|
throw new Error(ERROR_MESSAGES2.PRIVY_NOT_INITIALIZED);
|
|
@@ -31128,7 +31515,7 @@ var FunkitWeb2Provider = ({
|
|
|
31128
31515
|
setIsGeneratingFcUri(false);
|
|
31129
31516
|
}
|
|
31130
31517
|
}, [privy]);
|
|
31131
|
-
const getFcConnectionStatus =
|
|
31518
|
+
const getFcConnectionStatus = useCallback53(
|
|
31132
31519
|
async (channelToken) => {
|
|
31133
31520
|
try {
|
|
31134
31521
|
if (!privy) {
|
|
@@ -31275,16 +31662,16 @@ import React230 from "react";
|
|
|
31275
31662
|
import { useAccount as useAccount12, useBalance, useConfig as useConfig8 } from "wagmi";
|
|
31276
31663
|
|
|
31277
31664
|
// src/hooks/useIsMounted.ts
|
|
31278
|
-
import { useCallback as
|
|
31665
|
+
import { useCallback as useCallback54, useEffect as useEffect56, useState as useState73 } from "react";
|
|
31279
31666
|
function useIsMounted() {
|
|
31280
31667
|
const [isMounted, setIsMounted] = useState73(false);
|
|
31281
|
-
|
|
31668
|
+
useEffect56(() => {
|
|
31282
31669
|
setIsMounted(true);
|
|
31283
31670
|
return () => {
|
|
31284
31671
|
setIsMounted(false);
|
|
31285
31672
|
};
|
|
31286
31673
|
}, []);
|
|
31287
|
-
return
|
|
31674
|
+
return useCallback54(() => isMounted, [isMounted]);
|
|
31288
31675
|
}
|
|
31289
31676
|
|
|
31290
31677
|
// src/components/ConnectButton/abbreviateETHBalance.ts
|
|
@@ -31565,7 +31952,7 @@ function ConnectButton({
|
|
|
31565
31952
|
const connectionStatus = useConnectionStatus();
|
|
31566
31953
|
const { setShowBalance } = useShowBalance();
|
|
31567
31954
|
const [ready, setReady] = useState74(false);
|
|
31568
|
-
|
|
31955
|
+
useEffect57(() => {
|
|
31569
31956
|
setShowBalance(showBalance);
|
|
31570
31957
|
if (!ready) {
|
|
31571
31958
|
setReady(true);
|
|
@@ -32124,40 +32511,53 @@ var useUpdateActiveFunkitCheckout = () => {
|
|
|
32124
32511
|
|
|
32125
32512
|
// src/providers/FunkitProvider.tsx
|
|
32126
32513
|
import { QueryClientProvider } from "@tanstack/react-query";
|
|
32127
|
-
import
|
|
32514
|
+
import React235, { createContext as createContext19, useContext as useContext19 } from "react";
|
|
32128
32515
|
import { WagmiProvider, useAccountEffect as useAccountEffect3 } from "wagmi";
|
|
32129
32516
|
|
|
32130
|
-
// src/providers/
|
|
32131
|
-
import {
|
|
32132
|
-
|
|
32133
|
-
|
|
32134
|
-
|
|
32135
|
-
}
|
|
32136
|
-
|
|
32137
|
-
|
|
32138
|
-
|
|
32139
|
-
function
|
|
32140
|
-
|
|
32141
|
-
|
|
32142
|
-
|
|
32143
|
-
|
|
32144
|
-
|
|
32145
|
-
|
|
32517
|
+
// src/providers/FunkitStatsigProvider.tsx
|
|
32518
|
+
import {
|
|
32519
|
+
LogEventCompressionMode,
|
|
32520
|
+
StatsigProvider,
|
|
32521
|
+
useClientAsyncInit
|
|
32522
|
+
} from "@statsig/react-bindings";
|
|
32523
|
+
import React234 from "react";
|
|
32524
|
+
var STATSIG_API = "https://data-api.fun.xyz/v1";
|
|
32525
|
+
var STATSIG_CLIENT_KEY = "client-UmFd8WIJljA7cLmZuDqs3X25M8sKd5WIQP4BSC2bRbM";
|
|
32526
|
+
function FunkitStatsigProvider({
|
|
32527
|
+
children,
|
|
32528
|
+
isDevelopment = false
|
|
32529
|
+
}) {
|
|
32530
|
+
const { client } = useClientAsyncInit(
|
|
32531
|
+
STATSIG_CLIENT_KEY,
|
|
32532
|
+
{},
|
|
32533
|
+
{
|
|
32534
|
+
networkConfig: {
|
|
32535
|
+
api: STATSIG_API
|
|
32536
|
+
},
|
|
32537
|
+
// By default Statsig disables compression for events when proxy is used.
|
|
32538
|
+
// As our proxy does support compression, we force it to be enabled to save bandwidth.
|
|
32539
|
+
logEventCompressionMode: LogEventCompressionMode.Forced,
|
|
32540
|
+
environment: {
|
|
32541
|
+
tier: isDevelopment ? "development" : "production"
|
|
32542
|
+
}
|
|
32543
|
+
}
|
|
32544
|
+
);
|
|
32545
|
+
return /* @__PURE__ */ React234.createElement(StatsigProvider, { client }, children);
|
|
32146
32546
|
}
|
|
32147
32547
|
|
|
32148
32548
|
// src/providers/usePreloadImages.ts
|
|
32149
32549
|
import { isNotNullish as isNotNullish12 } from "@funkit/utils";
|
|
32150
|
-
import { useCallback as
|
|
32550
|
+
import { useCallback as useCallback55, useEffect as useEffect58 } from "react";
|
|
32151
32551
|
function usePreloadImages() {
|
|
32152
32552
|
const funkitConnectChains = useFunkitConnectChains();
|
|
32153
32553
|
const walletConnectors = useWalletConnectors();
|
|
32154
|
-
const preloadImages =
|
|
32554
|
+
const preloadImages = useCallback55(() => {
|
|
32155
32555
|
loadImages(
|
|
32156
32556
|
...walletConnectors.map((wallet) => wallet.iconUrl),
|
|
32157
32557
|
...funkitConnectChains.map((chain) => chain.iconUrl).filter(isNotNullish12)
|
|
32158
32558
|
);
|
|
32159
32559
|
}, [walletConnectors, funkitConnectChains]);
|
|
32160
|
-
|
|
32560
|
+
useEffect58(() => {
|
|
32161
32561
|
preloadImages();
|
|
32162
32562
|
}, [preloadImages]);
|
|
32163
32563
|
}
|
|
@@ -32185,7 +32585,7 @@ function FunkitProvider(props) {
|
|
|
32185
32585
|
!!props.debug,
|
|
32186
32586
|
getCurrentSdkVersion()
|
|
32187
32587
|
);
|
|
32188
|
-
const MainChild = /* @__PURE__ */
|
|
32588
|
+
const MainChild = /* @__PURE__ */ React235.createElement(FunkitThemeProvider, { theme: props.theme }, /* @__PURE__ */ React235.createElement(
|
|
32189
32589
|
FunkitProviderInner,
|
|
32190
32590
|
{
|
|
32191
32591
|
avatar: props.avatar,
|
|
@@ -32198,7 +32598,7 @@ function FunkitProvider(props) {
|
|
|
32198
32598
|
},
|
|
32199
32599
|
props.children
|
|
32200
32600
|
));
|
|
32201
|
-
return finalWagmiConfig && finalQueryClient ? /* @__PURE__ */
|
|
32601
|
+
return finalWagmiConfig && finalQueryClient ? /* @__PURE__ */ React235.createElement(WagmiProvider, { config: finalWagmiConfig }, /* @__PURE__ */ React235.createElement(QueryClientProvider, { client: finalQueryClient }, MainChild)) : MainChild;
|
|
32202
32602
|
}
|
|
32203
32603
|
function FunkitProviderInner({
|
|
32204
32604
|
avatar,
|
|
@@ -32218,7 +32618,7 @@ function FunkitProviderInner({
|
|
|
32218
32618
|
const avatarContext = avatar ?? defaultAvatar;
|
|
32219
32619
|
const isSandboxMode = !!sandbox;
|
|
32220
32620
|
const modalSizeFinal = modalSize || ModalSizeOptions.COMPACT;
|
|
32221
|
-
return /* @__PURE__ */
|
|
32621
|
+
return /* @__PURE__ */ React235.createElement(FunkitStatsigProvider, { isDevelopment: debug }, /* @__PURE__ */ React235.createElement(FunkitConfigContext.Provider, { value: funkitConfig }, /* @__PURE__ */ React235.createElement(FunkitConnectChainProvider, { initialChain }, /* @__PURE__ */ React235.createElement(ModalSizeProvider, { modalSize: modalSizeFinal }, /* @__PURE__ */ React235.createElement(FunkitWeb2Provider, null, /* @__PURE__ */ React235.createElement(GeneralWalletProvider, null, /* @__PURE__ */ React235.createElement(FunkitFlagsProvider, null, /* @__PURE__ */ React235.createElement(FunkitCheckoutHistoryProvider, null, /* @__PURE__ */ React235.createElement(FunkitCheckoutProvider, null, /* @__PURE__ */ React235.createElement(FunkitQuoteProvider, null, /* @__PURE__ */ React235.createElement(FunkitSandboxContext.Provider, { value: isSandboxMode }, /* @__PURE__ */ React235.createElement(AvatarContext.Provider, { value: avatarContext }, /* @__PURE__ */ React235.createElement(ThemeIdContext2.Provider, { value: id }, /* @__PURE__ */ React235.createElement(ShowBalanceProvider, null, /* @__PURE__ */ React235.createElement(FunkitMoonpayProvider, { debug: !!debug }, /* @__PURE__ */ React235.createElement(UserPresenceProvider, null, /* @__PURE__ */ React235.createElement(ModalProvider, null, activeTheme ? /* @__PURE__ */ React235.createElement(
|
|
32222
32622
|
"div",
|
|
32223
32623
|
{
|
|
32224
32624
|
...createThemeRootProps2(id),
|
|
@@ -32227,7 +32627,7 @@ function FunkitProviderInner({
|
|
|
32227
32627
|
height: "100%"
|
|
32228
32628
|
}
|
|
32229
32629
|
},
|
|
32230
|
-
/* @__PURE__ */
|
|
32630
|
+
/* @__PURE__ */ React235.createElement(
|
|
32231
32631
|
"style",
|
|
32232
32632
|
{
|
|
32233
32633
|
dangerouslySetInnerHTML: {
|
|
@@ -32244,7 +32644,7 @@ function FunkitProviderInner({
|
|
|
32244
32644
|
}
|
|
32245
32645
|
),
|
|
32246
32646
|
children
|
|
32247
|
-
) : children))))))))))))))));
|
|
32647
|
+
) : children)))))))))))))))));
|
|
32248
32648
|
}
|
|
32249
32649
|
|
|
32250
32650
|
// src/wallets/getDefaultWallets.ts
|