@funkit/connect 12.3.0 → 12.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +22 -0
- package/dist/components/FunNotification/FunNotification.d.ts +15 -2
- package/dist/consts/quote.d.ts +13 -13
- package/dist/domains/checkoutErrors.d.ts +3 -3
- package/dist/domains/relay.d.ts +3 -3
- package/dist/hooks/queries/useMeldLimits.d.ts +2 -1
- package/dist/hooks/track/analytics/events.d.ts +8 -0
- package/dist/hooks/track/analytics/useTrackErrorShown.d.ts +12 -0
- package/dist/hooks/useCheckoutQuoteNotification.d.ts +1 -1
- package/dist/index.js +624 -415
- package/dist/interfaces/solanaWallet.d.ts +2 -22
- package/dist/modals/CheckoutModal/ConfirmationStep/usePostCheckout.d.ts +2 -2
- package/dist/modals/CheckoutModal/InputAmount/useMeld.d.ts +2 -2
- package/dist/providers/FunkitQuoteContext.d.ts +2 -1
- package/dist/utils/solanaRelayWallet.d.ts +9 -0
- package/dist/utils/swapped.d.ts +2 -0
- package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
- package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
- package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
- package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
- package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
- package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
- package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
- package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
- package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
- package/dist/wallets/walletConnectors/index.js +55 -55
- package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
- package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
- package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
- package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
- package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
- package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
- package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
- package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
- package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
- package/package.json +7 -5
- package/dist/wallets/walletConnectors/chunk-53MYTA42.js +0 -94
- package/dist/wallets/walletConnectors/chunk-65ULY6OC.js +0 -70
- package/dist/wallets/walletConnectors/chunk-A5POD5SV.js +0 -103
- package/dist/wallets/walletConnectors/chunk-ANODOMIN.js +0 -218
- package/dist/wallets/walletConnectors/chunk-ASTCNVJC.js +0 -96
- package/dist/wallets/walletConnectors/chunk-F45CUFRR.js +0 -66
- package/dist/wallets/walletConnectors/chunk-FYPQ3HP4.js +0 -92
- package/dist/wallets/walletConnectors/chunk-IWPW26AL.js +0 -98
- package/dist/wallets/walletConnectors/chunk-JJBLW4IU.js +0 -87
- package/dist/wallets/walletConnectors/chunk-KE4CWI3A.js +0 -93
- package/dist/wallets/walletConnectors/chunk-MWB6LFSG.js +0 -110
- package/dist/wallets/walletConnectors/chunk-OVDCDVFX.js +0 -100
- package/dist/wallets/walletConnectors/chunk-PPQ6L4K2.js +0 -106
- package/dist/wallets/walletConnectors/chunk-RJF2YEZ5.js +0 -92
- package/dist/wallets/walletConnectors/chunk-RQYEGJKL.js +0 -96
- package/dist/wallets/walletConnectors/chunk-TIHTQ3OB.js +0 -95
- package/dist/wallets/walletConnectors/chunk-TM7UBV3Q.js +0 -69
- package/dist/wallets/walletConnectors/chunk-USLZMUJ3.js +0 -99
package/dist/index.js
CHANGED
|
@@ -449,7 +449,7 @@ function Avatar({ address, imageUrl, loading, size }) {
|
|
|
449
449
|
}
|
|
450
450
|
|
|
451
451
|
// src/components/ConnectButton/ConnectButton.tsx
|
|
452
|
-
import React327, { useEffect as
|
|
452
|
+
import React327, { useEffect as useEffect101, useState as useState95 } from "react";
|
|
453
453
|
|
|
454
454
|
// src/css/touchableStyles.css.ts
|
|
455
455
|
var active = { shrink: "_7rkubb8", shrinkSm: "_7rkubb9" };
|
|
@@ -5999,9 +5999,9 @@ import React325, {
|
|
|
5999
5999
|
createContext as createContext23,
|
|
6000
6000
|
useCallback as useCallback70,
|
|
6001
6001
|
useContext as useContext23,
|
|
6002
|
-
useEffect as
|
|
6002
|
+
useEffect as useEffect100,
|
|
6003
6003
|
useMemo as useMemo73,
|
|
6004
|
-
useRef as
|
|
6004
|
+
useRef as useRef58,
|
|
6005
6005
|
useState as useState94
|
|
6006
6006
|
} from "react";
|
|
6007
6007
|
import { flushSync as flushSync2 } from "react-dom";
|
|
@@ -6808,9 +6808,9 @@ import React324, {
|
|
|
6808
6808
|
createContext as createContext22,
|
|
6809
6809
|
useCallback as useCallback69,
|
|
6810
6810
|
useContext as useContext22,
|
|
6811
|
-
useEffect as
|
|
6811
|
+
useEffect as useEffect99,
|
|
6812
6812
|
useMemo as useMemo72,
|
|
6813
|
-
useRef as
|
|
6813
|
+
useRef as useRef57,
|
|
6814
6814
|
useState as useState93
|
|
6815
6815
|
} from "react";
|
|
6816
6816
|
|
|
@@ -6902,11 +6902,15 @@ var getInputErrorNotification = (error, t) => {
|
|
|
6902
6902
|
switch (error.type) {
|
|
6903
6903
|
case "aboveAvailable":
|
|
6904
6904
|
return {
|
|
6905
|
+
code: "INSUFFICIENT_BALANCE",
|
|
6906
|
+
messageKey: "inputAmount.insufficientBalance",
|
|
6905
6907
|
message: t("inputAmount.insufficientBalance"),
|
|
6906
6908
|
type: "hint"
|
|
6907
6909
|
};
|
|
6908
6910
|
case "aboveMax":
|
|
6909
6911
|
return {
|
|
6912
|
+
code: "AMOUNT_ABOVE_MAXIMUM",
|
|
6913
|
+
messageKey: "inputAmount.maximumDeposit",
|
|
6910
6914
|
message: t("inputAmount.maximumDeposit", {
|
|
6911
6915
|
amount: formatCurrencyAndStringify(error.usdMaxAmount)
|
|
6912
6916
|
}),
|
|
@@ -6914,6 +6918,8 @@ var getInputErrorNotification = (error, t) => {
|
|
|
6914
6918
|
};
|
|
6915
6919
|
case "belowMin":
|
|
6916
6920
|
return {
|
|
6921
|
+
code: "INSUFFICIENT_AMOUNT",
|
|
6922
|
+
messageKey: "inputAmount.minimumDeposit",
|
|
6917
6923
|
message: t("inputAmount.minimumDeposit", {
|
|
6918
6924
|
amount: formatCurrencyAndStringify(error.usdMinAmount)
|
|
6919
6925
|
}),
|
|
@@ -7157,7 +7163,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
7157
7163
|
localStorage.setItem(storageKey, version);
|
|
7158
7164
|
}
|
|
7159
7165
|
function getCurrentSdkVersion() {
|
|
7160
|
-
return "12.
|
|
7166
|
+
return "12.4.0";
|
|
7161
7167
|
}
|
|
7162
7168
|
function useFingerprint() {
|
|
7163
7169
|
const fingerprint = useCallback3(() => {
|
|
@@ -7475,7 +7481,7 @@ function useLighterAccounts({
|
|
|
7475
7481
|
}
|
|
7476
7482
|
|
|
7477
7483
|
// src/hooks/queries/useHasSavedFops.ts
|
|
7478
|
-
import { useEffect as
|
|
7484
|
+
import { useEffect as useEffect98, useState as useState92 } from "react";
|
|
7479
7485
|
|
|
7480
7486
|
// src/hooks/queries/useFops.ts
|
|
7481
7487
|
import {
|
|
@@ -7563,9 +7569,9 @@ import {
|
|
|
7563
7569
|
import React323, {
|
|
7564
7570
|
createContext as createContext21,
|
|
7565
7571
|
useContext as useContext21,
|
|
7566
|
-
useEffect as
|
|
7572
|
+
useEffect as useEffect97,
|
|
7567
7573
|
useMemo as useMemo70,
|
|
7568
|
-
useRef as
|
|
7574
|
+
useRef as useRef56,
|
|
7569
7575
|
useState as useState91
|
|
7570
7576
|
} from "react";
|
|
7571
7577
|
|
|
@@ -10689,103 +10695,157 @@ function isRelayPassthrough(details) {
|
|
|
10689
10695
|
}
|
|
10690
10696
|
function getRelayErrorMessages(t) {
|
|
10691
10697
|
return {
|
|
10692
|
-
["AMOUNT_TOO_LOW" /* AMOUNT_TOO_LOW */]:
|
|
10693
|
-
|
|
10694
|
-
|
|
10695
|
-
|
|
10696
|
-
|
|
10697
|
-
|
|
10698
|
-
|
|
10699
|
-
|
|
10700
|
-
|
|
10701
|
-
|
|
10702
|
-
|
|
10703
|
-
|
|
10704
|
-
|
|
10705
|
-
|
|
10706
|
-
"withdrawal.
|
|
10707
|
-
|
|
10708
|
-
["
|
|
10709
|
-
"withdrawal.
|
|
10710
|
-
|
|
10711
|
-
|
|
10712
|
-
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10716
|
-
|
|
10717
|
-
|
|
10718
|
-
|
|
10719
|
-
|
|
10720
|
-
|
|
10721
|
-
|
|
10722
|
-
"withdrawal.
|
|
10723
|
-
|
|
10724
|
-
["
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10729
|
-
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
["
|
|
10733
|
-
"withdrawal.
|
|
10734
|
-
|
|
10735
|
-
|
|
10736
|
-
["
|
|
10737
|
-
"withdrawal.
|
|
10738
|
-
|
|
10739
|
-
|
|
10740
|
-
|
|
10741
|
-
|
|
10742
|
-
|
|
10743
|
-
|
|
10744
|
-
|
|
10745
|
-
|
|
10746
|
-
"withdrawal.
|
|
10747
|
-
|
|
10748
|
-
["
|
|
10749
|
-
"withdrawal.
|
|
10750
|
-
|
|
10751
|
-
|
|
10752
|
-
|
|
10753
|
-
|
|
10754
|
-
|
|
10755
|
-
|
|
10756
|
-
|
|
10757
|
-
|
|
10758
|
-
|
|
10759
|
-
["
|
|
10760
|
-
|
|
10761
|
-
|
|
10762
|
-
|
|
10763
|
-
|
|
10764
|
-
|
|
10765
|
-
|
|
10766
|
-
|
|
10767
|
-
["
|
|
10768
|
-
|
|
10769
|
-
|
|
10770
|
-
|
|
10771
|
-
|
|
10772
|
-
|
|
10773
|
-
|
|
10774
|
-
|
|
10775
|
-
["
|
|
10776
|
-
|
|
10777
|
-
|
|
10778
|
-
|
|
10779
|
-
|
|
10780
|
-
|
|
10781
|
-
|
|
10782
|
-
|
|
10783
|
-
["
|
|
10698
|
+
["AMOUNT_TOO_LOW" /* AMOUNT_TOO_LOW */]: {
|
|
10699
|
+
messageKey: "withdrawal.amountTooLow",
|
|
10700
|
+
message: t("withdrawal.amountTooLow")
|
|
10701
|
+
},
|
|
10702
|
+
["CHAIN_DISABLED" /* CHAIN_DISABLED */]: {
|
|
10703
|
+
messageKey: "withdrawal.chainDisabled",
|
|
10704
|
+
message: t("withdrawal.chainDisabled")
|
|
10705
|
+
},
|
|
10706
|
+
["FORBIDDEN" /* FORBIDDEN */]: {
|
|
10707
|
+
messageKey: "withdrawal.forbidden",
|
|
10708
|
+
message: t("withdrawal.forbidden")
|
|
10709
|
+
},
|
|
10710
|
+
["INSUFFICIENT_FUNDS" /* INSUFFICIENT_FUNDS */]: {
|
|
10711
|
+
messageKey: "withdrawal.insufficientFunds",
|
|
10712
|
+
message: t("withdrawal.insufficientFunds")
|
|
10713
|
+
},
|
|
10714
|
+
["INSUFFICIENT_LIQUIDITY" /* INSUFFICIENT_LIQUIDITY */]: {
|
|
10715
|
+
messageKey: "withdrawal.insufficientLiquidity",
|
|
10716
|
+
message: t("withdrawal.insufficientLiquidity")
|
|
10717
|
+
},
|
|
10718
|
+
["INVALID_ADDRESS" /* INVALID_ADDRESS */]: {
|
|
10719
|
+
messageKey: "withdrawal.invalidAddress",
|
|
10720
|
+
message: t("withdrawal.invalidAddress")
|
|
10721
|
+
},
|
|
10722
|
+
["INVALID_INPUT_CURRENCY" /* INVALID_INPUT_CURRENCY */]: {
|
|
10723
|
+
messageKey: "withdrawal.invalidInputCurrency",
|
|
10724
|
+
message: t("withdrawal.invalidInputCurrency")
|
|
10725
|
+
},
|
|
10726
|
+
["INVALID_OUTPUT_CURRENCY" /* INVALID_OUTPUT_CURRENCY */]: {
|
|
10727
|
+
messageKey: "withdrawal.invalidOutputCurrency",
|
|
10728
|
+
message: t("withdrawal.invalidOutputCurrency")
|
|
10729
|
+
},
|
|
10730
|
+
["INVALID_SLIPPAGE_TOLERANCE" /* INVALID_SLIPPAGE_TOLERANCE */]: {
|
|
10731
|
+
messageKey: "withdrawal.invalidSlippageTolerance",
|
|
10732
|
+
message: t("withdrawal.invalidSlippageTolerance")
|
|
10733
|
+
},
|
|
10734
|
+
["NO_INTERNAL_SWAP_ROUTES_FOUND" /* NO_INTERNAL_SWAP_ROUTES_FOUND */]: {
|
|
10735
|
+
messageKey: "withdrawal.noInternalSwapRoutesFound",
|
|
10736
|
+
message: t("withdrawal.noInternalSwapRoutesFound")
|
|
10737
|
+
},
|
|
10738
|
+
["NO_QUOTES" /* NO_QUOTES */]: {
|
|
10739
|
+
messageKey: "withdrawal.noQuotes",
|
|
10740
|
+
message: t("withdrawal.noQuotes")
|
|
10741
|
+
},
|
|
10742
|
+
["NO_SWAP_ROUTES_FOUND" /* NO_SWAP_ROUTES_FOUND */]: {
|
|
10743
|
+
messageKey: "withdrawal.noSwapRoutesFound",
|
|
10744
|
+
message: t("withdrawal.noSwapRoutesFound")
|
|
10745
|
+
},
|
|
10746
|
+
["ROUTE_TEMPORARILY_RESTRICTED" /* ROUTE_TEMPORARILY_RESTRICTED */]: {
|
|
10747
|
+
messageKey: "withdrawal.routeTemporarilyRestricted",
|
|
10748
|
+
message: t("withdrawal.routeTemporarilyRestricted")
|
|
10749
|
+
},
|
|
10750
|
+
["SANCTIONED_CURRENCY" /* SANCTIONED_CURRENCY */]: {
|
|
10751
|
+
messageKey: "withdrawal.sanctionedCurrency",
|
|
10752
|
+
message: t("withdrawal.sanctionedCurrency")
|
|
10753
|
+
},
|
|
10754
|
+
["SANCTIONED_WALLET_ADDRESS" /* SANCTIONED_WALLET_ADDRESS */]: {
|
|
10755
|
+
messageKey: "withdrawal.sanctionedWalletAddress",
|
|
10756
|
+
message: /* @__PURE__ */ React27.createElement(
|
|
10757
|
+
FunkitTrans,
|
|
10758
|
+
{
|
|
10759
|
+
t,
|
|
10760
|
+
i18nKey: "withdrawal.sanctionedWalletAddress",
|
|
10761
|
+
components: { ContactSupportLink: /* @__PURE__ */ React27.createElement(ContactSupportLink, { size: "10" }) }
|
|
10762
|
+
}
|
|
10763
|
+
)
|
|
10764
|
+
},
|
|
10765
|
+
["SWAP_IMPACT_TOO_HIGH" /* SWAP_IMPACT_TOO_HIGH */]: {
|
|
10766
|
+
messageKey: "withdrawal.swapImpactTooHigh",
|
|
10767
|
+
message: t("withdrawal.swapImpactTooHigh")
|
|
10768
|
+
},
|
|
10769
|
+
["UNAUTHORIZED" /* UNAUTHORIZED */]: {
|
|
10770
|
+
messageKey: "withdrawal.unauthorized",
|
|
10771
|
+
message: t("withdrawal.unauthorized")
|
|
10772
|
+
},
|
|
10773
|
+
["UNSUPPORTED_CHAIN" /* UNSUPPORTED_CHAIN */]: {
|
|
10774
|
+
messageKey: "withdrawal.unsupportedChain",
|
|
10775
|
+
message: t("withdrawal.unsupportedChain")
|
|
10776
|
+
},
|
|
10777
|
+
["UNSUPPORTED_CURRENCY" /* UNSUPPORTED_CURRENCY */]: {
|
|
10778
|
+
messageKey: "withdrawal.unsupportedCurrency",
|
|
10779
|
+
message: t("withdrawal.unsupportedCurrency")
|
|
10780
|
+
},
|
|
10781
|
+
["UNSUPPORTED_EXECUTION_TYPE" /* UNSUPPORTED_EXECUTION_TYPE */]: {
|
|
10782
|
+
messageKey: "withdrawal.unsupportedExecutionType",
|
|
10783
|
+
message: t("withdrawal.unsupportedExecutionType")
|
|
10784
|
+
},
|
|
10785
|
+
["UNSUPPORTED_ROUTE" /* UNSUPPORTED_ROUTE */]: {
|
|
10786
|
+
messageKey: "withdrawal.unsupportedRoute",
|
|
10787
|
+
message: t("withdrawal.unsupportedRoute")
|
|
10788
|
+
},
|
|
10789
|
+
["USER_RECIPIENT_MISMATCH" /* USER_RECIPIENT_MISMATCH */]: {
|
|
10790
|
+
messageKey: "withdrawal.userRecipientMismatch",
|
|
10791
|
+
message: t("withdrawal.userRecipientMismatch")
|
|
10792
|
+
},
|
|
10793
|
+
["DESTINATION_TX_FAILED" /* DESTINATION_TX_FAILED */]: {
|
|
10794
|
+
messageKey: "withdrawal.destinationTxFailed",
|
|
10795
|
+
message: /* @__PURE__ */ React27.createElement(
|
|
10796
|
+
FunkitTrans,
|
|
10797
|
+
{
|
|
10798
|
+
t,
|
|
10799
|
+
i18nKey: "withdrawal.destinationTxFailed",
|
|
10800
|
+
components: { ContactSupportLink: /* @__PURE__ */ React27.createElement(ContactSupportLink, { size: "10" }) }
|
|
10801
|
+
}
|
|
10802
|
+
)
|
|
10803
|
+
},
|
|
10804
|
+
["ERC20_ROUTER_ADDRESS_NOT_FOUND" /* ERC20_ROUTER_ADDRESS_NOT_FOUND */]: {
|
|
10805
|
+
messageKey: "withdrawal.erc20RouterAddressNotFound",
|
|
10806
|
+
message: /* @__PURE__ */ React27.createElement(
|
|
10807
|
+
FunkitTrans,
|
|
10808
|
+
{
|
|
10809
|
+
t,
|
|
10810
|
+
i18nKey: "withdrawal.erc20RouterAddressNotFound",
|
|
10811
|
+
components: { ContactSupportLink: /* @__PURE__ */ React27.createElement(ContactSupportLink, { size: "10" }) }
|
|
10812
|
+
}
|
|
10813
|
+
)
|
|
10814
|
+
},
|
|
10815
|
+
["UNKNOWN_ERROR" /* UNKNOWN_ERROR */]: {
|
|
10816
|
+
messageKey: "withdrawal.unknownError",
|
|
10817
|
+
message: /* @__PURE__ */ React27.createElement(
|
|
10818
|
+
FunkitTrans,
|
|
10819
|
+
{
|
|
10820
|
+
t,
|
|
10821
|
+
i18nKey: "withdrawal.unknownError",
|
|
10822
|
+
components: { ContactSupportLink: /* @__PURE__ */ React27.createElement(ContactSupportLink, { size: "10" }) }
|
|
10823
|
+
}
|
|
10824
|
+
)
|
|
10825
|
+
},
|
|
10826
|
+
["SWAP_QUOTE_FAILED" /* SWAP_QUOTE_FAILED */]: {
|
|
10827
|
+
messageKey: "withdrawal.swapQuoteFailed",
|
|
10828
|
+
message: /* @__PURE__ */ React27.createElement(
|
|
10829
|
+
FunkitTrans,
|
|
10830
|
+
{
|
|
10831
|
+
t,
|
|
10832
|
+
i18nKey: "withdrawal.swapQuoteFailed",
|
|
10833
|
+
components: { ContactSupportLink: /* @__PURE__ */ React27.createElement(ContactSupportLink, { size: "10" }) }
|
|
10834
|
+
}
|
|
10835
|
+
)
|
|
10836
|
+
},
|
|
10837
|
+
["PERMIT_FAILED" /* PERMIT_FAILED */]: {
|
|
10838
|
+
messageKey: "withdrawal.permitFailed",
|
|
10839
|
+
message: t("withdrawal.permitFailed")
|
|
10840
|
+
}
|
|
10784
10841
|
};
|
|
10785
10842
|
}
|
|
10786
10843
|
function getRelayQuoteErrorDisplayMessage(error, t, fallback2) {
|
|
10787
10844
|
const messages = getRelayErrorMessages(t);
|
|
10788
|
-
return
|
|
10845
|
+
return {
|
|
10846
|
+
...messages[error.relayErrorCode] ?? fallback2,
|
|
10847
|
+
code: error.relayErrorCode
|
|
10848
|
+
};
|
|
10789
10849
|
}
|
|
10790
10850
|
|
|
10791
10851
|
// src/consts/quote.tsx
|
|
@@ -10795,16 +10855,36 @@ var getPendingQuoteMessageGenerator = (t) => ({
|
|
|
10795
10855
|
[2 /* ESTIMATING_GAS */]: () => t("quote.estimatingGas"),
|
|
10796
10856
|
[3 /* FINALIZING */]: () => t("quote.finalizingYourQuote")
|
|
10797
10857
|
});
|
|
10798
|
-
var getDefaultQuoteError = (t) =>
|
|
10799
|
-
|
|
10800
|
-
|
|
10801
|
-
|
|
10802
|
-
|
|
10803
|
-
|
|
10804
|
-
|
|
10858
|
+
var getDefaultQuoteError = (t) => ({
|
|
10859
|
+
code: "QUOTE_FAILED",
|
|
10860
|
+
messageKey: "quote.defaultError",
|
|
10861
|
+
message: /* @__PURE__ */ React28.createElement(
|
|
10862
|
+
FunkitTrans,
|
|
10863
|
+
{
|
|
10864
|
+
t,
|
|
10865
|
+
i18nKey: "quote.defaultError",
|
|
10866
|
+
components: {
|
|
10867
|
+
ContactSupportLink: /* @__PURE__ */ React28.createElement(ContactSupportLink, { size: "10" })
|
|
10868
|
+
}
|
|
10805
10869
|
}
|
|
10806
|
-
|
|
10807
|
-
|
|
10870
|
+
),
|
|
10871
|
+
type: "error"
|
|
10872
|
+
});
|
|
10873
|
+
var getNoRoutesFoundError = (t) => ({
|
|
10874
|
+
code: "NO_ROUTES_FOUND",
|
|
10875
|
+
messageKey: "quote.noRoutesFound",
|
|
10876
|
+
message: t("quote.noRoutesFound")
|
|
10877
|
+
});
|
|
10878
|
+
var getCheckoutAmountTooLowError = (t) => ({
|
|
10879
|
+
code: "INSUFFICIENT_AMOUNT",
|
|
10880
|
+
messageKey: "quote.checkoutAmountTooLow",
|
|
10881
|
+
message: t("quote.checkoutAmountTooLow")
|
|
10882
|
+
});
|
|
10883
|
+
var getInsufficientBalanceError = (t) => ({
|
|
10884
|
+
code: "INSUFFICIENT_BALANCE",
|
|
10885
|
+
messageKey: "quote.insufficientBalance",
|
|
10886
|
+
message: t("quote.insufficientBalance")
|
|
10887
|
+
});
|
|
10808
10888
|
var getQuoteApiErrorDisplayInfo = (t) => {
|
|
10809
10889
|
const DEFAULT_QUOTE_ERROR = getDefaultQuoteError(t);
|
|
10810
10890
|
return {
|
|
@@ -10818,44 +10898,43 @@ var getQuoteApiErrorDisplayInfo = (t) => {
|
|
|
10818
10898
|
},
|
|
10819
10899
|
[6 /* NO_ROUTE_FOUND_RELAY */]: {
|
|
10820
10900
|
check: "No routes found",
|
|
10821
|
-
display: t
|
|
10901
|
+
display: getNoRoutesFoundError(t)
|
|
10822
10902
|
},
|
|
10823
10903
|
[2 /* INSUFFICIENT_AMOUNT_GENERAL_1 */]: {
|
|
10824
10904
|
check: "try to increase the amount",
|
|
10825
|
-
display: t
|
|
10905
|
+
display: getCheckoutAmountTooLowError(t)
|
|
10826
10906
|
},
|
|
10827
10907
|
[3 /* INSUFFICIENT_AMOUNT_GENERAL_2 */]: {
|
|
10828
10908
|
check: "try increase the amount",
|
|
10829
|
-
display: t
|
|
10909
|
+
display: getCheckoutAmountTooLowError(t)
|
|
10830
10910
|
},
|
|
10831
10911
|
[4 /* INSUFFICIENT_AMOUNT_FOR_BRDIGE_1 */]: {
|
|
10832
10912
|
check: "target token must be at least",
|
|
10833
|
-
display: t
|
|
10913
|
+
display: getCheckoutAmountTooLowError(t)
|
|
10834
10914
|
},
|
|
10835
10915
|
[5 /* INSUFFICIENT_AMOUNT_FOR_BRDIGE_2 */]: {
|
|
10836
10916
|
check: "Bridge min amount not met",
|
|
10837
|
-
display: t
|
|
10917
|
+
display: getCheckoutAmountTooLowError(t)
|
|
10838
10918
|
}
|
|
10839
10919
|
};
|
|
10840
10920
|
};
|
|
10841
10921
|
var getQuoteCustomErrorDisplayInfo = (t) => {
|
|
10842
|
-
const INSUFFICIENT_ERROR_DISPLAY = t("quote.insufficientBalance");
|
|
10843
10922
|
return {
|
|
10844
10923
|
[0 /* INSUFFICIENT_BALANCE_PRE_CHECK */]: {
|
|
10845
10924
|
check: "exceeds the balance of the account",
|
|
10846
|
-
display:
|
|
10925
|
+
display: getInsufficientBalanceError(t)
|
|
10847
10926
|
},
|
|
10848
10927
|
[1 /* INSUFFICIENT_TOKEN_BALANCE_PRE_CHECK */]: {
|
|
10849
10928
|
check: "transfer amount exceeds balance",
|
|
10850
|
-
display:
|
|
10929
|
+
display: getInsufficientBalanceError(t)
|
|
10851
10930
|
},
|
|
10852
10931
|
[2 /* INSUFFICIENT_BALANCE_POST_CHECK */]: {
|
|
10853
10932
|
check: "custom error - insufficient balance",
|
|
10854
|
-
display:
|
|
10933
|
+
display: getInsufficientBalanceError(t)
|
|
10855
10934
|
},
|
|
10856
10935
|
[3 /* INSUFFICIENT_AMOUNT_POST_CHECK */]: {
|
|
10857
10936
|
check: "custom error - insufficient amount",
|
|
10858
|
-
display:
|
|
10937
|
+
display: getInsufficientBalanceError(t)
|
|
10859
10938
|
}
|
|
10860
10939
|
};
|
|
10861
10940
|
};
|
|
@@ -10865,14 +10944,18 @@ function getClientErrorDisplayMessage(err, t) {
|
|
|
10865
10944
|
return null;
|
|
10866
10945
|
}
|
|
10867
10946
|
const patterns = [
|
|
10868
|
-
{ check: /too low/i, display: t
|
|
10869
|
-
{ check: /too high/i, display: t
|
|
10947
|
+
{ check: /too low/i, display: getCheckoutAmountTooLowError(t) },
|
|
10948
|
+
{ check: /too high/i, display: getInsufficientBalanceError(t) }
|
|
10870
10949
|
];
|
|
10871
10950
|
const matched = patterns.find((p) => p.check.test(raw));
|
|
10872
10951
|
if (matched) {
|
|
10873
10952
|
return matched.display;
|
|
10874
10953
|
}
|
|
10875
|
-
return
|
|
10954
|
+
return {
|
|
10955
|
+
code: "QUOTE_FAILED_UNMAPPED",
|
|
10956
|
+
messageKey: null,
|
|
10957
|
+
message: raw
|
|
10958
|
+
};
|
|
10876
10959
|
}
|
|
10877
10960
|
function generateQuoteApiErrorForDisplay(err, t) {
|
|
10878
10961
|
const QUOTE_API_ERROR_DISPLAY_INFO = getQuoteApiErrorDisplayInfo(t);
|
|
@@ -11796,7 +11879,7 @@ var FunkitQuoteContext = createContext11({
|
|
|
11796
11879
|
latestQuote: null,
|
|
11797
11880
|
isQuoting: false,
|
|
11798
11881
|
quoteStepMessage: "",
|
|
11799
|
-
|
|
11882
|
+
quoteError: null,
|
|
11800
11883
|
usePermit: void 0,
|
|
11801
11884
|
preferredApprovalMethod: APPROVAL_METHOD_DEFAULT,
|
|
11802
11885
|
setPreferredApprovalMethod: () => void 0,
|
|
@@ -11843,7 +11926,7 @@ function FunkitQuoteProvider({ children }) {
|
|
|
11843
11926
|
const [latestQuote, setLatestQuote] = useState10(null);
|
|
11844
11927
|
const [isQuoting, setIsQuoting] = useState10(false);
|
|
11845
11928
|
const [quoteStepMessage, setQuoteStepMessage] = useState10("");
|
|
11846
|
-
const [
|
|
11929
|
+
const [quoteError, setQuoteError] = useState10(null);
|
|
11847
11930
|
const { getBluvoCheckoutQuote } = useBluvoCheckoutQuote();
|
|
11848
11931
|
const { selectedBrokerageAsset } = useFunkitBrokerageContext();
|
|
11849
11932
|
const quoteBuilder = useQuoteBuilder();
|
|
@@ -11874,14 +11957,14 @@ function FunkitQuoteProvider({ children }) {
|
|
|
11874
11957
|
setLatestQuote(null);
|
|
11875
11958
|
setQuoteProgress({
|
|
11876
11959
|
isQuoting: false,
|
|
11877
|
-
|
|
11960
|
+
quoteError: null,
|
|
11878
11961
|
quoteStepMessage: ""
|
|
11879
11962
|
});
|
|
11880
11963
|
}
|
|
11881
11964
|
}, [logoutSymbol]);
|
|
11882
11965
|
const setQuoteProgress = useCallback11(
|
|
11883
11966
|
(state) => {
|
|
11884
|
-
|
|
11967
|
+
setQuoteError(state.quoteError);
|
|
11885
11968
|
setQuoteStepMessage(state.quoteStepMessage);
|
|
11886
11969
|
setIsQuoting(state.isQuoting);
|
|
11887
11970
|
},
|
|
@@ -11889,7 +11972,7 @@ function FunkitQuoteProvider({ children }) {
|
|
|
11889
11972
|
);
|
|
11890
11973
|
const clearCheckoutQuoteMessages = useCallback11(() => {
|
|
11891
11974
|
setQuoteStepMessage("");
|
|
11892
|
-
|
|
11975
|
+
setQuoteError(null);
|
|
11893
11976
|
}, []);
|
|
11894
11977
|
const getCheckoutQuote = useEffectEvent(
|
|
11895
11978
|
async (disableInformationStreaming) => {
|
|
@@ -11911,7 +11994,7 @@ function FunkitQuoteProvider({ children }) {
|
|
|
11911
11994
|
setQuoteProgress({
|
|
11912
11995
|
isQuoting: true,
|
|
11913
11996
|
quoteStepMessage: PENDING_QUOTE_MESSAGE_GENERATOR[0 /* PREPARING */](),
|
|
11914
|
-
|
|
11997
|
+
quoteError: null
|
|
11915
11998
|
});
|
|
11916
11999
|
}
|
|
11917
12000
|
logger.log("_getCheckoutQuote:begin", {
|
|
@@ -12002,13 +12085,13 @@ function FunkitQuoteProvider({ children }) {
|
|
|
12002
12085
|
latestQuote: finalEstimation,
|
|
12003
12086
|
isQuoting: false,
|
|
12004
12087
|
quoteStepMessage: !disableInformationStreaming ? paymentMethodInfo.paymentMethod === PaymentMethod.ACCOUNT_BALANCE && loginType === "web3" /* Web3 */ ? PENDING_QUOTE_MESSAGE_GENERATOR[2 /* ESTIMATING_GAS */]() : PENDING_QUOTE_MESSAGE_GENERATOR[1 /* VERIFYING_PROVIDER */](paymentMethodInfo.title) : "",
|
|
12005
|
-
|
|
12088
|
+
quoteError: null
|
|
12006
12089
|
},
|
|
12007
12090
|
success: true
|
|
12008
12091
|
};
|
|
12009
12092
|
} catch (err) {
|
|
12010
12093
|
const error = err;
|
|
12011
|
-
const
|
|
12094
|
+
const quoteError2 = generateQuoteApiErrorForDisplay(error, t);
|
|
12012
12095
|
logger.error("_getCheckoutQuote:error", error, {
|
|
12013
12096
|
quoteErrorMessage: error?.message,
|
|
12014
12097
|
...error instanceof RelayQuoteError2 ? { relayErrorCode: error.relayErrorCode } : {},
|
|
@@ -12018,11 +12101,11 @@ function FunkitQuoteProvider({ children }) {
|
|
|
12018
12101
|
isQuoting: false,
|
|
12019
12102
|
latestQuote: null,
|
|
12020
12103
|
quoteStepMessage: "",
|
|
12021
|
-
|
|
12104
|
+
quoteError: quoteError2
|
|
12022
12105
|
};
|
|
12023
12106
|
if (!disableInformationStreaming) {
|
|
12024
|
-
const { isQuoting: isQuoting2,
|
|
12025
|
-
setQuoteProgress({ isQuoting: isQuoting2,
|
|
12107
|
+
const { isQuoting: isQuoting2, quoteError: quoteError3, quoteStepMessage: quoteStepMessage2 } = quoteState;
|
|
12108
|
+
setQuoteProgress({ isQuoting: isQuoting2, quoteError: quoteError3, quoteStepMessage: quoteStepMessage2 });
|
|
12026
12109
|
setLatestQuote(quoteState.latestQuote);
|
|
12027
12110
|
}
|
|
12028
12111
|
if (checkedAmount?.isAboveMaximum) {
|
|
@@ -12077,7 +12160,7 @@ function FunkitQuoteProvider({ children }) {
|
|
|
12077
12160
|
const contextValue = {
|
|
12078
12161
|
isQuoting,
|
|
12079
12162
|
latestQuote,
|
|
12080
|
-
|
|
12163
|
+
quoteError,
|
|
12081
12164
|
quoteStepMessage,
|
|
12082
12165
|
usePermit,
|
|
12083
12166
|
preferredApprovalMethod,
|
|
@@ -12504,7 +12587,7 @@ import React322, {
|
|
|
12504
12587
|
createContext as createContext20,
|
|
12505
12588
|
useCallback as useCallback67,
|
|
12506
12589
|
useContext as useContext20,
|
|
12507
|
-
useEffect as
|
|
12590
|
+
useEffect as useEffect94,
|
|
12508
12591
|
useMemo as useMemo69,
|
|
12509
12592
|
useState as useState90
|
|
12510
12593
|
} from "react";
|
|
@@ -12524,7 +12607,7 @@ var topbarOverflowContent = "_1r8f576 _1rsrm2fq9 _1rsrm2fsb";
|
|
|
12524
12607
|
|
|
12525
12608
|
// src/modals/WithdrawalModal/WithdrawalModal.tsx
|
|
12526
12609
|
import { resolveWithdrawalSourceTokenBalance as resolveWithdrawalSourceTokenBalance3 } from "@funkit/connect-core";
|
|
12527
|
-
import React162, { useCallback as useCallback36, useEffect as
|
|
12610
|
+
import React162, { useCallback as useCallback36, useEffect as useEffect55, useRef as useRef32, useState as useState47 } from "react";
|
|
12528
12611
|
import { mainnet as mainnet9 } from "viem/chains";
|
|
12529
12612
|
|
|
12530
12613
|
// src/clients/internal/nado/withdrawalConfig.ts
|
|
@@ -14909,6 +14992,7 @@ import React56, {
|
|
|
14909
14992
|
} from "react";
|
|
14910
14993
|
|
|
14911
14994
|
// src/utils/swapped.ts
|
|
14995
|
+
import chroma from "chroma-js";
|
|
14912
14996
|
import {
|
|
14913
14997
|
getFormOfPaymentDisplayName,
|
|
14914
14998
|
getSavedFormOfPaymentDisplayName,
|
|
@@ -14919,10 +15003,29 @@ import {
|
|
|
14919
15003
|
isSwappedOrigin,
|
|
14920
15004
|
SWAPPED_CARD_BRANDS
|
|
14921
15005
|
} from "@funkit/connect-core";
|
|
15006
|
+
var UNSUPPORTED_COLOR_FN_RE = /^(?:oklch|oklab|lab|lch|hsl|hsla)\(/i;
|
|
15007
|
+
function normalizeSwappedColor(value) {
|
|
15008
|
+
const color = value.trim();
|
|
15009
|
+
if (!UNSUPPORTED_COLOR_FN_RE.test(color)) {
|
|
15010
|
+
return value;
|
|
15011
|
+
}
|
|
15012
|
+
try {
|
|
15013
|
+
return chroma(color).hex();
|
|
15014
|
+
} catch {
|
|
15015
|
+
logger.warn("swapped:unparseableThemeColor", {
|
|
15016
|
+
message: "Theme color could not be converted; the embed may ignore it.",
|
|
15017
|
+
data: { value: color }
|
|
15018
|
+
});
|
|
15019
|
+
return value;
|
|
15020
|
+
}
|
|
15021
|
+
}
|
|
14922
15022
|
function resolveCssValue(value, scope) {
|
|
14923
|
-
if (typeof value !== "string"
|
|
15023
|
+
if (typeof value !== "string") {
|
|
14924
15024
|
return value;
|
|
14925
15025
|
}
|
|
15026
|
+
if (!value.startsWith("var(")) {
|
|
15027
|
+
return normalizeSwappedColor(value);
|
|
15028
|
+
}
|
|
14926
15029
|
if (typeof document === "undefined") {
|
|
14927
15030
|
return value;
|
|
14928
15031
|
}
|
|
@@ -14932,7 +15035,7 @@ function resolveCssValue(value, scope) {
|
|
|
14932
15035
|
return value;
|
|
14933
15036
|
}
|
|
14934
15037
|
const resolved = getComputedStyle(scope ?? document.documentElement).getPropertyValue(prop).trim();
|
|
14935
|
-
return resolved
|
|
15038
|
+
return resolved ? normalizeSwappedColor(resolved) : value;
|
|
14936
15039
|
} catch {
|
|
14937
15040
|
return value;
|
|
14938
15041
|
}
|
|
@@ -18160,11 +18263,13 @@ async function toCheckoutConfirmationError(t, error, wagmiConfig, options) {
|
|
|
18160
18263
|
const CHECKOUT_CONFIRMATION_UI_ERRORS = {
|
|
18161
18264
|
QUOTE_EXPIRED: {
|
|
18162
18265
|
durationMs: 5e3,
|
|
18266
|
+
messageKey: "checkoutConfirmation.quoteExpired",
|
|
18163
18267
|
message: t("checkoutConfirmation.quoteExpired"),
|
|
18164
18268
|
type: "hint",
|
|
18165
18269
|
code: "QUOTE_EXPIRED" /* QUOTE_EXPIRED */
|
|
18166
18270
|
},
|
|
18167
18271
|
GENERIC_ERROR: {
|
|
18272
|
+
messageKey: "checkoutConfirmation.genericErrorMessage",
|
|
18168
18273
|
message: /* @__PURE__ */ React87.createElement(
|
|
18169
18274
|
FunkitTrans,
|
|
18170
18275
|
{
|
|
@@ -18179,17 +18284,20 @@ async function toCheckoutConfirmationError(t, error, wagmiConfig, options) {
|
|
|
18179
18284
|
code: "GENERIC_ERROR" /* GENERIC_ERROR */
|
|
18180
18285
|
},
|
|
18181
18286
|
WITHDRAWAL_RATE_LIMIT_EXCEEDED: {
|
|
18287
|
+
messageKey: "checkoutConfirmation.rateLimitExceeded",
|
|
18182
18288
|
message: t("checkoutConfirmation.rateLimitExceeded"),
|
|
18183
18289
|
durationMs: 3e4,
|
|
18184
18290
|
type: "hint",
|
|
18185
18291
|
code: "WITHDRAWAL_RATE_LIMIT_EXCEEDED" /* WITHDRAWAL_RATE_LIMIT_EXCEEDED */
|
|
18186
18292
|
},
|
|
18187
18293
|
INSUFFICIENT_GAS: {
|
|
18294
|
+
messageKey: "checkoutConfirmation.insufficientGas",
|
|
18188
18295
|
message: t("checkoutConfirmation.insufficientGas"),
|
|
18189
18296
|
type: "hint",
|
|
18190
18297
|
code: "INSUFFICIENT_GAS" /* INSUFFICIENT_GAS */
|
|
18191
18298
|
},
|
|
18192
18299
|
POLYGON_RPC_ERROR: {
|
|
18300
|
+
messageKey: "checkoutConfirmation.polygonRpcError",
|
|
18193
18301
|
message: /* @__PURE__ */ React87.createElement(
|
|
18194
18302
|
FunkitTrans,
|
|
18195
18303
|
{
|
|
@@ -18204,6 +18312,7 @@ async function toCheckoutConfirmationError(t, error, wagmiConfig, options) {
|
|
|
18204
18312
|
code: "POLYGON_RPC_ERROR" /* POLYGON_RPC_ERROR */
|
|
18205
18313
|
},
|
|
18206
18314
|
RISK_ERROR: {
|
|
18315
|
+
messageKey: "checkoutConfirmation.riskErrorMessage",
|
|
18207
18316
|
message: t("checkoutConfirmation.riskErrorMessage", {
|
|
18208
18317
|
orgName: FUN_ORG_NAME
|
|
18209
18318
|
}),
|
|
@@ -18211,17 +18320,20 @@ async function toCheckoutConfirmationError(t, error, wagmiConfig, options) {
|
|
|
18211
18320
|
code: "RISK_ERROR" /* RISK_ERROR */
|
|
18212
18321
|
},
|
|
18213
18322
|
SIGNATURE_DENIED: {
|
|
18323
|
+
messageKey: "checkoutConfirmation.signatureDeclined",
|
|
18214
18324
|
message: t("checkoutConfirmation.signatureDeclined"),
|
|
18215
18325
|
durationMs: 5e3,
|
|
18216
18326
|
type: "hint",
|
|
18217
18327
|
code: "SIGNATURE_DENIED" /* SIGNATURE_DENIED */
|
|
18218
18328
|
},
|
|
18219
18329
|
SWITCH_CHAIN_ERROR: {
|
|
18330
|
+
messageKey: "checkoutConfirmation.unableToSwitchChains",
|
|
18220
18331
|
message: t("checkoutConfirmation.unableToSwitchChains"),
|
|
18221
18332
|
type: "hint",
|
|
18222
18333
|
code: "SWITCH_CHAIN_ERROR" /* SWITCH_CHAIN_ERROR */
|
|
18223
18334
|
},
|
|
18224
18335
|
WALLET_CLIENT_UNDEFINED: {
|
|
18336
|
+
messageKey: "checkoutConfirmation.walletClientUndefined",
|
|
18225
18337
|
message: t("checkoutConfirmation.walletClientUndefined"),
|
|
18226
18338
|
type: "hint",
|
|
18227
18339
|
code: "WALLET_CLIENT_UNDEFINED" /* WALLET_CLIENT_UNDEFINED */
|
|
@@ -23985,7 +24097,7 @@ import {
|
|
|
23985
24097
|
formatCryptoAndStringify as formatCryptoAndStringify4,
|
|
23986
24098
|
formatCurrencyAndStringify as formatCurrencyAndStringify6
|
|
23987
24099
|
} from "@funkit/utils";
|
|
23988
|
-
import React148, { useCallback as useCallback33, useEffect as
|
|
24100
|
+
import React148, { useCallback as useCallback33, useEffect as useEffect47, useMemo as useMemo41, useState as useState44 } from "react";
|
|
23989
24101
|
import { createPortal as createPortal6 } from "react-dom";
|
|
23990
24102
|
import { useDebounce } from "use-debounce";
|
|
23991
24103
|
import { isAddress } from "viem";
|
|
@@ -25776,6 +25888,31 @@ var useWithdrawalRisk = (apiKey, receiveAddress, chainId2) => {
|
|
|
25776
25888
|
});
|
|
25777
25889
|
};
|
|
25778
25890
|
|
|
25891
|
+
// src/hooks/track/analytics/useTrackErrorShown.ts
|
|
25892
|
+
import { useEffect as useEffect41, useRef as useRef19 } from "react";
|
|
25893
|
+
function useTrackErrorShown({ error, flow, step }) {
|
|
25894
|
+
const logEventV2 = useTrackV2();
|
|
25895
|
+
const identity = error && `${step}:${error.code ?? error.messageKey}`;
|
|
25896
|
+
const displayedErrorIdentityRef = useRef19(null);
|
|
25897
|
+
useEffect41(() => {
|
|
25898
|
+
if (!error) {
|
|
25899
|
+
displayedErrorIdentityRef.current = null;
|
|
25900
|
+
return;
|
|
25901
|
+
}
|
|
25902
|
+
if (displayedErrorIdentityRef.current === identity) {
|
|
25903
|
+
return;
|
|
25904
|
+
}
|
|
25905
|
+
displayedErrorIdentityRef.current = identity;
|
|
25906
|
+
logEventV2("fc_error_shown" /* ERROR_SHOWN */, () => ({
|
|
25907
|
+
error_code: error.code,
|
|
25908
|
+
error_message: error.messageKey,
|
|
25909
|
+
notification_type: error.type || "error",
|
|
25910
|
+
flow,
|
|
25911
|
+
step: formatAnalyticsStep(step)
|
|
25912
|
+
}));
|
|
25913
|
+
}, [error, flow, identity, logEventV2, step]);
|
|
25914
|
+
}
|
|
25915
|
+
|
|
25779
25916
|
// src/utils/polymarket.ts
|
|
25780
25917
|
import {
|
|
25781
25918
|
encodeAbiParameters,
|
|
@@ -25808,24 +25945,32 @@ function getErrorNotification({
|
|
|
25808
25945
|
t
|
|
25809
25946
|
}) {
|
|
25810
25947
|
if (quoteErrorObject) {
|
|
25811
|
-
const
|
|
25812
|
-
|
|
25813
|
-
|
|
25814
|
-
t("withdrawal.quoteError")
|
|
25815
|
-
|
|
25816
|
-
|
|
25948
|
+
const defaultError = {
|
|
25949
|
+
code: "QUOTE_FAILED",
|
|
25950
|
+
messageKey: "withdrawal.quoteError",
|
|
25951
|
+
message: t("withdrawal.quoteError")
|
|
25952
|
+
};
|
|
25953
|
+
const error = quoteErrorObject instanceof RelayQuoteError3 ? getRelayQuoteErrorDisplayMessage(quoteErrorObject, t, defaultError) : defaultError;
|
|
25954
|
+
return {
|
|
25955
|
+
...error,
|
|
25956
|
+
type: "default"
|
|
25957
|
+
};
|
|
25817
25958
|
}
|
|
25818
25959
|
if (withdrawalError) {
|
|
25819
25960
|
return withdrawalError;
|
|
25820
25961
|
}
|
|
25821
25962
|
if (targetAssetFetchError) {
|
|
25822
25963
|
return {
|
|
25964
|
+
code: "ASSET_PRICE_UNAVAILABLE",
|
|
25965
|
+
messageKey: "withdrawal.failedToFetchAssetPrice",
|
|
25823
25966
|
message: t("withdrawal.failedToFetchAssetPrice"),
|
|
25824
25967
|
type: "default"
|
|
25825
25968
|
};
|
|
25826
25969
|
}
|
|
25827
25970
|
if (riskCheckError) {
|
|
25828
25971
|
return {
|
|
25972
|
+
code: "RISK_CHECK_FAILED",
|
|
25973
|
+
messageKey: "common.somethingWentWrong",
|
|
25829
25974
|
message: t("common.somethingWentWrong"),
|
|
25830
25975
|
type: "default"
|
|
25831
25976
|
};
|
|
@@ -25834,7 +25979,7 @@ function getErrorNotification({
|
|
|
25834
25979
|
}
|
|
25835
25980
|
|
|
25836
25981
|
// src/modals/WithdrawalModal/RecipientAddress.tsx
|
|
25837
|
-
import React146, { useCallback as useCallback28, useEffect as
|
|
25982
|
+
import React146, { useCallback as useCallback28, useEffect as useEffect42, useRef as useRef21, useState as useState39 } from "react";
|
|
25838
25983
|
import {
|
|
25839
25984
|
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8,
|
|
25840
25985
|
solanaChain as solanaChain4,
|
|
@@ -25846,9 +25991,9 @@ import { isEVMAddressEquivalent as isEVMAddressEquivalent2 } from "@funkit/utils
|
|
|
25846
25991
|
import { useState as useState38 } from "react";
|
|
25847
25992
|
|
|
25848
25993
|
// src/hooks/useTextMeasurer.ts
|
|
25849
|
-
import { useCallback as useCallback27, useRef as
|
|
25994
|
+
import { useCallback as useCallback27, useRef as useRef20 } from "react";
|
|
25850
25995
|
function useTextMeasurer(inputRef) {
|
|
25851
|
-
const tempRef =
|
|
25996
|
+
const tempRef = useRef20(null);
|
|
25852
25997
|
const measureText = useCallback27(
|
|
25853
25998
|
(text, fontSize) => {
|
|
25854
25999
|
if (!inputRef.current || typeof document === "undefined") {
|
|
@@ -26011,7 +26156,7 @@ function useShowConnectWallet({ config }) {
|
|
|
26011
26156
|
isConnected,
|
|
26012
26157
|
connectedWalletAddress
|
|
26013
26158
|
});
|
|
26014
|
-
|
|
26159
|
+
useEffect42(() => {
|
|
26015
26160
|
logger.debug("withdrawalContent:showUseConnected", {
|
|
26016
26161
|
isConnected,
|
|
26017
26162
|
connectedWalletAddress,
|
|
@@ -26042,7 +26187,7 @@ function WithdrawRecipientAddress({
|
|
|
26042
26187
|
const { activeTheme } = useActiveTheme();
|
|
26043
26188
|
const hasAddressError = !isValidAddress && recipientAddress !== "";
|
|
26044
26189
|
const [addressInputTouched, setAddressInputTouched] = useState39(false);
|
|
26045
|
-
const addressAtFocusRef =
|
|
26190
|
+
const addressAtFocusRef = useRef21(recipientAddress);
|
|
26046
26191
|
const { updateCustomRecipient } = useCheckoutContext();
|
|
26047
26192
|
const { connector, address: connectedWalletAddress } = useAccount();
|
|
26048
26193
|
const wallets = usePreparedWalletConnectors();
|
|
@@ -26060,7 +26205,7 @@ function WithdrawRecipientAddress({
|
|
|
26060
26205
|
firstAddress: recipientAddress,
|
|
26061
26206
|
secondAddress: connectedWalletAddress
|
|
26062
26207
|
});
|
|
26063
|
-
const inputRef =
|
|
26208
|
+
const inputRef = useRef21(null);
|
|
26064
26209
|
const { fontSize: connectedAddressFontSize } = useFittedText({
|
|
26065
26210
|
enabled: isShowingConnectedAddress,
|
|
26066
26211
|
minFontSize: MIN_RECIPIENT_ADDRESS_FONT_SIZE,
|
|
@@ -26068,8 +26213,8 @@ function WithdrawRecipientAddress({
|
|
|
26068
26213
|
text: recipientAddress,
|
|
26069
26214
|
textRef: inputRef
|
|
26070
26215
|
});
|
|
26071
|
-
const shouldFocusAfterClear =
|
|
26072
|
-
|
|
26216
|
+
const shouldFocusAfterClear = useRef21(false);
|
|
26217
|
+
useEffect42(() => {
|
|
26073
26218
|
if (shouldFocusAfterClear.current && !isShowingConnectedAddress) {
|
|
26074
26219
|
shouldFocusAfterClear.current = false;
|
|
26075
26220
|
inputRef.current?.focus();
|
|
@@ -26082,8 +26227,8 @@ function WithdrawRecipientAddress({
|
|
|
26082
26227
|
},
|
|
26083
26228
|
[setRecipientAddressProp, updateCustomRecipient]
|
|
26084
26229
|
);
|
|
26085
|
-
const hasPrefilledConnectedAddress =
|
|
26086
|
-
|
|
26230
|
+
const hasPrefilledConnectedAddress = useRef21(false);
|
|
26231
|
+
useEffect42(() => {
|
|
26087
26232
|
if (hasPrefilledConnectedAddress.current || recipientAddress || !isPrefillConnectedAddressEnabled || !showUseConnected || !connectedWalletAddress) {
|
|
26088
26233
|
return;
|
|
26089
26234
|
}
|
|
@@ -26246,7 +26391,7 @@ import {
|
|
|
26246
26391
|
formatCurrencyAndStringify as formatCurrencyAndStringify5
|
|
26247
26392
|
} from "@funkit/utils";
|
|
26248
26393
|
import * as DropdownMenu3 from "@radix-ui/react-dropdown-menu";
|
|
26249
|
-
import React147, { useRef as
|
|
26394
|
+
import React147, { useRef as useRef22, useState as useState40 } from "react";
|
|
26250
26395
|
function WithdrawAmountInput({
|
|
26251
26396
|
withdrawalInputAmount,
|
|
26252
26397
|
setWithdrawalInputAmount,
|
|
@@ -26279,8 +26424,8 @@ function WithdrawAmountInput({
|
|
|
26279
26424
|
const displaySymbol = getLighterBaseSymbol2(activeSymbol);
|
|
26280
26425
|
const chipTooltip = isLighterFast ? t("withdrawal.lighterFastTokenTooltip") : void 0;
|
|
26281
26426
|
const [amountInputTouched, setAmountInputTouched] = useState40(false);
|
|
26282
|
-
const amountAtFocusRef =
|
|
26283
|
-
const latestAmountRef =
|
|
26427
|
+
const amountAtFocusRef = useRef22(withdrawalInputAmount);
|
|
26428
|
+
const latestAmountRef = useRef22(withdrawalInputAmount);
|
|
26284
26429
|
const handleAmountChange = (e) => {
|
|
26285
26430
|
if (!amountInputTouched) {
|
|
26286
26431
|
setAmountInputTouched(true);
|
|
@@ -26732,10 +26877,10 @@ function getRelayOutputCurrencyAmount(quote, fallback2) {
|
|
|
26732
26877
|
}
|
|
26733
26878
|
|
|
26734
26879
|
// src/modals/WithdrawalModal/withdrawalHooks.tsx
|
|
26735
|
-
import { useCallback as useCallback29, useEffect as
|
|
26880
|
+
import { useCallback as useCallback29, useEffect as useEffect44, useRef as useRef24 } from "react";
|
|
26736
26881
|
|
|
26737
26882
|
// src/hooks/useTokenAndChainDropdown.ts
|
|
26738
|
-
import { useEffect as
|
|
26883
|
+
import { useEffect as useEffect43, useRef as useRef23, useState as useState41 } from "react";
|
|
26739
26884
|
import { polygon as polygon4 } from "viem/chains";
|
|
26740
26885
|
|
|
26741
26886
|
// src/hooks/useEnabledTokenTransferChainTokens.ts
|
|
@@ -26808,7 +26953,7 @@ var useTokenAndChainDropdown = ({
|
|
|
26808
26953
|
defaultChainSymbols,
|
|
26809
26954
|
defaultValues?.token
|
|
26810
26955
|
);
|
|
26811
|
-
const hasUserSelectedRef =
|
|
26956
|
+
const hasUserSelectedRef = useRef23(false);
|
|
26812
26957
|
const isValidSelectionOverride = !hasUserSelectedRef.current && selectionOverride !== void 0 && enabledChainSymbols[selectionOverride.chainId]?.includes(
|
|
26813
26958
|
selectionOverride.token
|
|
26814
26959
|
);
|
|
@@ -26827,12 +26972,12 @@ var useTokenAndChainDropdown = ({
|
|
|
26827
26972
|
const [selectedToken, setSelectedToken] = useState41(
|
|
26828
26973
|
noDefaultSelection ? void 0 : selectedDefaultToken
|
|
26829
26974
|
);
|
|
26830
|
-
|
|
26975
|
+
useEffect43(() => {
|
|
26831
26976
|
if (!noDefaultSelection) {
|
|
26832
26977
|
setSelectedChainId(selectedDefaultChainId);
|
|
26833
26978
|
}
|
|
26834
26979
|
}, [selectedDefaultChainId, noDefaultSelection]);
|
|
26835
|
-
|
|
26980
|
+
useEffect43(() => {
|
|
26836
26981
|
if (!noDefaultSelection) {
|
|
26837
26982
|
setSelectedToken(selectedDefaultToken);
|
|
26838
26983
|
}
|
|
@@ -26947,7 +27092,7 @@ var useFrozenSourceTokenBalance = ({
|
|
|
26947
27092
|
isWithdrawing,
|
|
26948
27093
|
sourceTokenBalance
|
|
26949
27094
|
}) => {
|
|
26950
|
-
const frozenSourceTokenBalanceRef =
|
|
27095
|
+
const frozenSourceTokenBalanceRef = useRef24(null);
|
|
26951
27096
|
if (!isWithdrawing) {
|
|
26952
27097
|
frozenSourceTokenBalanceRef.current = null;
|
|
26953
27098
|
}
|
|
@@ -26971,11 +27116,11 @@ function useWithdrawalLogging({
|
|
|
26971
27116
|
debouncedInputAmount,
|
|
26972
27117
|
debouncedInputAmountUsd
|
|
26973
27118
|
}) {
|
|
26974
|
-
const lastTargetAssetErrorRef =
|
|
26975
|
-
const lastQuoteErrorRef =
|
|
26976
|
-
const lastRiskyRecipientRef =
|
|
26977
|
-
const lastBlacklistedRecipientRef =
|
|
26978
|
-
|
|
27119
|
+
const lastTargetAssetErrorRef = useRef24(null);
|
|
27120
|
+
const lastQuoteErrorRef = useRef24(null);
|
|
27121
|
+
const lastRiskyRecipientRef = useRef24(null);
|
|
27122
|
+
const lastBlacklistedRecipientRef = useRef24(null);
|
|
27123
|
+
useEffect44(() => {
|
|
26979
27124
|
if (!targetAssetFetchError) {
|
|
26980
27125
|
return;
|
|
26981
27126
|
}
|
|
@@ -26990,7 +27135,7 @@ function useWithdrawalLogging({
|
|
|
26990
27135
|
});
|
|
26991
27136
|
lastTargetAssetErrorRef.current = errorKey;
|
|
26992
27137
|
}, [targetAssetFetchError, selectedChainId, selectedToken]);
|
|
26993
|
-
|
|
27138
|
+
useEffect44(() => {
|
|
26994
27139
|
if (!quoteErrorObject) {
|
|
26995
27140
|
return;
|
|
26996
27141
|
}
|
|
@@ -27018,7 +27163,7 @@ function useWithdrawalLogging({
|
|
|
27018
27163
|
debouncedInputAmount,
|
|
27019
27164
|
debouncedInputAmountUsd
|
|
27020
27165
|
]);
|
|
27021
|
-
|
|
27166
|
+
useEffect44(() => {
|
|
27022
27167
|
if (!isRisky) {
|
|
27023
27168
|
return;
|
|
27024
27169
|
}
|
|
@@ -27033,7 +27178,7 @@ function useWithdrawalLogging({
|
|
|
27033
27178
|
});
|
|
27034
27179
|
lastRiskyRecipientRef.current = warningKey;
|
|
27035
27180
|
}, [isRisky, recipientAddress, selectedChainId, selectedToken]);
|
|
27036
|
-
|
|
27181
|
+
useEffect44(() => {
|
|
27037
27182
|
if (!isRecipientBlacklisted) {
|
|
27038
27183
|
return;
|
|
27039
27184
|
}
|
|
@@ -27054,11 +27199,11 @@ function useWithdrawalLogging({
|
|
|
27054
27199
|
import { useState as useState43 } from "react";
|
|
27055
27200
|
|
|
27056
27201
|
// src/hooks/useAutoClearState.ts
|
|
27057
|
-
import { useCallback as useCallback30, useEffect as
|
|
27202
|
+
import { useCallback as useCallback30, useEffect as useEffect45, useRef as useRef25, useState as useState42 } from "react";
|
|
27058
27203
|
function useAutoClearState(initialValue = null) {
|
|
27059
27204
|
const [state, setState] = useState42(initialValue);
|
|
27060
|
-
const timeoutRef =
|
|
27061
|
-
|
|
27205
|
+
const timeoutRef = useRef25(void 0);
|
|
27206
|
+
useEffect45(() => {
|
|
27062
27207
|
return () => {
|
|
27063
27208
|
if (timeoutRef.current !== void 0) {
|
|
27064
27209
|
clearTimeout(timeoutRef.current);
|
|
@@ -27218,10 +27363,11 @@ function useWithdrawal({
|
|
|
27218
27363
|
});
|
|
27219
27364
|
}
|
|
27220
27365
|
const error2 = customCallbackFailed ? {
|
|
27221
|
-
message: caughtError.message,
|
|
27222
|
-
type: "hint",
|
|
27223
27366
|
code: "GENERIC_ERROR" /* GENERIC_ERROR */,
|
|
27224
|
-
durationMs: 1e4
|
|
27367
|
+
durationMs: 1e4,
|
|
27368
|
+
messageKey: null,
|
|
27369
|
+
message: caughtError.message,
|
|
27370
|
+
type: "hint"
|
|
27225
27371
|
} : await toCheckoutConfirmationError(t, err, wagmiConfig);
|
|
27226
27372
|
logger.info("toCheckoutConfirmationError:resulting_error", error2);
|
|
27227
27373
|
setError(error2, error2.durationMs);
|
|
@@ -27246,7 +27392,7 @@ function useWithdrawal({
|
|
|
27246
27392
|
}
|
|
27247
27393
|
|
|
27248
27394
|
// src/modals/WithdrawalModal/useTrackWithdrawalQuoteEvents.ts
|
|
27249
|
-
import { useCallback as useCallback31, useEffect as
|
|
27395
|
+
import { useCallback as useCallback31, useEffect as useEffect46, useRef as useRef26 } from "react";
|
|
27250
27396
|
function useTrackWithdrawalQuoteEvents({
|
|
27251
27397
|
isQuoteLoading,
|
|
27252
27398
|
quote,
|
|
@@ -27256,13 +27402,13 @@ function useTrackWithdrawalQuoteEvents({
|
|
|
27256
27402
|
const { trackWithdrawalQuoteDisplayed, trackWithdrawalQuoteConfirmed } = useWithdrawalAnalytics();
|
|
27257
27403
|
const { checkoutItem } = useCheckoutContext();
|
|
27258
27404
|
const checkoutId = checkoutItem?.id ?? null;
|
|
27259
|
-
const lastDisplayedQuoteIdRef =
|
|
27260
|
-
const numQuoteRefreshesRef =
|
|
27261
|
-
|
|
27405
|
+
const lastDisplayedQuoteIdRef = useRef26(null);
|
|
27406
|
+
const numQuoteRefreshesRef = useRef26(0);
|
|
27407
|
+
useEffect46(() => {
|
|
27262
27408
|
lastDisplayedQuoteIdRef.current = null;
|
|
27263
27409
|
numQuoteRefreshesRef.current = 0;
|
|
27264
27410
|
}, [checkoutId]);
|
|
27265
|
-
|
|
27411
|
+
useEffect46(() => {
|
|
27266
27412
|
if (isQuoteLoading || !quote || !target) {
|
|
27267
27413
|
return;
|
|
27268
27414
|
}
|
|
@@ -27792,11 +27938,11 @@ function usePostClientCommonWithdrawalFlow({
|
|
|
27792
27938
|
sourceTokenUsdPrice
|
|
27793
27939
|
);
|
|
27794
27940
|
const targetAssetAmount = targetUnitPrice && debouncedInputAmountUsd !== void 0 ? debouncedInputAmountUsd / targetUnitPrice : void 0;
|
|
27795
|
-
|
|
27941
|
+
useEffect47(() => {
|
|
27796
27942
|
updateWithdrawalSourceAssetAmount(quoteInputAmount);
|
|
27797
27943
|
}, [quoteInputAmount, updateWithdrawalSourceAssetAmount]);
|
|
27798
27944
|
const isActiveTargetSynced = checkoutConfig?.targetAsset === targetAssetAddress && checkoutConfig?.targetChain === selectedChainId?.toString() && checkoutConfig?.targetAssetTicker === selectedToken;
|
|
27799
|
-
|
|
27945
|
+
useEffect47(() => {
|
|
27800
27946
|
if (!targetAssetAddress || !selectedChainId || !selectedToken || isActiveTargetSynced) {
|
|
27801
27947
|
return;
|
|
27802
27948
|
}
|
|
@@ -27814,7 +27960,7 @@ function usePostClientCommonWithdrawalFlow({
|
|
|
27814
27960
|
selectedToken,
|
|
27815
27961
|
isActiveTargetSynced
|
|
27816
27962
|
]);
|
|
27817
|
-
|
|
27963
|
+
useEffect47(() => {
|
|
27818
27964
|
setTimeout(() => {
|
|
27819
27965
|
updateTargetAssetAmount(targetAssetAmount ?? 0);
|
|
27820
27966
|
}, 0);
|
|
@@ -28057,16 +28203,26 @@ function usePostClientCommonWithdrawalFlow({
|
|
|
28057
28203
|
) : null;
|
|
28058
28204
|
function resolveTopNotification() {
|
|
28059
28205
|
if (l1FallbackError) {
|
|
28060
|
-
return
|
|
28206
|
+
return l1FallbackError;
|
|
28061
28207
|
}
|
|
28062
28208
|
if (isL1FallbackAvailable) {
|
|
28063
|
-
return {
|
|
28209
|
+
return {
|
|
28210
|
+
code: "LIGHTER_L1_FALLBACK",
|
|
28211
|
+
messageKey: "withdrawal.lighterL1FallbackNotice",
|
|
28212
|
+
message: t("withdrawal.lighterL1FallbackNotice"),
|
|
28213
|
+
type: "hint"
|
|
28214
|
+
};
|
|
28064
28215
|
}
|
|
28065
28216
|
if (errorNotification) {
|
|
28066
28217
|
return errorNotification;
|
|
28067
28218
|
}
|
|
28068
28219
|
if (maxExceededMessage) {
|
|
28069
|
-
return {
|
|
28220
|
+
return {
|
|
28221
|
+
code: "AMOUNT_ABOVE_MAXIMUM",
|
|
28222
|
+
messageKey: "withdrawal.fastMaxExceededMessage",
|
|
28223
|
+
message: maxExceededMessage,
|
|
28224
|
+
type: "hint"
|
|
28225
|
+
};
|
|
28070
28226
|
}
|
|
28071
28227
|
return null;
|
|
28072
28228
|
}
|
|
@@ -28199,6 +28355,11 @@ var WithdrawContent = ({
|
|
|
28199
28355
|
bottomBarId,
|
|
28200
28356
|
disableSubmit
|
|
28201
28357
|
});
|
|
28358
|
+
useTrackErrorShown({
|
|
28359
|
+
error: topNotification,
|
|
28360
|
+
flow: "withdraw",
|
|
28361
|
+
step: "ENTER_AMOUNT" /* ENTER_AMOUNT */
|
|
28362
|
+
});
|
|
28202
28363
|
const { trackWithdrawalTransferInteracted } = useWithdrawalAnalytics();
|
|
28203
28364
|
const targetFor = (token, chainId2) => ({
|
|
28204
28365
|
asset: token && chainId2 !== void 0 ? addressBySymbolByChainId[chainId2]?.[token] ?? null : null,
|
|
@@ -28656,11 +28817,11 @@ var useWithdrawFops = (params) => {
|
|
|
28656
28817
|
|
|
28657
28818
|
// src/hooks/useSwappedPreload.ts
|
|
28658
28819
|
import { isSwappedFop } from "@funkit/connect-core";
|
|
28659
|
-
import { useEffect as
|
|
28820
|
+
import { useEffect as useEffect48 } from "react";
|
|
28660
28821
|
|
|
28661
28822
|
// src/modals/CheckoutModal/SourceChange/FormOfPaymentsList.tsx
|
|
28662
28823
|
import { getFopKey, isSyntheticFop, sortFops as sortFops2 } from "@funkit/connect-core";
|
|
28663
|
-
import React154, { useRef as
|
|
28824
|
+
import React154, { useRef as useRef27, useState as useState45 } from "react";
|
|
28664
28825
|
|
|
28665
28826
|
// src/components/Icons/GlobeIcon.tsx
|
|
28666
28827
|
import React150 from "react";
|
|
@@ -28868,7 +29029,7 @@ function FormOfPaymentsContent({
|
|
|
28868
29029
|
}) {
|
|
28869
29030
|
const { t } = useFunkitTranslation();
|
|
28870
29031
|
const [isExpanded, setIsExpanded] = useState45(false);
|
|
28871
|
-
const toggleRef =
|
|
29032
|
+
const toggleRef = useRef27(null);
|
|
28872
29033
|
const { primary, secondary } = getFormOfPaymentSections(fopsData, fopPriority);
|
|
28873
29034
|
const totalItems = primary.items.length + secondary.items.length;
|
|
28874
29035
|
const showToggle = totalItems > defaultMaxItems;
|
|
@@ -29031,7 +29192,7 @@ function FormOfPaymentsList({
|
|
|
29031
29192
|
function useSwappedPreload(fopsData, mode) {
|
|
29032
29193
|
const fopPriority = useDynamicConfig("foppriority");
|
|
29033
29194
|
const { setIframeUrl } = useSwappedContext(mode);
|
|
29034
|
-
|
|
29195
|
+
useEffect48(() => {
|
|
29035
29196
|
if (!fopsData) {
|
|
29036
29197
|
setIframeUrl(null);
|
|
29037
29198
|
return;
|
|
@@ -29190,7 +29351,7 @@ function WithdrawalMethodSelect({
|
|
|
29190
29351
|
|
|
29191
29352
|
// src/modals/WithdrawalModal/WithdrawalSwappedIframeController.tsx
|
|
29192
29353
|
import { useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
29193
|
-
import React157, { useEffect as
|
|
29354
|
+
import React157, { useEffect as useEffect51 } from "react";
|
|
29194
29355
|
|
|
29195
29356
|
// src/components/SwappedIframeSkeleton.tsx
|
|
29196
29357
|
import React156 from "react";
|
|
@@ -29309,7 +29470,7 @@ function SwappedIframeSkeleton({
|
|
|
29309
29470
|
}
|
|
29310
29471
|
|
|
29311
29472
|
// src/hooks/useSwappedIframeLifecycle.ts
|
|
29312
|
-
import { useEffect as
|
|
29473
|
+
import { useEffect as useEffect49, useRef as useRef28 } from "react";
|
|
29313
29474
|
var SWAPPED_IFRAME_TIMEOUT = 15e3;
|
|
29314
29475
|
function useSwappedIframeLifecycle({
|
|
29315
29476
|
fopType,
|
|
@@ -29317,13 +29478,13 @@ function useSwappedIframeLifecycle({
|
|
|
29317
29478
|
mode
|
|
29318
29479
|
}) {
|
|
29319
29480
|
const { activateIframe, deactivateIframe, isSwappedReady } = useSwappedContext(mode);
|
|
29320
|
-
const timeoutRef =
|
|
29481
|
+
const timeoutRef = useRef28(void 0);
|
|
29321
29482
|
const stableOnTimeout = useEffectEvent(onTimeout);
|
|
29322
|
-
|
|
29483
|
+
useEffect49(() => {
|
|
29323
29484
|
activateIframe(fopType);
|
|
29324
29485
|
return () => deactivateIframe();
|
|
29325
29486
|
}, [fopType, activateIframe, deactivateIframe]);
|
|
29326
|
-
|
|
29487
|
+
useEffect49(() => {
|
|
29327
29488
|
if (isSwappedReady) {
|
|
29328
29489
|
clearTimeout(timeoutRef.current);
|
|
29329
29490
|
return;
|
|
@@ -29340,7 +29501,7 @@ function useSwappedIframeLifecycle({
|
|
|
29340
29501
|
|
|
29341
29502
|
// src/modals/WithdrawalModal/useFiatWithdrawal.ts
|
|
29342
29503
|
import { getCheckoutQuoteV2 as getCheckoutQuoteV22 } from "@funkit/api-base";
|
|
29343
|
-
import { useEffect as
|
|
29504
|
+
import { useEffect as useEffect50, useRef as useRef29 } from "react";
|
|
29344
29505
|
import { safeBigInt } from "@funkit/connect-core";
|
|
29345
29506
|
import {
|
|
29346
29507
|
findSwappedSourceOverride as findSwappedSourceOverride2,
|
|
@@ -29448,7 +29609,7 @@ function useFiatWithdrawal({
|
|
|
29448
29609
|
tokenAddress: config.sourceTokenAddress
|
|
29449
29610
|
})
|
|
29450
29611
|
) : null;
|
|
29451
|
-
|
|
29612
|
+
useEffect50(() => {
|
|
29452
29613
|
if (!legs || !checkoutItem) {
|
|
29453
29614
|
return;
|
|
29454
29615
|
}
|
|
@@ -29467,8 +29628,8 @@ function useFiatWithdrawal({
|
|
|
29467
29628
|
legs?.targetTokenSymbol,
|
|
29468
29629
|
legs?.iconSrc
|
|
29469
29630
|
]);
|
|
29470
|
-
const isProcessingOrderRef =
|
|
29471
|
-
const submittedOrderIdsRef =
|
|
29631
|
+
const isProcessingOrderRef = useRef29(false);
|
|
29632
|
+
const submittedOrderIdsRef = useRef29(/* @__PURE__ */ new Set());
|
|
29472
29633
|
const { handleWithdrawal, withdrawalError } = useWithdrawal({
|
|
29473
29634
|
config,
|
|
29474
29635
|
withdrawalItem
|
|
@@ -29479,7 +29640,7 @@ function useFiatWithdrawal({
|
|
|
29479
29640
|
onError();
|
|
29480
29641
|
}
|
|
29481
29642
|
});
|
|
29482
|
-
|
|
29643
|
+
useEffect50(() => {
|
|
29483
29644
|
if (withdrawalError) {
|
|
29484
29645
|
handleWithdrawalFailure();
|
|
29485
29646
|
}
|
|
@@ -29659,7 +29820,7 @@ function WithdrawalSwappedIframeController({
|
|
|
29659
29820
|
checkoutId: withdrawalItem?.id
|
|
29660
29821
|
})
|
|
29661
29822
|
);
|
|
29662
|
-
|
|
29823
|
+
useEffect51(() => {
|
|
29663
29824
|
if (isSwappedReady) {
|
|
29664
29825
|
const metadata = getTrackMetadata();
|
|
29665
29826
|
logger.info("swapped-withdrawal-iframe:ready", metadata);
|
|
@@ -29772,7 +29933,7 @@ function WithdrawalSwappedIframeController({
|
|
|
29772
29933
|
}
|
|
29773
29934
|
}
|
|
29774
29935
|
});
|
|
29775
|
-
|
|
29936
|
+
useEffect51(() => {
|
|
29776
29937
|
return swappedTransport.onMessage(handleSwappedMessage);
|
|
29777
29938
|
}, [swappedTransport, handleSwappedMessage]);
|
|
29778
29939
|
useSwappedIframeLifecycle({
|
|
@@ -29814,18 +29975,18 @@ import { noop as noop4 } from "@funkit/utils";
|
|
|
29814
29975
|
import React160 from "react";
|
|
29815
29976
|
|
|
29816
29977
|
// src/components/FunCheckoutHistory/FunCheckoutHistoryContent.tsx
|
|
29817
|
-
import React159, { useEffect as
|
|
29978
|
+
import React159, { useEffect as useEffect53 } from "react";
|
|
29818
29979
|
|
|
29819
29980
|
// src/components/FunCheckoutHistory/FunCheckoutHistoryDetail.tsx
|
|
29820
29981
|
import React158, { useCallback as useCallback34, useMemo as useMemo43, useState as useState46 } from "react";
|
|
29821
29982
|
import { createPortal as createPortal7 } from "react-dom";
|
|
29822
29983
|
|
|
29823
29984
|
// src/hooks/useFunListeners.ts
|
|
29824
|
-
import { useEffect as
|
|
29985
|
+
import { useEffect as useEffect52, useRef as useRef30 } from "react";
|
|
29825
29986
|
function useCheckoutHistoryListener(activate = true, singleDepositAddr) {
|
|
29826
|
-
const activeIntervalRef =
|
|
29987
|
+
const activeIntervalRef = useRef30(void 0);
|
|
29827
29988
|
const { startCheckoutHistoryListener, stopCheckoutHistoryListener } = useCheckoutHistoryContext();
|
|
29828
|
-
|
|
29989
|
+
useEffect52(() => {
|
|
29829
29990
|
if (activate) {
|
|
29830
29991
|
const createdIntervalId = startCheckoutHistoryListener(
|
|
29831
29992
|
/* singleDepositAddr */
|
|
@@ -29978,7 +30139,7 @@ function FunCheckoutHistoryContent({
|
|
|
29978
30139
|
initDirectExecution: directExecutionInfo
|
|
29979
30140
|
});
|
|
29980
30141
|
const isDirectExecutionRecord = isCheckoutHistoryDirectExecution(depositAddress);
|
|
29981
|
-
|
|
30142
|
+
useEffect53(() => {
|
|
29982
30143
|
if (isDirectExecutionRecord) {
|
|
29983
30144
|
if (directExecution) {
|
|
29984
30145
|
onHistoryItemChange?.({
|
|
@@ -30086,7 +30247,7 @@ function WithdrawalTypeSelect({
|
|
|
30086
30247
|
}
|
|
30087
30248
|
|
|
30088
30249
|
// src/modals/WithdrawalModal/useTrackWithdrawalEvents.ts
|
|
30089
|
-
import { useCallback as useCallback35, useEffect as
|
|
30250
|
+
import { useCallback as useCallback35, useEffect as useEffect54, useRef as useRef31 } from "react";
|
|
30090
30251
|
function getCompletionState(step) {
|
|
30091
30252
|
switch (step) {
|
|
30092
30253
|
case "PENDING_CALLBACK" /* PENDING_CALLBACK */:
|
|
@@ -30130,16 +30291,16 @@ function useTrackWithdrawalEvents({
|
|
|
30130
30291
|
}));
|
|
30131
30292
|
});
|
|
30132
30293
|
const checkoutId = checkoutItem?.id;
|
|
30133
|
-
|
|
30294
|
+
useEffect54(() => {
|
|
30134
30295
|
if (checkoutId && claimAnalyticsEvent("fc_modal_opened" /* MODAL_OPENED */, checkoutId)) {
|
|
30135
30296
|
trackModalOpened();
|
|
30136
30297
|
}
|
|
30137
30298
|
}, [checkoutId, trackModalOpened]);
|
|
30138
|
-
const trackedCheckoutIdRef =
|
|
30139
|
-
const lastViewedStepRef =
|
|
30140
|
-
const stepIndexRef =
|
|
30141
|
-
const stepHistoryRef =
|
|
30142
|
-
|
|
30299
|
+
const trackedCheckoutIdRef = useRef31(null);
|
|
30300
|
+
const lastViewedStepRef = useRef31(null);
|
|
30301
|
+
const stepIndexRef = useRef31(1);
|
|
30302
|
+
const stepHistoryRef = useRef31([]);
|
|
30303
|
+
useEffect54(() => {
|
|
30143
30304
|
if (!open) {
|
|
30144
30305
|
trackedCheckoutIdRef.current = null;
|
|
30145
30306
|
lastViewedStepRef.current = null;
|
|
@@ -30230,7 +30391,7 @@ function WithdrawalModal({
|
|
|
30230
30391
|
}
|
|
30231
30392
|
return "ENTER_AMOUNT" /* ENTER_AMOUNT */;
|
|
30232
30393
|
};
|
|
30233
|
-
const isMethodSelectionInFlight =
|
|
30394
|
+
const isMethodSelectionInFlight = useRef32(false);
|
|
30234
30395
|
const [navigation, setNavigation] = useState47(() => ({
|
|
30235
30396
|
isBackNavigation: false,
|
|
30236
30397
|
step: getInitialStep()
|
|
@@ -30256,13 +30417,13 @@ function WithdrawalModal({
|
|
|
30256
30417
|
"SELECT_METHOD" /* SELECT_METHOD */,
|
|
30257
30418
|
"ENTER_AMOUNT" /* ENTER_AMOUNT */
|
|
30258
30419
|
].includes(step);
|
|
30259
|
-
|
|
30420
|
+
useEffect55(() => {
|
|
30260
30421
|
setNavigation({
|
|
30261
30422
|
isBackNavigation: false,
|
|
30262
30423
|
step: isInitialStepSelectMethod ? "SELECT_METHOD" /* SELECT_METHOD */ : "ENTER_AMOUNT" /* ENTER_AMOUNT */
|
|
30263
30424
|
});
|
|
30264
30425
|
}, [isInitialStepSelectMethod]);
|
|
30265
|
-
|
|
30426
|
+
useEffect55(() => {
|
|
30266
30427
|
if (step === "SELECT_METHOD" /* SELECT_METHOD */) {
|
|
30267
30428
|
isMethodSelectionInFlight.current = false;
|
|
30268
30429
|
}
|
|
@@ -30636,8 +30797,8 @@ import React285 from "react";
|
|
|
30636
30797
|
// src/modals/CheckoutModal/stepTransition.ts
|
|
30637
30798
|
import {
|
|
30638
30799
|
useCallback as useCallback61,
|
|
30639
|
-
useEffect as
|
|
30640
|
-
useRef as
|
|
30800
|
+
useEffect as useEffect81,
|
|
30801
|
+
useRef as useRef49,
|
|
30641
30802
|
useState as useState81
|
|
30642
30803
|
} from "react";
|
|
30643
30804
|
|
|
@@ -30645,12 +30806,12 @@ import {
|
|
|
30645
30806
|
import { useMemo as useMemo45 } from "react";
|
|
30646
30807
|
function useCheckoutQuoteNotification() {
|
|
30647
30808
|
const { clearCheckoutQuoteMessages } = useQuoteContext();
|
|
30648
|
-
const {
|
|
30809
|
+
const { quoteError, quoteStepMessage } = useQuoteContext();
|
|
30649
30810
|
const quoteNotification = useMemo45(() => {
|
|
30650
|
-
if (
|
|
30811
|
+
if (quoteError) {
|
|
30651
30812
|
return {
|
|
30652
30813
|
messageType: "error",
|
|
30653
|
-
quoteMessage:
|
|
30814
|
+
quoteMessage: quoteError.message
|
|
30654
30815
|
};
|
|
30655
30816
|
}
|
|
30656
30817
|
if (quoteStepMessage !== "") {
|
|
@@ -30663,7 +30824,7 @@ function useCheckoutQuoteNotification() {
|
|
|
30663
30824
|
messageType: "none",
|
|
30664
30825
|
quoteMessage: void 0
|
|
30665
30826
|
};
|
|
30666
|
-
}, [
|
|
30827
|
+
}, [quoteError, quoteStepMessage]);
|
|
30667
30828
|
return {
|
|
30668
30829
|
quoteNotification,
|
|
30669
30830
|
clearCheckoutQuoteMessages
|
|
@@ -32098,7 +32259,7 @@ function VirtualFiatAccount({
|
|
|
32098
32259
|
|
|
32099
32260
|
// src/modals/PolymarketPerpsTransfer/PerpsTransferStep.tsx
|
|
32100
32261
|
import { useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
32101
|
-
import React193, { useEffect as
|
|
32262
|
+
import React193, { useEffect as useEffect57, useRef as useRef34, useState as useState52 } from "react";
|
|
32102
32263
|
import { createPortal as createPortal11 } from "react-dom";
|
|
32103
32264
|
|
|
32104
32265
|
// src/hooks/usePolymarketAccountBalances.ts
|
|
@@ -32272,7 +32433,7 @@ function useRecordPerpsTransfer() {
|
|
|
32272
32433
|
import React189 from "react";
|
|
32273
32434
|
|
|
32274
32435
|
// src/modals/PolymarketPerpsTransfer/PerpsTransferAmountInput.tsx
|
|
32275
|
-
import React184, { useRef as
|
|
32436
|
+
import React184, { useRef as useRef33 } from "react";
|
|
32276
32437
|
|
|
32277
32438
|
// src/modals/PolymarketPerpsTransfer/PerpsTransferAmountInput.css.ts
|
|
32278
32439
|
var transferAmountInput = "_1ykz3qq0";
|
|
@@ -32289,8 +32450,8 @@ function PerpsTransferAmountInput({
|
|
|
32289
32450
|
}) {
|
|
32290
32451
|
const { t } = useFunkitTranslation();
|
|
32291
32452
|
const { activeTheme } = useActiveTheme();
|
|
32292
|
-
const inputRef =
|
|
32293
|
-
const availableWidthRef =
|
|
32453
|
+
const inputRef = useRef33(null);
|
|
32454
|
+
const availableWidthRef = useRef33(null);
|
|
32294
32455
|
const maxFontSize = Number.parseInt(activeTheme.fontSize.inputAmount.fontSize, 10) || DEFAULT_MAX_FONT_SIZE;
|
|
32295
32456
|
const inputText = amount || AMOUNT_PLACEHOLDER;
|
|
32296
32457
|
const { fontSize: fittedFontSize, textWidth } = useFittedText({
|
|
@@ -32852,7 +33013,7 @@ function PerpsTransferBottomBar({ form }) {
|
|
|
32852
33013
|
|
|
32853
33014
|
// src/modals/PolymarketPerpsTransfer/usePerpsTransferForm.ts
|
|
32854
33015
|
import * as dnum6 from "dnum";
|
|
32855
|
-
import { useEffect as
|
|
33016
|
+
import { useEffect as useEffect56, useState as useState51 } from "react";
|
|
32856
33017
|
function parseAmount(amount) {
|
|
32857
33018
|
return Number(amount.replace(/,/g, ""));
|
|
32858
33019
|
}
|
|
@@ -32899,7 +33060,7 @@ function usePerpsTransferForm({
|
|
|
32899
33060
|
const [direction, setDirection] = useState51(
|
|
32900
33061
|
lockedDirection ?? initialDirection
|
|
32901
33062
|
);
|
|
32902
|
-
|
|
33063
|
+
useEffect56(() => {
|
|
32903
33064
|
logger.info("polymarket:perpsTransfer:directionResolved", {
|
|
32904
33065
|
access: {
|
|
32905
33066
|
predictions: predictionsAccessible,
|
|
@@ -32916,12 +33077,12 @@ function usePerpsTransferForm({
|
|
|
32916
33077
|
perpsAccessible,
|
|
32917
33078
|
predictionsAccessible
|
|
32918
33079
|
]);
|
|
32919
|
-
|
|
33080
|
+
useEffect56(() => {
|
|
32920
33081
|
if (lockedDirection) {
|
|
32921
33082
|
setDirection(lockedDirection);
|
|
32922
33083
|
}
|
|
32923
33084
|
}, [lockedDirection]);
|
|
32924
|
-
|
|
33085
|
+
useEffect56(() => {
|
|
32925
33086
|
if (status === "success") {
|
|
32926
33087
|
setAmount("");
|
|
32927
33088
|
setAmountSelection(null);
|
|
@@ -33056,14 +33217,14 @@ function PerpsTransferStepComponent() {
|
|
|
33056
33217
|
const { checkoutItem } = useCheckoutContext();
|
|
33057
33218
|
const recordTransfer = useRecordPerpsTransfer();
|
|
33058
33219
|
const [status, setStatus] = useState52("idle");
|
|
33059
|
-
const successResetTimerRef =
|
|
33220
|
+
const successResetTimerRef = useRef34(null);
|
|
33060
33221
|
const clearSuccessResetTimer = () => {
|
|
33061
33222
|
if (successResetTimerRef.current !== null) {
|
|
33062
33223
|
window.clearTimeout(successResetTimerRef.current);
|
|
33063
33224
|
successResetTimerRef.current = null;
|
|
33064
33225
|
}
|
|
33065
33226
|
};
|
|
33066
|
-
|
|
33227
|
+
useEffect57(() => clearSuccessResetTimer, []);
|
|
33067
33228
|
const perpsTransfer = checkoutItem?.initSettings.config.polymarketPerpsTransfer;
|
|
33068
33229
|
const balances = usePolymarketAccountBalances({
|
|
33069
33230
|
predictions: perpsTransfer?.predictions,
|
|
@@ -33234,8 +33395,8 @@ import { bluvoExecuteWithdrawal as bluvoExecuteWithdrawal2 } from "@funkit/api-b
|
|
|
33234
33395
|
// src/components/FunInput/FunTwoFaInput.tsx
|
|
33235
33396
|
import React196, {
|
|
33236
33397
|
useCallback as useCallback40,
|
|
33237
|
-
useEffect as
|
|
33238
|
-
useRef as
|
|
33398
|
+
useEffect as useEffect58,
|
|
33399
|
+
useRef as useRef35,
|
|
33239
33400
|
useState as useState53
|
|
33240
33401
|
} from "react";
|
|
33241
33402
|
var FunTwoFaInput = ({
|
|
@@ -33249,13 +33410,13 @@ var FunTwoFaInput = ({
|
|
|
33249
33410
|
hasResent = false,
|
|
33250
33411
|
onCompleted
|
|
33251
33412
|
}) => {
|
|
33252
|
-
const inputRefs =
|
|
33413
|
+
const inputRefs = useRef35(
|
|
33253
33414
|
Array.from({ length: initialInputLength }, () => null)
|
|
33254
33415
|
);
|
|
33255
33416
|
const [currentLength, setCurrentLength] = useState53(initialInputLength);
|
|
33256
33417
|
const [focusIndex, setFocusIndex] = useState53(0);
|
|
33257
33418
|
const [isFocused, setIsFocused] = useState53(false);
|
|
33258
|
-
|
|
33419
|
+
useEffect58(() => {
|
|
33259
33420
|
if (!value) {
|
|
33260
33421
|
setFocusIndex(0);
|
|
33261
33422
|
}
|
|
@@ -33835,7 +33996,7 @@ var TwoFactorIcon = () => /* @__PURE__ */ React197.createElement(
|
|
|
33835
33996
|
);
|
|
33836
33997
|
|
|
33837
33998
|
// src/modals/CheckoutModal/Brokerage/ConnectExchange.tsx
|
|
33838
|
-
import React201, { useCallback as useCallback42, useEffect as
|
|
33999
|
+
import React201, { useCallback as useCallback42, useEffect as useEffect59, useRef as useRef36, useState as useState55 } from "react";
|
|
33839
34000
|
import { createPortal as createPortal13 } from "react-dom";
|
|
33840
34001
|
|
|
33841
34002
|
// src/components/FunMessage/FunMessage.tsx
|
|
@@ -34177,13 +34338,18 @@ function ConnectExchange({
|
|
|
34177
34338
|
trackExchangeConnectStarted
|
|
34178
34339
|
} = useDepositAnalytics();
|
|
34179
34340
|
const { updateSelectedPaymentMethodInfo } = useCheckoutContext();
|
|
34180
|
-
const [authError, setAuthError] = useState55(
|
|
34341
|
+
const [authError, setAuthError] = useState55(null);
|
|
34181
34342
|
const { exchangeType, walletId, isConnected, handleStartWithdrawal } = useBluvo();
|
|
34182
34343
|
const [isLoadingBluvoModal, setIsLoadingBluvoModal] = useState55(false);
|
|
34183
34344
|
const icon = getExchangeIcon(brokerType, iconSize);
|
|
34184
34345
|
const isLoading = isLoadingBluvoModal;
|
|
34185
34346
|
const exchangeName = getExchangeName(brokerType);
|
|
34186
|
-
const isConnectingRef =
|
|
34347
|
+
const isConnectingRef = useRef36(false);
|
|
34348
|
+
useTrackErrorShown({
|
|
34349
|
+
error: authError,
|
|
34350
|
+
flow: "deposit",
|
|
34351
|
+
step: "connect_exchange" /* CONNECT_EXCHANGE */
|
|
34352
|
+
});
|
|
34187
34353
|
const navigateToBrokerage = useEffectEvent(() => {
|
|
34188
34354
|
if (exchangeType !== brokerType || !walletId) {
|
|
34189
34355
|
return;
|
|
@@ -34201,21 +34367,19 @@ function ConnectExchange({
|
|
|
34201
34367
|
updateSelectedPaymentMethodInfo(paymentInfo);
|
|
34202
34368
|
onNext({ paymentMethodInfo: paymentInfo, popCurrentStep: true });
|
|
34203
34369
|
});
|
|
34204
|
-
const handleAuthError = useEffectEvent(
|
|
34205
|
-
(error)
|
|
34206
|
-
|
|
34207
|
-
|
|
34208
|
-
|
|
34209
|
-
|
|
34210
|
-
|
|
34211
|
-
|
|
34212
|
-
|
|
34213
|
-
|
|
34214
|
-
isConnectingRef.current = false;
|
|
34215
|
-
}
|
|
34370
|
+
const handleAuthError = useEffectEvent((error) => {
|
|
34371
|
+
setAuthError(error);
|
|
34372
|
+
setIsLoadingBluvoModal(false);
|
|
34373
|
+
if (isConnectingRef.current) {
|
|
34374
|
+
trackExchangeConnectFailed({
|
|
34375
|
+
errorCode: error.code,
|
|
34376
|
+
errorMessage: error.messageKey,
|
|
34377
|
+
provider: brokerType
|
|
34378
|
+
});
|
|
34379
|
+
isConnectingRef.current = false;
|
|
34216
34380
|
}
|
|
34217
|
-
);
|
|
34218
|
-
|
|
34381
|
+
});
|
|
34382
|
+
useEffect59(() => {
|
|
34219
34383
|
if (isConnected) {
|
|
34220
34384
|
navigateToBrokerage();
|
|
34221
34385
|
}
|
|
@@ -34224,14 +34388,15 @@ function ConnectExchange({
|
|
|
34224
34388
|
try {
|
|
34225
34389
|
isConnectingRef.current = true;
|
|
34226
34390
|
setIsLoadingBluvoModal(true);
|
|
34227
|
-
setAuthError(
|
|
34391
|
+
setAuthError(null);
|
|
34228
34392
|
trackExchangeConnectStarted(brokerType);
|
|
34229
34393
|
const result = await handleStartWithdrawal(brokerType);
|
|
34230
34394
|
if ("error" in result) {
|
|
34231
34395
|
handleAuthError({
|
|
34232
34396
|
code: result.error.code,
|
|
34233
34397
|
messageKey: "brokerage.bluvoConnectionError",
|
|
34234
|
-
message: t("brokerage.bluvoConnectionError")
|
|
34398
|
+
message: t("brokerage.bluvoConnectionError"),
|
|
34399
|
+
type: "error"
|
|
34235
34400
|
});
|
|
34236
34401
|
}
|
|
34237
34402
|
} catch (err) {
|
|
@@ -34239,7 +34404,8 @@ function ConnectExchange({
|
|
|
34239
34404
|
handleAuthError({
|
|
34240
34405
|
code: null,
|
|
34241
34406
|
messageKey: "brokerage.bluvoConnectionError",
|
|
34242
|
-
message: t("brokerage.bluvoConnectionError")
|
|
34407
|
+
message: t("brokerage.bluvoConnectionError"),
|
|
34408
|
+
type: "error"
|
|
34243
34409
|
});
|
|
34244
34410
|
} finally {
|
|
34245
34411
|
setIsLoadingBluvoModal(false);
|
|
@@ -34275,20 +34441,20 @@ function ConnectExchange({
|
|
|
34275
34441
|
/* @__PURE__ */ React201.createElement(
|
|
34276
34442
|
Dialog.BottomBar,
|
|
34277
34443
|
{
|
|
34278
|
-
topSectionVisible: authError !==
|
|
34444
|
+
topSectionVisible: authError !== null,
|
|
34279
34445
|
topSection: /* @__PURE__ */ React201.createElement(
|
|
34280
34446
|
FunNotification,
|
|
34281
34447
|
{
|
|
34282
|
-
description: authError,
|
|
34283
|
-
type:
|
|
34284
|
-
isVisible: authError !==
|
|
34448
|
+
description: authError?.message,
|
|
34449
|
+
type: authError?.type,
|
|
34450
|
+
isVisible: authError !== null
|
|
34285
34451
|
}
|
|
34286
34452
|
),
|
|
34287
34453
|
actionButtonProps: {
|
|
34288
34454
|
title: t("brokerage.continue"),
|
|
34289
34455
|
onClick: onClickContinue,
|
|
34290
34456
|
isLoading,
|
|
34291
|
-
isDisabled: isLoading || authError !==
|
|
34457
|
+
isDisabled: isLoading || authError !== null
|
|
34292
34458
|
}
|
|
34293
34459
|
}
|
|
34294
34460
|
),
|
|
@@ -34673,11 +34839,11 @@ function CheckoutComplete({
|
|
|
34673
34839
|
|
|
34674
34840
|
// src/modals/CheckoutModal/ConfirmationStep/ConfirmationStep.tsx
|
|
34675
34841
|
import * as dnum8 from "dnum";
|
|
34676
|
-
import React220, { useEffect as
|
|
34842
|
+
import React220, { useEffect as useEffect65, useMemo as useMemo51, useState as useState67 } from "react";
|
|
34677
34843
|
import { createPortal as createPortal16 } from "react-dom";
|
|
34678
34844
|
|
|
34679
34845
|
// src/providers/UserPresenceContext.tsx
|
|
34680
|
-
import React206, { useEffect as
|
|
34846
|
+
import React206, { useEffect as useEffect60 } from "react";
|
|
34681
34847
|
import {
|
|
34682
34848
|
createContext as createContext19,
|
|
34683
34849
|
useContext as useContext19,
|
|
@@ -34689,7 +34855,7 @@ var UserPresenceContext = createContext19({
|
|
|
34689
34855
|
});
|
|
34690
34856
|
var UserPresenceProvider = ({ children }) => {
|
|
34691
34857
|
const [isAway, setIsAway] = useState57(false);
|
|
34692
|
-
|
|
34858
|
+
useEffect60(() => {
|
|
34693
34859
|
let timeoutId;
|
|
34694
34860
|
const handleVisibilityChange = () => {
|
|
34695
34861
|
if (document.visibilityState === "visible") {
|
|
@@ -35612,7 +35778,7 @@ import { DirectExecutionType as DirectExecutionType6, createDirectExecution as c
|
|
|
35612
35778
|
import {
|
|
35613
35779
|
isTokenEquivalent as isTokenEquivalent9
|
|
35614
35780
|
} from "@funkit/utils";
|
|
35615
|
-
import { useCallback as useCallback46, useRef as
|
|
35781
|
+
import { useCallback as useCallback46, useRef as useRef37, useState as useState59 } from "react";
|
|
35616
35782
|
import { erc20Abi as erc20Abi6, isAddress as isAddress2 } from "viem";
|
|
35617
35783
|
function getTransferAmountBaseUnit(tokenAmountBaseUnit, fallbackAssetAmount, decimals) {
|
|
35618
35784
|
if (tokenAmountBaseUnit) {
|
|
@@ -35751,7 +35917,7 @@ function useNadoDirectTransfer() {
|
|
|
35751
35917
|
const { refreshCheckoutHistory } = useCheckoutHistoryContext();
|
|
35752
35918
|
const [isPending, setIsPending] = useState59(false);
|
|
35753
35919
|
const [error, setError] = useState59(null);
|
|
35754
|
-
const isSubmittingRef =
|
|
35920
|
+
const isSubmittingRef = useRef37(false);
|
|
35755
35921
|
const config = checkoutItem?.initSettings.config;
|
|
35756
35922
|
const targetChainStr = config?.targetChain;
|
|
35757
35923
|
const targetAsset = config?.targetAsset;
|
|
@@ -36241,7 +36407,7 @@ function mapRetryAction(quoteBuilder, params) {
|
|
|
36241
36407
|
}
|
|
36242
36408
|
|
|
36243
36409
|
// src/modals/CheckoutModal/ConfirmationStep/useSourceAssetConfirm.tsx
|
|
36244
|
-
import { useEffect as
|
|
36410
|
+
import { useEffect as useEffect61, useState as useState61 } from "react";
|
|
36245
36411
|
function useSourceAssetConfirm(setPreloadedQuoteData) {
|
|
36246
36412
|
const { setCheckoutQuote, getCheckoutQuote, setQuoteProgress } = useQuoteContext();
|
|
36247
36413
|
const { checkoutItem, setCheckout } = useCheckoutContext();
|
|
@@ -36290,7 +36456,7 @@ function useHackyTriggerWorkaroundReactDevBrainExplode() {
|
|
|
36290
36456
|
function useTriggerQuoteAndOtherStuffsWithExtremeCaution(onResult, setPreloadedQuoteData) {
|
|
36291
36457
|
const [assetRefresh, triggerAssetConfirm] = useHackyTriggerWorkaroundReactDevBrainExplode();
|
|
36292
36458
|
const { isSourceAssetConfirming, onSourceAssetConfirmed } = useSourceAssetConfirm(setPreloadedQuoteData);
|
|
36293
|
-
|
|
36459
|
+
useEffect61(() => {
|
|
36294
36460
|
if (assetRefresh === 0) {
|
|
36295
36461
|
return;
|
|
36296
36462
|
}
|
|
@@ -36517,19 +36683,25 @@ function useAccountBalancePostCheckout(setPostCheckoutStepMessage) {
|
|
|
36517
36683
|
function toPostCheckoutError(t, error) {
|
|
36518
36684
|
const POST_CHECKOUT_UI_ERRORS = {
|
|
36519
36685
|
SIGNATURE_DENIED: {
|
|
36686
|
+
code: "SIGNATURE_DENIED",
|
|
36520
36687
|
disableContinue: false,
|
|
36521
36688
|
durationMs: 5e3,
|
|
36689
|
+
messageKey: "postCheckout.signatureDeclined",
|
|
36522
36690
|
message: t("postCheckout.signatureDeclined"),
|
|
36523
36691
|
type: "hint"
|
|
36524
36692
|
},
|
|
36525
36693
|
SWITCH_CHAIN_ERROR: {
|
|
36694
|
+
code: "SWITCH_CHAIN_ERROR",
|
|
36526
36695
|
disableContinue: false,
|
|
36696
|
+
messageKey: "postCheckout.unableToSwitchChains",
|
|
36527
36697
|
message: t("postCheckout.unableToSwitchChains"),
|
|
36528
36698
|
type: "warning"
|
|
36529
36699
|
},
|
|
36530
36700
|
// TODO: make sure it works
|
|
36531
36701
|
ERROR_FUNDING_CHECKOUT: {
|
|
36702
|
+
code: "ERROR_FUNDING_CHECKOUT",
|
|
36532
36703
|
disableContinue: true,
|
|
36704
|
+
messageKey: "postCheckout.errorFundingCheckoutMessage",
|
|
36533
36705
|
message: /* @__PURE__ */ React217.createElement(
|
|
36534
36706
|
FunkitTrans,
|
|
36535
36707
|
{
|
|
@@ -36552,14 +36724,18 @@ function toPostCheckoutError(t, error) {
|
|
|
36552
36724
|
if (error instanceof Error) {
|
|
36553
36725
|
if (error.message.match(/insufficient balance/i)) {
|
|
36554
36726
|
return {
|
|
36727
|
+
code: "INSUFFICIENT_BALANCE",
|
|
36555
36728
|
disableContinue: true,
|
|
36729
|
+
messageKey: "postCheckout.insufficientBalance",
|
|
36556
36730
|
message: t("postCheckout.insufficientBalance"),
|
|
36557
36731
|
type: "error"
|
|
36558
36732
|
};
|
|
36559
36733
|
}
|
|
36560
36734
|
if (error.message.match(/insufficient amount/i)) {
|
|
36561
36735
|
return {
|
|
36736
|
+
code: "INSUFFICIENT_AMOUNT",
|
|
36562
36737
|
disableContinue: true,
|
|
36738
|
+
messageKey: "postCheckout.insufficientAmount",
|
|
36563
36739
|
message: t("postCheckout.insufficientAmount"),
|
|
36564
36740
|
type: "error"
|
|
36565
36741
|
};
|
|
@@ -36567,7 +36743,9 @@ function toPostCheckoutError(t, error) {
|
|
|
36567
36743
|
}
|
|
36568
36744
|
if (error instanceof ClientError4) {
|
|
36569
36745
|
return {
|
|
36746
|
+
code: null,
|
|
36570
36747
|
disableContinue: true,
|
|
36748
|
+
messageKey: "postCheckout.genericErrorMessage",
|
|
36571
36749
|
message: /* @__PURE__ */ React217.createElement(
|
|
36572
36750
|
FunkitTrans,
|
|
36573
36751
|
{
|
|
@@ -36650,7 +36828,7 @@ function usePostCheckout({
|
|
|
36650
36828
|
}
|
|
36651
36829
|
|
|
36652
36830
|
// src/modals/CheckoutModal/ConfirmationStep/useQuoteRefresh.ts
|
|
36653
|
-
import { useCallback as useCallback50, useEffect as
|
|
36831
|
+
import { useCallback as useCallback50, useEffect as useEffect63, useMemo as useMemo50, useRef as useRef38, useState as useState66 } from "react";
|
|
36654
36832
|
|
|
36655
36833
|
// src/hooks/useCountdown.tsx
|
|
36656
36834
|
import React219 from "react";
|
|
@@ -36658,7 +36836,7 @@ import { useCallback as useCallback49, useState as useState65 } from "react";
|
|
|
36658
36836
|
|
|
36659
36837
|
// src/components/FunCountdown/FunCountdown.tsx
|
|
36660
36838
|
import { noop as noop5 } from "@funkit/utils";
|
|
36661
|
-
import React218, { useCallback as useCallback48, useEffect as
|
|
36839
|
+
import React218, { useCallback as useCallback48, useEffect as useEffect62, useState as useState64 } from "react";
|
|
36662
36840
|
|
|
36663
36841
|
// src/components/FunCountdown/FunCountdown.css.ts
|
|
36664
36842
|
var backgroundRing = "_1t0bc111 _1rsrm2f2mv";
|
|
@@ -36701,7 +36879,7 @@ var FunCountdown = ({
|
|
|
36701
36879
|
setRemainingSeconds((prev) => prev > 0 ? prev - 1 : prev);
|
|
36702
36880
|
}, [isPaused]);
|
|
36703
36881
|
useInterval(handleInterval, 1e3);
|
|
36704
|
-
|
|
36882
|
+
useEffect62(() => {
|
|
36705
36883
|
if (remainingSeconds === onBeforeCountdownEndsSeconds) {
|
|
36706
36884
|
onBeforeCountdownEndsOnce();
|
|
36707
36885
|
}
|
|
@@ -36848,14 +37026,19 @@ function useQuoteRefresh({
|
|
|
36848
37026
|
isOnHold,
|
|
36849
37027
|
refreshIntervalSeconds
|
|
36850
37028
|
}) {
|
|
36851
|
-
const {
|
|
36852
|
-
|
|
37029
|
+
const {
|
|
37030
|
+
setCheckoutQuote,
|
|
37031
|
+
isQuoting,
|
|
37032
|
+
quoteError: contextQuoteError,
|
|
37033
|
+
quoteStepMessage
|
|
37034
|
+
} = useQuoteContext();
|
|
37035
|
+
const preloadedQuoteRef = useRef38(
|
|
36853
37036
|
void 0
|
|
36854
37037
|
);
|
|
36855
|
-
const quoteCallbackRef =
|
|
37038
|
+
const quoteCallbackRef = useRef38(void 0);
|
|
36856
37039
|
const [isPendingRefresh, setIsPendingRefresh] = useState66(false);
|
|
36857
37040
|
const [numQuoteRefreshes, setNumQuoteRefreshes] = useState66(0);
|
|
36858
|
-
|
|
37041
|
+
useEffect63(() => {
|
|
36859
37042
|
setNumQuoteRefreshes(0);
|
|
36860
37043
|
}, [checkoutId]);
|
|
36861
37044
|
const {
|
|
@@ -36933,15 +37116,15 @@ function useQuoteRefresh({
|
|
|
36933
37116
|
[isOnHold, restartCountdown, setCheckoutQuote, triggerAssetConfirm]
|
|
36934
37117
|
);
|
|
36935
37118
|
const quoteError = useMemo50(() => {
|
|
36936
|
-
if (
|
|
37119
|
+
if (contextQuoteError && !isQuoting) {
|
|
36937
37120
|
return {
|
|
36938
|
-
|
|
37121
|
+
...contextQuoteError,
|
|
36939
37122
|
type: "hint"
|
|
36940
37123
|
};
|
|
36941
37124
|
}
|
|
36942
37125
|
return null;
|
|
36943
|
-
}, [isQuoting,
|
|
36944
|
-
|
|
37126
|
+
}, [isQuoting, contextQuoteError]);
|
|
37127
|
+
useEffect63(() => {
|
|
36945
37128
|
if (isPendingRefresh && !isOnHold) {
|
|
36946
37129
|
setIsPendingRefresh(false);
|
|
36947
37130
|
refreshQuote();
|
|
@@ -36959,7 +37142,7 @@ function useQuoteRefresh({
|
|
|
36959
37142
|
}
|
|
36960
37143
|
|
|
36961
37144
|
// src/modals/CheckoutModal/ConfirmationStep/useTrackDepositQuoteEvents.ts
|
|
36962
|
-
import { useCallback as useCallback51, useEffect as
|
|
37145
|
+
import { useCallback as useCallback51, useEffect as useEffect64, useRef as useRef39 } from "react";
|
|
36963
37146
|
function buildQuoteEventArgs({
|
|
36964
37147
|
checkoutConfig,
|
|
36965
37148
|
checkoutItem,
|
|
@@ -37021,11 +37204,11 @@ function useTrackDepositQuoteEvents({
|
|
|
37021
37204
|
const { payerWallets } = useGeneralWallet();
|
|
37022
37205
|
const checkoutId = checkoutItem?.id ?? null;
|
|
37023
37206
|
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
37024
|
-
const lastDisplayedQuoteIdRef =
|
|
37025
|
-
|
|
37207
|
+
const lastDisplayedQuoteIdRef = useRef39(null);
|
|
37208
|
+
useEffect64(() => {
|
|
37026
37209
|
lastDisplayedQuoteIdRef.current = null;
|
|
37027
37210
|
}, [checkoutId]);
|
|
37028
|
-
|
|
37211
|
+
useEffect64(() => {
|
|
37029
37212
|
if (!checkoutItem?.finalDollarValue || !checkoutConfig || !latestQuote || isQuoteLoading) {
|
|
37030
37213
|
return;
|
|
37031
37214
|
}
|
|
@@ -37213,7 +37396,7 @@ function ConfirmationStep({
|
|
|
37213
37396
|
}
|
|
37214
37397
|
}
|
|
37215
37398
|
});
|
|
37216
|
-
|
|
37399
|
+
useEffect65(() => {
|
|
37217
37400
|
if (!isDirectWalletTransfer) {
|
|
37218
37401
|
triggerNewQuote({ maxRetries: 1 });
|
|
37219
37402
|
}
|
|
@@ -37236,6 +37419,11 @@ function ConfirmationStep({
|
|
|
37236
37419
|
})
|
|
37237
37420
|
);
|
|
37238
37421
|
const error = confirmationError ?? postCheckoutError ?? quoteError ?? aaveSupply.error ?? nadoDirectTransfer.error;
|
|
37422
|
+
useTrackErrorShown({
|
|
37423
|
+
error,
|
|
37424
|
+
flow: "deposit",
|
|
37425
|
+
step: "confirmation" /* CONFIRMATION */
|
|
37426
|
+
});
|
|
37239
37427
|
const stepMessage = useMemo51(() => {
|
|
37240
37428
|
if (initialQuoteStep) {
|
|
37241
37429
|
return initialQuoteStep;
|
|
@@ -37387,7 +37575,7 @@ function ConfirmationStep({
|
|
|
37387
37575
|
const hasStaticPrimaryInfoValue = isExactIn && checkoutItem?.inputFiatAmount != null || !isExactIn && !!checkoutConfig?.targetAssetAmount && isStablecoin(checkoutConfig.targetAssetTicker);
|
|
37388
37576
|
const checkoutId = checkoutItem?.id;
|
|
37389
37577
|
const isReady = !!checkoutItem?.finalDollarValue && !isQuoteLoading;
|
|
37390
|
-
|
|
37578
|
+
useEffect65(() => {
|
|
37391
37579
|
if (checkoutId && isReady) {
|
|
37392
37580
|
logMeasuredEvent({
|
|
37393
37581
|
eventName: "fc::ready::confirmation" /* READY_CONFIRMATION */,
|
|
@@ -37519,7 +37707,7 @@ function ConfirmationStep({
|
|
|
37519
37707
|
|
|
37520
37708
|
// src/modals/CheckoutModal/InputAmount/InputAmount.tsx
|
|
37521
37709
|
import { isMobile as isMobile7 } from "@funkit/utils";
|
|
37522
|
-
import React235, { useEffect as
|
|
37710
|
+
import React235, { useEffect as useEffect69 } from "react";
|
|
37523
37711
|
|
|
37524
37712
|
// src/hooks/queries/useMeldCurrencies.ts
|
|
37525
37713
|
import { getMeldSupportedFiat } from "@funkit/api-base";
|
|
@@ -37729,7 +37917,9 @@ var useMeldLimitError = (amount, fiatCurrency) => {
|
|
|
37729
37917
|
}
|
|
37730
37918
|
);
|
|
37731
37919
|
return {
|
|
37920
|
+
code: "INSUFFICIENT_AMOUNT",
|
|
37732
37921
|
issue: t("inputAmount.amountBelowMinimum"),
|
|
37922
|
+
messageKey: "inputAmount.amountBelowMinimum",
|
|
37733
37923
|
suggestion: t("inputAmount.inputAmountGreaterThan", { limit })
|
|
37734
37924
|
};
|
|
37735
37925
|
}
|
|
@@ -37744,7 +37934,9 @@ var useMeldLimitError = (amount, fiatCurrency) => {
|
|
|
37744
37934
|
}
|
|
37745
37935
|
);
|
|
37746
37936
|
return {
|
|
37937
|
+
code: "AMOUNT_ABOVE_MAXIMUM",
|
|
37747
37938
|
issue: t("inputAmount.amountAboveMaximum"),
|
|
37939
|
+
messageKey: "inputAmount.amountAboveMaximum",
|
|
37748
37940
|
suggestion: t("inputAmount.inputAmountLowerThan", {
|
|
37749
37941
|
limit,
|
|
37750
37942
|
currency: meldLimit.currencyCode
|
|
@@ -37763,18 +37955,18 @@ import {
|
|
|
37763
37955
|
} from "@funkit/utils";
|
|
37764
37956
|
import * as dnum10 from "dnum";
|
|
37765
37957
|
import { motion as motion13 } from "motion/react";
|
|
37766
|
-
import React233, { useEffect as
|
|
37958
|
+
import React233, { useEffect as useEffect68, useMemo as useMemo55, useState as useState69 } from "react";
|
|
37767
37959
|
|
|
37768
37960
|
// src/components/AnimatedWidthWrapper/AnimatedWidthWrapper.tsx
|
|
37769
37961
|
import { motion as motion12 } from "motion/react";
|
|
37770
37962
|
import React221 from "react";
|
|
37771
|
-
import { useEffect as
|
|
37963
|
+
import { useEffect as useEffect66, useRef as useRef40, useState as useState68 } from "react";
|
|
37772
37964
|
function AnimatedWidthWrapper({ children }) {
|
|
37773
|
-
const containerRef =
|
|
37774
|
-
const animationFrameRef =
|
|
37775
|
-
const resizeObserverRef =
|
|
37965
|
+
const containerRef = useRef40(null);
|
|
37966
|
+
const animationFrameRef = useRef40(null);
|
|
37967
|
+
const resizeObserverRef = useRef40(null);
|
|
37776
37968
|
const [width, setWidth] = useState68("auto");
|
|
37777
|
-
|
|
37969
|
+
useEffect66(() => {
|
|
37778
37970
|
if (containerRef.current) {
|
|
37779
37971
|
resizeObserverRef.current = new ResizeObserver((entries) => {
|
|
37780
37972
|
animationFrameRef.current = requestAnimationFrame(() => {
|
|
@@ -37806,7 +37998,7 @@ function AnimatedWidthWrapper({ children }) {
|
|
|
37806
37998
|
}
|
|
37807
37999
|
|
|
37808
38000
|
// src/components/ApprovalMethodToggle/ApprovalMethodToggle.tsx
|
|
37809
|
-
import React222, { useCallback as useCallback52, useMemo as useMemo52, useRef as
|
|
38001
|
+
import React222, { useCallback as useCallback52, useMemo as useMemo52, useRef as useRef41 } from "react";
|
|
37810
38002
|
function ApprovalMethodToggle({
|
|
37811
38003
|
value,
|
|
37812
38004
|
onChange,
|
|
@@ -37814,7 +38006,7 @@ function ApprovalMethodToggle({
|
|
|
37814
38006
|
testId
|
|
37815
38007
|
}) {
|
|
37816
38008
|
const { t } = useFunkitTranslation();
|
|
37817
|
-
const tooltipAnchorRef =
|
|
38009
|
+
const tooltipAnchorRef = useRef41(null);
|
|
37818
38010
|
const options = useMemo52(
|
|
37819
38011
|
() => [
|
|
37820
38012
|
{ label: t("approvalMethodToggle.signedMessage"), value: "sign" },
|
|
@@ -38852,6 +39044,11 @@ function InputAmountLayout({
|
|
|
38852
39044
|
const isStablecoinSwitchHidingEnabled = useFeatureGate(
|
|
38853
39045
|
"hide-stablecoin-amount-switch"
|
|
38854
39046
|
);
|
|
39047
|
+
useTrackErrorShown({
|
|
39048
|
+
error: error ?? null,
|
|
39049
|
+
flow: "deposit",
|
|
39050
|
+
step: "input_amount" /* INPUT_AMOUNT */
|
|
39051
|
+
});
|
|
38855
39052
|
const shouldHideTokenAmountInputSwitcher = shouldHideAmountSwitcherForStablecoin(
|
|
38856
39053
|
switcherTokenSymbol,
|
|
38857
39054
|
isStablecoin,
|
|
@@ -39050,7 +39247,7 @@ var useCheckoutAmountLimits = ({
|
|
|
39050
39247
|
};
|
|
39051
39248
|
|
|
39052
39249
|
// src/modals/CheckoutModal/InputAmount/useAmountInput.ts
|
|
39053
|
-
import { useCallback as useCallback53, useMemo as useMemo53, useReducer as useReducer3, useRef as
|
|
39250
|
+
import { useCallback as useCallback53, useMemo as useMemo53, useReducer as useReducer3, useRef as useRef42 } from "react";
|
|
39054
39251
|
|
|
39055
39252
|
// src/modals/CheckoutModal/InputAmount/state.ts
|
|
39056
39253
|
import { isEVMAddressEquivalent as isEVMAddressEquivalent4, isTokenEquivalent as isTokenEquivalent10, round as round2 } from "@funkit/utils";
|
|
@@ -39832,8 +40029,8 @@ function useAmountInput(options) {
|
|
|
39832
40029
|
() => getDerivedState(state, checkoutConfig.targetAssetTicker),
|
|
39833
40030
|
[state, checkoutConfig]
|
|
39834
40031
|
);
|
|
39835
|
-
const inputRef =
|
|
39836
|
-
const availableWidthRef =
|
|
40032
|
+
const inputRef = useRef42(null);
|
|
40033
|
+
const availableWidthRef = useRef42(null);
|
|
39837
40034
|
const { inputValue, locale } = state;
|
|
39838
40035
|
const { inputDecimals, inputAffix, placeholder } = derivedState;
|
|
39839
40036
|
const { activeTheme } = useActiveTheme();
|
|
@@ -40240,7 +40437,7 @@ import {
|
|
|
40240
40437
|
useQuery as useQuery21,
|
|
40241
40438
|
useQueryClient as useQueryClient5
|
|
40242
40439
|
} from "@tanstack/react-query";
|
|
40243
|
-
import { useEffect as
|
|
40440
|
+
import { useEffect as useEffect67, useMemo as useMemo54 } from "react";
|
|
40244
40441
|
import { useDebounce as useDebounce2 } from "use-debounce";
|
|
40245
40442
|
var DEBOUNCE_DELAY = 500;
|
|
40246
40443
|
var COUNTDOWN_INTERVAL_SEC = 60;
|
|
@@ -40311,7 +40508,7 @@ var useMeldQuotes = (sourceAmount, fiatCurrency, meldEnabled = true) => {
|
|
|
40311
40508
|
autoRestart: true
|
|
40312
40509
|
});
|
|
40313
40510
|
const isOutdated = sourceAmount !== debouncedSourceAmount;
|
|
40314
|
-
|
|
40511
|
+
useEffect67(() => {
|
|
40315
40512
|
if (!checkoutId || isOutdated || query.isFetching || !query.isFetchedAfterMount || !query.data) {
|
|
40316
40513
|
return;
|
|
40317
40514
|
}
|
|
@@ -40433,18 +40630,24 @@ function useMeld(meldEnabled, manuallySelectedQuote, usdAmount, fiatCurrency) {
|
|
|
40433
40630
|
function getMeldError2() {
|
|
40434
40631
|
if (isSelectedQuoteUnavailable) {
|
|
40435
40632
|
return {
|
|
40633
|
+
code: "MELD_NO_QUOTES_FOR_PROVIDER",
|
|
40634
|
+
messageKey: "meld.noQuotesFoundForProvider",
|
|
40436
40635
|
message: t("meld.noQuotesFoundForProvider"),
|
|
40437
40636
|
type: "hint"
|
|
40438
40637
|
};
|
|
40439
40638
|
}
|
|
40440
40639
|
if (meldLimitError) {
|
|
40441
40640
|
return {
|
|
40641
|
+
code: meldLimitError.code,
|
|
40642
|
+
messageKey: meldLimitError.messageKey,
|
|
40442
40643
|
message: meldLimitError.suggestion,
|
|
40443
40644
|
type: "hint"
|
|
40444
40645
|
};
|
|
40445
40646
|
}
|
|
40446
40647
|
if (meldQuotesQuery.error) {
|
|
40447
40648
|
return {
|
|
40649
|
+
code: "MELD_QUOTE_FAILED",
|
|
40650
|
+
messageKey: "meld.errorNotified",
|
|
40448
40651
|
message: t("meld.errorNotified"),
|
|
40449
40652
|
type: "hint"
|
|
40450
40653
|
};
|
|
@@ -40529,7 +40732,7 @@ function InputAmountLoaded({
|
|
|
40529
40732
|
const isExactIn = quoteBuilder.isExactIn();
|
|
40530
40733
|
const sourceTokenKey = sourceHolding?.chainSymbolKey;
|
|
40531
40734
|
const sourceTokenChanged = modalState.sourceTokenKey != null && modalState.sourceTokenKey !== sourceTokenKey;
|
|
40532
|
-
|
|
40735
|
+
useEffect68(() => {
|
|
40533
40736
|
if (sourceTokenChanged) {
|
|
40534
40737
|
setAmountSelection({ selectType: "default", presetAmount: null });
|
|
40535
40738
|
}
|
|
@@ -40596,7 +40799,7 @@ function InputAmountLoaded({
|
|
|
40596
40799
|
}
|
|
40597
40800
|
return setFiatAmount(selectedFiat);
|
|
40598
40801
|
}
|
|
40599
|
-
|
|
40802
|
+
useEffect68(() => {
|
|
40600
40803
|
if (isInputInFiat !== modalState.isInputInFiat || fiatAmount !== modalState.fiatAmount || assetAmount !== modalState.assetAmount || sourceTokenKey !== modalState.sourceTokenKey || amountSelection.selectType !== modalState.amountSelection?.selectType || amountSelection.presetAmount !== modalState.amountSelection?.presetAmount) {
|
|
40601
40804
|
setModalState((state) => ({
|
|
40602
40805
|
...state,
|
|
@@ -40639,6 +40842,8 @@ function InputAmountLoaded({
|
|
|
40639
40842
|
}
|
|
40640
40843
|
if (usdAvailableAmount === 0) {
|
|
40641
40844
|
return {
|
|
40845
|
+
code: "INSUFFICIENT_BALANCE",
|
|
40846
|
+
messageKey: "inputAmount.insufficientBalanceSelectAnother",
|
|
40642
40847
|
message: t("inputAmount.insufficientBalanceSelectAnother"),
|
|
40643
40848
|
type: "hint"
|
|
40644
40849
|
};
|
|
@@ -41153,13 +41358,17 @@ function InputAmountLoading({
|
|
|
41153
41358
|
const error = useMemo56(() => {
|
|
41154
41359
|
if (sourceHoldingError) {
|
|
41155
41360
|
return {
|
|
41361
|
+
code: "BALANCE_UNAVAILABLE",
|
|
41156
41362
|
message: /* @__PURE__ */ React234.createElement("div", null, t("inputAmount.unableToRetrieveBalance"), " "),
|
|
41363
|
+
messageKey: "inputAmount.unableToRetrieveBalance",
|
|
41157
41364
|
type: "error"
|
|
41158
41365
|
};
|
|
41159
41366
|
}
|
|
41160
41367
|
if (unitPriceError) {
|
|
41161
41368
|
return {
|
|
41369
|
+
code: "ASSET_PRICE_UNAVAILABLE",
|
|
41162
41370
|
message: t("inputAmount.unableFetchPrice"),
|
|
41371
|
+
messageKey: "inputAmount.unableFetchPrice",
|
|
41163
41372
|
type: "error"
|
|
41164
41373
|
};
|
|
41165
41374
|
}
|
|
@@ -41421,10 +41630,10 @@ function InputAmount(props) {
|
|
|
41421
41630
|
query: { enabled: gasFetchingEnabled }
|
|
41422
41631
|
});
|
|
41423
41632
|
const isLoaded = !!(checkoutItem && unitPrice && !sourceHoldingError && !isLoadingSourceHolding && !isMeldDefaultCurrencyLoading && (!gasFetchingEnabled || gasPriceWei !== void 0));
|
|
41424
|
-
|
|
41633
|
+
useEffect69(() => setCheckoutQuote(null), []);
|
|
41425
41634
|
const checkoutId = checkoutItem?.id;
|
|
41426
41635
|
const paymentMethod = paymentMethodInfo.paymentMethod;
|
|
41427
|
-
|
|
41636
|
+
useEffect69(() => {
|
|
41428
41637
|
if (checkoutId && isLoaded) {
|
|
41429
41638
|
logMeasuredEvent({
|
|
41430
41639
|
eventName: "fc::ready::input_amount" /* READY_INPUT_AMOUNT */,
|
|
@@ -41457,7 +41666,7 @@ function InputAmount(props) {
|
|
|
41457
41666
|
}
|
|
41458
41667
|
|
|
41459
41668
|
// src/modals/CheckoutModal/LightningInvoice/LightningInvoice.tsx
|
|
41460
|
-
import React240, { useEffect as
|
|
41669
|
+
import React240, { useEffect as useEffect72 } from "react";
|
|
41461
41670
|
import { createPortal as createPortal18 } from "react-dom";
|
|
41462
41671
|
|
|
41463
41672
|
// src/components/CopyAddress/CopyInputDisplayedAddress.tsx
|
|
@@ -41465,7 +41674,7 @@ import { truncateMiddleOfAddress } from "@funkit/utils";
|
|
|
41465
41674
|
import React236, { useCallback as useCallback56, useState as useState71 } from "react";
|
|
41466
41675
|
|
|
41467
41676
|
// src/hooks/useCopyToClipboard.ts
|
|
41468
|
-
import { useCallback as useCallback55, useEffect as
|
|
41677
|
+
import { useCallback as useCallback55, useEffect as useEffect70, useState as useState70 } from "react";
|
|
41469
41678
|
var useCopyToClipboard = (text, delay = 1500) => {
|
|
41470
41679
|
const [isCopied, setCopied] = useState70(false);
|
|
41471
41680
|
const handleCopy = useCallback55(() => {
|
|
@@ -41475,7 +41684,7 @@ var useCopyToClipboard = (text, delay = 1500) => {
|
|
|
41475
41684
|
navigator.clipboard.writeText(text);
|
|
41476
41685
|
setCopied(true);
|
|
41477
41686
|
}, [text]);
|
|
41478
|
-
|
|
41687
|
+
useEffect70(() => {
|
|
41479
41688
|
if (!isCopied) {
|
|
41480
41689
|
return;
|
|
41481
41690
|
}
|
|
@@ -41602,7 +41811,7 @@ import {
|
|
|
41602
41811
|
import { LIGHTNING_MAINNET_CHAIN_ID, bitcoinChain as bitcoinChain5 } from "@funkit/chains";
|
|
41603
41812
|
import { getAssetPriceInfoWithFallback as getAssetPriceInfoWithFallback2 } from "@funkit/connect-core";
|
|
41604
41813
|
import { keepPreviousData as keepPreviousData3, useQuery as useQuery22 } from "@tanstack/react-query";
|
|
41605
|
-
import { useEffect as
|
|
41814
|
+
import { useEffect as useEffect71, useRef as useRef43, useState as useState72 } from "react";
|
|
41606
41815
|
import { parseUnits as parseUnits5 } from "viem";
|
|
41607
41816
|
var QUOTE_REFRESH_LEAD_MS = 3e3;
|
|
41608
41817
|
var QUOTE_REFRESH_MIN_MS = 250;
|
|
@@ -41618,9 +41827,9 @@ function usdToSats(usd, btcPrice) {
|
|
|
41618
41827
|
}
|
|
41619
41828
|
function useDeferredQuote(latestQuote) {
|
|
41620
41829
|
const [displayedQuote, setDisplayedQuote] = useState72(latestQuote);
|
|
41621
|
-
const latestQuoteRef =
|
|
41830
|
+
const latestQuoteRef = useRef43(latestQuote);
|
|
41622
41831
|
latestQuoteRef.current = latestQuote;
|
|
41623
|
-
|
|
41832
|
+
useEffect71(() => {
|
|
41624
41833
|
if (!displayedQuote) {
|
|
41625
41834
|
if (latestQuote) {
|
|
41626
41835
|
setDisplayedQuote(latestQuote);
|
|
@@ -42012,12 +42221,12 @@ function LightningInvoice(props) {
|
|
|
42012
42221
|
isHidden: isLoading || !!error,
|
|
42013
42222
|
isPaused: isLoading || !!error
|
|
42014
42223
|
});
|
|
42015
|
-
|
|
42224
|
+
useEffect72(() => {
|
|
42016
42225
|
if (expiresAtMs !== void 0) {
|
|
42017
42226
|
restartCountdown();
|
|
42018
42227
|
}
|
|
42019
42228
|
}, [expiresAtMs, restartCountdown]);
|
|
42020
|
-
|
|
42229
|
+
useEffect72(() => {
|
|
42021
42230
|
if (checkoutItem?.id && displayedBolt11) {
|
|
42022
42231
|
registerQrPaymentTarget(checkoutItem.id, displayedBolt11);
|
|
42023
42232
|
}
|
|
@@ -42072,7 +42281,7 @@ function LightningInvoice(props) {
|
|
|
42072
42281
|
}
|
|
42073
42282
|
|
|
42074
42283
|
// src/modals/CheckoutModal/LoadingAccount.tsx
|
|
42075
|
-
import React250, { useEffect as
|
|
42284
|
+
import React250, { useEffect as useEffect73 } from "react";
|
|
42076
42285
|
|
|
42077
42286
|
// src/hooks/usePaymentSources.ts
|
|
42078
42287
|
import { isNotNullish as isNotNullish3 } from "@funkit/utils";
|
|
@@ -43284,7 +43493,7 @@ function LoadingAccount({
|
|
|
43284
43493
|
const hasCustomStartingStep = !!checkoutConfig?.startingStep;
|
|
43285
43494
|
const startsOnConfirmationStep = checkoutConfig?.startingStep === "confirmation" /* CONFIRMATION */;
|
|
43286
43495
|
const startsOnSelectAssetStep = checkoutConfig?.startingStep === "select_asset" /* SELECT_ASSET */;
|
|
43287
|
-
|
|
43496
|
+
useEffect73(() => {
|
|
43288
43497
|
if (isLoadingFiat || !checkoutConfig) {
|
|
43289
43498
|
return;
|
|
43290
43499
|
}
|
|
@@ -43618,7 +43827,7 @@ function MeldRedirect({
|
|
|
43618
43827
|
import { etherealChain, hyperEvmChain as hyperEvmChain3 } from "@funkit/chains";
|
|
43619
43828
|
import { isTokenEquivalent as isTokenEquivalent12 } from "@funkit/utils";
|
|
43620
43829
|
import React257, {
|
|
43621
|
-
useEffect as
|
|
43830
|
+
useEffect as useEffect74,
|
|
43622
43831
|
useLayoutEffect as useLayoutEffect2,
|
|
43623
43832
|
useMemo as useMemo62,
|
|
43624
43833
|
useState as useState74
|
|
@@ -44012,7 +44221,7 @@ function useAssetOptions({
|
|
|
44012
44221
|
}
|
|
44013
44222
|
function useScrollToSelectedAsset(selectedChainTokenSymbol) {
|
|
44014
44223
|
const rootNode = useRootNode();
|
|
44015
|
-
|
|
44224
|
+
useEffect74(() => {
|
|
44016
44225
|
const optionEl = rootNode.getElementById(
|
|
44017
44226
|
`option-${selectedChainTokenSymbol}`
|
|
44018
44227
|
);
|
|
@@ -44209,7 +44418,7 @@ function AccountSelectAsset({
|
|
|
44209
44418
|
const isDisabled = isAssetsEmpty || !selectedChainTokenSymbol || isLoading;
|
|
44210
44419
|
const onBalanceTopUpSwitch = checkoutItem?.initSettings.onBalanceTopUpSwitch;
|
|
44211
44420
|
const checkoutId = checkoutItem?.id;
|
|
44212
|
-
|
|
44421
|
+
useEffect74(() => {
|
|
44213
44422
|
if (checkoutId && !isLoading) {
|
|
44214
44423
|
logMeasuredEvent({
|
|
44215
44424
|
eventName: "fc::ready::select_asset" /* READY_SELECT_ASSET */,
|
|
@@ -44374,7 +44583,7 @@ import {
|
|
|
44374
44583
|
resolveWithdrawalSourceTokenBalance as resolveWithdrawalSourceTokenBalance4
|
|
44375
44584
|
} from "@funkit/connect-core";
|
|
44376
44585
|
import { isTokenEquivalent as isTokenEquivalent13, noop as noop6 } from "@funkit/utils";
|
|
44377
|
-
import React266, { useEffect as
|
|
44586
|
+
import React266, { useEffect as useEffect77, useMemo as useMemo63, useRef as useRef45, useState as useState75 } from "react";
|
|
44378
44587
|
import { createPortal as createPortal22 } from "react-dom";
|
|
44379
44588
|
|
|
44380
44589
|
// src/components/Dropdown/ReceiveTokenDropdown.tsx
|
|
@@ -44482,13 +44691,13 @@ function useIsUserUnderComplianceReview() {
|
|
|
44482
44691
|
}
|
|
44483
44692
|
|
|
44484
44693
|
// src/modals/CheckoutModal/SourceChange/ComplianceReviewBanner.tsx
|
|
44485
|
-
import React259, { useEffect as
|
|
44694
|
+
import React259, { useEffect as useEffect75 } from "react";
|
|
44486
44695
|
function ComplianceReviewBanner({
|
|
44487
44696
|
checkoutId
|
|
44488
44697
|
}) {
|
|
44489
44698
|
const { t } = useFunkitTranslation();
|
|
44490
44699
|
const { logEvent } = useTrack();
|
|
44491
|
-
|
|
44700
|
+
useEffect75(() => {
|
|
44492
44701
|
logEvent({
|
|
44493
44702
|
eventName: "fc::compliance_review::banner_shown" /* COMPLIANCE_REVIEW_BANNER_SHOWN */,
|
|
44494
44703
|
metadata: { checkoutId }
|
|
@@ -44826,7 +45035,7 @@ function useStartBitcoinLightning() {
|
|
|
44826
45035
|
}
|
|
44827
45036
|
|
|
44828
45037
|
// src/modals/CheckoutModal/SourceChange/useTrackSourceChangeEvents.ts
|
|
44829
|
-
import { useEffect as
|
|
45038
|
+
import { useEffect as useEffect76, useRef as useRef44 } from "react";
|
|
44830
45039
|
function useTrackSourceChangeEvents({
|
|
44831
45040
|
tab
|
|
44832
45041
|
}) {
|
|
@@ -44834,7 +45043,7 @@ function useTrackSourceChangeEvents({
|
|
|
44834
45043
|
const { checkoutItem } = useCheckoutContext();
|
|
44835
45044
|
const { authorizedConnections } = useFunkitBrokerageContext();
|
|
44836
45045
|
const { connectorId, walletAddress } = useGeneralWallet();
|
|
44837
|
-
const tabSwitchCountRef =
|
|
45046
|
+
const tabSwitchCountRef = useRef44(0);
|
|
44838
45047
|
const trackModalOpened = useEffectEvent(() => {
|
|
44839
45048
|
if (!checkoutItem) {
|
|
44840
45049
|
return;
|
|
@@ -44858,7 +45067,7 @@ function useTrackSourceChangeEvents({
|
|
|
44858
45067
|
}));
|
|
44859
45068
|
});
|
|
44860
45069
|
const checkoutId = checkoutItem?.id;
|
|
44861
|
-
|
|
45070
|
+
useEffect76(() => {
|
|
44862
45071
|
if (checkoutId && claimAnalyticsEvent("fc_modal_opened" /* MODAL_OPENED */, checkoutId)) {
|
|
44863
45072
|
trackModalOpened();
|
|
44864
45073
|
}
|
|
@@ -45062,7 +45271,7 @@ function SourceChange({
|
|
|
45062
45271
|
return adaptLighterTargetAssetsForUnifiedAccount(candidates);
|
|
45063
45272
|
}, [checkoutConfig?.dynamicTargetAssetCandidates, isLighterUnifiedAccount]);
|
|
45064
45273
|
const [selectedFiatItem, setSelectedFiatItem] = useState75(null);
|
|
45065
|
-
const isWithdrawalContinuationInFlight =
|
|
45274
|
+
const isWithdrawalContinuationInFlight = useRef45(false);
|
|
45066
45275
|
const originalWithdrawalConfig = checkoutItem?.initSettings.withdrawalConfig;
|
|
45067
45276
|
const resolvedWithdrawalConfig = originalWithdrawalConfig ? isMultiMethodWithdrawalConfig(originalWithdrawalConfig) ? void 0 : originalWithdrawalConfig : void 0;
|
|
45068
45277
|
const isAutoContinue = !isOstiumCustomer(apiKey);
|
|
@@ -45167,7 +45376,7 @@ function SourceChange({
|
|
|
45167
45376
|
const showTagline = useDynamicConfig("showpoweredtagline");
|
|
45168
45377
|
const hasBottomBar = showTagline || !isAutoContinue || bottomBarCloseButtonConfig.enabled;
|
|
45169
45378
|
useSwappedPreload(fopsData?.data, "deposit");
|
|
45170
|
-
|
|
45379
|
+
useEffect77(() => {
|
|
45171
45380
|
const nextWithdrawalConfig = shouldSeedSourceChangeWithdrawalConfig ? resolvedWithdrawalConfig : void 0;
|
|
45172
45381
|
setModalState((state) => {
|
|
45173
45382
|
if (state.withdrawalConfig === nextWithdrawalConfig) {
|
|
@@ -45183,7 +45392,7 @@ function SourceChange({
|
|
|
45183
45392
|
setModalState,
|
|
45184
45393
|
shouldSeedSourceChangeWithdrawalConfig
|
|
45185
45394
|
]);
|
|
45186
|
-
|
|
45395
|
+
useEffect77(() => {
|
|
45187
45396
|
if (!paymentMethodInfo) {
|
|
45188
45397
|
return;
|
|
45189
45398
|
}
|
|
@@ -45298,7 +45507,7 @@ function SourceChange({
|
|
|
45298
45507
|
setModalState((state) => ({ ...state, showWalletOptions: true }));
|
|
45299
45508
|
}
|
|
45300
45509
|
};
|
|
45301
|
-
const lastObservedTabRef =
|
|
45510
|
+
const lastObservedTabRef = useRef45(void 0);
|
|
45302
45511
|
const sendPaymentMethodTabEvent = useEffectEvent((tab) => {
|
|
45303
45512
|
if (lastObservedTabRef.current === tab) {
|
|
45304
45513
|
return;
|
|
@@ -45311,7 +45520,7 @@ function SourceChange({
|
|
|
45311
45520
|
)
|
|
45312
45521
|
);
|
|
45313
45522
|
});
|
|
45314
|
-
|
|
45523
|
+
useEffect77(() => {
|
|
45315
45524
|
sendPaymentMethodTabEvent(paymentMethodTab);
|
|
45316
45525
|
}, [paymentMethodTab, sendPaymentMethodTabEvent]);
|
|
45317
45526
|
const analyticsTab = isSwappedEnabled ? paymentMethodTab : null;
|
|
@@ -45748,7 +45957,7 @@ function trackEventForTabChange(checkoutItem, tab) {
|
|
|
45748
45957
|
|
|
45749
45958
|
// src/modals/CheckoutModal/SwappedIframe/SwappedIframeController.tsx
|
|
45750
45959
|
import { useQueryClient as useQueryClient6 } from "@tanstack/react-query";
|
|
45751
|
-
import React267, { useEffect as
|
|
45960
|
+
import React267, { useEffect as useEffect78, useRef as useRef46 } from "react";
|
|
45752
45961
|
import { createPortal as createPortal23 } from "react-dom";
|
|
45753
45962
|
var SwappedIframeInfo = {
|
|
45754
45963
|
Component: SwappedIframeController,
|
|
@@ -45782,7 +45991,7 @@ function SwappedIframeController({
|
|
|
45782
45991
|
const { logEvent, logMeasuredEvent, startMeasuredEvent } = useTrack();
|
|
45783
45992
|
const { t } = useFunkitTranslation();
|
|
45784
45993
|
const queryClient = useQueryClient6();
|
|
45785
|
-
const successCallbackScheduledRef =
|
|
45994
|
+
const successCallbackScheduledRef = useRef46(false);
|
|
45786
45995
|
const { checkoutItem, resetForNewDeposit } = useCheckoutContext();
|
|
45787
45996
|
const bottomSectionRef = useBottomSectionRef();
|
|
45788
45997
|
const mode = modalState.swappedMode;
|
|
@@ -45803,10 +46012,10 @@ function SwappedIframeController({
|
|
|
45803
46012
|
metadata: {}
|
|
45804
46013
|
});
|
|
45805
46014
|
});
|
|
45806
|
-
|
|
46015
|
+
useEffect78(() => {
|
|
45807
46016
|
startMeasuredEvent("fc::ready::swapped_iframe" /* READY_SWAPPED_IFRAME */);
|
|
45808
46017
|
}, [startMeasuredEvent]);
|
|
45809
|
-
|
|
46018
|
+
useEffect78(() => {
|
|
45810
46019
|
if (isSwappedReady) {
|
|
45811
46020
|
const event = getTrackEvent("fc::ready::swapped_iframe" /* READY_SWAPPED_IFRAME */);
|
|
45812
46021
|
logger.info("swapped-iframe:ready", event.metadata);
|
|
@@ -45971,7 +46180,7 @@ function SwappedIframeController({
|
|
|
45971
46180
|
}
|
|
45972
46181
|
}
|
|
45973
46182
|
}
|
|
45974
|
-
|
|
46183
|
+
useEffect78(() => {
|
|
45975
46184
|
return swappedTransport.onMessage(handleSwappedMessage);
|
|
45976
46185
|
}, [swappedTransport, handleSwappedMessage]);
|
|
45977
46186
|
useSwappedIframeLifecycle({
|
|
@@ -46029,7 +46238,7 @@ function trackEventForFormOfPayment(fop, checkoutItem, eventName, extras) {
|
|
|
46029
46238
|
|
|
46030
46239
|
// src/modals/CheckoutModal/TransferToken/TransferToken.tsx
|
|
46031
46240
|
import { motion as motion18, useAnimationControls as useAnimationControls4 } from "motion/react";
|
|
46032
|
-
import React276, { useRef as
|
|
46241
|
+
import React276, { useRef as useRef48, useState as useState78 } from "react";
|
|
46033
46242
|
import { createPortal as createPortal24 } from "react-dom";
|
|
46034
46243
|
|
|
46035
46244
|
// src/components/BitcoinLightningBanner/BitcoinLightningBanner.tsx
|
|
@@ -46509,7 +46718,7 @@ var TransferTokenDetails = ({
|
|
|
46509
46718
|
};
|
|
46510
46719
|
|
|
46511
46720
|
// src/modals/CheckoutModal/TransferToken/useTransferTokenTracking.ts
|
|
46512
|
-
import { useCallback as useCallback59, useEffect as
|
|
46721
|
+
import { useCallback as useCallback59, useEffect as useEffect79, useRef as useRef47, useState as useState77 } from "react";
|
|
46513
46722
|
|
|
46514
46723
|
// src/modals/CheckoutModal/TransferToken/CheckoutNotifications.track.ts
|
|
46515
46724
|
function getNotificationId(item) {
|
|
@@ -46618,10 +46827,10 @@ function useTransferTokenTracking({
|
|
|
46618
46827
|
trackDepositTransferInteracted
|
|
46619
46828
|
} = useDepositAnalytics();
|
|
46620
46829
|
const [pendingInteraction, setPendingInteraction] = useState77(null);
|
|
46621
|
-
const nextInteractionIdRef =
|
|
46622
|
-
const lastEmittedInteractionIdRef =
|
|
46623
|
-
const interactionCountRef =
|
|
46624
|
-
|
|
46830
|
+
const nextInteractionIdRef = useRef47(0);
|
|
46831
|
+
const lastEmittedInteractionIdRef = useRef47(0);
|
|
46832
|
+
const interactionCountRef = useRef47(0);
|
|
46833
|
+
useEffect79(() => {
|
|
46625
46834
|
if (checkoutId && depositAddress) {
|
|
46626
46835
|
registerQrPaymentTarget(checkoutId, depositAddress);
|
|
46627
46836
|
}
|
|
@@ -46634,7 +46843,7 @@ function useTransferTokenTracking({
|
|
|
46634
46843
|
},
|
|
46635
46844
|
[]
|
|
46636
46845
|
);
|
|
46637
|
-
|
|
46846
|
+
useEffect79(() => {
|
|
46638
46847
|
if (!pendingInteraction || pendingInteraction.expectedSourceChain !== fromChainId || pendingInteraction.expectedSourceTicker !== fromTokenSymbol || !fromTokenAddress || !depositAddress || !targetChainId || !targetTokenAddress || lastEmittedInteractionIdRef.current >= pendingInteraction.id) {
|
|
46639
46848
|
return;
|
|
46640
46849
|
}
|
|
@@ -46673,7 +46882,7 @@ function useTransferTokenTracking({
|
|
|
46673
46882
|
targetTokenSymbol,
|
|
46674
46883
|
trackDepositTransferInteracted
|
|
46675
46884
|
]);
|
|
46676
|
-
|
|
46885
|
+
useEffect79(() => {
|
|
46677
46886
|
if (depositAddress && fromChainId && toChainId && toTokenAddress) {
|
|
46678
46887
|
setTokenTransferAddressShownAtMs({
|
|
46679
46888
|
fromChainId,
|
|
@@ -46807,7 +47016,7 @@ function useNotificationTracking({
|
|
|
46807
47016
|
const logEventV2 = useTrackV2();
|
|
46808
47017
|
const { logEvent } = useTrack();
|
|
46809
47018
|
const { connectorId } = useGeneralWallet();
|
|
46810
|
-
const depositNotificationDisplayRef =
|
|
47019
|
+
const depositNotificationDisplayRef = useRef47(null);
|
|
46811
47020
|
const trackDepositNotificationDisplayed = useEffectEvent(
|
|
46812
47021
|
(notification, notificationStatus) => {
|
|
46813
47022
|
const context = resolveExecutionProgressContext(notification, "deposit");
|
|
@@ -46836,14 +47045,14 @@ function useNotificationTracking({
|
|
|
46836
47045
|
}));
|
|
46837
47046
|
}
|
|
46838
47047
|
);
|
|
46839
|
-
const notificationDisplayedAtRef =
|
|
46840
|
-
const reasonRef =
|
|
46841
|
-
const itemRef =
|
|
46842
|
-
const statusRef =
|
|
47048
|
+
const notificationDisplayedAtRef = useRef47(null);
|
|
47049
|
+
const reasonRef = useRef47(null);
|
|
47050
|
+
const itemRef = useRef47(item);
|
|
47051
|
+
const statusRef = useRef47(status);
|
|
46843
47052
|
itemRef.current = item;
|
|
46844
47053
|
statusRef.current = status;
|
|
46845
47054
|
const id = item ? getNotificationId(item) : null;
|
|
46846
|
-
|
|
47055
|
+
useEffect79(() => {
|
|
46847
47056
|
if (!id || !itemRef.current) {
|
|
46848
47057
|
depositNotificationDisplayRef.current = null;
|
|
46849
47058
|
return;
|
|
@@ -46889,7 +47098,7 @@ function useNotificationTracking({
|
|
|
46889
47098
|
notificationDisplayedAtRef.current = null;
|
|
46890
47099
|
};
|
|
46891
47100
|
}, [id, logEvent, trackDepositNotificationDisplayed]);
|
|
46892
|
-
|
|
47101
|
+
useEffect79(() => {
|
|
46893
47102
|
if (!itemRef.current || !notificationDisplayedAtRef.current) {
|
|
46894
47103
|
return;
|
|
46895
47104
|
}
|
|
@@ -47063,7 +47272,7 @@ function TransferToken({
|
|
|
47063
47272
|
const { checkoutItem } = useCheckoutContext();
|
|
47064
47273
|
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
47065
47274
|
const { transferToken } = modalState;
|
|
47066
|
-
const disclaimerTextWrapperRef =
|
|
47275
|
+
const disclaimerTextWrapperRef = useRef48(null);
|
|
47067
47276
|
const { transferInit } = useCheckoutTransferInit();
|
|
47068
47277
|
const enabledChainSymbols = useEnabledTokenTransferChainTokens(transferInit);
|
|
47069
47278
|
const {
|
|
@@ -47821,7 +48030,7 @@ var FiatAccountDetail = {
|
|
|
47821
48030
|
|
|
47822
48031
|
// src/modals/CheckoutModal/VirtualFiatAccount/KycIframe.tsx
|
|
47823
48032
|
import { BridgeCustomerStatus as BridgeCustomerStatus7 } from "@funkit/api-base";
|
|
47824
|
-
import React282, { useCallback as useCallback60, useEffect as
|
|
48033
|
+
import React282, { useCallback as useCallback60, useEffect as useEffect80, useMemo as useMemo64, useState as useState80 } from "react";
|
|
47825
48034
|
function useIframeListener(listeners, expectedOrigin) {
|
|
47826
48035
|
const handleMessage = useCallback60(
|
|
47827
48036
|
(event) => {
|
|
@@ -47848,7 +48057,7 @@ function useIframeListener(listeners, expectedOrigin) {
|
|
|
47848
48057
|
},
|
|
47849
48058
|
[listeners, expectedOrigin]
|
|
47850
48059
|
);
|
|
47851
|
-
|
|
48060
|
+
useEffect80(() => {
|
|
47852
48061
|
window.addEventListener("message", handleMessage);
|
|
47853
48062
|
return () => {
|
|
47854
48063
|
window.removeEventListener("message", handleMessage);
|
|
@@ -48169,8 +48378,8 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
48169
48378
|
const { logEvent, logMeasuredEvent, startMeasuredEvent } = useTrack();
|
|
48170
48379
|
const logEventV2 = useTrackV2();
|
|
48171
48380
|
const [modalState, setModalState] = useState81(() => initialState(checkoutItem));
|
|
48172
|
-
const stepIndexRef =
|
|
48173
|
-
const lastViewedStepRef =
|
|
48381
|
+
const stepIndexRef = useRef49(1);
|
|
48382
|
+
const lastViewedStepRef = useRef49(null);
|
|
48174
48383
|
const { isStepReady, ensureStepQueries } = useStepQueryReadiness(
|
|
48175
48384
|
logEvent,
|
|
48176
48385
|
logMeasuredEvent
|
|
@@ -48180,7 +48389,7 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
48180
48389
|
ensureStepQueries(modalState.step);
|
|
48181
48390
|
}
|
|
48182
48391
|
});
|
|
48183
|
-
|
|
48392
|
+
useEffect81(() => {
|
|
48184
48393
|
ensureLoadingAccountScreen();
|
|
48185
48394
|
}, [ensureLoadingAccountScreen]);
|
|
48186
48395
|
const trackNextState = useCallback61(
|
|
@@ -48265,7 +48474,7 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
48265
48474
|
);
|
|
48266
48475
|
const { animation, animate } = useAnimatedNavigation(void 0);
|
|
48267
48476
|
const [stateHistory, setHistory] = useState81([]);
|
|
48268
|
-
const prevStep =
|
|
48477
|
+
const prevStep = useRef49(null);
|
|
48269
48478
|
const hasHistoryEntry = stateHistory.length > 1;
|
|
48270
48479
|
const onNext = useCallback61(
|
|
48271
48480
|
(payload) => {
|
|
@@ -48475,7 +48684,7 @@ function useCheckoutModalTitle(depositAddress, defaultTitle) {
|
|
|
48475
48684
|
import { IN_PROGRESS_CHECKOUT_STATES as IN_PROGRESS_CHECKOUT_STATES2 } from "@funkit/api-base";
|
|
48476
48685
|
import { formatTimestampToDate, fullMonthNames } from "@funkit/utils";
|
|
48477
48686
|
import clsx23 from "clsx";
|
|
48478
|
-
import React294, { useEffect as
|
|
48687
|
+
import React294, { useEffect as useEffect83, useMemo as useMemo65, useRef as useRef51, useState as useState83 } from "react";
|
|
48479
48688
|
import { Virtuoso } from "react-virtuoso";
|
|
48480
48689
|
|
|
48481
48690
|
// src/consts/layout.ts
|
|
@@ -48838,14 +49047,14 @@ import { useCallback as useCallback62, useState as useState82 } from "react";
|
|
|
48838
49047
|
|
|
48839
49048
|
// src/components/FunSelect/FunClickOutside.tsx
|
|
48840
49049
|
import React290 from "react";
|
|
48841
|
-
import { useEffect as
|
|
49050
|
+
import { useEffect as useEffect82, useRef as useRef50 } from "react";
|
|
48842
49051
|
function FunClickOutside({
|
|
48843
49052
|
children,
|
|
48844
49053
|
onClick
|
|
48845
49054
|
}) {
|
|
48846
|
-
const wrapperRef =
|
|
49055
|
+
const wrapperRef = useRef50(null);
|
|
48847
49056
|
const isShadowDomEnabled = useFeatureGate("enable-shadow-dom");
|
|
48848
|
-
|
|
49057
|
+
useEffect82(() => {
|
|
48849
49058
|
const handleClickListener = (event) => {
|
|
48850
49059
|
const wrapper = wrapperRef.current;
|
|
48851
49060
|
const clickedInside = isShadowDomEnabled ? !!wrapper && event.composedPath().includes(wrapper) : wrapper?.contains(event.target);
|
|
@@ -49018,8 +49227,8 @@ function Home({
|
|
|
49018
49227
|
}) {
|
|
49019
49228
|
const { t } = useFunkitTranslation();
|
|
49020
49229
|
const [selectedView, setSelectedView] = useState83(defaultHomeTab);
|
|
49021
|
-
const checkoutsListRef =
|
|
49022
|
-
const virtuosoParentRef =
|
|
49230
|
+
const checkoutsListRef = useRef51(null);
|
|
49231
|
+
const virtuosoParentRef = useRef51(null);
|
|
49023
49232
|
const account = useAccount();
|
|
49024
49233
|
useCheckoutHistoryListener();
|
|
49025
49234
|
const { userInfo } = useGeneralWallet();
|
|
@@ -49028,7 +49237,7 @@ function Home({
|
|
|
49028
49237
|
const { checkoutHistoryList, isCheckoutHistoryInited } = useCheckoutHistoryContext();
|
|
49029
49238
|
const { returnViewPresets } = useActivityTraversal();
|
|
49030
49239
|
const { animation: tabAnimation, navigateTo } = useAnimatedNavigation(setSelectedView);
|
|
49031
|
-
|
|
49240
|
+
useEffect83(() => {
|
|
49032
49241
|
const virtuosoDiv = virtuosoParentRef.current?.firstChild;
|
|
49033
49242
|
virtuosoDiv?.classList.add(animateVirtuosoInClass);
|
|
49034
49243
|
}, []);
|
|
@@ -49758,13 +49967,13 @@ function ChainModal({ onClose, open }) {
|
|
|
49758
49967
|
}
|
|
49759
49968
|
|
|
49760
49969
|
// src/modals/CheckoutModal/FunCheckoutModal.tsx
|
|
49761
|
-
import React320, { useEffect as
|
|
49970
|
+
import React320, { useEffect as useEffect93, useLayoutEffect as useLayoutEffect3, useRef as useRef54 } from "react";
|
|
49762
49971
|
|
|
49763
49972
|
// src/components/FunConnectOptions/FunConnectOptions.tsx
|
|
49764
49973
|
import React310, { useCallback as useCallback64, useMemo as useMemo66, useState as useState87 } from "react";
|
|
49765
49974
|
|
|
49766
49975
|
// src/components/FunConnectOptions/FunConnectResultStep.tsx
|
|
49767
|
-
import React305, { useEffect as
|
|
49976
|
+
import React305, { useEffect as useEffect84 } from "react";
|
|
49768
49977
|
var AUTO_CLOSE = 2e3;
|
|
49769
49978
|
var messageMap = (hasQrCode) => ({
|
|
49770
49979
|
error: {
|
|
@@ -49783,7 +49992,7 @@ var FunConnectResultStep = ({
|
|
|
49783
49992
|
qrCodeUri
|
|
49784
49993
|
}) => {
|
|
49785
49994
|
const hasAutoclose = type === "success";
|
|
49786
|
-
|
|
49995
|
+
useEffect84(() => {
|
|
49787
49996
|
if (!hasAutoclose) {
|
|
49788
49997
|
return;
|
|
49789
49998
|
}
|
|
@@ -50336,13 +50545,13 @@ var FunCheckoutBlocked = ({ reason }) => {
|
|
|
50336
50545
|
};
|
|
50337
50546
|
|
|
50338
50547
|
// src/modals/CheckoutModal/CheckoutModalPrefetchedHooks.tsx
|
|
50339
|
-
import React313, { useEffect as
|
|
50548
|
+
import React313, { useEffect as useEffect86 } from "react";
|
|
50340
50549
|
|
|
50341
50550
|
// src/modals/PolymarketPerpsTransfer/PolymarketPerpsPrefetch.tsx
|
|
50342
|
-
import React312, { useEffect as
|
|
50551
|
+
import React312, { useEffect as useEffect85, useMemo as useMemo67 } from "react";
|
|
50343
50552
|
function InactiveAccountQueries({ routingId }) {
|
|
50344
50553
|
useFops({ trackStepReadiness: false });
|
|
50345
|
-
|
|
50554
|
+
useEffect85(() => {
|
|
50346
50555
|
logger.info("polymarket:prefetch:inactiveAccount", { routingId });
|
|
50347
50556
|
}, [routingId]);
|
|
50348
50557
|
return null;
|
|
@@ -50366,14 +50575,14 @@ function CheckoutModalPrefetchedHooks() {
|
|
|
50366
50575
|
const { address: walletAddress } = useAccount();
|
|
50367
50576
|
const { setTargetAssetSupportsPermit, setTargetAssetPoolAllowance } = useQuoteContext();
|
|
50368
50577
|
const aavePermitSupported = useAaveTargetReservePermit(checkoutItem);
|
|
50369
|
-
|
|
50578
|
+
useEffect86(() => {
|
|
50370
50579
|
setTargetAssetSupportsPermit(aavePermitSupported);
|
|
50371
50580
|
}, [aavePermitSupported, setTargetAssetSupportsPermit]);
|
|
50372
50581
|
const aavePoolAllowance = useAaveTargetPoolAllowance(
|
|
50373
50582
|
checkoutItem,
|
|
50374
50583
|
walletAddress
|
|
50375
50584
|
);
|
|
50376
|
-
|
|
50585
|
+
useEffect86(() => {
|
|
50377
50586
|
setTargetAssetPoolAllowance(aavePoolAllowance);
|
|
50378
50587
|
}, [aavePoolAllowance, setTargetAssetPoolAllowance]);
|
|
50379
50588
|
return /* @__PURE__ */ React313.createElement(PolymarketPerpsPrefetch, null);
|
|
@@ -50381,7 +50590,7 @@ function CheckoutModalPrefetchedHooks() {
|
|
|
50381
50590
|
|
|
50382
50591
|
// src/modals/CheckoutModal/TransferToken/CheckoutNotifications.tsx
|
|
50383
50592
|
import clsx26 from "clsx";
|
|
50384
|
-
import React319, { useCallback as useCallback66, useEffect as
|
|
50593
|
+
import React319, { useCallback as useCallback66, useEffect as useEffect91, useMemo as useMemo68, useState as useState89 } from "react";
|
|
50385
50594
|
|
|
50386
50595
|
// src/components/FunNotificationBanner/FunNotificationShowMoreButton.tsx
|
|
50387
50596
|
import React314 from "react";
|
|
@@ -50449,10 +50658,10 @@ var useRecentCheckouts = ({
|
|
|
50449
50658
|
|
|
50450
50659
|
// src/hooks/useOnNewNotification.ts
|
|
50451
50660
|
import { safeParseJson as safeParseJson2 } from "@funkit/utils";
|
|
50452
|
-
import { useEffect as
|
|
50661
|
+
import { useEffect as useEffect87 } from "react";
|
|
50453
50662
|
var storageKey5 = "fkc-processed-notifications";
|
|
50454
50663
|
var useOnNewNotification = (combinedNotifications, cb) => {
|
|
50455
|
-
|
|
50664
|
+
useEffect87(() => {
|
|
50456
50665
|
const alreadyProcessed = safeParseJsonObject(
|
|
50457
50666
|
sessionStorage.getItem(storageKey5)
|
|
50458
50667
|
);
|
|
@@ -50499,7 +50708,7 @@ import React317 from "react";
|
|
|
50499
50708
|
|
|
50500
50709
|
// src/components/FunNotificationBanner/FunNotificationBanner.tsx
|
|
50501
50710
|
import { AnimatePresence as AnimatePresence6, motion as motion20 } from "motion/react";
|
|
50502
|
-
import React316, { useEffect as
|
|
50711
|
+
import React316, { useEffect as useEffect89, useRef as useRef53, useState as useState88 } from "react";
|
|
50503
50712
|
import clsx25 from "clsx";
|
|
50504
50713
|
|
|
50505
50714
|
// src/components/FunNotificationBanner/FunNotificationBanner.css.ts
|
|
@@ -50509,7 +50718,7 @@ var showMoreButtonStyle = "_4yitd93 _1rsrm2f1rd _1rsrm2f1i _1rsrm2f1f _1rsrm2f11
|
|
|
50509
50718
|
// src/components/FunNotificationBanner/FunNotificationBannerIcon.tsx
|
|
50510
50719
|
import clsx24 from "clsx";
|
|
50511
50720
|
import { motion as motion19, useAnimate as useAnimate3 } from "motion/react";
|
|
50512
|
-
import React315, { useCallback as useCallback65, useEffect as
|
|
50721
|
+
import React315, { useCallback as useCallback65, useEffect as useEffect88, useRef as useRef52 } from "react";
|
|
50513
50722
|
|
|
50514
50723
|
// src/components/FunNotificationBanner/FunNotificationBannerIcon.css.ts
|
|
50515
50724
|
var STATUS_SPINNER_BOTTOM_POSITION = -5;
|
|
@@ -50958,8 +51167,8 @@ var FunNotificationBannerIcon = ({
|
|
|
50958
51167
|
)
|
|
50959
51168
|
]);
|
|
50960
51169
|
}, [animate]);
|
|
50961
|
-
const statusRef =
|
|
50962
|
-
|
|
51170
|
+
const statusRef = useRef52(status);
|
|
51171
|
+
useEffect88(() => {
|
|
50963
51172
|
if (statusRef.current !== status) {
|
|
50964
51173
|
if (statusRef.current === "processing" && status === "completed") {
|
|
50965
51174
|
triggerAnimationProcessingToCompleted();
|
|
@@ -51057,9 +51266,9 @@ var FunNotificationBanner = ({
|
|
|
51057
51266
|
}) => {
|
|
51058
51267
|
const [showMore, setShowMore] = useState88(false);
|
|
51059
51268
|
const [isOpen, setIsOpen] = useState88(true);
|
|
51060
|
-
const prevStatusRef =
|
|
51269
|
+
const prevStatusRef = useRef53(status);
|
|
51061
51270
|
const prevStatus = prevStatusRef.current;
|
|
51062
|
-
|
|
51271
|
+
useEffect89(() => {
|
|
51063
51272
|
prevStatusRef.current = status;
|
|
51064
51273
|
}, [status]);
|
|
51065
51274
|
const direction = status && prevStatus && prevStatus !== status && (STATUS_RANK[status] ?? 0) < (STATUS_RANK[prevStatus] ?? 0) ? -1 : 1;
|
|
@@ -51587,10 +51796,10 @@ var parseDisclaimer2 = (t, isRefunded, isDelayed2, isFailed, onHelp) => {
|
|
|
51587
51796
|
};
|
|
51588
51797
|
|
|
51589
51798
|
// src/modals/CheckoutModal/TransferToken/useTrackDepositNotificationEvents.ts
|
|
51590
|
-
import { useEffect as
|
|
51799
|
+
import { useEffect as useEffect90 } from "react";
|
|
51591
51800
|
function useTrackDepositNotificationEvents(items) {
|
|
51592
51801
|
const { trackExecutionProgressEvents } = useTrackExecutionProgressEvents("deposit");
|
|
51593
|
-
|
|
51802
|
+
useEffect90(() => {
|
|
51594
51803
|
for (const item of items) {
|
|
51595
51804
|
trackExecutionProgressEvents(item);
|
|
51596
51805
|
}
|
|
@@ -51618,13 +51827,13 @@ var CheckoutNotifications = ({
|
|
|
51618
51827
|
}),
|
|
51619
51828
|
[directExecutions, variant]
|
|
51620
51829
|
);
|
|
51621
|
-
|
|
51830
|
+
useEffect91(() => {
|
|
51622
51831
|
if (initialCheckouts || !checkouts) {
|
|
51623
51832
|
return;
|
|
51624
51833
|
}
|
|
51625
51834
|
setInitialCheckouts(checkouts);
|
|
51626
51835
|
}, [initialCheckouts, checkouts]);
|
|
51627
|
-
|
|
51836
|
+
useEffect91(() => {
|
|
51628
51837
|
if (initialDirectExecutions || !directExecutions) {
|
|
51629
51838
|
return;
|
|
51630
51839
|
}
|
|
@@ -51659,7 +51868,7 @@ var CheckoutNotifications = ({
|
|
|
51659
51868
|
].sort((a, b) => b.createdTimeMs - a.createdTimeMs);
|
|
51660
51869
|
}, [displayedDirectExecutions, displayedCheckouts]);
|
|
51661
51870
|
useTrackDepositNotificationEvents(combinedNotifications);
|
|
51662
|
-
|
|
51871
|
+
useEffect91(() => {
|
|
51663
51872
|
if (!isVisible || !checkoutItem) {
|
|
51664
51873
|
return;
|
|
51665
51874
|
}
|
|
@@ -51747,7 +51956,7 @@ function selectSuccessScreenBackground({
|
|
|
51747
51956
|
}
|
|
51748
51957
|
|
|
51749
51958
|
// src/modals/CheckoutModal/useCheckoutBlocked.ts
|
|
51750
|
-
import { useEffect as
|
|
51959
|
+
import { useEffect as useEffect92 } from "react";
|
|
51751
51960
|
var geoblockedViewableSteps = /* @__PURE__ */ new Set([
|
|
51752
51961
|
"loading_account" /* LOADING_ACCOUNT */,
|
|
51753
51962
|
"source_change" /* SOURCE_CHANGE */
|
|
@@ -51785,7 +51994,7 @@ function useCheckoutBlocked(params) {
|
|
|
51785
51994
|
params.onCheckoutBlocked?.({ blockedReason: reason });
|
|
51786
51995
|
}
|
|
51787
51996
|
);
|
|
51788
|
-
|
|
51997
|
+
useEffect92(() => {
|
|
51789
51998
|
if (blockedReason) {
|
|
51790
51999
|
onCheckoutBlockedEvent(blockedReason);
|
|
51791
52000
|
}
|
|
@@ -51870,8 +52079,8 @@ function FunCheckoutModalInner({
|
|
|
51870
52079
|
} = useTitleConfig(checkoutItem, modalState);
|
|
51871
52080
|
const notificationVariant = NOTIFICATION_STEP_VARIANTS[modalState.step];
|
|
51872
52081
|
const handleCheckoutHelp = () => window.open(CONTACT_US_LINK, "_blank", "noopener");
|
|
51873
|
-
const animationCallbackRef =
|
|
51874
|
-
const tooltipAnchorRef =
|
|
52082
|
+
const animationCallbackRef = useRef54(null);
|
|
52083
|
+
const tooltipAnchorRef = useRef54(null);
|
|
51875
52084
|
const handleAnimationCompleteRegister = (cb) => {
|
|
51876
52085
|
animationCallbackRef.current = cb;
|
|
51877
52086
|
};
|
|
@@ -51891,7 +52100,7 @@ function FunCheckoutModalInner({
|
|
|
51891
52100
|
setModalState
|
|
51892
52101
|
};
|
|
51893
52102
|
const connectionStatus = useConnectionStatus();
|
|
51894
|
-
|
|
52103
|
+
useEffect93(() => {
|
|
51895
52104
|
if (!modalState.showWalletOptions) {
|
|
51896
52105
|
return;
|
|
51897
52106
|
}
|
|
@@ -52205,7 +52414,7 @@ function ModalProvider({ children }) {
|
|
|
52205
52414
|
onConnect: () => closeModals(isUnauthenticated),
|
|
52206
52415
|
onDisconnect: closeModals
|
|
52207
52416
|
});
|
|
52208
|
-
|
|
52417
|
+
useEffect94(() => {
|
|
52209
52418
|
if (isUnauthenticated) {
|
|
52210
52419
|
closeModals();
|
|
52211
52420
|
}
|
|
@@ -52310,7 +52519,7 @@ function useConnectModal(onClose) {
|
|
|
52310
52519
|
const { connectModalOpen, openConnectModal } = useContext20(ModalContext);
|
|
52311
52520
|
const { isWalletConnectModalOpen } = useWalletConnectOpenState();
|
|
52312
52521
|
const effectiveConnectModalOpen = connectModalOpen || isWalletConnectModalOpen;
|
|
52313
|
-
|
|
52522
|
+
useEffect94(() => {
|
|
52314
52523
|
if (!effectiveConnectModalOpen && onClose) {
|
|
52315
52524
|
onClose();
|
|
52316
52525
|
}
|
|
@@ -52345,7 +52554,7 @@ function useSoftHiddenCheckout() {
|
|
|
52345
52554
|
}
|
|
52346
52555
|
|
|
52347
52556
|
// src/wallets/useWalletAdoption.ts
|
|
52348
|
-
import { useEffect as
|
|
52557
|
+
import { useEffect as useEffect95, useRef as useRef55 } from "react";
|
|
52349
52558
|
function useWalletAdoption({
|
|
52350
52559
|
connectorId,
|
|
52351
52560
|
onSettled
|
|
@@ -52354,8 +52563,8 @@ function useWalletAdoption({
|
|
|
52354
52563
|
const { connectAsync, connectors } = useConnect();
|
|
52355
52564
|
const initialChainId = useInitialChainId();
|
|
52356
52565
|
const funkitConnectChains = useFunkitConnectChains();
|
|
52357
|
-
const startedRef =
|
|
52358
|
-
|
|
52566
|
+
const startedRef = useRef55(false);
|
|
52567
|
+
useEffect95(() => {
|
|
52359
52568
|
if (startedRef.current) {
|
|
52360
52569
|
return;
|
|
52361
52570
|
}
|
|
@@ -52437,7 +52646,7 @@ function useWalletAdoption({
|
|
|
52437
52646
|
|
|
52438
52647
|
// src/providers/usePreloadImages.ts
|
|
52439
52648
|
import { isNotNullish as isNotNullish6 } from "@funkit/utils";
|
|
52440
|
-
import { useCallback as useCallback68, useEffect as
|
|
52649
|
+
import { useCallback as useCallback68, useEffect as useEffect96 } from "react";
|
|
52441
52650
|
function usePreloadImages() {
|
|
52442
52651
|
const funkitConnectChains = useFunkitConnectChains();
|
|
52443
52652
|
const walletConnectors = useWalletConnectors();
|
|
@@ -52447,7 +52656,7 @@ function usePreloadImages() {
|
|
|
52447
52656
|
...funkitConnectChains.map((chain) => chain.iconUrl).filter(isNotNullish6)
|
|
52448
52657
|
);
|
|
52449
52658
|
}, [walletConnectors, funkitConnectChains]);
|
|
52450
|
-
|
|
52659
|
+
useEffect96(() => {
|
|
52451
52660
|
preloadImages();
|
|
52452
52661
|
}, [preloadImages]);
|
|
52453
52662
|
}
|
|
@@ -52477,7 +52686,7 @@ function createConnectorlessWagmiConfig() {
|
|
|
52477
52686
|
});
|
|
52478
52687
|
}
|
|
52479
52688
|
function FunkitProvider(props) {
|
|
52480
|
-
const adoptWalletRef =
|
|
52689
|
+
const adoptWalletRef = useRef56(props.adoptWallet && { ...props.adoptWallet });
|
|
52481
52690
|
const adoptWallet = adoptWalletRef.current;
|
|
52482
52691
|
const adoptedWalletChanged = props.adoptWallet?.connectorId !== adoptWallet?.connectorId;
|
|
52483
52692
|
validateFunkitProviderProps({ ...props, adoptWallet });
|
|
@@ -52513,7 +52722,7 @@ function FunkitProvider(props) {
|
|
|
52513
52722
|
]);
|
|
52514
52723
|
const finalQueryClient = props.queryClient;
|
|
52515
52724
|
const sdkVersion = useMemo70(() => getCurrentSdkVersion(), []);
|
|
52516
|
-
|
|
52725
|
+
useEffect97(() => {
|
|
52517
52726
|
logger.configure(
|
|
52518
52727
|
props.funkitConfig.apiKey,
|
|
52519
52728
|
!!props.debug,
|
|
@@ -52573,8 +52782,8 @@ function getConfiguredHttpRpcUrl(config, chainId2) {
|
|
|
52573
52782
|
}
|
|
52574
52783
|
function useInitializeRelayClient(source) {
|
|
52575
52784
|
const config = useConfig();
|
|
52576
|
-
const initializedRef =
|
|
52577
|
-
|
|
52785
|
+
const initializedRef = useRef56(false);
|
|
52786
|
+
useEffect97(() => {
|
|
52578
52787
|
if (initializedRef.current) {
|
|
52579
52788
|
return;
|
|
52580
52789
|
}
|
|
@@ -52965,7 +53174,7 @@ function useHasSavedFops() {
|
|
|
52965
53174
|
() => !userId || userId === "0x" ? void 0 : readHasSavedFops(userId)
|
|
52966
53175
|
);
|
|
52967
53176
|
const { realQueryData: fops } = useFops();
|
|
52968
|
-
|
|
53177
|
+
useEffect98(() => {
|
|
52969
53178
|
if (!userId || userId === "0x") {
|
|
52970
53179
|
setHasSavedFops(void 0);
|
|
52971
53180
|
return;
|
|
@@ -53099,8 +53308,8 @@ var GeneralWalletContext = createContext22({
|
|
|
53099
53308
|
logoutSymbol: void 0
|
|
53100
53309
|
});
|
|
53101
53310
|
function useLoggingLogout(userId) {
|
|
53102
|
-
const prevIdRef =
|
|
53103
|
-
|
|
53311
|
+
const prevIdRef = useRef57(userId);
|
|
53312
|
+
useEffect99(() => {
|
|
53104
53313
|
const prevUserId = prevIdRef.current;
|
|
53105
53314
|
if (prevUserId && prevUserId !== "0x" && (!userId || userId === "0x")) {
|
|
53106
53315
|
logger.warn("userInfoChangedToPlaceholder", {
|
|
@@ -53118,7 +53327,7 @@ function GeneralWalletProvider({ children }) {
|
|
|
53118
53327
|
const ensAvatar = useMainnetEnsAvatar(ensName);
|
|
53119
53328
|
const { externalUserId, apiKey } = useFunkitConfig();
|
|
53120
53329
|
const { updateUserAsync } = useTrack();
|
|
53121
|
-
const prevApiKeyRef =
|
|
53330
|
+
const prevApiKeyRef = useRef57(apiKey);
|
|
53122
53331
|
const isExternalUserIdAddress = getIsExternalUserIdAddress(
|
|
53123
53332
|
apiKey,
|
|
53124
53333
|
externalUserId
|
|
@@ -53165,7 +53374,7 @@ function GeneralWalletProvider({ children }) {
|
|
|
53165
53374
|
address: evmAddress2
|
|
53166
53375
|
});
|
|
53167
53376
|
useLoggingLogout(userInfo.id);
|
|
53168
|
-
|
|
53377
|
+
useEffect99(() => {
|
|
53169
53378
|
const apiKeyChanged = prevApiKeyRef.current !== apiKey;
|
|
53170
53379
|
const userInfoChanged = userInfo.id !== logger.getUserId() || userInfo.address !== logger.getUserAddress() || userInfo.name !== logger.getUserName() || userInfo.type !== logger.getUserLoginType() || userInfo.typeLabel !== logger.getTypeLabel() || l2Address !== logger.getL2Address();
|
|
53171
53380
|
if (apiKeyChanged || userInfoChanged) {
|
|
@@ -53456,7 +53665,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
53456
53665
|
const { logEvent, startMeasuredEvent } = useTrack();
|
|
53457
53666
|
const [activeCheckout, setActiveCheckout] = useState94(null);
|
|
53458
53667
|
const [activeWithdrawal, setActiveWithdrawal] = useState94(null);
|
|
53459
|
-
const preWithdrawalDepositSnapshotRef =
|
|
53668
|
+
const preWithdrawalDepositSnapshotRef = useRef58(null);
|
|
53460
53669
|
const udaParams = useUDAParams(
|
|
53461
53670
|
activeCheckout?.initSettings.config?.dynamicRoutingId
|
|
53462
53671
|
);
|
|
@@ -53473,7 +53682,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
53473
53682
|
},
|
|
53474
53683
|
[]
|
|
53475
53684
|
);
|
|
53476
|
-
|
|
53685
|
+
useEffect100(() => {
|
|
53477
53686
|
if (isNotNullish7(logoutSymbol)) {
|
|
53478
53687
|
setActiveCheckout(null);
|
|
53479
53688
|
}
|
|
@@ -54338,13 +54547,13 @@ function useFunkitCheckout(props) {
|
|
|
54338
54547
|
});
|
|
54339
54548
|
openWithdrawalModal?.({ withdrawalId, ...config });
|
|
54340
54549
|
});
|
|
54341
|
-
|
|
54550
|
+
useEffect100(() => {
|
|
54342
54551
|
if (isUserLoggedIn && pendingCheckoutConfig) {
|
|
54343
54552
|
setPendingCheckoutConfig(void 0);
|
|
54344
54553
|
beginCheckout(pendingCheckoutConfig);
|
|
54345
54554
|
}
|
|
54346
54555
|
}, [beginCheckout, isUserLoggedIn, pendingCheckoutConfig]);
|
|
54347
|
-
|
|
54556
|
+
useEffect100(() => {
|
|
54348
54557
|
if (pendingCheckoutConfig && !isUserLoggedIn && !connectModalOpen) {
|
|
54349
54558
|
setPendingCheckoutConfig(void 0);
|
|
54350
54559
|
}
|
|
@@ -55165,7 +55374,7 @@ function ConnectButton({
|
|
|
55165
55374
|
const connectionStatus = useConnectionStatus();
|
|
55166
55375
|
const { setShowBalance } = useShowBalance();
|
|
55167
55376
|
const [ready, setReady] = useState95(false);
|
|
55168
|
-
|
|
55377
|
+
useEffect101(() => {
|
|
55169
55378
|
setShowBalance(showBalance);
|
|
55170
55379
|
if (!ready) {
|
|
55171
55380
|
setReady(true);
|