@funkit/connect 12.15.2 → 12.16.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 +42 -0
- package/dist/clients/axiom.d.ts +11 -3
- package/dist/clients/axiom.js +3 -1
- package/dist/clients/internal/nado/withdrawalForm.js +1 -1
- package/dist/domains/convert/balances.d.ts +38 -0
- package/dist/domains/convert/recipient.d.ts +21 -0
- package/dist/domains/convert/sourceWallet.d.ts +29 -0
- package/dist/domains/convert/types.d.ts +149 -0
- package/dist/hooks/statsig/index.d.ts +1 -1
- package/dist/hooks/track/analytics/mappers.d.ts +0 -6
- package/dist/hooks/useSwappedBuyingCrypto.d.ts +13 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +938 -970
- package/dist/providers/FunkitCheckoutContext/types.d.ts +7 -0
- package/dist/providers/FunkitStatsigWhnProvider.d.ts +0 -11
- package/dist/providers/SwappedProvider.d.ts +4 -2
- package/dist/wallets/walletConnectors/index.js +39 -39
- package/package.json +4 -4
- package/dist/hooks/statsig/useExperimentV2.d.ts +0 -8
- package/dist/utils/statsig/client.d.ts +0 -4
package/dist/index.js
CHANGED
|
@@ -113,7 +113,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
113
113
|
localStorage.setItem(storageKey, version);
|
|
114
114
|
}
|
|
115
115
|
function getCurrentSdkVersion() {
|
|
116
|
-
return "12.
|
|
116
|
+
return "12.16.0";
|
|
117
117
|
}
|
|
118
118
|
function useFingerprint() {
|
|
119
119
|
const fingerprint = useCallback(() => {
|
|
@@ -518,7 +518,7 @@ function Avatar({ address, imageUrl, loading, size }) {
|
|
|
518
518
|
}
|
|
519
519
|
|
|
520
520
|
// src/components/ConnectButton/ConnectButton.tsx
|
|
521
|
-
import React334, { useEffect as
|
|
521
|
+
import React334, { useEffect as useEffect102, useState as useState97 } from "react";
|
|
522
522
|
|
|
523
523
|
// src/css/touchableStyles.css.ts
|
|
524
524
|
var active = { shrink: "_7rkubb8", shrinkSm: "_7rkubb9" };
|
|
@@ -6082,7 +6082,7 @@ import {
|
|
|
6082
6082
|
keepPreviousData,
|
|
6083
6083
|
useQueries
|
|
6084
6084
|
} from "@tanstack/react-query";
|
|
6085
|
-
import { useCallback as useCallback7, useMemo as
|
|
6085
|
+
import { useCallback as useCallback7, useMemo as useMemo9 } from "react";
|
|
6086
6086
|
import { arbitrum as arbitrum3, polygon as polygon3 } from "viem/chains";
|
|
6087
6087
|
|
|
6088
6088
|
// src/consts/customers.ts
|
|
@@ -7332,12 +7332,12 @@ function useFunkitConfig() {
|
|
|
7332
7332
|
}
|
|
7333
7333
|
|
|
7334
7334
|
// src/providers/GeneralWalletProvider.tsx
|
|
7335
|
-
import
|
|
7336
|
-
createContext as
|
|
7335
|
+
import React16, {
|
|
7336
|
+
createContext as createContext7,
|
|
7337
7337
|
useCallback as useCallback6,
|
|
7338
|
-
useContext as
|
|
7339
|
-
useEffect as
|
|
7340
|
-
useMemo as
|
|
7338
|
+
useContext as useContext7,
|
|
7339
|
+
useEffect as useEffect7,
|
|
7340
|
+
useMemo as useMemo8,
|
|
7341
7341
|
useRef as useRef2,
|
|
7342
7342
|
useState as useState8
|
|
7343
7343
|
} from "react";
|
|
@@ -7369,350 +7369,13 @@ function getConnectorIcon(connector) {
|
|
|
7369
7369
|
import {
|
|
7370
7370
|
jsonStringifyWithBigIntSanitization
|
|
7371
7371
|
} from "@funkit/utils";
|
|
7372
|
+
import {
|
|
7373
|
+
toStatsigMetadata,
|
|
7374
|
+
useFunWhnStatsigContext
|
|
7375
|
+
} from "@funkit/connect-core";
|
|
7372
7376
|
import { useStatsigClient, useStatsigUser } from "@statsig/react-bindings";
|
|
7373
7377
|
import { useCallback as useCallback5 } from "react";
|
|
7374
7378
|
|
|
7375
|
-
// src/hooks/track/analytics/mappers.ts
|
|
7376
|
-
import { FormOfPaymentType as FormOfPaymentType2 } from "@funkit/api-base";
|
|
7377
|
-
import { round as round2 } from "@funkit/utils";
|
|
7378
|
-
|
|
7379
|
-
// src/modals/CheckoutModal/InputAmount/utils.ts
|
|
7380
|
-
import { formatCurrencyAndStringify } from "@funkit/utils";
|
|
7381
|
-
var ASSET_DECIMALS = 5;
|
|
7382
|
-
var USD_DECIMALS = 2;
|
|
7383
|
-
var USD_INITIAL_AMOUNT = 100;
|
|
7384
|
-
function getDefaultAmountFromQuickOptions(quickOptions) {
|
|
7385
|
-
return quickOptions?.[Math.floor((quickOptions.length - 1) / 2)];
|
|
7386
|
-
}
|
|
7387
|
-
function getUsdMaxAmount(maxUsd) {
|
|
7388
|
-
if (maxUsd < 0) {
|
|
7389
|
-
return null;
|
|
7390
|
-
}
|
|
7391
|
-
return maxUsd;
|
|
7392
|
-
}
|
|
7393
|
-
function getUsdMinAmount(minUsd) {
|
|
7394
|
-
if (minUsd === void 0 || minUsd < MIN_CHECKOUT_AMOUNT_USD) {
|
|
7395
|
-
return MIN_CHECKOUT_AMOUNT_USD;
|
|
7396
|
-
}
|
|
7397
|
-
return minUsd;
|
|
7398
|
-
}
|
|
7399
|
-
function formatQuickOptionPresetAmount(option, percentMode, fiatCurrency, t) {
|
|
7400
|
-
if (percentMode) {
|
|
7401
|
-
return t("inputAmount.quickOptionsPercent", { percent: option });
|
|
7402
|
-
}
|
|
7403
|
-
return formatCurrencyAndStringify(
|
|
7404
|
-
option,
|
|
7405
|
-
{},
|
|
7406
|
-
{
|
|
7407
|
-
minimumFractionDigits: 0,
|
|
7408
|
-
currency: fiatCurrency,
|
|
7409
|
-
currencyDisplay: "narrowSymbol"
|
|
7410
|
-
}
|
|
7411
|
-
);
|
|
7412
|
-
}
|
|
7413
|
-
var getInputAmountSuggestion = (error, t) => {
|
|
7414
|
-
if (!error) {
|
|
7415
|
-
return void 0;
|
|
7416
|
-
}
|
|
7417
|
-
switch (error.type) {
|
|
7418
|
-
case "aboveAvailable":
|
|
7419
|
-
return {
|
|
7420
|
-
autoConfirm: true,
|
|
7421
|
-
buttonLabel: t("inputAmount.depositMaxBalance"),
|
|
7422
|
-
selectType: "max",
|
|
7423
|
-
usdAmount: error.usdAvailableAmount
|
|
7424
|
-
};
|
|
7425
|
-
case "aboveMax":
|
|
7426
|
-
return {
|
|
7427
|
-
autoConfirm: false,
|
|
7428
|
-
buttonLabel: t("inputAmount.updateOrder"),
|
|
7429
|
-
selectType: "max",
|
|
7430
|
-
usdAmount: error.usdMaxAmount
|
|
7431
|
-
};
|
|
7432
|
-
case "belowMin":
|
|
7433
|
-
return {
|
|
7434
|
-
autoConfirm: false,
|
|
7435
|
-
buttonLabel: t("inputAmount.updateOrder"),
|
|
7436
|
-
selectType: "min",
|
|
7437
|
-
usdAmount: error.usdMinAmount
|
|
7438
|
-
};
|
|
7439
|
-
}
|
|
7440
|
-
};
|
|
7441
|
-
var getInputErrorNotification = (error, t) => {
|
|
7442
|
-
if (!error) {
|
|
7443
|
-
return void 0;
|
|
7444
|
-
}
|
|
7445
|
-
switch (error.type) {
|
|
7446
|
-
case "aboveAvailable":
|
|
7447
|
-
return {
|
|
7448
|
-
code: "INSUFFICIENT_BALANCE",
|
|
7449
|
-
messageKey: "inputAmount.insufficientBalance",
|
|
7450
|
-
message: t("inputAmount.insufficientBalance"),
|
|
7451
|
-
type: "hint"
|
|
7452
|
-
};
|
|
7453
|
-
case "aboveMax":
|
|
7454
|
-
return {
|
|
7455
|
-
code: "AMOUNT_ABOVE_MAXIMUM",
|
|
7456
|
-
messageKey: "inputAmount.maximumDeposit",
|
|
7457
|
-
message: t("inputAmount.maximumDeposit", {
|
|
7458
|
-
amount: formatCurrencyAndStringify(error.usdMaxAmount)
|
|
7459
|
-
}),
|
|
7460
|
-
type: "hint"
|
|
7461
|
-
};
|
|
7462
|
-
case "belowMin":
|
|
7463
|
-
return {
|
|
7464
|
-
code: "INSUFFICIENT_AMOUNT",
|
|
7465
|
-
messageKey: "inputAmount.minimumDeposit",
|
|
7466
|
-
message: t("inputAmount.minimumDeposit", {
|
|
7467
|
-
amount: formatCurrencyAndStringify(error.usdMinAmount)
|
|
7468
|
-
}),
|
|
7469
|
-
type: "hint"
|
|
7470
|
-
};
|
|
7471
|
-
}
|
|
7472
|
-
};
|
|
7473
|
-
function getNumberSeparators(locale) {
|
|
7474
|
-
const parts = Intl.NumberFormat(locale, {
|
|
7475
|
-
currency: "USD",
|
|
7476
|
-
currencyDisplay: "narrowSymbol",
|
|
7477
|
-
style: "currency"
|
|
7478
|
-
}).formatToParts(123456789123456e-6);
|
|
7479
|
-
let decimalSeparator = ".";
|
|
7480
|
-
let groupSeparator = ",";
|
|
7481
|
-
for (const part of parts) {
|
|
7482
|
-
if (part.type === "group") {
|
|
7483
|
-
groupSeparator = part.value;
|
|
7484
|
-
} else if (part.type === "decimal") {
|
|
7485
|
-
decimalSeparator = part.value;
|
|
7486
|
-
}
|
|
7487
|
-
}
|
|
7488
|
-
return {
|
|
7489
|
-
decimalSeparator,
|
|
7490
|
-
groupSeparator: groupSeparator.match(/\s/) ? /[^\S\t\r\n\f\v]/g : new RegExp(`[${groupSeparator}]`, "g")
|
|
7491
|
-
};
|
|
7492
|
-
}
|
|
7493
|
-
function parseNumberInputValue(inputValue, separators) {
|
|
7494
|
-
const { decimalSeparator, groupSeparator } = separators;
|
|
7495
|
-
const regex = new RegExp(
|
|
7496
|
-
`^[0-9]+(${groupSeparator.source}[0-9]+)*([${decimalSeparator}][0-9]*)?$`
|
|
7497
|
-
);
|
|
7498
|
-
const match = inputValue.match(regex);
|
|
7499
|
-
if (match === null) {
|
|
7500
|
-
return {
|
|
7501
|
-
amount: void 0,
|
|
7502
|
-
amountString: "",
|
|
7503
|
-
amountStringNormalized: "",
|
|
7504
|
-
decimalPart: null,
|
|
7505
|
-
integerPart: ""
|
|
7506
|
-
};
|
|
7507
|
-
}
|
|
7508
|
-
const amountString = match[0];
|
|
7509
|
-
const amountStringNormalized = amountString.replace(new RegExp(`[^0-9${decimalSeparator}]`, "g"), "").replace(new RegExp(`[${decimalSeparator}]`, "g"), ".");
|
|
7510
|
-
const [integerPart, decimalPart = null] = amountString.split(decimalSeparator);
|
|
7511
|
-
return {
|
|
7512
|
-
amount: Number.parseFloat(amountStringNormalized),
|
|
7513
|
-
amountString,
|
|
7514
|
-
amountStringNormalized,
|
|
7515
|
-
decimalPart,
|
|
7516
|
-
integerPart: integerPart ?? ""
|
|
7517
|
-
};
|
|
7518
|
-
}
|
|
7519
|
-
function getCurrencyFormattingOptions(fiatCurrency, locale) {
|
|
7520
|
-
const parts = Intl.NumberFormat(locale, {
|
|
7521
|
-
currency: fiatCurrency,
|
|
7522
|
-
currencyDisplay: "narrowSymbol",
|
|
7523
|
-
style: "currency"
|
|
7524
|
-
}).formatToParts(123456789123456e-6);
|
|
7525
|
-
let currencySymbol = fiatCurrency;
|
|
7526
|
-
let decimals = 0;
|
|
7527
|
-
for (const part of parts) {
|
|
7528
|
-
if (part.type === "currency") {
|
|
7529
|
-
currencySymbol = part.value;
|
|
7530
|
-
} else if (part.type === "fraction") {
|
|
7531
|
-
decimals = part.value.length;
|
|
7532
|
-
}
|
|
7533
|
-
}
|
|
7534
|
-
return {
|
|
7535
|
-
currencySymbol,
|
|
7536
|
-
currencySymbolWithSpacing: currencySymbol.length > 1 ? `${currencySymbol} ` : currencySymbol,
|
|
7537
|
-
decimals
|
|
7538
|
-
};
|
|
7539
|
-
}
|
|
7540
|
-
function formatAssetAmountWithLocale(value, options) {
|
|
7541
|
-
return Intl.NumberFormat(options.locale, {
|
|
7542
|
-
maximumFractionDigits: ASSET_DECIMALS,
|
|
7543
|
-
minimumFractionDigits: ASSET_DECIMALS,
|
|
7544
|
-
style: "decimal"
|
|
7545
|
-
}).format(value);
|
|
7546
|
-
}
|
|
7547
|
-
function formatCurrencyAmountWithLocale(value, options) {
|
|
7548
|
-
return Intl.NumberFormat(options.locale, {
|
|
7549
|
-
maximumFractionDigits: ASSET_DECIMALS,
|
|
7550
|
-
minimumFractionDigits: 2,
|
|
7551
|
-
style: "decimal"
|
|
7552
|
-
}).format(value);
|
|
7553
|
-
}
|
|
7554
|
-
function formatFiatAmountAndStringify(value, options) {
|
|
7555
|
-
if (Number(Math.abs(value).toFixed(2)) >= 1e6) {
|
|
7556
|
-
return formatCurrencyAndStringify(value);
|
|
7557
|
-
}
|
|
7558
|
-
const { currencySymbolWithSpacing } = getCurrencyFormattingOptions(
|
|
7559
|
-
options.fiatCurrency,
|
|
7560
|
-
options.locale
|
|
7561
|
-
);
|
|
7562
|
-
const sign = value < 0 ? "-" : "";
|
|
7563
|
-
return `${sign}${currencySymbolWithSpacing}${formatCurrencyAmountWithLocale(Math.abs(value), options)}`;
|
|
7564
|
-
}
|
|
7565
|
-
function replaceStringRange(original, replacement, start, end) {
|
|
7566
|
-
return original.slice(0, Math.max(0, start)) + replacement + original.slice(end);
|
|
7567
|
-
}
|
|
7568
|
-
function reformatDecimalPart(decimalPart, decimals) {
|
|
7569
|
-
return decimalPart.slice(0, decimals);
|
|
7570
|
-
}
|
|
7571
|
-
function reformatIntegerPart(integerPart, locale, preserveLeadingZeroes) {
|
|
7572
|
-
const normalized = integerPart.replace(/[^0-9]/g, "") || "0";
|
|
7573
|
-
if (preserveLeadingZeroes) {
|
|
7574
|
-
return Intl.NumberFormat(locale).format(Number.parseInt(`1${normalized}`, 10)).replace(/^[1-9][^0-9]*/, "");
|
|
7575
|
-
}
|
|
7576
|
-
return Intl.NumberFormat(locale).format(Number.parseInt(normalized, 10));
|
|
7577
|
-
}
|
|
7578
|
-
|
|
7579
|
-
// src/hooks/track/analytics/mappers.ts
|
|
7580
|
-
function formatAnalyticsAmount(amount) {
|
|
7581
|
-
return amount === null ? null : round2(amount, ASSET_DECIMALS).toString();
|
|
7582
|
-
}
|
|
7583
|
-
function formatAnalyticsStep(step) {
|
|
7584
|
-
return step.toLowerCase();
|
|
7585
|
-
}
|
|
7586
|
-
function getCheckoutModalAnalyticsFlow(modalState) {
|
|
7587
|
-
switch (modalState.step) {
|
|
7588
|
-
case "withdrawal_enter_amount" /* WITHDRAWAL_ENTER_AMOUNT */:
|
|
7589
|
-
case "withdrawal_complete" /* WITHDRAWAL_COMPLETE */:
|
|
7590
|
-
return "withdraw";
|
|
7591
|
-
case "source_change" /* SOURCE_CHANGE */:
|
|
7592
|
-
return modalState.paymentMethodTypeFilter === "withdraw" ? "withdraw" : "deposit";
|
|
7593
|
-
case "swapped_iframe" /* SWAPPED_IFRAME */:
|
|
7594
|
-
return modalState.swappedMode === "withdrawal" ? "withdraw" : "deposit";
|
|
7595
|
-
case "convert" /* CONVERT */:
|
|
7596
|
-
return "convert";
|
|
7597
|
-
default:
|
|
7598
|
-
return "deposit";
|
|
7599
|
-
}
|
|
7600
|
-
}
|
|
7601
|
-
function getHistoricalSourceAddress(sourceOfFund) {
|
|
7602
|
-
const sourceAddress = sourceOfFund?.split("|")[2];
|
|
7603
|
-
return sourceAddress || null;
|
|
7604
|
-
}
|
|
7605
|
-
function resolveProvider(args, connectorId) {
|
|
7606
|
-
switch (args.paymentMethodInfo.paymentMethod) {
|
|
7607
|
-
case PaymentMethod.ACCOUNT_BALANCE:
|
|
7608
|
-
return connectorId || null;
|
|
7609
|
-
case PaymentMethod.BROKERAGE:
|
|
7610
|
-
return args.paymentMethodInfo.exchange || null;
|
|
7611
|
-
case PaymentMethod.CARD:
|
|
7612
|
-
return args.serviceProvider || null;
|
|
7613
|
-
default:
|
|
7614
|
-
return null;
|
|
7615
|
-
}
|
|
7616
|
-
}
|
|
7617
|
-
function resolvePaymentMethodProperties(args, connectorId) {
|
|
7618
|
-
return {
|
|
7619
|
-
payment_method: args.paymentMethodInfo.paymentMethod,
|
|
7620
|
-
provider: resolveProvider(args, connectorId)
|
|
7621
|
-
};
|
|
7622
|
-
}
|
|
7623
|
-
function mapSwappedFopTypeToPaymentMethod(fopType) {
|
|
7624
|
-
switch (fopType) {
|
|
7625
|
-
case FormOfPaymentType2.APPLE_PAY:
|
|
7626
|
-
return PaymentMethod.APPLE_PAY;
|
|
7627
|
-
case FormOfPaymentType2.BYBIT:
|
|
7628
|
-
case FormOfPaymentType2.COINBASE_EXCHANGE:
|
|
7629
|
-
return PaymentMethod.BROKERAGE;
|
|
7630
|
-
case FormOfPaymentType2.CARDS:
|
|
7631
|
-
return PaymentMethod.CARD;
|
|
7632
|
-
case FormOfPaymentType2.GOOGLE_PAY:
|
|
7633
|
-
return PaymentMethod.GOOGLE_PAY;
|
|
7634
|
-
case FormOfPaymentType2.REVOLUT_PAY:
|
|
7635
|
-
return PaymentMethod.REVOLUT_PAY;
|
|
7636
|
-
default:
|
|
7637
|
-
return null;
|
|
7638
|
-
}
|
|
7639
|
-
}
|
|
7640
|
-
function toStatsigMetadata(payload) {
|
|
7641
|
-
const result = {};
|
|
7642
|
-
for (const [key, value] of Object.entries(payload)) {
|
|
7643
|
-
if (value === null || value === void 0) {
|
|
7644
|
-
continue;
|
|
7645
|
-
}
|
|
7646
|
-
result[key] = String(value);
|
|
7647
|
-
}
|
|
7648
|
-
return result;
|
|
7649
|
-
}
|
|
7650
|
-
|
|
7651
|
-
// src/providers/FunkitStatsigWhnProvider.tsx
|
|
7652
|
-
import { useClientAsyncInit as useClientAsyncInit2 } from "@statsig/react-bindings";
|
|
7653
|
-
import React16, {
|
|
7654
|
-
createContext as createContext6,
|
|
7655
|
-
useContext as useContext6,
|
|
7656
|
-
useEffect as useEffect7,
|
|
7657
|
-
useMemo as useMemo7,
|
|
7658
|
-
useReducer as useReducer2
|
|
7659
|
-
} from "react";
|
|
7660
|
-
|
|
7661
|
-
// src/providers/FunkitStatsigProvider.tsx
|
|
7662
|
-
import { datadogLogs as datadogLogs2 } from "@datadog/browser-logs";
|
|
7663
|
-
import {
|
|
7664
|
-
LogEventCompressionMode,
|
|
7665
|
-
LogLevel,
|
|
7666
|
-
StatsigProvider,
|
|
7667
|
-
useClientAsyncInit
|
|
7668
|
-
} from "@statsig/react-bindings";
|
|
7669
|
-
import React15, { useEffect as useEffect6 } from "react";
|
|
7670
|
-
import { STATSIG_NETWORK_TIMEOUT_MS } from "@funkit/connect-core";
|
|
7671
|
-
var STATSIG_API = "https://data-api.fun.xyz/v1";
|
|
7672
|
-
var STATSIG_CLIENT_KEY = "client-UmFd8WIJljA7cLmZuDqs3X25M8sKd5WIQP4BSC2bRbM";
|
|
7673
|
-
function getStatsigOptions(isDevelopment) {
|
|
7674
|
-
return {
|
|
7675
|
-
networkConfig: {
|
|
7676
|
-
api: STATSIG_API,
|
|
7677
|
-
// default timeout is 10s which is too large imo
|
|
7678
|
-
// 5s should be plenty granted on average statsig responds in <200ms
|
|
7679
|
-
networkTimeoutMs: STATSIG_NETWORK_TIMEOUT_MS
|
|
7680
|
-
// uncomment to test offline mode
|
|
7681
|
-
// preventAllNetworkTraffic: true,
|
|
7682
|
-
},
|
|
7683
|
-
// By default Statsig disables compression for events when proxy is used.
|
|
7684
|
-
// As our proxy does support compression, we force it to be enabled to save bandwidth.
|
|
7685
|
-
logEventCompressionMode: LogEventCompressionMode.Forced,
|
|
7686
|
-
// Silence warnings from hooks running before async client init completes (harmless, as we have fallbacks)
|
|
7687
|
-
logLevel: isDevelopment ? void 0 : LogLevel.Error,
|
|
7688
|
-
environment: {
|
|
7689
|
-
tier: isDevelopment ? "development" : "production"
|
|
7690
|
-
}
|
|
7691
|
-
};
|
|
7692
|
-
}
|
|
7693
|
-
function FunkitStatsigProvider({
|
|
7694
|
-
children,
|
|
7695
|
-
isDevelopment = false
|
|
7696
|
-
}) {
|
|
7697
|
-
const options = getStatsigOptions(isDevelopment);
|
|
7698
|
-
const { client: primaryClient } = useClientAsyncInit(
|
|
7699
|
-
STATSIG_CLIENT_KEY,
|
|
7700
|
-
{},
|
|
7701
|
-
options
|
|
7702
|
-
);
|
|
7703
|
-
useEffect6(() => {
|
|
7704
|
-
const onValuesUpdated = (event) => {
|
|
7705
|
-
datadogLogs2.setGlobalContextProperty(
|
|
7706
|
-
"statsigSource",
|
|
7707
|
-
event.values?.source ?? "NoValues"
|
|
7708
|
-
);
|
|
7709
|
-
};
|
|
7710
|
-
primaryClient.on("values_updated", onValuesUpdated);
|
|
7711
|
-
return () => primaryClient.off("values_updated", onValuesUpdated);
|
|
7712
|
-
}, [primaryClient]);
|
|
7713
|
-
return /* @__PURE__ */ React15.createElement(StatsigProvider, { client: primaryClient }, children);
|
|
7714
|
-
}
|
|
7715
|
-
|
|
7716
7379
|
// src/hooks/track/user.ts
|
|
7717
7380
|
import { isMobile } from "@funkit/utils";
|
|
7718
7381
|
function buildStatsigUser({
|
|
@@ -7741,77 +7404,6 @@ function buildStatsigUser({
|
|
|
7741
7404
|
};
|
|
7742
7405
|
}
|
|
7743
7406
|
|
|
7744
|
-
// src/utils/statsig/client.ts
|
|
7745
|
-
function isStatsigClientLoading(client) {
|
|
7746
|
-
return client.loadingStatus !== "Ready";
|
|
7747
|
-
}
|
|
7748
|
-
function isStatsigClientFullyReady(client, apiKey, userId) {
|
|
7749
|
-
return client.loadingStatus === "Ready" && client.getContext().user.userID === (userId || "0x") && client.getContext().user.customIDs?.apiKey === apiKey;
|
|
7750
|
-
}
|
|
7751
|
-
|
|
7752
|
-
// src/providers/FunkitStatsigWhnProvider.tsx
|
|
7753
|
-
var STATSIG_CLIENT_KEY_FUN_WHN = "client-UrueDVSY9et85npGccWMFidPs00V5jzTYyzsDKlLAjr";
|
|
7754
|
-
var FunWhnStatsigContext = createContext6({
|
|
7755
|
-
client: null,
|
|
7756
|
-
isFullyReady: false,
|
|
7757
|
-
isLoading: false,
|
|
7758
|
-
renderVersion: 0
|
|
7759
|
-
});
|
|
7760
|
-
function useFunWhnStatsigContext() {
|
|
7761
|
-
return useContext6(FunWhnStatsigContext);
|
|
7762
|
-
}
|
|
7763
|
-
function FunkitStatsigWhnProvider({
|
|
7764
|
-
children,
|
|
7765
|
-
isDevelopment = false
|
|
7766
|
-
}) {
|
|
7767
|
-
const { apiKey } = useFunkitConfig();
|
|
7768
|
-
const { l2Address, userInfo } = useGeneralWallet();
|
|
7769
|
-
const userId = userInfo.id;
|
|
7770
|
-
const userName = userInfo.name;
|
|
7771
|
-
const userType = userInfo.type;
|
|
7772
|
-
const statsigUser = useMemo7(
|
|
7773
|
-
() => buildStatsigUser({
|
|
7774
|
-
apiKey,
|
|
7775
|
-
l2Address,
|
|
7776
|
-
userId,
|
|
7777
|
-
userName,
|
|
7778
|
-
userType
|
|
7779
|
-
}),
|
|
7780
|
-
[apiKey, l2Address, userId, userName, userType]
|
|
7781
|
-
);
|
|
7782
|
-
const { client } = useClientAsyncInit2(
|
|
7783
|
-
STATSIG_CLIENT_KEY_FUN_WHN,
|
|
7784
|
-
statsigUser,
|
|
7785
|
-
getStatsigOptions(isDevelopment)
|
|
7786
|
-
);
|
|
7787
|
-
const [renderVersion, rerender] = useReducer2((it) => it + 1, 0);
|
|
7788
|
-
useEffect7(() => {
|
|
7789
|
-
client.on("values_updated", rerender);
|
|
7790
|
-
return () => {
|
|
7791
|
-
client.off("values_updated", rerender);
|
|
7792
|
-
client.flush().catch((e) => {
|
|
7793
|
-
logger.warn("FunkitStatsigWhnProvider: flush failed", e);
|
|
7794
|
-
});
|
|
7795
|
-
};
|
|
7796
|
-
}, [client]);
|
|
7797
|
-
useEffect7(() => {
|
|
7798
|
-
const { user: currentUser } = client.getContext();
|
|
7799
|
-
if (currentUser.userID === statsigUser.userID && currentUser.customIDs?.apiKey === statsigUser.customIDs?.apiKey) {
|
|
7800
|
-
return;
|
|
7801
|
-
}
|
|
7802
|
-
client.updateUserAsync(statsigUser).catch((e) => {
|
|
7803
|
-
logger.warn("FunkitStatsigWhnProvider: updateUserAsync failed", e);
|
|
7804
|
-
});
|
|
7805
|
-
}, [client, statsigUser]);
|
|
7806
|
-
const isFullyReady = isStatsigClientFullyReady(client, apiKey, userId);
|
|
7807
|
-
const isLoading = isStatsigClientLoading(client);
|
|
7808
|
-
const value = useMemo7(
|
|
7809
|
-
() => ({ client, isFullyReady, isLoading, renderVersion }),
|
|
7810
|
-
[client, isFullyReady, isLoading, renderVersion]
|
|
7811
|
-
);
|
|
7812
|
-
return /* @__PURE__ */ React16.createElement(FunWhnStatsigContext.Provider, { value }, children);
|
|
7813
|
-
}
|
|
7814
|
-
|
|
7815
7407
|
// src/hooks/track/useTrack.ts
|
|
7816
7408
|
var MAX_FLATTEN_DEPTH = 10;
|
|
7817
7409
|
function flattenAndStringifyForStatsigEvent(eventName, metadata) {
|
|
@@ -8284,14 +7876,14 @@ function buildUserInfo({
|
|
|
8284
7876
|
}
|
|
8285
7877
|
|
|
8286
7878
|
// src/providers/SolanaWalletProvider.tsx
|
|
8287
|
-
import
|
|
8288
|
-
createContext as
|
|
8289
|
-
useContext as
|
|
8290
|
-
useEffect as
|
|
8291
|
-
useMemo as
|
|
7879
|
+
import React15, {
|
|
7880
|
+
createContext as createContext6,
|
|
7881
|
+
useContext as useContext6,
|
|
7882
|
+
useEffect as useEffect6,
|
|
7883
|
+
useMemo as useMemo7
|
|
8292
7884
|
} from "react";
|
|
8293
7885
|
import { toValidatedSolanaAddress } from "@funkit/connect-core";
|
|
8294
|
-
var SolanaWalletContext =
|
|
7886
|
+
var SolanaWalletContext = createContext6(
|
|
8295
7887
|
void 0
|
|
8296
7888
|
);
|
|
8297
7889
|
function SolanaWalletProvider({
|
|
@@ -8300,25 +7892,25 @@ function SolanaWalletProvider({
|
|
|
8300
7892
|
}) {
|
|
8301
7893
|
const hostAddress = solanaWallet?.address;
|
|
8302
7894
|
const address = toValidatedSolanaAddress(hostAddress);
|
|
8303
|
-
|
|
7895
|
+
useEffect6(() => {
|
|
8304
7896
|
if (solanaWallet && !address) {
|
|
8305
7897
|
logger.warn("solanaWallet_invalidAddress", {
|
|
8306
7898
|
addressLength: hostAddress?.length ?? 0
|
|
8307
7899
|
});
|
|
8308
7900
|
}
|
|
8309
7901
|
}, [solanaWallet, hostAddress, address]);
|
|
8310
|
-
const wallet =
|
|
7902
|
+
const wallet = useMemo7(
|
|
8311
7903
|
() => solanaWallet && address ? { ...solanaWallet, address } : void 0,
|
|
8312
7904
|
[solanaWallet, address]
|
|
8313
7905
|
);
|
|
8314
|
-
return /* @__PURE__ */
|
|
7906
|
+
return /* @__PURE__ */ React15.createElement(SolanaWalletContext.Provider, { value: wallet }, children);
|
|
8315
7907
|
}
|
|
8316
7908
|
var useSolanaWallet = () => {
|
|
8317
|
-
return
|
|
7909
|
+
return useContext6(SolanaWalletContext);
|
|
8318
7910
|
};
|
|
8319
7911
|
|
|
8320
7912
|
// src/providers/GeneralWalletProvider.tsx
|
|
8321
|
-
var GeneralWalletContext =
|
|
7913
|
+
var GeneralWalletContext = createContext7({
|
|
8322
7914
|
walletAddress: "",
|
|
8323
7915
|
payerWallets: { evmWallet: { address: "" }, solanaWallet: void 0 },
|
|
8324
7916
|
isUserLoggedIn: false,
|
|
@@ -8331,7 +7923,7 @@ var GeneralWalletContext = createContext8({
|
|
|
8331
7923
|
});
|
|
8332
7924
|
function useLoggingLogout(userId) {
|
|
8333
7925
|
const prevIdRef = useRef2(userId);
|
|
8334
|
-
|
|
7926
|
+
useEffect7(() => {
|
|
8335
7927
|
const prevUserId = prevIdRef.current;
|
|
8336
7928
|
if (prevUserId && prevUserId !== "0x" && (!userId || userId === "0x")) {
|
|
8337
7929
|
logger.warn("userInfoChangedToPlaceholder", {
|
|
@@ -8368,7 +7960,7 @@ function GeneralWalletProvider({ children }) {
|
|
|
8368
7960
|
identityAddress,
|
|
8369
7961
|
externalUserId
|
|
8370
7962
|
);
|
|
8371
|
-
const userInfo =
|
|
7963
|
+
const userInfo = useMemo8(
|
|
8372
7964
|
() => buildUserInfo({
|
|
8373
7965
|
address: evmAddress2,
|
|
8374
7966
|
solanaAddress,
|
|
@@ -8396,7 +7988,7 @@ function GeneralWalletProvider({ children }) {
|
|
|
8396
7988
|
address: evmAddress2
|
|
8397
7989
|
});
|
|
8398
7990
|
useLoggingLogout(userInfo.id);
|
|
8399
|
-
|
|
7991
|
+
useEffect7(() => {
|
|
8400
7992
|
const apiKeyChanged = prevApiKeyRef.current !== apiKey;
|
|
8401
7993
|
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();
|
|
8402
7994
|
if (apiKeyChanged || userInfoChanged) {
|
|
@@ -8457,7 +8049,7 @@ function GeneralWalletProvider({ children }) {
|
|
|
8457
8049
|
const connectorIcon = getConnectorIcon(connector);
|
|
8458
8050
|
const solanaName = solanaWallet?.name;
|
|
8459
8051
|
const solanaIcon = solanaWallet?.icon ?? getWalletIconByName(solanaName);
|
|
8460
|
-
const payerWallets =
|
|
8052
|
+
const payerWallets = useMemo8(
|
|
8461
8053
|
() => ({
|
|
8462
8054
|
evmWallet: {
|
|
8463
8055
|
address: evmAddress2 ?? "",
|
|
@@ -8492,10 +8084,10 @@ function GeneralWalletProvider({ children }) {
|
|
|
8492
8084
|
handleLogout,
|
|
8493
8085
|
logoutSymbol
|
|
8494
8086
|
};
|
|
8495
|
-
return /* @__PURE__ */
|
|
8087
|
+
return /* @__PURE__ */ React16.createElement(GeneralWalletContext.Provider, { value: providerValue }, children);
|
|
8496
8088
|
}
|
|
8497
8089
|
var useGeneralWallet = () => {
|
|
8498
|
-
return
|
|
8090
|
+
return useContext7(GeneralWalletContext);
|
|
8499
8091
|
};
|
|
8500
8092
|
var useIdentity = () => {
|
|
8501
8093
|
const { walletAddress, loginType, userInfo } = useGeneralWallet();
|
|
@@ -8508,7 +8100,7 @@ var useIdentity = () => {
|
|
|
8508
8100
|
};
|
|
8509
8101
|
};
|
|
8510
8102
|
var useFunkitAccount = () => {
|
|
8511
|
-
const { walletAddress, isUserLoggedIn, loginType } =
|
|
8103
|
+
const { walletAddress, isUserLoggedIn, loginType } = useContext7(GeneralWalletContext);
|
|
8512
8104
|
const wagmiAccountInfo = useAccount();
|
|
8513
8105
|
return {
|
|
8514
8106
|
...wagmiAccountInfo,
|
|
@@ -8519,12 +8111,12 @@ var useFunkitAccount = () => {
|
|
|
8519
8111
|
};
|
|
8520
8112
|
};
|
|
8521
8113
|
var useFunkitUserInfo = () => {
|
|
8522
|
-
const { userInfo } =
|
|
8114
|
+
const { userInfo } = useContext7(GeneralWalletContext);
|
|
8523
8115
|
return userInfo;
|
|
8524
8116
|
};
|
|
8525
8117
|
var useFunkitDisconnect = () => {
|
|
8526
8118
|
const disconnectReturn = useDisconnect();
|
|
8527
|
-
const { handleLogout } =
|
|
8119
|
+
const { handleLogout } = useContext7(GeneralWalletContext);
|
|
8528
8120
|
return {
|
|
8529
8121
|
...disconnectReturn,
|
|
8530
8122
|
disconnect: () => {
|
|
@@ -8682,7 +8274,7 @@ var useWalletAssets = ({
|
|
|
8682
8274
|
const { apiKey } = useFunkitConfig();
|
|
8683
8275
|
const { address, isConnected } = useAccount();
|
|
8684
8276
|
const { payerWallets } = useGeneralWallet();
|
|
8685
|
-
const addresses =
|
|
8277
|
+
const addresses = useMemo9(
|
|
8686
8278
|
() => [
|
|
8687
8279
|
isConnected ? address : void 0,
|
|
8688
8280
|
payerWallets.solanaWallet?.address
|
|
@@ -8720,16 +8312,16 @@ var useWalletAssets = ({
|
|
|
8720
8312
|
|
|
8721
8313
|
// src/providers/ModalContext.tsx
|
|
8722
8314
|
import React332, {
|
|
8723
|
-
createContext as
|
|
8315
|
+
createContext as createContext22,
|
|
8724
8316
|
useCallback as useCallback73,
|
|
8725
|
-
useContext as
|
|
8726
|
-
useEffect as
|
|
8727
|
-
useMemo as
|
|
8317
|
+
useContext as useContext22,
|
|
8318
|
+
useEffect as useEffect101,
|
|
8319
|
+
useMemo as useMemo77,
|
|
8728
8320
|
useState as useState96
|
|
8729
8321
|
} from "react";
|
|
8730
8322
|
|
|
8731
8323
|
// src/hooks/useModalStateValueWithProp.ts
|
|
8732
|
-
import { useCallback as useCallback8, useEffect as
|
|
8324
|
+
import { useCallback as useCallback8, useEffect as useEffect8, useRef as useRef3, useState as useState9 } from "react";
|
|
8733
8325
|
|
|
8734
8326
|
// src/components/Dialog/Dialog.css.ts
|
|
8735
8327
|
var DialogAnimationTimeIn = 0.25;
|
|
@@ -8749,7 +8341,7 @@ function useModalStateValueWithProp() {
|
|
|
8749
8341
|
const [isModalOpen, setModalOpen] = useState9(false);
|
|
8750
8342
|
const [prop, setProp] = useState9(null);
|
|
8751
8343
|
const clearPropTimer = useRef3(void 0);
|
|
8752
|
-
|
|
8344
|
+
useEffect8(() => () => clearTimeout(clearPropTimer.current), []);
|
|
8753
8345
|
return {
|
|
8754
8346
|
closeModal: useCallback8(() => {
|
|
8755
8347
|
clearTimeout(clearPropTimer.current);
|
|
@@ -8772,7 +8364,7 @@ function useModalStateValueWithProp() {
|
|
|
8772
8364
|
|
|
8773
8365
|
// src/modals/WithdrawalModal/WithdrawalModal.tsx
|
|
8774
8366
|
import { resolveWithdrawalSourceTokenBalance as resolveWithdrawalSourceTokenBalance3 } from "@funkit/connect-core";
|
|
8775
|
-
import React169, { useCallback as useCallback41, useEffect as
|
|
8367
|
+
import React169, { useCallback as useCallback41, useEffect as useEffect62, useRef as useRef38, useState as useState53 } from "react";
|
|
8776
8368
|
import { mainnet as mainnet10 } from "viem/chains";
|
|
8777
8369
|
|
|
8778
8370
|
// src/utils/withdrawal.ts
|
|
@@ -8906,7 +8498,7 @@ function dismissFreeUsdcBanner() {
|
|
|
8906
8498
|
}
|
|
8907
8499
|
|
|
8908
8500
|
// src/components/ChainIcon/ChainIcon.tsx
|
|
8909
|
-
import
|
|
8501
|
+
import React17 from "react";
|
|
8910
8502
|
function ChainIcon({
|
|
8911
8503
|
chainId: chainId2,
|
|
8912
8504
|
size,
|
|
@@ -8919,7 +8511,7 @@ function ChainIcon({
|
|
|
8919
8511
|
if (!chainMetadata) {
|
|
8920
8512
|
return null;
|
|
8921
8513
|
}
|
|
8922
|
-
return /* @__PURE__ */
|
|
8514
|
+
return /* @__PURE__ */ React17.createElement(
|
|
8923
8515
|
AsyncImage,
|
|
8924
8516
|
{
|
|
8925
8517
|
alt: chainMetadata.name,
|
|
@@ -8938,7 +8530,7 @@ function ChainIcon({
|
|
|
8938
8530
|
// src/components/FunButton/FunIconButton.tsx
|
|
8939
8531
|
import { noop } from "@funkit/utils";
|
|
8940
8532
|
import clsx3 from "clsx";
|
|
8941
|
-
import
|
|
8533
|
+
import React18 from "react";
|
|
8942
8534
|
|
|
8943
8535
|
// src/components/FunButton/FunButton.css.ts
|
|
8944
8536
|
var accentLinkStyle = "_1tyx5nu3 _1rsrm2f2up";
|
|
@@ -9011,7 +8603,7 @@ var FunIconButton = ({
|
|
|
9011
8603
|
const disableHoverStyles = as === "button" && !onClick || as === "a" && !props.href;
|
|
9012
8604
|
const showBorder = variant === "outlined";
|
|
9013
8605
|
const finalAriaLabel = ariaLabel ?? t("common.button");
|
|
9014
|
-
return /* @__PURE__ */
|
|
8606
|
+
return /* @__PURE__ */ React18.createElement(
|
|
9015
8607
|
Box,
|
|
9016
8608
|
{
|
|
9017
8609
|
display: "flex",
|
|
@@ -9051,7 +8643,7 @@ var FunIconButton = ({
|
|
|
9051
8643
|
...props,
|
|
9052
8644
|
...props.href ? { target: "_blank", rel: "noopener noreferrer" } : {}
|
|
9053
8645
|
},
|
|
9054
|
-
icon && /* @__PURE__ */
|
|
8646
|
+
icon && /* @__PURE__ */ React18.createElement(
|
|
9055
8647
|
Box,
|
|
9056
8648
|
{
|
|
9057
8649
|
position: "relative",
|
|
@@ -9067,9 +8659,9 @@ var FunIconButton = ({
|
|
|
9067
8659
|
};
|
|
9068
8660
|
|
|
9069
8661
|
// src/components/Icons/CloseIcon.tsx
|
|
9070
|
-
import
|
|
8662
|
+
import React19 from "react";
|
|
9071
8663
|
var CloseIcon = ({ size = 13 }) => {
|
|
9072
|
-
return /* @__PURE__ */
|
|
8664
|
+
return /* @__PURE__ */ React19.createElement(
|
|
9073
8665
|
"svg",
|
|
9074
8666
|
{
|
|
9075
8667
|
width: size,
|
|
@@ -9078,7 +8670,7 @@ var CloseIcon = ({ size = 13 }) => {
|
|
|
9078
8670
|
fill: "none",
|
|
9079
8671
|
xmlns: "http://www.w3.org/2000/svg"
|
|
9080
8672
|
},
|
|
9081
|
-
/* @__PURE__ */
|
|
8673
|
+
/* @__PURE__ */ React19.createElement(
|
|
9082
8674
|
"path",
|
|
9083
8675
|
{
|
|
9084
8676
|
id: "Vector 93",
|
|
@@ -9088,7 +8680,7 @@ var CloseIcon = ({ size = 13 }) => {
|
|
|
9088
8680
|
strokeLinecap: "round"
|
|
9089
8681
|
}
|
|
9090
8682
|
),
|
|
9091
|
-
/* @__PURE__ */
|
|
8683
|
+
/* @__PURE__ */ React19.createElement(
|
|
9092
8684
|
"path",
|
|
9093
8685
|
{
|
|
9094
8686
|
id: "Vector 94",
|
|
@@ -9104,8 +8696,8 @@ var CloseIcon = ({ size = 13 }) => {
|
|
|
9104
8696
|
// src/components/FunTooltip/FunTooltip.tsx
|
|
9105
8697
|
import * as Tooltip from "@radix-ui/react-tooltip";
|
|
9106
8698
|
import React40, {
|
|
9107
|
-
createContext as
|
|
9108
|
-
useContext as
|
|
8699
|
+
createContext as createContext19,
|
|
8700
|
+
useContext as useContext18,
|
|
9109
8701
|
useState as useState19
|
|
9110
8702
|
} from "react";
|
|
9111
8703
|
|
|
@@ -9127,9 +8719,9 @@ import {
|
|
|
9127
8719
|
QueryClientProvider
|
|
9128
8720
|
} from "@tanstack/react-query";
|
|
9129
8721
|
import React38, {
|
|
9130
|
-
createContext as
|
|
9131
|
-
useContext as
|
|
9132
|
-
useEffect as
|
|
8722
|
+
createContext as createContext18,
|
|
8723
|
+
useContext as useContext17,
|
|
8724
|
+
useEffect as useEffect25,
|
|
9133
8725
|
useMemo as useMemo19,
|
|
9134
8726
|
useRef as useRef9,
|
|
9135
8727
|
useState as useState18
|
|
@@ -9923,13 +9515,13 @@ import {
|
|
|
9923
9515
|
bluvoRequestQuotation
|
|
9924
9516
|
} from "@funkit/api-base";
|
|
9925
9517
|
import { safeParseJson } from "@funkit/utils";
|
|
9926
|
-
import
|
|
9927
|
-
useContext as
|
|
9928
|
-
useEffect as
|
|
9929
|
-
useMemo as
|
|
9518
|
+
import React22, {
|
|
9519
|
+
useContext as useContext11,
|
|
9520
|
+
useEffect as useEffect12,
|
|
9521
|
+
useMemo as useMemo14,
|
|
9930
9522
|
useState as useState12
|
|
9931
9523
|
} from "react";
|
|
9932
|
-
import { createContext as
|
|
9524
|
+
import { createContext as createContext11 } from "react";
|
|
9933
9525
|
|
|
9934
9526
|
// src/hooks/statsig/useDynamicConfig.ts
|
|
9935
9527
|
import {
|
|
@@ -9953,6 +9545,9 @@ var useDynamicConfig = (name, options) => {
|
|
|
9953
9545
|
});
|
|
9954
9546
|
};
|
|
9955
9547
|
|
|
9548
|
+
// src/hooks/statsig/index.ts
|
|
9549
|
+
import { useExperimentV2 } from "@funkit/connect-core";
|
|
9550
|
+
|
|
9956
9551
|
// src/hooks/statsig/useFeatureGate.ts
|
|
9957
9552
|
import { useFeatureGate } from "@funkit/connect-core";
|
|
9958
9553
|
|
|
@@ -9972,17 +9567,15 @@ import { arbitrum as arbitrum5 } from "viem/chains";
|
|
|
9972
9567
|
// src/hooks/useTokenTransfer.ts
|
|
9973
9568
|
import {
|
|
9974
9569
|
FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS as FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS3,
|
|
9975
|
-
|
|
9976
|
-
hyperCoreChain,
|
|
9977
|
-
solanaChain as solanaChain3,
|
|
9978
|
-
tronChain as tronChain2
|
|
9570
|
+
hyperCoreChain
|
|
9979
9571
|
} from "@funkit/chains";
|
|
9980
9572
|
import {
|
|
9981
9573
|
getMinTransferValueEur,
|
|
9982
9574
|
getMinTransferValueForChain,
|
|
9983
|
-
getMinTransferValueUsd
|
|
9575
|
+
getMinTransferValueUsd,
|
|
9576
|
+
transferChainFamily
|
|
9984
9577
|
} from "@funkit/connect-core";
|
|
9985
|
-
import { useMemo as
|
|
9578
|
+
import { useMemo as useMemo13 } from "react";
|
|
9986
9579
|
import { arbitrum as arbitrum4, polygon as polygon4 } from "viem/chains";
|
|
9987
9580
|
|
|
9988
9581
|
// src/hooks/useIsStablecoin.ts
|
|
@@ -10010,12 +9603,12 @@ import {
|
|
|
10010
9603
|
} from "@funkit/chains";
|
|
10011
9604
|
import { getCheckoutTokenTransferParams } from "@funkit/connect-core";
|
|
10012
9605
|
import { isAddressEquivalent as isAddressEquivalent5, isNotNullish as isNotNullish2 } from "@funkit/utils";
|
|
10013
|
-
import
|
|
10014
|
-
createContext as
|
|
9606
|
+
import React21, {
|
|
9607
|
+
createContext as createContext9,
|
|
10015
9608
|
useCallback as useCallback14,
|
|
10016
|
-
useContext as
|
|
10017
|
-
useEffect as
|
|
10018
|
-
useMemo as
|
|
9609
|
+
useContext as useContext9,
|
|
9610
|
+
useEffect as useEffect10,
|
|
9611
|
+
useMemo as useMemo12,
|
|
10019
9612
|
useRef as useRef5,
|
|
10020
9613
|
useState as useState11
|
|
10021
9614
|
} from "react";
|
|
@@ -10268,9 +9861,9 @@ import {
|
|
|
10268
9861
|
} from "@funkit/connect-core";
|
|
10269
9862
|
|
|
10270
9863
|
// src/hooks/useRelayBypass.ts
|
|
10271
|
-
import { useCallback as useCallback11, useMemo as
|
|
9864
|
+
import { useCallback as useCallback11, useMemo as useMemo10 } from "react";
|
|
10272
9865
|
function useRelayBypass() {
|
|
10273
|
-
const paymentMethodWhitelistConfig =
|
|
9866
|
+
const paymentMethodWhitelistConfig = useMemo10(() => {
|
|
10274
9867
|
return {
|
|
10275
9868
|
// TODO: Consolidate / Add brokerage and card here once Relay QR is ready for all clients
|
|
10276
9869
|
relayPaymentMethods: [
|
|
@@ -10827,13 +10420,13 @@ async function checkoutTransferFetch(params) {
|
|
|
10827
10420
|
import { useEffectEvent } from "@funkit/connect-core";
|
|
10828
10421
|
|
|
10829
10422
|
// src/hooks/useUDAParams.ts
|
|
10830
|
-
import { useMemo as
|
|
10423
|
+
import { useMemo as useMemo11 } from "react";
|
|
10831
10424
|
var useUDAParams = (_dynamicRoutingId) => {
|
|
10832
10425
|
const { checkoutItem } = useCheckoutContext();
|
|
10833
10426
|
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
10834
10427
|
const dynamicRoutingId = _dynamicRoutingId || checkoutConfig?.dynamicRoutingId;
|
|
10835
10428
|
const udaParams = useDynamicConfig("uda_params");
|
|
10836
|
-
const currentParams =
|
|
10429
|
+
const currentParams = useMemo11(() => {
|
|
10837
10430
|
return udaParams.find(
|
|
10838
10431
|
(param) => param.dynamicRoutingId === dynamicRoutingId
|
|
10839
10432
|
)?.params;
|
|
@@ -10869,11 +10462,11 @@ import {
|
|
|
10869
10462
|
getDirectExecutionsByUserId
|
|
10870
10463
|
} from "@funkit/api-base";
|
|
10871
10464
|
import { isNotNullish } from "@funkit/utils";
|
|
10872
|
-
import
|
|
10873
|
-
createContext as
|
|
10465
|
+
import React20, {
|
|
10466
|
+
createContext as createContext8,
|
|
10874
10467
|
useCallback as useCallback13,
|
|
10875
|
-
useContext as
|
|
10876
|
-
useEffect as
|
|
10468
|
+
useContext as useContext8,
|
|
10469
|
+
useEffect as useEffect9,
|
|
10877
10470
|
useRef as useRef4,
|
|
10878
10471
|
useState as useState10
|
|
10879
10472
|
} from "react";
|
|
@@ -10958,12 +10551,12 @@ function FunkitCheckoutHistoryProvider({
|
|
|
10958
10551
|
isUserLoggedIn,
|
|
10959
10552
|
userInfo
|
|
10960
10553
|
]);
|
|
10961
|
-
|
|
10554
|
+
useEffect9(() => {
|
|
10962
10555
|
if (isListening && (isUserLoggedIn || isGuestUserOnCheckoutHistory)) {
|
|
10963
10556
|
_refreshCheckoutHistory();
|
|
10964
10557
|
}
|
|
10965
10558
|
}, [refreshSymbol, isUserLoggedIn]);
|
|
10966
|
-
|
|
10559
|
+
useEffect9(() => {
|
|
10967
10560
|
if (isNotNullish(logoutSymbol) && isInited) {
|
|
10968
10561
|
setIsInited(false);
|
|
10969
10562
|
setCheckoutHistoryList([]);
|
|
@@ -11004,9 +10597,9 @@ function FunkitCheckoutHistoryProvider({
|
|
|
11004
10597
|
startCheckoutHistoryListener,
|
|
11005
10598
|
stopCheckoutHistoryListener
|
|
11006
10599
|
};
|
|
11007
|
-
return /* @__PURE__ */
|
|
10600
|
+
return /* @__PURE__ */ React20.createElement(FunkitCheckoutHistoryContext.Provider, { value: contextValue }, children);
|
|
11008
10601
|
}
|
|
11009
|
-
var FunkitCheckoutHistoryContext =
|
|
10602
|
+
var FunkitCheckoutHistoryContext = createContext8({
|
|
11010
10603
|
checkoutHistoryList: [],
|
|
11011
10604
|
isCheckoutHistoryInited: false,
|
|
11012
10605
|
isRefreshingCheckoutHistory: true,
|
|
@@ -11015,7 +10608,7 @@ var FunkitCheckoutHistoryContext = createContext9({
|
|
|
11015
10608
|
stopCheckoutHistoryListener: () => void 0
|
|
11016
10609
|
});
|
|
11017
10610
|
function useCheckoutHistoryContext() {
|
|
11018
|
-
return
|
|
10611
|
+
return useContext8(FunkitCheckoutHistoryContext);
|
|
11019
10612
|
}
|
|
11020
10613
|
function useCheckoutsListenerByUserId(userId) {
|
|
11021
10614
|
const { apiKey } = useFunkitConfig();
|
|
@@ -11076,7 +10669,7 @@ var useFunkitPostCheckoutInternal = (checkoutId) => {
|
|
|
11076
10669
|
const [checkoutHistoryInfo, setCheckoutHistoryInfo] = useState10();
|
|
11077
10670
|
const [directExecutionInfo, setDirectExecutionInfo] = useState10();
|
|
11078
10671
|
const [isLoading, setIsLoading] = useState10(false);
|
|
11079
|
-
|
|
10672
|
+
useEffect9(() => {
|
|
11080
10673
|
const setupCheckoutHistory = async () => {
|
|
11081
10674
|
if (!checkoutId || checkoutId === "0x") {
|
|
11082
10675
|
return;
|
|
@@ -11179,7 +10772,7 @@ var trackEventFromDirectExecutionConfirmed = ({
|
|
|
11179
10772
|
};
|
|
11180
10773
|
|
|
11181
10774
|
// src/providers/FunkitCheckoutContext/index.tsx
|
|
11182
|
-
var FunkitCheckoutContext =
|
|
10775
|
+
var FunkitCheckoutContext = createContext9({
|
|
11183
10776
|
checkoutItem: null,
|
|
11184
10777
|
getCheckoutProgress: () => void 0,
|
|
11185
10778
|
setCheckoutProgress: () => void 0,
|
|
@@ -11290,7 +10883,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
11290
10883
|
},
|
|
11291
10884
|
[]
|
|
11292
10885
|
);
|
|
11293
|
-
|
|
10886
|
+
useEffect10(() => {
|
|
11294
10887
|
if (isNotNullish2(logoutSymbol)) {
|
|
11295
10888
|
setActiveCheckout(null);
|
|
11296
10889
|
}
|
|
@@ -11578,6 +11171,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
11578
11171
|
refreshCheckoutHistory();
|
|
11579
11172
|
return confirmationResult;
|
|
11580
11173
|
},
|
|
11174
|
+
// oxlint-disable-next-line react-hooks/exhaustive-deps -- TODO(review): suppressed when the rule was turned on
|
|
11581
11175
|
[
|
|
11582
11176
|
getDirectExecutionInfo,
|
|
11583
11177
|
funkitConfig.apiKey,
|
|
@@ -11585,7 +11179,6 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
11585
11179
|
refreshCheckoutHistory,
|
|
11586
11180
|
setCheckoutProgress,
|
|
11587
11181
|
userInfo.id,
|
|
11588
|
-
updateActiveCheckout,
|
|
11589
11182
|
walletAddress,
|
|
11590
11183
|
payerWallets,
|
|
11591
11184
|
getWithdrawalDirectExecution,
|
|
@@ -11622,13 +11215,7 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
11622
11215
|
depositAddress
|
|
11623
11216
|
};
|
|
11624
11217
|
},
|
|
11625
|
-
[
|
|
11626
|
-
t,
|
|
11627
|
-
activeCheckout,
|
|
11628
|
-
refreshCheckoutHistory,
|
|
11629
|
-
funkitConfig.apiKey,
|
|
11630
|
-
updateActiveCheckout
|
|
11631
|
-
]
|
|
11218
|
+
[t, activeCheckout, refreshCheckoutHistory, funkitConfig.apiKey]
|
|
11632
11219
|
);
|
|
11633
11220
|
const confirmCheckout = useEffectEvent(
|
|
11634
11221
|
async (latestQuote, stepMessageSetter, withdrawalClient, preWithdrawalTxs) => {
|
|
@@ -11966,18 +11553,18 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
11966
11553
|
updateDynamicRoutingId,
|
|
11967
11554
|
applyDynamicTargetAssetCandidate
|
|
11968
11555
|
};
|
|
11969
|
-
return /* @__PURE__ */
|
|
11556
|
+
return /* @__PURE__ */ React21.createElement(FunkitCheckoutContext.Provider, { value: contextValue }, children);
|
|
11970
11557
|
}
|
|
11971
11558
|
function useCheckoutContext() {
|
|
11972
|
-
return
|
|
11559
|
+
return useContext9(FunkitCheckoutContext);
|
|
11973
11560
|
}
|
|
11974
11561
|
function CheckoutConfigOverride({
|
|
11975
11562
|
config,
|
|
11976
11563
|
children
|
|
11977
11564
|
}) {
|
|
11978
|
-
const parent =
|
|
11565
|
+
const parent = useContext9(FunkitCheckoutContext);
|
|
11979
11566
|
const { checkoutItem } = parent;
|
|
11980
|
-
const value =
|
|
11567
|
+
const value = useMemo12(() => {
|
|
11981
11568
|
if (!checkoutItem) {
|
|
11982
11569
|
return null;
|
|
11983
11570
|
}
|
|
@@ -11992,7 +11579,7 @@ function CheckoutConfigOverride({
|
|
|
11992
11579
|
if (!value) {
|
|
11993
11580
|
return null;
|
|
11994
11581
|
}
|
|
11995
|
-
return /* @__PURE__ */
|
|
11582
|
+
return /* @__PURE__ */ React21.createElement(FunkitCheckoutContext.Provider, { value }, children);
|
|
11996
11583
|
}
|
|
11997
11584
|
function useFunkitCheckout(props) {
|
|
11998
11585
|
const { onValidation, onError } = props;
|
|
@@ -12002,7 +11589,7 @@ function useFunkitCheckout(props) {
|
|
|
12002
11589
|
initNewWithdrawal,
|
|
12003
11590
|
updateSourceAsset,
|
|
12004
11591
|
updateSelectedPaymentMethodInfo
|
|
12005
|
-
} =
|
|
11592
|
+
} = useContext9(FunkitCheckoutContext);
|
|
12006
11593
|
const { openFunCheckoutModal } = useFunCheckoutModal();
|
|
12007
11594
|
const { openWithdrawalModal } = useWithdrawalModal();
|
|
12008
11595
|
const { connectModalOpen, openConnectModal } = useConnectModal();
|
|
@@ -12171,13 +11758,13 @@ function useFunkitCheckout(props) {
|
|
|
12171
11758
|
});
|
|
12172
11759
|
openWithdrawalModal?.({ withdrawalId, ...config });
|
|
12173
11760
|
});
|
|
12174
|
-
|
|
11761
|
+
useEffect10(() => {
|
|
12175
11762
|
if (isUserLoggedIn && pendingCheckoutConfig) {
|
|
12176
11763
|
setPendingCheckoutConfig(void 0);
|
|
12177
11764
|
beginCheckout(pendingCheckoutConfig);
|
|
12178
11765
|
}
|
|
12179
|
-
}, [
|
|
12180
|
-
|
|
11766
|
+
}, [isUserLoggedIn, pendingCheckoutConfig]);
|
|
11767
|
+
useEffect10(() => {
|
|
12181
11768
|
if (pendingCheckoutConfig && !isUserLoggedIn && !connectModalOpen) {
|
|
12182
11769
|
setPendingCheckoutConfig(void 0);
|
|
12183
11770
|
}
|
|
@@ -12198,7 +11785,7 @@ import {
|
|
|
12198
11785
|
import { lighterChain } from "@funkit/chains";
|
|
12199
11786
|
import { getCheckoutTokenTransferParams as getCheckoutTokenTransferParams2 } from "@funkit/connect-core";
|
|
12200
11787
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
12201
|
-
import { useEffect as
|
|
11788
|
+
import { useEffect as useEffect11 } from "react";
|
|
12202
11789
|
|
|
12203
11790
|
// src/hooks/useIsDynamicRoutingEnabled.ts
|
|
12204
11791
|
var useIsDynamicRoutingEnabled = ({
|
|
@@ -12267,7 +11854,7 @@ var useCheckoutTransferInit = (enabled = true, { trackStepReadiness = true } = {
|
|
|
12267
11854
|
return getCheckoutRecipient({ config: checkoutConfig, payerWallets }) || "0x";
|
|
12268
11855
|
})();
|
|
12269
11856
|
const isLighterWalletFallback = isLighterTarget && !mainAccountIndex && !checkoutConfig?.customRecipient;
|
|
12270
|
-
|
|
11857
|
+
useEffect11(() => {
|
|
12271
11858
|
if (useLighterMainAccount) {
|
|
12272
11859
|
logger.info("checkout:recipient:lighterMainAccount", {
|
|
12273
11860
|
mainAccountIndex,
|
|
@@ -12275,7 +11862,7 @@ var useCheckoutTransferInit = (enabled = true, { trackStepReadiness = true } = {
|
|
|
12275
11862
|
});
|
|
12276
11863
|
}
|
|
12277
11864
|
}, [useLighterMainAccount, mainAccountIndex, udaParams?.targetChain]);
|
|
12278
|
-
|
|
11865
|
+
useEffect11(() => {
|
|
12279
11866
|
if (isLighterWalletFallback && !isLighterLookupFetching) {
|
|
12280
11867
|
logger.warn("checkout:recipient:lighterMainAccountUnresolved", {
|
|
12281
11868
|
targetChain: udaParams?.targetChain,
|
|
@@ -12373,18 +11960,7 @@ var useTokenTransfer = (selectedChainId, selectedToken, chainIds) => {
|
|
|
12373
11960
|
const isUsdcOnPolygon = isPolygon && selectedToken === "USDC";
|
|
12374
11961
|
const showOriginalRecipient = !enableUniversal && (isUsdceOnPolygon || isUsdcOnPolygon);
|
|
12375
11962
|
const funDepositAddress = selectedChainId !== void 0 ? getDepositAddressForChain(selectedChainId, transferInit) : void 0;
|
|
12376
|
-
const blockchainType = (
|
|
12377
|
-
if (selectedChainId === solanaChain3.id) {
|
|
12378
|
-
return "solana";
|
|
12379
|
-
}
|
|
12380
|
-
if (selectedChainId === bitcoinChain.id) {
|
|
12381
|
-
return "bitcoin";
|
|
12382
|
-
}
|
|
12383
|
-
if (selectedChainId === tronChain2.id) {
|
|
12384
|
-
return "tron";
|
|
12385
|
-
}
|
|
12386
|
-
return "ethereum";
|
|
12387
|
-
})();
|
|
11963
|
+
const blockchainType = transferChainFamily(selectedChainId);
|
|
12388
11964
|
const depositAddressTooltip = showOriginalRecipient ? t("transferToken.depositAddressOriginalRecipient") : t("transferToken.depositAddressUniversal", {
|
|
12389
11965
|
targetToken: checkoutConfig?.targetAssetTicker
|
|
12390
11966
|
});
|
|
@@ -12436,7 +12012,7 @@ var useMinTransferValueEur = (selectedChainId) => {
|
|
|
12436
12012
|
};
|
|
12437
12013
|
var useMinTransferValues = (chainIds) => {
|
|
12438
12014
|
const limits = useDynamicConfig("mintokentransfervalue");
|
|
12439
|
-
return
|
|
12015
|
+
return useMemo13(() => {
|
|
12440
12016
|
return chainIds.reduce(
|
|
12441
12017
|
(acc, id) => {
|
|
12442
12018
|
acc[id] = getMinTransferValueUsd(id, limits);
|
|
@@ -12725,9 +12301,9 @@ var isBluvoWithdrawalError = (error) => {
|
|
|
12725
12301
|
};
|
|
12726
12302
|
|
|
12727
12303
|
// src/providers/FunkitSandboxContext.tsx
|
|
12728
|
-
import { createContext as
|
|
12729
|
-
var FunkitSandboxContext =
|
|
12730
|
-
var useIsFunkitSandboxMode = () =>
|
|
12304
|
+
import { createContext as createContext10, useContext as useContext10 } from "react";
|
|
12305
|
+
var FunkitSandboxContext = createContext10(false);
|
|
12306
|
+
var useIsFunkitSandboxMode = () => useContext10(FunkitSandboxContext);
|
|
12731
12307
|
|
|
12732
12308
|
// src/providers/FunkitBrokerageProvider.tsx
|
|
12733
12309
|
var PROD_ORG_ID = "swVwRpxm54werxWOQ5EayjtWM8i33jtL";
|
|
@@ -12735,7 +12311,7 @@ var PROD_PROJECT_ID = "tdN6yxVldIkEuE9XjKVGu0OCLsHcjVuy";
|
|
|
12735
12311
|
var STAGE_ORG_ID = "ezCUF9l9zpdB01nVvGe8O2E1vDZSbkVa";
|
|
12736
12312
|
var STAGE_PROJECT_ID = "D00dTLSdlAYpEFDTL2mMj7bee3SbjYI0";
|
|
12737
12313
|
var LOCAL_STORAGE_KEY = "fkc-bluvo-cex";
|
|
12738
|
-
var FunkitBrokerageContext =
|
|
12314
|
+
var FunkitBrokerageContext = createContext11(void 0);
|
|
12739
12315
|
var FunkitBrokerageProvider = ({
|
|
12740
12316
|
children
|
|
12741
12317
|
}) => {
|
|
@@ -12777,7 +12353,7 @@ var FunkitBrokerageProvider = ({
|
|
|
12777
12353
|
const [isConnected, setIsConnected] = useState12(
|
|
12778
12354
|
() => initialIsConnected
|
|
12779
12355
|
);
|
|
12780
|
-
|
|
12356
|
+
useEffect12(() => {
|
|
12781
12357
|
if (!isBluvoEnabled) {
|
|
12782
12358
|
setAuthConnections({});
|
|
12783
12359
|
bluvoClient.cancel();
|
|
@@ -12788,12 +12364,12 @@ var FunkitBrokerageProvider = ({
|
|
|
12788
12364
|
const initialConnections = getAuthConnectedExchanges();
|
|
12789
12365
|
setAuthConnections(initialConnections);
|
|
12790
12366
|
}, [isBluvoEnabled]);
|
|
12791
|
-
|
|
12367
|
+
useEffect12(() => {
|
|
12792
12368
|
if (bluvoClient.withdrawal?.status === "completed") {
|
|
12793
12369
|
setSelectedBrokerageAsset(null);
|
|
12794
12370
|
}
|
|
12795
12371
|
}, [bluvoClient.withdrawal?.status]);
|
|
12796
|
-
const brokerageMinMax =
|
|
12372
|
+
const brokerageMinMax = useMemo14(() => {
|
|
12797
12373
|
if (!selectedBrokerageAsset || !isBrokerageAsset(selectedBrokerageAsset)) {
|
|
12798
12374
|
return null;
|
|
12799
12375
|
}
|
|
@@ -12832,7 +12408,7 @@ var FunkitBrokerageProvider = ({
|
|
|
12832
12408
|
saveAuthConnectedExchange(walletId, exchange);
|
|
12833
12409
|
setIsConnected(true);
|
|
12834
12410
|
};
|
|
12835
|
-
return /* @__PURE__ */
|
|
12411
|
+
return /* @__PURE__ */ React22.createElement(
|
|
12836
12412
|
FunkitBrokerageContext.Provider,
|
|
12837
12413
|
{
|
|
12838
12414
|
value: {
|
|
@@ -12849,7 +12425,7 @@ var FunkitBrokerageProvider = ({
|
|
|
12849
12425
|
);
|
|
12850
12426
|
};
|
|
12851
12427
|
function useFunkitBrokerageContext() {
|
|
12852
|
-
const context =
|
|
12428
|
+
const context = useContext11(FunkitBrokerageContext);
|
|
12853
12429
|
if (!context) {
|
|
12854
12430
|
throw new Error("FunkitBrokerageContext not found");
|
|
12855
12431
|
}
|
|
@@ -12857,28 +12433,28 @@ function useFunkitBrokerageContext() {
|
|
|
12857
12433
|
}
|
|
12858
12434
|
|
|
12859
12435
|
// src/providers/FunkitI18nProvider.tsx
|
|
12860
|
-
import
|
|
12436
|
+
import React23, { useEffect as useEffect13 } from "react";
|
|
12861
12437
|
function FunkitI18nProvider({
|
|
12862
12438
|
children,
|
|
12863
12439
|
locale = "en"
|
|
12864
12440
|
}) {
|
|
12865
|
-
|
|
12441
|
+
useEffect13(() => {
|
|
12866
12442
|
const targetLanguage = localeMapping[locale];
|
|
12867
12443
|
if (i18n_default.language !== targetLanguage) {
|
|
12868
12444
|
i18n_default.changeLanguage(targetLanguage);
|
|
12869
12445
|
}
|
|
12870
12446
|
}, [locale]);
|
|
12871
|
-
return /* @__PURE__ */
|
|
12447
|
+
return /* @__PURE__ */ React23.createElement(React23.Fragment, null, children);
|
|
12872
12448
|
}
|
|
12873
12449
|
|
|
12874
12450
|
// src/providers/FunkitQuoteContext.tsx
|
|
12875
12451
|
import { RelayQuoteError as RelayQuoteError2 } from "@funkit/api-base";
|
|
12876
12452
|
import { isNotNullish as isNotNullish3 } from "@funkit/utils";
|
|
12877
|
-
import
|
|
12878
|
-
createContext as
|
|
12453
|
+
import React30, {
|
|
12454
|
+
createContext as createContext13,
|
|
12879
12455
|
useCallback as useCallback16,
|
|
12880
|
-
useContext as
|
|
12881
|
-
useEffect as
|
|
12456
|
+
useContext as useContext13,
|
|
12457
|
+
useEffect as useEffect15,
|
|
12882
12458
|
useState as useState13
|
|
12883
12459
|
} from "react";
|
|
12884
12460
|
|
|
@@ -12889,7 +12465,7 @@ import {
|
|
|
12889
12465
|
import { bluvoGetWithdrawableBalanceById as bluvoGetWithdrawableBalanceById2 } from "@funkit/api-base";
|
|
12890
12466
|
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO6 } from "@funkit/chains";
|
|
12891
12467
|
import { keepPreviousData as keepPreviousData2, useQuery as useQuery5 } from "@tanstack/react-query";
|
|
12892
|
-
import { useCallback as useCallback15, useMemo as
|
|
12468
|
+
import { useCallback as useCallback15, useMemo as useMemo15 } from "react";
|
|
12893
12469
|
import { parseUnits as parseUnits2 } from "viem";
|
|
12894
12470
|
|
|
12895
12471
|
// src/domains/wallet.ts
|
|
@@ -13029,7 +12605,7 @@ var useBluvoSupportedExchanges = ({
|
|
|
13029
12605
|
filterBy = DEFAULT_FILTER_BY
|
|
13030
12606
|
}) => {
|
|
13031
12607
|
const { authorizedConnections } = useFunkitBrokerageContext();
|
|
13032
|
-
const exchangeOptions =
|
|
12608
|
+
const exchangeOptions = useMemo15(
|
|
13033
12609
|
() => SUPPORTED_EXCHANGES.filter(
|
|
13034
12610
|
({ status: exchangeStatus }) => filterBy.includes(exchangeStatus)
|
|
13035
12611
|
).map(({ exchange, status }) => {
|
|
@@ -13096,22 +12672,22 @@ var useBluvo = () => {
|
|
|
13096
12672
|
// src/consts/quote.tsx
|
|
13097
12673
|
import { RelayQuoteError } from "@funkit/api-base";
|
|
13098
12674
|
import { ClientError } from "@funkit/utils";
|
|
13099
|
-
import
|
|
12675
|
+
import React28 from "react";
|
|
13100
12676
|
|
|
13101
12677
|
// src/components/FunkitTrans.tsx
|
|
13102
|
-
import
|
|
12678
|
+
import React24 from "react";
|
|
13103
12679
|
import { Trans } from "react-i18next";
|
|
13104
12680
|
function FunkitTrans(props) {
|
|
13105
|
-
return /* @__PURE__ */
|
|
12681
|
+
return /* @__PURE__ */ React24.createElement(Trans, { ...props, i18n: i18n_default });
|
|
13106
12682
|
}
|
|
13107
12683
|
|
|
13108
12684
|
// src/components/FunButton/FunLinkButton.tsx
|
|
13109
|
-
import
|
|
12685
|
+
import React26 from "react";
|
|
13110
12686
|
import clsx4 from "clsx";
|
|
13111
12687
|
|
|
13112
12688
|
// src/components/Text/Text.tsx
|
|
13113
|
-
import
|
|
13114
|
-
var Text =
|
|
12689
|
+
import React25 from "react";
|
|
12690
|
+
var Text = React25.forwardRef(
|
|
13115
12691
|
({
|
|
13116
12692
|
as = "div",
|
|
13117
12693
|
children,
|
|
@@ -13129,7 +12705,7 @@ var Text = React27.forwardRef(
|
|
|
13129
12705
|
weight = "regular",
|
|
13130
12706
|
testId
|
|
13131
12707
|
}, ref) => {
|
|
13132
|
-
return /* @__PURE__ */
|
|
12708
|
+
return /* @__PURE__ */ React25.createElement(
|
|
13133
12709
|
Box,
|
|
13134
12710
|
{
|
|
13135
12711
|
as,
|
|
@@ -13167,7 +12743,7 @@ function FunLinkButton({
|
|
|
13167
12743
|
}) {
|
|
13168
12744
|
const isLink = !!href;
|
|
13169
12745
|
const isExternalLink = !!href?.startsWith("http");
|
|
13170
|
-
return /* @__PURE__ */
|
|
12746
|
+
return /* @__PURE__ */ React26.createElement(
|
|
13171
12747
|
Box,
|
|
13172
12748
|
{
|
|
13173
12749
|
as: isLink ? "a" : "button",
|
|
@@ -13182,7 +12758,7 @@ function FunLinkButton({
|
|
|
13182
12758
|
target: isExternalLink ? "_blank" : void 0,
|
|
13183
12759
|
type: isLink ? void 0 : "button"
|
|
13184
12760
|
},
|
|
13185
|
-
/* @__PURE__ */
|
|
12761
|
+
/* @__PURE__ */ React26.createElement(
|
|
13186
12762
|
Text,
|
|
13187
12763
|
{
|
|
13188
12764
|
as: inline ? "span" : "div",
|
|
@@ -13202,7 +12778,7 @@ var ContactSupportLink = ({
|
|
|
13202
12778
|
inline = true,
|
|
13203
12779
|
href = CONTACT_US_LINK,
|
|
13204
12780
|
...rest
|
|
13205
|
-
}) => /* @__PURE__ */
|
|
12781
|
+
}) => /* @__PURE__ */ React26.createElement(
|
|
13206
12782
|
FunLinkButton,
|
|
13207
12783
|
{
|
|
13208
12784
|
text: text ?? children ?? "contact us",
|
|
@@ -13215,7 +12791,7 @@ var ContactSupportLink = ({
|
|
|
13215
12791
|
);
|
|
13216
12792
|
|
|
13217
12793
|
// src/domains/relay.tsx
|
|
13218
|
-
import
|
|
12794
|
+
import React27 from "react";
|
|
13219
12795
|
function isRelayQuoteSameChainAndAsset(details) {
|
|
13220
12796
|
const { currencyIn, currencyOut } = details;
|
|
13221
12797
|
if (!currencyIn || !currencyOut) {
|
|
@@ -13305,12 +12881,12 @@ function getRelayErrorMessages(t) {
|
|
|
13305
12881
|
},
|
|
13306
12882
|
["SANCTIONED_WALLET_ADDRESS" /* SANCTIONED_WALLET_ADDRESS */]: {
|
|
13307
12883
|
messageKey: "withdrawal.sanctionedWalletAddress",
|
|
13308
|
-
message: /* @__PURE__ */
|
|
12884
|
+
message: /* @__PURE__ */ React27.createElement(
|
|
13309
12885
|
FunkitTrans,
|
|
13310
12886
|
{
|
|
13311
12887
|
t,
|
|
13312
12888
|
i18nKey: "withdrawal.sanctionedWalletAddress",
|
|
13313
|
-
components: { ContactSupportLink: /* @__PURE__ */
|
|
12889
|
+
components: { ContactSupportLink: /* @__PURE__ */ React27.createElement(ContactSupportLink, { size: "10" }) }
|
|
13314
12890
|
}
|
|
13315
12891
|
)
|
|
13316
12892
|
},
|
|
@@ -13344,45 +12920,45 @@ function getRelayErrorMessages(t) {
|
|
|
13344
12920
|
},
|
|
13345
12921
|
["DESTINATION_TX_FAILED" /* DESTINATION_TX_FAILED */]: {
|
|
13346
12922
|
messageKey: "withdrawal.destinationTxFailed",
|
|
13347
|
-
message: /* @__PURE__ */
|
|
12923
|
+
message: /* @__PURE__ */ React27.createElement(
|
|
13348
12924
|
FunkitTrans,
|
|
13349
12925
|
{
|
|
13350
12926
|
t,
|
|
13351
12927
|
i18nKey: "withdrawal.destinationTxFailed",
|
|
13352
|
-
components: { ContactSupportLink: /* @__PURE__ */
|
|
12928
|
+
components: { ContactSupportLink: /* @__PURE__ */ React27.createElement(ContactSupportLink, { size: "10" }) }
|
|
13353
12929
|
}
|
|
13354
12930
|
)
|
|
13355
12931
|
},
|
|
13356
12932
|
["ERC20_ROUTER_ADDRESS_NOT_FOUND" /* ERC20_ROUTER_ADDRESS_NOT_FOUND */]: {
|
|
13357
12933
|
messageKey: "withdrawal.erc20RouterAddressNotFound",
|
|
13358
|
-
message: /* @__PURE__ */
|
|
12934
|
+
message: /* @__PURE__ */ React27.createElement(
|
|
13359
12935
|
FunkitTrans,
|
|
13360
12936
|
{
|
|
13361
12937
|
t,
|
|
13362
12938
|
i18nKey: "withdrawal.erc20RouterAddressNotFound",
|
|
13363
|
-
components: { ContactSupportLink: /* @__PURE__ */
|
|
12939
|
+
components: { ContactSupportLink: /* @__PURE__ */ React27.createElement(ContactSupportLink, { size: "10" }) }
|
|
13364
12940
|
}
|
|
13365
12941
|
)
|
|
13366
12942
|
},
|
|
13367
12943
|
["UNKNOWN_ERROR" /* UNKNOWN_ERROR */]: {
|
|
13368
12944
|
messageKey: "withdrawal.unknownError",
|
|
13369
|
-
message: /* @__PURE__ */
|
|
12945
|
+
message: /* @__PURE__ */ React27.createElement(
|
|
13370
12946
|
FunkitTrans,
|
|
13371
12947
|
{
|
|
13372
12948
|
t,
|
|
13373
12949
|
i18nKey: "withdrawal.unknownError",
|
|
13374
|
-
components: { ContactSupportLink: /* @__PURE__ */
|
|
12950
|
+
components: { ContactSupportLink: /* @__PURE__ */ React27.createElement(ContactSupportLink, { size: "10" }) }
|
|
13375
12951
|
}
|
|
13376
12952
|
)
|
|
13377
12953
|
},
|
|
13378
12954
|
["SWAP_QUOTE_FAILED" /* SWAP_QUOTE_FAILED */]: {
|
|
13379
12955
|
messageKey: "withdrawal.swapQuoteFailed",
|
|
13380
|
-
message: /* @__PURE__ */
|
|
12956
|
+
message: /* @__PURE__ */ React27.createElement(
|
|
13381
12957
|
FunkitTrans,
|
|
13382
12958
|
{
|
|
13383
12959
|
t,
|
|
13384
12960
|
i18nKey: "withdrawal.swapQuoteFailed",
|
|
13385
|
-
components: { ContactSupportLink: /* @__PURE__ */
|
|
12961
|
+
components: { ContactSupportLink: /* @__PURE__ */ React27.createElement(ContactSupportLink, { size: "10" }) }
|
|
13386
12962
|
}
|
|
13387
12963
|
)
|
|
13388
12964
|
},
|
|
@@ -13410,13 +12986,13 @@ var getPendingQuoteMessageGenerator = (t) => ({
|
|
|
13410
12986
|
var getDefaultQuoteError = (t) => ({
|
|
13411
12987
|
code: "QUOTE_FAILED",
|
|
13412
12988
|
messageKey: "quote.defaultError",
|
|
13413
|
-
message: /* @__PURE__ */
|
|
12989
|
+
message: /* @__PURE__ */ React28.createElement(
|
|
13414
12990
|
FunkitTrans,
|
|
13415
12991
|
{
|
|
13416
12992
|
t,
|
|
13417
12993
|
i18nKey: "quote.defaultError",
|
|
13418
12994
|
components: {
|
|
13419
|
-
ContactSupportLink: /* @__PURE__ */
|
|
12995
|
+
ContactSupportLink: /* @__PURE__ */ React28.createElement(ContactSupportLink, { size: "10" })
|
|
13420
12996
|
}
|
|
13421
12997
|
}
|
|
13422
12998
|
),
|
|
@@ -14016,11 +13592,11 @@ var trackEventFromFinalQuote = (finalEstimation, checkoutItem, eventName, quoteM
|
|
|
14016
13592
|
};
|
|
14017
13593
|
|
|
14018
13594
|
// src/providers/QuoteModeContext.tsx
|
|
14019
|
-
import
|
|
14020
|
-
createContext as
|
|
14021
|
-
useContext as
|
|
14022
|
-
useEffect as
|
|
14023
|
-
useMemo as
|
|
13595
|
+
import React29, {
|
|
13596
|
+
createContext as createContext12,
|
|
13597
|
+
useContext as useContext12,
|
|
13598
|
+
useEffect as useEffect14,
|
|
13599
|
+
useMemo as useMemo16,
|
|
14024
13600
|
useRef as useRef6
|
|
14025
13601
|
} from "react";
|
|
14026
13602
|
|
|
@@ -14028,7 +13604,7 @@ import React31, {
|
|
|
14028
13604
|
import * as dnum4 from "dnum";
|
|
14029
13605
|
|
|
14030
13606
|
// src/utils/tokenMath.ts
|
|
14031
|
-
import { formatCurrencyAndStringify
|
|
13607
|
+
import { formatCurrencyAndStringify } from "@funkit/utils";
|
|
14032
13608
|
import * as dnum3 from "dnum";
|
|
14033
13609
|
import { formatUnits as formatUnits4 } from "viem";
|
|
14034
13610
|
function mulByPriceRoundedDown(amount, price, resultDecimals) {
|
|
@@ -14051,7 +13627,7 @@ function floorToDecimals(value, decimals) {
|
|
|
14051
13627
|
return dnum3.toNumber(d, decimals);
|
|
14052
13628
|
}
|
|
14053
13629
|
function formatUsdFlooredToCent(balanceUsd) {
|
|
14054
|
-
return
|
|
13630
|
+
return formatCurrencyAndStringify(floorToDecimals(balanceUsd, 2));
|
|
14055
13631
|
}
|
|
14056
13632
|
|
|
14057
13633
|
// src/domains/quoteMode/exactOut.ts
|
|
@@ -14317,7 +13893,7 @@ function getGasEstimateWei(gasPriceWei, gasUnits) {
|
|
|
14317
13893
|
}
|
|
14318
13894
|
|
|
14319
13895
|
// src/providers/QuoteModeContext.tsx
|
|
14320
|
-
var QuoteModeContext =
|
|
13896
|
+
var QuoteModeContext = createContext12(
|
|
14321
13897
|
null
|
|
14322
13898
|
);
|
|
14323
13899
|
function QuoteModeProvider({ children }) {
|
|
@@ -14330,7 +13906,7 @@ function QuoteModeProvider({ children }) {
|
|
|
14330
13906
|
const isStablecoin = useIsStablecoin();
|
|
14331
13907
|
const config = checkoutItem?.initSettings.config;
|
|
14332
13908
|
const hasPostAction = config ? isCheckoutPostActionRequired(config) : void 0;
|
|
14333
|
-
const resolveQuoteBuilderParams =
|
|
13909
|
+
const resolveQuoteBuilderParams = useMemo16(
|
|
14334
13910
|
() => ({
|
|
14335
13911
|
hasPostAction,
|
|
14336
13912
|
isExactInEnabled,
|
|
@@ -14346,12 +13922,12 @@ function QuoteModeProvider({ children }) {
|
|
|
14346
13922
|
walletFlowEnableExactInputWithActions
|
|
14347
13923
|
]
|
|
14348
13924
|
);
|
|
14349
|
-
const builder =
|
|
13925
|
+
const builder = useMemo16(
|
|
14350
13926
|
() => resolveQuoteBuilder(resolveQuoteBuilderParams),
|
|
14351
13927
|
[resolveQuoteBuilderParams]
|
|
14352
13928
|
);
|
|
14353
13929
|
const lastLoggedKey = useRef6(null);
|
|
14354
|
-
|
|
13930
|
+
useEffect14(() => {
|
|
14355
13931
|
const checkoutId = checkoutItem?.id;
|
|
14356
13932
|
if (!checkoutId) {
|
|
14357
13933
|
return;
|
|
@@ -14389,10 +13965,10 @@ function QuoteModeProvider({ children }) {
|
|
|
14389
13965
|
config,
|
|
14390
13966
|
logEvent
|
|
14391
13967
|
]);
|
|
14392
|
-
return /* @__PURE__ */
|
|
13968
|
+
return /* @__PURE__ */ React29.createElement(QuoteModeContext.Provider, { value: builder }, children);
|
|
14393
13969
|
}
|
|
14394
13970
|
function useQuoteBuilder() {
|
|
14395
|
-
const ctx =
|
|
13971
|
+
const ctx = useContext12(QuoteModeContext);
|
|
14396
13972
|
if (ctx === null) {
|
|
14397
13973
|
throw new Error("useQuoteBuilder must be used within QuoteModeProvider");
|
|
14398
13974
|
}
|
|
@@ -14401,7 +13977,7 @@ function useQuoteBuilder() {
|
|
|
14401
13977
|
|
|
14402
13978
|
// src/providers/FunkitQuoteContext.tsx
|
|
14403
13979
|
var APPROVAL_METHOD_DEFAULT = "sign";
|
|
14404
|
-
var FunkitQuoteContext =
|
|
13980
|
+
var FunkitQuoteContext = createContext13({
|
|
14405
13981
|
latestQuote: null,
|
|
14406
13982
|
isQuoting: false,
|
|
14407
13983
|
quoteStepMessage: "",
|
|
@@ -14548,7 +14124,7 @@ function FunkitQuoteProvider({ children }) {
|
|
|
14548
14124
|
targetAssetAllowanceCoversAmount
|
|
14549
14125
|
});
|
|
14550
14126
|
const usePermit = showApprovalMethodToggle ? preferredApprovalMethod === "sign" : void 0;
|
|
14551
|
-
|
|
14127
|
+
useEffect15(() => {
|
|
14552
14128
|
if (isNotNullish3(logoutSymbol)) {
|
|
14553
14129
|
setLatestQuote(null);
|
|
14554
14130
|
setQuoteProgress({
|
|
@@ -14719,18 +14295,18 @@ function FunkitQuoteProvider({ children }) {
|
|
|
14719
14295
|
targetAssetPoolAllowance,
|
|
14720
14296
|
setTargetAssetPoolAllowance
|
|
14721
14297
|
};
|
|
14722
|
-
return /* @__PURE__ */
|
|
14298
|
+
return /* @__PURE__ */ React30.createElement(FunkitQuoteContext.Provider, { value: contextValue }, children);
|
|
14723
14299
|
}
|
|
14724
14300
|
function useQuoteContext() {
|
|
14725
|
-
return
|
|
14301
|
+
return useContext13(FunkitQuoteContext);
|
|
14726
14302
|
}
|
|
14727
14303
|
|
|
14728
14304
|
// src/providers/FunkitShadowHostProvider.tsx
|
|
14729
|
-
import
|
|
14305
|
+
import React33, { createContext as createContext15, useContext as useContext15 } from "react";
|
|
14730
14306
|
import { createPortal } from "react-dom";
|
|
14731
14307
|
|
|
14732
14308
|
// src/shadow/useMountShadowHost.ts
|
|
14733
|
-
import { useEffect as
|
|
14309
|
+
import { useEffect as useEffect16, useState as useState14 } from "react";
|
|
14734
14310
|
|
|
14735
14311
|
// src/shadow/adoptStyles.ts
|
|
14736
14312
|
var STYLE_ATTR_MARKER = "data-funkit-styles";
|
|
@@ -14765,7 +14341,7 @@ function mountShadowHost(shadowCss, themeId) {
|
|
|
14765
14341
|
}
|
|
14766
14342
|
function useMountShadowHost(shadowCss, themeId) {
|
|
14767
14343
|
const [container, setContainer] = useState14(null);
|
|
14768
|
-
|
|
14344
|
+
useEffect16(() => {
|
|
14769
14345
|
if (shadowCss === null) {
|
|
14770
14346
|
return;
|
|
14771
14347
|
}
|
|
@@ -14800,7 +14376,7 @@ function useMountShadowHost(shadowCss, themeId) {
|
|
|
14800
14376
|
}
|
|
14801
14377
|
|
|
14802
14378
|
// src/shadow/useShadowCss.ts
|
|
14803
|
-
import { useEffect as
|
|
14379
|
+
import { useEffect as useEffect17, useState as useState15 } from "react";
|
|
14804
14380
|
|
|
14805
14381
|
// src/shadow/loadShadowCss.ts
|
|
14806
14382
|
var RETRY_DELAYS_MS = [0, 1e3];
|
|
@@ -14862,7 +14438,7 @@ async function loadShadowCss() {
|
|
|
14862
14438
|
// src/shadow/useShadowCss.ts
|
|
14863
14439
|
function useShadowCss(enabled) {
|
|
14864
14440
|
const [css, setCss] = useState15(null);
|
|
14865
|
-
|
|
14441
|
+
useEffect17(() => {
|
|
14866
14442
|
if (!enabled || css !== null) {
|
|
14867
14443
|
return;
|
|
14868
14444
|
}
|
|
@@ -14880,7 +14456,7 @@ function useShadowCss(enabled) {
|
|
|
14880
14456
|
}
|
|
14881
14457
|
|
|
14882
14458
|
// src/providers/FunkitThemeStyle.tsx
|
|
14883
|
-
import
|
|
14459
|
+
import React32, { useMemo as useMemo17, useRef as useRef7 } from "react";
|
|
14884
14460
|
|
|
14885
14461
|
// src/utils/sanitizeHtml.ts
|
|
14886
14462
|
function sanitizeCssStyleContent(css) {
|
|
@@ -14919,22 +14495,22 @@ function cssStringFromTheme(theme, options = {}) {
|
|
|
14919
14495
|
}
|
|
14920
14496
|
|
|
14921
14497
|
// src/hooks/useIsomorphicEffect.ts
|
|
14922
|
-
import { useEffect as
|
|
14923
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect :
|
|
14498
|
+
import { useEffect as useEffect18, useLayoutEffect } from "react";
|
|
14499
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect18;
|
|
14924
14500
|
|
|
14925
14501
|
// src/providers/FunkitThemeProvider.tsx
|
|
14926
|
-
import
|
|
14502
|
+
import React31, { createContext as createContext14, useContext as useContext14, useEffect as useEffect19, useState as useState16 } from "react";
|
|
14927
14503
|
var FUNKIT_THEME_CACHE_KEY = "funkit-connect-is-light";
|
|
14928
14504
|
var DEFAULT_THEME_SET = {
|
|
14929
14505
|
lightTheme: lightTheme(),
|
|
14930
14506
|
darkTheme: darkTheme()
|
|
14931
14507
|
};
|
|
14932
14508
|
var DEFAULT_THEME = DEFAULT_THEME_SET.darkTheme;
|
|
14933
|
-
var ThemeIdContext =
|
|
14509
|
+
var ThemeIdContext = createContext14(void 0);
|
|
14934
14510
|
function isThemeSet(themeOrThemeSet) {
|
|
14935
14511
|
return themeOrThemeSet.lightTheme !== void 0 && themeOrThemeSet.darkTheme !== void 0;
|
|
14936
14512
|
}
|
|
14937
|
-
var ThemeContext =
|
|
14513
|
+
var ThemeContext = createContext14({
|
|
14938
14514
|
activeTheme: DEFAULT_THEME,
|
|
14939
14515
|
lightTheme: void 0,
|
|
14940
14516
|
darkTheme: void 0,
|
|
@@ -14954,7 +14530,7 @@ var useActiveTheme = () => {
|
|
|
14954
14530
|
darkTheme: darkTheme2,
|
|
14955
14531
|
toggleTheme,
|
|
14956
14532
|
themeColorScheme
|
|
14957
|
-
} =
|
|
14533
|
+
} = useContext14(ThemeContext);
|
|
14958
14534
|
return {
|
|
14959
14535
|
activeTheme,
|
|
14960
14536
|
/** Overrides the currently active `theme` with disregard to the `theme` provided to the `FunkitProvider`, ie. `toggleTheme` will switch to the `theme` provided to the `FunkitProvider`, not the theme set by `setTheme` */
|
|
@@ -14998,7 +14574,7 @@ var FunkitThemeProvider = ({
|
|
|
14998
14574
|
const [activeTheme, setActiveTheme] = useState16(
|
|
14999
14575
|
getConfigTheme(themeOrThemeSet, systemColorScheme)
|
|
15000
14576
|
);
|
|
15001
|
-
|
|
14577
|
+
useEffect19(() => {
|
|
15002
14578
|
const handler = (e) => {
|
|
15003
14579
|
const colorScheme = e.matches ? "light" : "dark";
|
|
15004
14580
|
setSystemColorScheme(colorScheme);
|
|
@@ -15015,13 +14591,13 @@ var FunkitThemeProvider = ({
|
|
|
15015
14591
|
};
|
|
15016
14592
|
}
|
|
15017
14593
|
}, []);
|
|
15018
|
-
|
|
14594
|
+
useEffect19(() => {
|
|
15019
14595
|
setActiveTheme(getConfigTheme(themeOrThemeSet, systemColorScheme));
|
|
15020
14596
|
}, [systemColorScheme, themeOrThemeSet]);
|
|
15021
14597
|
const isFullThemeSet = isThemeSet(themeOrThemeSet);
|
|
15022
14598
|
const lightTheme2 = isFullThemeSet ? themeOrThemeSet.lightTheme : themeOrThemeSet;
|
|
15023
14599
|
const darkTheme2 = isFullThemeSet ? themeOrThemeSet.darkTheme : themeOrThemeSet;
|
|
15024
|
-
return /* @__PURE__ */
|
|
14600
|
+
return /* @__PURE__ */ React31.createElement(
|
|
15025
14601
|
ThemeContext.Provider,
|
|
15026
14602
|
{
|
|
15027
14603
|
value: {
|
|
@@ -15076,7 +14652,7 @@ function FunkitThemeStyle({
|
|
|
15076
14652
|
useStyleRefForTheme
|
|
15077
14653
|
}) {
|
|
15078
14654
|
const { activeTheme } = useActiveTheme();
|
|
15079
|
-
const themeStyles =
|
|
14655
|
+
const themeStyles = useMemo17(() => {
|
|
15080
14656
|
if (!activeTheme) {
|
|
15081
14657
|
return "";
|
|
15082
14658
|
}
|
|
@@ -15093,22 +14669,22 @@ function FunkitThemeStyle({
|
|
|
15093
14669
|
return null;
|
|
15094
14670
|
}
|
|
15095
14671
|
if (useStyleRefForTheme) {
|
|
15096
|
-
return /* @__PURE__ */
|
|
14672
|
+
return /* @__PURE__ */ React32.createElement("style", { ref: styleRef });
|
|
15097
14673
|
}
|
|
15098
|
-
return /* @__PURE__ */
|
|
14674
|
+
return /* @__PURE__ */ React32.createElement("style", { dangerouslySetInnerHTML: { __html: themeStyles } });
|
|
15099
14675
|
}
|
|
15100
14676
|
|
|
15101
14677
|
// src/providers/FunkitShadowHostProvider.tsx
|
|
15102
|
-
var ShadowContainerContext =
|
|
14678
|
+
var ShadowContainerContext = createContext15(null);
|
|
15103
14679
|
function useShadowContainer() {
|
|
15104
|
-
const container =
|
|
14680
|
+
const container = useContext15(ShadowContainerContext);
|
|
15105
14681
|
if (container) {
|
|
15106
14682
|
return container;
|
|
15107
14683
|
}
|
|
15108
14684
|
return typeof document === "undefined" ? null : document.body;
|
|
15109
14685
|
}
|
|
15110
14686
|
function useRootNode() {
|
|
15111
|
-
const container =
|
|
14687
|
+
const container = useContext15(ShadowContainerContext);
|
|
15112
14688
|
return container ? container.getRootNode() : document;
|
|
15113
14689
|
}
|
|
15114
14690
|
function FunkitShadowHostProvider({
|
|
@@ -15120,8 +14696,8 @@ function FunkitShadowHostProvider({
|
|
|
15120
14696
|
const isShadowDomEnabled = useFeatureGate("enable-shadow-dom");
|
|
15121
14697
|
const shadowCss = useShadowCss(isShadowDomEnabled);
|
|
15122
14698
|
const container = useMountShadowHost(shadowCss, themeId);
|
|
15123
|
-
return /* @__PURE__ */
|
|
15124
|
-
/* @__PURE__ */
|
|
14699
|
+
return /* @__PURE__ */ React33.createElement(ShadowContainerContext.Provider, { value: container }, children, container && createPortal(
|
|
14700
|
+
/* @__PURE__ */ React33.createElement(
|
|
15125
14701
|
FunkitThemeStyle,
|
|
15126
14702
|
{
|
|
15127
14703
|
selector,
|
|
@@ -15132,15 +14708,110 @@ function FunkitShadowHostProvider({
|
|
|
15132
14708
|
));
|
|
15133
14709
|
}
|
|
15134
14710
|
|
|
14711
|
+
// src/providers/FunkitStatsigProvider.tsx
|
|
14712
|
+
import { datadogLogs as datadogLogs2 } from "@datadog/browser-logs";
|
|
14713
|
+
import {
|
|
14714
|
+
LogEventCompressionMode,
|
|
14715
|
+
LogLevel,
|
|
14716
|
+
StatsigProvider,
|
|
14717
|
+
useClientAsyncInit
|
|
14718
|
+
} from "@statsig/react-bindings";
|
|
14719
|
+
import React34, { useEffect as useEffect20 } from "react";
|
|
14720
|
+
import { STATSIG_NETWORK_TIMEOUT_MS } from "@funkit/connect-core";
|
|
14721
|
+
var STATSIG_API = "https://data-api.fun.xyz/v1";
|
|
14722
|
+
var STATSIG_CLIENT_KEY = "client-UmFd8WIJljA7cLmZuDqs3X25M8sKd5WIQP4BSC2bRbM";
|
|
14723
|
+
function getStatsigOptions(isDevelopment) {
|
|
14724
|
+
return {
|
|
14725
|
+
networkConfig: {
|
|
14726
|
+
api: STATSIG_API,
|
|
14727
|
+
// default timeout is 10s which is too large imo
|
|
14728
|
+
// 5s should be plenty granted on average statsig responds in <200ms
|
|
14729
|
+
networkTimeoutMs: STATSIG_NETWORK_TIMEOUT_MS
|
|
14730
|
+
// uncomment to test offline mode
|
|
14731
|
+
// preventAllNetworkTraffic: true,
|
|
14732
|
+
},
|
|
14733
|
+
// By default Statsig disables compression for events when proxy is used.
|
|
14734
|
+
// As our proxy does support compression, we force it to be enabled to save bandwidth.
|
|
14735
|
+
logEventCompressionMode: LogEventCompressionMode.Forced,
|
|
14736
|
+
// Silence warnings from hooks running before async client init completes (harmless, as we have fallbacks)
|
|
14737
|
+
logLevel: isDevelopment ? void 0 : LogLevel.Error,
|
|
14738
|
+
environment: {
|
|
14739
|
+
tier: isDevelopment ? "development" : "production"
|
|
14740
|
+
}
|
|
14741
|
+
};
|
|
14742
|
+
}
|
|
14743
|
+
function FunkitStatsigProvider({
|
|
14744
|
+
children,
|
|
14745
|
+
isDevelopment = false
|
|
14746
|
+
}) {
|
|
14747
|
+
const options = getStatsigOptions(isDevelopment);
|
|
14748
|
+
const { client: primaryClient } = useClientAsyncInit(
|
|
14749
|
+
STATSIG_CLIENT_KEY,
|
|
14750
|
+
{},
|
|
14751
|
+
options
|
|
14752
|
+
);
|
|
14753
|
+
useEffect20(() => {
|
|
14754
|
+
const onValuesUpdated = (event) => {
|
|
14755
|
+
datadogLogs2.setGlobalContextProperty(
|
|
14756
|
+
"statsigSource",
|
|
14757
|
+
event.values?.source ?? "NoValues"
|
|
14758
|
+
);
|
|
14759
|
+
};
|
|
14760
|
+
primaryClient.on("values_updated", onValuesUpdated);
|
|
14761
|
+
return () => primaryClient.off("values_updated", onValuesUpdated);
|
|
14762
|
+
}, [primaryClient]);
|
|
14763
|
+
return /* @__PURE__ */ React34.createElement(StatsigProvider, { client: primaryClient }, children);
|
|
14764
|
+
}
|
|
14765
|
+
|
|
14766
|
+
// src/providers/FunkitStatsigWhnProvider.tsx
|
|
14767
|
+
import {
|
|
14768
|
+
FunWhnStatsigContext,
|
|
14769
|
+
useFunWhnStatsigClientValue
|
|
14770
|
+
} from "@funkit/connect-core";
|
|
14771
|
+
import { useClientAsyncInit as useClientAsyncInit2 } from "@statsig/react-bindings";
|
|
14772
|
+
import React35, { useMemo as useMemo18 } from "react";
|
|
14773
|
+
var STATSIG_CLIENT_KEY_FUN_WHN = "client-UrueDVSY9et85npGccWMFidPs00V5jzTYyzsDKlLAjr";
|
|
14774
|
+
function FunkitStatsigWhnProvider({
|
|
14775
|
+
children,
|
|
14776
|
+
isDevelopment = false
|
|
14777
|
+
}) {
|
|
14778
|
+
const { apiKey } = useFunkitConfig();
|
|
14779
|
+
const { l2Address, userInfo } = useGeneralWallet();
|
|
14780
|
+
const userId = userInfo.id;
|
|
14781
|
+
const userName = userInfo.name;
|
|
14782
|
+
const userType = userInfo.type;
|
|
14783
|
+
const statsigUser = useMemo18(
|
|
14784
|
+
() => buildStatsigUser({
|
|
14785
|
+
apiKey,
|
|
14786
|
+
l2Address,
|
|
14787
|
+
userId,
|
|
14788
|
+
userName,
|
|
14789
|
+
userType
|
|
14790
|
+
}),
|
|
14791
|
+
[apiKey, l2Address, userId, userName, userType]
|
|
14792
|
+
);
|
|
14793
|
+
const { client } = useClientAsyncInit2(
|
|
14794
|
+
STATSIG_CLIENT_KEY_FUN_WHN,
|
|
14795
|
+
statsigUser,
|
|
14796
|
+
getStatsigOptions(isDevelopment)
|
|
14797
|
+
);
|
|
14798
|
+
const value = useFunWhnStatsigClientValue({
|
|
14799
|
+
client,
|
|
14800
|
+
logger,
|
|
14801
|
+
statsigUser
|
|
14802
|
+
});
|
|
14803
|
+
return /* @__PURE__ */ React35.createElement(FunWhnStatsigContext.Provider, { value }, children);
|
|
14804
|
+
}
|
|
14805
|
+
|
|
15135
14806
|
// src/providers/ModalSizeContext.tsx
|
|
15136
|
-
import React36, { createContext as
|
|
14807
|
+
import React36, { createContext as createContext16 } from "react";
|
|
15137
14808
|
var ModalSizeOptions = {
|
|
15138
14809
|
COMPACT: "compact",
|
|
15139
14810
|
MEDIUM: "medium",
|
|
15140
14811
|
WIDE: "wide",
|
|
15141
14812
|
EXTRA_WIDE: "extraWide"
|
|
15142
14813
|
};
|
|
15143
|
-
var ModalSizeContext =
|
|
14814
|
+
var ModalSizeContext = createContext16(ModalSizeOptions.WIDE);
|
|
15144
14815
|
function ModalSizeProvider({
|
|
15145
14816
|
children,
|
|
15146
14817
|
modalSize
|
|
@@ -15149,19 +14820,19 @@ function ModalSizeProvider({
|
|
|
15149
14820
|
}
|
|
15150
14821
|
|
|
15151
14822
|
// src/providers/UserPresenceContext.tsx
|
|
15152
|
-
import React37, { useEffect as
|
|
14823
|
+
import React37, { useEffect as useEffect21 } from "react";
|
|
15153
14824
|
import {
|
|
15154
|
-
createContext as
|
|
15155
|
-
useContext as
|
|
14825
|
+
createContext as createContext17,
|
|
14826
|
+
useContext as useContext16,
|
|
15156
14827
|
useState as useState17
|
|
15157
14828
|
} from "react";
|
|
15158
14829
|
var DELAY = 5 * 60 * 1e3;
|
|
15159
|
-
var UserPresenceContext =
|
|
14830
|
+
var UserPresenceContext = createContext17({
|
|
15160
14831
|
isAway: false
|
|
15161
14832
|
});
|
|
15162
14833
|
var UserPresenceProvider = ({ children }) => {
|
|
15163
14834
|
const [isAway, setIsAway] = useState17(false);
|
|
15164
|
-
|
|
14835
|
+
useEffect21(() => {
|
|
15165
14836
|
let timeoutId;
|
|
15166
14837
|
const handleVisibilityChange = () => {
|
|
15167
14838
|
if (document.visibilityState === "visible") {
|
|
@@ -15179,10 +14850,10 @@ var UserPresenceProvider = ({ children }) => {
|
|
|
15179
14850
|
}, []);
|
|
15180
14851
|
return /* @__PURE__ */ React37.createElement(UserPresenceContext.Provider, { value: { isAway } }, children);
|
|
15181
14852
|
};
|
|
15182
|
-
var useUserPresence = () =>
|
|
14853
|
+
var useUserPresence = () => useContext16(UserPresenceContext);
|
|
15183
14854
|
|
|
15184
14855
|
// src/wallets/useAdoptionConnectionGuard.ts
|
|
15185
|
-
import { useEffect as
|
|
14856
|
+
import { useEffect as useEffect22 } from "react";
|
|
15186
14857
|
var pendingUserInitiatedConnectorUids = /* @__PURE__ */ new Set();
|
|
15187
14858
|
async function withUserInitiatedConnection(connectorUid, connect) {
|
|
15188
14859
|
pendingUserInitiatedConnectorUids.add(connectorUid);
|
|
@@ -15194,7 +14865,7 @@ async function withUserInitiatedConnection(connectorUid, connect) {
|
|
|
15194
14865
|
}
|
|
15195
14866
|
function useAdoptionConnectionGuard(adoptedConnectorId) {
|
|
15196
14867
|
const config = useConfig();
|
|
15197
|
-
|
|
14868
|
+
useEffect22(() => {
|
|
15198
14869
|
const approvedConnectorUids = /* @__PURE__ */ new Set();
|
|
15199
14870
|
const evictUnapprovedConnections = (connections) => {
|
|
15200
14871
|
for (const uid of approvedConnectorUids) {
|
|
@@ -15227,7 +14898,7 @@ function useAdoptionConnectionGuard(adoptedConnectorId) {
|
|
|
15227
14898
|
}
|
|
15228
14899
|
|
|
15229
14900
|
// src/wallets/useWalletAdoption.ts
|
|
15230
|
-
import { useEffect as
|
|
14901
|
+
import { useEffect as useEffect23, useRef as useRef8 } from "react";
|
|
15231
14902
|
|
|
15232
14903
|
// src/utils/signature.ts
|
|
15233
14904
|
import { isSwitchChainError, isUserRejectedError } from "@funkit/connect-core";
|
|
@@ -15251,7 +14922,7 @@ function useWalletAdoption({
|
|
|
15251
14922
|
const initialChainId = useInitialChainId();
|
|
15252
14923
|
const funkitConnectChains = useFunkitConnectChains();
|
|
15253
14924
|
const startedRef = useRef8(false);
|
|
15254
|
-
|
|
14925
|
+
useEffect23(() => {
|
|
15255
14926
|
if (startedRef.current) {
|
|
15256
14927
|
return;
|
|
15257
14928
|
}
|
|
@@ -15333,7 +15004,7 @@ function useWalletAdoption({
|
|
|
15333
15004
|
|
|
15334
15005
|
// src/providers/usePreloadImages.ts
|
|
15335
15006
|
import { isNotNullish as isNotNullish4 } from "@funkit/utils";
|
|
15336
|
-
import { useCallback as useCallback17, useEffect as
|
|
15007
|
+
import { useCallback as useCallback17, useEffect as useEffect24 } from "react";
|
|
15337
15008
|
|
|
15338
15009
|
// src/wallets/useWalletConnectors.ts
|
|
15339
15010
|
import { indexBy } from "@funkit/utils";
|
|
@@ -15594,7 +15265,7 @@ function usePreloadImages() {
|
|
|
15594
15265
|
...funkitConnectChains.map((chain) => chain.iconUrl).filter(isNotNullish4)
|
|
15595
15266
|
);
|
|
15596
15267
|
}, [walletConnectors, funkitConnectChains]);
|
|
15597
|
-
|
|
15268
|
+
useEffect24(() => {
|
|
15598
15269
|
preloadImages();
|
|
15599
15270
|
}, [preloadImages]);
|
|
15600
15271
|
}
|
|
@@ -15626,12 +15297,12 @@ var createThemeRootSelector = (id) => {
|
|
|
15626
15297
|
}
|
|
15627
15298
|
return id ? `[${attr}="${id}"]` : `[${attr}]`;
|
|
15628
15299
|
};
|
|
15629
|
-
var ThemeRootContext =
|
|
15300
|
+
var ThemeRootContext = createContext18({
|
|
15630
15301
|
id: void 0,
|
|
15631
15302
|
element: null
|
|
15632
15303
|
});
|
|
15633
|
-
var useThemeRootProps = () => createThemeRootProps(
|
|
15634
|
-
var useThemeRootElement = () =>
|
|
15304
|
+
var useThemeRootProps = () => createThemeRootProps(useContext17(ThemeRootContext).id);
|
|
15305
|
+
var useThemeRootElement = () => useContext17(ThemeRootContext).element;
|
|
15635
15306
|
function createConnectorlessWagmiConfig() {
|
|
15636
15307
|
return createConfig({
|
|
15637
15308
|
chains: getDefaultChains(),
|
|
@@ -15646,8 +15317,8 @@ function FunkitProvider(props) {
|
|
|
15646
15317
|
const adoptWallet = adoptWalletRef.current;
|
|
15647
15318
|
const adoptedWalletChanged = props.adoptWallet?.connectorId !== adoptWallet?.connectorId;
|
|
15648
15319
|
validateFunkitProviderProps({ ...props, adoptWallet });
|
|
15649
|
-
const existingWagmiConfig =
|
|
15650
|
-
const existingQueryClient =
|
|
15320
|
+
const existingWagmiConfig = useContext17(WagmiContext);
|
|
15321
|
+
const existingQueryClient = useContext17(QueryClientContext);
|
|
15651
15322
|
const shouldSelfMount = !!props.solanaWalletOnly && !props.wagmiConfig && !existingWagmiConfig;
|
|
15652
15323
|
const selfMounted = useMemo19(
|
|
15653
15324
|
() => shouldSelfMount ? {
|
|
@@ -15678,7 +15349,7 @@ function FunkitProvider(props) {
|
|
|
15678
15349
|
]);
|
|
15679
15350
|
const finalQueryClient = props.queryClient;
|
|
15680
15351
|
const sdkVersion = useMemo19(() => getCurrentSdkVersion(), []);
|
|
15681
|
-
|
|
15352
|
+
useEffect25(() => {
|
|
15682
15353
|
logger.configure(
|
|
15683
15354
|
props.funkitConfig.apiKey,
|
|
15684
15355
|
!!props.debug,
|
|
@@ -15739,7 +15410,7 @@ function getConfiguredHttpRpcUrl(config, chainId2) {
|
|
|
15739
15410
|
function useInitializeRelayClient(source) {
|
|
15740
15411
|
const config = useConfig();
|
|
15741
15412
|
const initializedRef = useRef9(false);
|
|
15742
|
-
|
|
15413
|
+
useEffect25(() => {
|
|
15743
15414
|
if (initializedRef.current) {
|
|
15744
15415
|
return;
|
|
15745
15416
|
}
|
|
@@ -15887,7 +15558,7 @@ var tooltipContent = "z1l38i7 _1rsrm2fq0 _1rsrm2fs2 _1rsrm2fu2 _1rsrm2fnw _1rsrm
|
|
|
15887
15558
|
var tooltipTrigger = "z1l38i5";
|
|
15888
15559
|
|
|
15889
15560
|
// src/components/FunTooltip/FunTooltip.tsx
|
|
15890
|
-
var TooltipAnchorRefContext =
|
|
15561
|
+
var TooltipAnchorRefContext = createContext19(null);
|
|
15891
15562
|
var FunTooltip = ({
|
|
15892
15563
|
content: content2,
|
|
15893
15564
|
children = /* @__PURE__ */ React40.createElement(Box, { color: { base: "tertiaryText", hover: "primaryText" } }, /* @__PURE__ */ React40.createElement(InfoIcon, null)),
|
|
@@ -15898,7 +15569,7 @@ var FunTooltip = ({
|
|
|
15898
15569
|
startDelay = 0,
|
|
15899
15570
|
width
|
|
15900
15571
|
}) => {
|
|
15901
|
-
const anchorRef =
|
|
15572
|
+
const anchorRef = useContext18(TooltipAnchorRefContext);
|
|
15902
15573
|
const themeRootElement = useThemeRootElement();
|
|
15903
15574
|
const [open, setOpen] = useState19(false);
|
|
15904
15575
|
const hasHover = useHasHover();
|
|
@@ -16144,7 +15815,7 @@ function getCheckoutStateBooleans(checkoutState, refundState) {
|
|
|
16144
15815
|
}
|
|
16145
15816
|
|
|
16146
15817
|
// src/components/FunCheckoutHistory/FunCheckoutStatus.tsx
|
|
16147
|
-
import React52, { useEffect as
|
|
15818
|
+
import React52, { useEffect as useEffect28, useMemo as useMemo21, useState as useState23 } from "react";
|
|
16148
15819
|
|
|
16149
15820
|
// src/components/TransactionStatus/TransactionStatus.tsx
|
|
16150
15821
|
import {
|
|
@@ -16152,7 +15823,7 @@ import {
|
|
|
16152
15823
|
} from "motion/react";
|
|
16153
15824
|
import React47, {
|
|
16154
15825
|
useCallback as useCallback18,
|
|
16155
|
-
useEffect as
|
|
15826
|
+
useEffect as useEffect27,
|
|
16156
15827
|
useMemo as useMemo20,
|
|
16157
15828
|
useRef as useRef10,
|
|
16158
15829
|
useState as useState22
|
|
@@ -16527,7 +16198,7 @@ var AnimatedSpinner = ({
|
|
|
16527
16198
|
|
|
16528
16199
|
// src/components/TransactionStatus/AnimatedText.tsx
|
|
16529
16200
|
import { AnimatePresence as AnimatePresence2, motion as motion5 } from "motion/react";
|
|
16530
|
-
import React46, { useEffect as
|
|
16201
|
+
import React46, { useEffect as useEffect26, useState as useState21 } from "react";
|
|
16531
16202
|
var AnimatedText = ({
|
|
16532
16203
|
animationDelay = 0,
|
|
16533
16204
|
animationDirection = -1,
|
|
@@ -16540,7 +16211,7 @@ var AnimatedText = ({
|
|
|
16540
16211
|
...props
|
|
16541
16212
|
}) => {
|
|
16542
16213
|
const [initialTextKey, setInitialTextKey] = useState21(textKey);
|
|
16543
|
-
|
|
16214
|
+
useEffect26(() => {
|
|
16544
16215
|
setInitialTextKey((prev) => prev === textKey ? prev : "");
|
|
16545
16216
|
}, [textKey]);
|
|
16546
16217
|
return /* @__PURE__ */ React46.createElement(AnimatePresence2, { mode: animationMode }, /* @__PURE__ */ React46.createElement(
|
|
@@ -16757,12 +16428,12 @@ var TransactionStatus = ({
|
|
|
16757
16428
|
},
|
|
16758
16429
|
[animate]
|
|
16759
16430
|
);
|
|
16760
|
-
|
|
16431
|
+
useEffect27(() => {
|
|
16761
16432
|
if (initialStatus === "progress") {
|
|
16762
16433
|
startSpinning(initialStep);
|
|
16763
16434
|
}
|
|
16764
16435
|
}, [initialStatus, initialStep, startSpinning]);
|
|
16765
|
-
|
|
16436
|
+
useEffect27(() => {
|
|
16766
16437
|
if (transitioningToStatus !== currentStatus || transitioningToStep !== currentStep) {
|
|
16767
16438
|
return;
|
|
16768
16439
|
}
|
|
@@ -17207,18 +16878,18 @@ function FunCheckoutStatusLoaded({
|
|
|
17207
16878
|
[activeCheckoutItem, checkoutHistoryItem]
|
|
17208
16879
|
);
|
|
17209
16880
|
const [currentTimeMs, setCurrentTimeMs] = useState23(Date.now());
|
|
17210
|
-
|
|
16881
|
+
useEffect28(() => {
|
|
17211
16882
|
const interval = setInterval(() => setCurrentTimeMs(Date.now()), 1e3);
|
|
17212
16883
|
return () => clearInterval(interval);
|
|
17213
16884
|
}, []);
|
|
17214
16885
|
const onOrderDelayedEvent = useEffectEvent(() => onOrderDelayed?.());
|
|
17215
16886
|
const elapsedSeconds = (currentTimeMs - startTimeMs) / 1e3;
|
|
17216
16887
|
const isNewlyDelayed = isProcessing && elapsedSeconds >= 60;
|
|
17217
|
-
|
|
16888
|
+
useEffect28(() => {
|
|
17218
16889
|
if (isNewlyDelayed) {
|
|
17219
16890
|
onOrderDelayedEvent();
|
|
17220
16891
|
}
|
|
17221
|
-
}, [isNewlyDelayed
|
|
16892
|
+
}, [isNewlyDelayed]);
|
|
17222
16893
|
if (checkoutHistoryItem.refundState === "REFUNDED") {
|
|
17223
16894
|
return null;
|
|
17224
16895
|
}
|
|
@@ -17246,7 +16917,7 @@ function extractStartTimeMs(historyCheckoutItemId, activeCheckoutItem, { created
|
|
|
17246
16917
|
}
|
|
17247
16918
|
|
|
17248
16919
|
// src/components/FunCheckoutHistory/FunDirectExecutionStatus.tsx
|
|
17249
|
-
import React53, { useEffect as
|
|
16920
|
+
import React53, { useEffect as useEffect29, useState as useState24 } from "react";
|
|
17250
16921
|
|
|
17251
16922
|
// src/hooks/useCheckoutDirectExecutionHistory.ts
|
|
17252
16923
|
import {
|
|
@@ -17450,7 +17121,7 @@ function FunDirectExecutionStatusLoaded({
|
|
|
17450
17121
|
const progress = getCheckoutProgress(directExecution.clientMetadata.id);
|
|
17451
17122
|
const startTimeMs = directExecution.createdTimeMs;
|
|
17452
17123
|
const [currentTimeMs, setCurrentTimeMs] = useState24(Date.now());
|
|
17453
|
-
|
|
17124
|
+
useEffect29(() => {
|
|
17454
17125
|
const interval = setInterval(() => setCurrentTimeMs(Date.now()), 1e3);
|
|
17455
17126
|
return () => clearInterval(interval);
|
|
17456
17127
|
}, []);
|
|
@@ -17578,7 +17249,7 @@ import React56 from "react";
|
|
|
17578
17249
|
|
|
17579
17250
|
// src/components/ModalHeightAnimationLayer/ModalHeightAnimationLayer.tsx
|
|
17580
17251
|
import { motion as motion6 } from "motion/react";
|
|
17581
|
-
import React55, { useEffect as
|
|
17252
|
+
import React55, { useEffect as useEffect30, useRef as useRef12, useState as useState26 } from "react";
|
|
17582
17253
|
var MODAL_HEIGHT_ANIMATION_TRANSITION = {
|
|
17583
17254
|
duration: 0.15,
|
|
17584
17255
|
ease: [0.33, 1, 0.68, 1]
|
|
@@ -17591,7 +17262,7 @@ function ModalHeightAnimationLayer({
|
|
|
17591
17262
|
const animationFrameRef = useRef12(null);
|
|
17592
17263
|
const resizeObserverRef = useRef12(null);
|
|
17593
17264
|
const [height, setHeight] = useState26("auto");
|
|
17594
|
-
|
|
17265
|
+
useEffect30(() => {
|
|
17595
17266
|
if (containerRef.current) {
|
|
17596
17267
|
resizeObserverRef.current = new ResizeObserver((entries) => {
|
|
17597
17268
|
animationFrameRef.current = requestAnimationFrame(() => {
|
|
@@ -17655,7 +17326,7 @@ function WithdrawalModalHeightAnimationWrapper({
|
|
|
17655
17326
|
}
|
|
17656
17327
|
|
|
17657
17328
|
// src/hooks/track/analytics/useWithdrawalAnalytics.ts
|
|
17658
|
-
import { useCallback as useCallback20, useEffect as
|
|
17329
|
+
import { useCallback as useCallback20, useEffect as useEffect31, useRef as useRef13 } from "react";
|
|
17659
17330
|
|
|
17660
17331
|
// src/hooks/track/useTrackV2.ts
|
|
17661
17332
|
import { useCallback as useCallback19 } from "react";
|
|
@@ -17696,6 +17367,272 @@ function useTrackV2() {
|
|
|
17696
17367
|
);
|
|
17697
17368
|
}
|
|
17698
17369
|
|
|
17370
|
+
// src/hooks/track/analytics/mappers.ts
|
|
17371
|
+
import { FormOfPaymentType as FormOfPaymentType2 } from "@funkit/api-base";
|
|
17372
|
+
import { round as round2 } from "@funkit/utils";
|
|
17373
|
+
|
|
17374
|
+
// src/modals/CheckoutModal/InputAmount/utils.ts
|
|
17375
|
+
import { formatCurrencyAndStringify as formatCurrencyAndStringify2 } from "@funkit/utils";
|
|
17376
|
+
var ASSET_DECIMALS = 5;
|
|
17377
|
+
var USD_DECIMALS = 2;
|
|
17378
|
+
var USD_INITIAL_AMOUNT = 100;
|
|
17379
|
+
function getDefaultAmountFromQuickOptions(quickOptions) {
|
|
17380
|
+
return quickOptions?.[Math.floor((quickOptions.length - 1) / 2)];
|
|
17381
|
+
}
|
|
17382
|
+
function getUsdMaxAmount(maxUsd) {
|
|
17383
|
+
if (maxUsd < 0) {
|
|
17384
|
+
return null;
|
|
17385
|
+
}
|
|
17386
|
+
return maxUsd;
|
|
17387
|
+
}
|
|
17388
|
+
function getUsdMinAmount(minUsd) {
|
|
17389
|
+
if (minUsd === void 0 || minUsd < MIN_CHECKOUT_AMOUNT_USD) {
|
|
17390
|
+
return MIN_CHECKOUT_AMOUNT_USD;
|
|
17391
|
+
}
|
|
17392
|
+
return minUsd;
|
|
17393
|
+
}
|
|
17394
|
+
function formatQuickOptionPresetAmount(option, percentMode, fiatCurrency, t) {
|
|
17395
|
+
if (percentMode) {
|
|
17396
|
+
return t("inputAmount.quickOptionsPercent", { percent: option });
|
|
17397
|
+
}
|
|
17398
|
+
return formatCurrencyAndStringify2(
|
|
17399
|
+
option,
|
|
17400
|
+
{},
|
|
17401
|
+
{
|
|
17402
|
+
minimumFractionDigits: 0,
|
|
17403
|
+
currency: fiatCurrency,
|
|
17404
|
+
currencyDisplay: "narrowSymbol"
|
|
17405
|
+
}
|
|
17406
|
+
);
|
|
17407
|
+
}
|
|
17408
|
+
var getInputAmountSuggestion = (error, t) => {
|
|
17409
|
+
if (!error) {
|
|
17410
|
+
return void 0;
|
|
17411
|
+
}
|
|
17412
|
+
switch (error.type) {
|
|
17413
|
+
case "aboveAvailable":
|
|
17414
|
+
return {
|
|
17415
|
+
autoConfirm: true,
|
|
17416
|
+
buttonLabel: t("inputAmount.depositMaxBalance"),
|
|
17417
|
+
selectType: "max",
|
|
17418
|
+
usdAmount: error.usdAvailableAmount
|
|
17419
|
+
};
|
|
17420
|
+
case "aboveMax":
|
|
17421
|
+
return {
|
|
17422
|
+
autoConfirm: false,
|
|
17423
|
+
buttonLabel: t("inputAmount.updateOrder"),
|
|
17424
|
+
selectType: "max",
|
|
17425
|
+
usdAmount: error.usdMaxAmount
|
|
17426
|
+
};
|
|
17427
|
+
case "belowMin":
|
|
17428
|
+
return {
|
|
17429
|
+
autoConfirm: false,
|
|
17430
|
+
buttonLabel: t("inputAmount.updateOrder"),
|
|
17431
|
+
selectType: "min",
|
|
17432
|
+
usdAmount: error.usdMinAmount
|
|
17433
|
+
};
|
|
17434
|
+
}
|
|
17435
|
+
};
|
|
17436
|
+
var getInputErrorNotification = (error, t) => {
|
|
17437
|
+
if (!error) {
|
|
17438
|
+
return void 0;
|
|
17439
|
+
}
|
|
17440
|
+
switch (error.type) {
|
|
17441
|
+
case "aboveAvailable":
|
|
17442
|
+
return {
|
|
17443
|
+
code: "INSUFFICIENT_BALANCE",
|
|
17444
|
+
messageKey: "inputAmount.insufficientBalance",
|
|
17445
|
+
message: t("inputAmount.insufficientBalance"),
|
|
17446
|
+
type: "hint"
|
|
17447
|
+
};
|
|
17448
|
+
case "aboveMax":
|
|
17449
|
+
return {
|
|
17450
|
+
code: "AMOUNT_ABOVE_MAXIMUM",
|
|
17451
|
+
messageKey: "inputAmount.maximumDeposit",
|
|
17452
|
+
message: t("inputAmount.maximumDeposit", {
|
|
17453
|
+
amount: formatCurrencyAndStringify2(error.usdMaxAmount)
|
|
17454
|
+
}),
|
|
17455
|
+
type: "hint"
|
|
17456
|
+
};
|
|
17457
|
+
case "belowMin":
|
|
17458
|
+
return {
|
|
17459
|
+
code: "INSUFFICIENT_AMOUNT",
|
|
17460
|
+
messageKey: "inputAmount.minimumDeposit",
|
|
17461
|
+
message: t("inputAmount.minimumDeposit", {
|
|
17462
|
+
amount: formatCurrencyAndStringify2(error.usdMinAmount)
|
|
17463
|
+
}),
|
|
17464
|
+
type: "hint"
|
|
17465
|
+
};
|
|
17466
|
+
}
|
|
17467
|
+
};
|
|
17468
|
+
function getNumberSeparators(locale) {
|
|
17469
|
+
const parts = Intl.NumberFormat(locale, {
|
|
17470
|
+
currency: "USD",
|
|
17471
|
+
currencyDisplay: "narrowSymbol",
|
|
17472
|
+
style: "currency"
|
|
17473
|
+
}).formatToParts(123456789123456e-6);
|
|
17474
|
+
let decimalSeparator = ".";
|
|
17475
|
+
let groupSeparator = ",";
|
|
17476
|
+
for (const part of parts) {
|
|
17477
|
+
if (part.type === "group") {
|
|
17478
|
+
groupSeparator = part.value;
|
|
17479
|
+
} else if (part.type === "decimal") {
|
|
17480
|
+
decimalSeparator = part.value;
|
|
17481
|
+
}
|
|
17482
|
+
}
|
|
17483
|
+
return {
|
|
17484
|
+
decimalSeparator,
|
|
17485
|
+
groupSeparator: groupSeparator.match(/\s/) ? /[^\S\t\r\n\f\v]/g : new RegExp(`[${groupSeparator}]`, "g")
|
|
17486
|
+
};
|
|
17487
|
+
}
|
|
17488
|
+
function parseNumberInputValue(inputValue, separators) {
|
|
17489
|
+
const { decimalSeparator, groupSeparator } = separators;
|
|
17490
|
+
const regex = new RegExp(
|
|
17491
|
+
`^[0-9]+(${groupSeparator.source}[0-9]+)*([${decimalSeparator}][0-9]*)?$`
|
|
17492
|
+
);
|
|
17493
|
+
const match = inputValue.match(regex);
|
|
17494
|
+
if (match === null) {
|
|
17495
|
+
return {
|
|
17496
|
+
amount: void 0,
|
|
17497
|
+
amountString: "",
|
|
17498
|
+
amountStringNormalized: "",
|
|
17499
|
+
decimalPart: null,
|
|
17500
|
+
integerPart: ""
|
|
17501
|
+
};
|
|
17502
|
+
}
|
|
17503
|
+
const amountString = match[0];
|
|
17504
|
+
const amountStringNormalized = amountString.replace(new RegExp(`[^0-9${decimalSeparator}]`, "g"), "").replace(new RegExp(`[${decimalSeparator}]`, "g"), ".");
|
|
17505
|
+
const [integerPart, decimalPart = null] = amountString.split(decimalSeparator);
|
|
17506
|
+
return {
|
|
17507
|
+
amount: Number.parseFloat(amountStringNormalized),
|
|
17508
|
+
amountString,
|
|
17509
|
+
amountStringNormalized,
|
|
17510
|
+
decimalPart,
|
|
17511
|
+
integerPart: integerPart ?? ""
|
|
17512
|
+
};
|
|
17513
|
+
}
|
|
17514
|
+
function getCurrencyFormattingOptions(fiatCurrency, locale) {
|
|
17515
|
+
const parts = Intl.NumberFormat(locale, {
|
|
17516
|
+
currency: fiatCurrency,
|
|
17517
|
+
currencyDisplay: "narrowSymbol",
|
|
17518
|
+
style: "currency"
|
|
17519
|
+
}).formatToParts(123456789123456e-6);
|
|
17520
|
+
let currencySymbol = fiatCurrency;
|
|
17521
|
+
let decimals = 0;
|
|
17522
|
+
for (const part of parts) {
|
|
17523
|
+
if (part.type === "currency") {
|
|
17524
|
+
currencySymbol = part.value;
|
|
17525
|
+
} else if (part.type === "fraction") {
|
|
17526
|
+
decimals = part.value.length;
|
|
17527
|
+
}
|
|
17528
|
+
}
|
|
17529
|
+
return {
|
|
17530
|
+
currencySymbol,
|
|
17531
|
+
currencySymbolWithSpacing: currencySymbol.length > 1 ? `${currencySymbol} ` : currencySymbol,
|
|
17532
|
+
decimals
|
|
17533
|
+
};
|
|
17534
|
+
}
|
|
17535
|
+
function formatAssetAmountWithLocale(value, options) {
|
|
17536
|
+
return Intl.NumberFormat(options.locale, {
|
|
17537
|
+
maximumFractionDigits: ASSET_DECIMALS,
|
|
17538
|
+
minimumFractionDigits: ASSET_DECIMALS,
|
|
17539
|
+
style: "decimal"
|
|
17540
|
+
}).format(value);
|
|
17541
|
+
}
|
|
17542
|
+
function formatCurrencyAmountWithLocale(value, options) {
|
|
17543
|
+
return Intl.NumberFormat(options.locale, {
|
|
17544
|
+
maximumFractionDigits: ASSET_DECIMALS,
|
|
17545
|
+
minimumFractionDigits: 2,
|
|
17546
|
+
style: "decimal"
|
|
17547
|
+
}).format(value);
|
|
17548
|
+
}
|
|
17549
|
+
function formatFiatAmountAndStringify(value, options) {
|
|
17550
|
+
if (Number(Math.abs(value).toFixed(2)) >= 1e6) {
|
|
17551
|
+
return formatCurrencyAndStringify2(value);
|
|
17552
|
+
}
|
|
17553
|
+
const { currencySymbolWithSpacing } = getCurrencyFormattingOptions(
|
|
17554
|
+
options.fiatCurrency,
|
|
17555
|
+
options.locale
|
|
17556
|
+
);
|
|
17557
|
+
const sign = value < 0 ? "-" : "";
|
|
17558
|
+
return `${sign}${currencySymbolWithSpacing}${formatCurrencyAmountWithLocale(Math.abs(value), options)}`;
|
|
17559
|
+
}
|
|
17560
|
+
function replaceStringRange(original, replacement, start, end) {
|
|
17561
|
+
return original.slice(0, Math.max(0, start)) + replacement + original.slice(end);
|
|
17562
|
+
}
|
|
17563
|
+
function reformatDecimalPart(decimalPart, decimals) {
|
|
17564
|
+
return decimalPart.slice(0, decimals);
|
|
17565
|
+
}
|
|
17566
|
+
function reformatIntegerPart(integerPart, locale, preserveLeadingZeroes) {
|
|
17567
|
+
const normalized = integerPart.replace(/[^0-9]/g, "") || "0";
|
|
17568
|
+
if (preserveLeadingZeroes) {
|
|
17569
|
+
return Intl.NumberFormat(locale).format(Number.parseInt(`1${normalized}`, 10)).replace(/^[1-9][^0-9]*/, "");
|
|
17570
|
+
}
|
|
17571
|
+
return Intl.NumberFormat(locale).format(Number.parseInt(normalized, 10));
|
|
17572
|
+
}
|
|
17573
|
+
|
|
17574
|
+
// src/hooks/track/analytics/mappers.ts
|
|
17575
|
+
function formatAnalyticsAmount(amount) {
|
|
17576
|
+
return amount === null ? null : round2(amount, ASSET_DECIMALS).toString();
|
|
17577
|
+
}
|
|
17578
|
+
function formatAnalyticsStep(step) {
|
|
17579
|
+
return step.toLowerCase();
|
|
17580
|
+
}
|
|
17581
|
+
function getCheckoutModalAnalyticsFlow(modalState) {
|
|
17582
|
+
switch (modalState.step) {
|
|
17583
|
+
case "withdrawal_enter_amount" /* WITHDRAWAL_ENTER_AMOUNT */:
|
|
17584
|
+
case "withdrawal_complete" /* WITHDRAWAL_COMPLETE */:
|
|
17585
|
+
return "withdraw";
|
|
17586
|
+
case "source_change" /* SOURCE_CHANGE */:
|
|
17587
|
+
return modalState.paymentMethodTypeFilter === "withdraw" ? "withdraw" : "deposit";
|
|
17588
|
+
case "swapped_iframe" /* SWAPPED_IFRAME */:
|
|
17589
|
+
return modalState.swappedMode === "withdrawal" ? "withdraw" : "deposit";
|
|
17590
|
+
case "convert" /* CONVERT */:
|
|
17591
|
+
return "convert";
|
|
17592
|
+
default:
|
|
17593
|
+
return "deposit";
|
|
17594
|
+
}
|
|
17595
|
+
}
|
|
17596
|
+
function getHistoricalSourceAddress(sourceOfFund) {
|
|
17597
|
+
const sourceAddress = sourceOfFund?.split("|")[2];
|
|
17598
|
+
return sourceAddress || null;
|
|
17599
|
+
}
|
|
17600
|
+
function resolveProvider(args, connectorId) {
|
|
17601
|
+
switch (args.paymentMethodInfo.paymentMethod) {
|
|
17602
|
+
case PaymentMethod.ACCOUNT_BALANCE:
|
|
17603
|
+
return connectorId || null;
|
|
17604
|
+
case PaymentMethod.BROKERAGE:
|
|
17605
|
+
return args.paymentMethodInfo.exchange || null;
|
|
17606
|
+
case PaymentMethod.CARD:
|
|
17607
|
+
return args.serviceProvider || null;
|
|
17608
|
+
default:
|
|
17609
|
+
return null;
|
|
17610
|
+
}
|
|
17611
|
+
}
|
|
17612
|
+
function resolvePaymentMethodProperties(args, connectorId) {
|
|
17613
|
+
return {
|
|
17614
|
+
payment_method: args.paymentMethodInfo.paymentMethod,
|
|
17615
|
+
provider: resolveProvider(args, connectorId)
|
|
17616
|
+
};
|
|
17617
|
+
}
|
|
17618
|
+
function mapSwappedFopTypeToPaymentMethod(fopType) {
|
|
17619
|
+
switch (fopType) {
|
|
17620
|
+
case FormOfPaymentType2.APPLE_PAY:
|
|
17621
|
+
return PaymentMethod.APPLE_PAY;
|
|
17622
|
+
case FormOfPaymentType2.BYBIT:
|
|
17623
|
+
case FormOfPaymentType2.COINBASE_EXCHANGE:
|
|
17624
|
+
return PaymentMethod.BROKERAGE;
|
|
17625
|
+
case FormOfPaymentType2.CARDS:
|
|
17626
|
+
return PaymentMethod.CARD;
|
|
17627
|
+
case FormOfPaymentType2.GOOGLE_PAY:
|
|
17628
|
+
return PaymentMethod.GOOGLE_PAY;
|
|
17629
|
+
case FormOfPaymentType2.REVOLUT_PAY:
|
|
17630
|
+
return PaymentMethod.REVOLUT_PAY;
|
|
17631
|
+
default:
|
|
17632
|
+
return null;
|
|
17633
|
+
}
|
|
17634
|
+
}
|
|
17635
|
+
|
|
17699
17636
|
// src/hooks/track/analytics/quote.ts
|
|
17700
17637
|
import { extractRelayFeeInfo } from "@funkit/connect-core";
|
|
17701
17638
|
var NULL_VISIBLE_QUOTE_FEE_PROPERTIES = {
|
|
@@ -17763,7 +17700,7 @@ function useWithdrawalAnalytics() {
|
|
|
17763
17700
|
const { checkoutItem } = useCheckoutContext();
|
|
17764
17701
|
const transferInteractionCountRef = useRef13(0);
|
|
17765
17702
|
const checkoutId = checkoutItem?.id;
|
|
17766
|
-
|
|
17703
|
+
useEffect31(() => {
|
|
17767
17704
|
transferInteractionCountRef.current = 0;
|
|
17768
17705
|
}, [checkoutId]);
|
|
17769
17706
|
const trackWithdrawalAmountConfirmed = useCallback20(
|
|
@@ -17787,6 +17724,7 @@ function useWithdrawalAnalytics() {
|
|
|
17787
17724
|
trade_type: "EXACT_IN" /* EXACT_IN */
|
|
17788
17725
|
}));
|
|
17789
17726
|
},
|
|
17727
|
+
// oxlint-disable-next-line react-hooks/exhaustive-deps -- TODO(review): suppressed when the rule was turned on
|
|
17790
17728
|
[logEventV2]
|
|
17791
17729
|
);
|
|
17792
17730
|
const trackWithdrawalMethodSelected = useCallback20(
|
|
@@ -17855,7 +17793,7 @@ function useWithdrawalAnalytics() {
|
|
|
17855
17793
|
}
|
|
17856
17794
|
|
|
17857
17795
|
// src/hooks/useAnimatedNavigation.ts
|
|
17858
|
-
import { useCallback as useCallback21, useEffect as
|
|
17796
|
+
import { useCallback as useCallback21, useEffect as useEffect32, useRef as useRef14, useState as useState27 } from "react";
|
|
17859
17797
|
|
|
17860
17798
|
// src/css/modalTransitionStyles.css.ts
|
|
17861
17799
|
var animateContentInClass = "stgjxl2";
|
|
@@ -17886,7 +17824,7 @@ function useAnimatedNavigation(callback) {
|
|
|
17886
17824
|
const [isSkipped, setIsSkipped] = useState27(false);
|
|
17887
17825
|
const [isReversed, setIsReversed] = useState27(false);
|
|
17888
17826
|
const pendingTimers = useRef14(/* @__PURE__ */ new Set());
|
|
17889
|
-
|
|
17827
|
+
useEffect32(
|
|
17890
17828
|
() => () => {
|
|
17891
17829
|
for (const timer of pendingTimers.current) {
|
|
17892
17830
|
clearTimeout(timer);
|
|
@@ -17934,14 +17872,16 @@ function useAnimatedNavigation(callback) {
|
|
|
17934
17872
|
}
|
|
17935
17873
|
|
|
17936
17874
|
// src/modals/CheckoutModal/SwappedIframe/SwappedIframe.tsx
|
|
17937
|
-
import React58, { useEffect as
|
|
17875
|
+
import React58, { useEffect as useEffect33, useState as useState29 } from "react";
|
|
17938
17876
|
|
|
17939
17877
|
// src/providers/SwappedProvider.tsx
|
|
17940
|
-
import {
|
|
17878
|
+
import {
|
|
17879
|
+
useSwappedSession
|
|
17880
|
+
} from "@funkit/connect-core";
|
|
17941
17881
|
import React57, {
|
|
17942
|
-
createContext as
|
|
17882
|
+
createContext as createContext20,
|
|
17943
17883
|
useCallback as useCallback22,
|
|
17944
|
-
useContext as
|
|
17884
|
+
useContext as useContext19,
|
|
17945
17885
|
useMemo as useMemo23,
|
|
17946
17886
|
useRef as useRef15,
|
|
17947
17887
|
useState as useState28
|
|
@@ -18158,8 +18098,8 @@ function createIframeSwappedTransport({
|
|
|
18158
18098
|
}
|
|
18159
18099
|
|
|
18160
18100
|
// src/providers/SwappedProvider.tsx
|
|
18161
|
-
var SwappedContext =
|
|
18162
|
-
function useSwappedSlot(swappedTheme) {
|
|
18101
|
+
var SwappedContext = createContext20(null);
|
|
18102
|
+
function useSwappedSlot(swappedTheme, buyingCrypto) {
|
|
18163
18103
|
const [iframeUrl, setIframeUrlState] = useState28(null);
|
|
18164
18104
|
const iframeRef = useRef15(null);
|
|
18165
18105
|
const iframeUrlRef = useRef15(iframeUrl);
|
|
@@ -18171,7 +18111,12 @@ function useSwappedSlot(swappedTheme) {
|
|
|
18171
18111
|
}),
|
|
18172
18112
|
[]
|
|
18173
18113
|
);
|
|
18174
|
-
const session = useSwappedSession({
|
|
18114
|
+
const session = useSwappedSession({
|
|
18115
|
+
transport,
|
|
18116
|
+
swappedTheme,
|
|
18117
|
+
buyingCrypto,
|
|
18118
|
+
logger
|
|
18119
|
+
});
|
|
18175
18120
|
const setIframeRef = useCallback22((el) => {
|
|
18176
18121
|
iframeRef.current = el;
|
|
18177
18122
|
}, []);
|
|
@@ -18182,6 +18127,7 @@ function useSwappedSlot(swappedTheme) {
|
|
|
18182
18127
|
}
|
|
18183
18128
|
setIframeUrlState(nextUrl);
|
|
18184
18129
|
},
|
|
18130
|
+
// oxlint-disable-next-line react-hooks/exhaustive-deps -- TODO(review): suppressed when the rule was turned on
|
|
18185
18131
|
[session.reset]
|
|
18186
18132
|
);
|
|
18187
18133
|
const resetIframe = useCallback22(() => {
|
|
@@ -18215,9 +18161,12 @@ function useSwappedSlot(swappedTheme) {
|
|
|
18215
18161
|
]
|
|
18216
18162
|
);
|
|
18217
18163
|
}
|
|
18218
|
-
function SwappedProvider({
|
|
18164
|
+
function SwappedProvider({
|
|
18165
|
+
children,
|
|
18166
|
+
buyingCrypto
|
|
18167
|
+
}) {
|
|
18219
18168
|
const swappedTheme = useSwappedIframeTheme();
|
|
18220
|
-
const deposit = useSwappedSlot(swappedTheme);
|
|
18169
|
+
const deposit = useSwappedSlot(swappedTheme, buyingCrypto);
|
|
18221
18170
|
const withdrawal = useSwappedSlot(swappedTheme);
|
|
18222
18171
|
const value = useMemo23(
|
|
18223
18172
|
() => ({ deposit, withdrawal, swappedTheme }),
|
|
@@ -18226,14 +18175,14 @@ function SwappedProvider({ children }) {
|
|
|
18226
18175
|
return /* @__PURE__ */ React57.createElement(SwappedContext.Provider, { value }, children);
|
|
18227
18176
|
}
|
|
18228
18177
|
function useSwappedContext(mode) {
|
|
18229
|
-
const ctx =
|
|
18178
|
+
const ctx = useContext19(SwappedContext);
|
|
18230
18179
|
if (!ctx) {
|
|
18231
18180
|
throw new Error("useSwappedContext must be used within SwappedProvider");
|
|
18232
18181
|
}
|
|
18233
18182
|
return ctx[mode];
|
|
18234
18183
|
}
|
|
18235
18184
|
function useSwappedTheme() {
|
|
18236
|
-
const ctx =
|
|
18185
|
+
const ctx = useContext19(SwappedContext);
|
|
18237
18186
|
if (!ctx) {
|
|
18238
18187
|
throw new Error("useSwappedTheme must be used within SwappedProvider");
|
|
18239
18188
|
}
|
|
@@ -18248,7 +18197,7 @@ var SwappedIframe = ({ mode }) => {
|
|
|
18248
18197
|
const { iframeUrl, isSwappedReady, isActive, setIframeRef } = useSwappedContext(mode);
|
|
18249
18198
|
const [visible, setVisible] = useState29(false);
|
|
18250
18199
|
const shouldShow = isActive && isSwappedReady;
|
|
18251
|
-
|
|
18200
|
+
useEffect33(() => {
|
|
18252
18201
|
if (shouldShow) {
|
|
18253
18202
|
const frame = requestAnimationFrame(() => setVisible(true));
|
|
18254
18203
|
return () => cancelAnimationFrame(frame);
|
|
@@ -18307,8 +18256,8 @@ import { isMobile as isMobile3 } from "@funkit/utils";
|
|
|
18307
18256
|
import clsx10 from "clsx";
|
|
18308
18257
|
import React77, {
|
|
18309
18258
|
useCallback as useCallback25,
|
|
18310
|
-
useContext as
|
|
18311
|
-
useEffect as
|
|
18259
|
+
useContext as useContext20,
|
|
18260
|
+
useEffect as useEffect37,
|
|
18312
18261
|
useRef as useRef17
|
|
18313
18262
|
} from "react";
|
|
18314
18263
|
import { createPortal as createPortal2 } from "react-dom";
|
|
@@ -18316,7 +18265,7 @@ import { RemoveScroll } from "react-remove-scroll";
|
|
|
18316
18265
|
import { AnimatePresence as AnimatePresence3, motion as motion8 } from "motion/react";
|
|
18317
18266
|
|
|
18318
18267
|
// src/hooks/useScrollDivider.ts
|
|
18319
|
-
import { useCallback as useCallback23, useEffect as
|
|
18268
|
+
import { useCallback as useCallback23, useEffect as useEffect34, useState as useState30 } from "react";
|
|
18320
18269
|
var useScrollDivider = () => {
|
|
18321
18270
|
const [refElement, setRefElement] = useState30(null);
|
|
18322
18271
|
const ref = useCallback23((node) => setRefElement(node), []);
|
|
@@ -18324,7 +18273,7 @@ var useScrollDivider = () => {
|
|
|
18324
18273
|
const [isAtBottom, setIsAtBottom] = useState30(false);
|
|
18325
18274
|
const [isScrollable, setIsScrollable] = useState30(false);
|
|
18326
18275
|
const [isScrolling, setIsScrolling] = useState30(false);
|
|
18327
|
-
|
|
18276
|
+
useEffect34(() => {
|
|
18328
18277
|
const content2 = refElement;
|
|
18329
18278
|
if (!content2 || !window.ResizeObserver) {
|
|
18330
18279
|
return;
|
|
@@ -19482,7 +19431,7 @@ var PaddedScrollableArea = React75.forwardRef(function PaddedScrollableArea2({ p
|
|
|
19482
19431
|
});
|
|
19483
19432
|
|
|
19484
19433
|
// src/components/Dialog/FocusTrap.tsx
|
|
19485
|
-
import React76, { useCallback as useCallback24, useEffect as
|
|
19434
|
+
import React76, { useCallback as useCallback24, useEffect as useEffect35, useRef as useRef16 } from "react";
|
|
19486
19435
|
var MAX_SHADOW_DEPTH = 32;
|
|
19487
19436
|
var getActiveElementAcrossShadowRoots = () => {
|
|
19488
19437
|
let active2 = document.activeElement;
|
|
@@ -19507,14 +19456,14 @@ var moveFocusWithin = (element2, position) => {
|
|
|
19507
19456
|
};
|
|
19508
19457
|
function FocusTrap(props) {
|
|
19509
19458
|
const contentRef = useRef16(null);
|
|
19510
|
-
|
|
19459
|
+
useEffect35(() => {
|
|
19511
19460
|
const previouslyActiveElement = getActiveElementAcrossShadowRoots();
|
|
19512
19461
|
return () => {
|
|
19513
19462
|
;
|
|
19514
19463
|
previouslyActiveElement.focus?.();
|
|
19515
19464
|
};
|
|
19516
19465
|
}, []);
|
|
19517
|
-
|
|
19466
|
+
useEffect35(() => {
|
|
19518
19467
|
if (contentRef.current) {
|
|
19519
19468
|
const elementToFocus = contentRef.current.querySelector("[data-auto-focus]");
|
|
19520
19469
|
if (elementToFocus) {
|
|
@@ -19555,7 +19504,7 @@ function FocusTrap(props) {
|
|
|
19555
19504
|
}
|
|
19556
19505
|
|
|
19557
19506
|
// src/components/Dialog/hooks.ts
|
|
19558
|
-
import { useEffect as
|
|
19507
|
+
import { useEffect as useEffect36, useState as useState32 } from "react";
|
|
19559
19508
|
var MODAL_BOTTOM_BAR_WRAPPER_ID = "fun-modal-bottom-bar-wrapper";
|
|
19560
19509
|
var MODAL_BOTTOM_BAR_IDS = {
|
|
19561
19510
|
checkout: "checkout-modal-bottom-bar",
|
|
@@ -19634,7 +19583,7 @@ function useBottomBarHasNoChildren() {
|
|
|
19634
19583
|
const withdrawalBottomBarElement = useWithdrawalBottomBarElement();
|
|
19635
19584
|
const connectWalletBottomBarElement = useConnectWalletBottomBarElement();
|
|
19636
19585
|
const [hasNoChildren, setHasNoChildren] = useState32(false);
|
|
19637
|
-
|
|
19586
|
+
useEffect36(() => {
|
|
19638
19587
|
const node = connectWalletBottomBarElement || checkoutBottomBarElement || withdrawalBottomBarElement || generalBottomBarElement;
|
|
19639
19588
|
if (!node) {
|
|
19640
19589
|
return;
|
|
@@ -19687,7 +19636,7 @@ function Dialog({
|
|
|
19687
19636
|
backgroundOverlay,
|
|
19688
19637
|
withoutBorder = false
|
|
19689
19638
|
}) {
|
|
19690
|
-
|
|
19639
|
+
useEffect37(() => {
|
|
19691
19640
|
const handleEscape = (event) => open && event.key === "Escape" && onClose();
|
|
19692
19641
|
if (isSmartCloseable) {
|
|
19693
19642
|
document.addEventListener("keydown", handleEscape);
|
|
@@ -19811,7 +19760,7 @@ var DialogWrapper = ({
|
|
|
19811
19760
|
withoutBorder = false
|
|
19812
19761
|
}) => {
|
|
19813
19762
|
const mobile = isMobile3();
|
|
19814
|
-
const modalSize =
|
|
19763
|
+
const modalSize = useContext20(ModalSizeContext);
|
|
19815
19764
|
const mapModalSizeToClassName = {
|
|
19816
19765
|
[ModalSizeOptions.MEDIUM]: dialogMedium,
|
|
19817
19766
|
[ModalSizeOptions.COMPACT]: dialogCompact,
|
|
@@ -20166,7 +20115,7 @@ import { formatAddress as formatAddress3, formatCryptoAndStringify as formatCryp
|
|
|
20166
20115
|
import { v4 as uuid3 } from "uuid";
|
|
20167
20116
|
import React93, {
|
|
20168
20117
|
useCallback as useCallback26,
|
|
20169
|
-
useEffect as
|
|
20118
|
+
useEffect as useEffect40,
|
|
20170
20119
|
useMemo as useMemo25,
|
|
20171
20120
|
useRef as useRef19,
|
|
20172
20121
|
useState as useState35
|
|
@@ -20345,7 +20294,7 @@ function FunTxSummarySections({
|
|
|
20345
20294
|
// src/components/FunInput/FunInput.tsx
|
|
20346
20295
|
import React83, {
|
|
20347
20296
|
forwardRef as forwardRef4,
|
|
20348
|
-
useEffect as
|
|
20297
|
+
useEffect as useEffect38,
|
|
20349
20298
|
useState as useState33
|
|
20350
20299
|
} from "react";
|
|
20351
20300
|
import clsx11 from "clsx";
|
|
@@ -20427,7 +20376,7 @@ var FunInput = forwardRef4(function FunInputWithRef({
|
|
|
20427
20376
|
const isFocused = alwaysFocused || focused;
|
|
20428
20377
|
const isValidDecimalColor = !!decimalsColor && activeTheme.colors?.[decimalsColor] !== "none";
|
|
20429
20378
|
const textareaRef = React83.useRef(null);
|
|
20430
|
-
|
|
20379
|
+
useEffect38(() => {
|
|
20431
20380
|
if (allowMultiline) {
|
|
20432
20381
|
adjustTextareaHeight(textareaRef.current);
|
|
20433
20382
|
}
|
|
@@ -20778,7 +20727,7 @@ import {
|
|
|
20778
20727
|
noop as noop2
|
|
20779
20728
|
} from "@funkit/utils";
|
|
20780
20729
|
import React89, {
|
|
20781
|
-
useEffect as
|
|
20730
|
+
useEffect as useEffect39,
|
|
20782
20731
|
useMemo as useMemo24,
|
|
20783
20732
|
useRef as useRef18,
|
|
20784
20733
|
useState as useState34
|
|
@@ -21335,7 +21284,7 @@ function PaymentFeesSummary({
|
|
|
21335
21284
|
}
|
|
21336
21285
|
}
|
|
21337
21286
|
};
|
|
21338
|
-
|
|
21287
|
+
useEffect39(() => {
|
|
21339
21288
|
if (valuesNotAvailable && isExpanded) {
|
|
21340
21289
|
controls.set("hiddenOverflow");
|
|
21341
21290
|
controls.start("collapsed");
|
|
@@ -21370,7 +21319,7 @@ function PaymentFeesSummary({
|
|
|
21370
21319
|
const isExpandable = expandedItems.length > 0 && !isLoading && !valuesNotAvailable;
|
|
21371
21320
|
const autoExpand = isWithdrawal ? uiCustomizations.withdrawalScreen.autoExpandFeesSummary : uiCustomizations.confirmationScreen.autoExpandFeesSummary;
|
|
21372
21321
|
const hasAutoExpandedRef = useRef18(false);
|
|
21373
|
-
|
|
21322
|
+
useEffect39(() => {
|
|
21374
21323
|
if (!autoExpand || hasAutoExpandedRef.current || !isExpandable) {
|
|
21375
21324
|
return;
|
|
21376
21325
|
}
|
|
@@ -21906,7 +21855,7 @@ function useLighterWithdrawalBalances({
|
|
|
21906
21855
|
const { account, isLoading, error } = useLighterAccount(
|
|
21907
21856
|
accountIndex ? { by: "index", value: accountIndex } : null
|
|
21908
21857
|
);
|
|
21909
|
-
|
|
21858
|
+
useEffect40(() => {
|
|
21910
21859
|
logger.debug("lighter:withdrawal:balances:query", {
|
|
21911
21860
|
accountIndex,
|
|
21912
21861
|
isLoading,
|
|
@@ -21928,7 +21877,7 @@ function useLighterWithdrawal(config, setRecipientAddress) {
|
|
|
21928
21877
|
const isLighterSecure = isLighterxyzCustomer(apiKey) && config.sourceChainId === mainnet6.id.toString();
|
|
21929
21878
|
const isLighterFast = isLighterFastWithdrawal(apiKey, config);
|
|
21930
21879
|
const { address: connectedAddress } = useAccount();
|
|
21931
|
-
|
|
21880
|
+
useEffect40(() => {
|
|
21932
21881
|
if (isLighterSecure && connectedAddress) {
|
|
21933
21882
|
setRecipientAddress(connectedAddress);
|
|
21934
21883
|
}
|
|
@@ -22053,7 +22002,7 @@ function useLighterL1Fallback({
|
|
|
22053
22002
|
const [isSubmitting, setIsSubmitting] = useState35(false);
|
|
22054
22003
|
const [l1FallbackError, setL1FallbackError] = useState35(null);
|
|
22055
22004
|
const submittingRef = useRef19(false);
|
|
22056
|
-
|
|
22005
|
+
useEffect40(() => {
|
|
22057
22006
|
if (isLighterSecure && isLighterWithdrawalRateLimitError2(withdrawalError)) {
|
|
22058
22007
|
setIsLatched((prev) => {
|
|
22059
22008
|
if (!prev) {
|
|
@@ -22066,14 +22015,14 @@ function useLighterL1Fallback({
|
|
|
22066
22015
|
}
|
|
22067
22016
|
}, [isLighterSecure, withdrawalError, connectedAddress]);
|
|
22068
22017
|
const prevResetKey = useRef19(resetKey);
|
|
22069
|
-
|
|
22018
|
+
useEffect40(() => {
|
|
22070
22019
|
if (prevResetKey.current !== resetKey) {
|
|
22071
22020
|
prevResetKey.current = resetKey;
|
|
22072
22021
|
setIsLatched(false);
|
|
22073
22022
|
setL1FallbackError(null);
|
|
22074
22023
|
}
|
|
22075
22024
|
}, [resetKey]);
|
|
22076
|
-
|
|
22025
|
+
useEffect40(() => {
|
|
22077
22026
|
if (!isLighterSecure) {
|
|
22078
22027
|
setIsLatched(false);
|
|
22079
22028
|
setL1FallbackError(null);
|
|
@@ -22324,7 +22273,7 @@ import {
|
|
|
22324
22273
|
useDirectExecutionForDepositAddress,
|
|
22325
22274
|
useLogOnce as useLogOnce3
|
|
22326
22275
|
} from "@funkit/connect-core";
|
|
22327
|
-
import { useEffect as
|
|
22276
|
+
import { useEffect as useEffect41, useMemo as useMemo26, useState as useState36 } from "react";
|
|
22328
22277
|
function useNadoWithdrawalStatus({
|
|
22329
22278
|
depositAddress,
|
|
22330
22279
|
pollIntervalMs
|
|
@@ -22348,7 +22297,7 @@ function useNadoWithdrawalStatus({
|
|
|
22348
22297
|
isCompleted: isCompleted && isFinalStep,
|
|
22349
22298
|
isFailed
|
|
22350
22299
|
});
|
|
22351
|
-
|
|
22300
|
+
useEffect41(() => {
|
|
22352
22301
|
if (status !== "pending") {
|
|
22353
22302
|
setHasSettled(true);
|
|
22354
22303
|
}
|
|
@@ -22522,7 +22471,7 @@ import {
|
|
|
22522
22471
|
DirectExecutionType as DirectExecutionType4,
|
|
22523
22472
|
RelayExecutionStatus as RelayExecutionStatus2
|
|
22524
22473
|
} from "@funkit/api-base";
|
|
22525
|
-
import React138, { useCallback as useCallback30, useEffect as
|
|
22474
|
+
import React138, { useCallback as useCallback30, useEffect as useEffect44, useMemo as useMemo40, useState as useState39 } from "react";
|
|
22526
22475
|
|
|
22527
22476
|
// src/domains/checkoutNotifications.ts
|
|
22528
22477
|
import {
|
|
@@ -22662,7 +22611,7 @@ function usePayerWallet(address) {
|
|
|
22662
22611
|
|
|
22663
22612
|
// src/hooks/usePaymentMethodIcon.tsx
|
|
22664
22613
|
import React130 from "react";
|
|
22665
|
-
import { bitcoinChain as
|
|
22614
|
+
import { bitcoinChain as bitcoinChain3 } from "@funkit/chains";
|
|
22666
22615
|
|
|
22667
22616
|
// src/components/FunPayments/FunPaymentMethods.tsx
|
|
22668
22617
|
import {
|
|
@@ -22671,7 +22620,7 @@ import {
|
|
|
22671
22620
|
} from "@funkit/api-base";
|
|
22672
22621
|
import { lightningChain as lightningChain2 } from "@funkit/chains";
|
|
22673
22622
|
import { formatCurrencyAndStringify as formatCurrencyAndStringify4 } from "@funkit/utils";
|
|
22674
|
-
import React117, { useEffect as
|
|
22623
|
+
import React117, { useEffect as useEffect42 } from "react";
|
|
22675
22624
|
|
|
22676
22625
|
// src/domains/bridge.ts
|
|
22677
22626
|
import {
|
|
@@ -23039,7 +22988,7 @@ function getExchangesComingSoon(iconSize) {
|
|
|
23039
22988
|
|
|
23040
22989
|
// src/hooks/queries/useSwappedExchanges.ts
|
|
23041
22990
|
import { RailConfigType, getFops } from "@funkit/api-base";
|
|
23042
|
-
import { bitcoinChain
|
|
22991
|
+
import { bitcoinChain, solanaChain as solanaChain3, tronChain as tronChain2 } from "@funkit/chains";
|
|
23043
22992
|
import { keepPreviousData as keepPreviousData3, useQuery as useQuery7 } from "@tanstack/react-query";
|
|
23044
22993
|
import { useMemo as useMemo30 } from "react";
|
|
23045
22994
|
|
|
@@ -23189,7 +23138,7 @@ var useSwappedExchanges = () => {
|
|
|
23189
23138
|
targets.push({
|
|
23190
23139
|
recipientAddress: transferInit.solanaAddr,
|
|
23191
23140
|
destinationToken: {
|
|
23192
|
-
chainId:
|
|
23141
|
+
chainId: solanaChain3.id.toString(),
|
|
23193
23142
|
address: SOLANA_USDC_ADDRESS
|
|
23194
23143
|
}
|
|
23195
23144
|
});
|
|
@@ -23198,7 +23147,7 @@ var useSwappedExchanges = () => {
|
|
|
23198
23147
|
targets.push({
|
|
23199
23148
|
recipientAddress: transferInit.tronAddr,
|
|
23200
23149
|
destinationToken: {
|
|
23201
|
-
chainId:
|
|
23150
|
+
chainId: tronChain2.id.toString(),
|
|
23202
23151
|
address: TRON_USDT_ADDRESS
|
|
23203
23152
|
}
|
|
23204
23153
|
});
|
|
@@ -23207,7 +23156,7 @@ var useSwappedExchanges = () => {
|
|
|
23207
23156
|
targets.push({
|
|
23208
23157
|
recipientAddress: transferInit.btcDepositAddr,
|
|
23209
23158
|
destinationToken: {
|
|
23210
|
-
chainId:
|
|
23159
|
+
chainId: bitcoinChain.id.toString(),
|
|
23211
23160
|
address: NATIVE_TOKEN
|
|
23212
23161
|
}
|
|
23213
23162
|
});
|
|
@@ -23216,9 +23165,9 @@ var useSwappedExchanges = () => {
|
|
|
23216
23165
|
(target) => target.destinationToken.chainId === targetChain && target.destinationToken.address === targetAsset
|
|
23217
23166
|
)) {
|
|
23218
23167
|
const recipientAddresses = {
|
|
23219
|
-
[
|
|
23220
|
-
[
|
|
23221
|
-
[
|
|
23168
|
+
[bitcoinChain.id]: transferInit.btcDepositAddr,
|
|
23169
|
+
[solanaChain3.id]: transferInit.solanaAddr,
|
|
23170
|
+
[tronChain2.id]: transferInit.tronAddr
|
|
23222
23171
|
};
|
|
23223
23172
|
const recipientAddress = recipientAddresses[targetChain] || transferInit.depositAddr;
|
|
23224
23173
|
targets.push({
|
|
@@ -25012,16 +24961,16 @@ function ExchangeIconCluster({
|
|
|
25012
24961
|
}
|
|
25013
24962
|
|
|
25014
24963
|
// src/components/FunPayments/TransferCryptoChainIcons.tsx
|
|
25015
|
-
import { bitcoinChain as
|
|
24964
|
+
import { bitcoinChain as bitcoinChain2, solanaChain as solanaChain4, tronChain as tronChain3 } from "@funkit/chains";
|
|
25016
24965
|
import React116 from "react";
|
|
25017
24966
|
import { base as base5, bsc as bsc2, mainnet as mainnet8 } from "viem/chains";
|
|
25018
24967
|
var previewChainIds = [
|
|
25019
|
-
|
|
24968
|
+
bitcoinChain2,
|
|
25020
24969
|
mainnet8,
|
|
25021
|
-
|
|
24970
|
+
solanaChain4,
|
|
25022
24971
|
bsc2,
|
|
25023
24972
|
base5,
|
|
25024
|
-
|
|
24973
|
+
tronChain3
|
|
25025
24974
|
].map((chain) => String(chain.id));
|
|
25026
24975
|
function TransferCryptoChainIcons() {
|
|
25027
24976
|
return /* @__PURE__ */ React116.createElement(SupportedChainList, { chainIdList: previewChainIds, showMore: true });
|
|
@@ -25135,7 +25084,7 @@ var ConnectedBluvoPaymentMethodItem = ({
|
|
|
25135
25084
|
const hasLowBalance = !isPending && sourceBalance < getUsdMinAmount();
|
|
25136
25085
|
const isDisabled = disabled || isPending || !!isBalanceError || hasLowBalance || isUserGeoblocked;
|
|
25137
25086
|
const icon = isPending ? /* @__PURE__ */ React117.createElement(SpinnerIcon, { size: 20 }) : /* @__PURE__ */ React117.createElement("div", { style: { borderRadius: "50%", overflow: "hidden" } }, label.icon);
|
|
25138
|
-
|
|
25087
|
+
useEffect42(() => {
|
|
25139
25088
|
if (isPending) {
|
|
25140
25089
|
return;
|
|
25141
25090
|
}
|
|
@@ -26014,7 +25963,7 @@ var PAYMENT_METHOD_ICONS = {
|
|
|
26014
25963
|
[PaymentMethod.REVOLUT_PAY]: (size) => /* @__PURE__ */ React130.createElement(RevolutPayIcon, { size }),
|
|
26015
25964
|
[PaymentMethod.TOKEN_TRANSFER]: (size) => /* @__PURE__ */ React130.createElement(CryptoTransferQRIcon, { size }),
|
|
26016
25965
|
[PaymentMethod.BITCOIN_LIGHTNING]: (size) => {
|
|
26017
|
-
const bitcoinIconUrl = chainMetadataById[
|
|
25966
|
+
const bitcoinIconUrl = chainMetadataById[bitcoinChain3.id]?.iconUrl ?? "";
|
|
26018
25967
|
return /* @__PURE__ */ React130.createElement(
|
|
26019
25968
|
AsyncImage,
|
|
26020
25969
|
{
|
|
@@ -26409,7 +26358,7 @@ function AddTokenToWalletButton({
|
|
|
26409
26358
|
import { CheckoutState as CheckoutState3 } from "@funkit/api-base";
|
|
26410
26359
|
import { SOLANA_MAINNET_CHAIN_ID as SOLANA_MAINNET_CHAIN_ID2 } from "@funkit/chains";
|
|
26411
26360
|
import { formatAddress as formatAddress6, formatTimestamp } from "@funkit/utils";
|
|
26412
|
-
import React136, { useEffect as
|
|
26361
|
+
import React136, { useEffect as useEffect43, useRef as useRef21, useState as useState37 } from "react";
|
|
26413
26362
|
|
|
26414
26363
|
// src/utils/checkoutHistory.ts
|
|
26415
26364
|
function getCheckoutCompletionTime(checkout) {
|
|
@@ -26494,7 +26443,7 @@ function StatusTag({ state, refundState, isDelayed: isDelayed2 }) {
|
|
|
26494
26443
|
const checkoutState = getCheckoutStateBooleans(state, refundState);
|
|
26495
26444
|
const [delayedCheckoutState, setDelayedCheckoutState] = useState37(checkoutState);
|
|
26496
26445
|
const { status, isCompleted, isRefundProceeded } = delayedCheckoutState;
|
|
26497
|
-
|
|
26446
|
+
useEffect43(() => {
|
|
26498
26447
|
const timeout = setTimeout(
|
|
26499
26448
|
() => {
|
|
26500
26449
|
setDelayedCheckoutState(getCheckoutStateBooleans(state, refundState));
|
|
@@ -27118,7 +27067,7 @@ var PendingSuccessScreen = ({
|
|
|
27118
27067
|
}
|
|
27119
27068
|
}, [directExecution, checkoutItem, setCheckoutProgress, quote, isWithdrawal]);
|
|
27120
27069
|
const firstMergedDirectExecution = mergedDirectExecutions?.[0];
|
|
27121
|
-
|
|
27070
|
+
useEffect44(() => {
|
|
27122
27071
|
if (firstMergedDirectExecution) {
|
|
27123
27072
|
onHistoryItemChange?.({
|
|
27124
27073
|
...firstMergedDirectExecution,
|
|
@@ -27145,7 +27094,7 @@ var PendingSuccessScreen = ({
|
|
|
27145
27094
|
firstMergedDirectExecution?.latestStep?.txHash,
|
|
27146
27095
|
firstMergedDirectExecution?.latestStep?.listenerInfo?.status
|
|
27147
27096
|
]);
|
|
27148
|
-
|
|
27097
|
+
useEffect44(() => {
|
|
27149
27098
|
if (!latestDirectExecution) {
|
|
27150
27099
|
return;
|
|
27151
27100
|
}
|
|
@@ -27543,7 +27492,7 @@ import {
|
|
|
27543
27492
|
formatCryptoAndStringify as formatCryptoAndStringify5,
|
|
27544
27493
|
formatCurrencyAndStringify as formatCurrencyAndStringify6
|
|
27545
27494
|
} from "@funkit/utils";
|
|
27546
|
-
import React156, { useCallback as useCallback38, useEffect as
|
|
27495
|
+
import React156, { useCallback as useCallback38, useEffect as useEffect54, useMemo as useMemo48, useState as useState50 } from "react";
|
|
27547
27496
|
import { createPortal as createPortal6 } from "react-dom";
|
|
27548
27497
|
import { useDebounce } from "use-debounce";
|
|
27549
27498
|
import { isAddress as isAddress2 } from "viem";
|
|
@@ -27557,7 +27506,7 @@ import {
|
|
|
27557
27506
|
useNadoFeeRates,
|
|
27558
27507
|
useNadoMaxWithdrawable
|
|
27559
27508
|
} from "@funkit/connect-core/clients/nado";
|
|
27560
|
-
import { useEffect as
|
|
27509
|
+
import { useEffect as useEffect45, useMemo as useMemo42, useState as useState40 } from "react";
|
|
27561
27510
|
|
|
27562
27511
|
// src/hooks/useAssetPrice.ts
|
|
27563
27512
|
import { getAssetPriceInfoWithFallback } from "@funkit/connect-core";
|
|
@@ -27606,7 +27555,7 @@ function useNadoWithdrawalForm(config, selectedSourceToken) {
|
|
|
27606
27555
|
() => nadoConfig?.defaultSpotLeverage ?? false
|
|
27607
27556
|
);
|
|
27608
27557
|
const { data: feeRates } = useNadoFeeRates({ sender: subaccount, logger });
|
|
27609
|
-
|
|
27558
|
+
useEffect45(() => {
|
|
27610
27559
|
setSpotLeverage(nadoConfig?.defaultSpotLeverage ?? false);
|
|
27611
27560
|
}, [subaccount, nadoConfig?.defaultSpotLeverage]);
|
|
27612
27561
|
const amountToggle = {
|
|
@@ -27686,7 +27635,7 @@ import React146, { useMemo as useMemo44 } from "react";
|
|
|
27686
27635
|
// src/components/Dropdown/BaseDropdown.tsx
|
|
27687
27636
|
import { isMobile as isMobile4 } from "@funkit/utils";
|
|
27688
27637
|
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
27689
|
-
import React144, { useCallback as useCallback31, useEffect as
|
|
27638
|
+
import React144, { useCallback as useCallback31, useEffect as useEffect46, useMemo as useMemo43, useRef as useRef23, useState as useState41 } from "react";
|
|
27690
27639
|
|
|
27691
27640
|
// src/components/FunNoResults/FunNoResults.tsx
|
|
27692
27641
|
import React142 from "react";
|
|
@@ -28114,7 +28063,7 @@ function BaseDropdown({
|
|
|
28114
28063
|
},
|
|
28115
28064
|
[onOpen, resetSearchOnClose]
|
|
28116
28065
|
);
|
|
28117
|
-
|
|
28066
|
+
useEffect46(() => {
|
|
28118
28067
|
if (isOpened && !prevIsOpenedRef.current) {
|
|
28119
28068
|
prevIsOpenedRef.current = true;
|
|
28120
28069
|
if (selectedOption) {
|
|
@@ -28825,13 +28774,13 @@ import React152 from "react";
|
|
|
28825
28774
|
import React151, { useState as useState43 } from "react";
|
|
28826
28775
|
|
|
28827
28776
|
// src/hooks/useInterval.ts
|
|
28828
|
-
import { useEffect as
|
|
28777
|
+
import { useEffect as useEffect47, useRef as useRef24 } from "react";
|
|
28829
28778
|
function useInterval(callback, delay) {
|
|
28830
28779
|
const savedCallback = useRef24(callback);
|
|
28831
28780
|
useIsomorphicLayoutEffect(() => {
|
|
28832
28781
|
savedCallback.current = callback;
|
|
28833
28782
|
}, [callback]);
|
|
28834
|
-
|
|
28783
|
+
useEffect47(() => {
|
|
28835
28784
|
const id = setInterval(() => {
|
|
28836
28785
|
savedCallback.current();
|
|
28837
28786
|
}, delay);
|
|
@@ -29271,12 +29220,12 @@ var useWithdrawalRisk = (apiKey, receiveAddress, chainId2) => {
|
|
|
29271
29220
|
};
|
|
29272
29221
|
|
|
29273
29222
|
// src/hooks/track/analytics/useTrackErrorShown.ts
|
|
29274
|
-
import { useEffect as
|
|
29223
|
+
import { useEffect as useEffect48, useRef as useRef25 } from "react";
|
|
29275
29224
|
function useTrackErrorShown({ error, flow, step }) {
|
|
29276
29225
|
const logEventV2 = useTrackV2();
|
|
29277
29226
|
const identity = error && `${step}:${error.code ?? error.messageKey}`;
|
|
29278
29227
|
const displayedErrorIdentityRef = useRef25(null);
|
|
29279
|
-
|
|
29228
|
+
useEffect48(() => {
|
|
29280
29229
|
if (!error) {
|
|
29281
29230
|
displayedErrorIdentityRef.current = null;
|
|
29282
29231
|
return;
|
|
@@ -29361,11 +29310,11 @@ function getErrorNotification({
|
|
|
29361
29310
|
}
|
|
29362
29311
|
|
|
29363
29312
|
// src/modals/WithdrawalModal/RecipientAddress.tsx
|
|
29364
|
-
import React154, { useCallback as useCallback33, useEffect as
|
|
29313
|
+
import React154, { useCallback as useCallback33, useEffect as useEffect49, useRef as useRef27, useState as useState45 } from "react";
|
|
29365
29314
|
import {
|
|
29366
29315
|
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO11,
|
|
29367
|
-
solanaChain as
|
|
29368
|
-
tronChain as
|
|
29316
|
+
solanaChain as solanaChain5,
|
|
29317
|
+
tronChain as tronChain4
|
|
29369
29318
|
} from "@funkit/chains";
|
|
29370
29319
|
import { isAddressEquivalent as isAddressEquivalent7 } from "@funkit/utils";
|
|
29371
29320
|
|
|
@@ -29549,7 +29498,7 @@ function useConnectedWalletShortcut({
|
|
|
29549
29498
|
isConnected,
|
|
29550
29499
|
hasMultipleWalletsConnected
|
|
29551
29500
|
});
|
|
29552
|
-
|
|
29501
|
+
useEffect49(() => {
|
|
29553
29502
|
logger.debug("withdrawalContent:showUseConnected", {
|
|
29554
29503
|
isConnected,
|
|
29555
29504
|
connectedWalletAddress,
|
|
@@ -29570,7 +29519,7 @@ function useConnectedWalletShortcut({
|
|
|
29570
29519
|
};
|
|
29571
29520
|
}
|
|
29572
29521
|
function getRecipientAddressPlaceholder(selectedChainId, t) {
|
|
29573
|
-
if (selectedChainId ===
|
|
29522
|
+
if (selectedChainId === solanaChain5.id || selectedChainId === tronChain4.id) {
|
|
29574
29523
|
return t("withdrawal.enterRecipientAddress")[0] + t("withdrawal.enterRecipientAddress").slice(1).toLowerCase();
|
|
29575
29524
|
}
|
|
29576
29525
|
return "0x...";
|
|
@@ -29626,7 +29575,7 @@ function WithdrawRecipientAddress({
|
|
|
29626
29575
|
textRef: inputRef
|
|
29627
29576
|
});
|
|
29628
29577
|
const shouldFocusAfterClear = useRef27(false);
|
|
29629
|
-
|
|
29578
|
+
useEffect49(() => {
|
|
29630
29579
|
if (shouldFocusAfterClear.current && !isShowingConnectedAddress) {
|
|
29631
29580
|
shouldFocusAfterClear.current = false;
|
|
29632
29581
|
inputRef.current?.focus();
|
|
@@ -29640,7 +29589,7 @@ function WithdrawRecipientAddress({
|
|
|
29640
29589
|
[setRecipientAddressProp, updateCustomRecipient]
|
|
29641
29590
|
);
|
|
29642
29591
|
const hasPrefilledConnectedAddress = useRef27(false);
|
|
29643
|
-
|
|
29592
|
+
useEffect49(() => {
|
|
29644
29593
|
if (hasPrefilledConnectedAddress.current || recipientAddress || !isPrefillConnectedAddressEnabled || !showUseConnected || !connectedWalletAddress) {
|
|
29645
29594
|
return;
|
|
29646
29595
|
}
|
|
@@ -30285,10 +30234,10 @@ function getRelayOutputCurrencyAmount(quote, fallback2) {
|
|
|
30285
30234
|
}
|
|
30286
30235
|
|
|
30287
30236
|
// src/modals/WithdrawalModal/withdrawalHooks.tsx
|
|
30288
|
-
import { useCallback as useCallback34, useEffect as
|
|
30237
|
+
import { useCallback as useCallback34, useEffect as useEffect51, useRef as useRef30 } from "react";
|
|
30289
30238
|
|
|
30290
30239
|
// src/hooks/useTokenAndChainDropdown.ts
|
|
30291
|
-
import { useEffect as
|
|
30240
|
+
import { useEffect as useEffect50, useRef as useRef29, useState as useState47 } from "react";
|
|
30292
30241
|
import { polygon as polygon6 } from "viem/chains";
|
|
30293
30242
|
|
|
30294
30243
|
// src/hooks/useEnabledTokenTransferChainTokens.ts
|
|
@@ -30380,12 +30329,12 @@ var useTokenAndChainDropdown = ({
|
|
|
30380
30329
|
noDefaultSelection ? void 0 : selectedDefaultToken
|
|
30381
30330
|
);
|
|
30382
30331
|
const hasUserSelectedRef = useRef29(false);
|
|
30383
|
-
|
|
30332
|
+
useEffect50(() => {
|
|
30384
30333
|
if (!noDefaultSelection && !hasUserSelectedRef.current) {
|
|
30385
30334
|
setSelectedChainId(selectedDefaultChainId);
|
|
30386
30335
|
}
|
|
30387
30336
|
}, [selectedDefaultChainId, noDefaultSelection]);
|
|
30388
|
-
|
|
30337
|
+
useEffect50(() => {
|
|
30389
30338
|
if (!noDefaultSelection && !hasUserSelectedRef.current) {
|
|
30390
30339
|
setSelectedToken(selectedDefaultToken);
|
|
30391
30340
|
}
|
|
@@ -30531,7 +30480,7 @@ function useWithdrawalLogging({
|
|
|
30531
30480
|
const lastQuoteErrorRef = useRef30(null);
|
|
30532
30481
|
const lastRiskyRecipientRef = useRef30(null);
|
|
30533
30482
|
const lastBlacklistedRecipientRef = useRef30(null);
|
|
30534
|
-
|
|
30483
|
+
useEffect51(() => {
|
|
30535
30484
|
if (!targetAssetFetchError) {
|
|
30536
30485
|
return;
|
|
30537
30486
|
}
|
|
@@ -30546,7 +30495,7 @@ function useWithdrawalLogging({
|
|
|
30546
30495
|
});
|
|
30547
30496
|
lastTargetAssetErrorRef.current = errorKey;
|
|
30548
30497
|
}, [targetAssetFetchError, selectedChainId, selectedToken]);
|
|
30549
|
-
|
|
30498
|
+
useEffect51(() => {
|
|
30550
30499
|
if (!sourceAssetFetchError) {
|
|
30551
30500
|
return;
|
|
30552
30501
|
}
|
|
@@ -30560,7 +30509,7 @@ function useWithdrawalLogging({
|
|
|
30560
30509
|
});
|
|
30561
30510
|
lastSourceAssetErrorRef.current = errorKey;
|
|
30562
30511
|
}, [sourceAssetFetchError, selectedSourceToken]);
|
|
30563
|
-
|
|
30512
|
+
useEffect51(() => {
|
|
30564
30513
|
if (!quoteErrorObject) {
|
|
30565
30514
|
return;
|
|
30566
30515
|
}
|
|
@@ -30588,7 +30537,7 @@ function useWithdrawalLogging({
|
|
|
30588
30537
|
debouncedInputAmount,
|
|
30589
30538
|
debouncedInputAmountUsd
|
|
30590
30539
|
]);
|
|
30591
|
-
|
|
30540
|
+
useEffect51(() => {
|
|
30592
30541
|
if (!isRisky) {
|
|
30593
30542
|
return;
|
|
30594
30543
|
}
|
|
@@ -30603,7 +30552,7 @@ function useWithdrawalLogging({
|
|
|
30603
30552
|
});
|
|
30604
30553
|
lastRiskyRecipientRef.current = warningKey;
|
|
30605
30554
|
}, [isRisky, recipientAddress, selectedChainId, selectedToken]);
|
|
30606
|
-
|
|
30555
|
+
useEffect51(() => {
|
|
30607
30556
|
if (!isRecipientBlacklisted) {
|
|
30608
30557
|
return;
|
|
30609
30558
|
}
|
|
@@ -30624,11 +30573,11 @@ function useWithdrawalLogging({
|
|
|
30624
30573
|
import { useState as useState49 } from "react";
|
|
30625
30574
|
|
|
30626
30575
|
// src/hooks/useAutoClearState.ts
|
|
30627
|
-
import { useCallback as useCallback35, useEffect as
|
|
30576
|
+
import { useCallback as useCallback35, useEffect as useEffect52, useRef as useRef31, useState as useState48 } from "react";
|
|
30628
30577
|
function useAutoClearState(initialValue = null) {
|
|
30629
30578
|
const [state, setState] = useState48(initialValue);
|
|
30630
30579
|
const timeoutRef = useRef31(void 0);
|
|
30631
|
-
|
|
30580
|
+
useEffect52(() => {
|
|
30632
30581
|
return () => {
|
|
30633
30582
|
if (timeoutRef.current !== void 0) {
|
|
30634
30583
|
clearTimeout(timeoutRef.current);
|
|
@@ -30817,7 +30766,7 @@ function useWithdrawal({
|
|
|
30817
30766
|
}
|
|
30818
30767
|
|
|
30819
30768
|
// src/modals/WithdrawalModal/useTrackWithdrawalQuoteEvents.ts
|
|
30820
|
-
import { useCallback as useCallback36, useEffect as
|
|
30769
|
+
import { useCallback as useCallback36, useEffect as useEffect53, useRef as useRef32 } from "react";
|
|
30821
30770
|
function useTrackWithdrawalQuoteEvents({
|
|
30822
30771
|
isQuoteLoading,
|
|
30823
30772
|
quote,
|
|
@@ -30829,11 +30778,11 @@ function useTrackWithdrawalQuoteEvents({
|
|
|
30829
30778
|
const checkoutId = checkoutItem?.id ?? null;
|
|
30830
30779
|
const lastDisplayedQuoteIdRef = useRef32(null);
|
|
30831
30780
|
const numQuoteRefreshesRef = useRef32(0);
|
|
30832
|
-
|
|
30781
|
+
useEffect53(() => {
|
|
30833
30782
|
lastDisplayedQuoteIdRef.current = null;
|
|
30834
30783
|
numQuoteRefreshesRef.current = 0;
|
|
30835
30784
|
}, [checkoutId]);
|
|
30836
|
-
|
|
30785
|
+
useEffect53(() => {
|
|
30837
30786
|
if (isQuoteLoading || !quote || !target) {
|
|
30838
30787
|
return;
|
|
30839
30788
|
}
|
|
@@ -31431,11 +31380,11 @@ function usePostClientCommonWithdrawalFlow({
|
|
|
31431
31380
|
sourceTokenUsdPrice
|
|
31432
31381
|
);
|
|
31433
31382
|
const targetAssetAmount = targetUnitPrice && debouncedInputAmountUsd !== void 0 ? debouncedInputAmountUsd / targetUnitPrice : void 0;
|
|
31434
|
-
|
|
31383
|
+
useEffect54(() => {
|
|
31435
31384
|
updateWithdrawalSourceAssetAmount(quoteInputAmount);
|
|
31436
31385
|
}, [quoteInputAmount, updateWithdrawalSourceAssetAmount]);
|
|
31437
31386
|
const isActiveTargetSynced = checkoutConfig?.targetAsset === targetAssetAddress && checkoutConfig?.targetChain === selectedChainId?.toString() && checkoutConfig?.targetAssetTicker === selectedToken;
|
|
31438
|
-
|
|
31387
|
+
useEffect54(() => {
|
|
31439
31388
|
if (!targetAssetAddress || !selectedChainId || !selectedToken || isActiveTargetSynced) {
|
|
31440
31389
|
return;
|
|
31441
31390
|
}
|
|
@@ -31453,7 +31402,7 @@ function usePostClientCommonWithdrawalFlow({
|
|
|
31453
31402
|
selectedToken,
|
|
31454
31403
|
isActiveTargetSynced
|
|
31455
31404
|
]);
|
|
31456
|
-
|
|
31405
|
+
useEffect54(() => {
|
|
31457
31406
|
setTimeout(() => {
|
|
31458
31407
|
updateTargetAssetAmount(targetAssetAmount ?? 0);
|
|
31459
31408
|
}, 0);
|
|
@@ -32332,7 +32281,7 @@ var useWithdrawFops = (params) => {
|
|
|
32332
32281
|
|
|
32333
32282
|
// src/hooks/useSwappedPreload.ts
|
|
32334
32283
|
import { isSwappedFop } from "@funkit/connect-core";
|
|
32335
|
-
import { useEffect as
|
|
32284
|
+
import { useEffect as useEffect55 } from "react";
|
|
32336
32285
|
|
|
32337
32286
|
// src/modals/CheckoutModal/SourceChange/FormOfPaymentsList.tsx
|
|
32338
32287
|
import { getFopKey, isSyntheticFop, sortFops as sortFops2 } from "@funkit/connect-core";
|
|
@@ -32722,7 +32671,7 @@ function FormOfPaymentsList({
|
|
|
32722
32671
|
function useSwappedPreload(fopsData, mode) {
|
|
32723
32672
|
const fopPriority = useDynamicConfig("foppriority");
|
|
32724
32673
|
const { setIframeUrl } = useSwappedContext(mode);
|
|
32725
|
-
|
|
32674
|
+
useEffect55(() => {
|
|
32726
32675
|
if (!fopsData) {
|
|
32727
32676
|
setIframeUrl(null);
|
|
32728
32677
|
return;
|
|
@@ -32904,7 +32853,7 @@ function WithdrawalMethodSelect({
|
|
|
32904
32853
|
|
|
32905
32854
|
// src/modals/WithdrawalModal/WithdrawalSwappedIframeController.tsx
|
|
32906
32855
|
import { useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
32907
|
-
import React164, { useEffect as
|
|
32856
|
+
import React164, { useEffect as useEffect58 } from "react";
|
|
32908
32857
|
|
|
32909
32858
|
// src/components/SwappedIframeSkeleton.tsx
|
|
32910
32859
|
import React163 from "react";
|
|
@@ -33023,7 +32972,7 @@ function SwappedIframeSkeleton({
|
|
|
33023
32972
|
}
|
|
33024
32973
|
|
|
33025
32974
|
// src/hooks/useSwappedIframeLifecycle.ts
|
|
33026
|
-
import { useEffect as
|
|
32975
|
+
import { useEffect as useEffect56, useRef as useRef34 } from "react";
|
|
33027
32976
|
var SWAPPED_IFRAME_TIMEOUT = 15e3;
|
|
33028
32977
|
function useSwappedIframeLifecycle({
|
|
33029
32978
|
fopType,
|
|
@@ -33033,11 +32982,11 @@ function useSwappedIframeLifecycle({
|
|
|
33033
32982
|
const { activateIframe, deactivateIframe, isSwappedReady } = useSwappedContext(mode);
|
|
33034
32983
|
const timeoutRef = useRef34(void 0);
|
|
33035
32984
|
const stableOnTimeout = useEffectEvent(onTimeout);
|
|
33036
|
-
|
|
32985
|
+
useEffect56(() => {
|
|
33037
32986
|
activateIframe(fopType);
|
|
33038
32987
|
return () => deactivateIframe();
|
|
33039
32988
|
}, [fopType, activateIframe, deactivateIframe]);
|
|
33040
|
-
|
|
32989
|
+
useEffect56(() => {
|
|
33041
32990
|
if (isSwappedReady) {
|
|
33042
32991
|
clearTimeout(timeoutRef.current);
|
|
33043
32992
|
return;
|
|
@@ -33049,12 +32998,12 @@ function useSwappedIframeLifecycle({
|
|
|
33049
32998
|
});
|
|
33050
32999
|
}, SWAPPED_IFRAME_TIMEOUT);
|
|
33051
33000
|
return () => clearTimeout(timeoutRef.current);
|
|
33052
|
-
}, [isSwappedReady
|
|
33001
|
+
}, [isSwappedReady]);
|
|
33053
33002
|
}
|
|
33054
33003
|
|
|
33055
33004
|
// src/modals/WithdrawalModal/useFiatWithdrawal.ts
|
|
33056
33005
|
import { getCheckoutQuoteV2 as getCheckoutQuoteV22 } from "@funkit/api-base";
|
|
33057
|
-
import { useEffect as
|
|
33006
|
+
import { useEffect as useEffect57, useRef as useRef35 } from "react";
|
|
33058
33007
|
import { safeBigInt } from "@funkit/connect-core";
|
|
33059
33008
|
import {
|
|
33060
33009
|
findSwappedSourceOverride as findSwappedSourceOverride2,
|
|
@@ -33162,7 +33111,7 @@ function useFiatWithdrawal({
|
|
|
33162
33111
|
tokenAddress: config.sourceTokenAddress
|
|
33163
33112
|
})
|
|
33164
33113
|
) : null;
|
|
33165
|
-
|
|
33114
|
+
useEffect57(() => {
|
|
33166
33115
|
if (!legs || !checkoutItem) {
|
|
33167
33116
|
return;
|
|
33168
33117
|
}
|
|
@@ -33193,11 +33142,11 @@ function useFiatWithdrawal({
|
|
|
33193
33142
|
onError();
|
|
33194
33143
|
}
|
|
33195
33144
|
});
|
|
33196
|
-
|
|
33145
|
+
useEffect57(() => {
|
|
33197
33146
|
if (withdrawalError) {
|
|
33198
33147
|
handleWithdrawalFailure();
|
|
33199
33148
|
}
|
|
33200
|
-
}, [withdrawalError
|
|
33149
|
+
}, [withdrawalError]);
|
|
33201
33150
|
const rejectOrderBeforeStart = useEffectEvent(
|
|
33202
33151
|
(order) => {
|
|
33203
33152
|
if (isProcessingOrderRef.current) {
|
|
@@ -33373,7 +33322,7 @@ function WithdrawalSwappedIframeController({
|
|
|
33373
33322
|
checkoutId: withdrawalItem?.id
|
|
33374
33323
|
})
|
|
33375
33324
|
);
|
|
33376
|
-
|
|
33325
|
+
useEffect58(() => {
|
|
33377
33326
|
if (isSwappedReady) {
|
|
33378
33327
|
const metadata = getTrackMetadata();
|
|
33379
33328
|
logger.info("swapped-withdrawal-iframe:ready", metadata);
|
|
@@ -33383,7 +33332,7 @@ function WithdrawalSwappedIframeController({
|
|
|
33383
33332
|
});
|
|
33384
33333
|
focusAmountInput();
|
|
33385
33334
|
}
|
|
33386
|
-
}, [
|
|
33335
|
+
}, [isSwappedReady, logEvent, focusAmountInput]);
|
|
33387
33336
|
const handleSwappedMessage = useEffectEvent((msg) => {
|
|
33388
33337
|
switch (msg.type) {
|
|
33389
33338
|
case "SWAPPED_GO_BACK": {
|
|
@@ -33486,9 +33435,9 @@ function WithdrawalSwappedIframeController({
|
|
|
33486
33435
|
}
|
|
33487
33436
|
}
|
|
33488
33437
|
});
|
|
33489
|
-
|
|
33438
|
+
useEffect58(() => {
|
|
33490
33439
|
return swappedTransport.onMessage(handleSwappedMessage);
|
|
33491
|
-
}, [swappedTransport
|
|
33440
|
+
}, [swappedTransport]);
|
|
33492
33441
|
useSwappedIframeLifecycle({
|
|
33493
33442
|
fopType: selectedFop.fopType,
|
|
33494
33443
|
onTimeout: onError,
|
|
@@ -33541,18 +33490,18 @@ import { noop as noop4 } from "@funkit/utils";
|
|
|
33541
33490
|
import React167 from "react";
|
|
33542
33491
|
|
|
33543
33492
|
// src/components/FunCheckoutHistory/FunCheckoutHistoryContent.tsx
|
|
33544
|
-
import React166, { useEffect as
|
|
33493
|
+
import React166, { useEffect as useEffect60 } from "react";
|
|
33545
33494
|
|
|
33546
33495
|
// src/components/FunCheckoutHistory/FunCheckoutHistoryDetail.tsx
|
|
33547
33496
|
import React165, { useCallback as useCallback39, useMemo as useMemo50, useState as useState52 } from "react";
|
|
33548
33497
|
import { createPortal as createPortal7 } from "react-dom";
|
|
33549
33498
|
|
|
33550
33499
|
// src/hooks/useFunListeners.ts
|
|
33551
|
-
import { useEffect as
|
|
33500
|
+
import { useEffect as useEffect59, useRef as useRef36 } from "react";
|
|
33552
33501
|
function useCheckoutHistoryListener(activate = true, singleDepositAddr) {
|
|
33553
33502
|
const activeIntervalRef = useRef36(void 0);
|
|
33554
33503
|
const { startCheckoutHistoryListener, stopCheckoutHistoryListener } = useCheckoutHistoryContext();
|
|
33555
|
-
|
|
33504
|
+
useEffect59(() => {
|
|
33556
33505
|
if (activate) {
|
|
33557
33506
|
const createdIntervalId = startCheckoutHistoryListener(
|
|
33558
33507
|
/* singleDepositAddr */
|
|
@@ -33705,7 +33654,7 @@ function FunCheckoutHistoryContent({
|
|
|
33705
33654
|
initDirectExecution: directExecutionInfo
|
|
33706
33655
|
});
|
|
33707
33656
|
const isDirectExecutionRecord = isCheckoutHistoryDirectExecution(depositAddress);
|
|
33708
|
-
|
|
33657
|
+
useEffect60(() => {
|
|
33709
33658
|
if (isDirectExecutionRecord) {
|
|
33710
33659
|
if (directExecution) {
|
|
33711
33660
|
onHistoryItemChange?.({
|
|
@@ -33813,7 +33762,7 @@ function WithdrawalTypeSelect({
|
|
|
33813
33762
|
}
|
|
33814
33763
|
|
|
33815
33764
|
// src/modals/WithdrawalModal/useTrackWithdrawalEvents.ts
|
|
33816
|
-
import { useCallback as useCallback40, useEffect as
|
|
33765
|
+
import { useCallback as useCallback40, useEffect as useEffect61, useRef as useRef37 } from "react";
|
|
33817
33766
|
function getCompletionState(step) {
|
|
33818
33767
|
switch (step) {
|
|
33819
33768
|
case "PENDING_CALLBACK" /* PENDING_CALLBACK */:
|
|
@@ -33857,16 +33806,16 @@ function useTrackWithdrawalEvents({
|
|
|
33857
33806
|
}));
|
|
33858
33807
|
});
|
|
33859
33808
|
const checkoutId = checkoutItem?.id;
|
|
33860
|
-
|
|
33809
|
+
useEffect61(() => {
|
|
33861
33810
|
if (checkoutId && claimAnalyticsEvent("fc_modal_opened" /* MODAL_OPENED */, checkoutId)) {
|
|
33862
33811
|
trackModalOpened();
|
|
33863
33812
|
}
|
|
33864
|
-
}, [checkoutId
|
|
33813
|
+
}, [checkoutId]);
|
|
33865
33814
|
const trackedCheckoutIdRef = useRef37(null);
|
|
33866
33815
|
const lastViewedStepRef = useRef37(null);
|
|
33867
33816
|
const stepIndexRef = useRef37(1);
|
|
33868
33817
|
const stepHistoryRef = useRef37([]);
|
|
33869
|
-
|
|
33818
|
+
useEffect61(() => {
|
|
33870
33819
|
if (!open) {
|
|
33871
33820
|
trackedCheckoutIdRef.current = null;
|
|
33872
33821
|
lastViewedStepRef.current = null;
|
|
@@ -33983,13 +33932,13 @@ function WithdrawalModal({
|
|
|
33983
33932
|
"SELECT_METHOD" /* SELECT_METHOD */,
|
|
33984
33933
|
"ENTER_AMOUNT" /* ENTER_AMOUNT */
|
|
33985
33934
|
].includes(step);
|
|
33986
|
-
|
|
33935
|
+
useEffect62(() => {
|
|
33987
33936
|
setNavigation({
|
|
33988
33937
|
isBackNavigation: false,
|
|
33989
33938
|
step: isInitialStepSelectMethod ? "SELECT_METHOD" /* SELECT_METHOD */ : "ENTER_AMOUNT" /* ENTER_AMOUNT */
|
|
33990
33939
|
});
|
|
33991
33940
|
}, [isInitialStepSelectMethod]);
|
|
33992
|
-
|
|
33941
|
+
useEffect62(() => {
|
|
33993
33942
|
if (step === "SELECT_METHOD" /* SELECT_METHOD */) {
|
|
33994
33943
|
isMethodSelectionInFlight.current = false;
|
|
33995
33944
|
}
|
|
@@ -34284,13 +34233,13 @@ import React185 from "react";
|
|
|
34284
34233
|
|
|
34285
34234
|
// src/modals/ProfileDetails/ActivityTraversalContext.tsx
|
|
34286
34235
|
import React170, {
|
|
34287
|
-
createContext as
|
|
34236
|
+
createContext as createContext21,
|
|
34288
34237
|
useCallback as useCallback42,
|
|
34289
|
-
useContext as
|
|
34238
|
+
useContext as useContext21,
|
|
34290
34239
|
useMemo as useMemo51,
|
|
34291
34240
|
useState as useState54
|
|
34292
34241
|
} from "react";
|
|
34293
|
-
var ActivityTraversalContext =
|
|
34242
|
+
var ActivityTraversalContext = createContext21({
|
|
34294
34243
|
selectedPurchaseId: void 0,
|
|
34295
34244
|
selectedPurchaseInitView: void 0,
|
|
34296
34245
|
returnView: void 0,
|
|
@@ -34351,7 +34300,7 @@ var ActivityTraversalProvider = ({
|
|
|
34351
34300
|
return /* @__PURE__ */ React170.createElement(ActivityTraversalContext.Provider, { value: contextValue }, children);
|
|
34352
34301
|
};
|
|
34353
34302
|
var useActivityTraversal = () => {
|
|
34354
|
-
return
|
|
34303
|
+
return useContext21(ActivityTraversalContext);
|
|
34355
34304
|
};
|
|
34356
34305
|
|
|
34357
34306
|
// src/modals/ProfileDetails/ProfileDetails.tsx
|
|
@@ -34416,7 +34365,7 @@ function useCheckoutModalTitle(depositAddress, defaultTitle) {
|
|
|
34416
34365
|
import { IN_PROGRESS_CHECKOUT_STATES as IN_PROGRESS_CHECKOUT_STATES2 } from "@funkit/api-base";
|
|
34417
34366
|
import { formatTimestampToDate, fullMonthNames } from "@funkit/utils";
|
|
34418
34367
|
import clsx20 from "clsx";
|
|
34419
|
-
import React180, { useEffect as
|
|
34368
|
+
import React180, { useEffect as useEffect64, useMemo as useMemo52, useRef as useRef40, useState as useState56 } from "react";
|
|
34420
34369
|
import { Virtuoso } from "react-virtuoso";
|
|
34421
34370
|
|
|
34422
34371
|
// src/consts/layout.ts
|
|
@@ -34805,14 +34754,14 @@ import { useCallback as useCallback43, useState as useState55 } from "react";
|
|
|
34805
34754
|
|
|
34806
34755
|
// src/components/FunSelect/FunClickOutside.tsx
|
|
34807
34756
|
import React177 from "react";
|
|
34808
|
-
import { useEffect as
|
|
34757
|
+
import { useEffect as useEffect63, useRef as useRef39 } from "react";
|
|
34809
34758
|
function FunClickOutside({
|
|
34810
34759
|
children,
|
|
34811
34760
|
onClick
|
|
34812
34761
|
}) {
|
|
34813
34762
|
const wrapperRef = useRef39(null);
|
|
34814
34763
|
const isShadowDomEnabled = useFeatureGate("enable-shadow-dom");
|
|
34815
|
-
|
|
34764
|
+
useEffect63(() => {
|
|
34816
34765
|
const handleClickListener = (event) => {
|
|
34817
34766
|
const wrapper = wrapperRef.current;
|
|
34818
34767
|
const clickedInside = isShadowDomEnabled ? !!wrapper && event.composedPath().includes(wrapper) : wrapper?.contains(event.target);
|
|
@@ -34997,7 +34946,7 @@ function Home({
|
|
|
34997
34946
|
const { checkoutHistoryList, isCheckoutHistoryInited } = useCheckoutHistoryContext();
|
|
34998
34947
|
const { returnViewPresets } = useActivityTraversal();
|
|
34999
34948
|
const { animation: tabAnimation, navigateTo } = useAnimatedNavigation(setSelectedView);
|
|
35000
|
-
|
|
34949
|
+
useEffect64(() => {
|
|
35001
34950
|
const virtuosoDiv = virtuosoParentRef.current?.firstChild;
|
|
35002
34951
|
virtuosoDiv?.classList.add(animateVirtuosoInClass);
|
|
35003
34952
|
}, []);
|
|
@@ -35172,7 +35121,7 @@ import React183 from "react";
|
|
|
35172
35121
|
import React182 from "react";
|
|
35173
35122
|
|
|
35174
35123
|
// src/hooks/useCopyToClipboard.ts
|
|
35175
|
-
import { useCallback as useCallback44, useEffect as
|
|
35124
|
+
import { useCallback as useCallback44, useEffect as useEffect65, useState as useState57 } from "react";
|
|
35176
35125
|
var useCopyToClipboard = (text, delay = 1500) => {
|
|
35177
35126
|
const [isCopied, setCopied] = useState57(false);
|
|
35178
35127
|
const handleCopy = useCallback44(() => {
|
|
@@ -35182,7 +35131,7 @@ var useCopyToClipboard = (text, delay = 1500) => {
|
|
|
35182
35131
|
navigator.clipboard.writeText(text);
|
|
35183
35132
|
setCopied(true);
|
|
35184
35133
|
}, [text]);
|
|
35185
|
-
|
|
35134
|
+
useEffect65(() => {
|
|
35186
35135
|
if (!isCopied) {
|
|
35187
35136
|
return;
|
|
35188
35137
|
}
|
|
@@ -35720,13 +35669,13 @@ function ChainModal({ onClose, open }) {
|
|
|
35720
35669
|
}
|
|
35721
35670
|
|
|
35722
35671
|
// src/modals/CheckoutModal/FunCheckoutModal.tsx
|
|
35723
|
-
import React330, { useEffect as
|
|
35672
|
+
import React330, { useEffect as useEffect100, useLayoutEffect as useLayoutEffect3, useRef as useRef62 } from "react";
|
|
35724
35673
|
|
|
35725
35674
|
// src/components/FunConnectOptions/FunConnectOptions.tsx
|
|
35726
35675
|
import React198, { useCallback as useCallback46, useMemo as useMemo54, useState as useState61 } from "react";
|
|
35727
35676
|
|
|
35728
35677
|
// src/components/FunConnectOptions/FunConnectResultStep.tsx
|
|
35729
|
-
import React193, { useEffect as
|
|
35678
|
+
import React193, { useEffect as useEffect66 } from "react";
|
|
35730
35679
|
|
|
35731
35680
|
// src/components/FunMessage/FunMessage.tsx
|
|
35732
35681
|
import React191 from "react";
|
|
@@ -35930,7 +35879,7 @@ var FunConnectResultStep = ({
|
|
|
35930
35879
|
qrCodeUri
|
|
35931
35880
|
}) => {
|
|
35932
35881
|
const hasAutoclose = type === "success";
|
|
35933
|
-
|
|
35882
|
+
useEffect66(() => {
|
|
35934
35883
|
if (!hasAutoclose) {
|
|
35935
35884
|
return;
|
|
35936
35885
|
}
|
|
@@ -36415,6 +36364,24 @@ function useIsCheckoutComplete(depositAddress) {
|
|
|
36415
36364
|
return false;
|
|
36416
36365
|
}
|
|
36417
36366
|
|
|
36367
|
+
// src/hooks/useSwappedBuyingCrypto.ts
|
|
36368
|
+
import {
|
|
36369
|
+
getSwappedBuyingCrypto
|
|
36370
|
+
} from "@funkit/connect-core";
|
|
36371
|
+
import { useMemo as useMemo55 } from "react";
|
|
36372
|
+
function useSwappedBuyingCrypto(config) {
|
|
36373
|
+
const isGateEnabled = useFeatureGate("enable-swapped-destination-token");
|
|
36374
|
+
const { targetAssetTicker, iconSrc, showFiatDestinationToken } = config;
|
|
36375
|
+
return useMemo55(
|
|
36376
|
+
() => getSwappedBuyingCrypto({
|
|
36377
|
+
show: isGateEnabled && showFiatDestinationToken !== false,
|
|
36378
|
+
targetAssetTicker,
|
|
36379
|
+
iconSrc: iconSrc ?? void 0
|
|
36380
|
+
}),
|
|
36381
|
+
[isGateEnabled, showFiatDestinationToken, targetAssetTicker, iconSrc]
|
|
36382
|
+
);
|
|
36383
|
+
}
|
|
36384
|
+
|
|
36418
36385
|
// src/hooks/usePaymentSources.ts
|
|
36419
36386
|
import { isNotNullish as isNotNullish6 } from "@funkit/utils";
|
|
36420
36387
|
|
|
@@ -36660,10 +36627,10 @@ var FunCheckoutBlocked = ({ reason }) => {
|
|
|
36660
36627
|
};
|
|
36661
36628
|
|
|
36662
36629
|
// src/modals/CheckoutModal/CheckoutModalPrefetchedHooks.tsx
|
|
36663
|
-
import React201, { useEffect as
|
|
36630
|
+
import React201, { useEffect as useEffect68 } from "react";
|
|
36664
36631
|
|
|
36665
36632
|
// src/modals/PolymarketPerpsTransfer/PolymarketPerpsPrefetch.tsx
|
|
36666
|
-
import React200, { useEffect as
|
|
36633
|
+
import React200, { useEffect as useEffect67, useMemo as useMemo56 } from "react";
|
|
36667
36634
|
|
|
36668
36635
|
// src/domains/polymarketPerps.ts
|
|
36669
36636
|
import { getAddress as getAddress4 } from "viem";
|
|
@@ -36701,7 +36668,7 @@ import {
|
|
|
36701
36668
|
RailConfigType as RailConfigType3,
|
|
36702
36669
|
getFops as getFops3
|
|
36703
36670
|
} from "@funkit/api-base";
|
|
36704
|
-
import { solanaChain as
|
|
36671
|
+
import { solanaChain as solanaChain6 } from "@funkit/chains";
|
|
36705
36672
|
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
36706
36673
|
import {
|
|
36707
36674
|
buildSwappedThirdPartyPaymentConfigs as buildSwappedThirdPartyPaymentConfigs2,
|
|
@@ -36771,7 +36738,7 @@ var useFops = ({
|
|
|
36771
36738
|
}
|
|
36772
36739
|
const destinationToken = { chainId: targetChain, address: targetAsset };
|
|
36773
36740
|
const secondaryDestinationToken = {
|
|
36774
|
-
chainId:
|
|
36741
|
+
chainId: solanaChain6.id.toString(),
|
|
36775
36742
|
address: NATIVE_TOKEN
|
|
36776
36743
|
};
|
|
36777
36744
|
const thirdPartyPaymentConfigs = buildSwappedThirdPartyPaymentConfigs2({
|
|
@@ -36921,7 +36888,7 @@ var placeholderFops = {
|
|
|
36921
36888
|
// src/modals/PolymarketPerpsTransfer/PolymarketPerpsPrefetch.tsx
|
|
36922
36889
|
function InactiveAccountQueries({ routingId }) {
|
|
36923
36890
|
useFops({ trackStepReadiness: false });
|
|
36924
|
-
|
|
36891
|
+
useEffect67(() => {
|
|
36925
36892
|
logger.info("polymarket:prefetch:inactiveAccount", { routingId });
|
|
36926
36893
|
}, [routingId]);
|
|
36927
36894
|
return null;
|
|
@@ -36929,7 +36896,7 @@ function InactiveAccountQueries({ routingId }) {
|
|
|
36929
36896
|
function PolymarketPerpsPrefetch() {
|
|
36930
36897
|
const { checkoutItem } = useCheckoutContext();
|
|
36931
36898
|
const config = checkoutItem?.initSettings.config;
|
|
36932
|
-
const inactiveConfig =
|
|
36899
|
+
const inactiveConfig = useMemo56(
|
|
36933
36900
|
() => config ? resolveInactivePolymarketAccountConfig(config) : void 0,
|
|
36934
36901
|
[config]
|
|
36935
36902
|
);
|
|
@@ -37418,14 +37385,14 @@ function CheckoutModalPrefetchedHooks() {
|
|
|
37418
37385
|
const { address: walletAddress } = useAccount();
|
|
37419
37386
|
const { setTargetAssetSupportsPermit, setTargetAssetPoolAllowance } = useQuoteContext();
|
|
37420
37387
|
const aavePermitSupported = useAaveTargetReservePermit(checkoutItem);
|
|
37421
|
-
|
|
37388
|
+
useEffect68(() => {
|
|
37422
37389
|
setTargetAssetSupportsPermit(aavePermitSupported);
|
|
37423
37390
|
}, [aavePermitSupported, setTargetAssetSupportsPermit]);
|
|
37424
37391
|
const aavePoolAllowance = useAaveTargetPoolAllowance(
|
|
37425
37392
|
checkoutItem,
|
|
37426
37393
|
walletAddress
|
|
37427
37394
|
);
|
|
37428
|
-
|
|
37395
|
+
useEffect68(() => {
|
|
37429
37396
|
setTargetAssetPoolAllowance(aavePoolAllowance);
|
|
37430
37397
|
}, [aavePoolAllowance, setTargetAssetPoolAllowance]);
|
|
37431
37398
|
return /* @__PURE__ */ React201.createElement(PolymarketPerpsPrefetch, null);
|
|
@@ -37433,7 +37400,7 @@ function CheckoutModalPrefetchedHooks() {
|
|
|
37433
37400
|
|
|
37434
37401
|
// src/modals/CheckoutModal/TransferToken/CheckoutNotifications.tsx
|
|
37435
37402
|
import clsx23 from "clsx";
|
|
37436
|
-
import React207, { useCallback as useCallback52, useEffect as
|
|
37403
|
+
import React207, { useCallback as useCallback52, useEffect as useEffect74, useMemo as useMemo57, useState as useState65 } from "react";
|
|
37437
37404
|
|
|
37438
37405
|
// src/components/FunNotificationBanner/FunNotificationShowMoreButton.tsx
|
|
37439
37406
|
import React202 from "react";
|
|
@@ -37552,10 +37519,10 @@ function consumeQrNotificationObserved(checkoutId) {
|
|
|
37552
37519
|
|
|
37553
37520
|
// src/hooks/useOnNewNotification.ts
|
|
37554
37521
|
import { safeParseJson as safeParseJson3 } from "@funkit/utils";
|
|
37555
|
-
import { useEffect as
|
|
37522
|
+
import { useEffect as useEffect69 } from "react";
|
|
37556
37523
|
var storageKey5 = "fkc-processed-notifications";
|
|
37557
37524
|
var useOnNewNotification = (combinedNotifications, cb) => {
|
|
37558
|
-
|
|
37525
|
+
useEffect69(() => {
|
|
37559
37526
|
const alreadyProcessed = safeParseJsonObject(
|
|
37560
37527
|
sessionStorage.getItem(storageKey5)
|
|
37561
37528
|
);
|
|
@@ -37602,7 +37569,7 @@ import React205 from "react";
|
|
|
37602
37569
|
|
|
37603
37570
|
// src/components/FunNotificationBanner/FunNotificationBanner.tsx
|
|
37604
37571
|
import { AnimatePresence as AnimatePresence4, motion as motion11 } from "motion/react";
|
|
37605
|
-
import React204, { useEffect as
|
|
37572
|
+
import React204, { useEffect as useEffect71, useRef as useRef42, useState as useState63 } from "react";
|
|
37606
37573
|
import clsx22 from "clsx";
|
|
37607
37574
|
|
|
37608
37575
|
// src/components/FunNotificationBanner/FunNotificationBanner.css.ts
|
|
@@ -37612,7 +37579,7 @@ var showMoreButtonStyle = "_4yitd93 _1rsrm2f1rd _1rsrm2f1i _1rsrm2f1f _1rsrm2f11
|
|
|
37612
37579
|
// src/components/FunNotificationBanner/FunNotificationBannerIcon.tsx
|
|
37613
37580
|
import clsx21 from "clsx";
|
|
37614
37581
|
import { motion as motion10, useAnimate as useAnimate2 } from "motion/react";
|
|
37615
|
-
import React203, { useCallback as useCallback48, useEffect as
|
|
37582
|
+
import React203, { useCallback as useCallback48, useEffect as useEffect70, useRef as useRef41 } from "react";
|
|
37616
37583
|
|
|
37617
37584
|
// src/components/FunNotificationBanner/FunNotificationBannerIcon.css.ts
|
|
37618
37585
|
var STATUS_SPINNER_BOTTOM_POSITION = -5;
|
|
@@ -38094,7 +38061,7 @@ var FunNotificationBannerIcon = ({
|
|
|
38094
38061
|
]);
|
|
38095
38062
|
}, [animate]);
|
|
38096
38063
|
const statusRef = useRef41(status);
|
|
38097
|
-
|
|
38064
|
+
useEffect70(() => {
|
|
38098
38065
|
if (statusRef.current !== status) {
|
|
38099
38066
|
if (statusRef.current === "processing" && status === "completed") {
|
|
38100
38067
|
triggerAnimationProcessingToCompleted();
|
|
@@ -38163,7 +38130,7 @@ var FunNotificationBanner = ({
|
|
|
38163
38130
|
const [isOpen, setIsOpen] = useState63(true);
|
|
38164
38131
|
const prevStatusRef = useRef42(status);
|
|
38165
38132
|
const prevStatus = prevStatusRef.current;
|
|
38166
|
-
|
|
38133
|
+
useEffect71(() => {
|
|
38167
38134
|
prevStatusRef.current = status;
|
|
38168
38135
|
}, [status]);
|
|
38169
38136
|
const direction = status && prevStatus && prevStatus !== status && (STATUS_RANK[status] ?? 0) < (STATUS_RANK[prevStatus] ?? 0) ? -1 : 1;
|
|
@@ -38373,7 +38340,7 @@ var useCheckout = (depositAddress, initial) => {
|
|
|
38373
38340
|
};
|
|
38374
38341
|
|
|
38375
38342
|
// src/modals/CheckoutModal/TransferToken/useTransferTokenTracking.ts
|
|
38376
|
-
import { useCallback as useCallback50, useEffect as
|
|
38343
|
+
import { useCallback as useCallback50, useEffect as useEffect72, useRef as useRef43, useState as useState64 } from "react";
|
|
38377
38344
|
|
|
38378
38345
|
// src/hooks/track/analytics/useDepositAnalytics.ts
|
|
38379
38346
|
import { useCallback as useCallback49 } from "react";
|
|
@@ -38472,6 +38439,7 @@ function useDepositAnalytics() {
|
|
|
38472
38439
|
target_chain: args.target.chainId
|
|
38473
38440
|
}));
|
|
38474
38441
|
},
|
|
38442
|
+
// oxlint-disable-next-line react-hooks/exhaustive-deps -- TODO(review): suppressed when the rule was turned on
|
|
38475
38443
|
[logEventV2]
|
|
38476
38444
|
);
|
|
38477
38445
|
const trackDepositAmountConfirmed = useCallback49(
|
|
@@ -38516,6 +38484,7 @@ function useDepositAnalytics() {
|
|
|
38516
38484
|
target_asset_ticker: config.targetAssetTicker || null
|
|
38517
38485
|
}));
|
|
38518
38486
|
},
|
|
38487
|
+
// oxlint-disable-next-line react-hooks/exhaustive-deps -- TODO(review): suppressed when the rule was turned on
|
|
38519
38488
|
[config, connectorId, logEventV2]
|
|
38520
38489
|
);
|
|
38521
38490
|
const trackDepositTransferBreakdownClicked = useCallback49(
|
|
@@ -38578,6 +38547,7 @@ function useDepositAnalytics() {
|
|
|
38578
38547
|
trade_type: "EXACT_IN" /* EXACT_IN */
|
|
38579
38548
|
}));
|
|
38580
38549
|
},
|
|
38550
|
+
// oxlint-disable-next-line react-hooks/exhaustive-deps -- TODO(review): suppressed when the rule was turned on
|
|
38581
38551
|
[config, connectorId, logEventV2, paymentMethodInfo, payerWallets]
|
|
38582
38552
|
);
|
|
38583
38553
|
const trackDepositQuoteConfirmed = useCallback49(
|
|
@@ -38714,7 +38684,7 @@ function useTransferTokenTracking({
|
|
|
38714
38684
|
const nextInteractionIdRef = useRef43(0);
|
|
38715
38685
|
const lastEmittedInteractionIdRef = useRef43(0);
|
|
38716
38686
|
const interactionCountRef = useRef43(0);
|
|
38717
|
-
|
|
38687
|
+
useEffect72(() => {
|
|
38718
38688
|
if (checkoutId && depositAddress) {
|
|
38719
38689
|
registerQrPaymentTarget(checkoutId, depositAddress);
|
|
38720
38690
|
}
|
|
@@ -38727,7 +38697,7 @@ function useTransferTokenTracking({
|
|
|
38727
38697
|
},
|
|
38728
38698
|
[]
|
|
38729
38699
|
);
|
|
38730
|
-
|
|
38700
|
+
useEffect72(() => {
|
|
38731
38701
|
if (!pendingInteraction || pendingInteraction.expectedSourceChain !== fromChainId || pendingInteraction.expectedSourceTicker !== fromTokenSymbol || !fromTokenAddress || !depositAddress || !targetChainId || !targetTokenAddress || lastEmittedInteractionIdRef.current >= pendingInteraction.id) {
|
|
38732
38702
|
return;
|
|
38733
38703
|
}
|
|
@@ -38766,7 +38736,7 @@ function useTransferTokenTracking({
|
|
|
38766
38736
|
targetTokenSymbol,
|
|
38767
38737
|
trackDepositTransferInteracted
|
|
38768
38738
|
]);
|
|
38769
|
-
|
|
38739
|
+
useEffect72(() => {
|
|
38770
38740
|
if (depositAddress && fromChainId && toChainId && toTokenAddress) {
|
|
38771
38741
|
setTokenTransferAddressShownAtMs({
|
|
38772
38742
|
fromChainId,
|
|
@@ -38936,7 +38906,7 @@ function useNotificationTracking({
|
|
|
38936
38906
|
itemRef.current = item;
|
|
38937
38907
|
statusRef.current = status;
|
|
38938
38908
|
const id = item ? getNotificationId(item) : null;
|
|
38939
|
-
|
|
38909
|
+
useEffect72(() => {
|
|
38940
38910
|
if (!id || !itemRef.current) {
|
|
38941
38911
|
depositNotificationDisplayRef.current = null;
|
|
38942
38912
|
return;
|
|
@@ -38981,8 +38951,8 @@ function useNotificationTracking({
|
|
|
38981
38951
|
);
|
|
38982
38952
|
notificationDisplayedAtRef.current = null;
|
|
38983
38953
|
};
|
|
38984
|
-
}, [id, logEvent
|
|
38985
|
-
|
|
38954
|
+
}, [id, logEvent]);
|
|
38955
|
+
useEffect72(() => {
|
|
38986
38956
|
if (!itemRef.current || !notificationDisplayedAtRef.current) {
|
|
38987
38957
|
return;
|
|
38988
38958
|
}
|
|
@@ -39021,7 +38991,7 @@ function useNotificationTracking({
|
|
|
39021
38991
|
});
|
|
39022
38992
|
}
|
|
39023
38993
|
reasonRef.current = "dismissed";
|
|
39024
|
-
}, [logEvent
|
|
38994
|
+
}, [logEvent]);
|
|
39025
38995
|
const trackShowMore = useCallback50(() => {
|
|
39026
38996
|
if (!itemRef.current || !notificationDisplayedAtRef.current) {
|
|
39027
38997
|
return;
|
|
@@ -39041,7 +39011,7 @@ function useNotificationTracking({
|
|
|
39041
39011
|
status: statusRef.current
|
|
39042
39012
|
});
|
|
39043
39013
|
}
|
|
39044
|
-
}, [logEvent
|
|
39014
|
+
}, [logEvent]);
|
|
39045
39015
|
return { trackDismissal, trackShowMore };
|
|
39046
39016
|
}
|
|
39047
39017
|
function getNotificationDisplayedEventData(item, status, addressDisplayedAtMs) {
|
|
@@ -39491,10 +39461,10 @@ function useSaveTransferTokenOnDeposit() {
|
|
|
39491
39461
|
}
|
|
39492
39462
|
|
|
39493
39463
|
// src/modals/CheckoutModal/TransferToken/useTrackDepositNotificationEvents.ts
|
|
39494
|
-
import { useEffect as
|
|
39464
|
+
import { useEffect as useEffect73 } from "react";
|
|
39495
39465
|
function useTrackDepositNotificationEvents(items) {
|
|
39496
39466
|
const { trackExecutionProgressEvents } = useTrackExecutionProgressEvents("deposit");
|
|
39497
|
-
|
|
39467
|
+
useEffect73(() => {
|
|
39498
39468
|
for (const item of items) {
|
|
39499
39469
|
trackExecutionProgressEvents(item);
|
|
39500
39470
|
}
|
|
@@ -39516,25 +39486,25 @@ var CheckoutNotifications = ({
|
|
|
39516
39486
|
const [closedNotifications, setClosedNotifications] = useState65([]);
|
|
39517
39487
|
const { data: checkouts } = useRecentCheckouts({ isVisible });
|
|
39518
39488
|
const { data: directExecutions } = useRecentDeposits({ isVisible });
|
|
39519
|
-
const mergedDirectExecutions =
|
|
39489
|
+
const mergedDirectExecutions = useMemo57(
|
|
39520
39490
|
() => processRecentDepositsForNotifications(directExecutions, {
|
|
39521
39491
|
variant
|
|
39522
39492
|
}),
|
|
39523
39493
|
[directExecutions, variant]
|
|
39524
39494
|
);
|
|
39525
|
-
|
|
39495
|
+
useEffect74(() => {
|
|
39526
39496
|
if (initialCheckouts || !checkouts) {
|
|
39527
39497
|
return;
|
|
39528
39498
|
}
|
|
39529
39499
|
setInitialCheckouts(checkouts);
|
|
39530
39500
|
}, [initialCheckouts, checkouts]);
|
|
39531
|
-
|
|
39501
|
+
useEffect74(() => {
|
|
39532
39502
|
if (initialDirectExecutions || !directExecutions) {
|
|
39533
39503
|
return;
|
|
39534
39504
|
}
|
|
39535
39505
|
setInitialDirectExecutions(directExecutions);
|
|
39536
39506
|
}, [initialDirectExecutions, directExecutions]);
|
|
39537
|
-
const displayedDirectExecutions =
|
|
39507
|
+
const displayedDirectExecutions = useMemo57(() => {
|
|
39538
39508
|
if (!mergedDirectExecutions || !initialDirectExecutions) {
|
|
39539
39509
|
return [];
|
|
39540
39510
|
}
|
|
@@ -39546,13 +39516,13 @@ var CheckoutNotifications = ({
|
|
|
39546
39516
|
return !closedNotifications.includes(notificationKey);
|
|
39547
39517
|
}).slice(0, MAX_COUNT);
|
|
39548
39518
|
}, [initialDirectExecutions, mergedDirectExecutions, closedNotifications]);
|
|
39549
|
-
const displayedCheckouts =
|
|
39519
|
+
const displayedCheckouts = useMemo57(() => {
|
|
39550
39520
|
if (!checkouts || !initialCheckouts) {
|
|
39551
39521
|
return [];
|
|
39552
39522
|
}
|
|
39553
39523
|
return getUpdatedCheckouts(checkouts, initialCheckouts).filter(({ depositAddr }) => !closedNotifications.includes(depositAddr)).slice(0, MAX_COUNT);
|
|
39554
39524
|
}, [initialCheckouts, checkouts, closedNotifications]);
|
|
39555
|
-
const combinedNotifications =
|
|
39525
|
+
const combinedNotifications = useMemo57(() => {
|
|
39556
39526
|
return [
|
|
39557
39527
|
...displayedDirectExecutions.map(
|
|
39558
39528
|
(item) => ({ ...item, isDirectExecution: true })
|
|
@@ -39563,7 +39533,7 @@ var CheckoutNotifications = ({
|
|
|
39563
39533
|
].sort((a, b) => b.createdTimeMs - a.createdTimeMs);
|
|
39564
39534
|
}, [displayedDirectExecutions, displayedCheckouts]);
|
|
39565
39535
|
useTrackDepositNotificationEvents(combinedNotifications);
|
|
39566
|
-
|
|
39536
|
+
useEffect74(() => {
|
|
39567
39537
|
if (!isVisible || !checkoutItem) {
|
|
39568
39538
|
return;
|
|
39569
39539
|
}
|
|
@@ -39575,7 +39545,7 @@ var CheckoutNotifications = ({
|
|
|
39575
39545
|
);
|
|
39576
39546
|
}
|
|
39577
39547
|
}, [checkoutItem, combinedNotifications, isVisible]);
|
|
39578
|
-
const displayedNotifications =
|
|
39548
|
+
const displayedNotifications = useMemo57(() => {
|
|
39579
39549
|
return isExpanded ? combinedNotifications : combinedNotifications.slice(0, COLLAPSED_COUNT);
|
|
39580
39550
|
}, [isExpanded, combinedNotifications]);
|
|
39581
39551
|
const handleNotificationClose = (id) => setClosedNotifications((prev) => [...prev, id]);
|
|
@@ -39958,17 +39928,17 @@ function selectSuccessScreenBackground({
|
|
|
39958
39928
|
// src/modals/CheckoutModal/stepTransition.ts
|
|
39959
39929
|
import {
|
|
39960
39930
|
useCallback as useCallback72,
|
|
39961
|
-
useEffect as
|
|
39931
|
+
useEffect as useEffect98,
|
|
39962
39932
|
useRef as useRef61,
|
|
39963
39933
|
useState as useState95
|
|
39964
39934
|
} from "react";
|
|
39965
39935
|
|
|
39966
39936
|
// src/hooks/useCheckoutQuoteNotification.ts
|
|
39967
|
-
import { useMemo as
|
|
39937
|
+
import { useMemo as useMemo58 } from "react";
|
|
39968
39938
|
function useCheckoutQuoteNotification() {
|
|
39969
39939
|
const { clearCheckoutQuoteMessages } = useQuoteContext();
|
|
39970
39940
|
const { quoteError, quoteStepMessage } = useQuoteContext();
|
|
39971
|
-
const quoteNotification =
|
|
39941
|
+
const quoteNotification = useMemo58(() => {
|
|
39972
39942
|
if (quoteError) {
|
|
39973
39943
|
return {
|
|
39974
39944
|
messageType: "error",
|
|
@@ -41380,7 +41350,7 @@ function VirtualFiatAccount({
|
|
|
41380
41350
|
|
|
41381
41351
|
// src/modals/PolymarketPerpsTransfer/PerpsTransferStep.tsx
|
|
41382
41352
|
import { useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
41383
|
-
import React238, { useEffect as
|
|
41353
|
+
import React238, { useEffect as useEffect76, useRef as useRef46, useState as useState69 } from "react";
|
|
41384
41354
|
import { createPortal as createPortal11 } from "react-dom";
|
|
41385
41355
|
|
|
41386
41356
|
// src/modals/PolymarketPerpsTransfer/useRecordPerpsTransfer.ts
|
|
@@ -42052,7 +42022,7 @@ function PerpsTransferBottomBar({ form }) {
|
|
|
42052
42022
|
|
|
42053
42023
|
// src/modals/PolymarketPerpsTransfer/usePerpsTransferForm.ts
|
|
42054
42024
|
import * as dnum8 from "dnum";
|
|
42055
|
-
import { useEffect as
|
|
42025
|
+
import { useEffect as useEffect75, useState as useState68 } from "react";
|
|
42056
42026
|
function parseAmount(amount) {
|
|
42057
42027
|
return Number(amount.replace(/,/g, ""));
|
|
42058
42028
|
}
|
|
@@ -42115,7 +42085,7 @@ function usePerpsTransferForm({
|
|
|
42115
42085
|
const [direction, setDirection] = useState68(
|
|
42116
42086
|
lockedDirection ?? initialDirection
|
|
42117
42087
|
);
|
|
42118
|
-
|
|
42088
|
+
useEffect75(() => {
|
|
42119
42089
|
logger.info("polymarket:perpsTransfer:directionResolved", {
|
|
42120
42090
|
access: {
|
|
42121
42091
|
predictions: predictionsAccessible,
|
|
@@ -42134,12 +42104,12 @@ function usePerpsTransferForm({
|
|
|
42134
42104
|
perpsAccessible,
|
|
42135
42105
|
predictionsAccessible
|
|
42136
42106
|
]);
|
|
42137
|
-
|
|
42107
|
+
useEffect75(() => {
|
|
42138
42108
|
if (lockedDirection) {
|
|
42139
42109
|
setDirection(lockedDirection);
|
|
42140
42110
|
}
|
|
42141
42111
|
}, [lockedDirection]);
|
|
42142
|
-
|
|
42112
|
+
useEffect75(() => {
|
|
42143
42113
|
if (status === "success") {
|
|
42144
42114
|
setAmount("");
|
|
42145
42115
|
setAmountSelection(null);
|
|
@@ -42288,7 +42258,7 @@ function PerpsTransferStepComponent({
|
|
|
42288
42258
|
successTimerRef.current = null;
|
|
42289
42259
|
}
|
|
42290
42260
|
};
|
|
42291
|
-
|
|
42261
|
+
useEffect76(() => clearSuccessTimer, []);
|
|
42292
42262
|
const perpsTransfer = checkoutItem?.initSettings.config.polymarketPerpsTransfer;
|
|
42293
42263
|
const balances = usePolymarketAccountBalances({
|
|
42294
42264
|
predictions: perpsTransfer?.predictions,
|
|
@@ -42887,7 +42857,7 @@ import React247 from "react";
|
|
|
42887
42857
|
|
|
42888
42858
|
// src/modals/CheckoutModal/Brokerage/components/BrokerageSuccess.tsx
|
|
42889
42859
|
import { capitalizeFirstLetter } from "@funkit/utils";
|
|
42890
|
-
import React246, { useMemo as
|
|
42860
|
+
import React246, { useMemo as useMemo59 } from "react";
|
|
42891
42861
|
var BrokerageSuccess = ({
|
|
42892
42862
|
bottomBarId,
|
|
42893
42863
|
onClose,
|
|
@@ -42895,7 +42865,7 @@ var BrokerageSuccess = ({
|
|
|
42895
42865
|
}) => {
|
|
42896
42866
|
const { t } = useFunkitTranslation();
|
|
42897
42867
|
const { exchangeType } = useBluvo();
|
|
42898
|
-
const customTextConfigSteps =
|
|
42868
|
+
const customTextConfigSteps = useMemo59(() => {
|
|
42899
42869
|
if (exchangeType) {
|
|
42900
42870
|
return {
|
|
42901
42871
|
...getDefaultTextConfigSteps(t),
|
|
@@ -42971,7 +42941,7 @@ import { bluvoExecuteWithdrawal as bluvoExecuteWithdrawal2 } from "@funkit/api-b
|
|
|
42971
42941
|
// src/components/FunInput/FunTwoFaInput.tsx
|
|
42972
42942
|
import React248, {
|
|
42973
42943
|
useCallback as useCallback55,
|
|
42974
|
-
useEffect as
|
|
42944
|
+
useEffect as useEffect77,
|
|
42975
42945
|
useRef as useRef48,
|
|
42976
42946
|
useState as useState71
|
|
42977
42947
|
} from "react";
|
|
@@ -42992,7 +42962,7 @@ var FunTwoFaInput = ({
|
|
|
42992
42962
|
const [currentLength, setCurrentLength] = useState71(initialInputLength);
|
|
42993
42963
|
const [focusIndex, setFocusIndex] = useState71(0);
|
|
42994
42964
|
const [isFocused, setIsFocused] = useState71(false);
|
|
42995
|
-
|
|
42965
|
+
useEffect77(() => {
|
|
42996
42966
|
if (!value) {
|
|
42997
42967
|
setFocusIndex(0);
|
|
42998
42968
|
}
|
|
@@ -43600,7 +43570,7 @@ var TwoFactorIcon = () => /* @__PURE__ */ React249.createElement(
|
|
|
43600
43570
|
);
|
|
43601
43571
|
|
|
43602
43572
|
// src/modals/CheckoutModal/Brokerage/ConnectExchange.tsx
|
|
43603
|
-
import React252, { useCallback as useCallback56, useEffect as
|
|
43573
|
+
import React252, { useCallback as useCallback56, useEffect as useEffect78, useRef as useRef49, useState as useState73 } from "react";
|
|
43604
43574
|
import { createPortal as createPortal13 } from "react-dom";
|
|
43605
43575
|
|
|
43606
43576
|
// src/components/Icons/HandIcon.tsx
|
|
@@ -43730,7 +43700,7 @@ function ConnectExchange({
|
|
|
43730
43700
|
isConnectingRef.current = false;
|
|
43731
43701
|
}
|
|
43732
43702
|
});
|
|
43733
|
-
|
|
43703
|
+
useEffect78(() => {
|
|
43734
43704
|
if (isConnected) {
|
|
43735
43705
|
navigateToBrokerage();
|
|
43736
43706
|
}
|
|
@@ -43761,14 +43731,7 @@ function ConnectExchange({
|
|
|
43761
43731
|
} finally {
|
|
43762
43732
|
setIsLoadingBluvoModal(false);
|
|
43763
43733
|
}
|
|
43764
|
-
}, [
|
|
43765
|
-
brokerType,
|
|
43766
|
-
handleStartWithdrawal,
|
|
43767
|
-
handleAuthError,
|
|
43768
|
-
t,
|
|
43769
|
-
trackExchangeConnectFailed,
|
|
43770
|
-
trackExchangeConnectStarted
|
|
43771
|
-
]);
|
|
43734
|
+
}, [brokerType, handleStartWithdrawal, t, trackExchangeConnectStarted]);
|
|
43772
43735
|
const bottomSectionRef = useBottomSectionRef();
|
|
43773
43736
|
const { CustomComponent } = uiCustomizations.connectExchangeScreen;
|
|
43774
43737
|
return /* @__PURE__ */ React252.createElement(Box, { id: "connect-exchange" }, uiCustomizations.connectExchangeScreen.customTopComponent?.(), CustomComponent ? /* @__PURE__ */ React252.createElement(
|
|
@@ -44195,7 +44158,7 @@ function CheckoutComplete({
|
|
|
44195
44158
|
|
|
44196
44159
|
// src/modals/CheckoutModal/ConfirmationStep/ConfirmationStep.tsx
|
|
44197
44160
|
import * as dnum9 from "dnum";
|
|
44198
|
-
import React270, { useEffect as
|
|
44161
|
+
import React270, { useEffect as useEffect83, useMemo as useMemo64, useState as useState83 } from "react";
|
|
44199
44162
|
import { createPortal as createPortal16 } from "react-dom";
|
|
44200
44163
|
import { DirectExecutionType as DirectExecutionType8 } from "@funkit/api-base";
|
|
44201
44164
|
|
|
@@ -44209,13 +44172,21 @@ var ChainInfoBanners = ({ chainId: chainId2 }) => {
|
|
|
44209
44172
|
const chainBanners = chainInfoBanners[chainId2] ?? [];
|
|
44210
44173
|
return chainBanners.map((banner) => {
|
|
44211
44174
|
const { expireAtMs, ...bannerProps } = banner;
|
|
44175
|
+
const key = `${banner.message}-${chainId2}`;
|
|
44212
44176
|
if (expireAtMs && Date.now() > expireAtMs) {
|
|
44213
44177
|
return null;
|
|
44214
44178
|
}
|
|
44215
44179
|
if (expireAtMs) {
|
|
44216
|
-
return /* @__PURE__ */ React257.createElement(
|
|
44180
|
+
return /* @__PURE__ */ React257.createElement(
|
|
44181
|
+
EphemeralInfoBanner,
|
|
44182
|
+
{
|
|
44183
|
+
key,
|
|
44184
|
+
...bannerProps,
|
|
44185
|
+
expireAtMs
|
|
44186
|
+
}
|
|
44187
|
+
);
|
|
44217
44188
|
}
|
|
44218
|
-
return /* @__PURE__ */ React257.createElement(InfoBanner, { key
|
|
44189
|
+
return /* @__PURE__ */ React257.createElement(InfoBanner, { key, ...banner });
|
|
44219
44190
|
});
|
|
44220
44191
|
} catch {
|
|
44221
44192
|
logger.error("ChainInfoBanners:error", { chainId: chainId2, chainInfoBanners });
|
|
@@ -44231,7 +44202,7 @@ import {
|
|
|
44231
44202
|
} from "@funkit/utils";
|
|
44232
44203
|
import NumberFlow from "@number-flow/react";
|
|
44233
44204
|
import { motion as motion15 } from "motion/react";
|
|
44234
|
-
import React258, { useMemo as
|
|
44205
|
+
import React258, { useMemo as useMemo60 } from "react";
|
|
44235
44206
|
import { LIGHTER_CHAIN_ID } from "@funkit/chains";
|
|
44236
44207
|
|
|
44237
44208
|
// src/consts/design.ts
|
|
@@ -44296,7 +44267,7 @@ function PaymentAmountSummary({
|
|
|
44296
44267
|
const feeBreakdown = quote?.baseQuote.metadata?.feeBreakdown;
|
|
44297
44268
|
return checkoutConfig?.generateActionsParams ? feeBreakdown?.swapImpact || 0 : 0;
|
|
44298
44269
|
})();
|
|
44299
|
-
const receiveTokenUsdAmount =
|
|
44270
|
+
const receiveTokenUsdAmount = useMemo60(() => {
|
|
44300
44271
|
if (!quote) {
|
|
44301
44272
|
return void 0;
|
|
44302
44273
|
}
|
|
@@ -44937,11 +44908,11 @@ import React265 from "react";
|
|
|
44937
44908
|
|
|
44938
44909
|
// src/components/AnimatedDollarValue/AnimatedDollarValue.tsx
|
|
44939
44910
|
import NumberFlow2 from "@number-flow/react";
|
|
44940
|
-
import React263, { forwardRef as forwardRef5, useMemo as
|
|
44911
|
+
import React263, { forwardRef as forwardRef5, useMemo as useMemo61 } from "react";
|
|
44941
44912
|
var AnimatedDollarValue = forwardRef5((props, ref) => {
|
|
44942
44913
|
const { value, dynamicMinFractionDigits, ...restProps } = props;
|
|
44943
44914
|
const minimumFractionDigits = typeof value === "number" && !Number.isInteger(value) || !dynamicMinFractionDigits ? 2 : 0;
|
|
44944
|
-
const formatOptions =
|
|
44915
|
+
const formatOptions = useMemo61(
|
|
44945
44916
|
() => ({
|
|
44946
44917
|
style: "currency",
|
|
44947
44918
|
currency: "USD",
|
|
@@ -45081,7 +45052,7 @@ function CheckoutPrimaryInfo({
|
|
|
45081
45052
|
}
|
|
45082
45053
|
|
|
45083
45054
|
// src/modals/CheckoutModal/ConfirmationStep/DisclaimerText.tsx
|
|
45084
|
-
import React266, { useMemo as
|
|
45055
|
+
import React266, { useMemo as useMemo62 } from "react";
|
|
45085
45056
|
var FunLinkButtonComponent = ({
|
|
45086
45057
|
children,
|
|
45087
45058
|
href
|
|
@@ -45127,7 +45098,7 @@ var DisclaimerText = ({
|
|
|
45127
45098
|
};
|
|
45128
45099
|
function useCardDisclaimer(checkoutItem, finalConvertedAssetName) {
|
|
45129
45100
|
const { t } = useFunkitTranslation();
|
|
45130
|
-
const cardDisclaimer =
|
|
45101
|
+
const cardDisclaimer = useMemo62(() => {
|
|
45131
45102
|
if (!checkoutItem || !finalConvertedAssetName) {
|
|
45132
45103
|
return null;
|
|
45133
45104
|
}
|
|
@@ -45274,7 +45245,7 @@ function mapRetryAction(quoteBuilder, params) {
|
|
|
45274
45245
|
}
|
|
45275
45246
|
|
|
45276
45247
|
// src/modals/CheckoutModal/ConfirmationStep/useSourceAssetConfirm.tsx
|
|
45277
|
-
import { useEffect as
|
|
45248
|
+
import { useEffect as useEffect79, useState as useState77 } from "react";
|
|
45278
45249
|
function useSourceAssetConfirm(setPreloadedQuoteData) {
|
|
45279
45250
|
const { setCheckoutQuote, getCheckoutQuote, setQuoteProgress } = useQuoteContext();
|
|
45280
45251
|
const { checkoutItem, setCheckout } = useCheckoutContext();
|
|
@@ -45323,7 +45294,7 @@ function useHackyTriggerWorkaroundReactDevBrainExplode() {
|
|
|
45323
45294
|
function useTriggerQuoteAndOtherStuffsWithExtremeCaution(onResult, setPreloadedQuoteData) {
|
|
45324
45295
|
const [assetRefresh, triggerAssetConfirm] = useHackyTriggerWorkaroundReactDevBrainExplode();
|
|
45325
45296
|
const { isSourceAssetConfirming, onSourceAssetConfirmed } = useSourceAssetConfirm(setPreloadedQuoteData);
|
|
45326
|
-
|
|
45297
|
+
useEffect79(() => {
|
|
45327
45298
|
if (assetRefresh === 0) {
|
|
45328
45299
|
return;
|
|
45329
45300
|
}
|
|
@@ -45695,7 +45666,7 @@ function usePostCheckout({
|
|
|
45695
45666
|
}
|
|
45696
45667
|
|
|
45697
45668
|
// src/modals/CheckoutModal/ConfirmationStep/useQuoteRefresh.ts
|
|
45698
|
-
import { useCallback as useCallback63, useEffect as
|
|
45669
|
+
import { useCallback as useCallback63, useEffect as useEffect81, useMemo as useMemo63, useRef as useRef51, useState as useState82 } from "react";
|
|
45699
45670
|
|
|
45700
45671
|
// src/hooks/useCountdown.tsx
|
|
45701
45672
|
import React269 from "react";
|
|
@@ -45703,7 +45674,7 @@ import { useCallback as useCallback62, useState as useState81 } from "react";
|
|
|
45703
45674
|
|
|
45704
45675
|
// src/components/FunCountdown/FunCountdown.tsx
|
|
45705
45676
|
import { noop as noop5 } from "@funkit/utils";
|
|
45706
|
-
import React268, { useCallback as useCallback61, useEffect as
|
|
45677
|
+
import React268, { useCallback as useCallback61, useEffect as useEffect80, useState as useState80 } from "react";
|
|
45707
45678
|
|
|
45708
45679
|
// src/components/FunCountdown/FunCountdown.css.ts
|
|
45709
45680
|
var backgroundRing = "_1t0bc111 _1rsrm2f2mv";
|
|
@@ -45746,7 +45717,7 @@ var FunCountdown = ({
|
|
|
45746
45717
|
setRemainingSeconds((prev) => prev > 0 ? prev - 1 : prev);
|
|
45747
45718
|
}, [isPaused]);
|
|
45748
45719
|
useInterval(handleInterval, 1e3);
|
|
45749
|
-
|
|
45720
|
+
useEffect80(() => {
|
|
45750
45721
|
if (remainingSeconds === onBeforeCountdownEndsSeconds) {
|
|
45751
45722
|
onBeforeCountdownEndsOnce();
|
|
45752
45723
|
}
|
|
@@ -45756,13 +45727,7 @@ var FunCountdown = ({
|
|
|
45756
45727
|
if (remainingSeconds <= 0) {
|
|
45757
45728
|
onCountdownEndedOnce();
|
|
45758
45729
|
}
|
|
45759
|
-
}, [
|
|
45760
|
-
remainingSeconds,
|
|
45761
|
-
onCountdownEndedOnce,
|
|
45762
|
-
onBeforeCountdownEndsOnce,
|
|
45763
|
-
onCountdownLastSecondOnce,
|
|
45764
|
-
onBeforeCountdownEndsSeconds
|
|
45765
|
-
]);
|
|
45730
|
+
}, [remainingSeconds, onBeforeCountdownEndsSeconds]);
|
|
45766
45731
|
const innerContent = typeof children === "function" ? children(remainingSeconds) : children;
|
|
45767
45732
|
if (isHidden) {
|
|
45768
45733
|
return null;
|
|
@@ -45905,7 +45870,7 @@ function useQuoteRefresh({
|
|
|
45905
45870
|
const quoteCallbackRef = useRef51(void 0);
|
|
45906
45871
|
const [isPendingRefresh, setIsPendingRefresh] = useState82(false);
|
|
45907
45872
|
const [numQuoteRefreshes, setNumQuoteRefreshes] = useState82(0);
|
|
45908
|
-
|
|
45873
|
+
useEffect81(() => {
|
|
45909
45874
|
setNumQuoteRefreshes(0);
|
|
45910
45875
|
}, [checkoutId]);
|
|
45911
45876
|
const {
|
|
@@ -45982,7 +45947,7 @@ function useQuoteRefresh({
|
|
|
45982
45947
|
},
|
|
45983
45948
|
[isOnHold, restartCountdown, setCheckoutQuote, triggerAssetConfirm]
|
|
45984
45949
|
);
|
|
45985
|
-
const quoteError =
|
|
45950
|
+
const quoteError = useMemo63(() => {
|
|
45986
45951
|
if (contextQuoteError && !isQuoting) {
|
|
45987
45952
|
return {
|
|
45988
45953
|
...contextQuoteError,
|
|
@@ -45991,7 +45956,7 @@ function useQuoteRefresh({
|
|
|
45991
45956
|
}
|
|
45992
45957
|
return null;
|
|
45993
45958
|
}, [isQuoting, contextQuoteError]);
|
|
45994
|
-
|
|
45959
|
+
useEffect81(() => {
|
|
45995
45960
|
if (isPendingRefresh && !isOnHold) {
|
|
45996
45961
|
setIsPendingRefresh(false);
|
|
45997
45962
|
refreshQuote();
|
|
@@ -46009,7 +45974,7 @@ function useQuoteRefresh({
|
|
|
46009
45974
|
}
|
|
46010
45975
|
|
|
46011
45976
|
// src/modals/CheckoutModal/ConfirmationStep/useTrackDepositQuoteEvents.ts
|
|
46012
|
-
import { useCallback as useCallback64, useEffect as
|
|
45977
|
+
import { useCallback as useCallback64, useEffect as useEffect82, useRef as useRef52 } from "react";
|
|
46013
45978
|
function buildQuoteEventArgs({
|
|
46014
45979
|
checkoutConfig,
|
|
46015
45980
|
checkoutItem,
|
|
@@ -46072,10 +46037,10 @@ function useTrackDepositQuoteEvents({
|
|
|
46072
46037
|
const checkoutId = checkoutItem?.id ?? null;
|
|
46073
46038
|
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
46074
46039
|
const lastDisplayedQuoteIdRef = useRef52(null);
|
|
46075
|
-
|
|
46040
|
+
useEffect82(() => {
|
|
46076
46041
|
lastDisplayedQuoteIdRef.current = null;
|
|
46077
46042
|
}, [checkoutId]);
|
|
46078
|
-
|
|
46043
|
+
useEffect82(() => {
|
|
46079
46044
|
if (!checkoutItem?.finalDollarValue || !checkoutConfig || !latestQuote || isQuoteLoading) {
|
|
46080
46045
|
return;
|
|
46081
46046
|
}
|
|
@@ -46263,7 +46228,7 @@ function ConfirmationStep({
|
|
|
46263
46228
|
}
|
|
46264
46229
|
}
|
|
46265
46230
|
});
|
|
46266
|
-
|
|
46231
|
+
useEffect83(() => {
|
|
46267
46232
|
if (!isDirectWalletTransfer) {
|
|
46268
46233
|
triggerNewQuote({ maxRetries: 1 });
|
|
46269
46234
|
}
|
|
@@ -46291,7 +46256,7 @@ function ConfirmationStep({
|
|
|
46291
46256
|
flow: "deposit",
|
|
46292
46257
|
step: "confirmation" /* CONFIRMATION */
|
|
46293
46258
|
});
|
|
46294
|
-
const stepMessage =
|
|
46259
|
+
const stepMessage = useMemo64(() => {
|
|
46295
46260
|
if (initialQuoteStep) {
|
|
46296
46261
|
return initialQuoteStep;
|
|
46297
46262
|
}
|
|
@@ -46412,7 +46377,7 @@ function ConfirmationStep({
|
|
|
46412
46377
|
};
|
|
46413
46378
|
const isStepLoading = isInitialQuoting || isContinuing || isRefreshing || aaveSupply.isPending || nadoDirectTransfer.isPending;
|
|
46414
46379
|
const customRecipient = checkoutItem?.initSettings.config.customRecipient;
|
|
46415
|
-
const displayAmounts =
|
|
46380
|
+
const displayAmounts = useMemo64(() => {
|
|
46416
46381
|
if (!latestQuote || !checkoutConfig?.targetAssetAmount) {
|
|
46417
46382
|
return null;
|
|
46418
46383
|
}
|
|
@@ -46428,7 +46393,7 @@ function ConfirmationStep({
|
|
|
46428
46393
|
quoteBuilder
|
|
46429
46394
|
]);
|
|
46430
46395
|
const supplyHumanAmount = displayAmounts?.receiveAmount ?? (checkoutConfig?.targetAssetAmount != null ? String(checkoutConfig.targetAssetAmount) : null);
|
|
46431
|
-
const resolveHealthFactor =
|
|
46396
|
+
const resolveHealthFactor = useMemo64(
|
|
46432
46397
|
() => wrapResolveHealthFactor(checkoutConfig?.resolveHealthFactor),
|
|
46433
46398
|
[checkoutConfig?.resolveHealthFactor]
|
|
46434
46399
|
);
|
|
@@ -46442,7 +46407,7 @@ function ConfirmationStep({
|
|
|
46442
46407
|
const resolveDestinationLineItems = checkoutConfig?.resolveDestinationLineItems;
|
|
46443
46408
|
const targetHumanAmount = displayAmounts?.receiveAmount ?? (isExactIn ? null : supplyHumanAmount);
|
|
46444
46409
|
const sourceAssetInfo = checkoutItem?.selectedSourceAssetInfo;
|
|
46445
|
-
const destinationLineItems =
|
|
46410
|
+
const destinationLineItems = useMemo64(() => {
|
|
46446
46411
|
if (!resolveDestinationLineItems || !targetHumanAmount) {
|
|
46447
46412
|
return null;
|
|
46448
46413
|
}
|
|
@@ -46467,7 +46432,7 @@ function ConfirmationStep({
|
|
|
46467
46432
|
const hasStaticPrimaryInfoValue = isExactIn && checkoutItem?.inputFiatAmount != null || !isExactIn && !!checkoutConfig?.targetAssetAmount && isStablecoin(checkoutConfig.targetAssetTicker);
|
|
46468
46433
|
const checkoutId = checkoutItem?.id;
|
|
46469
46434
|
const isReady = !!checkoutItem?.finalDollarValue && !isQuoteLoading;
|
|
46470
|
-
|
|
46435
|
+
useEffect83(() => {
|
|
46471
46436
|
if (checkoutId && isReady) {
|
|
46472
46437
|
logMeasuredEvent({
|
|
46473
46438
|
eventName: "fc::ready::confirmation" /* READY_CONFIRMATION */,
|
|
@@ -46600,7 +46565,7 @@ function ConfirmationStep({
|
|
|
46600
46565
|
|
|
46601
46566
|
// src/modals/CheckoutModal/InputAmount/InputAmount.tsx
|
|
46602
46567
|
import { isMobile as isMobile13 } from "@funkit/utils";
|
|
46603
|
-
import React285, { useEffect as
|
|
46568
|
+
import React285, { useEffect as useEffect87 } from "react";
|
|
46604
46569
|
|
|
46605
46570
|
// src/hooks/queries/useMeldCurrencies.ts
|
|
46606
46571
|
import { getMeldSupportedFiat } from "@funkit/api-base";
|
|
@@ -46808,18 +46773,18 @@ import {
|
|
|
46808
46773
|
} from "@funkit/utils";
|
|
46809
46774
|
import * as dnum11 from "dnum";
|
|
46810
46775
|
import { motion as motion17 } from "motion/react";
|
|
46811
|
-
import React283, { useEffect as
|
|
46776
|
+
import React283, { useEffect as useEffect86, useMemo as useMemo68, useState as useState85 } from "react";
|
|
46812
46777
|
|
|
46813
46778
|
// src/components/AnimatedWidthWrapper/AnimatedWidthWrapper.tsx
|
|
46814
46779
|
import { motion as motion16 } from "motion/react";
|
|
46815
46780
|
import React271 from "react";
|
|
46816
|
-
import { useEffect as
|
|
46781
|
+
import { useEffect as useEffect84, useRef as useRef53, useState as useState84 } from "react";
|
|
46817
46782
|
function AnimatedWidthWrapper({ children }) {
|
|
46818
46783
|
const containerRef = useRef53(null);
|
|
46819
46784
|
const animationFrameRef = useRef53(null);
|
|
46820
46785
|
const resizeObserverRef = useRef53(null);
|
|
46821
46786
|
const [width, setWidth] = useState84("auto");
|
|
46822
|
-
|
|
46787
|
+
useEffect84(() => {
|
|
46823
46788
|
if (containerRef.current) {
|
|
46824
46789
|
resizeObserverRef.current = new ResizeObserver((entries) => {
|
|
46825
46790
|
animationFrameRef.current = requestAnimationFrame(() => {
|
|
@@ -46851,7 +46816,7 @@ function AnimatedWidthWrapper({ children }) {
|
|
|
46851
46816
|
}
|
|
46852
46817
|
|
|
46853
46818
|
// src/components/ApprovalMethodToggle/ApprovalMethodToggle.tsx
|
|
46854
|
-
import React272, { useCallback as useCallback65, useMemo as
|
|
46819
|
+
import React272, { useCallback as useCallback65, useMemo as useMemo65, useRef as useRef54 } from "react";
|
|
46855
46820
|
function ApprovalMethodToggle({
|
|
46856
46821
|
value,
|
|
46857
46822
|
onChange,
|
|
@@ -46860,7 +46825,7 @@ function ApprovalMethodToggle({
|
|
|
46860
46825
|
}) {
|
|
46861
46826
|
const { t } = useFunkitTranslation();
|
|
46862
46827
|
const tooltipAnchorRef = useRef54(null);
|
|
46863
|
-
const options =
|
|
46828
|
+
const options = useMemo65(
|
|
46864
46829
|
() => [
|
|
46865
46830
|
{ label: t("approvalMethodToggle.signedMessage"), value: "sign" },
|
|
46866
46831
|
{
|
|
@@ -48100,7 +48065,7 @@ var useCheckoutAmountLimits = ({
|
|
|
48100
48065
|
};
|
|
48101
48066
|
|
|
48102
48067
|
// src/modals/CheckoutModal/InputAmount/useAmountInput.ts
|
|
48103
|
-
import { useCallback as useCallback66, useMemo as
|
|
48068
|
+
import { useCallback as useCallback66, useMemo as useMemo66, useReducer as useReducer2, useRef as useRef55 } from "react";
|
|
48104
48069
|
|
|
48105
48070
|
// src/modals/CheckoutModal/InputAmount/state.ts
|
|
48106
48071
|
import { isTokenEquivalent as isTokenEquivalent13, round as round3 } from "@funkit/utils";
|
|
@@ -48872,7 +48837,7 @@ var MAX_AVAILABLE_WIDTH2 = 310;
|
|
|
48872
48837
|
function useAmountInput(options) {
|
|
48873
48838
|
const { t } = useFunkitTranslation();
|
|
48874
48839
|
const isMeldEnabled = useIsMeldEnabled();
|
|
48875
|
-
const [state, dispatch] =
|
|
48840
|
+
const [state, dispatch] = useReducer2(reduceState, options, initializeState);
|
|
48876
48841
|
const {
|
|
48877
48842
|
unitPrice: realUnitPrice,
|
|
48878
48843
|
checkoutConfig,
|
|
@@ -48880,7 +48845,7 @@ function useAmountInput(options) {
|
|
|
48880
48845
|
quickOptions,
|
|
48881
48846
|
paymentMethodInfo
|
|
48882
48847
|
} = options;
|
|
48883
|
-
const derivedState =
|
|
48848
|
+
const derivedState = useMemo66(
|
|
48884
48849
|
() => getDerivedState(state, checkoutConfig.targetAssetTicker),
|
|
48885
48850
|
[state, checkoutConfig]
|
|
48886
48851
|
);
|
|
@@ -49292,7 +49257,7 @@ import {
|
|
|
49292
49257
|
useQuery as useQuery23,
|
|
49293
49258
|
useQueryClient as useQueryClient5
|
|
49294
49259
|
} from "@tanstack/react-query";
|
|
49295
|
-
import { useEffect as
|
|
49260
|
+
import { useEffect as useEffect85, useMemo as useMemo67 } from "react";
|
|
49296
49261
|
import { useDebounce as useDebounce2 } from "use-debounce";
|
|
49297
49262
|
var DEBOUNCE_DELAY = 500;
|
|
49298
49263
|
var COUNTDOWN_INTERVAL_SEC = 60;
|
|
@@ -49308,7 +49273,7 @@ var useMeldQuotes = (sourceAmount, fiatCurrency, meldEnabled = true) => {
|
|
|
49308
49273
|
const checkoutId = checkoutItem?.id ?? null;
|
|
49309
49274
|
const destinationCurrencyCode = useMeldCryptoCurrencyCode();
|
|
49310
49275
|
const sourceCurrencyCode = fiatCurrency || "USD";
|
|
49311
|
-
const queryKey =
|
|
49276
|
+
const queryKey = useMemo67(
|
|
49312
49277
|
() => [
|
|
49313
49278
|
"meld",
|
|
49314
49279
|
"quotes",
|
|
@@ -49363,7 +49328,7 @@ var useMeldQuotes = (sourceAmount, fiatCurrency, meldEnabled = true) => {
|
|
|
49363
49328
|
autoRestart: true
|
|
49364
49329
|
});
|
|
49365
49330
|
const isOutdated = sourceAmount !== debouncedSourceAmount;
|
|
49366
|
-
|
|
49331
|
+
useEffect85(() => {
|
|
49367
49332
|
if (!checkoutId || isOutdated || query.isFetching || !query.isFetchedAfterMount || !query.data) {
|
|
49368
49333
|
return;
|
|
49369
49334
|
}
|
|
@@ -49587,7 +49552,7 @@ function InputAmountLoaded({
|
|
|
49587
49552
|
const isExactIn = quoteBuilder.isExactIn();
|
|
49588
49553
|
const sourceTokenKey = sourceHolding?.chainSymbolKey;
|
|
49589
49554
|
const sourceTokenChanged = modalState.sourceTokenKey != null && modalState.sourceTokenKey !== sourceTokenKey;
|
|
49590
|
-
|
|
49555
|
+
useEffect86(() => {
|
|
49591
49556
|
if (sourceTokenChanged) {
|
|
49592
49557
|
setAmountSelection({ selectType: "default", presetAmount: null });
|
|
49593
49558
|
}
|
|
@@ -49654,7 +49619,7 @@ function InputAmountLoaded({
|
|
|
49654
49619
|
}
|
|
49655
49620
|
return setFiatAmount(selectedFiat);
|
|
49656
49621
|
}
|
|
49657
|
-
|
|
49622
|
+
useEffect86(() => {
|
|
49658
49623
|
if (isInputInFiat !== modalState.isInputInFiat || fiatAmount !== modalState.fiatAmount || assetAmount !== modalState.assetAmount || sourceTokenKey !== modalState.sourceTokenKey || amountSelection.selectType !== modalState.amountSelection?.selectType || amountSelection.presetAmount !== modalState.amountSelection?.presetAmount) {
|
|
49659
49624
|
setModalState((state) => ({
|
|
49660
49625
|
...state,
|
|
@@ -49688,7 +49653,7 @@ function InputAmountLoaded({
|
|
|
49688
49653
|
fiatCurrency,
|
|
49689
49654
|
onNext
|
|
49690
49655
|
});
|
|
49691
|
-
const error =
|
|
49656
|
+
const error = useMemo68(() => {
|
|
49692
49657
|
if (isCardCheckout) {
|
|
49693
49658
|
const meldError = getMeldError();
|
|
49694
49659
|
if (meldError) {
|
|
@@ -50035,7 +50000,7 @@ function useAmountInputUI({
|
|
|
50035
50000
|
style: { ...styles }
|
|
50036
50001
|
}
|
|
50037
50002
|
};
|
|
50038
|
-
const
|
|
50003
|
+
const backdrop = /* @__PURE__ */ React283.createElement(
|
|
50039
50004
|
motion17.div,
|
|
50040
50005
|
{
|
|
50041
50006
|
initial: {
|
|
@@ -50090,7 +50055,7 @@ function useAmountInputUI({
|
|
|
50090
50055
|
inputAffix.type === "prefix" && affixElement,
|
|
50091
50056
|
/* @__PURE__ */ React283.createElement(FunInput, { ...sharedInputProps }),
|
|
50092
50057
|
inputAffix.type === "suffix" && affixElement,
|
|
50093
|
-
|
|
50058
|
+
backdrop
|
|
50094
50059
|
)
|
|
50095
50060
|
)
|
|
50096
50061
|
);
|
|
@@ -50129,7 +50094,7 @@ function useAmountInputUI({
|
|
|
50129
50094
|
borderRadius: "inputAmountSwitcher",
|
|
50130
50095
|
isDisabled: meldEnabled || isInputDisabled
|
|
50131
50096
|
},
|
|
50132
|
-
/* @__PURE__ */ React283.createElement(AnimatedWidthWrapper, null, /* @__PURE__ */ React283.createElement(Box, { display: "flex", alignItems: "center", gap: "0" }, !isInputInFiat ? /* @__PURE__ */ React283.createElement(motion17.div, { key: "fiat", layoutId: "fiat", ...motionProps.switch }, fiatDisplay,
|
|
50097
|
+
/* @__PURE__ */ React283.createElement(AnimatedWidthWrapper, null, /* @__PURE__ */ React283.createElement(Box, { display: "flex", alignItems: "center", gap: "0" }, !isInputInFiat ? /* @__PURE__ */ React283.createElement(motion17.div, { key: "fiat", layoutId: "fiat", ...motionProps.switch }, fiatDisplay, backdrop) : /* @__PURE__ */ React283.createElement(motion17.div, { key: "asset", layoutId: "asset", ...motionProps.switch }, formatCryptoAndStringify9(switchAmount), backdrop), isInputInFiat && /* @__PURE__ */ React283.createElement(motion17.div, { key: "symbol", ...motionProps.symbol }, "\xA0", switchSymbol)))
|
|
50133
50098
|
)
|
|
50134
50099
|
);
|
|
50135
50100
|
return {
|
|
@@ -50187,7 +50152,7 @@ function YouPayYouReceiveWrapper({
|
|
|
50187
50152
|
|
|
50188
50153
|
// src/modals/CheckoutModal/InputAmount/InputAmountLoading.tsx
|
|
50189
50154
|
import { formatCryptoAndStringify as formatCryptoAndStringify10 } from "@funkit/utils";
|
|
50190
|
-
import React284, { useMemo as
|
|
50155
|
+
import React284, { useMemo as useMemo69 } from "react";
|
|
50191
50156
|
function InputAmountLoading({
|
|
50192
50157
|
modalState,
|
|
50193
50158
|
sourceHoldingError,
|
|
@@ -50210,7 +50175,7 @@ function InputAmountLoading({
|
|
|
50210
50175
|
isExactIn,
|
|
50211
50176
|
sourceTokenSymbol: sourceAsset?.symbol
|
|
50212
50177
|
});
|
|
50213
|
-
const error =
|
|
50178
|
+
const error = useMemo69(() => {
|
|
50214
50179
|
if (sourceHoldingError) {
|
|
50215
50180
|
return {
|
|
50216
50181
|
code: "BALANCE_UNAVAILABLE",
|
|
@@ -50322,7 +50287,7 @@ function getLoadingAmountOptions(paymentMethod) {
|
|
|
50322
50287
|
}
|
|
50323
50288
|
|
|
50324
50289
|
// src/modals/CheckoutModal/InputAmount/useAvailableBalanceForCheckout.ts
|
|
50325
|
-
import { useMemo as
|
|
50290
|
+
import { useMemo as useMemo70 } from "react";
|
|
50326
50291
|
function useAvailableBalanceForCheckout(paymentMethodInfo, targetChainId, assetChainId, assetSymbol) {
|
|
50327
50292
|
const paymentMethod = paymentMethodInfo.paymentMethod;
|
|
50328
50293
|
const isBrokerage = paymentMethod === PaymentMethod.BROKERAGE;
|
|
@@ -50339,7 +50304,7 @@ function useAvailableBalanceForCheckout(paymentMethodInfo, targetChainId, assetC
|
|
|
50339
50304
|
[PaymentMethod.VIRTUAL_BANK]: null
|
|
50340
50305
|
}[paymentMethod];
|
|
50341
50306
|
const isLoading = isBrokerage ? isLoadingBrokerageBalance : isLoadingWalletAssetHoldings;
|
|
50342
|
-
const holdingItem =
|
|
50307
|
+
const holdingItem = useMemo70(() => {
|
|
50343
50308
|
if (!assetSymbol || !holdings) {
|
|
50344
50309
|
return;
|
|
50345
50310
|
}
|
|
@@ -50485,10 +50450,10 @@ function InputAmount(props) {
|
|
|
50485
50450
|
query: { enabled: gasFetchingEnabled }
|
|
50486
50451
|
});
|
|
50487
50452
|
const isLoaded = !!(checkoutItem && unitPrice && !sourceHoldingError && !isLoadingSourceHolding && !isMeldDefaultCurrencyLoading && (!gasFetchingEnabled || gasPriceWei !== void 0));
|
|
50488
|
-
|
|
50453
|
+
useEffect87(() => setCheckoutQuote(null), []);
|
|
50489
50454
|
const checkoutId = checkoutItem?.id;
|
|
50490
50455
|
const paymentMethod = paymentMethodInfo.paymentMethod;
|
|
50491
|
-
|
|
50456
|
+
useEffect87(() => {
|
|
50492
50457
|
if (checkoutId && isLoaded) {
|
|
50493
50458
|
logMeasuredEvent({
|
|
50494
50459
|
eventName: "fc::ready::input_amount" /* READY_INPUT_AMOUNT */,
|
|
@@ -50521,7 +50486,7 @@ function InputAmount(props) {
|
|
|
50521
50486
|
}
|
|
50522
50487
|
|
|
50523
50488
|
// src/modals/CheckoutModal/LightningInvoice/LightningInvoice.tsx
|
|
50524
|
-
import React289, { useEffect as
|
|
50489
|
+
import React289, { useEffect as useEffect89 } from "react";
|
|
50525
50490
|
import { createPortal as createPortal18 } from "react-dom";
|
|
50526
50491
|
|
|
50527
50492
|
// src/components/CopyAddress/CopyInputDisplayedAddress.tsx
|
|
@@ -50642,15 +50607,15 @@ function CopyInputDisplayedAddress(props) {
|
|
|
50642
50607
|
import {
|
|
50643
50608
|
getLightningQuote
|
|
50644
50609
|
} from "@funkit/api-base";
|
|
50645
|
-
import { LIGHTNING_MAINNET_CHAIN_ID, bitcoinChain as
|
|
50610
|
+
import { LIGHTNING_MAINNET_CHAIN_ID, bitcoinChain as bitcoinChain4 } from "@funkit/chains";
|
|
50646
50611
|
import { getAssetPriceInfoWithFallback as getAssetPriceInfoWithFallback2 } from "@funkit/connect-core";
|
|
50647
50612
|
import { keepPreviousData as keepPreviousData4, useQuery as useQuery24 } from "@tanstack/react-query";
|
|
50648
|
-
import { useEffect as
|
|
50613
|
+
import { useEffect as useEffect88, useRef as useRef56, useState as useState87 } from "react";
|
|
50649
50614
|
import { parseUnits as parseUnits5 } from "viem";
|
|
50650
50615
|
var QUOTE_REFRESH_LEAD_MS = 3e3;
|
|
50651
50616
|
var QUOTE_REFRESH_MIN_MS = 250;
|
|
50652
50617
|
var QUOTE_GC_MS = 1e4;
|
|
50653
|
-
var BTC_DECIMALS =
|
|
50618
|
+
var BTC_DECIMALS = bitcoinChain4.nativeCurrency.decimals;
|
|
50654
50619
|
var SATS_PER_BTC = 10n ** BigInt(BTC_DECIMALS);
|
|
50655
50620
|
function usdToSats(usd, btcPrice) {
|
|
50656
50621
|
if (usd && btcPrice) {
|
|
@@ -50663,7 +50628,7 @@ function useDeferredQuote(latestQuote) {
|
|
|
50663
50628
|
const [displayedQuote, setDisplayedQuote] = useState87(latestQuote);
|
|
50664
50629
|
const latestQuoteRef = useRef56(latestQuote);
|
|
50665
50630
|
latestQuoteRef.current = latestQuote;
|
|
50666
|
-
|
|
50631
|
+
useEffect88(() => {
|
|
50667
50632
|
if (!displayedQuote) {
|
|
50668
50633
|
if (latestQuote) {
|
|
50669
50634
|
setDisplayedQuote(latestQuote);
|
|
@@ -50703,7 +50668,7 @@ var useLightningQuote = ({
|
|
|
50703
50668
|
}
|
|
50704
50669
|
const btcPrice = await getAssetPriceInfoWithFallback2({
|
|
50705
50670
|
apiKey,
|
|
50706
|
-
chainId:
|
|
50671
|
+
chainId: bitcoinChain4.id.toString(),
|
|
50707
50672
|
assetTokenAddress: NATIVE_TOKEN,
|
|
50708
50673
|
logger
|
|
50709
50674
|
});
|
|
@@ -50896,12 +50861,12 @@ function LightningInvoice(props) {
|
|
|
50896
50861
|
isHidden: isLoading || !!error,
|
|
50897
50862
|
isPaused: isLoading || !!error
|
|
50898
50863
|
});
|
|
50899
|
-
|
|
50864
|
+
useEffect89(() => {
|
|
50900
50865
|
if (expiresAtMs !== void 0) {
|
|
50901
50866
|
restartCountdown();
|
|
50902
50867
|
}
|
|
50903
50868
|
}, [expiresAtMs, restartCountdown]);
|
|
50904
|
-
|
|
50869
|
+
useEffect89(() => {
|
|
50905
50870
|
if (checkoutItem?.id && displayedBolt11) {
|
|
50906
50871
|
registerQrPaymentTarget(checkoutItem.id, displayedBolt11);
|
|
50907
50872
|
}
|
|
@@ -50968,7 +50933,7 @@ function LightningInvoice(props) {
|
|
|
50968
50933
|
}
|
|
50969
50934
|
|
|
50970
50935
|
// src/modals/CheckoutModal/LoadingAccount.tsx
|
|
50971
|
-
import React297, { useEffect as
|
|
50936
|
+
import React297, { useEffect as useEffect91 } from "react";
|
|
50972
50937
|
|
|
50973
50938
|
// src/components/FunAsset/FunAssetLoading.tsx
|
|
50974
50939
|
import React291 from "react";
|
|
@@ -51208,10 +51173,10 @@ var CheckoutTopAnnouncementBanner = () => {
|
|
|
51208
51173
|
};
|
|
51209
51174
|
|
|
51210
51175
|
// src/hooks/usePaymentMethodTabs.ts
|
|
51211
|
-
import { useMemo as
|
|
51176
|
+
import { useMemo as useMemo71 } from "react";
|
|
51212
51177
|
|
|
51213
51178
|
// src/hooks/queries/useHasSavedFops.ts
|
|
51214
|
-
import { useEffect as
|
|
51179
|
+
import { useEffect as useEffect90, useState as useState88 } from "react";
|
|
51215
51180
|
function useHasSavedFops() {
|
|
51216
51181
|
const { userInfo } = useGeneralWallet();
|
|
51217
51182
|
const userId = userInfo.id;
|
|
@@ -51219,7 +51184,7 @@ function useHasSavedFops() {
|
|
|
51219
51184
|
() => !userId || userId === "0x" ? void 0 : readHasSavedFops(userId)
|
|
51220
51185
|
);
|
|
51221
51186
|
const { realQueryData: fops } = useFops();
|
|
51222
|
-
|
|
51187
|
+
useEffect90(() => {
|
|
51223
51188
|
if (!userId || userId === "0x") {
|
|
51224
51189
|
setHasSavedFops(void 0);
|
|
51225
51190
|
return;
|
|
@@ -51245,7 +51210,7 @@ function usePaymentMethodTabs({
|
|
|
51245
51210
|
);
|
|
51246
51211
|
const isWithdrawalTabEnabled = useDynamicConfig("enablecashierformfactor") && isCashier;
|
|
51247
51212
|
const defaultTab = isSavedCardDefaultsToFiatTabEnabled && hasSavedFops ? "fiat" : "crypto";
|
|
51248
|
-
const tabOrder =
|
|
51213
|
+
const tabOrder = useMemo71(() => {
|
|
51249
51214
|
const tabs2 = [];
|
|
51250
51215
|
if (defaultTab === "fiat") {
|
|
51251
51216
|
tabs2.push("fiat", "crypto");
|
|
@@ -51759,7 +51724,7 @@ function LoadingAccount({
|
|
|
51759
51724
|
const hasCustomStartingStep = !!checkoutConfig?.startingStep;
|
|
51760
51725
|
const startsOnConfirmationStep = checkoutConfig?.startingStep === "confirmation" /* CONFIRMATION */;
|
|
51761
51726
|
const startsOnSelectAssetStep = checkoutConfig?.startingStep === "select_asset" /* SELECT_ASSET */;
|
|
51762
|
-
|
|
51727
|
+
useEffect91(() => {
|
|
51763
51728
|
if (isLoadingFiat || !checkoutConfig) {
|
|
51764
51729
|
return;
|
|
51765
51730
|
}
|
|
@@ -51829,7 +51794,7 @@ function LoadingAccount({
|
|
|
51829
51794
|
|
|
51830
51795
|
// src/modals/CheckoutModal/MeldCurrencySelect/MeldCurrencySelect.tsx
|
|
51831
51796
|
import clsx26 from "clsx";
|
|
51832
|
-
import React298, { useMemo as
|
|
51797
|
+
import React298, { useMemo as useMemo72, useState as useState89 } from "react";
|
|
51833
51798
|
|
|
51834
51799
|
// src/modals/CheckoutModal/MeldCurrencySelect/currenciesWithMultipleCountries.ts
|
|
51835
51800
|
var currenciesWithMultipleCountries = {
|
|
@@ -51890,7 +51855,7 @@ function MeldCurrencySelect({
|
|
|
51890
51855
|
const [selectedCurrency, setSelectedCurrency] = useState89(
|
|
51891
51856
|
defaultCurrency
|
|
51892
51857
|
);
|
|
51893
|
-
const filteredOptions =
|
|
51858
|
+
const filteredOptions = useMemo72(() => {
|
|
51894
51859
|
const newOptions = data?.filter(
|
|
51895
51860
|
({ name, currencyCode }) => currencyCode.toLowerCase().includes(query.toLowerCase()) || name.toLowerCase().includes(query.toLowerCase())
|
|
51896
51861
|
) ?? [];
|
|
@@ -52092,15 +52057,15 @@ function MeldRedirect({
|
|
|
52092
52057
|
// src/modals/CheckoutModal/SelectAsset/SelectAsset.tsx
|
|
52093
52058
|
import { isTokenEquivalent as isTokenEquivalent15 } from "@funkit/utils";
|
|
52094
52059
|
import React304, {
|
|
52095
|
-
useEffect as
|
|
52060
|
+
useEffect as useEffect92,
|
|
52096
52061
|
useLayoutEffect as useLayoutEffect2,
|
|
52097
|
-
useMemo as
|
|
52062
|
+
useMemo as useMemo74,
|
|
52098
52063
|
useState as useState90
|
|
52099
52064
|
} from "react";
|
|
52100
52065
|
import { createPortal as createPortal21 } from "react-dom";
|
|
52101
52066
|
|
|
52102
52067
|
// src/hooks/useDynamicRoutes.ts
|
|
52103
|
-
import { useMemo as
|
|
52068
|
+
import { useMemo as useMemo73 } from "react";
|
|
52104
52069
|
import { DYNAMIC_ROUTES, initDynamicRouting } from "@funkit/fun-relay";
|
|
52105
52070
|
var toMutable = (obj) => {
|
|
52106
52071
|
return obj;
|
|
@@ -52110,7 +52075,7 @@ var useDynamicRoutes = (_dynamicRoutingId) => {
|
|
|
52110
52075
|
const { checkoutItem } = useCheckoutContext();
|
|
52111
52076
|
const config = checkoutItem?.initSettings.config;
|
|
52112
52077
|
const dynamicRoutingId = _dynamicRoutingId || config?.dynamicRoutingId;
|
|
52113
|
-
const findPath =
|
|
52078
|
+
const findPath = useMemo73(() => {
|
|
52114
52079
|
if (!dynamicRoutingId) {
|
|
52115
52080
|
return () => null;
|
|
52116
52081
|
}
|
|
@@ -52356,7 +52321,7 @@ function useEnrichedAccountHoldings({
|
|
|
52356
52321
|
const minTransferLimits = useDynamicConfig("mintokentransfervalue");
|
|
52357
52322
|
const isDynamicRoutingEnabled = useIsDynamicRoutingEnabled();
|
|
52358
52323
|
const isNadoDirectTransferSource = useIsNadoDirectTransferSource();
|
|
52359
|
-
const enrichedAccountHoldings =
|
|
52324
|
+
const enrichedAccountHoldings = useMemo74(() => {
|
|
52360
52325
|
if (!checkoutConfig) {
|
|
52361
52326
|
return [];
|
|
52362
52327
|
}
|
|
@@ -52419,7 +52384,7 @@ function useAssetOptions({
|
|
|
52419
52384
|
const { t } = useFunkitTranslation();
|
|
52420
52385
|
const { findPath } = useDynamicRoutes();
|
|
52421
52386
|
const isNadoDirectTransferSource = useIsNadoDirectTransferSource();
|
|
52422
|
-
const assetOptions =
|
|
52387
|
+
const assetOptions = useMemo74(() => {
|
|
52423
52388
|
return enrichedAccountHoldings.map(({ asset, usableForCheckout }) => {
|
|
52424
52389
|
const { isUsable, reason } = usableForCheckout;
|
|
52425
52390
|
const isKnown = isKnownAsset2(asset);
|
|
@@ -52502,7 +52467,7 @@ function getDefaultChainTokenSymbol(assetOptions, selectedSourceAssetInfo) {
|
|
|
52502
52467
|
}
|
|
52503
52468
|
function useScrollToSelectedAsset(selectedChainTokenSymbol) {
|
|
52504
52469
|
const rootNode = useRootNode();
|
|
52505
|
-
|
|
52470
|
+
useEffect92(() => {
|
|
52506
52471
|
const optionEl = rootNode.getElementById(
|
|
52507
52472
|
`option-${selectedChainTokenSymbol}`
|
|
52508
52473
|
);
|
|
@@ -52544,7 +52509,7 @@ function AccountSelectAsset({
|
|
|
52544
52509
|
const { setSelectedBrokerageAsset } = useFunkitBrokerageContext();
|
|
52545
52510
|
const [explicitlySelectedChainTokenSymbol, setSelectedChainTokenSymbol] = useState90("");
|
|
52546
52511
|
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
52547
|
-
const defaultTargetAsset =
|
|
52512
|
+
const defaultTargetAsset = useMemo74(
|
|
52548
52513
|
() => getDefaultDynamicTargetAsset(checkoutConfig),
|
|
52549
52514
|
[checkoutConfig]
|
|
52550
52515
|
);
|
|
@@ -52650,11 +52615,11 @@ function AccountSelectAsset({
|
|
|
52650
52615
|
onFinish();
|
|
52651
52616
|
});
|
|
52652
52617
|
const selectedSourceAssetInfo = checkoutItem?.selectedSourceAssetInfo;
|
|
52653
|
-
const defaultSelectedChainTokenSymbol =
|
|
52618
|
+
const defaultSelectedChainTokenSymbol = useMemo74(
|
|
52654
52619
|
() => getDefaultChainTokenSymbol(assetOptions, selectedSourceAssetInfo),
|
|
52655
52620
|
[assetOptions, selectedSourceAssetInfo]
|
|
52656
52621
|
);
|
|
52657
|
-
const selectedChainTokenSymbol =
|
|
52622
|
+
const selectedChainTokenSymbol = useMemo74(() => {
|
|
52658
52623
|
if (explicitlySelectedChainTokenSymbol) {
|
|
52659
52624
|
const assetExists = assetOptions.some(
|
|
52660
52625
|
({ asset }) => asset.chainSymbolKey === explicitlySelectedChainTokenSymbol
|
|
@@ -52688,7 +52653,7 @@ function AccountSelectAsset({
|
|
|
52688
52653
|
const isDisabled = isAssetsEmpty || !selectedChainTokenSymbol || isLoading;
|
|
52689
52654
|
const onBalanceTopUpSwitch = checkoutItem?.initSettings.onBalanceTopUpSwitch;
|
|
52690
52655
|
const checkoutId = checkoutItem?.id;
|
|
52691
|
-
|
|
52656
|
+
useEffect92(() => {
|
|
52692
52657
|
if (checkoutId && !isLoading) {
|
|
52693
52658
|
logMeasuredEvent({
|
|
52694
52659
|
eventName: "fc::ready::select_asset" /* READY_SELECT_ASSET */,
|
|
@@ -52816,7 +52781,7 @@ import {
|
|
|
52816
52781
|
resolveWithdrawalSourceTokenBalance as resolveWithdrawalSourceTokenBalance4
|
|
52817
52782
|
} from "@funkit/connect-core";
|
|
52818
52783
|
import { isTokenEquivalent as isTokenEquivalent16, noop as noop6 } from "@funkit/utils";
|
|
52819
|
-
import React313, { useEffect as
|
|
52784
|
+
import React313, { useEffect as useEffect95, useMemo as useMemo75, useRef as useRef58, useState as useState91 } from "react";
|
|
52820
52785
|
import { createPortal as createPortal22 } from "react-dom";
|
|
52821
52786
|
|
|
52822
52787
|
// src/components/Dropdown/ReceiveTokenDropdown.tsx
|
|
@@ -52929,13 +52894,13 @@ function useIsUserUnderComplianceReview() {
|
|
|
52929
52894
|
}
|
|
52930
52895
|
|
|
52931
52896
|
// src/modals/CheckoutModal/SourceChange/ComplianceReviewBanner.tsx
|
|
52932
|
-
import React306, { useEffect as
|
|
52897
|
+
import React306, { useEffect as useEffect93 } from "react";
|
|
52933
52898
|
function ComplianceReviewBanner({
|
|
52934
52899
|
checkoutId
|
|
52935
52900
|
}) {
|
|
52936
52901
|
const { t } = useFunkitTranslation();
|
|
52937
52902
|
const { logEvent } = useTrack();
|
|
52938
|
-
|
|
52903
|
+
useEffect93(() => {
|
|
52939
52904
|
logEvent({
|
|
52940
52905
|
eventName: "fc::compliance_review::banner_shown" /* COMPLIANCE_REVIEW_BANNER_SHOWN */,
|
|
52941
52906
|
metadata: { checkoutId }
|
|
@@ -53273,7 +53238,7 @@ function useStartBitcoinLightning() {
|
|
|
53273
53238
|
}
|
|
53274
53239
|
|
|
53275
53240
|
// src/modals/CheckoutModal/SourceChange/useTrackSourceChangeEvents.ts
|
|
53276
|
-
import { useEffect as
|
|
53241
|
+
import { useEffect as useEffect94, useRef as useRef57 } from "react";
|
|
53277
53242
|
function useTrackSourceChangeEvents({
|
|
53278
53243
|
tab
|
|
53279
53244
|
}) {
|
|
@@ -53305,11 +53270,11 @@ function useTrackSourceChangeEvents({
|
|
|
53305
53270
|
}));
|
|
53306
53271
|
});
|
|
53307
53272
|
const checkoutId = checkoutItem?.id;
|
|
53308
|
-
|
|
53273
|
+
useEffect94(() => {
|
|
53309
53274
|
if (checkoutId && claimAnalyticsEvent("fc_modal_opened" /* MODAL_OPENED */, checkoutId)) {
|
|
53310
53275
|
trackModalOpened();
|
|
53311
53276
|
}
|
|
53312
|
-
}, [checkoutId
|
|
53277
|
+
}, [checkoutId]);
|
|
53313
53278
|
const trackTabSwitched = useEffectEvent(
|
|
53314
53279
|
({
|
|
53315
53280
|
fromTab,
|
|
@@ -53501,7 +53466,7 @@ function SourceChange({
|
|
|
53501
53466
|
const { isUnifiedTradingMode: isLighterUnifiedAccount } = useLighterAccounts({
|
|
53502
53467
|
address: walletAddress
|
|
53503
53468
|
});
|
|
53504
|
-
const dynamicTargetAssets =
|
|
53469
|
+
const dynamicTargetAssets = useMemo75(() => {
|
|
53505
53470
|
const candidates = checkoutConfig?.dynamicTargetAssetCandidates;
|
|
53506
53471
|
if (!candidates || !isLighterUnifiedAccount) {
|
|
53507
53472
|
return candidates;
|
|
@@ -53564,7 +53529,7 @@ function SourceChange({
|
|
|
53564
53529
|
});
|
|
53565
53530
|
}
|
|
53566
53531
|
const [connectedSource, setConnectedSource] = useState91(paymentMethodInfo);
|
|
53567
|
-
const syntheticFops =
|
|
53532
|
+
const syntheticFops = useMemo75(
|
|
53568
53533
|
() => isCashAppLightningEnabled ? [createSyntheticFop(PaymentMethod.CASH_APP_LIGHTNING)] : [],
|
|
53569
53534
|
[isCashAppLightningEnabled]
|
|
53570
53535
|
);
|
|
@@ -53589,7 +53554,7 @@ function SourceChange({
|
|
|
53589
53554
|
const { trackTabSwitched } = useTrackSourceChangeEvents({
|
|
53590
53555
|
tab: paymentMethodTab
|
|
53591
53556
|
});
|
|
53592
|
-
const nativeHolding =
|
|
53557
|
+
const nativeHolding = useMemo75(() => {
|
|
53593
53558
|
if (!checkoutConfig || !walletHoldings || !isCustomerNativeFastPathEnabled(apiKey)) {
|
|
53594
53559
|
return void 0;
|
|
53595
53560
|
}
|
|
@@ -53603,7 +53568,7 @@ function SourceChange({
|
|
|
53603
53568
|
);
|
|
53604
53569
|
return holding && holding.usdAmount != null && holding.usdAmount > 0 ? holding : void 0;
|
|
53605
53570
|
}, [apiKey, walletHoldings, checkoutConfig]);
|
|
53606
|
-
const connectedWallet =
|
|
53571
|
+
const connectedWallet = useMemo75(
|
|
53607
53572
|
() => preferred.find(
|
|
53608
53573
|
(s) => isConnectablePaymentMethodInfo(s) && s.paymentMethod === PaymentMethod.ACCOUNT_BALANCE
|
|
53609
53574
|
),
|
|
@@ -53614,7 +53579,7 @@ function SourceChange({
|
|
|
53614
53579
|
const showTagline = useDynamicConfig("showpoweredtagline");
|
|
53615
53580
|
const hasBottomBar = showTagline || !isAutoContinue || bottomBarCloseButtonConfig.enabled;
|
|
53616
53581
|
useSwappedPreload(fopsData?.data, "deposit");
|
|
53617
|
-
|
|
53582
|
+
useEffect95(() => {
|
|
53618
53583
|
const nextWithdrawalConfig = shouldSeedSourceChangeWithdrawalConfig ? resolvedWithdrawalConfig : void 0;
|
|
53619
53584
|
setModalState((state) => {
|
|
53620
53585
|
if (state.withdrawalConfig === nextWithdrawalConfig) {
|
|
@@ -53630,7 +53595,7 @@ function SourceChange({
|
|
|
53630
53595
|
setModalState,
|
|
53631
53596
|
shouldSeedSourceChangeWithdrawalConfig
|
|
53632
53597
|
]);
|
|
53633
|
-
|
|
53598
|
+
useEffect95(() => {
|
|
53634
53599
|
if (!paymentMethodInfo) {
|
|
53635
53600
|
return;
|
|
53636
53601
|
}
|
|
@@ -53758,9 +53723,9 @@ function SourceChange({
|
|
|
53758
53723
|
)
|
|
53759
53724
|
);
|
|
53760
53725
|
});
|
|
53761
|
-
|
|
53726
|
+
useEffect95(() => {
|
|
53762
53727
|
sendPaymentMethodTabEvent(paymentMethodTab);
|
|
53763
|
-
}, [paymentMethodTab
|
|
53728
|
+
}, [paymentMethodTab]);
|
|
53764
53729
|
const analyticsTab = isSwappedEnabled ? paymentMethodTab : null;
|
|
53765
53730
|
const handleNewSourceContinue = async (newSource2) => {
|
|
53766
53731
|
switch (newSource2) {
|
|
@@ -54196,7 +54161,7 @@ function trackEventForTabChange(checkoutItem, tab) {
|
|
|
54196
54161
|
|
|
54197
54162
|
// src/modals/CheckoutModal/SwappedIframe/SwappedIframeController.tsx
|
|
54198
54163
|
import { useQueryClient as useQueryClient6 } from "@tanstack/react-query";
|
|
54199
|
-
import React314, { useEffect as
|
|
54164
|
+
import React314, { useEffect as useEffect96, useRef as useRef59 } from "react";
|
|
54200
54165
|
import { createPortal as createPortal23 } from "react-dom";
|
|
54201
54166
|
var SwappedIframeInfo = {
|
|
54202
54167
|
Component: SwappedIframeController,
|
|
@@ -54251,17 +54216,17 @@ function SwappedIframeController({
|
|
|
54251
54216
|
metadata: {}
|
|
54252
54217
|
});
|
|
54253
54218
|
});
|
|
54254
|
-
|
|
54219
|
+
useEffect96(() => {
|
|
54255
54220
|
startMeasuredEvent("fc::ready::swapped_iframe" /* READY_SWAPPED_IFRAME */);
|
|
54256
54221
|
}, [startMeasuredEvent]);
|
|
54257
|
-
|
|
54222
|
+
useEffect96(() => {
|
|
54258
54223
|
if (isSwappedReady) {
|
|
54259
54224
|
const event = getTrackEvent("fc::ready::swapped_iframe" /* READY_SWAPPED_IFRAME */);
|
|
54260
54225
|
logger.info("swapped-iframe:ready", event.metadata);
|
|
54261
54226
|
logMeasuredEvent(event);
|
|
54262
54227
|
focusAmountInput();
|
|
54263
54228
|
}
|
|
54264
|
-
}, [
|
|
54229
|
+
}, [isSwappedReady, logMeasuredEvent, focusAmountInput]);
|
|
54265
54230
|
const handleSwappedMessage = useEffectEvent((msg) => {
|
|
54266
54231
|
switch (msg.type) {
|
|
54267
54232
|
case "SWAPPED_GO_BACK": {
|
|
@@ -54419,9 +54384,9 @@ function SwappedIframeController({
|
|
|
54419
54384
|
}
|
|
54420
54385
|
}
|
|
54421
54386
|
}
|
|
54422
|
-
|
|
54387
|
+
useEffect96(() => {
|
|
54423
54388
|
return swappedTransport.onMessage(handleSwappedMessage);
|
|
54424
|
-
}, [swappedTransport
|
|
54389
|
+
}, [swappedTransport]);
|
|
54425
54390
|
useSwappedIframeLifecycle({
|
|
54426
54391
|
fopType: selectedPaymentOption.fopType,
|
|
54427
54392
|
onTimeout: () => setModalState((s) => ({ ...s, error: true })),
|
|
@@ -54776,7 +54741,7 @@ var TransferTokenDetails = ({
|
|
|
54776
54741
|
};
|
|
54777
54742
|
|
|
54778
54743
|
// src/modals/CheckoutModal/TransferToken/TransferToken.tsx
|
|
54779
|
-
import { bitcoinChain as
|
|
54744
|
+
import { bitcoinChain as bitcoinChain5, lightningChain as lightningChain7 } from "@funkit/chains";
|
|
54780
54745
|
var TransferTokenInfo = {
|
|
54781
54746
|
Component: TransferToken,
|
|
54782
54747
|
disableBack: ({ isSourceNavWidgetEnabled }) => isSourceNavWidgetEnabled,
|
|
@@ -54844,7 +54809,7 @@ function TransferToken({
|
|
|
54844
54809
|
transferInit
|
|
54845
54810
|
});
|
|
54846
54811
|
const dropdownAssets = isLightningEnabled ? { ...assets, [lightningChain7.id]: ["BTC"] } : assets;
|
|
54847
|
-
const dropdownChainIds = isLightningEnabled ? insertChainIdAfter(chainIdSortOrder, lightningChain7.id,
|
|
54812
|
+
const dropdownChainIds = isLightningEnabled ? insertChainIdAfter(chainIdSortOrder, lightningChain7.id, bitcoinChain5.id) : chainIdSortOrder;
|
|
54848
54813
|
const { addressBySymbolByChainId } = useTokenTransferConfig(false);
|
|
54849
54814
|
const { trackDepositAssetSelected, trackDepositMethodSelected } = useDepositAnalytics();
|
|
54850
54815
|
const trackTokenTransferAssetSelected = (source) => {
|
|
@@ -54980,8 +54945,8 @@ function TransferToken({
|
|
|
54980
54945
|
}
|
|
54981
54946
|
function getSelectionOverride() {
|
|
54982
54947
|
const sourceAsset = checkoutItem?.selectedSourceAssetInfo;
|
|
54983
|
-
if (sourceAsset?.symbol === "BTC" && sourceAsset.chainId === String(lightningChain7.id) && enabledChainSymbols[
|
|
54984
|
-
return { token: "BTC", chainId:
|
|
54948
|
+
if (sourceAsset?.symbol === "BTC" && sourceAsset.chainId === String(lightningChain7.id) && enabledChainSymbols[bitcoinChain5.id]?.includes("BTC")) {
|
|
54949
|
+
return { token: "BTC", chainId: bitcoinChain5.id };
|
|
54985
54950
|
}
|
|
54986
54951
|
return transferToken ? void 0 : savedSelection;
|
|
54987
54952
|
}
|
|
@@ -55582,7 +55547,7 @@ var FiatAccountDetail = {
|
|
|
55582
55547
|
|
|
55583
55548
|
// src/modals/CheckoutModal/VirtualFiatAccount/KycIframe.tsx
|
|
55584
55549
|
import { BridgeCustomerStatus as BridgeCustomerStatus7 } from "@funkit/api-base";
|
|
55585
|
-
import React327, { useCallback as useCallback71, useEffect as
|
|
55550
|
+
import React327, { useCallback as useCallback71, useEffect as useEffect97, useMemo as useMemo76, useState as useState94 } from "react";
|
|
55586
55551
|
function useIframeListener(listeners, expectedOrigin) {
|
|
55587
55552
|
const handleMessage = useCallback71(
|
|
55588
55553
|
(event) => {
|
|
@@ -55609,7 +55574,7 @@ function useIframeListener(listeners, expectedOrigin) {
|
|
|
55609
55574
|
},
|
|
55610
55575
|
[listeners, expectedOrigin]
|
|
55611
55576
|
);
|
|
55612
|
-
|
|
55577
|
+
useEffect97(() => {
|
|
55613
55578
|
window.addEventListener("message", handleMessage);
|
|
55614
55579
|
return () => {
|
|
55615
55580
|
window.removeEventListener("message", handleMessage);
|
|
@@ -55639,14 +55604,14 @@ function KycIframe({
|
|
|
55639
55604
|
const { clearVirtualFiatAccounts } = useClearFrogAccountsCache();
|
|
55640
55605
|
const { data: kycLink, isLoading: isLinkLoading } = useLoadKycLink(modalState);
|
|
55641
55606
|
const [iframeLoading, setIframeLoading] = useState94(true);
|
|
55642
|
-
const kycOrigin =
|
|
55607
|
+
const kycOrigin = useMemo76(() => {
|
|
55643
55608
|
try {
|
|
55644
55609
|
return kycLink ? new URL(kycLink).origin : null;
|
|
55645
55610
|
} catch {
|
|
55646
55611
|
return null;
|
|
55647
55612
|
}
|
|
55648
55613
|
}, [kycLink]);
|
|
55649
|
-
const listeners =
|
|
55614
|
+
const listeners = useMemo76(
|
|
55650
55615
|
() => ({
|
|
55651
55616
|
load: () => {
|
|
55652
55617
|
logger.info("KYC iframe loaded");
|
|
@@ -55928,9 +55893,9 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
55928
55893
|
ensureStepQueries(modalState.step);
|
|
55929
55894
|
}
|
|
55930
55895
|
});
|
|
55931
|
-
|
|
55896
|
+
useEffect98(() => {
|
|
55932
55897
|
ensureLoadingAccountScreen();
|
|
55933
|
-
}, [
|
|
55898
|
+
}, []);
|
|
55934
55899
|
const trackNextState = useCallback72(
|
|
55935
55900
|
(nextState, metadata) => {
|
|
55936
55901
|
const trackEvent = trackEventFromNextState(nextState);
|
|
@@ -56180,7 +56145,7 @@ function useTitleConfig(checkoutItem, state) {
|
|
|
56180
56145
|
}
|
|
56181
56146
|
|
|
56182
56147
|
// src/modals/CheckoutModal/useCheckoutBlocked.ts
|
|
56183
|
-
import { useEffect as
|
|
56148
|
+
import { useEffect as useEffect99 } from "react";
|
|
56184
56149
|
var geoblockedViewableSteps = /* @__PURE__ */ new Set([
|
|
56185
56150
|
"loading_account" /* LOADING_ACCOUNT */,
|
|
56186
56151
|
"source_change" /* SOURCE_CHANGE */
|
|
@@ -56218,11 +56183,11 @@ function useCheckoutBlocked(params) {
|
|
|
56218
56183
|
params.onCheckoutBlocked?.({ blockedReason: reason });
|
|
56219
56184
|
}
|
|
56220
56185
|
);
|
|
56221
|
-
|
|
56186
|
+
useEffect99(() => {
|
|
56222
56187
|
if (blockedReason) {
|
|
56223
56188
|
onCheckoutBlockedEvent(blockedReason);
|
|
56224
56189
|
}
|
|
56225
|
-
}, [blockedReason
|
|
56190
|
+
}, [blockedReason]);
|
|
56226
56191
|
if (!blockedReason) {
|
|
56227
56192
|
return { blockedReason: null, showBlockedUI: false };
|
|
56228
56193
|
}
|
|
@@ -56324,7 +56289,7 @@ function FunCheckoutModalInner({
|
|
|
56324
56289
|
setModalState
|
|
56325
56290
|
};
|
|
56326
56291
|
const connectionStatus = useConnectionStatus();
|
|
56327
|
-
|
|
56292
|
+
useEffect100(() => {
|
|
56328
56293
|
if (!modalState.showWalletOptions) {
|
|
56329
56294
|
return;
|
|
56330
56295
|
}
|
|
@@ -56361,6 +56326,9 @@ function FunCheckoutModalInner({
|
|
|
56361
56326
|
const resolvedHeaderTabs = useCheckoutHeaderTabsState(modalState);
|
|
56362
56327
|
const headerTabs = showBlockedUI ? void 0 : resolvedHeaderTabs;
|
|
56363
56328
|
const perpsTitleMeta = usePerpsTitleMeta(checkoutItem.initSettings.config);
|
|
56329
|
+
const swappedBuyingCrypto = useSwappedBuyingCrypto(
|
|
56330
|
+
checkoutItem.initSettings.config
|
|
56331
|
+
);
|
|
56364
56332
|
const getTitleMeta = () => {
|
|
56365
56333
|
if (!!headerTabs || HIDE_MODAL_META_TITLE_AND_DIVIDER.includes(modalState.step)) {
|
|
56366
56334
|
return void 0;
|
|
@@ -56418,7 +56386,7 @@ function FunCheckoutModalInner({
|
|
|
56418
56386
|
backgroundOverlay: successScreenBackgroundOverlay,
|
|
56419
56387
|
withoutBorder: modalState.step === "swapped_iframe" /* SWAPPED_IFRAME */ && !modalState.error
|
|
56420
56388
|
},
|
|
56421
|
-
/* @__PURE__ */ React330.createElement(SwappedProvider,
|
|
56389
|
+
/* @__PURE__ */ React330.createElement(SwappedProvider, { buyingCrypto: swappedBuyingCrypto }, /* @__PURE__ */ React330.createElement(CheckoutModalPrefetchedHooks, null), /* @__PURE__ */ React330.createElement(TooltipAnchorRefContext.Provider, { value: tooltipAnchorRef }, /* @__PURE__ */ React330.createElement(
|
|
56422
56390
|
FunCheckoutModalHeightAnimationWrapper,
|
|
56423
56391
|
{
|
|
56424
56392
|
checkoutConfig,
|
|
@@ -56540,7 +56508,7 @@ function useModalStateValue() {
|
|
|
56540
56508
|
openModal: useCallback73(() => setModalOpen(true), [])
|
|
56541
56509
|
};
|
|
56542
56510
|
}
|
|
56543
|
-
var ModalContext =
|
|
56511
|
+
var ModalContext = createContext22({
|
|
56544
56512
|
accountModalOpen: false,
|
|
56545
56513
|
chainModalOpen: false,
|
|
56546
56514
|
connectModalOpen: false,
|
|
@@ -56614,7 +56582,7 @@ function ModalProvider({ children }) {
|
|
|
56614
56582
|
onConnect: () => closeModals(isUnauthenticated),
|
|
56615
56583
|
onDisconnect: closeModals
|
|
56616
56584
|
});
|
|
56617
|
-
|
|
56585
|
+
useEffect101(() => {
|
|
56618
56586
|
if (isUnauthenticated) {
|
|
56619
56587
|
closeModals();
|
|
56620
56588
|
}
|
|
@@ -56622,7 +56590,7 @@ function ModalProvider({ children }) {
|
|
|
56622
56590
|
return /* @__PURE__ */ React332.createElement(
|
|
56623
56591
|
ModalContext.Provider,
|
|
56624
56592
|
{
|
|
56625
|
-
value:
|
|
56593
|
+
value: useMemo77(
|
|
56626
56594
|
() => ({
|
|
56627
56595
|
accountModalOpen,
|
|
56628
56596
|
accountModalTab,
|
|
@@ -56696,7 +56664,7 @@ function ModalProvider({ children }) {
|
|
|
56696
56664
|
);
|
|
56697
56665
|
}
|
|
56698
56666
|
function useModalState() {
|
|
56699
|
-
const { accountModalOpen, chainModalOpen, connectModalOpen } =
|
|
56667
|
+
const { accountModalOpen, chainModalOpen, connectModalOpen } = useContext22(ModalContext);
|
|
56700
56668
|
return {
|
|
56701
56669
|
accountModalOpen,
|
|
56702
56670
|
chainModalOpen,
|
|
@@ -56704,22 +56672,22 @@ function useModalState() {
|
|
|
56704
56672
|
};
|
|
56705
56673
|
}
|
|
56706
56674
|
function useAccountModal() {
|
|
56707
|
-
const { accountModalOpen, openAccountModal } =
|
|
56675
|
+
const { accountModalOpen, openAccountModal } = useContext22(ModalContext);
|
|
56708
56676
|
return { accountModalOpen, openAccountModal };
|
|
56709
56677
|
}
|
|
56710
56678
|
function useChainModal() {
|
|
56711
|
-
const { chainModalOpen, openChainModal } =
|
|
56679
|
+
const { chainModalOpen, openChainModal } = useContext22(ModalContext);
|
|
56712
56680
|
return { chainModalOpen, openChainModal };
|
|
56713
56681
|
}
|
|
56714
56682
|
function useWalletConnectOpenState() {
|
|
56715
|
-
const { isWalletConnectModalOpen, setIsWalletConnectModalOpen } =
|
|
56683
|
+
const { isWalletConnectModalOpen, setIsWalletConnectModalOpen } = useContext22(ModalContext);
|
|
56716
56684
|
return { isWalletConnectModalOpen, setIsWalletConnectModalOpen };
|
|
56717
56685
|
}
|
|
56718
56686
|
function useConnectModal(onClose) {
|
|
56719
|
-
const { connectModalOpen, openConnectModal } =
|
|
56687
|
+
const { connectModalOpen, openConnectModal } = useContext22(ModalContext);
|
|
56720
56688
|
const { isWalletConnectModalOpen } = useWalletConnectOpenState();
|
|
56721
56689
|
const effectiveConnectModalOpen = connectModalOpen || isWalletConnectModalOpen;
|
|
56722
|
-
|
|
56690
|
+
useEffect101(() => {
|
|
56723
56691
|
if (!effectiveConnectModalOpen && onClose) {
|
|
56724
56692
|
onClose();
|
|
56725
56693
|
}
|
|
@@ -56730,11 +56698,11 @@ function useConnectModal(onClose) {
|
|
|
56730
56698
|
};
|
|
56731
56699
|
}
|
|
56732
56700
|
function useFunCheckoutModal() {
|
|
56733
|
-
const { funCheckoutModalOpen, openFunCheckoutModal } =
|
|
56701
|
+
const { funCheckoutModalOpen, openFunCheckoutModal } = useContext22(ModalContext);
|
|
56734
56702
|
return { funCheckoutModalOpen, openFunCheckoutModal };
|
|
56735
56703
|
}
|
|
56736
56704
|
function useWithdrawalModal() {
|
|
56737
|
-
const { openWithdrawalModal } =
|
|
56705
|
+
const { openWithdrawalModal } = useContext22(ModalContext);
|
|
56738
56706
|
return { openWithdrawalModal };
|
|
56739
56707
|
}
|
|
56740
56708
|
function useSoftHiddenCheckout() {
|
|
@@ -56743,7 +56711,7 @@ function useSoftHiddenCheckout() {
|
|
|
56743
56711
|
softHideFunCheckoutModal,
|
|
56744
56712
|
resumeSoftHiddenCheckout,
|
|
56745
56713
|
discardSoftHiddenCheckout
|
|
56746
|
-
} =
|
|
56714
|
+
} = useContext22(ModalContext);
|
|
56747
56715
|
return {
|
|
56748
56716
|
hasSoftHiddenCheckout: !!softHiddenCheckoutId,
|
|
56749
56717
|
softHiddenCheckoutId,
|
|
@@ -57033,7 +57001,7 @@ function ConnectButton({
|
|
|
57033
57001
|
const connectionStatus = useConnectionStatus();
|
|
57034
57002
|
const { setShowBalance } = useShowBalance();
|
|
57035
57003
|
const [ready, setReady] = useState97(false);
|
|
57036
|
-
|
|
57004
|
+
useEffect102(() => {
|
|
57037
57005
|
setShowBalance(showBalance);
|
|
57038
57006
|
if (!ready) {
|
|
57039
57007
|
setReady(true);
|
|
@@ -57621,12 +57589,12 @@ function createConnectedWithdrawalClient(config, ownerAddress, sourceChainId) {
|
|
|
57621
57589
|
}
|
|
57622
57590
|
|
|
57623
57591
|
// src/wallets/solanaWithdrawal.ts
|
|
57624
|
-
import { solanaChain as
|
|
57592
|
+
import { solanaChain as solanaChain7 } from "@funkit/chains";
|
|
57625
57593
|
import { toValidatedSolanaAddress as toValidatedSolanaAddress2, useLogOnce as useLogOnce6 } from "@funkit/connect-core";
|
|
57626
57594
|
import {
|
|
57627
57595
|
createSolanaWithdrawalClient
|
|
57628
57596
|
} from "@funkit/connect-core/clients/solana";
|
|
57629
|
-
import { useMemo as
|
|
57597
|
+
import { useMemo as useMemo78 } from "react";
|
|
57630
57598
|
function useSolanaWithdrawalConfig(params) {
|
|
57631
57599
|
const signer = params?.signer;
|
|
57632
57600
|
const address = toValidatedSolanaAddress2(signer?.address);
|
|
@@ -57638,7 +57606,7 @@ function useSolanaWithdrawalConfig(params) {
|
|
|
57638
57606
|
});
|
|
57639
57607
|
}
|
|
57640
57608
|
);
|
|
57641
|
-
return
|
|
57609
|
+
return useMemo78(() => {
|
|
57642
57610
|
if (!params || !signer || !address) {
|
|
57643
57611
|
return null;
|
|
57644
57612
|
}
|
|
@@ -57647,7 +57615,7 @@ function useSolanaWithdrawalConfig(params) {
|
|
|
57647
57615
|
...rest,
|
|
57648
57616
|
// TODO: Cast until #6751 widens the source address type.
|
|
57649
57617
|
sourceTokenAddress,
|
|
57650
|
-
sourceChainId: String(
|
|
57618
|
+
sourceChainId: String(solanaChain7.id),
|
|
57651
57619
|
wallet: createSolanaWithdrawalClient(
|
|
57652
57620
|
signer,
|
|
57653
57621
|
logger
|
|
@@ -57662,7 +57630,7 @@ import { useLogOnce as useLogOnce7 } from "@funkit/connect-core";
|
|
|
57662
57630
|
import {
|
|
57663
57631
|
createHypercoreAdaptedWallet as createHypercoreAdaptedWallet2
|
|
57664
57632
|
} from "@funkit/connect-core/clients/hypercore";
|
|
57665
|
-
import { useMemo as
|
|
57633
|
+
import { useMemo as useMemo79 } from "react";
|
|
57666
57634
|
import { getAddress as getAddress5, isAddress as isAddress4 } from "viem";
|
|
57667
57635
|
function unsupported(member) {
|
|
57668
57636
|
throw new Error(`HypercoreWithdrawalClient does not support ${member}`);
|
|
@@ -57691,7 +57659,7 @@ function useHypercoreWithdrawalConfig(options) {
|
|
|
57691
57659
|
});
|
|
57692
57660
|
}
|
|
57693
57661
|
);
|
|
57694
|
-
return
|
|
57662
|
+
return useMemo79(() => {
|
|
57695
57663
|
if (!options || !signer || !address) {
|
|
57696
57664
|
return null;
|
|
57697
57665
|
}
|