@funkit/connect 1.0.23 → 1.0.24
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 +12 -0
- package/dist/components/FunTransactionSummary/FunTransactionSummary.d.ts +1 -0
- package/dist/components/FunkitProvider/FunkitConfigContext.d.ts +2 -0
- package/dist/components/FunkitProvider/FunkitMoonpayProvider.d.ts +20 -0
- package/dist/components/FunkitProvider/GeneralWalletProvider.d.ts +2 -2
- package/dist/consts/funkit.d.ts +3 -0
- package/dist/consts/moonpay.d.ts +3 -0
- package/dist/index.css +12 -0
- package/dist/index.js +631 -453
- package/dist/utils/checkout.d.ts +1 -1
- package/dist/utils/mesh.d.ts +2 -1
- package/dist/wallets/walletConnectors/index.js +45 -45
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
import "./chunk-UK5FXGK3.js";
|
|
12
12
|
|
|
13
13
|
// src/components/ConnectButton/ConnectButton.tsx
|
|
14
|
-
import
|
|
14
|
+
import React152, { useContext as useContext28, useEffect as useEffect35, useState as useState48 } from "react";
|
|
15
15
|
|
|
16
16
|
// src/css/sprinkles.css.ts
|
|
17
17
|
import { createMapValueFn as _51c72 } from "@vanilla-extract/sprinkles/createUtils";
|
|
@@ -131,13 +131,13 @@ import PrivyJS, {
|
|
|
131
131
|
getUserEmbeddedWallet,
|
|
132
132
|
LocalStorage
|
|
133
133
|
} from "@privy-io/js-sdk-core";
|
|
134
|
-
import
|
|
135
|
-
createContext as
|
|
134
|
+
import React147, {
|
|
135
|
+
createContext as createContext18,
|
|
136
136
|
useCallback as useCallback30,
|
|
137
|
-
useContext as
|
|
138
|
-
useEffect as
|
|
137
|
+
useContext as useContext24,
|
|
138
|
+
useEffect as useEffect31,
|
|
139
139
|
useMemo as useMemo36,
|
|
140
|
-
useState as
|
|
140
|
+
useState as useState43
|
|
141
141
|
} from "react";
|
|
142
142
|
import { useConnect as useConnect2, useDisconnect as useDisconnect3 } from "wagmi";
|
|
143
143
|
|
|
@@ -483,13 +483,13 @@ var useFunkitConnectChainsById = () => {
|
|
|
483
483
|
};
|
|
484
484
|
|
|
485
485
|
// src/components/FunkitProvider/ModalContext.tsx
|
|
486
|
-
import
|
|
487
|
-
createContext as
|
|
486
|
+
import React146, {
|
|
487
|
+
createContext as createContext17,
|
|
488
488
|
useCallback as useCallback29,
|
|
489
|
-
useContext as
|
|
490
|
-
useEffect as
|
|
489
|
+
useContext as useContext23,
|
|
490
|
+
useEffect as useEffect30,
|
|
491
491
|
useMemo as useMemo35,
|
|
492
|
-
useState as
|
|
492
|
+
useState as useState42
|
|
493
493
|
} from "react";
|
|
494
494
|
import { useAccount as useAccount11, useAccountEffect as useAccountEffect2, useConfig as useConfig4 } from "wagmi";
|
|
495
495
|
|
|
@@ -620,7 +620,7 @@ var DEFAULT_FUNKIT_CONFIG = {
|
|
|
620
620
|
["apple_oauth" /* APPLE */]: false
|
|
621
621
|
}
|
|
622
622
|
},
|
|
623
|
-
accountModalConfig: { allowDepositing: false },
|
|
623
|
+
accountModalConfig: { showUnknownTokens: false, allowDepositing: false },
|
|
624
624
|
paymentsConfig: {
|
|
625
625
|
allowBrokerageUnlinking: false,
|
|
626
626
|
defaultPaymentMethod: void 0,
|
|
@@ -1465,7 +1465,7 @@ var GeneralWalletContext = createContext8({
|
|
|
1465
1465
|
isUserLoggedIn: false,
|
|
1466
1466
|
isWeb2Login: false,
|
|
1467
1467
|
isWeb3Login: false,
|
|
1468
|
-
userInfo: PLACEHOLDER_FUNKIT_USER_INFO,
|
|
1468
|
+
userInfo: { ...PLACEHOLDER_FUNKIT_USER_INFO, globalFunkitUserId: "" },
|
|
1469
1469
|
isFetchingAssets: false,
|
|
1470
1470
|
walletAssets: null,
|
|
1471
1471
|
startAssetsListener: () => void 0,
|
|
@@ -1480,6 +1480,7 @@ function GeneralWalletProvider({ children }) {
|
|
|
1480
1480
|
const { connectors, disconnectAsync } = useDisconnect();
|
|
1481
1481
|
const ensName = useMainnetEnsName(address);
|
|
1482
1482
|
const { web2AccountInfo, handleFunkitWeb2Logout } = useFunkitWeb2Login();
|
|
1483
|
+
const { apiKey, accountModalConfig } = useFunkitConfig();
|
|
1483
1484
|
const isWeb2Login = useMemo5(() => {
|
|
1484
1485
|
return connector && connector.id === FUNKIT_CONNECT_WALLET_ID;
|
|
1485
1486
|
}, [connector]);
|
|
@@ -1490,28 +1491,36 @@ function GeneralWalletProvider({ children }) {
|
|
|
1490
1491
|
return isWeb2Login || isWeb3Login;
|
|
1491
1492
|
}, [isWeb2Login, isWeb3Login]);
|
|
1492
1493
|
const userInfo = useMemo5(() => {
|
|
1494
|
+
let baseInfo;
|
|
1493
1495
|
if (isWeb2Login) {
|
|
1494
|
-
|
|
1496
|
+
baseInfo = web2AccountInfo;
|
|
1495
1497
|
} else if (isWeb3Login) {
|
|
1496
|
-
|
|
1498
|
+
baseInfo = {
|
|
1497
1499
|
userId: address,
|
|
1498
1500
|
accountLabel: connector == null ? void 0 : connector.name,
|
|
1499
1501
|
accountName: ensName ? formatENS(ensName) : formatAddress(address || "")
|
|
1500
1502
|
};
|
|
1501
1503
|
} else {
|
|
1502
|
-
|
|
1504
|
+
baseInfo = PLACEHOLDER_FUNKIT_USER_INFO;
|
|
1503
1505
|
}
|
|
1506
|
+
return {
|
|
1507
|
+
...baseInfo,
|
|
1508
|
+
globalFunkitUserId: isUserLoggedIn ? `${address}|${baseInfo.accountName}|${apiKey}` : `0x|UnknownGuest|${apiKey}`
|
|
1509
|
+
};
|
|
1504
1510
|
}, [
|
|
1505
1511
|
address,
|
|
1512
|
+
apiKey,
|
|
1506
1513
|
connector == null ? void 0 : connector.name,
|
|
1507
1514
|
ensName,
|
|
1515
|
+
isUserLoggedIn,
|
|
1508
1516
|
isWeb2Login,
|
|
1509
1517
|
isWeb3Login,
|
|
1510
1518
|
web2AccountInfo
|
|
1511
1519
|
]);
|
|
1512
1520
|
useEffect6(() => {
|
|
1513
|
-
if (userInfo.
|
|
1514
|
-
logger.
|
|
1521
|
+
if (userInfo.globalFunkitUserId !== logger.getUserId()) {
|
|
1522
|
+
logger.log("settingUserId", { newUserId: userInfo.globalFunkitUserId });
|
|
1523
|
+
logger.setUserId(userInfo.globalFunkitUserId);
|
|
1515
1524
|
}
|
|
1516
1525
|
}, [userInfo]);
|
|
1517
1526
|
const intervalRef = useRef2();
|
|
@@ -1529,6 +1538,9 @@ function GeneralWalletProvider({ children }) {
|
|
|
1529
1538
|
const modifiedAssets = Object.keys(chainAssets).reduce(
|
|
1530
1539
|
(acc2, curAddress) => {
|
|
1531
1540
|
const asset = chainAssets[curAddress];
|
|
1541
|
+
if ((!asset.price || !asset.totalUsdValue) && !accountModalConfig.showUnknownTokens) {
|
|
1542
|
+
return acc2;
|
|
1543
|
+
}
|
|
1532
1544
|
const chainAddress = combineChainSymbolOrAddress({
|
|
1533
1545
|
chainId: asset.chainId,
|
|
1534
1546
|
symbolOrAddress: curAddress
|
|
@@ -1800,6 +1812,74 @@ import {
|
|
|
1800
1812
|
import { getBalance } from "@wagmi/core";
|
|
1801
1813
|
import { isAddress } from "viem";
|
|
1802
1814
|
|
|
1815
|
+
// src/consts/moonpay.ts
|
|
1816
|
+
var MOONPAY_TOKENS_SUPPORTED_REGIONS = {
|
|
1817
|
+
usdc: {
|
|
1818
|
+
isSupportedInUS: true,
|
|
1819
|
+
notAllowedUSStates: ["VI"],
|
|
1820
|
+
notAllowedCountries: ["CA"],
|
|
1821
|
+
minBuyAmount: 15,
|
|
1822
|
+
maxBuyAmount: 3e4,
|
|
1823
|
+
precision: 2
|
|
1824
|
+
},
|
|
1825
|
+
usdc_arbitrum: {
|
|
1826
|
+
isSupportedInUS: true,
|
|
1827
|
+
notAllowedUSStates: ["NY", "TX", "VI"],
|
|
1828
|
+
notAllowedCountries: ["CA"],
|
|
1829
|
+
minBuyAmount: 15,
|
|
1830
|
+
maxBuyAmount: 3e4,
|
|
1831
|
+
precision: 2
|
|
1832
|
+
},
|
|
1833
|
+
usdc_base: {
|
|
1834
|
+
isSupportedInUS: true,
|
|
1835
|
+
notAllowedUSStates: ["NY", "TX", "VI"],
|
|
1836
|
+
notAllowedCountries: ["CA"],
|
|
1837
|
+
minBuyAmount: 15,
|
|
1838
|
+
maxBuyAmount: 3e4,
|
|
1839
|
+
precision: 2
|
|
1840
|
+
},
|
|
1841
|
+
usdc_polygon: {
|
|
1842
|
+
isSupportedInUS: true,
|
|
1843
|
+
notAllowedUSStates: ["NY", "TX", "VI"],
|
|
1844
|
+
notAllowedCountries: ["CA"],
|
|
1845
|
+
minBuyAmount: 15,
|
|
1846
|
+
maxBuyAmount: 3e4,
|
|
1847
|
+
precision: 2
|
|
1848
|
+
},
|
|
1849
|
+
eth: {
|
|
1850
|
+
isSupportedInUS: true,
|
|
1851
|
+
notAllowedUSStates: ["VI"],
|
|
1852
|
+
notAllowedCountries: [],
|
|
1853
|
+
minBuyAmount: 48e-4,
|
|
1854
|
+
maxBuyAmount: 3e4,
|
|
1855
|
+
precision: 4
|
|
1856
|
+
},
|
|
1857
|
+
eth_arbitrum: {
|
|
1858
|
+
isSupportedInUS: true,
|
|
1859
|
+
notAllowedUSStates: ["NY", "TX", "VI"],
|
|
1860
|
+
notAllowedCountries: [],
|
|
1861
|
+
minBuyAmount: 11e-4,
|
|
1862
|
+
maxBuyAmount: 1e9,
|
|
1863
|
+
precision: 4
|
|
1864
|
+
},
|
|
1865
|
+
eth_base: {
|
|
1866
|
+
isSupportedInUS: true,
|
|
1867
|
+
notAllowedUSStates: ["NY", "TX", "VI"],
|
|
1868
|
+
notAllowedCountries: [],
|
|
1869
|
+
minBuyAmount: 48e-4,
|
|
1870
|
+
maxBuyAmount: 9999999,
|
|
1871
|
+
precision: 4
|
|
1872
|
+
},
|
|
1873
|
+
eth_polygon: {
|
|
1874
|
+
isSupportedInUS: true,
|
|
1875
|
+
notAllowedUSStates: ["NY", "TX", "VI"],
|
|
1876
|
+
notAllowedCountries: [],
|
|
1877
|
+
minBuyAmount: 48e-4,
|
|
1878
|
+
maxBuyAmount: 9999999,
|
|
1879
|
+
precision: 4
|
|
1880
|
+
}
|
|
1881
|
+
};
|
|
1882
|
+
|
|
1803
1883
|
// src/utils/formatNumber.ts
|
|
1804
1884
|
var FORMAT_NUMBER_DEFAULT = {
|
|
1805
1885
|
minBeforeUseScientific: 1e-5,
|
|
@@ -2207,8 +2287,9 @@ function getCheckoutStateStepNumber(state) {
|
|
|
2207
2287
|
return 0;
|
|
2208
2288
|
}
|
|
2209
2289
|
}
|
|
2210
|
-
function formatTokenAmountForMoonpay(amount) {
|
|
2211
|
-
const
|
|
2290
|
+
function formatTokenAmountForMoonpay(amount, mpCurrencyCode) {
|
|
2291
|
+
const precision = MOONPAY_TOKENS_SUPPORTED_REGIONS[mpCurrencyCode.toLowerCase()].precision;
|
|
2292
|
+
const formattedNumber = roundUpToXDecimalPlaces(amount.toString(), precision);
|
|
2212
2293
|
return formattedNumber.toString();
|
|
2213
2294
|
}
|
|
2214
2295
|
function combineChainSymbolOrAddress2({
|
|
@@ -2690,7 +2771,8 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
2690
2771
|
const moonpayEstimation = await getMoonpayBuyQuoteForCreditCard({
|
|
2691
2772
|
currencyCode: mpCurrencyCode,
|
|
2692
2773
|
quoteCurrencyAmount: formatTokenAmountForMoonpay(
|
|
2693
|
-
parseFloat(baseQuote.estTotalFromAmount)
|
|
2774
|
+
parseFloat(baseQuote.estTotalFromAmount),
|
|
2775
|
+
mpCurrencyCode
|
|
2694
2776
|
),
|
|
2695
2777
|
baseCurrencyCode: "usd",
|
|
2696
2778
|
areFeesIncluded: true,
|
|
@@ -4056,9 +4138,9 @@ var EXCHANGE_NAME_TO_TYPE = {
|
|
|
4056
4138
|
["Bybit" /* Bybit */]: "bybit",
|
|
4057
4139
|
["BitfinexDirect" /* BitfinexDirect */]: "bitfinexDirect"
|
|
4058
4140
|
};
|
|
4059
|
-
async function fetchMeshLinkToken(selectedExchange, funApiKey) {
|
|
4141
|
+
async function fetchMeshLinkToken(funkitUserId, selectedExchange, funApiKey) {
|
|
4060
4142
|
return await meshGetLinkToken(
|
|
4061
|
-
|
|
4143
|
+
funkitUserId,
|
|
4062
4144
|
selectedExchange,
|
|
4063
4145
|
true,
|
|
4064
4146
|
null,
|
|
@@ -4180,6 +4262,7 @@ function useFunkitMesh({
|
|
|
4180
4262
|
}) {
|
|
4181
4263
|
const { apiKey } = useFunkitConfig();
|
|
4182
4264
|
const { meshBrokerDataMap, setDataMapAndCache } = useContext10(FunkitMeshContext);
|
|
4265
|
+
const { userInfo } = useGeneralWallet();
|
|
4183
4266
|
const handleIntegrationConnected = useCallback8(
|
|
4184
4267
|
(brokerData) => {
|
|
4185
4268
|
var _a;
|
|
@@ -4222,7 +4305,11 @@ function useFunkitMesh({
|
|
|
4222
4305
|
if (hasActiveConnectionCheck(brokerage)) {
|
|
4223
4306
|
onConnected == null ? void 0 : onConnected(meshBrokerDataMap[brokerage]);
|
|
4224
4307
|
} else {
|
|
4225
|
-
const response = await fetchMeshLinkToken(
|
|
4308
|
+
const response = await fetchMeshLinkToken(
|
|
4309
|
+
"meshconnectkit",
|
|
4310
|
+
brokerage,
|
|
4311
|
+
apiKey
|
|
4312
|
+
);
|
|
4226
4313
|
const linkToken = response.linkToken;
|
|
4227
4314
|
const linkConnection = getLinkConnection();
|
|
4228
4315
|
if (linkConnection && linkToken) {
|
|
@@ -6562,7 +6649,9 @@ function FeesLineItem({
|
|
|
6562
6649
|
}) {
|
|
6563
6650
|
const [isExpanded, setIsExpanded] = useState16(false);
|
|
6564
6651
|
const toggle = () => setIsExpanded(!isExpanded);
|
|
6565
|
-
return /* @__PURE__ */ React68.createElement(
|
|
6652
|
+
return /* @__PURE__ */ React68.createElement(Box, {
|
|
6653
|
+
width: "full"
|
|
6654
|
+
}, /* @__PURE__ */ React68.createElement(LineItem, {
|
|
6566
6655
|
onClick: isLoading ? () => void 0 : () => toggle == null ? void 0 : toggle(),
|
|
6567
6656
|
paddingY: isLoading ? "8" : "5",
|
|
6568
6657
|
color: { base: "modalTextDim", hover: "accentColor" },
|
|
@@ -6586,7 +6675,9 @@ function FeesLineItem({
|
|
|
6586
6675
|
size: "14"
|
|
6587
6676
|
}, formatCurrencyAndStringify(
|
|
6588
6677
|
parseFloat(feesItem.totalUsd.toString())
|
|
6589
|
-
)), isExpanded ? /* @__PURE__ */ React68.createElement(FunUpArrow, null) : /* @__PURE__ */ React68.createElement(FunDownArrow, null)) : null),
|
|
6678
|
+
)), isExpanded ? /* @__PURE__ */ React68.createElement(FunUpArrow, null) : /* @__PURE__ */ React68.createElement(FunDownArrow, null)) : null), /* @__PURE__ */ React68.createElement(Box, {
|
|
6679
|
+
className: isExpanded ? "fun-container-content-expanded" : "fun-container-content-collapsed"
|
|
6680
|
+
}, /* @__PURE__ */ React68.createElement(LineItem, null, /* @__PURE__ */ React68.createElement(Text, {
|
|
6590
6681
|
weight: "medium",
|
|
6591
6682
|
color: "modalTextDim",
|
|
6592
6683
|
size: "14"
|
|
@@ -6603,9 +6694,7 @@ function FeesLineItem({
|
|
|
6603
6694
|
color: "modalTextDim",
|
|
6604
6695
|
size: "14"
|
|
6605
6696
|
}, "(", formatCryptoAndStringify(
|
|
6606
|
-
parseFloat(
|
|
6607
|
-
feesItem.transactionFeesTokenAmount.toString()
|
|
6608
|
-
),
|
|
6697
|
+
parseFloat(feesItem.transactionFeesTokenAmount.toString()),
|
|
6609
6698
|
feesItem.transactionFeesTokenSymbol
|
|
6610
6699
|
), ")\xA0") : null, /* @__PURE__ */ React68.createElement(Text, {
|
|
6611
6700
|
weight: "medium",
|
|
@@ -6638,7 +6727,7 @@ function FeesLineItem({
|
|
|
6638
6727
|
size: "14"
|
|
6639
6728
|
}, formatCurrencyAndStringify(
|
|
6640
6729
|
parseFloat(feesItem.platformFeesUsd.toString())
|
|
6641
|
-
))) : null))
|
|
6730
|
+
))) : null)));
|
|
6642
6731
|
}
|
|
6643
6732
|
function FunTxSummaryDivider() {
|
|
6644
6733
|
return /* @__PURE__ */ React68.createElement(Box, {
|
|
@@ -7515,10 +7604,14 @@ function FunPaymentMoonpayType({
|
|
|
7515
7604
|
const [isSupportedRegion, setIsSupportedRegion] = useState20(true);
|
|
7516
7605
|
const [isBackToHomeDisabled, setIsBackToHomeDisabled] = useState20(true);
|
|
7517
7606
|
const funkitConfig = useFunkitConfig();
|
|
7607
|
+
const { userInfo } = useGeneralWallet();
|
|
7518
7608
|
const currencyCode = useMemo19(() => {
|
|
7519
7609
|
return generateMoonpayCurrencyCode(depositToken, depositTokenChainId);
|
|
7520
7610
|
}, [depositToken, depositTokenChainId]);
|
|
7521
|
-
const depositTokenAmountStringFormatted = formatTokenAmountForMoonpay(
|
|
7611
|
+
const depositTokenAmountStringFormatted = formatTokenAmountForMoonpay(
|
|
7612
|
+
depositTokenAmount,
|
|
7613
|
+
currencyCode
|
|
7614
|
+
);
|
|
7522
7615
|
const handleGetSignature = async (url) => {
|
|
7523
7616
|
const res = await getMoonpayUrlSignature(
|
|
7524
7617
|
url,
|
|
@@ -7598,7 +7691,8 @@ function FunPaymentMoonpayType({
|
|
|
7598
7691
|
border: `1px solid ${active2.colors.modalTextDim}`
|
|
7599
7692
|
},
|
|
7600
7693
|
theme: active2.moonpayTheme,
|
|
7601
|
-
colorCode: moonpayButtonColor
|
|
7694
|
+
colorCode: moonpayButtonColor,
|
|
7695
|
+
externalCustomerId: userInfo.globalFunkitUserId
|
|
7602
7696
|
})), paymentFlow === 0 /* DEPOSIT */ ? /* @__PURE__ */ React79.createElement(Box, {
|
|
7603
7697
|
width: "full"
|
|
7604
7698
|
}, /* @__PURE__ */ React79.createElement(FunButton, {
|
|
@@ -8650,7 +8744,6 @@ function Home({
|
|
|
8650
8744
|
}
|
|
8651
8745
|
|
|
8652
8746
|
// src/components/ProfileDetails/FunProfileViews/Settings/Settings.tsx
|
|
8653
|
-
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO5 } from "@funkit/core";
|
|
8654
8747
|
import React96, { useCallback as useCallback16, useState as useState24 } from "react";
|
|
8655
8748
|
import { useAccount as useAccount6 } from "wagmi";
|
|
8656
8749
|
|
|
@@ -8801,9 +8894,10 @@ function Settings({
|
|
|
8801
8894
|
}), /* @__PURE__ */ React96.createElement(FunIconButton, {
|
|
8802
8895
|
icon: /* @__PURE__ */ React96.createElement(RedirectIcon, null),
|
|
8803
8896
|
onClick: () => {
|
|
8897
|
+
var _a;
|
|
8804
8898
|
if (activeChain == null ? void 0 : activeChain.id) {
|
|
8805
8899
|
window.open(
|
|
8806
|
-
`${
|
|
8900
|
+
`${(_a = activeChain.blockExplorers) == null ? void 0 : _a.default.url}/address/${walletAddress}`,
|
|
8807
8901
|
"_blank"
|
|
8808
8902
|
);
|
|
8809
8903
|
}
|
|
@@ -11448,14 +11542,28 @@ function ConnectDetail({
|
|
|
11448
11542
|
alignItems: "center",
|
|
11449
11543
|
display: "flex",
|
|
11450
11544
|
height: "full",
|
|
11451
|
-
justifyContent: "center"
|
|
11545
|
+
justifyContent: "center",
|
|
11546
|
+
flexDirection: "column"
|
|
11452
11547
|
}, /* @__PURE__ */ React127.createElement(QRCode, {
|
|
11453
11548
|
logoBackground: iconBackground,
|
|
11454
11549
|
logoSize: compactModeEnabled ? 60 : 72,
|
|
11455
11550
|
logoUrl: iconUrl,
|
|
11456
11551
|
size: compactModeEnabled ? 318 : smallWindow ? Math.max(280, Math.min(windowWidth - 308, 382)) : 382,
|
|
11457
11552
|
uri: qrCodeUri
|
|
11458
|
-
})
|
|
11553
|
+
}), /* @__PURE__ */ React127.createElement(Box, {
|
|
11554
|
+
display: "flex",
|
|
11555
|
+
alignItems: "center",
|
|
11556
|
+
justifyContent: "center",
|
|
11557
|
+
paddingTop: "20"
|
|
11558
|
+
}, /* @__PURE__ */ React127.createElement(Text, {
|
|
11559
|
+
weight: "medium",
|
|
11560
|
+
color: "modalText",
|
|
11561
|
+
size: "14",
|
|
11562
|
+
style: { paddingRight: 8 }
|
|
11563
|
+
}, "Copy Link"), /* @__PURE__ */ React127.createElement(CopyAddress, {
|
|
11564
|
+
address: qrCodeUri,
|
|
11565
|
+
type: "button"
|
|
11566
|
+
}))) : /* @__PURE__ */ React127.createElement(Box, {
|
|
11459
11567
|
alignItems: "center",
|
|
11460
11568
|
display: "flex",
|
|
11461
11569
|
justifyContent: "center",
|
|
@@ -12406,16 +12514,16 @@ function ConnectModal({ onClose, open }) {
|
|
|
12406
12514
|
}
|
|
12407
12515
|
|
|
12408
12516
|
// src/components/FunCheckoutHistoryModal/FunCheckoutHistoryModal.tsx
|
|
12409
|
-
import
|
|
12517
|
+
import React144, { useCallback as useCallback28, useMemo as useMemo34, useState as useState41 } from "react";
|
|
12410
12518
|
|
|
12411
12519
|
// src/components/FunCheckoutHistoryModal/FunCheckoutHistoryDetail.tsx
|
|
12412
12520
|
import {
|
|
12413
|
-
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as
|
|
12521
|
+
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8
|
|
12414
12522
|
} from "@funkit/core";
|
|
12415
|
-
import
|
|
12523
|
+
import React141, { useMemo as useMemo32 } from "react";
|
|
12416
12524
|
|
|
12417
12525
|
// src/components/FunCheckoutModal/FunCheckoutPrimaryInfo.tsx
|
|
12418
|
-
import
|
|
12526
|
+
import React140, { useCallback as useCallback27, useEffect as useEffect29, useMemo as useMemo31, useState as useState39 } from "react";
|
|
12419
12527
|
|
|
12420
12528
|
// src/components/Icons/EditIcon.tsx
|
|
12421
12529
|
import React132 from "react";
|
|
@@ -12435,10 +12543,11 @@ var EditIcon = ({ size = "24" }) => /* @__PURE__ */ React132.createElement("svg"
|
|
|
12435
12543
|
|
|
12436
12544
|
// src/components/FunCheckoutModal/FunCheckoutModal.tsx
|
|
12437
12545
|
import {
|
|
12438
|
-
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as
|
|
12546
|
+
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7,
|
|
12439
12547
|
getTokenInfo as getTokenInfo2
|
|
12440
12548
|
} from "@funkit/core";
|
|
12441
|
-
import
|
|
12549
|
+
import React139, { useCallback as useCallback26, useEffect as useEffect28, useMemo as useMemo30, useState as useState38 } from "react";
|
|
12550
|
+
import { mainnet as mainnet3 } from "viem/chains";
|
|
12442
12551
|
|
|
12443
12552
|
// src/hooks/useCheckoutAccountBalanceTransfer.ts
|
|
12444
12553
|
import { useCallback as useCallback22 } from "react";
|
|
@@ -12495,15 +12604,72 @@ function useCheckoutAccountBalanceTransfer(checkoutId) {
|
|
|
12495
12604
|
};
|
|
12496
12605
|
}
|
|
12497
12606
|
|
|
12607
|
+
// src/components/FunkitProvider/FunkitMoonpayProvider.tsx
|
|
12608
|
+
import React133, { createContext as createContext16, useContext as useContext22, useEffect as useEffect25, useState as useState34 } from "react";
|
|
12609
|
+
var MoonPayOriginalProvider = (props) => {
|
|
12610
|
+
const [MoonPayProviderInner, setMoonPayProviderInner] = useState34(null);
|
|
12611
|
+
useEffect25(() => {
|
|
12612
|
+
const loadMoonPayProviderInner = async () => {
|
|
12613
|
+
try {
|
|
12614
|
+
const module = await import("@moonpay/moonpay-react");
|
|
12615
|
+
setMoonPayProviderInner(() => module.MoonPayProvider);
|
|
12616
|
+
} catch (error) {
|
|
12617
|
+
logger.error("Failed to load MoonPayProvider", error);
|
|
12618
|
+
}
|
|
12619
|
+
};
|
|
12620
|
+
loadMoonPayProviderInner();
|
|
12621
|
+
}, []);
|
|
12622
|
+
if (!MoonPayProviderInner)
|
|
12623
|
+
return /* @__PURE__ */ React133.createElement(React133.Fragment, null, props.children);
|
|
12624
|
+
return /* @__PURE__ */ React133.createElement(MoonPayProviderInner, {
|
|
12625
|
+
...props
|
|
12626
|
+
}, props.children);
|
|
12627
|
+
};
|
|
12628
|
+
var FunkitMoonpayContext = createContext16({
|
|
12629
|
+
moonpayApiKey: ""
|
|
12630
|
+
});
|
|
12631
|
+
function FunkitMoonpayProvider({
|
|
12632
|
+
children,
|
|
12633
|
+
debug
|
|
12634
|
+
}) {
|
|
12635
|
+
const isSandboxMode = useIsFunkitSandboxMode();
|
|
12636
|
+
const moonpayApiKey = isSandboxMode ? "pk_test_dWfAhBbvVexIId9S5hPd78mKM7ivIsqu" : "pk_live_IxayBRQuBC3RzpPZkbGPrwUsRWAaeO";
|
|
12637
|
+
return /* @__PURE__ */ React133.createElement(MoonPayOriginalProvider, {
|
|
12638
|
+
apiKey: moonpayApiKey,
|
|
12639
|
+
debug
|
|
12640
|
+
}, /* @__PURE__ */ React133.createElement(FunkitMoonpayContext.Provider, {
|
|
12641
|
+
value: { moonpayApiKey }
|
|
12642
|
+
}, children));
|
|
12643
|
+
}
|
|
12644
|
+
function useFunkitMoonpayUserIp() {
|
|
12645
|
+
const [userIpInfo, setUserIpInfo] = useState34(
|
|
12646
|
+
null
|
|
12647
|
+
);
|
|
12648
|
+
const { moonpayApiKey } = useContext22(FunkitMoonpayContext);
|
|
12649
|
+
const getUserIpViaMoonpay = async () => {
|
|
12650
|
+
const response = await fetch(
|
|
12651
|
+
`https://api.moonpay.com/v3/ip_address?apiKey=${moonpayApiKey}`
|
|
12652
|
+
);
|
|
12653
|
+
const responseJson = await response.json();
|
|
12654
|
+
setUserIpInfo(responseJson);
|
|
12655
|
+
};
|
|
12656
|
+
useEffect25(() => {
|
|
12657
|
+
getUserIpViaMoonpay().catch(
|
|
12658
|
+
(err) => logger.error("getUserIpViaMoonpay:error", err)
|
|
12659
|
+
);
|
|
12660
|
+
}, []);
|
|
12661
|
+
return userIpInfo;
|
|
12662
|
+
}
|
|
12663
|
+
|
|
12498
12664
|
// src/components/FunCheckoutModal/FunCheckoutConfirmationStep.tsx
|
|
12499
12665
|
import {
|
|
12500
12666
|
ERC20_ABI,
|
|
12501
|
-
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as
|
|
12667
|
+
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO5,
|
|
12502
12668
|
getPaymasterDataForCheckoutSponsoredTransfer,
|
|
12503
12669
|
isAddress as isAddress3,
|
|
12504
12670
|
meshPreviewTransfer as meshPreviewTransfer3
|
|
12505
12671
|
} from "@funkit/core";
|
|
12506
|
-
import
|
|
12672
|
+
import React134, { useCallback as useCallback23, useMemo as useMemo27, useState as useState35 } from "react";
|
|
12507
12673
|
import { useAccount as useAccount10, useSendTransaction, useWriteContract } from "wagmi";
|
|
12508
12674
|
function FunCheckoutConfirmationStep({
|
|
12509
12675
|
checkoutId,
|
|
@@ -12528,16 +12694,16 @@ function FunCheckoutConfirmationStep({
|
|
|
12528
12694
|
const hasDraftValueAndMethodError = ((_a = checkoutItem == null ? void 0 : checkoutItem.selectedPaymentMethodInfo) == null ? void 0 : _a.paymentMethod) === "card" /* CARD */ && isAmountValidForMoonpay({
|
|
12529
12695
|
amountUsd: ((checkoutItem == null ? void 0 : checkoutItem.draftDollarValue) || 0).toString()
|
|
12530
12696
|
});
|
|
12531
|
-
const [isConfirming, setIsConfirming] =
|
|
12532
|
-
const [checkoutStepMessage, setCheckoutStepMessage] =
|
|
12533
|
-
const [confirmationError, setConfirmationError] =
|
|
12697
|
+
const [isConfirming, setIsConfirming] = useState35(false);
|
|
12698
|
+
const [checkoutStepMessage, setCheckoutStepMessage] = useState35("");
|
|
12699
|
+
const [confirmationError, setConfirmationError] = useState35("");
|
|
12534
12700
|
const hasCheckoutConfirmationError = useMemo27(
|
|
12535
12701
|
() => confirmationError !== "",
|
|
12536
12702
|
[confirmationError]
|
|
12537
12703
|
);
|
|
12538
|
-
const [isPostCheckoutLoading, setIsPostCheckoutLoading] =
|
|
12539
|
-
const [postCheckoutStepMessage, setPostCheckoutStepMessage] =
|
|
12540
|
-
const [postCheckoutError, setPostCheckoutError] =
|
|
12704
|
+
const [isPostCheckoutLoading, setIsPostCheckoutLoading] = useState35(false);
|
|
12705
|
+
const [postCheckoutStepMessage, setPostCheckoutStepMessage] = useState35("");
|
|
12706
|
+
const [postCheckoutError, setPostCheckoutError] = useState35("");
|
|
12541
12707
|
const hasPostCheckoutError = useMemo27(
|
|
12542
12708
|
() => postCheckoutError !== "",
|
|
12543
12709
|
[postCheckoutError]
|
|
@@ -12640,7 +12806,7 @@ function FunCheckoutConfirmationStep({
|
|
|
12640
12806
|
sourceAssetChainId,
|
|
12641
12807
|
currentChain: chain
|
|
12642
12808
|
});
|
|
12643
|
-
const chainName =
|
|
12809
|
+
const chainName = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO5[sourceAssetChainId].chainInfo.name;
|
|
12644
12810
|
setPostCheckoutStepMessage(
|
|
12645
12811
|
WEB3_ACCOUNT_BALANCE_MESSAGE_GENERATOR[1 /* SWITCH_CHAIN */](chainName)
|
|
12646
12812
|
);
|
|
@@ -12822,7 +12988,7 @@ function FunCheckoutConfirmationStep({
|
|
|
12822
12988
|
]);
|
|
12823
12989
|
const paymentTokenString = useMemo27(() => {
|
|
12824
12990
|
var _a2, _b2, _c2, _d2, _e2, _f2;
|
|
12825
|
-
const sourceChainName = ((_a2 = checkoutItem == null ? void 0 : checkoutItem.selectedSourceAssetInfo) == null ? void 0 : _a2.chainId) ? (_d2 = (_c2 =
|
|
12991
|
+
const sourceChainName = ((_a2 = checkoutItem == null ? void 0 : checkoutItem.selectedSourceAssetInfo) == null ? void 0 : _a2.chainId) ? (_d2 = (_c2 = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO5) == null ? void 0 : _c2[(_b2 = checkoutItem == null ? void 0 : checkoutItem.selectedSourceAssetInfo) == null ? void 0 : _b2.chainId]) == null ? void 0 : _d2.name : "";
|
|
12826
12992
|
return formatCryptoAndStringify(
|
|
12827
12993
|
parseFloat(((_e2 = checkoutItem == null ? void 0 : checkoutItem.latestQuote) == null ? void 0 : _e2.finalPaymentTokenAmount) || "0"),
|
|
12828
12994
|
`${(_f2 = checkoutItem == null ? void 0 : checkoutItem.selectedSourceAssetInfo) == null ? void 0 : _f2.symbol}${sourceChainName ? ` (${sourceChainName})` : ""}` || ""
|
|
@@ -12833,23 +12999,23 @@ function FunCheckoutConfirmationStep({
|
|
|
12833
12999
|
(_q = checkoutItem == null ? void 0 : checkoutItem.selectedSourceAssetInfo) == null ? void 0 : _q.symbol
|
|
12834
13000
|
]);
|
|
12835
13001
|
const hasError = hasDraftValueAndMethodError || hasQuoteError || hasCheckoutConfirmationError || hasPostCheckoutError;
|
|
12836
|
-
return /* @__PURE__ */
|
|
13002
|
+
return /* @__PURE__ */ React134.createElement(Box, {
|
|
12837
13003
|
display: "flex",
|
|
12838
13004
|
flexDirection: "column",
|
|
12839
13005
|
gap: "24",
|
|
12840
13006
|
paddingY: "24",
|
|
12841
13007
|
className: animateOut ? animateContentOutClass : animateContentInClass
|
|
12842
|
-
}, /* @__PURE__ */
|
|
13008
|
+
}, /* @__PURE__ */ React134.createElement(CheckoutPrimaryInfo, {
|
|
12843
13009
|
checkoutId,
|
|
12844
13010
|
checkoutStep
|
|
12845
|
-
}), /* @__PURE__ */
|
|
13011
|
+
}), /* @__PURE__ */ React134.createElement(Box, {
|
|
12846
13012
|
display: "flex",
|
|
12847
13013
|
flexDirection: "column",
|
|
12848
13014
|
gap: "24"
|
|
12849
|
-
}, (checkoutItem == null ? void 0 : checkoutItem.selectedPaymentMethodInfo) ? /* @__PURE__ */
|
|
13015
|
+
}, (checkoutItem == null ? void 0 : checkoutItem.selectedPaymentMethodInfo) ? /* @__PURE__ */ React134.createElement(ExistingPaymentMethodItem, {
|
|
12850
13016
|
paymentMethodInfo: checkoutItem == null ? void 0 : checkoutItem.selectedPaymentMethodInfo,
|
|
12851
13017
|
isClickable: false
|
|
12852
|
-
}) : null, /* @__PURE__ */
|
|
13018
|
+
}) : null, /* @__PURE__ */ React134.createElement(FunTransactionSummary, {
|
|
12853
13019
|
estFees: {
|
|
12854
13020
|
totalUsd: parseInputToNumber(
|
|
12855
13021
|
(_r = checkoutItem == null ? void 0 : checkoutItem.latestQuote) == null ? void 0 : _r.finalFeesBreakdown.totalFeesUsd
|
|
@@ -12872,31 +13038,31 @@ function FunCheckoutConfirmationStep({
|
|
|
12872
13038
|
1 /* CHECKOUT */,
|
|
12873
13039
|
false
|
|
12874
13040
|
) : hasQuoteError ? checkoutItem == null ? void 0 : checkoutItem.quoteErrorMessage : hasCheckoutConfirmationError ? confirmationError : hasPostCheckoutError ? postCheckoutError : ""
|
|
12875
|
-
})), !hasError && (postCheckoutStepMessage || checkoutStepMessage) ? /* @__PURE__ */
|
|
13041
|
+
})), !hasError && (postCheckoutStepMessage || checkoutStepMessage) ? /* @__PURE__ */ React134.createElement(FunNotification, {
|
|
12876
13042
|
description: postCheckoutStepMessage || checkoutStepMessage,
|
|
12877
13043
|
type: "default"
|
|
12878
|
-
}) : null, /* @__PURE__ */
|
|
13044
|
+
}) : null, /* @__PURE__ */ React134.createElement(Box, {
|
|
12879
13045
|
display: "flex",
|
|
12880
13046
|
flexDirection: "column",
|
|
12881
13047
|
gap: "4"
|
|
12882
|
-
}, /* @__PURE__ */
|
|
13048
|
+
}, /* @__PURE__ */ React134.createElement(FunButton, {
|
|
12883
13049
|
title: "Confirm Order",
|
|
12884
13050
|
isDisabled: (checkoutItem == null ? void 0 : checkoutItem.isQuoting) || (checkoutItem == null ? void 0 : checkoutItem.isDrafting) || isConfirming || hasDraftValueAndMethodError || hasQuoteError || isPostCheckoutLoading || hasCheckoutConfirmationError || hasPostCheckoutError,
|
|
12885
|
-
titleSuffix: isConfirming || isPostCheckoutLoading ? /* @__PURE__ */
|
|
13051
|
+
titleSuffix: isConfirming || isPostCheckoutLoading ? /* @__PURE__ */ React134.createElement(Box, {
|
|
12886
13052
|
display: "flex",
|
|
12887
13053
|
alignItems: "center",
|
|
12888
13054
|
color: "modalText"
|
|
12889
|
-
}, /* @__PURE__ */
|
|
13055
|
+
}, /* @__PURE__ */ React134.createElement(SpinnerIcon, {
|
|
12890
13056
|
height: 16,
|
|
12891
13057
|
width: 16
|
|
12892
13058
|
})) : null,
|
|
12893
13059
|
onClick: onClickConfirm
|
|
12894
|
-
}), /* @__PURE__ */
|
|
13060
|
+
}), /* @__PURE__ */ React134.createElement(FunTermsAndConditionsTextButton, null)));
|
|
12895
13061
|
}
|
|
12896
13062
|
|
|
12897
13063
|
// src/components/FunCheckoutModal/FunCheckoutInputAmountStep.tsx
|
|
12898
13064
|
import { getAssetPriceInfoForCheckout as getAssetPriceInfoForCheckout3 } from "@funkit/core";
|
|
12899
|
-
import
|
|
13065
|
+
import React135, { useCallback as useCallback24, useEffect as useEffect26, useMemo as useMemo28, useState as useState36 } from "react";
|
|
12900
13066
|
function FunCheckoutInputAmountStep({
|
|
12901
13067
|
checkoutId,
|
|
12902
13068
|
onContinue,
|
|
@@ -12905,12 +13071,12 @@ function FunCheckoutInputAmountStep({
|
|
|
12905
13071
|
const { active: active2 } = useActiveTheme();
|
|
12906
13072
|
const { checkoutItem, updateTargetAssetAmount, getCheckoutDraftDollarValue } = useFunkitPreCheckoutInternal(checkoutId);
|
|
12907
13073
|
const initialAmount = (checkoutItem == null ? void 0 : checkoutItem.initSettings.config.targetAssetAmount) || 0;
|
|
12908
|
-
const [amountInput, setAmountInput] =
|
|
13074
|
+
const [amountInput, setAmountInput] = useState36(
|
|
12909
13075
|
initialAmount === 0 ? "" : initialAmount.toFixed(4)
|
|
12910
13076
|
);
|
|
12911
|
-
const [unitPrice, setUnitPrice] =
|
|
12912
|
-
const [errorMessage, setErrorMessage] =
|
|
12913
|
-
|
|
13077
|
+
const [unitPrice, setUnitPrice] = useState36(0);
|
|
13078
|
+
const [errorMessage, setErrorMessage] = useState36("");
|
|
13079
|
+
useEffect26(() => {
|
|
12914
13080
|
const fetchPrice = async () => {
|
|
12915
13081
|
var _a, _b, _c, _d;
|
|
12916
13082
|
try {
|
|
@@ -12933,7 +13099,7 @@ function FunCheckoutInputAmountStep({
|
|
|
12933
13099
|
const usdEquivalent = useMemo28(() => {
|
|
12934
13100
|
return unitPrice * Number(amountInput);
|
|
12935
13101
|
}, [amountInput, unitPrice]);
|
|
12936
|
-
const [isContinuing, setIsContinuing] =
|
|
13102
|
+
const [isContinuing, setIsContinuing] = useState36(false);
|
|
12937
13103
|
const onClickContinue = useCallback24(async () => {
|
|
12938
13104
|
setIsContinuing(true);
|
|
12939
13105
|
await updateTargetAssetAmount(parseFloat(amountInput));
|
|
@@ -12946,21 +13112,21 @@ function FunCheckoutInputAmountStep({
|
|
|
12946
13112
|
onContinue,
|
|
12947
13113
|
updateTargetAssetAmount
|
|
12948
13114
|
]);
|
|
12949
|
-
return /* @__PURE__ */
|
|
13115
|
+
return /* @__PURE__ */ React135.createElement(Box, {
|
|
12950
13116
|
display: "flex",
|
|
12951
13117
|
flexDirection: "column",
|
|
12952
13118
|
gap: "24",
|
|
12953
13119
|
paddingY: "24",
|
|
12954
13120
|
width: "full",
|
|
12955
13121
|
className: animateOut ? animateContentOutClass : animateContentInClass
|
|
12956
|
-
}, /* @__PURE__ */
|
|
13122
|
+
}, /* @__PURE__ */ React135.createElement(Box, {
|
|
12957
13123
|
display: "flex",
|
|
12958
13124
|
flexDirection: "column",
|
|
12959
13125
|
justifyContent: "center",
|
|
12960
13126
|
alignItems: "center",
|
|
12961
13127
|
gap: "8",
|
|
12962
13128
|
width: "full"
|
|
12963
|
-
}, /* @__PURE__ */
|
|
13129
|
+
}, /* @__PURE__ */ React135.createElement(FunInput, {
|
|
12964
13130
|
value: amountInput,
|
|
12965
13131
|
placeholder: "0",
|
|
12966
13132
|
onChange: (newAmount) => setAmountInput(newAmount.target.value),
|
|
@@ -12978,22 +13144,22 @@ function FunCheckoutInputAmountStep({
|
|
|
12978
13144
|
},
|
|
12979
13145
|
hasBackground: false,
|
|
12980
13146
|
textColor: "modalText"
|
|
12981
|
-
}), /* @__PURE__ */
|
|
13147
|
+
}), /* @__PURE__ */ React135.createElement(Text, {
|
|
12982
13148
|
color: "modalTextSecondary"
|
|
12983
|
-
}, formatCurrencyAndStringify(usdEquivalent)), errorMessage ? /* @__PURE__ */
|
|
13149
|
+
}, formatCurrencyAndStringify(usdEquivalent)), errorMessage ? /* @__PURE__ */ React135.createElement(Box, {
|
|
12984
13150
|
width: "full",
|
|
12985
13151
|
paddingTop: "16"
|
|
12986
|
-
}, /* @__PURE__ */
|
|
13152
|
+
}, /* @__PURE__ */ React135.createElement(FunNotification, {
|
|
12987
13153
|
type: "error",
|
|
12988
13154
|
description: errorMessage
|
|
12989
|
-
})) : null), /* @__PURE__ */
|
|
13155
|
+
})) : null), /* @__PURE__ */ React135.createElement(FunButton, {
|
|
12990
13156
|
title: "Continue",
|
|
12991
13157
|
isDisabled: isContinuing || (parseFloat(amountInput) || 0) <= 0 || usdEquivalent <= 0,
|
|
12992
|
-
titleSuffix: isContinuing ? /* @__PURE__ */
|
|
13158
|
+
titleSuffix: isContinuing ? /* @__PURE__ */ React135.createElement(Box, {
|
|
12993
13159
|
display: "flex",
|
|
12994
13160
|
alignItems: "center",
|
|
12995
13161
|
color: "modalText"
|
|
12996
|
-
}, /* @__PURE__ */
|
|
13162
|
+
}, /* @__PURE__ */ React135.createElement(SpinnerIcon, {
|
|
12997
13163
|
height: 16,
|
|
12998
13164
|
width: 16
|
|
12999
13165
|
})) : null,
|
|
@@ -13004,19 +13170,19 @@ function FunCheckoutInputAmountStep({
|
|
|
13004
13170
|
// src/components/FunCheckoutModal/FunCheckoutSelectAssetStep.tsx
|
|
13005
13171
|
import {
|
|
13006
13172
|
FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS as FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS3,
|
|
13007
|
-
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as
|
|
13173
|
+
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO6
|
|
13008
13174
|
} from "@funkit/core";
|
|
13009
|
-
import
|
|
13175
|
+
import React137, { useCallback as useCallback25, useEffect as useEffect27, useMemo as useMemo29, useState as useState37 } from "react";
|
|
13010
13176
|
|
|
13011
13177
|
// src/components/FunBadge/FunBadge.tsx
|
|
13012
|
-
import
|
|
13178
|
+
import React136 from "react";
|
|
13013
13179
|
function FunBadge({ text }) {
|
|
13014
|
-
return /* @__PURE__ */
|
|
13180
|
+
return /* @__PURE__ */ React136.createElement(Box, {
|
|
13015
13181
|
background: "notificationPrimary",
|
|
13016
13182
|
paddingX: "8",
|
|
13017
13183
|
borderRadius: "6",
|
|
13018
13184
|
style: { width: "fit-content" }
|
|
13019
|
-
}, /* @__PURE__ */
|
|
13185
|
+
}, /* @__PURE__ */ React136.createElement(Text, {
|
|
13020
13186
|
size: "10",
|
|
13021
13187
|
color: "modalTextSecondary",
|
|
13022
13188
|
weight: "medium"
|
|
@@ -13031,9 +13197,9 @@ function MeshOrAccountSelectAsset({
|
|
|
13031
13197
|
isOnFinishLoading
|
|
13032
13198
|
}) {
|
|
13033
13199
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
13034
|
-
const [accountHoldingsMap, setAccountHoldingsMap] =
|
|
13035
|
-
const [isLoadingAssets, setIsLoadingAssets] =
|
|
13036
|
-
const [selectedChainTokenSymbol, setSelectedChainTokenSymbol] =
|
|
13200
|
+
const [accountHoldingsMap, setAccountHoldingsMap] = useState37({});
|
|
13201
|
+
const [isLoadingAssets, setIsLoadingAssets] = useState37(true);
|
|
13202
|
+
const [selectedChainTokenSymbol, setSelectedChainTokenSymbol] = useState37("");
|
|
13037
13203
|
const { checkoutItem, updateSourceAsset } = useFunkitPreCheckoutInternal(checkoutId);
|
|
13038
13204
|
const { isCheckoutCrFlow } = useCheckoutType(checkoutItem);
|
|
13039
13205
|
const draftDollarValueNormalized = (checkoutItem == null ? void 0 : checkoutItem.draftDollarValue) || 0;
|
|
@@ -13125,18 +13291,18 @@ function MeshOrAccountSelectAsset({
|
|
|
13125
13291
|
const generateAccountHoldingsMapForBalance = useCallback25(async () => {
|
|
13126
13292
|
const itemMap = {};
|
|
13127
13293
|
const checkoutTargetChainId = checkoutItem == null ? void 0 : checkoutItem.initSettings.config.targetChain;
|
|
13128
|
-
const isCheckoutOnMainnet =
|
|
13294
|
+
const isCheckoutOnMainnet = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO6[checkoutTargetChainId || ""].isFiatCheckoutSupported;
|
|
13129
13295
|
Object.values(walletAssets || {}).forEach((fwAsset) => {
|
|
13130
13296
|
var _a2, _b2, _c2, _d2;
|
|
13131
13297
|
if (!fwAsset.symbol || !fwAsset.contractAddress)
|
|
13132
13298
|
return;
|
|
13133
|
-
const isAssetOnMainnet =
|
|
13299
|
+
const isAssetOnMainnet = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO6[fwAsset.chainId].isFiatCheckoutSupported;
|
|
13134
13300
|
if (isCheckoutOnMainnet && !isAssetOnMainnet)
|
|
13135
13301
|
return;
|
|
13136
13302
|
if (!isCheckoutOnMainnet && checkoutTargetChainId !== fwAsset.chainId)
|
|
13137
13303
|
return;
|
|
13138
13304
|
let normalizedTokenAddress = fwAsset.contractAddress;
|
|
13139
|
-
if (((_d2 = (_c2 = (_b2 = (_a2 =
|
|
13305
|
+
if (((_d2 = (_c2 = (_b2 = (_a2 = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO6) == null ? void 0 : _a2[fwAsset.chainId]) == null ? void 0 : _b2.nativeCurrency) == null ? void 0 : _c2.symbol) == null ? void 0 : _d2.toUpperCase()) === fwAsset.symbol.toUpperCase()) {
|
|
13140
13306
|
normalizedTokenAddress = FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS3;
|
|
13141
13307
|
}
|
|
13142
13308
|
const chainSymbol = combineChainSymbolOrAddress2({
|
|
@@ -13159,7 +13325,7 @@ function MeshOrAccountSelectAsset({
|
|
|
13159
13325
|
});
|
|
13160
13326
|
return itemMap;
|
|
13161
13327
|
}, [checkoutItem == null ? void 0 : checkoutItem.initSettings.config.targetChain, walletAssets]);
|
|
13162
|
-
|
|
13328
|
+
useEffect27(() => {
|
|
13163
13329
|
async function fetchAccountHoldings() {
|
|
13164
13330
|
var _a2;
|
|
13165
13331
|
const isMapInited = Object.keys(accountHoldingsMap).length > 0;
|
|
@@ -13202,33 +13368,33 @@ function MeshOrAccountSelectAsset({
|
|
|
13202
13368
|
return {
|
|
13203
13369
|
value: chainSymbolKey,
|
|
13204
13370
|
isDisabled: isTokenDisabled,
|
|
13205
|
-
label: /* @__PURE__ */
|
|
13371
|
+
label: /* @__PURE__ */ React137.createElement(Box, {
|
|
13206
13372
|
alignItems: "center",
|
|
13207
13373
|
display: "flex",
|
|
13208
13374
|
flexDirection: "row",
|
|
13209
13375
|
justifyContent: "space-between",
|
|
13210
13376
|
style: { fontSize: 12 },
|
|
13211
13377
|
key: chainSymbolKey
|
|
13212
|
-
}, /* @__PURE__ */
|
|
13378
|
+
}, /* @__PURE__ */ React137.createElement(Box, {
|
|
13213
13379
|
display: "flex",
|
|
13214
13380
|
justifyContent: "flex-start",
|
|
13215
13381
|
alignItems: "center",
|
|
13216
13382
|
gap: "8"
|
|
13217
|
-
}, /* @__PURE__ */
|
|
13383
|
+
}, /* @__PURE__ */ React137.createElement(FunAssetAvatar, {
|
|
13218
13384
|
assetSrc: item.iconSrc,
|
|
13219
13385
|
assetTicker: item.symbol,
|
|
13220
13386
|
assetName: item.symbol,
|
|
13221
13387
|
assetIconSize: "24",
|
|
13222
13388
|
chainId: item.pickedChainId,
|
|
13223
13389
|
chainIconSize: "10"
|
|
13224
|
-
}), /* @__PURE__ */
|
|
13390
|
+
}), /* @__PURE__ */ React137.createElement(Box, null, /* @__PURE__ */ React137.createElement("div", null, item.symbol), isNotNullish(item.amount) ? /* @__PURE__ */ React137.createElement("div", null, formatCryptoAndStringify(item.amount)) : null)), /* @__PURE__ */ React137.createElement(Box, {
|
|
13225
13391
|
display: "flex",
|
|
13226
13392
|
alignItems: "center",
|
|
13227
13393
|
justifyContent: "flex-end",
|
|
13228
13394
|
gap: "8"
|
|
13229
|
-
}, badgeText ? /* @__PURE__ */
|
|
13395
|
+
}, badgeText ? /* @__PURE__ */ React137.createElement(FunBadge, {
|
|
13230
13396
|
text: badgeText
|
|
13231
|
-
}) : null, /* @__PURE__ */
|
|
13397
|
+
}) : null, /* @__PURE__ */ React137.createElement("div", null, formatCurrencyAndStringify(item.usdAmount || 0)))),
|
|
13232
13398
|
labelMeta: item.usdAmount
|
|
13233
13399
|
};
|
|
13234
13400
|
}).sort(
|
|
@@ -13257,36 +13423,36 @@ function MeshOrAccountSelectAsset({
|
|
|
13257
13423
|
quoteNotificationMessage,
|
|
13258
13424
|
clearCheckoutQuoteMessages
|
|
13259
13425
|
} = useCheckoutQuoteNotification(checkoutId || "");
|
|
13260
|
-
const [insufficientAssetError, setInsufficientAssetError] =
|
|
13426
|
+
const [insufficientAssetError, setInsufficientAssetError] = useState37("");
|
|
13261
13427
|
const hasInsufficientAssetError = !!insufficientAssetError;
|
|
13262
|
-
|
|
13428
|
+
useEffect27(() => {
|
|
13263
13429
|
if (checkoutItem == null ? void 0 : checkoutItem.isDrafting) {
|
|
13264
13430
|
setSelectedChainTokenSymbol("");
|
|
13265
13431
|
setInsufficientAssetError("");
|
|
13266
13432
|
}
|
|
13267
13433
|
}, [checkoutItem == null ? void 0 : checkoutItem.isDrafting]);
|
|
13268
|
-
return /* @__PURE__ */
|
|
13434
|
+
return /* @__PURE__ */ React137.createElement(Box, null, /* @__PURE__ */ React137.createElement(CheckoutPrimaryInfo, {
|
|
13269
13435
|
checkoutId,
|
|
13270
13436
|
checkoutStep
|
|
13271
|
-
}), /* @__PURE__ */
|
|
13437
|
+
}), /* @__PURE__ */ React137.createElement(Box, {
|
|
13272
13438
|
display: "flex",
|
|
13273
13439
|
flexDirection: "column",
|
|
13274
13440
|
gap: "10",
|
|
13275
13441
|
paddingTop: "24"
|
|
13276
|
-
}, /* @__PURE__ */
|
|
13442
|
+
}, /* @__PURE__ */ React137.createElement(Text, {
|
|
13277
13443
|
color: "modalTextSecondary",
|
|
13278
13444
|
size: "18",
|
|
13279
13445
|
weight: "semibold"
|
|
13280
|
-
}, funkitConfig.textCustomizations.payWith)), /* @__PURE__ */
|
|
13446
|
+
}, funkitConfig.textCustomizations.payWith)), /* @__PURE__ */ React137.createElement(Box, {
|
|
13281
13447
|
paddingBottom: "24",
|
|
13282
13448
|
paddingTop: "8"
|
|
13283
|
-
}, isLoadingAssets ? /* @__PURE__ */
|
|
13449
|
+
}, isLoadingAssets ? /* @__PURE__ */ React137.createElement(Box, {
|
|
13284
13450
|
display: "flex",
|
|
13285
13451
|
flexDirection: "column",
|
|
13286
13452
|
gap: "10"
|
|
13287
|
-
}, /* @__PURE__ */
|
|
13453
|
+
}, /* @__PURE__ */ React137.createElement(SkeletalLoader, {
|
|
13288
13454
|
key: "skeletal-loader"
|
|
13289
|
-
})) : /* @__PURE__ */
|
|
13455
|
+
})) : /* @__PURE__ */ React137.createElement(FunSelectDropdown, {
|
|
13290
13456
|
handleSelect: (newValue) => {
|
|
13291
13457
|
setSelectedChainTokenSymbol(newValue);
|
|
13292
13458
|
clearCheckoutQuoteMessages();
|
|
@@ -13305,20 +13471,20 @@ function MeshOrAccountSelectAsset({
|
|
|
13305
13471
|
selectedValue: selectedChainTokenSymbol || "",
|
|
13306
13472
|
optionItemPadding: "12",
|
|
13307
13473
|
showBorder: false
|
|
13308
|
-
})), hasInsufficientAssetError || showQuoteNotification ? /* @__PURE__ */
|
|
13474
|
+
})), hasInsufficientAssetError || showQuoteNotification ? /* @__PURE__ */ React137.createElement(Box, {
|
|
13309
13475
|
paddingBottom: "24"
|
|
13310
|
-
}, /* @__PURE__ */
|
|
13476
|
+
}, /* @__PURE__ */ React137.createElement(FunNotification, {
|
|
13311
13477
|
type: hasQuoteError ? "error" : "default",
|
|
13312
13478
|
description: quoteNotificationMessage || insufficientAssetError
|
|
13313
|
-
})) : null, /* @__PURE__ */
|
|
13479
|
+
})) : null, /* @__PURE__ */ React137.createElement(FunButton, {
|
|
13314
13480
|
type: "primary",
|
|
13315
13481
|
title: "Continue",
|
|
13316
13482
|
isDisabled: !selectedChainTokenSymbol || hasInsufficientAssetError || (checkoutItem == null ? void 0 : checkoutItem.isDrafting) || showQuoteNotification || isOnFinishLoading,
|
|
13317
|
-
titleSuffix: isOnFinishLoading ? /* @__PURE__ */
|
|
13483
|
+
titleSuffix: isOnFinishLoading ? /* @__PURE__ */ React137.createElement(Box, {
|
|
13318
13484
|
display: "flex",
|
|
13319
13485
|
alignItems: "center",
|
|
13320
13486
|
color: "modalText"
|
|
13321
|
-
}, /* @__PURE__ */
|
|
13487
|
+
}, /* @__PURE__ */ React137.createElement(SpinnerIcon, {
|
|
13322
13488
|
height: 16,
|
|
13323
13489
|
width: 16
|
|
13324
13490
|
})) : null,
|
|
@@ -13334,7 +13500,7 @@ function FunCheckoutSelectAssetStep({
|
|
|
13334
13500
|
}) {
|
|
13335
13501
|
var _a, _b;
|
|
13336
13502
|
const { checkoutItem } = useFunkitPreCheckoutInternal(checkoutId);
|
|
13337
|
-
return /* @__PURE__ */
|
|
13503
|
+
return /* @__PURE__ */ React137.createElement(Box, {
|
|
13338
13504
|
display: "flex",
|
|
13339
13505
|
flexDirection: "column",
|
|
13340
13506
|
gap: "24",
|
|
@@ -13342,18 +13508,18 @@ function FunCheckoutSelectAssetStep({
|
|
|
13342
13508
|
className: animateOut ? animateContentOutClass : animateContentInClass
|
|
13343
13509
|
}, isNotNullish((_a = checkoutItem == null ? void 0 : checkoutItem.selectedPaymentMethodInfo) == null ? void 0 : _a.paymentMethod) && ["brokerage" /* BROKERAGE */, "balance" /* ACCOUNT_BALANCE */].includes(
|
|
13344
13510
|
(_b = checkoutItem == null ? void 0 : checkoutItem.selectedPaymentMethodInfo) == null ? void 0 : _b.paymentMethod
|
|
13345
|
-
) ? /* @__PURE__ */
|
|
13511
|
+
) ? /* @__PURE__ */ React137.createElement(MeshOrAccountSelectAsset, {
|
|
13346
13512
|
isOnFinishLoading,
|
|
13347
13513
|
onFinish,
|
|
13348
13514
|
checkoutId,
|
|
13349
13515
|
checkoutStep
|
|
13350
|
-
}) : /* @__PURE__ */
|
|
13516
|
+
}) : /* @__PURE__ */ React137.createElement(Text, {
|
|
13351
13517
|
color: "modalTextSecondary"
|
|
13352
13518
|
}, "Unsupported payment method"));
|
|
13353
13519
|
}
|
|
13354
13520
|
|
|
13355
13521
|
// src/components/FunCheckoutModal/FunCheckoutVerifyDetailsStep.tsx
|
|
13356
|
-
import
|
|
13522
|
+
import React138 from "react";
|
|
13357
13523
|
function FunCheckoutVerifyDetailsStep({
|
|
13358
13524
|
checkoutId,
|
|
13359
13525
|
checkoutStep,
|
|
@@ -13361,16 +13527,16 @@ function FunCheckoutVerifyDetailsStep({
|
|
|
13361
13527
|
}) {
|
|
13362
13528
|
const { checkoutItem } = useFunkitPreCheckoutInternal(checkoutId);
|
|
13363
13529
|
const isDraftDollarValueReady = isNotNullish(checkoutItem == null ? void 0 : checkoutItem.draftDollarValue) && !(checkoutItem == null ? void 0 : checkoutItem.isDrafting);
|
|
13364
|
-
return /* @__PURE__ */
|
|
13530
|
+
return /* @__PURE__ */ React138.createElement(Box, {
|
|
13365
13531
|
display: "flex",
|
|
13366
13532
|
flexDirection: "column",
|
|
13367
13533
|
gap: "24",
|
|
13368
13534
|
paddingTop: "24",
|
|
13369
13535
|
paddingBottom: "16"
|
|
13370
|
-
}, /* @__PURE__ */
|
|
13536
|
+
}, /* @__PURE__ */ React138.createElement(CheckoutPrimaryInfo, {
|
|
13371
13537
|
checkoutId,
|
|
13372
13538
|
checkoutStep
|
|
13373
|
-
}), /* @__PURE__ */
|
|
13539
|
+
}), /* @__PURE__ */ React138.createElement(FunPaymentMethods, {
|
|
13374
13540
|
checkoutId,
|
|
13375
13541
|
paymentFlow: 1 /* CHECKOUT */,
|
|
13376
13542
|
onSelect: onSelectPaymentMethod,
|
|
@@ -13395,25 +13561,26 @@ function FunCheckoutModal({
|
|
|
13395
13561
|
}
|
|
13396
13562
|
const { textCustomizations } = useFunkitConfig();
|
|
13397
13563
|
const { accountBalancePaymentDefaultInfo, isWeb2Login } = useGeneralWallet();
|
|
13564
|
+
const userIpInfo = useFunkitMoonpayUserIp();
|
|
13398
13565
|
const { updateSourceAsset, updateSelectedPaymentMethodInfo, reDraftSymbol } = useFunkitPreCheckoutInternal(checkoutId);
|
|
13399
13566
|
const { openFunCheckoutHistoryModal } = useFunCheckoutHistoryModal();
|
|
13400
|
-
const [isSoftHidden, setIsSoftHidden] =
|
|
13401
|
-
const [animateOut, setAnimateOut] =
|
|
13567
|
+
const [isSoftHidden, setIsSoftHidden] = useState38(false);
|
|
13568
|
+
const [animateOut, setAnimateOut] = useState38(false);
|
|
13402
13569
|
const { checkoutItem, getCheckoutQuote } = useFunkitPreCheckoutInternal(
|
|
13403
13570
|
checkoutId || ""
|
|
13404
13571
|
);
|
|
13405
13572
|
const { clearCheckoutQuoteMessages } = useCheckoutQuoteNotification(
|
|
13406
13573
|
checkoutId || ""
|
|
13407
13574
|
);
|
|
13408
|
-
const [checkoutStep, setCheckoutStep] =
|
|
13575
|
+
const [checkoutStep, setCheckoutStep] = useState38(
|
|
13409
13576
|
(checkoutItem == null ? void 0 : checkoutItem.isFastForwarded) ? "confirmation" /* CONFIRMATION */ : (checkoutItem == null ? void 0 : checkoutItem.initSettings.config.targetAssetAmount) === 0 && !checkoutItem.initSettings.config.disableEditing ? "input_amount" /* INPUT_AMOUNT */ : "select_payment" /* SELECT_PAYMENT_METHOD */
|
|
13410
13577
|
);
|
|
13411
|
-
|
|
13578
|
+
useEffect28(() => {
|
|
13412
13579
|
return () => {
|
|
13413
13580
|
setCheckoutStep("select_payment" /* SELECT_PAYMENT_METHOD */);
|
|
13414
13581
|
};
|
|
13415
13582
|
}, []);
|
|
13416
|
-
|
|
13583
|
+
useEffect28(() => {
|
|
13417
13584
|
clearCheckoutQuoteMessages();
|
|
13418
13585
|
}, [checkoutStep]);
|
|
13419
13586
|
const { generateCheckoutTransferOpItems } = useCheckoutAccountBalanceTransfer(checkoutId);
|
|
@@ -13548,7 +13715,7 @@ function FunCheckoutModal({
|
|
|
13548
13715
|
},
|
|
13549
13716
|
[checkoutItem, onCloseWrapper, openFunCheckoutHistoryModal]
|
|
13550
13717
|
);
|
|
13551
|
-
const [isSourceAssetConfirming, setIsSourceAssetConfirming] =
|
|
13718
|
+
const [isSourceAssetConfirming, setIsSourceAssetConfirming] = useState38(false);
|
|
13552
13719
|
const onSourceAssetConfirmed = useCallback26(async () => {
|
|
13553
13720
|
var _a2, _b2, _c2, _d2;
|
|
13554
13721
|
try {
|
|
@@ -13573,9 +13740,9 @@ function FunCheckoutModal({
|
|
|
13573
13740
|
newPaymentMethodInfo = {
|
|
13574
13741
|
paymentMethod: "card" /* CARD */,
|
|
13575
13742
|
title: textCustomizations.debitOrCredit,
|
|
13576
|
-
titleIcon: /* @__PURE__ */
|
|
13743
|
+
titleIcon: /* @__PURE__ */ React139.createElement(CreditCardIcon, null),
|
|
13577
13744
|
description: "",
|
|
13578
|
-
descriptionIcon: /* @__PURE__ */
|
|
13745
|
+
descriptionIcon: /* @__PURE__ */ React139.createElement(CombinedCreditCardOptionsIcon, null),
|
|
13579
13746
|
meta: {}
|
|
13580
13747
|
};
|
|
13581
13748
|
} else if (selectedPaymentMethod === "brokerage" /* BROKERAGE */) {
|
|
@@ -13619,43 +13786,80 @@ function FunCheckoutModal({
|
|
|
13619
13786
|
textCustomizations.debitOrCredit
|
|
13620
13787
|
]);
|
|
13621
13788
|
const [triggerSymbol, triggerSourceAssetConfirmedFn] = useSymbolRefresh_default();
|
|
13622
|
-
|
|
13789
|
+
useEffect28(() => {
|
|
13623
13790
|
onSourceAssetConfirmed();
|
|
13624
13791
|
}, [triggerSymbol]);
|
|
13625
|
-
|
|
13792
|
+
useEffect28(() => {
|
|
13626
13793
|
if (checkoutItem && isCheckoutCrFlow && checkoutStep === "confirmation" /* CONFIRMATION */) {
|
|
13627
13794
|
onSourceAssetConfirmed();
|
|
13628
13795
|
}
|
|
13629
13796
|
}, [reDraftSymbol]);
|
|
13797
|
+
const pickSourceAssetForCard = useCallback26(async () => {
|
|
13798
|
+
var _a2;
|
|
13799
|
+
if (!(checkoutItem == null ? void 0 : checkoutItem.initSettings.config.targetChain)) {
|
|
13800
|
+
throw new Error("pickSourceAssetForCard: Missing targetChain");
|
|
13801
|
+
}
|
|
13802
|
+
logger.log(
|
|
13803
|
+
"pickSourceAssetForCard:begin",
|
|
13804
|
+
checkoutItem == null ? void 0 : checkoutItem.initSettings.config
|
|
13805
|
+
);
|
|
13806
|
+
const isNyOrTxOrVi = userIpInfo ? userIpInfo.alpha2 === "US" && ["NY", "TX", "VI"].includes(userIpInfo.state) : false;
|
|
13807
|
+
const isCanada = userIpInfo ? userIpInfo.alpha2 === "CA" : false;
|
|
13808
|
+
const targetChainId = checkoutItem == null ? void 0 : checkoutItem.initSettings.config.targetChain.toString();
|
|
13809
|
+
const wethAddrOnTargetChain = (await getTokenInfo2("weth", targetChainId)).toLowerCase();
|
|
13810
|
+
const isTargetAssetEthOrWeth = [NATIVE_TOKEN, wethAddrOnTargetChain].includes(
|
|
13811
|
+
(_a2 = checkoutItem == null ? void 0 : checkoutItem.initSettings) == null ? void 0 : _a2.config.targetAsset
|
|
13812
|
+
) && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7[targetChainId].nativeCurrency.symbol === "ETH" /* ETH */;
|
|
13813
|
+
let sourceTokenAddress;
|
|
13814
|
+
let sourceTokenTicker;
|
|
13815
|
+
let sourceTokenChainId;
|
|
13816
|
+
if (isCanada) {
|
|
13817
|
+
sourceTokenTicker = "ETH" /* ETH */;
|
|
13818
|
+
sourceTokenAddress = NATIVE_TOKEN;
|
|
13819
|
+
sourceTokenChainId = targetChainId;
|
|
13820
|
+
} else {
|
|
13821
|
+
sourceTokenChainId = isNyOrTxOrVi ? mainnet3.id.toString() : targetChainId;
|
|
13822
|
+
if (isTargetAssetEthOrWeth) {
|
|
13823
|
+
sourceTokenTicker = "ETH" /* ETH */;
|
|
13824
|
+
sourceTokenAddress = NATIVE_TOKEN;
|
|
13825
|
+
} else {
|
|
13826
|
+
sourceTokenTicker = "USDC" /* USDC */;
|
|
13827
|
+
sourceTokenAddress = await getTokenAddress(
|
|
13828
|
+
"USDC" /* USDC */,
|
|
13829
|
+
sourceTokenChainId
|
|
13830
|
+
);
|
|
13831
|
+
}
|
|
13832
|
+
}
|
|
13833
|
+
logger.log("pickSourceAssetForCard:result", {
|
|
13834
|
+
targetAssetInfo: checkoutItem == null ? void 0 : checkoutItem.initSettings.config,
|
|
13835
|
+
isNyOrTxOrVi,
|
|
13836
|
+
isCanada,
|
|
13837
|
+
isTargetAssetEthOrWeth,
|
|
13838
|
+
sourceTokenAddress,
|
|
13839
|
+
sourceTokenChainId,
|
|
13840
|
+
sourceTokenTicker
|
|
13841
|
+
});
|
|
13842
|
+
return {
|
|
13843
|
+
pickedSourceTokenAddress: sourceTokenAddress,
|
|
13844
|
+
pickedSourceTokenTicker: sourceTokenTicker,
|
|
13845
|
+
pickedSourceTokenChainId: sourceTokenChainId
|
|
13846
|
+
};
|
|
13847
|
+
}, [checkoutItem == null ? void 0 : checkoutItem.initSettings.config, userIpInfo]);
|
|
13630
13848
|
const onSelectPaymentMethod = useCallback26(
|
|
13631
13849
|
async (partialPaymentMethodInfo) => {
|
|
13632
|
-
var _a2;
|
|
13633
13850
|
updateSelectedPaymentMethodInfo(partialPaymentMethodInfo);
|
|
13634
13851
|
if (partialPaymentMethodInfo.paymentMethod === "balance" /* ACCOUNT_BALANCE */) {
|
|
13635
13852
|
setCheckoutStep("select_asset" /* SELECT_ASSET */);
|
|
13636
13853
|
} else if (partialPaymentMethodInfo.paymentMethod === "card" /* CARD */) {
|
|
13637
|
-
|
|
13638
|
-
|
|
13639
|
-
|
|
13640
|
-
|
|
13641
|
-
|
|
13642
|
-
const wethAddrOnTargetChain = (await getTokenInfo2("weth", targetChainId)).toLowerCase();
|
|
13643
|
-
if ([NATIVE_TOKEN, wethAddrOnTargetChain].includes(
|
|
13644
|
-
(_a2 = checkoutItem == null ? void 0 : checkoutItem.initSettings) == null ? void 0 : _a2.config.targetAsset
|
|
13645
|
-
) && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8[targetChainId].nativeCurrency.symbol === "ETH" /* ETH */) {
|
|
13646
|
-
sourceTokenAddress = NATIVE_TOKEN;
|
|
13647
|
-
sourceTokenTicker = "ETH" /* ETH */;
|
|
13648
|
-
} else {
|
|
13649
|
-
sourceTokenAddress = await getTokenAddress(
|
|
13650
|
-
"USDC" /* USDC */,
|
|
13651
|
-
targetChainId
|
|
13652
|
-
);
|
|
13653
|
-
sourceTokenTicker = "USDC" /* USDC */;
|
|
13654
|
-
}
|
|
13854
|
+
const {
|
|
13855
|
+
pickedSourceTokenAddress,
|
|
13856
|
+
pickedSourceTokenChainId,
|
|
13857
|
+
pickedSourceTokenTicker
|
|
13858
|
+
} = await pickSourceAssetForCard();
|
|
13655
13859
|
updateSourceAsset(
|
|
13656
|
-
|
|
13657
|
-
|
|
13658
|
-
|
|
13860
|
+
pickedSourceTokenAddress,
|
|
13861
|
+
pickedSourceTokenTicker,
|
|
13862
|
+
pickedSourceTokenChainId
|
|
13659
13863
|
);
|
|
13660
13864
|
triggerSourceAssetConfirmedFn();
|
|
13661
13865
|
} else {
|
|
@@ -13663,8 +13867,7 @@ function FunCheckoutModal({
|
|
|
13663
13867
|
}
|
|
13664
13868
|
},
|
|
13665
13869
|
[
|
|
13666
|
-
|
|
13667
|
-
checkoutItem == null ? void 0 : checkoutItem.initSettings.config.targetChain,
|
|
13870
|
+
pickSourceAssetForCard,
|
|
13668
13871
|
triggerSourceAssetConfirmedFn,
|
|
13669
13872
|
updateSelectedPaymentMethodInfo,
|
|
13670
13873
|
updateSourceAsset
|
|
@@ -13674,35 +13877,35 @@ function FunCheckoutModal({
|
|
|
13674
13877
|
const meshAccessInfo = meshMeta == null ? void 0 : meshMeta.accessToken;
|
|
13675
13878
|
const meshPreviewResult = (_i = meshMeta == null ? void 0 : meshMeta.previewTransfer) == null ? void 0 : _i.previewResult;
|
|
13676
13879
|
const meshPreviewExpirationMs = meshMeta == null ? void 0 : meshMeta.computedPreviewExpirationMs;
|
|
13677
|
-
return /* @__PURE__ */
|
|
13880
|
+
return /* @__PURE__ */ React139.createElement(Dialog, {
|
|
13678
13881
|
open,
|
|
13679
13882
|
onClose: onCloseWrapper,
|
|
13680
13883
|
titleId: "fun-checkout-modal",
|
|
13681
13884
|
isHidden: isSoftHidden
|
|
13682
|
-
}, /* @__PURE__ */
|
|
13885
|
+
}, /* @__PURE__ */ React139.createElement(DialogContent, {
|
|
13683
13886
|
bottomSheetOnMobile: true,
|
|
13684
13887
|
padding: "0"
|
|
13685
|
-
}, /* @__PURE__ */
|
|
13888
|
+
}, /* @__PURE__ */ React139.createElement(Box, {
|
|
13686
13889
|
paddingTop: "20",
|
|
13687
13890
|
paddingX: "20"
|
|
13688
|
-
}, /* @__PURE__ */
|
|
13891
|
+
}, /* @__PURE__ */ React139.createElement(FunModalTitleSection, {
|
|
13689
13892
|
hasBackButton: titleConfig.hasBack,
|
|
13690
13893
|
onBack: titleConfig.onBack,
|
|
13691
13894
|
title: titleConfig.title,
|
|
13692
13895
|
hasCloseButton: true,
|
|
13693
13896
|
onClose: onCloseWrapper
|
|
13694
|
-
}), checkoutStep === "input_amount" /* INPUT_AMOUNT */ ? /* @__PURE__ */
|
|
13897
|
+
}), checkoutStep === "input_amount" /* INPUT_AMOUNT */ ? /* @__PURE__ */ React139.createElement(FunCheckoutInputAmountStep, {
|
|
13695
13898
|
checkoutId: checkoutId || "",
|
|
13696
13899
|
onContinue: () => setCheckoutStep("select_payment" /* SELECT_PAYMENT_METHOD */),
|
|
13697
13900
|
animateOut
|
|
13698
|
-
}) : checkoutStep === "select_payment" /* SELECT_PAYMENT_METHOD */ ? /* @__PURE__ */
|
|
13901
|
+
}) : checkoutStep === "select_payment" /* SELECT_PAYMENT_METHOD */ ? /* @__PURE__ */ React139.createElement(FunCheckoutVerifyDetailsStep, {
|
|
13699
13902
|
checkoutId,
|
|
13700
13903
|
checkoutStep,
|
|
13701
13904
|
onSelectPaymentMethod
|
|
13702
|
-
}) : checkoutStep === "payment_setup" /* PAYMENT_SETUP */ ? /* @__PURE__ */
|
|
13905
|
+
}) : checkoutStep === "payment_setup" /* PAYMENT_SETUP */ ? /* @__PURE__ */ React139.createElement(Box, {
|
|
13703
13906
|
paddingY: "24",
|
|
13704
13907
|
width: "full"
|
|
13705
|
-
}, /* @__PURE__ */
|
|
13908
|
+
}, /* @__PURE__ */ React139.createElement(FunPaymentSetup, {
|
|
13706
13909
|
key: checkoutStep,
|
|
13707
13910
|
paymentFlow: 1 /* CHECKOUT */,
|
|
13708
13911
|
paymentAddress: checkoutItem == null ? void 0 : checkoutItem.depositAddress,
|
|
@@ -13721,13 +13924,13 @@ function FunCheckoutModal({
|
|
|
13721
13924
|
redirectToCheckoutHistory,
|
|
13722
13925
|
isParentLoading: !!(checkoutItem == null ? void 0 : checkoutItem.isDrafting),
|
|
13723
13926
|
finalConvertedAssetName: checkoutItem == null ? void 0 : checkoutItem.initSettings.config.checkoutItemTitle
|
|
13724
|
-
})) : checkoutStep === "select_asset" /* SELECT_ASSET */ ? /* @__PURE__ */
|
|
13927
|
+
})) : checkoutStep === "select_asset" /* SELECT_ASSET */ ? /* @__PURE__ */ React139.createElement(FunCheckoutSelectAssetStep, {
|
|
13725
13928
|
checkoutId,
|
|
13726
13929
|
checkoutStep,
|
|
13727
13930
|
isOnFinishLoading: isSourceAssetConfirming,
|
|
13728
13931
|
onFinish: triggerSourceAssetConfirmedFn,
|
|
13729
13932
|
animateOut
|
|
13730
|
-
}) : checkoutStep === "confirmation" /* CONFIRMATION */ ? /* @__PURE__ */
|
|
13933
|
+
}) : checkoutStep === "confirmation" /* CONFIRMATION */ ? /* @__PURE__ */ React139.createElement(FunCheckoutConfirmationStep, {
|
|
13731
13934
|
checkoutId,
|
|
13732
13935
|
checkoutStep,
|
|
13733
13936
|
regenerateQuoteFn: triggerSourceAssetConfirmedFn,
|
|
@@ -13743,9 +13946,9 @@ function FunCheckoutModal({
|
|
|
13743
13946
|
}
|
|
13744
13947
|
},
|
|
13745
13948
|
animateOut
|
|
13746
|
-
}) : checkoutStep === "mesh_verification" /* MESH_VERIFICATION */ ? /* @__PURE__ */
|
|
13949
|
+
}) : checkoutStep === "mesh_verification" /* MESH_VERIFICATION */ ? /* @__PURE__ */ React139.createElement(Box, {
|
|
13747
13950
|
paddingY: "24"
|
|
13748
|
-
}, /* @__PURE__ */
|
|
13951
|
+
}, /* @__PURE__ */ React139.createElement(FunMeshVerificationStep, {
|
|
13749
13952
|
previewId: meshPreviewResult == null ? void 0 : meshPreviewResult.previewId,
|
|
13750
13953
|
previewExpirationMs: meshPreviewExpirationMs,
|
|
13751
13954
|
transferToAddress: meshPreviewResult == null ? void 0 : meshPreviewResult.toAddress,
|
|
@@ -13774,8 +13977,8 @@ function CheckoutPrimaryInfoSnapshot({
|
|
|
13774
13977
|
const showCheckoutItemAmount = isEditable || isNotNullish(checkoutConfig == null ? void 0 : checkoutConfig.checkoutItemAmount) && checkoutConfig.checkoutItemAmount > 0;
|
|
13775
13978
|
const checkoutItemAmountRaw = (checkoutConfig == null ? void 0 : checkoutConfig.checkoutItemAmount) || 0;
|
|
13776
13979
|
const checkoutItemAmountFormatted = showCheckoutItemAmount ? formatCryptoAndStringify(checkoutItemAmountRaw) : FALLBACK_CHECKOUT_ITEM_AMOUNT;
|
|
13777
|
-
const [isEditing, setIsEditing] =
|
|
13778
|
-
const [editedValue, setEditedValue] =
|
|
13980
|
+
const [isEditing, setIsEditing] = useState39(false);
|
|
13981
|
+
const [editedValue, setEditedValue] = useState39(
|
|
13779
13982
|
checkoutItemAmountRaw.toString()
|
|
13780
13983
|
);
|
|
13781
13984
|
const hasInputError = useMemo31(() => {
|
|
@@ -13789,25 +13992,25 @@ function CheckoutPrimaryInfoSnapshot({
|
|
|
13789
13992
|
}
|
|
13790
13993
|
}
|
|
13791
13994
|
}, [editedValue, hasInputError, isEditable, isEditing, onConfirmEdit]);
|
|
13792
|
-
return /* @__PURE__ */
|
|
13995
|
+
return /* @__PURE__ */ React140.createElement(Box, {
|
|
13793
13996
|
display: "flex",
|
|
13794
13997
|
gap: "12",
|
|
13795
13998
|
borderRadius: "menuButton",
|
|
13796
13999
|
background: "notificationPrimary",
|
|
13797
14000
|
padding: "14"
|
|
13798
|
-
}, (checkoutConfig == null ? void 0 : checkoutConfig.iconSrc) ? /* @__PURE__ */
|
|
14001
|
+
}, (checkoutConfig == null ? void 0 : checkoutConfig.iconSrc) ? /* @__PURE__ */ React140.createElement(FunAssetAvatar, {
|
|
13799
14002
|
assetSrc: checkoutConfig.iconSrc,
|
|
13800
14003
|
assetName: "checkout-asset",
|
|
13801
14004
|
assetIconSize: "50",
|
|
13802
14005
|
chainId: checkoutConfig.targetChain,
|
|
13803
14006
|
chainIconSize: "16",
|
|
13804
14007
|
prioritizeDefaults: false
|
|
13805
|
-
}) : null, /* @__PURE__ */
|
|
14008
|
+
}) : null, /* @__PURE__ */ React140.createElement(Box, {
|
|
13806
14009
|
display: "flex",
|
|
13807
14010
|
flexDirection: "column",
|
|
13808
14011
|
gap: "6",
|
|
13809
14012
|
width: "full"
|
|
13810
|
-
}, /* @__PURE__ */
|
|
14013
|
+
}, /* @__PURE__ */ React140.createElement(FunKeyValue, {
|
|
13811
14014
|
keyText: checkoutConfig.checkoutItemTitle,
|
|
13812
14015
|
keyTextColor: "modalText",
|
|
13813
14016
|
keyTextSize: "18",
|
|
@@ -13815,7 +14018,7 @@ function CheckoutPrimaryInfoSnapshot({
|
|
|
13815
14018
|
valueText: isLoading ? "" : `${formatCurrencyAndStringify(
|
|
13816
14019
|
(checkoutItem == null ? void 0 : checkoutItem.draftDollarValue) || 0
|
|
13817
14020
|
)} USD`,
|
|
13818
|
-
valueIcon: isLoading ? /* @__PURE__ */
|
|
14021
|
+
valueIcon: isLoading ? /* @__PURE__ */ React140.createElement(SpinnerIcon, {
|
|
13819
14022
|
height: 16,
|
|
13820
14023
|
width: 16
|
|
13821
14024
|
}) : void 0,
|
|
@@ -13825,15 +14028,15 @@ function CheckoutPrimaryInfoSnapshot({
|
|
|
13825
14028
|
hasBorder: false,
|
|
13826
14029
|
paddingY: "0",
|
|
13827
14030
|
paddingX: "0"
|
|
13828
|
-
}), showCheckoutItemDescription || showCheckoutItemAmount ? /* @__PURE__ */
|
|
14031
|
+
}), showCheckoutItemDescription || showCheckoutItemAmount ? /* @__PURE__ */ React140.createElement(FunKeyValue, {
|
|
13829
14032
|
keyText: (checkoutConfig == null ? void 0 : checkoutConfig.checkoutItemDescription) || FALLBACK_CHECKOUT_ITEM_DESCRIPTION,
|
|
13830
14033
|
keyTextSize: "14",
|
|
13831
14034
|
keyTextColor: "modalTextDim",
|
|
13832
14035
|
keyTextWeight: "medium",
|
|
13833
|
-
valueIcon: isEditable ? /* @__PURE__ */
|
|
13834
|
-
icon: isEditing ? /* @__PURE__ */
|
|
14036
|
+
valueIcon: isEditable ? /* @__PURE__ */ React140.createElement(FunIconButton, {
|
|
14037
|
+
icon: isEditing ? /* @__PURE__ */ React140.createElement(CopiedIcon, {
|
|
13835
14038
|
size: "10"
|
|
13836
|
-
}) : /* @__PURE__ */
|
|
14039
|
+
}) : /* @__PURE__ */ React140.createElement(EditIcon, null),
|
|
13837
14040
|
size: "14",
|
|
13838
14041
|
showBorder: false,
|
|
13839
14042
|
onClick: handleEditInputConfirm,
|
|
@@ -13848,7 +14051,7 @@ function CheckoutPrimaryInfoSnapshot({
|
|
|
13848
14051
|
valueTextWeight: "medium",
|
|
13849
14052
|
valueGap: "4",
|
|
13850
14053
|
reverseValueItems: true,
|
|
13851
|
-
customValueComponent: isEditing ? /* @__PURE__ */
|
|
14054
|
+
customValueComponent: isEditing ? /* @__PURE__ */ React140.createElement(FunInput, {
|
|
13852
14055
|
value: editedValue,
|
|
13853
14056
|
onChange: (e) => {
|
|
13854
14057
|
var _a;
|
|
@@ -13875,12 +14078,12 @@ function CheckoutPrimaryInfoSnapshot({
|
|
|
13875
14078
|
inputProps: { autoFocus: true },
|
|
13876
14079
|
error: hasInputError,
|
|
13877
14080
|
overrideBorderWidth: "1"
|
|
13878
|
-
}) : isEditable ? /* @__PURE__ */
|
|
14081
|
+
}) : isEditable ? /* @__PURE__ */ React140.createElement(Box, {
|
|
13879
14082
|
height: "max",
|
|
13880
14083
|
flexDirection: "row",
|
|
13881
14084
|
style: { cursor: "pointer" },
|
|
13882
14085
|
onClick: () => setIsEditing(true)
|
|
13883
|
-
}, /* @__PURE__ */
|
|
14086
|
+
}, /* @__PURE__ */ React140.createElement(Text, {
|
|
13884
14087
|
weight: "medium",
|
|
13885
14088
|
color: { base: "modalTextDim", hover: "accentColor" },
|
|
13886
14089
|
size: "14"
|
|
@@ -13903,8 +14106,8 @@ function CheckoutPrimaryInfo({
|
|
|
13903
14106
|
clearCheckoutQuoteMessages
|
|
13904
14107
|
} = useFunkitPreCheckoutInternal(checkoutId);
|
|
13905
14108
|
const { isCheckoutCrFlow } = useCheckoutType(checkoutItem);
|
|
13906
|
-
const [isForceRefresh, setIsForceRefresh] =
|
|
13907
|
-
|
|
14109
|
+
const [isForceRefresh, setIsForceRefresh] = useState39(false);
|
|
14110
|
+
useEffect29(() => {
|
|
13908
14111
|
if (isForceRefresh || !isNotNullish(checkoutItem == null ? void 0 : checkoutItem.draftDollarValue)) {
|
|
13909
14112
|
setIsForceRefresh(false);
|
|
13910
14113
|
getCheckoutDraftDollarValue().catch(
|
|
@@ -13918,7 +14121,7 @@ function CheckoutPrimaryInfo({
|
|
|
13918
14121
|
const isCheckoutTargetAssetEditable = isCheckoutCrFlow && !(checkoutStep === "confirmation" /* CONFIRMATION */ && ((_c = checkoutItem == null ? void 0 : checkoutItem.selectedPaymentMethodInfo) == null ? void 0 : _c.paymentMethod) && ["brokerage" /* BROKERAGE */, "balance" /* ACCOUNT_BALANCE */].includes(
|
|
13919
14122
|
checkoutItem == null ? void 0 : checkoutItem.selectedPaymentMethodInfo.paymentMethod
|
|
13920
14123
|
)) && !(checkoutItem == null ? void 0 : checkoutItem.initSettings.config.disableEditing);
|
|
13921
|
-
return checkoutItem ? /* @__PURE__ */
|
|
14124
|
+
return checkoutItem ? /* @__PURE__ */ React140.createElement(CheckoutPrimaryInfoSnapshot, {
|
|
13922
14125
|
isLoading: checkoutItem.isDrafting,
|
|
13923
14126
|
checkoutItem,
|
|
13924
14127
|
isEditable: isCheckoutTargetAssetEditable,
|
|
@@ -13965,8 +14168,8 @@ function FunCheckoutHistoryDetail({
|
|
|
13965
14168
|
};
|
|
13966
14169
|
}, [checkoutHistoryInfo.createdTimeMs, checkoutItem]);
|
|
13967
14170
|
const timelineLabels = useMemo32(() => {
|
|
13968
|
-
const fromExplorerInfo =
|
|
13969
|
-
const toExplorerInfo =
|
|
14171
|
+
const fromExplorerInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8[checkoutHistoryInfo.fromChainId].explorerInfo;
|
|
14172
|
+
const toExplorerInfo = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8[checkoutHistoryInfo.toChainId].explorerInfo;
|
|
13970
14173
|
return [
|
|
13971
14174
|
{
|
|
13972
14175
|
text: "Order Submitted",
|
|
@@ -14022,7 +14225,7 @@ function FunCheckoutHistoryDetail({
|
|
|
14022
14225
|
isCompleted
|
|
14023
14226
|
]);
|
|
14024
14227
|
const GetHelpButton = ({ text = "Get Help \u{1F449}" }) => {
|
|
14025
|
-
return /* @__PURE__ */
|
|
14228
|
+
return /* @__PURE__ */ React141.createElement(FunLinkButton, {
|
|
14026
14229
|
hasPadding: false,
|
|
14027
14230
|
text,
|
|
14028
14231
|
textProps: {
|
|
@@ -14033,56 +14236,56 @@ function FunCheckoutHistoryDetail({
|
|
|
14033
14236
|
onClick: () => setCurrentPage("help" /* HELP */)
|
|
14034
14237
|
});
|
|
14035
14238
|
};
|
|
14036
|
-
return /* @__PURE__ */
|
|
14239
|
+
return /* @__PURE__ */ React141.createElement(Box, {
|
|
14037
14240
|
display: "flex",
|
|
14038
14241
|
flexDirection: "column",
|
|
14039
14242
|
gap: "24",
|
|
14040
14243
|
paddingY: "24",
|
|
14041
14244
|
className: animateOut ? animateContentOutClass : animateContentInClass
|
|
14042
|
-
}, /* @__PURE__ */
|
|
14245
|
+
}, /* @__PURE__ */ React141.createElement(Box, {
|
|
14043
14246
|
display: "flex",
|
|
14044
14247
|
flexDirection: "column",
|
|
14045
14248
|
gap: "24",
|
|
14046
14249
|
style: { opacity: isFailedFinal ? 0.5 : 1 }
|
|
14047
|
-
}, /* @__PURE__ */
|
|
14250
|
+
}, /* @__PURE__ */ React141.createElement(CheckoutPrimaryInfoSnapshot, {
|
|
14048
14251
|
checkoutItem,
|
|
14049
14252
|
isLoading: false,
|
|
14050
14253
|
isEditable: false
|
|
14051
|
-
}), isTerminal ? null : /* @__PURE__ */
|
|
14254
|
+
}), isTerminal ? null : /* @__PURE__ */ React141.createElement(FunNotification, {
|
|
14052
14255
|
description: isCheckoutDirectCrFlow ? "Funds may take up to 10 minutes to arrive." : "We are currently processing your order."
|
|
14053
|
-
}), /* @__PURE__ */
|
|
14256
|
+
}), /* @__PURE__ */ React141.createElement(FunVerticalProgressBar, {
|
|
14054
14257
|
step: isCheckoutDirectCrFlow ? 2 : isTerminal ? 3 : 2,
|
|
14055
14258
|
totalSteps: timelineLabels.length,
|
|
14056
14259
|
labels: timelineLabels
|
|
14057
|
-
})), isFailedFinal ? /* @__PURE__ */
|
|
14260
|
+
})), isFailedFinal ? /* @__PURE__ */ React141.createElement(FunToast, {
|
|
14058
14261
|
type: 1 /* ERROR */,
|
|
14059
14262
|
title: "Order Failed",
|
|
14060
14263
|
isDescriptionText: false,
|
|
14061
|
-
description: /* @__PURE__ */
|
|
14264
|
+
description: /* @__PURE__ */ React141.createElement(Text, {
|
|
14062
14265
|
size: "12",
|
|
14063
14266
|
weight: "medium",
|
|
14064
14267
|
color: "modalTextDim"
|
|
14065
|
-
}, "A problem occurred processing your order. We are actively working to resolve this. ", /* @__PURE__ */
|
|
14268
|
+
}, "A problem occurred processing your order. We are actively working to resolve this. ", /* @__PURE__ */ React141.createElement(GetHelpButton, {
|
|
14066
14269
|
text: "Get In Contact \u{1F449}"
|
|
14067
14270
|
})),
|
|
14068
14271
|
hideTitleSuffix: true
|
|
14069
|
-
}) : /* @__PURE__ */
|
|
14272
|
+
}) : /* @__PURE__ */ React141.createElement(Box, {
|
|
14070
14273
|
display: "flex",
|
|
14071
14274
|
flexDirection: "column",
|
|
14072
14275
|
alignItems: "center",
|
|
14073
14276
|
justifyContent: "center"
|
|
14074
|
-
}, /* @__PURE__ */
|
|
14277
|
+
}, /* @__PURE__ */ React141.createElement(Text, {
|
|
14075
14278
|
size: "12",
|
|
14076
14279
|
color: "modalTextDim"
|
|
14077
|
-
}, "Experiencing problems? ", /* @__PURE__ */
|
|
14280
|
+
}, "Experiencing problems? ", /* @__PURE__ */ React141.createElement(GetHelpButton, null))));
|
|
14078
14281
|
}
|
|
14079
14282
|
|
|
14080
14283
|
// src/components/FunCheckoutHistoryModal/FunCheckoutHistoryHelp.tsx
|
|
14081
14284
|
import { sendSupportMessage } from "@funkit/core";
|
|
14082
|
-
import
|
|
14285
|
+
import React143, { useMemo as useMemo33, useState as useState40 } from "react";
|
|
14083
14286
|
|
|
14084
14287
|
// src/components/FunInput/FunTextAreaInput.tsx
|
|
14085
|
-
import
|
|
14288
|
+
import React142 from "react";
|
|
14086
14289
|
function FunTextAreaInput({
|
|
14087
14290
|
placeholder,
|
|
14088
14291
|
value,
|
|
@@ -14100,19 +14303,19 @@ function FunTextAreaInput({
|
|
|
14100
14303
|
focused: _focused,
|
|
14101
14304
|
overrideBorderWidth
|
|
14102
14305
|
}) {
|
|
14103
|
-
const [focused, setFocused] =
|
|
14306
|
+
const [focused, setFocused] = React142.useState(false);
|
|
14104
14307
|
const onFocus = () => setFocused(true);
|
|
14105
14308
|
const onBlur = () => setFocused(false);
|
|
14106
|
-
return /* @__PURE__ */
|
|
14309
|
+
return /* @__PURE__ */ React142.createElement(Box, {
|
|
14107
14310
|
color: "modalText",
|
|
14108
14311
|
display: "flex",
|
|
14109
14312
|
flexDirection: "column",
|
|
14110
14313
|
gap: "8"
|
|
14111
|
-
}, label && /* @__PURE__ */
|
|
14314
|
+
}, label && /* @__PURE__ */ React142.createElement(Text, {
|
|
14112
14315
|
color: textColor,
|
|
14113
14316
|
size: "14",
|
|
14114
14317
|
weight: "medium"
|
|
14115
|
-
}, label), /* @__PURE__ */
|
|
14318
|
+
}, label), /* @__PURE__ */ React142.createElement(Box, {
|
|
14116
14319
|
background: hasBackground ? "actionButtonSecondaryBackground" : void 0,
|
|
14117
14320
|
borderRadius: "menuButton",
|
|
14118
14321
|
fontFamily: "body",
|
|
@@ -14123,7 +14326,7 @@ function FunTextAreaInput({
|
|
|
14123
14326
|
borderColor: error ? "error" : focused && _focused ? "accentColor" : void 0,
|
|
14124
14327
|
borderWidth: overrideBorderWidth ? overrideBorderWidth : error && focused ? "2" : error ? "1" : focused && _focused ? "1" : "0",
|
|
14125
14328
|
borderStyle: "solid"
|
|
14126
|
-
}, /* @__PURE__ */
|
|
14329
|
+
}, /* @__PURE__ */ React142.createElement("textarea", {
|
|
14127
14330
|
type: (inputProps == null ? void 0 : inputProps.type) || "text",
|
|
14128
14331
|
value,
|
|
14129
14332
|
placeholder,
|
|
@@ -14147,7 +14350,7 @@ function FunTextAreaInput({
|
|
|
14147
14350
|
fontWeight: value ? "600" : "500",
|
|
14148
14351
|
...inputStyle
|
|
14149
14352
|
}
|
|
14150
|
-
})), error && typeof error === "string" && /* @__PURE__ */
|
|
14353
|
+
})), error && typeof error === "string" && /* @__PURE__ */ React142.createElement(Text, {
|
|
14151
14354
|
color: "error",
|
|
14152
14355
|
size: "14",
|
|
14153
14356
|
weight: "medium"
|
|
@@ -14174,7 +14377,7 @@ var RESOLUTION_OPTIONS = [
|
|
|
14174
14377
|
];
|
|
14175
14378
|
var RESOLUTION_OPTIONS_FORMATTED = RESOLUTION_OPTIONS.map((item) => {
|
|
14176
14379
|
const newItem = { ...item };
|
|
14177
|
-
newItem.label = /* @__PURE__ */
|
|
14380
|
+
newItem.label = /* @__PURE__ */ React143.createElement(Text, {
|
|
14178
14381
|
color: "modalText",
|
|
14179
14382
|
size: "14",
|
|
14180
14383
|
weight: "semibold"
|
|
@@ -14191,13 +14394,13 @@ function FunCheckoutHistoryHelp({
|
|
|
14191
14394
|
const { appName, apiKey } = useFunkitConfig();
|
|
14192
14395
|
const { userInfo } = useGeneralWallet();
|
|
14193
14396
|
const { showToast } = useFunToast();
|
|
14194
|
-
const [isSubmitting, setIsSubmitting] =
|
|
14195
|
-
const [emailInput, setEmailInput] =
|
|
14196
|
-
const [subjectInput, setSubjectInput] =
|
|
14197
|
-
const [resolutionInput, setResolutionInput] =
|
|
14397
|
+
const [isSubmitting, setIsSubmitting] = useState40(false);
|
|
14398
|
+
const [emailInput, setEmailInput] = useState40("");
|
|
14399
|
+
const [subjectInput, setSubjectInput] = useState40("");
|
|
14400
|
+
const [resolutionInput, setResolutionInput] = useState40(
|
|
14198
14401
|
RESOLUTION_OPTIONS[0].value
|
|
14199
14402
|
);
|
|
14200
|
-
const [descriptionInput, setDescriptionInput] =
|
|
14403
|
+
const [descriptionInput, setDescriptionInput] = useState40("");
|
|
14201
14404
|
const isEmailInputValid = useMemo33(() => {
|
|
14202
14405
|
return validateEmailString(emailInput);
|
|
14203
14406
|
}, [emailInput]);
|
|
@@ -14235,7 +14438,7 @@ function FunCheckoutHistoryHelp({
|
|
|
14235
14438
|
|
|
14236
14439
|
App ID: ${apiKey}
|
|
14237
14440
|
|
|
14238
|
-
User ID: ${userInfo.
|
|
14441
|
+
User ID: ${userInfo.globalFunkitUserId}
|
|
14239
14442
|
|
|
14240
14443
|
=========================
|
|
14241
14444
|
|
|
@@ -14288,7 +14491,7 @@ function FunCheckoutHistoryHelp({
|
|
|
14288
14491
|
setIsSubmitting(false);
|
|
14289
14492
|
}
|
|
14290
14493
|
};
|
|
14291
|
-
return /* @__PURE__ */
|
|
14494
|
+
return /* @__PURE__ */ React143.createElement(Box, {
|
|
14292
14495
|
display: "flex",
|
|
14293
14496
|
flexDirection: "column",
|
|
14294
14497
|
gap: "24",
|
|
@@ -14298,26 +14501,26 @@ function FunCheckoutHistoryHelp({
|
|
|
14298
14501
|
animateOut ? animateContentOutClass : animateContentInClass
|
|
14299
14502
|
],
|
|
14300
14503
|
style: { maxHeight: 500, overflow: "auto" }
|
|
14301
|
-
}, /* @__PURE__ */
|
|
14504
|
+
}, /* @__PURE__ */ React143.createElement(Box, {
|
|
14302
14505
|
display: "flex",
|
|
14303
14506
|
flexDirection: "column",
|
|
14304
14507
|
gap: "10"
|
|
14305
|
-
}, /* @__PURE__ */
|
|
14508
|
+
}, /* @__PURE__ */ React143.createElement(Text, {
|
|
14306
14509
|
color: "modalText",
|
|
14307
14510
|
size: "18",
|
|
14308
14511
|
weight: "heavy"
|
|
14309
|
-
}, "Tell us what's wrong"), /* @__PURE__ */
|
|
14512
|
+
}, "Tell us what's wrong"), /* @__PURE__ */ React143.createElement(Text, {
|
|
14310
14513
|
color: "modalTextSecondary",
|
|
14311
14514
|
size: "14",
|
|
14312
14515
|
weight: "medium"
|
|
14313
|
-
}, "If you're experiencing an issue or have a question, please fill out the form below and our support team will get back to you as soon as possible.")), /* @__PURE__ */
|
|
14516
|
+
}, "If you're experiencing an issue or have a question, please fill out the form below and our support team will get back to you as soon as possible.")), /* @__PURE__ */ React143.createElement(FunInput, {
|
|
14314
14517
|
inputProps: { disabled: true },
|
|
14315
14518
|
inputStyle: { fontSize: 14 },
|
|
14316
14519
|
label: "Checkout ID",
|
|
14317
14520
|
placeholder: checkoutHistoryInfo.depositAddr,
|
|
14318
14521
|
value: "",
|
|
14319
14522
|
onChange: () => void 0
|
|
14320
|
-
}), /* @__PURE__ */
|
|
14523
|
+
}), /* @__PURE__ */ React143.createElement(FunInput, {
|
|
14321
14524
|
label: "Your Email*",
|
|
14322
14525
|
inputStyle: { fontSize: 14 },
|
|
14323
14526
|
placeholder: "",
|
|
@@ -14326,7 +14529,7 @@ function FunCheckoutHistoryHelp({
|
|
|
14326
14529
|
var _a;
|
|
14327
14530
|
return setEmailInput((_a = e == null ? void 0 : e.target) == null ? void 0 : _a.value);
|
|
14328
14531
|
}
|
|
14329
|
-
}), /* @__PURE__ */
|
|
14532
|
+
}), /* @__PURE__ */ React143.createElement(FunInput, {
|
|
14330
14533
|
label: "Subject*",
|
|
14331
14534
|
inputStyle: { fontSize: 14 },
|
|
14332
14535
|
placeholder: "",
|
|
@@ -14335,7 +14538,7 @@ function FunCheckoutHistoryHelp({
|
|
|
14335
14538
|
var _a;
|
|
14336
14539
|
return setSubjectInput((_a = e == null ? void 0 : e.target) == null ? void 0 : _a.value);
|
|
14337
14540
|
}
|
|
14338
|
-
}), /* @__PURE__ */
|
|
14541
|
+
}), /* @__PURE__ */ React143.createElement(FunTextAreaInput, {
|
|
14339
14542
|
label: "Description*",
|
|
14340
14543
|
inputStyle: { fontSize: 14, fontFamily: "inherit" },
|
|
14341
14544
|
placeholder: "",
|
|
@@ -14344,21 +14547,21 @@ function FunCheckoutHistoryHelp({
|
|
|
14344
14547
|
var _a;
|
|
14345
14548
|
return setDescriptionInput((_a = e == null ? void 0 : e.target) == null ? void 0 : _a.value);
|
|
14346
14549
|
}
|
|
14347
|
-
}), /* @__PURE__ */
|
|
14550
|
+
}), /* @__PURE__ */ React143.createElement(FunSelect, {
|
|
14348
14551
|
label: "Resolution Preference*",
|
|
14349
14552
|
initValue: RESOLUTION_OPTIONS_FORMATTED[0].value,
|
|
14350
14553
|
options: RESOLUTION_OPTIONS_FORMATTED,
|
|
14351
14554
|
onChange: (newValue) => setResolutionInput(newValue),
|
|
14352
14555
|
showBorder: false
|
|
14353
|
-
}), /* @__PURE__ */
|
|
14556
|
+
}), /* @__PURE__ */ React143.createElement(FunButton, {
|
|
14354
14557
|
title: "Submit",
|
|
14355
14558
|
onClick: (e) => onSubmitIssue(e),
|
|
14356
14559
|
isDisabled: isSubmitting || !subjectInput || !descriptionInput || !emailInput || !isEmailInputValid || !resolutionInput,
|
|
14357
|
-
titleSuffix: isSubmitting ? /* @__PURE__ */
|
|
14560
|
+
titleSuffix: isSubmitting ? /* @__PURE__ */ React143.createElement(Box, {
|
|
14358
14561
|
display: "flex",
|
|
14359
14562
|
alignItems: "center",
|
|
14360
14563
|
color: "modalText"
|
|
14361
|
-
}, /* @__PURE__ */
|
|
14564
|
+
}, /* @__PURE__ */ React143.createElement(SpinnerIcon, {
|
|
14362
14565
|
height: 16,
|
|
14363
14566
|
width: 16
|
|
14364
14567
|
})) : null
|
|
@@ -14378,11 +14581,11 @@ function FunCheckoutHistoryModal({
|
|
|
14378
14581
|
);
|
|
14379
14582
|
}
|
|
14380
14583
|
const { checkoutHistoryInfo, isLoading } = useFunkitPostCheckoutInternal(depositAddress);
|
|
14381
|
-
const [currentPage, setCurrentPage] =
|
|
14584
|
+
const [currentPage, setCurrentPage] = useState41(
|
|
14382
14585
|
initialPage || "detail" /* DETAIL */
|
|
14383
14586
|
);
|
|
14384
14587
|
const ANIMATION_DELAY2 = 150;
|
|
14385
|
-
const [animateOut, setAnimateOut] =
|
|
14588
|
+
const [animateOut, setAnimateOut] = useState41(false);
|
|
14386
14589
|
const onBackFromHelpPage = useCallback28(() => {
|
|
14387
14590
|
setAnimateOut(true);
|
|
14388
14591
|
setTimeout(() => {
|
|
@@ -14405,23 +14608,23 @@ function FunCheckoutHistoryModal({
|
|
|
14405
14608
|
};
|
|
14406
14609
|
}
|
|
14407
14610
|
}, [currentPage, onBackFromHelpPage]);
|
|
14408
|
-
return /* @__PURE__ */
|
|
14611
|
+
return /* @__PURE__ */ React144.createElement(Dialog, {
|
|
14409
14612
|
open,
|
|
14410
14613
|
onClose,
|
|
14411
14614
|
titleId: "fun-checkout-history-modal"
|
|
14412
|
-
}, /* @__PURE__ */
|
|
14615
|
+
}, /* @__PURE__ */ React144.createElement(DialogContent, {
|
|
14413
14616
|
bottomSheetOnMobile: true,
|
|
14414
14617
|
padding: "0"
|
|
14415
|
-
}, /* @__PURE__ */
|
|
14618
|
+
}, /* @__PURE__ */ React144.createElement(Box, {
|
|
14416
14619
|
paddingTop: "20",
|
|
14417
14620
|
paddingX: "20"
|
|
14418
|
-
}, /* @__PURE__ */
|
|
14621
|
+
}, /* @__PURE__ */ React144.createElement(FunModalTitleSection, {
|
|
14419
14622
|
hasBackButton: titleConfig.hasBackButton,
|
|
14420
14623
|
onBack: titleConfig.onBack,
|
|
14421
14624
|
title: titleConfig.title,
|
|
14422
14625
|
hasCloseButton: true,
|
|
14423
14626
|
onClose
|
|
14424
|
-
}), isLoading ? /* @__PURE__ */
|
|
14627
|
+
}), isLoading ? /* @__PURE__ */ React144.createElement(Box, {
|
|
14425
14628
|
width: "full",
|
|
14426
14629
|
height: "200",
|
|
14427
14630
|
display: "flex",
|
|
@@ -14429,11 +14632,11 @@ function FunCheckoutHistoryModal({
|
|
|
14429
14632
|
alignItems: "center",
|
|
14430
14633
|
justifyContent: "center",
|
|
14431
14634
|
color: "modalText"
|
|
14432
|
-
}, /* @__PURE__ */
|
|
14635
|
+
}, /* @__PURE__ */ React144.createElement(SpinnerIcon, null)) : checkoutHistoryInfo ? currentPage === "detail" /* DETAIL */ ? /* @__PURE__ */ React144.createElement(FunCheckoutHistoryDetail, {
|
|
14433
14636
|
checkoutHistoryInfo,
|
|
14434
14637
|
setCurrentPage,
|
|
14435
14638
|
animateOut
|
|
14436
|
-
}) : currentPage === "help" /* HELP */ ? /* @__PURE__ */
|
|
14639
|
+
}) : currentPage === "help" /* HELP */ ? /* @__PURE__ */ React144.createElement(FunCheckoutHistoryHelp, {
|
|
14437
14640
|
checkoutHistoryInfo,
|
|
14438
14641
|
animateOut,
|
|
14439
14642
|
onBackFromHelpPage
|
|
@@ -14441,20 +14644,20 @@ function FunCheckoutHistoryModal({
|
|
|
14441
14644
|
}
|
|
14442
14645
|
|
|
14443
14646
|
// src/components/FunDevTestModal/FunDevTestModal.tsx
|
|
14444
|
-
import
|
|
14647
|
+
import React145 from "react";
|
|
14445
14648
|
function FunDevTestModal({ onClose, open }) {
|
|
14446
|
-
return /* @__PURE__ */
|
|
14649
|
+
return /* @__PURE__ */ React145.createElement(Dialog, {
|
|
14447
14650
|
onClose,
|
|
14448
14651
|
open,
|
|
14449
14652
|
titleId: "dev/test modal"
|
|
14450
|
-
}, /* @__PURE__ */
|
|
14653
|
+
}, /* @__PURE__ */ React145.createElement(DialogContent, {
|
|
14451
14654
|
bottomSheetOnMobile: true
|
|
14452
|
-
}, /* @__PURE__ */
|
|
14655
|
+
}, /* @__PURE__ */ React145.createElement(Box, null)));
|
|
14453
14656
|
}
|
|
14454
14657
|
|
|
14455
14658
|
// src/components/FunkitProvider/ModalContext.tsx
|
|
14456
14659
|
function useModalStateValue() {
|
|
14457
|
-
const [isModalOpen, setModalOpen] =
|
|
14660
|
+
const [isModalOpen, setModalOpen] = useState42(false);
|
|
14458
14661
|
return {
|
|
14459
14662
|
closeModal: useCallback29(() => setModalOpen(false), []),
|
|
14460
14663
|
isModalOpen,
|
|
@@ -14462,8 +14665,8 @@ function useModalStateValue() {
|
|
|
14462
14665
|
};
|
|
14463
14666
|
}
|
|
14464
14667
|
function useModalStateValueWithId() {
|
|
14465
|
-
const [isModalOpen, setModalOpen] =
|
|
14466
|
-
const [modalId, setModalId] =
|
|
14668
|
+
const [isModalOpen, setModalOpen] = useState42(false);
|
|
14669
|
+
const [modalId, setModalId] = useState42(null);
|
|
14467
14670
|
return {
|
|
14468
14671
|
closeModal: useCallback29(() => {
|
|
14469
14672
|
setModalId(null);
|
|
@@ -14477,7 +14680,7 @@ function useModalStateValueWithId() {
|
|
|
14477
14680
|
}, [])
|
|
14478
14681
|
};
|
|
14479
14682
|
}
|
|
14480
|
-
var ModalContext =
|
|
14683
|
+
var ModalContext = createContext17({
|
|
14481
14684
|
accountModalOpen: false,
|
|
14482
14685
|
chainModalOpen: false,
|
|
14483
14686
|
connectModalOpen: false,
|
|
@@ -14504,7 +14707,7 @@ function ModalProvider({ children }) {
|
|
|
14504
14707
|
isModalOpen: chainModalOpen,
|
|
14505
14708
|
openModal: openChainModal
|
|
14506
14709
|
} = useModalStateValue();
|
|
14507
|
-
const [isWalletConnectModalOpen, setIsWalletConnectModalOpen] =
|
|
14710
|
+
const [isWalletConnectModalOpen, setIsWalletConnectModalOpen] = useState42(false);
|
|
14508
14711
|
const {
|
|
14509
14712
|
closeModal: closeFunCheckoutModal,
|
|
14510
14713
|
isModalOpen: funCheckoutModalOpen,
|
|
@@ -14542,11 +14745,11 @@ function ModalProvider({ children }) {
|
|
|
14542
14745
|
onConnect: () => closeModals({ keepConnectModalOpen: isUnauthenticated }),
|
|
14543
14746
|
onDisconnect: () => closeModals()
|
|
14544
14747
|
});
|
|
14545
|
-
|
|
14748
|
+
useEffect30(() => {
|
|
14546
14749
|
if (isUnauthenticated)
|
|
14547
14750
|
closeModals();
|
|
14548
14751
|
}, [isUnauthenticated]);
|
|
14549
|
-
return /* @__PURE__ */
|
|
14752
|
+
return /* @__PURE__ */ React146.createElement(ModalContext.Provider, {
|
|
14550
14753
|
value: useMemo35(
|
|
14551
14754
|
() => ({
|
|
14552
14755
|
accountModalOpen,
|
|
@@ -14586,21 +14789,21 @@ function ModalProvider({ children }) {
|
|
|
14586
14789
|
openFunDevTestModal
|
|
14587
14790
|
]
|
|
14588
14791
|
)
|
|
14589
|
-
}, children, /* @__PURE__ */
|
|
14792
|
+
}, children, /* @__PURE__ */ React146.createElement(ConnectModal, {
|
|
14590
14793
|
onClose: closeConnectModal,
|
|
14591
14794
|
open: connectModalOpen
|
|
14592
|
-
}), /* @__PURE__ */
|
|
14795
|
+
}), /* @__PURE__ */ React146.createElement(AccountModal, {
|
|
14593
14796
|
onClose: closeAccountModal,
|
|
14594
14797
|
open: accountModalOpen
|
|
14595
|
-
}), /* @__PURE__ */
|
|
14798
|
+
}), /* @__PURE__ */ React146.createElement(ChainModal, {
|
|
14596
14799
|
onClose: closeChainModal,
|
|
14597
14800
|
open: chainModalOpen
|
|
14598
|
-
}), /* @__PURE__ */
|
|
14801
|
+
}), /* @__PURE__ */ React146.createElement(FunCheckoutModal, {
|
|
14599
14802
|
onClose: closeFunCheckoutModal,
|
|
14600
14803
|
open: funCheckoutModalOpen,
|
|
14601
14804
|
checkoutId: funCheckoutModalId,
|
|
14602
14805
|
key: funCheckoutModalId
|
|
14603
|
-
}), depositAddressInitialPageCombined ? /* @__PURE__ */
|
|
14806
|
+
}), depositAddressInitialPageCombined ? /* @__PURE__ */ React146.createElement(FunCheckoutHistoryModal, {
|
|
14604
14807
|
onClose: closeFunCheckoutHistoryModal,
|
|
14605
14808
|
open: funCheckoutHistoryModalOpen,
|
|
14606
14809
|
depositAddress: deconstructDepositAddressAndInitialPage(
|
|
@@ -14609,13 +14812,13 @@ function ModalProvider({ children }) {
|
|
|
14609
14812
|
initialPage: deconstructDepositAddressAndInitialPage(
|
|
14610
14813
|
depositAddressInitialPageCombined
|
|
14611
14814
|
).initialPage
|
|
14612
|
-
}) : null, /* @__PURE__ */
|
|
14815
|
+
}) : null, /* @__PURE__ */ React146.createElement(FunDevTestModal, {
|
|
14613
14816
|
onClose: closeFunDevTestModal,
|
|
14614
14817
|
open: funDevTestModalOpen
|
|
14615
14818
|
}));
|
|
14616
14819
|
}
|
|
14617
14820
|
function useModalState() {
|
|
14618
|
-
const { accountModalOpen, chainModalOpen, connectModalOpen } =
|
|
14821
|
+
const { accountModalOpen, chainModalOpen, connectModalOpen } = useContext23(ModalContext);
|
|
14619
14822
|
return {
|
|
14620
14823
|
accountModalOpen,
|
|
14621
14824
|
chainModalOpen,
|
|
@@ -14623,19 +14826,19 @@ function useModalState() {
|
|
|
14623
14826
|
};
|
|
14624
14827
|
}
|
|
14625
14828
|
function useAccountModal() {
|
|
14626
|
-
const { accountModalOpen, openAccountModal } =
|
|
14829
|
+
const { accountModalOpen, openAccountModal } = useContext23(ModalContext);
|
|
14627
14830
|
return { accountModalOpen, openAccountModal };
|
|
14628
14831
|
}
|
|
14629
14832
|
function useChainModal() {
|
|
14630
|
-
const { chainModalOpen, openChainModal } =
|
|
14833
|
+
const { chainModalOpen, openChainModal } = useContext23(ModalContext);
|
|
14631
14834
|
return { chainModalOpen, openChainModal };
|
|
14632
14835
|
}
|
|
14633
14836
|
function useWalletConnectOpenState() {
|
|
14634
|
-
const { isWalletConnectModalOpen, setIsWalletConnectModalOpen } =
|
|
14837
|
+
const { isWalletConnectModalOpen, setIsWalletConnectModalOpen } = useContext23(ModalContext);
|
|
14635
14838
|
return { isWalletConnectModalOpen, setIsWalletConnectModalOpen };
|
|
14636
14839
|
}
|
|
14637
14840
|
function useConnectModal() {
|
|
14638
|
-
const { connectModalOpen, openConnectModal } =
|
|
14841
|
+
const { connectModalOpen, openConnectModal } = useContext23(ModalContext);
|
|
14639
14842
|
const { isWalletConnectModalOpen } = useWalletConnectOpenState();
|
|
14640
14843
|
return {
|
|
14641
14844
|
connectModalOpen: connectModalOpen || isWalletConnectModalOpen,
|
|
@@ -14643,11 +14846,11 @@ function useConnectModal() {
|
|
|
14643
14846
|
};
|
|
14644
14847
|
}
|
|
14645
14848
|
function useFunCheckoutModal() {
|
|
14646
|
-
const { funCheckoutModalOpen, openFunCheckoutModal } =
|
|
14849
|
+
const { funCheckoutModalOpen, openFunCheckoutModal } = useContext23(ModalContext);
|
|
14647
14850
|
return { funCheckoutModalOpen, openFunCheckoutModal };
|
|
14648
14851
|
}
|
|
14649
14852
|
function useFunCheckoutHistoryModal() {
|
|
14650
|
-
const { funCheckoutHistoryModalOpen, openFunCheckoutHistoryModal } =
|
|
14853
|
+
const { funCheckoutHistoryModalOpen, openFunCheckoutHistoryModal } = useContext23(ModalContext);
|
|
14651
14854
|
return { funCheckoutHistoryModalOpen, openFunCheckoutHistoryModal };
|
|
14652
14855
|
}
|
|
14653
14856
|
|
|
@@ -14858,7 +15061,7 @@ var ERROR_MESSAGES = {
|
|
|
14858
15061
|
PRIVY_USER_NOT_INITIALIZED: "Privy user not initialized",
|
|
14859
15062
|
FARCASTER_NOT_INITIALIZED: "Unable to initialize Farcaster login"
|
|
14860
15063
|
};
|
|
14861
|
-
var FunkitWeb2Context =
|
|
15064
|
+
var FunkitWeb2Context = createContext18({
|
|
14862
15065
|
isSendingOtpEmail: false,
|
|
14863
15066
|
isGeneratingFcUri: false,
|
|
14864
15067
|
handleSendOtpEmail: () => Promise.resolve({ success: false, error: "" }),
|
|
@@ -14903,15 +15106,15 @@ var FunkitWeb2Provider = ({
|
|
|
14903
15106
|
const funkitConfig = useFunkitConfig();
|
|
14904
15107
|
const { connectAsync } = useConnect2();
|
|
14905
15108
|
const { connectors, disconnectAsync } = useDisconnect3();
|
|
14906
|
-
const [privy, setPrivy] =
|
|
14907
|
-
const [privyIframeUrl, setPrivyIframeUrl] =
|
|
14908
|
-
const [loginMethod, setLoginMethod] =
|
|
15109
|
+
const [privy, setPrivy] = useState43(null);
|
|
15110
|
+
const [privyIframeUrl, setPrivyIframeUrl] = useState43();
|
|
15111
|
+
const [loginMethod, setLoginMethod] = useState43(
|
|
14909
15112
|
getLoginMethodFromCache() || null
|
|
14910
15113
|
);
|
|
14911
15114
|
const wallets = useWalletConnectors();
|
|
14912
|
-
const [isLoggingIn, setIsLoggingIn] =
|
|
14913
|
-
const [loginErrorMessage, setLoginErrorMessage] =
|
|
14914
|
-
const [loggedInUser, setLoggedInUser] =
|
|
15115
|
+
const [isLoggingIn, setIsLoggingIn] = useState43(false);
|
|
15116
|
+
const [loginErrorMessage, setLoginErrorMessage] = useState43("");
|
|
15117
|
+
const [loggedInUser, setLoggedInUser] = useState43(null);
|
|
14915
15118
|
const setLoginMethodAndCache = useCallback30(
|
|
14916
15119
|
(method) => {
|
|
14917
15120
|
try {
|
|
@@ -14927,7 +15130,7 @@ var FunkitWeb2Provider = ({
|
|
|
14927
15130
|
},
|
|
14928
15131
|
[]
|
|
14929
15132
|
);
|
|
14930
|
-
|
|
15133
|
+
useEffect31(() => {
|
|
14931
15134
|
const newPrivy = new PrivyJS({
|
|
14932
15135
|
appId: funkitConfig.privyAppId,
|
|
14933
15136
|
storage: new LocalStorage()
|
|
@@ -15125,7 +15328,7 @@ var FunkitWeb2Provider = ({
|
|
|
15125
15328
|
}
|
|
15126
15329
|
}
|
|
15127
15330
|
}, [handleFunkitWeb2Login, initChainId, loginMethod]);
|
|
15128
|
-
|
|
15331
|
+
useEffect31(() => {
|
|
15129
15332
|
if (privy && privyIframeUrl && isNotNullish(initChainId)) {
|
|
15130
15333
|
const iframe = document.getElementById(
|
|
15131
15334
|
PRIVY_IFRAME_ID
|
|
@@ -15167,7 +15370,7 @@ var FunkitWeb2Provider = ({
|
|
|
15167
15370
|
},
|
|
15168
15371
|
[privy, setLoginMethodAndCache]
|
|
15169
15372
|
);
|
|
15170
|
-
const [isSendingOtpEmail, setIsSendingOtpEmail] =
|
|
15373
|
+
const [isSendingOtpEmail, setIsSendingOtpEmail] = useState43(false);
|
|
15171
15374
|
const handleSendOtpEmail = useCallback30(
|
|
15172
15375
|
async (emailAddress) => {
|
|
15173
15376
|
try {
|
|
@@ -15195,7 +15398,7 @@ var FunkitWeb2Provider = ({
|
|
|
15195
15398
|
},
|
|
15196
15399
|
[privy, setLoginMethodAndCache]
|
|
15197
15400
|
);
|
|
15198
|
-
const [isGeneratingFcUri, setIsGeneratingFcUri] =
|
|
15401
|
+
const [isGeneratingFcUri, setIsGeneratingFcUri] = useState43(false);
|
|
15199
15402
|
const handleGenerateFcUri = useCallback30(async () => {
|
|
15200
15403
|
try {
|
|
15201
15404
|
if (!privy)
|
|
@@ -15307,15 +15510,15 @@ var FunkitWeb2Provider = ({
|
|
|
15307
15510
|
handleFunkitWeb2Logout,
|
|
15308
15511
|
web2AccountInfo: userAccountInfo
|
|
15309
15512
|
};
|
|
15310
|
-
return /* @__PURE__ */
|
|
15513
|
+
return /* @__PURE__ */ React147.createElement(FunkitWeb2Context.Provider, {
|
|
15311
15514
|
value: contextValue
|
|
15312
|
-
}, privyIframeUrl ? /* @__PURE__ */
|
|
15515
|
+
}, privyIframeUrl ? /* @__PURE__ */ React147.createElement("iframe", {
|
|
15313
15516
|
id: PRIVY_IFRAME_ID,
|
|
15314
15517
|
src: privyIframeUrl,
|
|
15315
15518
|
style: { display: "none" }
|
|
15316
15519
|
}) : null, children);
|
|
15317
15520
|
};
|
|
15318
|
-
var useFunkitWeb2Login = () =>
|
|
15521
|
+
var useFunkitWeb2Login = () => useContext24(FunkitWeb2Context);
|
|
15319
15522
|
|
|
15320
15523
|
// src/hooks/useConnectionStatus.ts
|
|
15321
15524
|
function useConnectionStatus() {
|
|
@@ -15338,27 +15541,27 @@ function useConnectionStatus() {
|
|
|
15338
15541
|
}
|
|
15339
15542
|
|
|
15340
15543
|
// src/components/FunkitProvider/ShowBalanceContext.tsx
|
|
15341
|
-
import
|
|
15342
|
-
var ShowBalanceContext =
|
|
15544
|
+
import React148, { createContext as createContext19, useContext as useContext25, useState as useState44 } from "react";
|
|
15545
|
+
var ShowBalanceContext = createContext19({
|
|
15343
15546
|
showBalance: void 0,
|
|
15344
15547
|
setShowBalance: () => void 0
|
|
15345
15548
|
});
|
|
15346
15549
|
function ShowBalanceProvider({ children }) {
|
|
15347
|
-
const [showBalance, setShowBalance] =
|
|
15348
|
-
return /* @__PURE__ */
|
|
15550
|
+
const [showBalance, setShowBalance] = useState44();
|
|
15551
|
+
return /* @__PURE__ */ React148.createElement(ShowBalanceContext.Provider, {
|
|
15349
15552
|
value: { showBalance, setShowBalance }
|
|
15350
15553
|
}, children);
|
|
15351
15554
|
}
|
|
15352
|
-
var useShowBalance = () =>
|
|
15555
|
+
var useShowBalance = () => useContext25(ShowBalanceContext);
|
|
15353
15556
|
|
|
15354
15557
|
// src/components/Icons/Dropdown.tsx
|
|
15355
|
-
import
|
|
15356
|
-
var DropdownIcon = () => /* @__PURE__ */
|
|
15558
|
+
import React149 from "react";
|
|
15559
|
+
var DropdownIcon = () => /* @__PURE__ */ React149.createElement("svg", {
|
|
15357
15560
|
fill: "none",
|
|
15358
15561
|
height: "7",
|
|
15359
15562
|
width: "14",
|
|
15360
15563
|
xmlns: "http://www.w3.org/2000/svg"
|
|
15361
|
-
}, /* @__PURE__ */
|
|
15564
|
+
}, /* @__PURE__ */ React149.createElement("path", {
|
|
15362
15565
|
d: "M12.75 1.54001L8.51647 5.0038C7.77974 5.60658 6.72026 5.60658 5.98352 5.0038L1.75 1.54001",
|
|
15363
15566
|
stroke: "currentColor",
|
|
15364
15567
|
strokeLinecap: "round",
|
|
@@ -15368,14 +15571,14 @@ var DropdownIcon = () => /* @__PURE__ */ React148.createElement("svg", {
|
|
|
15368
15571
|
}));
|
|
15369
15572
|
|
|
15370
15573
|
// src/components/ConnectButton/ConnectButtonRenderer.tsx
|
|
15371
|
-
import
|
|
15574
|
+
import React151, { useContext as useContext27 } from "react";
|
|
15372
15575
|
import { useAccount as useAccount16, useBalance, useConfig as useConfig5 } from "wagmi";
|
|
15373
15576
|
|
|
15374
15577
|
// src/hooks/useIsMounted.ts
|
|
15375
|
-
import { useCallback as useCallback31, useEffect as
|
|
15578
|
+
import { useCallback as useCallback31, useEffect as useEffect32, useState as useState45 } from "react";
|
|
15376
15579
|
function useIsMounted() {
|
|
15377
|
-
const [isMounted, setIsMounted] =
|
|
15378
|
-
|
|
15580
|
+
const [isMounted, setIsMounted] = useState45(false);
|
|
15581
|
+
useEffect32(() => {
|
|
15379
15582
|
setIsMounted(true);
|
|
15380
15583
|
return () => {
|
|
15381
15584
|
setIsMounted(false);
|
|
@@ -15387,11 +15590,11 @@ function useIsMounted() {
|
|
|
15387
15590
|
// src/hooks/useMainnetEnsAvatar.ts
|
|
15388
15591
|
import { normalize } from "viem/ens";
|
|
15389
15592
|
import { useEnsAvatar } from "wagmi";
|
|
15390
|
-
import { mainnet as
|
|
15593
|
+
import { mainnet as mainnet4 } from "wagmi/chains";
|
|
15391
15594
|
function useMainnetEnsAvatar(name) {
|
|
15392
15595
|
const mainnetConfigured = useIsMainnetConfigured();
|
|
15393
15596
|
const { data: ensAvatar } = useEnsAvatar({
|
|
15394
|
-
chainId:
|
|
15597
|
+
chainId: mainnet4.id,
|
|
15395
15598
|
name: name ? normalize(name) : void 0,
|
|
15396
15599
|
query: {
|
|
15397
15600
|
enabled: mainnetConfigured
|
|
@@ -15401,7 +15604,7 @@ function useMainnetEnsAvatar(name) {
|
|
|
15401
15604
|
}
|
|
15402
15605
|
|
|
15403
15606
|
// src/transactions/useRecentTransactions.ts
|
|
15404
|
-
import { useEffect as
|
|
15607
|
+
import { useEffect as useEffect34, useState as useState47 } from "react";
|
|
15405
15608
|
import { useAccount as useAccount15 } from "wagmi";
|
|
15406
15609
|
|
|
15407
15610
|
// src/hooks/useChainId.ts
|
|
@@ -15413,7 +15616,7 @@ function useChainId() {
|
|
|
15413
15616
|
}
|
|
15414
15617
|
|
|
15415
15618
|
// src/transactions/TransactionStoreContext.tsx
|
|
15416
|
-
import
|
|
15619
|
+
import React150, { createContext as createContext20, useContext as useContext26, useEffect as useEffect33, useState as useState46 } from "react";
|
|
15417
15620
|
import { useAccount as useAccount14, usePublicClient } from "wagmi";
|
|
15418
15621
|
|
|
15419
15622
|
// src/transactions/transactionStore.ts
|
|
@@ -15556,30 +15759,30 @@ function createTransactionStore({
|
|
|
15556
15759
|
|
|
15557
15760
|
// src/transactions/TransactionStoreContext.tsx
|
|
15558
15761
|
var storeSingleton;
|
|
15559
|
-
var TransactionStoreContext =
|
|
15762
|
+
var TransactionStoreContext = createContext20(null);
|
|
15560
15763
|
function TransactionStoreProvider({
|
|
15561
15764
|
children
|
|
15562
15765
|
}) {
|
|
15563
15766
|
const provider = usePublicClient();
|
|
15564
15767
|
const { address } = useAccount14();
|
|
15565
15768
|
const chainId = useChainId();
|
|
15566
|
-
const [store] =
|
|
15769
|
+
const [store] = useState46(
|
|
15567
15770
|
() => storeSingleton != null ? storeSingleton : storeSingleton = createTransactionStore({ provider })
|
|
15568
15771
|
);
|
|
15569
|
-
|
|
15772
|
+
useEffect33(() => {
|
|
15570
15773
|
store.setProvider(provider);
|
|
15571
15774
|
}, [store, provider]);
|
|
15572
|
-
|
|
15775
|
+
useEffect33(() => {
|
|
15573
15776
|
if (address && chainId) {
|
|
15574
15777
|
store.waitForPendingTransactions(address, chainId);
|
|
15575
15778
|
}
|
|
15576
15779
|
}, [store, address, chainId]);
|
|
15577
|
-
return /* @__PURE__ */
|
|
15780
|
+
return /* @__PURE__ */ React150.createElement(TransactionStoreContext.Provider, {
|
|
15578
15781
|
value: store
|
|
15579
15782
|
}, children);
|
|
15580
15783
|
}
|
|
15581
15784
|
function useTransactionStore() {
|
|
15582
|
-
const store =
|
|
15785
|
+
const store = useContext26(TransactionStoreContext);
|
|
15583
15786
|
if (!store) {
|
|
15584
15787
|
throw new Error("Transaction hooks must be used within FunkitProvider");
|
|
15585
15788
|
}
|
|
@@ -15591,10 +15794,10 @@ function useRecentTransactions() {
|
|
|
15591
15794
|
const store = useTransactionStore();
|
|
15592
15795
|
const { address } = useAccount15();
|
|
15593
15796
|
const chainId = useChainId();
|
|
15594
|
-
const [transactions, setTransactions] =
|
|
15797
|
+
const [transactions, setTransactions] = useState47(
|
|
15595
15798
|
() => store && address && chainId ? store.getTransactions(address, chainId) : []
|
|
15596
15799
|
);
|
|
15597
|
-
|
|
15800
|
+
useEffect34(() => {
|
|
15598
15801
|
if (store && address && chainId) {
|
|
15599
15802
|
setTransactions(store.getTransactions(address, chainId));
|
|
15600
15803
|
return store.onChange(() => {
|
|
@@ -15606,8 +15809,8 @@ function useRecentTransactions() {
|
|
|
15606
15809
|
}
|
|
15607
15810
|
|
|
15608
15811
|
// src/components/FunkitProvider/ShowRecentTransactionsContext.ts
|
|
15609
|
-
import { createContext as
|
|
15610
|
-
var ShowRecentTransactionsContext =
|
|
15812
|
+
import { createContext as createContext21 } from "react";
|
|
15813
|
+
var ShowRecentTransactionsContext = createContext21(false);
|
|
15611
15814
|
|
|
15612
15815
|
// src/components/ConnectButton/abbreviateETHBalance.ts
|
|
15613
15816
|
var units = ["k", "m", "b", "t"];
|
|
@@ -15657,7 +15860,7 @@ function ConnectButtonRenderer({
|
|
|
15657
15860
|
const chainIconUrl = (_c = funkitConnectChain == null ? void 0 : funkitConnectChain.iconUrl) != null ? _c : void 0;
|
|
15658
15861
|
const chainIconBackground = (_d = funkitConnectChain == null ? void 0 : funkitConnectChain.iconBackground) != null ? _d : void 0;
|
|
15659
15862
|
const resolvedChainIconUrl = useAsyncImage(chainIconUrl);
|
|
15660
|
-
const showRecentTransactions =
|
|
15863
|
+
const showRecentTransactions = useContext27(ShowRecentTransactionsContext);
|
|
15661
15864
|
const hasPendingTransactions = useRecentTransactions().some(({ status }) => status === "pending") && showRecentTransactions;
|
|
15662
15865
|
const { showBalance } = useShowBalance();
|
|
15663
15866
|
const computeShouldShowBalance = () => {
|
|
@@ -15678,7 +15881,7 @@ function ConnectButtonRenderer({
|
|
|
15678
15881
|
const { openChainModal } = useChainModal();
|
|
15679
15882
|
const { openAccountModal } = useAccountModal();
|
|
15680
15883
|
const { accountModalOpen, chainModalOpen, connectModalOpen } = useModalState();
|
|
15681
|
-
return /* @__PURE__ */
|
|
15884
|
+
return /* @__PURE__ */ React151.createElement(React151.Fragment, null, children({
|
|
15682
15885
|
account: address ? {
|
|
15683
15886
|
address,
|
|
15684
15887
|
balanceDecimals: balanceData == null ? void 0 : balanceData.decimals,
|
|
@@ -15725,8 +15928,8 @@ function ChainSelectorButton({
|
|
|
15725
15928
|
chain
|
|
15726
15929
|
}) {
|
|
15727
15930
|
var _a, _b;
|
|
15728
|
-
const { i18n: i18n2 } =
|
|
15729
|
-
return /* @__PURE__ */
|
|
15931
|
+
const { i18n: i18n2 } = useContext28(I18nContext);
|
|
15932
|
+
return /* @__PURE__ */ React152.createElement(Box, {
|
|
15730
15933
|
alignItems: "center",
|
|
15731
15934
|
"aria-label": "Chain Selector",
|
|
15732
15935
|
as: "button",
|
|
@@ -15752,37 +15955,37 @@ function ChainSelectorButton({
|
|
|
15752
15955
|
testId: unsupportedChain ? "wrong-network-button" : "chain-button",
|
|
15753
15956
|
transition: "default",
|
|
15754
15957
|
type: "button"
|
|
15755
|
-
}, unsupportedChain ? /* @__PURE__ */
|
|
15958
|
+
}, unsupportedChain ? /* @__PURE__ */ React152.createElement(Box, {
|
|
15756
15959
|
alignItems: "center",
|
|
15757
15960
|
display: "flex",
|
|
15758
15961
|
height: "24",
|
|
15759
15962
|
paddingX: "4"
|
|
15760
|
-
}, i18n2.t("connect_wallet.wrong_network.label")) : /* @__PURE__ */
|
|
15963
|
+
}, i18n2.t("connect_wallet.wrong_network.label")) : /* @__PURE__ */ React152.createElement(Box, {
|
|
15761
15964
|
alignItems: "center",
|
|
15762
15965
|
display: "flex",
|
|
15763
15966
|
gap: "6"
|
|
15764
|
-
}, chain.hasIcon ? /* @__PURE__ */
|
|
15967
|
+
}, chain.hasIcon ? /* @__PURE__ */ React152.createElement(Box, {
|
|
15765
15968
|
display: mapResponsiveValue(
|
|
15766
15969
|
chainStatus,
|
|
15767
15970
|
(value) => value === "full" || value === "icon" ? "block" : "none"
|
|
15768
15971
|
),
|
|
15769
15972
|
height: "24",
|
|
15770
15973
|
width: "24"
|
|
15771
|
-
}, /* @__PURE__ */
|
|
15974
|
+
}, /* @__PURE__ */ React152.createElement(AsyncImage, {
|
|
15772
15975
|
alt: (_a = chain.name) != null ? _a : "Chain icon",
|
|
15773
15976
|
background: chain.iconBackground,
|
|
15774
15977
|
borderRadius: "full",
|
|
15775
15978
|
height: "24",
|
|
15776
15979
|
src: chain.iconUrl,
|
|
15777
15980
|
width: "24"
|
|
15778
|
-
})) : null, /* @__PURE__ */
|
|
15981
|
+
})) : null, /* @__PURE__ */ React152.createElement(Box, {
|
|
15779
15982
|
display: mapResponsiveValue(chainStatus, (value) => {
|
|
15780
15983
|
if (value === "icon" && !chain.iconUrl) {
|
|
15781
15984
|
return "block";
|
|
15782
15985
|
}
|
|
15783
15986
|
return value === "full" || value === "name" ? "block" : "none";
|
|
15784
15987
|
})
|
|
15785
|
-
}, (_b = chain.name) != null ? _b : chain.id)), /* @__PURE__ */
|
|
15988
|
+
}, (_b = chain.name) != null ? _b : chain.id)), /* @__PURE__ */ React152.createElement(DropdownIcon, null));
|
|
15786
15989
|
}
|
|
15787
15990
|
function AccountButton({
|
|
15788
15991
|
openAccountModal,
|
|
@@ -15791,7 +15994,7 @@ function AccountButton({
|
|
|
15791
15994
|
accountStatus
|
|
15792
15995
|
}) {
|
|
15793
15996
|
const { userInfo } = useGeneralWallet();
|
|
15794
|
-
return /* @__PURE__ */
|
|
15997
|
+
return /* @__PURE__ */ React152.createElement(Box, {
|
|
15795
15998
|
alignItems: "center",
|
|
15796
15999
|
as: "button",
|
|
15797
16000
|
background: "accentColor",
|
|
@@ -15809,14 +16012,14 @@ function AccountButton({
|
|
|
15809
16012
|
testId: "account-button",
|
|
15810
16013
|
transition: "default",
|
|
15811
16014
|
type: "button"
|
|
15812
|
-
}, account.displayBalance && /* @__PURE__ */
|
|
16015
|
+
}, account.displayBalance && /* @__PURE__ */ React152.createElement(Box, {
|
|
15813
16016
|
display: mapResponsiveValue(
|
|
15814
16017
|
showBalance,
|
|
15815
16018
|
(value) => value ? "block" : "none"
|
|
15816
16019
|
),
|
|
15817
16020
|
padding: "8",
|
|
15818
16021
|
paddingLeft: "12"
|
|
15819
|
-
}, account.displayBalance), /* @__PURE__ */
|
|
16022
|
+
}, account.displayBalance), /* @__PURE__ */ React152.createElement(Box, {
|
|
15820
16023
|
background: "connectButtonInnerBackground",
|
|
15821
16024
|
borderColor: "accentColor",
|
|
15822
16025
|
borderRadius: "connectButton",
|
|
@@ -15828,32 +16031,32 @@ function AccountButton({
|
|
|
15828
16031
|
paddingX: "8",
|
|
15829
16032
|
paddingY: "6",
|
|
15830
16033
|
transition: "default"
|
|
15831
|
-
}, /* @__PURE__ */
|
|
16034
|
+
}, /* @__PURE__ */ React152.createElement(Box, {
|
|
15832
16035
|
alignItems: "center",
|
|
15833
16036
|
display: "flex",
|
|
15834
16037
|
gap: "6",
|
|
15835
16038
|
height: "24"
|
|
15836
|
-
}, /* @__PURE__ */
|
|
16039
|
+
}, /* @__PURE__ */ React152.createElement(Box, {
|
|
15837
16040
|
display: mapResponsiveValue(
|
|
15838
16041
|
accountStatus,
|
|
15839
16042
|
(value) => value === "full" || value === "avatar" ? "block" : "none"
|
|
15840
16043
|
)
|
|
15841
|
-
}, /* @__PURE__ */
|
|
16044
|
+
}, /* @__PURE__ */ React152.createElement(Avatar, {
|
|
15842
16045
|
address: account.address,
|
|
15843
16046
|
imageUrl: account.ensAvatar || userInfo.accountPicSrc,
|
|
15844
16047
|
loading: account.hasPendingTransactions,
|
|
15845
16048
|
size: 24
|
|
15846
|
-
})), /* @__PURE__ */
|
|
16049
|
+
})), /* @__PURE__ */ React152.createElement(Box, {
|
|
15847
16050
|
alignItems: "center",
|
|
15848
16051
|
display: "flex",
|
|
15849
16052
|
gap: "6"
|
|
15850
|
-
}, /* @__PURE__ */
|
|
16053
|
+
}, /* @__PURE__ */ React152.createElement(Box, {
|
|
15851
16054
|
display: mapResponsiveValue(
|
|
15852
16055
|
accountStatus,
|
|
15853
16056
|
(value) => value === "full" || value === "address" ? "block" : "none"
|
|
15854
16057
|
),
|
|
15855
16058
|
style: { textWrap: "nowrap" }
|
|
15856
|
-
}, userInfo.accountName), /* @__PURE__ */
|
|
16059
|
+
}, userInfo.accountName), /* @__PURE__ */ React152.createElement(DropdownIcon, null)))));
|
|
15857
16060
|
}
|
|
15858
16061
|
function ConnectButton({
|
|
15859
16062
|
accountStatus = defaultProps.accountStatus,
|
|
@@ -15865,14 +16068,14 @@ function ConnectButton({
|
|
|
15865
16068
|
const chains = useFunkitConnectChains();
|
|
15866
16069
|
const connectionStatus = useConnectionStatus();
|
|
15867
16070
|
const { setShowBalance } = useShowBalance();
|
|
15868
|
-
const [ready, setReady] =
|
|
15869
|
-
const { i18n: i18n2 } =
|
|
15870
|
-
|
|
16071
|
+
const [ready, setReady] = useState48(false);
|
|
16072
|
+
const { i18n: i18n2 } = useContext28(I18nContext);
|
|
16073
|
+
useEffect35(() => {
|
|
15871
16074
|
setShowBalance(showBalance);
|
|
15872
16075
|
if (!ready)
|
|
15873
16076
|
setReady(true);
|
|
15874
16077
|
}, [showBalance, setShowBalance, ready]);
|
|
15875
|
-
return ready ? /* @__PURE__ */
|
|
16078
|
+
return ready ? /* @__PURE__ */ React152.createElement(ConnectButtonRenderer, null, ({
|
|
15876
16079
|
account,
|
|
15877
16080
|
chain,
|
|
15878
16081
|
mounted,
|
|
@@ -15883,7 +16086,7 @@ function ConnectButton({
|
|
|
15883
16086
|
var _a;
|
|
15884
16087
|
const ready2 = mounted && connectionStatus !== "loading";
|
|
15885
16088
|
const unsupportedChain = (_a = chain == null ? void 0 : chain.unsupported) != null ? _a : false;
|
|
15886
|
-
return /* @__PURE__ */
|
|
16089
|
+
return /* @__PURE__ */ React152.createElement(Box, {
|
|
15887
16090
|
display: "flex",
|
|
15888
16091
|
gap: "12",
|
|
15889
16092
|
...!ready2 && {
|
|
@@ -15894,17 +16097,17 @@ function ConnectButton({
|
|
|
15894
16097
|
userSelect: "none"
|
|
15895
16098
|
}
|
|
15896
16099
|
}
|
|
15897
|
-
}, ready2 && account && connectionStatus === "connected" ? /* @__PURE__ */
|
|
16100
|
+
}, ready2 && account && connectionStatus === "connected" ? /* @__PURE__ */ React152.createElement(React152.Fragment, null, showChainSelector && chain && (chains.length > 1 || unsupportedChain) && /* @__PURE__ */ React152.createElement(ChainSelectorButton, {
|
|
15898
16101
|
unsupportedChain,
|
|
15899
16102
|
chainStatus,
|
|
15900
16103
|
openChainModal,
|
|
15901
16104
|
chain
|
|
15902
|
-
}), !unsupportedChain && /* @__PURE__ */
|
|
16105
|
+
}), !unsupportedChain && /* @__PURE__ */ React152.createElement(AccountButton, {
|
|
15903
16106
|
openAccountModal,
|
|
15904
16107
|
account,
|
|
15905
16108
|
showBalance,
|
|
15906
16109
|
accountStatus
|
|
15907
|
-
})) : /* @__PURE__ */
|
|
16110
|
+
})) : /* @__PURE__ */ React152.createElement(Box, {
|
|
15908
16111
|
as: "button",
|
|
15909
16112
|
background: "accentColor",
|
|
15910
16113
|
borderRadius: "connectButton",
|
|
@@ -15924,14 +16127,14 @@ function ConnectButton({
|
|
|
15924
16127
|
transition: "default",
|
|
15925
16128
|
type: "button"
|
|
15926
16129
|
}, mounted && label === "Connect Wallet" ? i18n2.t("connect_wallet.label") : label));
|
|
15927
|
-
}) : /* @__PURE__ */
|
|
16130
|
+
}) : /* @__PURE__ */ React152.createElement(React152.Fragment, null);
|
|
15928
16131
|
}
|
|
15929
16132
|
ConnectButton.__defaultProps = defaultProps;
|
|
15930
16133
|
ConnectButton.Custom = ConnectButtonRenderer;
|
|
15931
16134
|
|
|
15932
16135
|
// src/components/FunkitProvider/FunkitProvider.tsx
|
|
15933
16136
|
import { QueryClientProvider } from "@tanstack/react-query";
|
|
15934
|
-
import
|
|
16137
|
+
import React153, { createContext as createContext22, useContext as useContext29 } from "react";
|
|
15935
16138
|
import { useAccountEffect as useAccountEffect3, WagmiProvider } from "wagmi";
|
|
15936
16139
|
|
|
15937
16140
|
// src/css/cssObjectFromTheme.ts
|
|
@@ -15961,9 +16164,6 @@ function cssStringFromTheme(theme, options = {}) {
|
|
|
15961
16164
|
return Object.entries(cssObjectFromTheme(theme, options)).map(([key, value]) => `${key}:${value.replace(/[:;{}</>]/g, "")};`).join("");
|
|
15962
16165
|
}
|
|
15963
16166
|
|
|
15964
|
-
// src/utils/funkitProvider.ts
|
|
15965
|
-
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_ID_LIST as FUNKIT_CONNECT_SUPPORTED_CHAINS_ID_LIST2 } from "@funkit/core";
|
|
15966
|
-
|
|
15967
16167
|
// src/config/getDefaultConfig.ts
|
|
15968
16168
|
import { http } from "wagmi";
|
|
15969
16169
|
import { createConfig } from "wagmi";
|
|
@@ -16659,12 +16859,10 @@ function getInitialChainIdFromFunkitProviderProps(props) {
|
|
|
16659
16859
|
}
|
|
16660
16860
|
function validateChains(props) {
|
|
16661
16861
|
const initialChainId = getInitialChainIdFromFunkitProviderProps(props);
|
|
16662
|
-
props.wagmiConfig.chains.
|
|
16663
|
-
|
|
16664
|
-
|
|
16665
|
-
|
|
16666
|
-
});
|
|
16667
|
-
if (!FUNKIT_CONNECT_SUPPORTED_CHAINS_ID_LIST2.includes(initialChainId.toString())) {
|
|
16862
|
+
const foundInitialChain = props.wagmiConfig.chains.find(
|
|
16863
|
+
(fkcChain) => fkcChain.id.toString() === initialChainId.toString()
|
|
16864
|
+
);
|
|
16865
|
+
if (!foundInitialChain) {
|
|
16668
16866
|
throw new Error(
|
|
16669
16867
|
`Unsupported initialChain ${initialChainId}. Ensure that it is included in 'chains' config as well.`
|
|
16670
16868
|
);
|
|
@@ -16737,25 +16935,25 @@ function generateInnerWagmiConfig(props) {
|
|
|
16737
16935
|
}
|
|
16738
16936
|
|
|
16739
16937
|
// src/components/FunkitProvider/useFingerprint.ts
|
|
16740
|
-
import { useCallback as useCallback32, useEffect as
|
|
16938
|
+
import { useCallback as useCallback32, useEffect as useEffect36 } from "react";
|
|
16741
16939
|
var storageKey6 = "funkit-connect-version";
|
|
16742
16940
|
function setFunkitConnectVersion({ version }) {
|
|
16743
16941
|
localStorage.setItem(storageKey6, version);
|
|
16744
16942
|
}
|
|
16745
16943
|
function getCurrentSdkVersion() {
|
|
16746
|
-
return "1.0.
|
|
16944
|
+
return "1.0.24";
|
|
16747
16945
|
}
|
|
16748
16946
|
function useFingerprint() {
|
|
16749
16947
|
const fingerprint = useCallback32(() => {
|
|
16750
16948
|
setFunkitConnectVersion({ version: getCurrentSdkVersion() });
|
|
16751
16949
|
}, []);
|
|
16752
|
-
|
|
16950
|
+
useEffect36(() => {
|
|
16753
16951
|
fingerprint();
|
|
16754
16952
|
}, [fingerprint]);
|
|
16755
16953
|
}
|
|
16756
16954
|
|
|
16757
16955
|
// src/components/FunkitProvider/usePreloadImages.ts
|
|
16758
|
-
import { useCallback as useCallback33, useEffect as
|
|
16956
|
+
import { useCallback as useCallback33, useEffect as useEffect37 } from "react";
|
|
16759
16957
|
function usePreloadImages() {
|
|
16760
16958
|
const funkitConnectChains = useFunkitConnectChains();
|
|
16761
16959
|
const walletConnectors = useWalletConnectors();
|
|
@@ -16773,32 +16971,13 @@ function usePreloadImages() {
|
|
|
16773
16971
|
loadImages(signInIcon);
|
|
16774
16972
|
}
|
|
16775
16973
|
}, [walletConnectors, funkitConnectChains, isUnauthenticated]);
|
|
16776
|
-
|
|
16974
|
+
useEffect37(() => {
|
|
16777
16975
|
preloadImages();
|
|
16778
16976
|
}, [preloadImages]);
|
|
16779
16977
|
}
|
|
16780
16978
|
|
|
16781
16979
|
// src/components/FunkitProvider/FunkitProvider.tsx
|
|
16782
|
-
var
|
|
16783
|
-
const [MoonPayProviderInner, setMoonPayProviderInner] = React152.useState(null);
|
|
16784
|
-
useEffect37(() => {
|
|
16785
|
-
const loadMoonPayProviderInner = async () => {
|
|
16786
|
-
try {
|
|
16787
|
-
const module = await import("@moonpay/moonpay-react");
|
|
16788
|
-
setMoonPayProviderInner(() => module.MoonPayProvider);
|
|
16789
|
-
} catch (error) {
|
|
16790
|
-
logger.error("Failed to load MoonPayProvider", error);
|
|
16791
|
-
}
|
|
16792
|
-
};
|
|
16793
|
-
loadMoonPayProviderInner();
|
|
16794
|
-
}, []);
|
|
16795
|
-
if (!MoonPayProviderInner)
|
|
16796
|
-
return /* @__PURE__ */ React152.createElement(React152.Fragment, null, props.children);
|
|
16797
|
-
return /* @__PURE__ */ React152.createElement(MoonPayProviderInner, {
|
|
16798
|
-
...props
|
|
16799
|
-
}, props.children);
|
|
16800
|
-
};
|
|
16801
|
-
var ThemeIdContext2 = createContext21(void 0);
|
|
16980
|
+
var ThemeIdContext2 = createContext22(void 0);
|
|
16802
16981
|
var attr2 = "data-rk";
|
|
16803
16982
|
var createThemeRootProps2 = (id) => ({ [attr2]: id || "" });
|
|
16804
16983
|
var createThemeRootSelector = (id) => {
|
|
@@ -16816,13 +16995,13 @@ function FunkitProvider(props) {
|
|
|
16816
16995
|
getCurrentSdkVersion()
|
|
16817
16996
|
);
|
|
16818
16997
|
const initialChainId = getInitialChainIdFromFunkitProviderProps(props);
|
|
16819
|
-
return /* @__PURE__ */
|
|
16998
|
+
return /* @__PURE__ */ React153.createElement(WagmiProvider, {
|
|
16820
16999
|
config: finalWagmiConfig
|
|
16821
|
-
}, /* @__PURE__ */
|
|
17000
|
+
}, /* @__PURE__ */ React153.createElement(QueryClientProvider, {
|
|
16822
17001
|
client: props.queryClient
|
|
16823
|
-
}, /* @__PURE__ */
|
|
17002
|
+
}, /* @__PURE__ */ React153.createElement(FunkitThemeProvider, {
|
|
16824
17003
|
theme: props.theme
|
|
16825
|
-
}, /* @__PURE__ */
|
|
17004
|
+
}, /* @__PURE__ */ React153.createElement(FunkitProviderInner, {
|
|
16826
17005
|
appInfo: props.appInfo,
|
|
16827
17006
|
avatar: props.avatar,
|
|
16828
17007
|
id: props.id,
|
|
@@ -16858,36 +17037,35 @@ function FunkitProviderInner({
|
|
|
16858
17037
|
const modalSize = ModalSizeOptions.WIDE;
|
|
16859
17038
|
const coolMode = false;
|
|
16860
17039
|
const showRecentTransactions = false;
|
|
16861
|
-
return /* @__PURE__ */
|
|
17040
|
+
return /* @__PURE__ */ React153.createElement(FunkitConnectChainProvider, {
|
|
16862
17041
|
initialChain
|
|
16863
|
-
}, /* @__PURE__ */
|
|
17042
|
+
}, /* @__PURE__ */ React153.createElement(FunkitConfigContext.Provider, {
|
|
16864
17043
|
value: funkitConfig
|
|
16865
|
-
}, /* @__PURE__ */
|
|
17044
|
+
}, /* @__PURE__ */ React153.createElement(WalletButtonProvider, null, /* @__PURE__ */ React153.createElement(I18nProvider, {
|
|
16866
17045
|
locale
|
|
16867
|
-
}, /* @__PURE__ */
|
|
17046
|
+
}, /* @__PURE__ */ React153.createElement(CoolModeContext.Provider, {
|
|
16868
17047
|
value: coolMode
|
|
16869
|
-
}, /* @__PURE__ */
|
|
17048
|
+
}, /* @__PURE__ */ React153.createElement(ModalSizeProvider, {
|
|
16870
17049
|
modalSize
|
|
16871
|
-
}, /* @__PURE__ */
|
|
17050
|
+
}, /* @__PURE__ */ React153.createElement(FunkitWeb2Provider, null, /* @__PURE__ */ React153.createElement(GeneralWalletProvider, null, /* @__PURE__ */ React153.createElement(FunkitCheckoutProvider, null, /* @__PURE__ */ React153.createElement(ShowRecentTransactionsContext.Provider, {
|
|
16872
17051
|
value: showRecentTransactions
|
|
16873
|
-
}, /* @__PURE__ */
|
|
17052
|
+
}, /* @__PURE__ */ React153.createElement(FunkitSandboxContext.Provider, {
|
|
16874
17053
|
value: isSandboxMode
|
|
16875
|
-
}, /* @__PURE__ */
|
|
17054
|
+
}, /* @__PURE__ */ React153.createElement(FunkitMeshProvider, null, /* @__PURE__ */ React153.createElement(TransactionStoreProvider, null, /* @__PURE__ */ React153.createElement(AvatarContext.Provider, {
|
|
16876
17055
|
value: avatarContext
|
|
16877
|
-
}, /* @__PURE__ */
|
|
17056
|
+
}, /* @__PURE__ */ React153.createElement(AppContext.Provider, {
|
|
16878
17057
|
value: appContext
|
|
16879
|
-
}, /* @__PURE__ */
|
|
17058
|
+
}, /* @__PURE__ */ React153.createElement(ThemeIdContext2.Provider, {
|
|
16880
17059
|
value: id
|
|
16881
|
-
}, /* @__PURE__ */
|
|
16882
|
-
apiKey: isSandboxMode ? "pk_test_dWfAhBbvVexIId9S5hPd78mKM7ivIsqu" : "pk_live_IxayBRQuBC3RzpPZkbGPrwUsRWAaeO",
|
|
17060
|
+
}, /* @__PURE__ */ React153.createElement(ShowBalanceProvider, null, /* @__PURE__ */ React153.createElement(FunToastProvider, null, /* @__PURE__ */ React153.createElement(FunkitMoonpayProvider, {
|
|
16883
17061
|
debug: !!debug
|
|
16884
|
-
}, /* @__PURE__ */
|
|
17062
|
+
}, /* @__PURE__ */ React153.createElement(ModalProvider, null, activeTheme ? /* @__PURE__ */ React153.createElement("div", {
|
|
16885
17063
|
...createThemeRootProps2(id),
|
|
16886
17064
|
style: {
|
|
16887
17065
|
width: "100%",
|
|
16888
17066
|
height: "100%"
|
|
16889
17067
|
}
|
|
16890
|
-
}, /* @__PURE__ */
|
|
17068
|
+
}, /* @__PURE__ */ React153.createElement("style", {
|
|
16891
17069
|
dangerouslySetInnerHTML: {
|
|
16892
17070
|
__html: [
|
|
16893
17071
|
`${selector}{${cssStringFromTheme(
|
|
@@ -16899,18 +17077,18 @@ function FunkitProviderInner({
|
|
|
16899
17077
|
}
|
|
16900
17078
|
|
|
16901
17079
|
// src/components/WalletButton/WalletButton.tsx
|
|
16902
|
-
import
|
|
17080
|
+
import React155, { useContext as useContext31 } from "react";
|
|
16903
17081
|
|
|
16904
17082
|
// src/components/WalletButton/WalletButton.css.ts
|
|
16905
17083
|
var border = "_85s11r0";
|
|
16906
17084
|
var maxWidth = "_85s11r1";
|
|
16907
17085
|
|
|
16908
17086
|
// src/components/WalletButton/WalletButtonRenderer.tsx
|
|
16909
|
-
import
|
|
16910
|
-
useContext as
|
|
17087
|
+
import React154, {
|
|
17088
|
+
useContext as useContext30,
|
|
16911
17089
|
useEffect as useEffect38,
|
|
16912
17090
|
useMemo as useMemo37,
|
|
16913
|
-
useState as
|
|
17091
|
+
useState as useState49
|
|
16914
17092
|
} from "react";
|
|
16915
17093
|
import { useAccount as useAccount17, useAccountEffect as useAccountEffect4 } from "wagmi";
|
|
16916
17094
|
function WalletButtonRenderer({
|
|
@@ -16920,14 +17098,14 @@ function WalletButtonRenderer({
|
|
|
16920
17098
|
const isMounted = useIsMounted();
|
|
16921
17099
|
const { openConnectModal } = useConnectModal();
|
|
16922
17100
|
const { connectModalOpen } = useModalState();
|
|
16923
|
-
const { connector, setConnector } =
|
|
17101
|
+
const { connector, setConnector } = useContext30(WalletButtonContext);
|
|
16924
17102
|
const [firstConnector] = useWalletConnectors().filter((wallet2) => wallet2.isFunkitSdkConnector).filter((_wallet) => _wallet.id.toLowerCase() === wallet.toLowerCase()).sort((a, b) => a.groupIndex - b.groupIndex);
|
|
16925
17103
|
if (!firstConnector) {
|
|
16926
17104
|
throw new Error("Connector not found");
|
|
16927
17105
|
}
|
|
16928
17106
|
const connectionStatus = useConnectionStatus();
|
|
16929
|
-
const [loading, setLoading] =
|
|
16930
|
-
const [isError, setIsError] =
|
|
17107
|
+
const [loading, setLoading] = useState49(false);
|
|
17108
|
+
const [isError, setIsError] = useState49(false);
|
|
16931
17109
|
const mobile = isMobile();
|
|
16932
17110
|
useEffect38(() => {
|
|
16933
17111
|
if (!connectModalOpen && connector)
|
|
@@ -16966,7 +17144,7 @@ function WalletButtonRenderer({
|
|
|
16966
17144
|
const isStatusLoading = connectionStatus === "loading";
|
|
16967
17145
|
const ready = !isConnecting && !!openConnectModal && firstConnector && !isStatusLoading;
|
|
16968
17146
|
const isNotSupported = !(firstConnector == null ? void 0 : firstConnector.installed) || !(firstConnector == null ? void 0 : firstConnector.ready);
|
|
16969
|
-
return /* @__PURE__ */
|
|
17147
|
+
return /* @__PURE__ */ React154.createElement(React154.Fragment, null, children({
|
|
16970
17148
|
error: isError,
|
|
16971
17149
|
loading,
|
|
16972
17150
|
connected: isLastWalletIdConnected,
|
|
@@ -16987,15 +17165,15 @@ function WalletButtonRenderer({
|
|
|
16987
17165
|
|
|
16988
17166
|
// src/components/WalletButton/WalletButton.tsx
|
|
16989
17167
|
var WalletButton = ({ wallet }) => {
|
|
16990
|
-
const { i18n: i18n2 } =
|
|
16991
|
-
return /* @__PURE__ */
|
|
17168
|
+
const { i18n: i18n2 } = useContext31(I18nContext);
|
|
17169
|
+
return /* @__PURE__ */ React155.createElement(WalletButtonRenderer, {
|
|
16992
17170
|
wallet
|
|
16993
17171
|
}, ({ ready, connect, connected, mounted, connector, loading }) => {
|
|
16994
17172
|
const isDisabled = !ready || loading;
|
|
16995
17173
|
const connectorName = (connector == null ? void 0 : connector.name) || "";
|
|
16996
17174
|
if (!mounted)
|
|
16997
17175
|
return;
|
|
16998
|
-
return /* @__PURE__ */
|
|
17176
|
+
return /* @__PURE__ */ React155.createElement(Box, {
|
|
16999
17177
|
display: "flex",
|
|
17000
17178
|
flexDirection: "column",
|
|
17001
17179
|
alignItems: "center",
|
|
@@ -17003,7 +17181,7 @@ var WalletButton = ({ wallet }) => {
|
|
|
17003
17181
|
style: {
|
|
17004
17182
|
pointerEvents: isDisabled ? "none" : "all"
|
|
17005
17183
|
}
|
|
17006
|
-
}, /* @__PURE__ */
|
|
17184
|
+
}, /* @__PURE__ */ React155.createElement(Box, {
|
|
17007
17185
|
as: "button",
|
|
17008
17186
|
borderRadius: "menuButton",
|
|
17009
17187
|
borderStyle: "solid",
|
|
@@ -17025,7 +17203,7 @@ var WalletButton = ({ wallet }) => {
|
|
|
17025
17203
|
transition: "default",
|
|
17026
17204
|
width: "full",
|
|
17027
17205
|
background: "connectButtonBackground"
|
|
17028
|
-
}, /* @__PURE__ */
|
|
17206
|
+
}, /* @__PURE__ */ React155.createElement(Box, {
|
|
17029
17207
|
color: "modalText",
|
|
17030
17208
|
fontFamily: "body",
|
|
17031
17209
|
fontSize: "16",
|
|
@@ -17033,28 +17211,28 @@ var WalletButton = ({ wallet }) => {
|
|
|
17033
17211
|
transition: "default",
|
|
17034
17212
|
display: "flex",
|
|
17035
17213
|
alignItems: "center"
|
|
17036
|
-
}, /* @__PURE__ */
|
|
17214
|
+
}, /* @__PURE__ */ React155.createElement(Box, {
|
|
17037
17215
|
alignItems: "center",
|
|
17038
17216
|
display: "flex",
|
|
17039
17217
|
flexDirection: "row",
|
|
17040
17218
|
gap: "12",
|
|
17041
17219
|
paddingRight: "6"
|
|
17042
|
-
}, /* @__PURE__ */
|
|
17220
|
+
}, /* @__PURE__ */ React155.createElement(Box, null, loading ? /* @__PURE__ */ React155.createElement(SpinnerIcon, null) : /* @__PURE__ */ React155.createElement(AsyncImage, {
|
|
17043
17221
|
background: connector == null ? void 0 : connector.iconBackground,
|
|
17044
17222
|
borderRadius: "6",
|
|
17045
17223
|
height: "28",
|
|
17046
17224
|
src: connector == null ? void 0 : connector.iconUrl,
|
|
17047
17225
|
width: "28"
|
|
17048
|
-
})), /* @__PURE__ */
|
|
17226
|
+
})), /* @__PURE__ */ React155.createElement(Box, {
|
|
17049
17227
|
alignItems: "center",
|
|
17050
17228
|
display: "flex",
|
|
17051
17229
|
flexDirection: "column",
|
|
17052
17230
|
color: "modalText"
|
|
17053
|
-
}, /* @__PURE__ */
|
|
17231
|
+
}, /* @__PURE__ */ React155.createElement(Box, {
|
|
17054
17232
|
testId: `wallet-button-label-${(connector == null ? void 0 : connector.id) || ""}`
|
|
17055
17233
|
}, loading ? i18n2.t("connect.status.connecting", {
|
|
17056
17234
|
wallet: connectorName
|
|
17057
|
-
}) : connectorName)), connected ? /* @__PURE__ */
|
|
17235
|
+
}) : connectorName)), connected ? /* @__PURE__ */ React155.createElement(Box, {
|
|
17058
17236
|
background: "connectionIndicator",
|
|
17059
17237
|
borderColor: "selectedOptionBorder",
|
|
17060
17238
|
borderRadius: "full",
|
|
@@ -17092,12 +17270,12 @@ function getDefaultWallets(parameters) {
|
|
|
17092
17270
|
}
|
|
17093
17271
|
|
|
17094
17272
|
// src/components/ConnectOptions/MobileOptions.tsx
|
|
17095
|
-
import
|
|
17273
|
+
import React156, {
|
|
17096
17274
|
useCallback as useCallback34,
|
|
17097
|
-
useContext as
|
|
17275
|
+
useContext as useContext32,
|
|
17098
17276
|
useEffect as useEffect39,
|
|
17099
17277
|
useRef as useRef12,
|
|
17100
|
-
useState as
|
|
17278
|
+
useState as useState50
|
|
17101
17279
|
} from "react";
|
|
17102
17280
|
|
|
17103
17281
|
// src/components/ConnectOptions/MobileOptions.css.ts
|
|
@@ -17111,12 +17289,12 @@ var LoadingSpinner = ({ wallet }) => {
|
|
|
17111
17289
|
const height = 80;
|
|
17112
17290
|
const radiusFactor = 20;
|
|
17113
17291
|
const perimeter = 2 * (width + height - 4 * radiusFactor);
|
|
17114
|
-
return /* @__PURE__ */
|
|
17292
|
+
return /* @__PURE__ */ React156.createElement("svg", {
|
|
17115
17293
|
className: spinner,
|
|
17116
17294
|
viewBox: "0 0 86 86",
|
|
17117
17295
|
width: "86",
|
|
17118
17296
|
height: "86"
|
|
17119
|
-
}, /* @__PURE__ */
|
|
17297
|
+
}, /* @__PURE__ */ React156.createElement("title", null, "Loading"), /* @__PURE__ */ React156.createElement("rect", {
|
|
17120
17298
|
x: "3",
|
|
17121
17299
|
y: "3",
|
|
17122
17300
|
width,
|
|
@@ -17149,7 +17327,7 @@ function WalletButton2({
|
|
|
17149
17327
|
} = wallet;
|
|
17150
17328
|
const coolModeRef = useCoolMode(iconUrl);
|
|
17151
17329
|
const initialized = useRef12(false);
|
|
17152
|
-
const { i18n: i18n2 } =
|
|
17330
|
+
const { i18n: i18n2 } = useContext32(I18nContext);
|
|
17153
17331
|
const onConnect = useCallback34(async () => {
|
|
17154
17332
|
const onMobileUri = async () => {
|
|
17155
17333
|
const mobileUri = await (getMobileUri == null ? void 0 : getMobileUri());
|
|
@@ -17183,7 +17361,7 @@ function WalletButton2({
|
|
|
17183
17361
|
initialized.current = true;
|
|
17184
17362
|
}
|
|
17185
17363
|
}, [connecting, onConnect]);
|
|
17186
|
-
return /* @__PURE__ */
|
|
17364
|
+
return /* @__PURE__ */ React156.createElement(Box, {
|
|
17187
17365
|
as: "button",
|
|
17188
17366
|
color: ready ? "modalText" : "modalTextSecondary",
|
|
17189
17367
|
disabled: !ready,
|
|
@@ -17195,40 +17373,40 @@ function WalletButton2({
|
|
|
17195
17373
|
testId: `wallet-option-${id}`,
|
|
17196
17374
|
type: "button",
|
|
17197
17375
|
width: "full"
|
|
17198
|
-
}, /* @__PURE__ */
|
|
17376
|
+
}, /* @__PURE__ */ React156.createElement(Box, {
|
|
17199
17377
|
alignItems: "center",
|
|
17200
17378
|
display: "flex",
|
|
17201
17379
|
flexDirection: "column",
|
|
17202
17380
|
justifyContent: "center"
|
|
17203
|
-
}, /* @__PURE__ */
|
|
17381
|
+
}, /* @__PURE__ */ React156.createElement(Box, {
|
|
17204
17382
|
display: "flex",
|
|
17205
17383
|
alignItems: "center",
|
|
17206
17384
|
justifyContent: "center",
|
|
17207
17385
|
paddingBottom: "8",
|
|
17208
17386
|
paddingTop: "10",
|
|
17209
17387
|
position: "relative"
|
|
17210
|
-
}, connecting ? /* @__PURE__ */
|
|
17388
|
+
}, connecting ? /* @__PURE__ */ React156.createElement(LoadingSpinner, {
|
|
17211
17389
|
wallet
|
|
17212
|
-
}) : null, /* @__PURE__ */
|
|
17390
|
+
}) : null, /* @__PURE__ */ React156.createElement(AsyncImage, {
|
|
17213
17391
|
background: iconBackground,
|
|
17214
17392
|
borderRadius: "13",
|
|
17215
17393
|
boxShadow: "walletLogo",
|
|
17216
17394
|
height: "60",
|
|
17217
17395
|
src: iconUrl,
|
|
17218
17396
|
width: "60"
|
|
17219
|
-
})), !connecting ? /* @__PURE__ */
|
|
17397
|
+
})), !connecting ? /* @__PURE__ */ React156.createElement(Box, {
|
|
17220
17398
|
display: "flex",
|
|
17221
17399
|
flexDirection: "column",
|
|
17222
17400
|
textAlign: "center"
|
|
17223
|
-
}, /* @__PURE__ */
|
|
17401
|
+
}, /* @__PURE__ */ React156.createElement(Text, {
|
|
17224
17402
|
as: "h2",
|
|
17225
17403
|
color: wallet.ready ? "modalText" : "modalTextSecondary",
|
|
17226
17404
|
size: "13",
|
|
17227
17405
|
weight: "medium"
|
|
17228
|
-
}, /* @__PURE__ */
|
|
17406
|
+
}, /* @__PURE__ */ React156.createElement(Box, {
|
|
17229
17407
|
as: "span",
|
|
17230
17408
|
position: "relative"
|
|
17231
|
-
}, shortName != null ? shortName : name, !wallet.ready && " (unsupported)")), wallet.recent && /* @__PURE__ */
|
|
17409
|
+
}, shortName != null ? shortName : name, !wallet.ready && " (unsupported)")), wallet.recent && /* @__PURE__ */ React156.createElement(Text, {
|
|
17232
17410
|
color: "accentColor",
|
|
17233
17411
|
size: "12",
|
|
17234
17412
|
weight: "medium"
|
|
@@ -17240,85 +17418,85 @@ function MobileOptions({ onClose }) {
|
|
|
17240
17418
|
const wallets = useWalletConnectors().filter(
|
|
17241
17419
|
(wallet) => wallet.isFunkitSdkConnector
|
|
17242
17420
|
);
|
|
17243
|
-
const { disclaimer: Disclaimer, learnMoreUrl } =
|
|
17421
|
+
const { disclaimer: Disclaimer, learnMoreUrl } = useContext32(AppContext);
|
|
17244
17422
|
let headerLabel = null;
|
|
17245
17423
|
let walletContent = null;
|
|
17246
17424
|
let headerBackgroundContrast = false;
|
|
17247
17425
|
let headerBackButtonLink = null;
|
|
17248
|
-
const [walletStep, setWalletStep] =
|
|
17426
|
+
const [walletStep, setWalletStep] = useState50(
|
|
17249
17427
|
"CONNECT" /* Connect */
|
|
17250
17428
|
);
|
|
17251
|
-
const { i18n: i18n2 } =
|
|
17429
|
+
const { i18n: i18n2 } = useContext32(I18nContext);
|
|
17252
17430
|
const ios = isIOS();
|
|
17253
17431
|
switch (walletStep) {
|
|
17254
17432
|
case "CONNECT" /* Connect */: {
|
|
17255
17433
|
headerLabel = i18n2.t("connect.title");
|
|
17256
17434
|
headerBackgroundContrast = true;
|
|
17257
|
-
walletContent = /* @__PURE__ */
|
|
17435
|
+
walletContent = /* @__PURE__ */ React156.createElement(Box, null, /* @__PURE__ */ React156.createElement(Box, {
|
|
17258
17436
|
background: "profileForeground",
|
|
17259
17437
|
className: scroll,
|
|
17260
17438
|
display: "flex",
|
|
17261
17439
|
paddingBottom: "20",
|
|
17262
17440
|
paddingTop: "6"
|
|
17263
|
-
}, /* @__PURE__ */
|
|
17441
|
+
}, /* @__PURE__ */ React156.createElement(Box, {
|
|
17264
17442
|
display: "flex",
|
|
17265
17443
|
style: { margin: "0 auto" }
|
|
17266
17444
|
}, wallets.filter((wallet) => wallet.ready).map((wallet) => {
|
|
17267
|
-
return /* @__PURE__ */
|
|
17445
|
+
return /* @__PURE__ */ React156.createElement(Box, {
|
|
17268
17446
|
key: wallet.id,
|
|
17269
17447
|
paddingX: "20"
|
|
17270
|
-
}, /* @__PURE__ */
|
|
17448
|
+
}, /* @__PURE__ */ React156.createElement(Box, {
|
|
17271
17449
|
width: "60"
|
|
17272
|
-
}, /* @__PURE__ */
|
|
17450
|
+
}, /* @__PURE__ */ React156.createElement(WalletButton2, {
|
|
17273
17451
|
onClose,
|
|
17274
17452
|
wallet
|
|
17275
17453
|
})));
|
|
17276
|
-
}))), /* @__PURE__ */
|
|
17454
|
+
}))), /* @__PURE__ */ React156.createElement(Box, {
|
|
17277
17455
|
background: "generalBorder",
|
|
17278
17456
|
height: "1",
|
|
17279
17457
|
marginBottom: "32",
|
|
17280
17458
|
marginTop: "-1"
|
|
17281
|
-
}), /* @__PURE__ */
|
|
17459
|
+
}), /* @__PURE__ */ React156.createElement(Box, {
|
|
17282
17460
|
alignItems: "center",
|
|
17283
17461
|
display: "flex",
|
|
17284
17462
|
flexDirection: "column",
|
|
17285
17463
|
gap: "32",
|
|
17286
17464
|
paddingX: "32",
|
|
17287
17465
|
style: { textAlign: "center" }
|
|
17288
|
-
}, /* @__PURE__ */
|
|
17466
|
+
}, /* @__PURE__ */ React156.createElement(Box, {
|
|
17289
17467
|
display: "flex",
|
|
17290
17468
|
flexDirection: "column",
|
|
17291
17469
|
gap: "8",
|
|
17292
17470
|
textAlign: "center"
|
|
17293
|
-
}, /* @__PURE__ */
|
|
17471
|
+
}, /* @__PURE__ */ React156.createElement(Text, {
|
|
17294
17472
|
color: "modalText",
|
|
17295
17473
|
size: "16",
|
|
17296
17474
|
weight: "bold"
|
|
17297
|
-
}, i18n2.t("intro.title")), /* @__PURE__ */
|
|
17475
|
+
}, i18n2.t("intro.title")), /* @__PURE__ */ React156.createElement(Text, {
|
|
17298
17476
|
color: "modalTextSecondary",
|
|
17299
17477
|
size: "16"
|
|
17300
|
-
}, i18n2.t("intro.description")))), /* @__PURE__ */
|
|
17478
|
+
}, i18n2.t("intro.description")))), /* @__PURE__ */ React156.createElement(Box, {
|
|
17301
17479
|
paddingTop: "32",
|
|
17302
17480
|
paddingX: "20"
|
|
17303
|
-
}, /* @__PURE__ */
|
|
17481
|
+
}, /* @__PURE__ */ React156.createElement(Box, {
|
|
17304
17482
|
display: "flex",
|
|
17305
17483
|
gap: "14",
|
|
17306
17484
|
justifyContent: "center"
|
|
17307
|
-
}, /* @__PURE__ */
|
|
17485
|
+
}, /* @__PURE__ */ React156.createElement(ActionButton, {
|
|
17308
17486
|
label: i18n2.t("intro.get.label"),
|
|
17309
17487
|
onClick: () => setWalletStep("GET" /* Get */),
|
|
17310
17488
|
size: "large",
|
|
17311
17489
|
type: "secondary"
|
|
17312
|
-
}), /* @__PURE__ */
|
|
17490
|
+
}), /* @__PURE__ */ React156.createElement(ActionButton, {
|
|
17313
17491
|
href: learnMoreUrl,
|
|
17314
17492
|
label: i18n2.t("intro.learn_more.label"),
|
|
17315
17493
|
size: "large",
|
|
17316
17494
|
type: "secondary"
|
|
17317
|
-
}))), Disclaimer && /* @__PURE__ */
|
|
17495
|
+
}))), Disclaimer && /* @__PURE__ */ React156.createElement(Box, {
|
|
17318
17496
|
marginTop: "28",
|
|
17319
17497
|
marginX: "32",
|
|
17320
17498
|
textAlign: "center"
|
|
17321
|
-
}, /* @__PURE__ */
|
|
17499
|
+
}, /* @__PURE__ */ React156.createElement(Disclaimer, {
|
|
17322
17500
|
Link: DisclaimerLink,
|
|
17323
17501
|
Text: DisclaimerText
|
|
17324
17502
|
})));
|
|
@@ -17333,7 +17511,7 @@ function MobileOptions({ onClose }) {
|
|
|
17333
17511
|
return ((_a2 = wallet.downloadUrls) == null ? void 0 : _a2.ios) || ((_b = wallet.downloadUrls) == null ? void 0 : _b.android) || ((_c = wallet.downloadUrls) == null ? void 0 : _c.mobile);
|
|
17334
17512
|
}
|
|
17335
17513
|
)) == null ? void 0 : _a.splice(0, 3);
|
|
17336
|
-
walletContent = /* @__PURE__ */
|
|
17514
|
+
walletContent = /* @__PURE__ */ React156.createElement(Box, null, /* @__PURE__ */ React156.createElement(Box, {
|
|
17337
17515
|
alignItems: "center",
|
|
17338
17516
|
display: "flex",
|
|
17339
17517
|
flexDirection: "column",
|
|
@@ -17347,88 +17525,88 @@ function MobileOptions({ onClose }) {
|
|
|
17347
17525
|
if (!(downloadUrls == null ? void 0 : downloadUrls.ios) && !(downloadUrls == null ? void 0 : downloadUrls.android) && !(downloadUrls == null ? void 0 : downloadUrls.mobile)) {
|
|
17348
17526
|
return null;
|
|
17349
17527
|
}
|
|
17350
|
-
return /* @__PURE__ */
|
|
17528
|
+
return /* @__PURE__ */ React156.createElement(Box, {
|
|
17351
17529
|
display: "flex",
|
|
17352
17530
|
gap: "16",
|
|
17353
17531
|
key: wallet.id,
|
|
17354
17532
|
paddingX: "20",
|
|
17355
17533
|
width: "full"
|
|
17356
|
-
}, /* @__PURE__ */
|
|
17534
|
+
}, /* @__PURE__ */ React156.createElement(Box, {
|
|
17357
17535
|
style: { minHeight: 48, minWidth: 48 }
|
|
17358
|
-
}, /* @__PURE__ */
|
|
17536
|
+
}, /* @__PURE__ */ React156.createElement(AsyncImage, {
|
|
17359
17537
|
background: iconBackground,
|
|
17360
17538
|
borderColor: "generalBorder",
|
|
17361
17539
|
borderRadius: "10",
|
|
17362
17540
|
height: "48",
|
|
17363
17541
|
src: iconUrl,
|
|
17364
17542
|
width: "48"
|
|
17365
|
-
})), /* @__PURE__ */
|
|
17543
|
+
})), /* @__PURE__ */ React156.createElement(Box, {
|
|
17366
17544
|
display: "flex",
|
|
17367
17545
|
flexDirection: "column",
|
|
17368
17546
|
width: "full"
|
|
17369
|
-
}, /* @__PURE__ */
|
|
17547
|
+
}, /* @__PURE__ */ React156.createElement(Box, {
|
|
17370
17548
|
alignItems: "center",
|
|
17371
17549
|
display: "flex",
|
|
17372
17550
|
height: "48"
|
|
17373
|
-
}, /* @__PURE__ */
|
|
17551
|
+
}, /* @__PURE__ */ React156.createElement(Box, {
|
|
17374
17552
|
width: "full"
|
|
17375
|
-
}, /* @__PURE__ */
|
|
17553
|
+
}, /* @__PURE__ */ React156.createElement(Text, {
|
|
17376
17554
|
color: "modalText",
|
|
17377
17555
|
size: "18",
|
|
17378
17556
|
weight: "bold"
|
|
17379
|
-
}, name)), /* @__PURE__ */
|
|
17557
|
+
}, name)), /* @__PURE__ */ React156.createElement(ActionButton, {
|
|
17380
17558
|
href: (ios ? downloadUrls == null ? void 0 : downloadUrls.ios : downloadUrls == null ? void 0 : downloadUrls.android) || (downloadUrls == null ? void 0 : downloadUrls.mobile),
|
|
17381
17559
|
label: i18n2.t("get.action.label"),
|
|
17382
17560
|
size: "small",
|
|
17383
17561
|
type: "secondary"
|
|
17384
|
-
})), index < mobileWallets.length - 1 && /* @__PURE__ */
|
|
17562
|
+
})), index < mobileWallets.length - 1 && /* @__PURE__ */ React156.createElement(Box, {
|
|
17385
17563
|
background: "generalBorderDim",
|
|
17386
17564
|
height: "1",
|
|
17387
17565
|
marginY: "10",
|
|
17388
17566
|
width: "full"
|
|
17389
17567
|
})));
|
|
17390
|
-
})), /* @__PURE__ */
|
|
17568
|
+
})), /* @__PURE__ */ React156.createElement(Box, {
|
|
17391
17569
|
style: { marginBottom: "42px" }
|
|
17392
|
-
}), /* @__PURE__ */
|
|
17570
|
+
}), /* @__PURE__ */ React156.createElement(Box, {
|
|
17393
17571
|
alignItems: "center",
|
|
17394
17572
|
display: "flex",
|
|
17395
17573
|
flexDirection: "column",
|
|
17396
17574
|
gap: "36",
|
|
17397
17575
|
paddingX: "36",
|
|
17398
17576
|
style: { textAlign: "center" }
|
|
17399
|
-
}, /* @__PURE__ */
|
|
17577
|
+
}, /* @__PURE__ */ React156.createElement(Box, {
|
|
17400
17578
|
display: "flex",
|
|
17401
17579
|
flexDirection: "column",
|
|
17402
17580
|
gap: "12",
|
|
17403
17581
|
textAlign: "center"
|
|
17404
|
-
}, /* @__PURE__ */
|
|
17582
|
+
}, /* @__PURE__ */ React156.createElement(Text, {
|
|
17405
17583
|
color: "modalText",
|
|
17406
17584
|
size: "16",
|
|
17407
17585
|
weight: "bold"
|
|
17408
|
-
}, i18n2.t("get.looking_for.title")), /* @__PURE__ */
|
|
17586
|
+
}, i18n2.t("get.looking_for.title")), /* @__PURE__ */ React156.createElement(Text, {
|
|
17409
17587
|
color: "modalTextSecondary",
|
|
17410
17588
|
size: "16"
|
|
17411
17589
|
}, i18n2.t("get.looking_for.mobile.description")))));
|
|
17412
17590
|
break;
|
|
17413
17591
|
}
|
|
17414
17592
|
}
|
|
17415
|
-
return /* @__PURE__ */
|
|
17593
|
+
return /* @__PURE__ */ React156.createElement(Box, {
|
|
17416
17594
|
display: "flex",
|
|
17417
17595
|
flexDirection: "column",
|
|
17418
17596
|
paddingBottom: "36"
|
|
17419
|
-
}, /* @__PURE__ */
|
|
17597
|
+
}, /* @__PURE__ */ React156.createElement(Box, {
|
|
17420
17598
|
background: headerBackgroundContrast ? "profileForeground" : "modalBackground",
|
|
17421
17599
|
display: "flex",
|
|
17422
17600
|
flexDirection: "column",
|
|
17423
17601
|
paddingBottom: "4",
|
|
17424
17602
|
paddingTop: "14"
|
|
17425
|
-
}, /* @__PURE__ */
|
|
17603
|
+
}, /* @__PURE__ */ React156.createElement(Box, {
|
|
17426
17604
|
display: "flex",
|
|
17427
17605
|
justifyContent: "center",
|
|
17428
17606
|
paddingBottom: "6",
|
|
17429
17607
|
paddingX: "20",
|
|
17430
17608
|
position: "relative"
|
|
17431
|
-
}, headerBackButtonLink && /* @__PURE__ */
|
|
17609
|
+
}, headerBackButtonLink && /* @__PURE__ */ React156.createElement(Box, {
|
|
17432
17610
|
display: "flex",
|
|
17433
17611
|
position: "absolute",
|
|
17434
17612
|
style: {
|
|
@@ -17436,7 +17614,7 @@ function MobileOptions({ onClose }) {
|
|
|
17436
17614
|
marginBottom: -20,
|
|
17437
17615
|
marginTop: -20
|
|
17438
17616
|
}
|
|
17439
|
-
}, /* @__PURE__ */
|
|
17617
|
+
}, /* @__PURE__ */ React156.createElement(Box, {
|
|
17440
17618
|
alignItems: "center",
|
|
17441
17619
|
as: "button",
|
|
17442
17620
|
className: touchableStyles({
|
|
@@ -17452,28 +17630,28 @@ function MobileOptions({ onClose }) {
|
|
|
17452
17630
|
style: { height: 17, willChange: "transform" },
|
|
17453
17631
|
transition: "default",
|
|
17454
17632
|
type: "button"
|
|
17455
|
-
}, /* @__PURE__ */
|
|
17633
|
+
}, /* @__PURE__ */ React156.createElement(BackIcon, null))), /* @__PURE__ */ React156.createElement(Box, {
|
|
17456
17634
|
marginTop: "4",
|
|
17457
17635
|
textAlign: "center",
|
|
17458
17636
|
width: "full"
|
|
17459
|
-
}, /* @__PURE__ */
|
|
17637
|
+
}, /* @__PURE__ */ React156.createElement(Text, {
|
|
17460
17638
|
as: "h1",
|
|
17461
17639
|
color: "modalText",
|
|
17462
17640
|
id: titleId,
|
|
17463
17641
|
size: "20",
|
|
17464
17642
|
weight: "bold"
|
|
17465
|
-
}, headerLabel)), /* @__PURE__ */
|
|
17643
|
+
}, headerLabel)), /* @__PURE__ */ React156.createElement(Box, {
|
|
17466
17644
|
alignItems: "center",
|
|
17467
17645
|
display: "flex",
|
|
17468
17646
|
height: "32",
|
|
17469
17647
|
paddingRight: "14",
|
|
17470
17648
|
position: "absolute",
|
|
17471
17649
|
right: "0"
|
|
17472
|
-
}, /* @__PURE__ */
|
|
17650
|
+
}, /* @__PURE__ */ React156.createElement(Box, {
|
|
17473
17651
|
style: { marginBottom: -20, marginTop: -20 }
|
|
17474
|
-
}, /* @__PURE__ */
|
|
17652
|
+
}, /* @__PURE__ */ React156.createElement(CloseButton, {
|
|
17475
17653
|
onClose
|
|
17476
|
-
}))))), /* @__PURE__ */
|
|
17654
|
+
}))))), /* @__PURE__ */ React156.createElement(Box, {
|
|
17477
17655
|
display: "flex",
|
|
17478
17656
|
flexDirection: "column"
|
|
17479
17657
|
}, walletContent));
|