@funkit/connect 12.15.3 → 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 +23 -0
- package/dist/clients/axiom.d.ts +11 -3
- package/dist/clients/axiom.js +3 -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 +900 -926
- 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 +38 -38
- 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
|
}
|
|
@@ -11960,18 +11553,18 @@ function FunkitCheckoutProvider({ children }) {
|
|
|
11960
11553
|
updateDynamicRoutingId,
|
|
11961
11554
|
applyDynamicTargetAssetCandidate
|
|
11962
11555
|
};
|
|
11963
|
-
return /* @__PURE__ */
|
|
11556
|
+
return /* @__PURE__ */ React21.createElement(FunkitCheckoutContext.Provider, { value: contextValue }, children);
|
|
11964
11557
|
}
|
|
11965
11558
|
function useCheckoutContext() {
|
|
11966
|
-
return
|
|
11559
|
+
return useContext9(FunkitCheckoutContext);
|
|
11967
11560
|
}
|
|
11968
11561
|
function CheckoutConfigOverride({
|
|
11969
11562
|
config,
|
|
11970
11563
|
children
|
|
11971
11564
|
}) {
|
|
11972
|
-
const parent =
|
|
11565
|
+
const parent = useContext9(FunkitCheckoutContext);
|
|
11973
11566
|
const { checkoutItem } = parent;
|
|
11974
|
-
const value =
|
|
11567
|
+
const value = useMemo12(() => {
|
|
11975
11568
|
if (!checkoutItem) {
|
|
11976
11569
|
return null;
|
|
11977
11570
|
}
|
|
@@ -11986,7 +11579,7 @@ function CheckoutConfigOverride({
|
|
|
11986
11579
|
if (!value) {
|
|
11987
11580
|
return null;
|
|
11988
11581
|
}
|
|
11989
|
-
return /* @__PURE__ */
|
|
11582
|
+
return /* @__PURE__ */ React21.createElement(FunkitCheckoutContext.Provider, { value }, children);
|
|
11990
11583
|
}
|
|
11991
11584
|
function useFunkitCheckout(props) {
|
|
11992
11585
|
const { onValidation, onError } = props;
|
|
@@ -11996,7 +11589,7 @@ function useFunkitCheckout(props) {
|
|
|
11996
11589
|
initNewWithdrawal,
|
|
11997
11590
|
updateSourceAsset,
|
|
11998
11591
|
updateSelectedPaymentMethodInfo
|
|
11999
|
-
} =
|
|
11592
|
+
} = useContext9(FunkitCheckoutContext);
|
|
12000
11593
|
const { openFunCheckoutModal } = useFunCheckoutModal();
|
|
12001
11594
|
const { openWithdrawalModal } = useWithdrawalModal();
|
|
12002
11595
|
const { connectModalOpen, openConnectModal } = useConnectModal();
|
|
@@ -12165,13 +11758,13 @@ function useFunkitCheckout(props) {
|
|
|
12165
11758
|
});
|
|
12166
11759
|
openWithdrawalModal?.({ withdrawalId, ...config });
|
|
12167
11760
|
});
|
|
12168
|
-
|
|
11761
|
+
useEffect10(() => {
|
|
12169
11762
|
if (isUserLoggedIn && pendingCheckoutConfig) {
|
|
12170
11763
|
setPendingCheckoutConfig(void 0);
|
|
12171
11764
|
beginCheckout(pendingCheckoutConfig);
|
|
12172
11765
|
}
|
|
12173
11766
|
}, [isUserLoggedIn, pendingCheckoutConfig]);
|
|
12174
|
-
|
|
11767
|
+
useEffect10(() => {
|
|
12175
11768
|
if (pendingCheckoutConfig && !isUserLoggedIn && !connectModalOpen) {
|
|
12176
11769
|
setPendingCheckoutConfig(void 0);
|
|
12177
11770
|
}
|
|
@@ -12192,7 +11785,7 @@ import {
|
|
|
12192
11785
|
import { lighterChain } from "@funkit/chains";
|
|
12193
11786
|
import { getCheckoutTokenTransferParams as getCheckoutTokenTransferParams2 } from "@funkit/connect-core";
|
|
12194
11787
|
import { useQuery as useQuery3 } from "@tanstack/react-query";
|
|
12195
|
-
import { useEffect as
|
|
11788
|
+
import { useEffect as useEffect11 } from "react";
|
|
12196
11789
|
|
|
12197
11790
|
// src/hooks/useIsDynamicRoutingEnabled.ts
|
|
12198
11791
|
var useIsDynamicRoutingEnabled = ({
|
|
@@ -12261,7 +11854,7 @@ var useCheckoutTransferInit = (enabled = true, { trackStepReadiness = true } = {
|
|
|
12261
11854
|
return getCheckoutRecipient({ config: checkoutConfig, payerWallets }) || "0x";
|
|
12262
11855
|
})();
|
|
12263
11856
|
const isLighterWalletFallback = isLighterTarget && !mainAccountIndex && !checkoutConfig?.customRecipient;
|
|
12264
|
-
|
|
11857
|
+
useEffect11(() => {
|
|
12265
11858
|
if (useLighterMainAccount) {
|
|
12266
11859
|
logger.info("checkout:recipient:lighterMainAccount", {
|
|
12267
11860
|
mainAccountIndex,
|
|
@@ -12269,7 +11862,7 @@ var useCheckoutTransferInit = (enabled = true, { trackStepReadiness = true } = {
|
|
|
12269
11862
|
});
|
|
12270
11863
|
}
|
|
12271
11864
|
}, [useLighterMainAccount, mainAccountIndex, udaParams?.targetChain]);
|
|
12272
|
-
|
|
11865
|
+
useEffect11(() => {
|
|
12273
11866
|
if (isLighterWalletFallback && !isLighterLookupFetching) {
|
|
12274
11867
|
logger.warn("checkout:recipient:lighterMainAccountUnresolved", {
|
|
12275
11868
|
targetChain: udaParams?.targetChain,
|
|
@@ -12367,18 +11960,7 @@ var useTokenTransfer = (selectedChainId, selectedToken, chainIds) => {
|
|
|
12367
11960
|
const isUsdcOnPolygon = isPolygon && selectedToken === "USDC";
|
|
12368
11961
|
const showOriginalRecipient = !enableUniversal && (isUsdceOnPolygon || isUsdcOnPolygon);
|
|
12369
11962
|
const funDepositAddress = selectedChainId !== void 0 ? getDepositAddressForChain(selectedChainId, transferInit) : void 0;
|
|
12370
|
-
const blockchainType = (
|
|
12371
|
-
if (selectedChainId === solanaChain3.id) {
|
|
12372
|
-
return "solana";
|
|
12373
|
-
}
|
|
12374
|
-
if (selectedChainId === bitcoinChain.id) {
|
|
12375
|
-
return "bitcoin";
|
|
12376
|
-
}
|
|
12377
|
-
if (selectedChainId === tronChain2.id) {
|
|
12378
|
-
return "tron";
|
|
12379
|
-
}
|
|
12380
|
-
return "ethereum";
|
|
12381
|
-
})();
|
|
11963
|
+
const blockchainType = transferChainFamily(selectedChainId);
|
|
12382
11964
|
const depositAddressTooltip = showOriginalRecipient ? t("transferToken.depositAddressOriginalRecipient") : t("transferToken.depositAddressUniversal", {
|
|
12383
11965
|
targetToken: checkoutConfig?.targetAssetTicker
|
|
12384
11966
|
});
|
|
@@ -12430,7 +12012,7 @@ var useMinTransferValueEur = (selectedChainId) => {
|
|
|
12430
12012
|
};
|
|
12431
12013
|
var useMinTransferValues = (chainIds) => {
|
|
12432
12014
|
const limits = useDynamicConfig("mintokentransfervalue");
|
|
12433
|
-
return
|
|
12015
|
+
return useMemo13(() => {
|
|
12434
12016
|
return chainIds.reduce(
|
|
12435
12017
|
(acc, id) => {
|
|
12436
12018
|
acc[id] = getMinTransferValueUsd(id, limits);
|
|
@@ -12719,9 +12301,9 @@ var isBluvoWithdrawalError = (error) => {
|
|
|
12719
12301
|
};
|
|
12720
12302
|
|
|
12721
12303
|
// src/providers/FunkitSandboxContext.tsx
|
|
12722
|
-
import { createContext as
|
|
12723
|
-
var FunkitSandboxContext =
|
|
12724
|
-
var useIsFunkitSandboxMode = () =>
|
|
12304
|
+
import { createContext as createContext10, useContext as useContext10 } from "react";
|
|
12305
|
+
var FunkitSandboxContext = createContext10(false);
|
|
12306
|
+
var useIsFunkitSandboxMode = () => useContext10(FunkitSandboxContext);
|
|
12725
12307
|
|
|
12726
12308
|
// src/providers/FunkitBrokerageProvider.tsx
|
|
12727
12309
|
var PROD_ORG_ID = "swVwRpxm54werxWOQ5EayjtWM8i33jtL";
|
|
@@ -12729,7 +12311,7 @@ var PROD_PROJECT_ID = "tdN6yxVldIkEuE9XjKVGu0OCLsHcjVuy";
|
|
|
12729
12311
|
var STAGE_ORG_ID = "ezCUF9l9zpdB01nVvGe8O2E1vDZSbkVa";
|
|
12730
12312
|
var STAGE_PROJECT_ID = "D00dTLSdlAYpEFDTL2mMj7bee3SbjYI0";
|
|
12731
12313
|
var LOCAL_STORAGE_KEY = "fkc-bluvo-cex";
|
|
12732
|
-
var FunkitBrokerageContext =
|
|
12314
|
+
var FunkitBrokerageContext = createContext11(void 0);
|
|
12733
12315
|
var FunkitBrokerageProvider = ({
|
|
12734
12316
|
children
|
|
12735
12317
|
}) => {
|
|
@@ -12771,7 +12353,7 @@ var FunkitBrokerageProvider = ({
|
|
|
12771
12353
|
const [isConnected, setIsConnected] = useState12(
|
|
12772
12354
|
() => initialIsConnected
|
|
12773
12355
|
);
|
|
12774
|
-
|
|
12356
|
+
useEffect12(() => {
|
|
12775
12357
|
if (!isBluvoEnabled) {
|
|
12776
12358
|
setAuthConnections({});
|
|
12777
12359
|
bluvoClient.cancel();
|
|
@@ -12782,12 +12364,12 @@ var FunkitBrokerageProvider = ({
|
|
|
12782
12364
|
const initialConnections = getAuthConnectedExchanges();
|
|
12783
12365
|
setAuthConnections(initialConnections);
|
|
12784
12366
|
}, [isBluvoEnabled]);
|
|
12785
|
-
|
|
12367
|
+
useEffect12(() => {
|
|
12786
12368
|
if (bluvoClient.withdrawal?.status === "completed") {
|
|
12787
12369
|
setSelectedBrokerageAsset(null);
|
|
12788
12370
|
}
|
|
12789
12371
|
}, [bluvoClient.withdrawal?.status]);
|
|
12790
|
-
const brokerageMinMax =
|
|
12372
|
+
const brokerageMinMax = useMemo14(() => {
|
|
12791
12373
|
if (!selectedBrokerageAsset || !isBrokerageAsset(selectedBrokerageAsset)) {
|
|
12792
12374
|
return null;
|
|
12793
12375
|
}
|
|
@@ -12826,7 +12408,7 @@ var FunkitBrokerageProvider = ({
|
|
|
12826
12408
|
saveAuthConnectedExchange(walletId, exchange);
|
|
12827
12409
|
setIsConnected(true);
|
|
12828
12410
|
};
|
|
12829
|
-
return /* @__PURE__ */
|
|
12411
|
+
return /* @__PURE__ */ React22.createElement(
|
|
12830
12412
|
FunkitBrokerageContext.Provider,
|
|
12831
12413
|
{
|
|
12832
12414
|
value: {
|
|
@@ -12843,7 +12425,7 @@ var FunkitBrokerageProvider = ({
|
|
|
12843
12425
|
);
|
|
12844
12426
|
};
|
|
12845
12427
|
function useFunkitBrokerageContext() {
|
|
12846
|
-
const context =
|
|
12428
|
+
const context = useContext11(FunkitBrokerageContext);
|
|
12847
12429
|
if (!context) {
|
|
12848
12430
|
throw new Error("FunkitBrokerageContext not found");
|
|
12849
12431
|
}
|
|
@@ -12851,28 +12433,28 @@ function useFunkitBrokerageContext() {
|
|
|
12851
12433
|
}
|
|
12852
12434
|
|
|
12853
12435
|
// src/providers/FunkitI18nProvider.tsx
|
|
12854
|
-
import
|
|
12436
|
+
import React23, { useEffect as useEffect13 } from "react";
|
|
12855
12437
|
function FunkitI18nProvider({
|
|
12856
12438
|
children,
|
|
12857
12439
|
locale = "en"
|
|
12858
12440
|
}) {
|
|
12859
|
-
|
|
12441
|
+
useEffect13(() => {
|
|
12860
12442
|
const targetLanguage = localeMapping[locale];
|
|
12861
12443
|
if (i18n_default.language !== targetLanguage) {
|
|
12862
12444
|
i18n_default.changeLanguage(targetLanguage);
|
|
12863
12445
|
}
|
|
12864
12446
|
}, [locale]);
|
|
12865
|
-
return /* @__PURE__ */
|
|
12447
|
+
return /* @__PURE__ */ React23.createElement(React23.Fragment, null, children);
|
|
12866
12448
|
}
|
|
12867
12449
|
|
|
12868
12450
|
// src/providers/FunkitQuoteContext.tsx
|
|
12869
12451
|
import { RelayQuoteError as RelayQuoteError2 } from "@funkit/api-base";
|
|
12870
12452
|
import { isNotNullish as isNotNullish3 } from "@funkit/utils";
|
|
12871
|
-
import
|
|
12872
|
-
createContext as
|
|
12453
|
+
import React30, {
|
|
12454
|
+
createContext as createContext13,
|
|
12873
12455
|
useCallback as useCallback16,
|
|
12874
|
-
useContext as
|
|
12875
|
-
useEffect as
|
|
12456
|
+
useContext as useContext13,
|
|
12457
|
+
useEffect as useEffect15,
|
|
12876
12458
|
useState as useState13
|
|
12877
12459
|
} from "react";
|
|
12878
12460
|
|
|
@@ -12883,7 +12465,7 @@ import {
|
|
|
12883
12465
|
import { bluvoGetWithdrawableBalanceById as bluvoGetWithdrawableBalanceById2 } from "@funkit/api-base";
|
|
12884
12466
|
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO6 } from "@funkit/chains";
|
|
12885
12467
|
import { keepPreviousData as keepPreviousData2, useQuery as useQuery5 } from "@tanstack/react-query";
|
|
12886
|
-
import { useCallback as useCallback15, useMemo as
|
|
12468
|
+
import { useCallback as useCallback15, useMemo as useMemo15 } from "react";
|
|
12887
12469
|
import { parseUnits as parseUnits2 } from "viem";
|
|
12888
12470
|
|
|
12889
12471
|
// src/domains/wallet.ts
|
|
@@ -13023,7 +12605,7 @@ var useBluvoSupportedExchanges = ({
|
|
|
13023
12605
|
filterBy = DEFAULT_FILTER_BY
|
|
13024
12606
|
}) => {
|
|
13025
12607
|
const { authorizedConnections } = useFunkitBrokerageContext();
|
|
13026
|
-
const exchangeOptions =
|
|
12608
|
+
const exchangeOptions = useMemo15(
|
|
13027
12609
|
() => SUPPORTED_EXCHANGES.filter(
|
|
13028
12610
|
({ status: exchangeStatus }) => filterBy.includes(exchangeStatus)
|
|
13029
12611
|
).map(({ exchange, status }) => {
|
|
@@ -13090,22 +12672,22 @@ var useBluvo = () => {
|
|
|
13090
12672
|
// src/consts/quote.tsx
|
|
13091
12673
|
import { RelayQuoteError } from "@funkit/api-base";
|
|
13092
12674
|
import { ClientError } from "@funkit/utils";
|
|
13093
|
-
import
|
|
12675
|
+
import React28 from "react";
|
|
13094
12676
|
|
|
13095
12677
|
// src/components/FunkitTrans.tsx
|
|
13096
|
-
import
|
|
12678
|
+
import React24 from "react";
|
|
13097
12679
|
import { Trans } from "react-i18next";
|
|
13098
12680
|
function FunkitTrans(props) {
|
|
13099
|
-
return /* @__PURE__ */
|
|
12681
|
+
return /* @__PURE__ */ React24.createElement(Trans, { ...props, i18n: i18n_default });
|
|
13100
12682
|
}
|
|
13101
12683
|
|
|
13102
12684
|
// src/components/FunButton/FunLinkButton.tsx
|
|
13103
|
-
import
|
|
12685
|
+
import React26 from "react";
|
|
13104
12686
|
import clsx4 from "clsx";
|
|
13105
12687
|
|
|
13106
12688
|
// src/components/Text/Text.tsx
|
|
13107
|
-
import
|
|
13108
|
-
var Text =
|
|
12689
|
+
import React25 from "react";
|
|
12690
|
+
var Text = React25.forwardRef(
|
|
13109
12691
|
({
|
|
13110
12692
|
as = "div",
|
|
13111
12693
|
children,
|
|
@@ -13123,7 +12705,7 @@ var Text = React27.forwardRef(
|
|
|
13123
12705
|
weight = "regular",
|
|
13124
12706
|
testId
|
|
13125
12707
|
}, ref) => {
|
|
13126
|
-
return /* @__PURE__ */
|
|
12708
|
+
return /* @__PURE__ */ React25.createElement(
|
|
13127
12709
|
Box,
|
|
13128
12710
|
{
|
|
13129
12711
|
as,
|
|
@@ -13161,7 +12743,7 @@ function FunLinkButton({
|
|
|
13161
12743
|
}) {
|
|
13162
12744
|
const isLink = !!href;
|
|
13163
12745
|
const isExternalLink = !!href?.startsWith("http");
|
|
13164
|
-
return /* @__PURE__ */
|
|
12746
|
+
return /* @__PURE__ */ React26.createElement(
|
|
13165
12747
|
Box,
|
|
13166
12748
|
{
|
|
13167
12749
|
as: isLink ? "a" : "button",
|
|
@@ -13176,7 +12758,7 @@ function FunLinkButton({
|
|
|
13176
12758
|
target: isExternalLink ? "_blank" : void 0,
|
|
13177
12759
|
type: isLink ? void 0 : "button"
|
|
13178
12760
|
},
|
|
13179
|
-
/* @__PURE__ */
|
|
12761
|
+
/* @__PURE__ */ React26.createElement(
|
|
13180
12762
|
Text,
|
|
13181
12763
|
{
|
|
13182
12764
|
as: inline ? "span" : "div",
|
|
@@ -13196,7 +12778,7 @@ var ContactSupportLink = ({
|
|
|
13196
12778
|
inline = true,
|
|
13197
12779
|
href = CONTACT_US_LINK,
|
|
13198
12780
|
...rest
|
|
13199
|
-
}) => /* @__PURE__ */
|
|
12781
|
+
}) => /* @__PURE__ */ React26.createElement(
|
|
13200
12782
|
FunLinkButton,
|
|
13201
12783
|
{
|
|
13202
12784
|
text: text ?? children ?? "contact us",
|
|
@@ -13209,7 +12791,7 @@ var ContactSupportLink = ({
|
|
|
13209
12791
|
);
|
|
13210
12792
|
|
|
13211
12793
|
// src/domains/relay.tsx
|
|
13212
|
-
import
|
|
12794
|
+
import React27 from "react";
|
|
13213
12795
|
function isRelayQuoteSameChainAndAsset(details) {
|
|
13214
12796
|
const { currencyIn, currencyOut } = details;
|
|
13215
12797
|
if (!currencyIn || !currencyOut) {
|
|
@@ -13299,12 +12881,12 @@ function getRelayErrorMessages(t) {
|
|
|
13299
12881
|
},
|
|
13300
12882
|
["SANCTIONED_WALLET_ADDRESS" /* SANCTIONED_WALLET_ADDRESS */]: {
|
|
13301
12883
|
messageKey: "withdrawal.sanctionedWalletAddress",
|
|
13302
|
-
message: /* @__PURE__ */
|
|
12884
|
+
message: /* @__PURE__ */ React27.createElement(
|
|
13303
12885
|
FunkitTrans,
|
|
13304
12886
|
{
|
|
13305
12887
|
t,
|
|
13306
12888
|
i18nKey: "withdrawal.sanctionedWalletAddress",
|
|
13307
|
-
components: { ContactSupportLink: /* @__PURE__ */
|
|
12889
|
+
components: { ContactSupportLink: /* @__PURE__ */ React27.createElement(ContactSupportLink, { size: "10" }) }
|
|
13308
12890
|
}
|
|
13309
12891
|
)
|
|
13310
12892
|
},
|
|
@@ -13338,45 +12920,45 @@ function getRelayErrorMessages(t) {
|
|
|
13338
12920
|
},
|
|
13339
12921
|
["DESTINATION_TX_FAILED" /* DESTINATION_TX_FAILED */]: {
|
|
13340
12922
|
messageKey: "withdrawal.destinationTxFailed",
|
|
13341
|
-
message: /* @__PURE__ */
|
|
12923
|
+
message: /* @__PURE__ */ React27.createElement(
|
|
13342
12924
|
FunkitTrans,
|
|
13343
12925
|
{
|
|
13344
12926
|
t,
|
|
13345
12927
|
i18nKey: "withdrawal.destinationTxFailed",
|
|
13346
|
-
components: { ContactSupportLink: /* @__PURE__ */
|
|
12928
|
+
components: { ContactSupportLink: /* @__PURE__ */ React27.createElement(ContactSupportLink, { size: "10" }) }
|
|
13347
12929
|
}
|
|
13348
12930
|
)
|
|
13349
12931
|
},
|
|
13350
12932
|
["ERC20_ROUTER_ADDRESS_NOT_FOUND" /* ERC20_ROUTER_ADDRESS_NOT_FOUND */]: {
|
|
13351
12933
|
messageKey: "withdrawal.erc20RouterAddressNotFound",
|
|
13352
|
-
message: /* @__PURE__ */
|
|
12934
|
+
message: /* @__PURE__ */ React27.createElement(
|
|
13353
12935
|
FunkitTrans,
|
|
13354
12936
|
{
|
|
13355
12937
|
t,
|
|
13356
12938
|
i18nKey: "withdrawal.erc20RouterAddressNotFound",
|
|
13357
|
-
components: { ContactSupportLink: /* @__PURE__ */
|
|
12939
|
+
components: { ContactSupportLink: /* @__PURE__ */ React27.createElement(ContactSupportLink, { size: "10" }) }
|
|
13358
12940
|
}
|
|
13359
12941
|
)
|
|
13360
12942
|
},
|
|
13361
12943
|
["UNKNOWN_ERROR" /* UNKNOWN_ERROR */]: {
|
|
13362
12944
|
messageKey: "withdrawal.unknownError",
|
|
13363
|
-
message: /* @__PURE__ */
|
|
12945
|
+
message: /* @__PURE__ */ React27.createElement(
|
|
13364
12946
|
FunkitTrans,
|
|
13365
12947
|
{
|
|
13366
12948
|
t,
|
|
13367
12949
|
i18nKey: "withdrawal.unknownError",
|
|
13368
|
-
components: { ContactSupportLink: /* @__PURE__ */
|
|
12950
|
+
components: { ContactSupportLink: /* @__PURE__ */ React27.createElement(ContactSupportLink, { size: "10" }) }
|
|
13369
12951
|
}
|
|
13370
12952
|
)
|
|
13371
12953
|
},
|
|
13372
12954
|
["SWAP_QUOTE_FAILED" /* SWAP_QUOTE_FAILED */]: {
|
|
13373
12955
|
messageKey: "withdrawal.swapQuoteFailed",
|
|
13374
|
-
message: /* @__PURE__ */
|
|
12956
|
+
message: /* @__PURE__ */ React27.createElement(
|
|
13375
12957
|
FunkitTrans,
|
|
13376
12958
|
{
|
|
13377
12959
|
t,
|
|
13378
12960
|
i18nKey: "withdrawal.swapQuoteFailed",
|
|
13379
|
-
components: { ContactSupportLink: /* @__PURE__ */
|
|
12961
|
+
components: { ContactSupportLink: /* @__PURE__ */ React27.createElement(ContactSupportLink, { size: "10" }) }
|
|
13380
12962
|
}
|
|
13381
12963
|
)
|
|
13382
12964
|
},
|
|
@@ -13404,13 +12986,13 @@ var getPendingQuoteMessageGenerator = (t) => ({
|
|
|
13404
12986
|
var getDefaultQuoteError = (t) => ({
|
|
13405
12987
|
code: "QUOTE_FAILED",
|
|
13406
12988
|
messageKey: "quote.defaultError",
|
|
13407
|
-
message: /* @__PURE__ */
|
|
12989
|
+
message: /* @__PURE__ */ React28.createElement(
|
|
13408
12990
|
FunkitTrans,
|
|
13409
12991
|
{
|
|
13410
12992
|
t,
|
|
13411
12993
|
i18nKey: "quote.defaultError",
|
|
13412
12994
|
components: {
|
|
13413
|
-
ContactSupportLink: /* @__PURE__ */
|
|
12995
|
+
ContactSupportLink: /* @__PURE__ */ React28.createElement(ContactSupportLink, { size: "10" })
|
|
13414
12996
|
}
|
|
13415
12997
|
}
|
|
13416
12998
|
),
|
|
@@ -14010,11 +13592,11 @@ var trackEventFromFinalQuote = (finalEstimation, checkoutItem, eventName, quoteM
|
|
|
14010
13592
|
};
|
|
14011
13593
|
|
|
14012
13594
|
// src/providers/QuoteModeContext.tsx
|
|
14013
|
-
import
|
|
14014
|
-
createContext as
|
|
14015
|
-
useContext as
|
|
14016
|
-
useEffect as
|
|
14017
|
-
useMemo as
|
|
13595
|
+
import React29, {
|
|
13596
|
+
createContext as createContext12,
|
|
13597
|
+
useContext as useContext12,
|
|
13598
|
+
useEffect as useEffect14,
|
|
13599
|
+
useMemo as useMemo16,
|
|
14018
13600
|
useRef as useRef6
|
|
14019
13601
|
} from "react";
|
|
14020
13602
|
|
|
@@ -14022,7 +13604,7 @@ import React31, {
|
|
|
14022
13604
|
import * as dnum4 from "dnum";
|
|
14023
13605
|
|
|
14024
13606
|
// src/utils/tokenMath.ts
|
|
14025
|
-
import { formatCurrencyAndStringify
|
|
13607
|
+
import { formatCurrencyAndStringify } from "@funkit/utils";
|
|
14026
13608
|
import * as dnum3 from "dnum";
|
|
14027
13609
|
import { formatUnits as formatUnits4 } from "viem";
|
|
14028
13610
|
function mulByPriceRoundedDown(amount, price, resultDecimals) {
|
|
@@ -14045,7 +13627,7 @@ function floorToDecimals(value, decimals) {
|
|
|
14045
13627
|
return dnum3.toNumber(d, decimals);
|
|
14046
13628
|
}
|
|
14047
13629
|
function formatUsdFlooredToCent(balanceUsd) {
|
|
14048
|
-
return
|
|
13630
|
+
return formatCurrencyAndStringify(floorToDecimals(balanceUsd, 2));
|
|
14049
13631
|
}
|
|
14050
13632
|
|
|
14051
13633
|
// src/domains/quoteMode/exactOut.ts
|
|
@@ -14311,7 +13893,7 @@ function getGasEstimateWei(gasPriceWei, gasUnits) {
|
|
|
14311
13893
|
}
|
|
14312
13894
|
|
|
14313
13895
|
// src/providers/QuoteModeContext.tsx
|
|
14314
|
-
var QuoteModeContext =
|
|
13896
|
+
var QuoteModeContext = createContext12(
|
|
14315
13897
|
null
|
|
14316
13898
|
);
|
|
14317
13899
|
function QuoteModeProvider({ children }) {
|
|
@@ -14324,7 +13906,7 @@ function QuoteModeProvider({ children }) {
|
|
|
14324
13906
|
const isStablecoin = useIsStablecoin();
|
|
14325
13907
|
const config = checkoutItem?.initSettings.config;
|
|
14326
13908
|
const hasPostAction = config ? isCheckoutPostActionRequired(config) : void 0;
|
|
14327
|
-
const resolveQuoteBuilderParams =
|
|
13909
|
+
const resolveQuoteBuilderParams = useMemo16(
|
|
14328
13910
|
() => ({
|
|
14329
13911
|
hasPostAction,
|
|
14330
13912
|
isExactInEnabled,
|
|
@@ -14340,12 +13922,12 @@ function QuoteModeProvider({ children }) {
|
|
|
14340
13922
|
walletFlowEnableExactInputWithActions
|
|
14341
13923
|
]
|
|
14342
13924
|
);
|
|
14343
|
-
const builder =
|
|
13925
|
+
const builder = useMemo16(
|
|
14344
13926
|
() => resolveQuoteBuilder(resolveQuoteBuilderParams),
|
|
14345
13927
|
[resolveQuoteBuilderParams]
|
|
14346
13928
|
);
|
|
14347
13929
|
const lastLoggedKey = useRef6(null);
|
|
14348
|
-
|
|
13930
|
+
useEffect14(() => {
|
|
14349
13931
|
const checkoutId = checkoutItem?.id;
|
|
14350
13932
|
if (!checkoutId) {
|
|
14351
13933
|
return;
|
|
@@ -14383,10 +13965,10 @@ function QuoteModeProvider({ children }) {
|
|
|
14383
13965
|
config,
|
|
14384
13966
|
logEvent
|
|
14385
13967
|
]);
|
|
14386
|
-
return /* @__PURE__ */
|
|
13968
|
+
return /* @__PURE__ */ React29.createElement(QuoteModeContext.Provider, { value: builder }, children);
|
|
14387
13969
|
}
|
|
14388
13970
|
function useQuoteBuilder() {
|
|
14389
|
-
const ctx =
|
|
13971
|
+
const ctx = useContext12(QuoteModeContext);
|
|
14390
13972
|
if (ctx === null) {
|
|
14391
13973
|
throw new Error("useQuoteBuilder must be used within QuoteModeProvider");
|
|
14392
13974
|
}
|
|
@@ -14395,7 +13977,7 @@ function useQuoteBuilder() {
|
|
|
14395
13977
|
|
|
14396
13978
|
// src/providers/FunkitQuoteContext.tsx
|
|
14397
13979
|
var APPROVAL_METHOD_DEFAULT = "sign";
|
|
14398
|
-
var FunkitQuoteContext =
|
|
13980
|
+
var FunkitQuoteContext = createContext13({
|
|
14399
13981
|
latestQuote: null,
|
|
14400
13982
|
isQuoting: false,
|
|
14401
13983
|
quoteStepMessage: "",
|
|
@@ -14542,7 +14124,7 @@ function FunkitQuoteProvider({ children }) {
|
|
|
14542
14124
|
targetAssetAllowanceCoversAmount
|
|
14543
14125
|
});
|
|
14544
14126
|
const usePermit = showApprovalMethodToggle ? preferredApprovalMethod === "sign" : void 0;
|
|
14545
|
-
|
|
14127
|
+
useEffect15(() => {
|
|
14546
14128
|
if (isNotNullish3(logoutSymbol)) {
|
|
14547
14129
|
setLatestQuote(null);
|
|
14548
14130
|
setQuoteProgress({
|
|
@@ -14713,18 +14295,18 @@ function FunkitQuoteProvider({ children }) {
|
|
|
14713
14295
|
targetAssetPoolAllowance,
|
|
14714
14296
|
setTargetAssetPoolAllowance
|
|
14715
14297
|
};
|
|
14716
|
-
return /* @__PURE__ */
|
|
14298
|
+
return /* @__PURE__ */ React30.createElement(FunkitQuoteContext.Provider, { value: contextValue }, children);
|
|
14717
14299
|
}
|
|
14718
14300
|
function useQuoteContext() {
|
|
14719
|
-
return
|
|
14301
|
+
return useContext13(FunkitQuoteContext);
|
|
14720
14302
|
}
|
|
14721
14303
|
|
|
14722
14304
|
// src/providers/FunkitShadowHostProvider.tsx
|
|
14723
|
-
import
|
|
14305
|
+
import React33, { createContext as createContext15, useContext as useContext15 } from "react";
|
|
14724
14306
|
import { createPortal } from "react-dom";
|
|
14725
14307
|
|
|
14726
14308
|
// src/shadow/useMountShadowHost.ts
|
|
14727
|
-
import { useEffect as
|
|
14309
|
+
import { useEffect as useEffect16, useState as useState14 } from "react";
|
|
14728
14310
|
|
|
14729
14311
|
// src/shadow/adoptStyles.ts
|
|
14730
14312
|
var STYLE_ATTR_MARKER = "data-funkit-styles";
|
|
@@ -14759,7 +14341,7 @@ function mountShadowHost(shadowCss, themeId) {
|
|
|
14759
14341
|
}
|
|
14760
14342
|
function useMountShadowHost(shadowCss, themeId) {
|
|
14761
14343
|
const [container, setContainer] = useState14(null);
|
|
14762
|
-
|
|
14344
|
+
useEffect16(() => {
|
|
14763
14345
|
if (shadowCss === null) {
|
|
14764
14346
|
return;
|
|
14765
14347
|
}
|
|
@@ -14794,7 +14376,7 @@ function useMountShadowHost(shadowCss, themeId) {
|
|
|
14794
14376
|
}
|
|
14795
14377
|
|
|
14796
14378
|
// src/shadow/useShadowCss.ts
|
|
14797
|
-
import { useEffect as
|
|
14379
|
+
import { useEffect as useEffect17, useState as useState15 } from "react";
|
|
14798
14380
|
|
|
14799
14381
|
// src/shadow/loadShadowCss.ts
|
|
14800
14382
|
var RETRY_DELAYS_MS = [0, 1e3];
|
|
@@ -14856,7 +14438,7 @@ async function loadShadowCss() {
|
|
|
14856
14438
|
// src/shadow/useShadowCss.ts
|
|
14857
14439
|
function useShadowCss(enabled) {
|
|
14858
14440
|
const [css, setCss] = useState15(null);
|
|
14859
|
-
|
|
14441
|
+
useEffect17(() => {
|
|
14860
14442
|
if (!enabled || css !== null) {
|
|
14861
14443
|
return;
|
|
14862
14444
|
}
|
|
@@ -14874,7 +14456,7 @@ function useShadowCss(enabled) {
|
|
|
14874
14456
|
}
|
|
14875
14457
|
|
|
14876
14458
|
// src/providers/FunkitThemeStyle.tsx
|
|
14877
|
-
import
|
|
14459
|
+
import React32, { useMemo as useMemo17, useRef as useRef7 } from "react";
|
|
14878
14460
|
|
|
14879
14461
|
// src/utils/sanitizeHtml.ts
|
|
14880
14462
|
function sanitizeCssStyleContent(css) {
|
|
@@ -14913,22 +14495,22 @@ function cssStringFromTheme(theme, options = {}) {
|
|
|
14913
14495
|
}
|
|
14914
14496
|
|
|
14915
14497
|
// src/hooks/useIsomorphicEffect.ts
|
|
14916
|
-
import { useEffect as
|
|
14917
|
-
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect :
|
|
14498
|
+
import { useEffect as useEffect18, useLayoutEffect } from "react";
|
|
14499
|
+
var useIsomorphicLayoutEffect = typeof window !== "undefined" ? useLayoutEffect : useEffect18;
|
|
14918
14500
|
|
|
14919
14501
|
// src/providers/FunkitThemeProvider.tsx
|
|
14920
|
-
import
|
|
14502
|
+
import React31, { createContext as createContext14, useContext as useContext14, useEffect as useEffect19, useState as useState16 } from "react";
|
|
14921
14503
|
var FUNKIT_THEME_CACHE_KEY = "funkit-connect-is-light";
|
|
14922
14504
|
var DEFAULT_THEME_SET = {
|
|
14923
14505
|
lightTheme: lightTheme(),
|
|
14924
14506
|
darkTheme: darkTheme()
|
|
14925
14507
|
};
|
|
14926
14508
|
var DEFAULT_THEME = DEFAULT_THEME_SET.darkTheme;
|
|
14927
|
-
var ThemeIdContext =
|
|
14509
|
+
var ThemeIdContext = createContext14(void 0);
|
|
14928
14510
|
function isThemeSet(themeOrThemeSet) {
|
|
14929
14511
|
return themeOrThemeSet.lightTheme !== void 0 && themeOrThemeSet.darkTheme !== void 0;
|
|
14930
14512
|
}
|
|
14931
|
-
var ThemeContext =
|
|
14513
|
+
var ThemeContext = createContext14({
|
|
14932
14514
|
activeTheme: DEFAULT_THEME,
|
|
14933
14515
|
lightTheme: void 0,
|
|
14934
14516
|
darkTheme: void 0,
|
|
@@ -14948,7 +14530,7 @@ var useActiveTheme = () => {
|
|
|
14948
14530
|
darkTheme: darkTheme2,
|
|
14949
14531
|
toggleTheme,
|
|
14950
14532
|
themeColorScheme
|
|
14951
|
-
} =
|
|
14533
|
+
} = useContext14(ThemeContext);
|
|
14952
14534
|
return {
|
|
14953
14535
|
activeTheme,
|
|
14954
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` */
|
|
@@ -14992,7 +14574,7 @@ var FunkitThemeProvider = ({
|
|
|
14992
14574
|
const [activeTheme, setActiveTheme] = useState16(
|
|
14993
14575
|
getConfigTheme(themeOrThemeSet, systemColorScheme)
|
|
14994
14576
|
);
|
|
14995
|
-
|
|
14577
|
+
useEffect19(() => {
|
|
14996
14578
|
const handler = (e) => {
|
|
14997
14579
|
const colorScheme = e.matches ? "light" : "dark";
|
|
14998
14580
|
setSystemColorScheme(colorScheme);
|
|
@@ -15009,13 +14591,13 @@ var FunkitThemeProvider = ({
|
|
|
15009
14591
|
};
|
|
15010
14592
|
}
|
|
15011
14593
|
}, []);
|
|
15012
|
-
|
|
14594
|
+
useEffect19(() => {
|
|
15013
14595
|
setActiveTheme(getConfigTheme(themeOrThemeSet, systemColorScheme));
|
|
15014
14596
|
}, [systemColorScheme, themeOrThemeSet]);
|
|
15015
14597
|
const isFullThemeSet = isThemeSet(themeOrThemeSet);
|
|
15016
14598
|
const lightTheme2 = isFullThemeSet ? themeOrThemeSet.lightTheme : themeOrThemeSet;
|
|
15017
14599
|
const darkTheme2 = isFullThemeSet ? themeOrThemeSet.darkTheme : themeOrThemeSet;
|
|
15018
|
-
return /* @__PURE__ */
|
|
14600
|
+
return /* @__PURE__ */ React31.createElement(
|
|
15019
14601
|
ThemeContext.Provider,
|
|
15020
14602
|
{
|
|
15021
14603
|
value: {
|
|
@@ -15070,7 +14652,7 @@ function FunkitThemeStyle({
|
|
|
15070
14652
|
useStyleRefForTheme
|
|
15071
14653
|
}) {
|
|
15072
14654
|
const { activeTheme } = useActiveTheme();
|
|
15073
|
-
const themeStyles =
|
|
14655
|
+
const themeStyles = useMemo17(() => {
|
|
15074
14656
|
if (!activeTheme) {
|
|
15075
14657
|
return "";
|
|
15076
14658
|
}
|
|
@@ -15087,22 +14669,22 @@ function FunkitThemeStyle({
|
|
|
15087
14669
|
return null;
|
|
15088
14670
|
}
|
|
15089
14671
|
if (useStyleRefForTheme) {
|
|
15090
|
-
return /* @__PURE__ */
|
|
14672
|
+
return /* @__PURE__ */ React32.createElement("style", { ref: styleRef });
|
|
15091
14673
|
}
|
|
15092
|
-
return /* @__PURE__ */
|
|
14674
|
+
return /* @__PURE__ */ React32.createElement("style", { dangerouslySetInnerHTML: { __html: themeStyles } });
|
|
15093
14675
|
}
|
|
15094
14676
|
|
|
15095
14677
|
// src/providers/FunkitShadowHostProvider.tsx
|
|
15096
|
-
var ShadowContainerContext =
|
|
14678
|
+
var ShadowContainerContext = createContext15(null);
|
|
15097
14679
|
function useShadowContainer() {
|
|
15098
|
-
const container =
|
|
14680
|
+
const container = useContext15(ShadowContainerContext);
|
|
15099
14681
|
if (container) {
|
|
15100
14682
|
return container;
|
|
15101
14683
|
}
|
|
15102
14684
|
return typeof document === "undefined" ? null : document.body;
|
|
15103
14685
|
}
|
|
15104
14686
|
function useRootNode() {
|
|
15105
|
-
const container =
|
|
14687
|
+
const container = useContext15(ShadowContainerContext);
|
|
15106
14688
|
return container ? container.getRootNode() : document;
|
|
15107
14689
|
}
|
|
15108
14690
|
function FunkitShadowHostProvider({
|
|
@@ -15114,8 +14696,8 @@ function FunkitShadowHostProvider({
|
|
|
15114
14696
|
const isShadowDomEnabled = useFeatureGate("enable-shadow-dom");
|
|
15115
14697
|
const shadowCss = useShadowCss(isShadowDomEnabled);
|
|
15116
14698
|
const container = useMountShadowHost(shadowCss, themeId);
|
|
15117
|
-
return /* @__PURE__ */
|
|
15118
|
-
/* @__PURE__ */
|
|
14699
|
+
return /* @__PURE__ */ React33.createElement(ShadowContainerContext.Provider, { value: container }, children, container && createPortal(
|
|
14700
|
+
/* @__PURE__ */ React33.createElement(
|
|
15119
14701
|
FunkitThemeStyle,
|
|
15120
14702
|
{
|
|
15121
14703
|
selector,
|
|
@@ -15126,15 +14708,110 @@ function FunkitShadowHostProvider({
|
|
|
15126
14708
|
));
|
|
15127
14709
|
}
|
|
15128
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
|
+
|
|
15129
14806
|
// src/providers/ModalSizeContext.tsx
|
|
15130
|
-
import React36, { createContext as
|
|
14807
|
+
import React36, { createContext as createContext16 } from "react";
|
|
15131
14808
|
var ModalSizeOptions = {
|
|
15132
14809
|
COMPACT: "compact",
|
|
15133
14810
|
MEDIUM: "medium",
|
|
15134
14811
|
WIDE: "wide",
|
|
15135
14812
|
EXTRA_WIDE: "extraWide"
|
|
15136
14813
|
};
|
|
15137
|
-
var ModalSizeContext =
|
|
14814
|
+
var ModalSizeContext = createContext16(ModalSizeOptions.WIDE);
|
|
15138
14815
|
function ModalSizeProvider({
|
|
15139
14816
|
children,
|
|
15140
14817
|
modalSize
|
|
@@ -15143,19 +14820,19 @@ function ModalSizeProvider({
|
|
|
15143
14820
|
}
|
|
15144
14821
|
|
|
15145
14822
|
// src/providers/UserPresenceContext.tsx
|
|
15146
|
-
import React37, { useEffect as
|
|
14823
|
+
import React37, { useEffect as useEffect21 } from "react";
|
|
15147
14824
|
import {
|
|
15148
|
-
createContext as
|
|
15149
|
-
useContext as
|
|
14825
|
+
createContext as createContext17,
|
|
14826
|
+
useContext as useContext16,
|
|
15150
14827
|
useState as useState17
|
|
15151
14828
|
} from "react";
|
|
15152
14829
|
var DELAY = 5 * 60 * 1e3;
|
|
15153
|
-
var UserPresenceContext =
|
|
14830
|
+
var UserPresenceContext = createContext17({
|
|
15154
14831
|
isAway: false
|
|
15155
14832
|
});
|
|
15156
14833
|
var UserPresenceProvider = ({ children }) => {
|
|
15157
14834
|
const [isAway, setIsAway] = useState17(false);
|
|
15158
|
-
|
|
14835
|
+
useEffect21(() => {
|
|
15159
14836
|
let timeoutId;
|
|
15160
14837
|
const handleVisibilityChange = () => {
|
|
15161
14838
|
if (document.visibilityState === "visible") {
|
|
@@ -15173,10 +14850,10 @@ var UserPresenceProvider = ({ children }) => {
|
|
|
15173
14850
|
}, []);
|
|
15174
14851
|
return /* @__PURE__ */ React37.createElement(UserPresenceContext.Provider, { value: { isAway } }, children);
|
|
15175
14852
|
};
|
|
15176
|
-
var useUserPresence = () =>
|
|
14853
|
+
var useUserPresence = () => useContext16(UserPresenceContext);
|
|
15177
14854
|
|
|
15178
14855
|
// src/wallets/useAdoptionConnectionGuard.ts
|
|
15179
|
-
import { useEffect as
|
|
14856
|
+
import { useEffect as useEffect22 } from "react";
|
|
15180
14857
|
var pendingUserInitiatedConnectorUids = /* @__PURE__ */ new Set();
|
|
15181
14858
|
async function withUserInitiatedConnection(connectorUid, connect) {
|
|
15182
14859
|
pendingUserInitiatedConnectorUids.add(connectorUid);
|
|
@@ -15188,7 +14865,7 @@ async function withUserInitiatedConnection(connectorUid, connect) {
|
|
|
15188
14865
|
}
|
|
15189
14866
|
function useAdoptionConnectionGuard(adoptedConnectorId) {
|
|
15190
14867
|
const config = useConfig();
|
|
15191
|
-
|
|
14868
|
+
useEffect22(() => {
|
|
15192
14869
|
const approvedConnectorUids = /* @__PURE__ */ new Set();
|
|
15193
14870
|
const evictUnapprovedConnections = (connections) => {
|
|
15194
14871
|
for (const uid of approvedConnectorUids) {
|
|
@@ -15221,7 +14898,7 @@ function useAdoptionConnectionGuard(adoptedConnectorId) {
|
|
|
15221
14898
|
}
|
|
15222
14899
|
|
|
15223
14900
|
// src/wallets/useWalletAdoption.ts
|
|
15224
|
-
import { useEffect as
|
|
14901
|
+
import { useEffect as useEffect23, useRef as useRef8 } from "react";
|
|
15225
14902
|
|
|
15226
14903
|
// src/utils/signature.ts
|
|
15227
14904
|
import { isSwitchChainError, isUserRejectedError } from "@funkit/connect-core";
|
|
@@ -15245,7 +14922,7 @@ function useWalletAdoption({
|
|
|
15245
14922
|
const initialChainId = useInitialChainId();
|
|
15246
14923
|
const funkitConnectChains = useFunkitConnectChains();
|
|
15247
14924
|
const startedRef = useRef8(false);
|
|
15248
|
-
|
|
14925
|
+
useEffect23(() => {
|
|
15249
14926
|
if (startedRef.current) {
|
|
15250
14927
|
return;
|
|
15251
14928
|
}
|
|
@@ -15327,7 +15004,7 @@ function useWalletAdoption({
|
|
|
15327
15004
|
|
|
15328
15005
|
// src/providers/usePreloadImages.ts
|
|
15329
15006
|
import { isNotNullish as isNotNullish4 } from "@funkit/utils";
|
|
15330
|
-
import { useCallback as useCallback17, useEffect as
|
|
15007
|
+
import { useCallback as useCallback17, useEffect as useEffect24 } from "react";
|
|
15331
15008
|
|
|
15332
15009
|
// src/wallets/useWalletConnectors.ts
|
|
15333
15010
|
import { indexBy } from "@funkit/utils";
|
|
@@ -15588,7 +15265,7 @@ function usePreloadImages() {
|
|
|
15588
15265
|
...funkitConnectChains.map((chain) => chain.iconUrl).filter(isNotNullish4)
|
|
15589
15266
|
);
|
|
15590
15267
|
}, [walletConnectors, funkitConnectChains]);
|
|
15591
|
-
|
|
15268
|
+
useEffect24(() => {
|
|
15592
15269
|
preloadImages();
|
|
15593
15270
|
}, [preloadImages]);
|
|
15594
15271
|
}
|
|
@@ -15620,12 +15297,12 @@ var createThemeRootSelector = (id) => {
|
|
|
15620
15297
|
}
|
|
15621
15298
|
return id ? `[${attr}="${id}"]` : `[${attr}]`;
|
|
15622
15299
|
};
|
|
15623
|
-
var ThemeRootContext =
|
|
15300
|
+
var ThemeRootContext = createContext18({
|
|
15624
15301
|
id: void 0,
|
|
15625
15302
|
element: null
|
|
15626
15303
|
});
|
|
15627
|
-
var useThemeRootProps = () => createThemeRootProps(
|
|
15628
|
-
var useThemeRootElement = () =>
|
|
15304
|
+
var useThemeRootProps = () => createThemeRootProps(useContext17(ThemeRootContext).id);
|
|
15305
|
+
var useThemeRootElement = () => useContext17(ThemeRootContext).element;
|
|
15629
15306
|
function createConnectorlessWagmiConfig() {
|
|
15630
15307
|
return createConfig({
|
|
15631
15308
|
chains: getDefaultChains(),
|
|
@@ -15640,8 +15317,8 @@ function FunkitProvider(props) {
|
|
|
15640
15317
|
const adoptWallet = adoptWalletRef.current;
|
|
15641
15318
|
const adoptedWalletChanged = props.adoptWallet?.connectorId !== adoptWallet?.connectorId;
|
|
15642
15319
|
validateFunkitProviderProps({ ...props, adoptWallet });
|
|
15643
|
-
const existingWagmiConfig =
|
|
15644
|
-
const existingQueryClient =
|
|
15320
|
+
const existingWagmiConfig = useContext17(WagmiContext);
|
|
15321
|
+
const existingQueryClient = useContext17(QueryClientContext);
|
|
15645
15322
|
const shouldSelfMount = !!props.solanaWalletOnly && !props.wagmiConfig && !existingWagmiConfig;
|
|
15646
15323
|
const selfMounted = useMemo19(
|
|
15647
15324
|
() => shouldSelfMount ? {
|
|
@@ -15672,7 +15349,7 @@ function FunkitProvider(props) {
|
|
|
15672
15349
|
]);
|
|
15673
15350
|
const finalQueryClient = props.queryClient;
|
|
15674
15351
|
const sdkVersion = useMemo19(() => getCurrentSdkVersion(), []);
|
|
15675
|
-
|
|
15352
|
+
useEffect25(() => {
|
|
15676
15353
|
logger.configure(
|
|
15677
15354
|
props.funkitConfig.apiKey,
|
|
15678
15355
|
!!props.debug,
|
|
@@ -15733,7 +15410,7 @@ function getConfiguredHttpRpcUrl(config, chainId2) {
|
|
|
15733
15410
|
function useInitializeRelayClient(source) {
|
|
15734
15411
|
const config = useConfig();
|
|
15735
15412
|
const initializedRef = useRef9(false);
|
|
15736
|
-
|
|
15413
|
+
useEffect25(() => {
|
|
15737
15414
|
if (initializedRef.current) {
|
|
15738
15415
|
return;
|
|
15739
15416
|
}
|
|
@@ -15881,7 +15558,7 @@ var tooltipContent = "z1l38i7 _1rsrm2fq0 _1rsrm2fs2 _1rsrm2fu2 _1rsrm2fnw _1rsrm
|
|
|
15881
15558
|
var tooltipTrigger = "z1l38i5";
|
|
15882
15559
|
|
|
15883
15560
|
// src/components/FunTooltip/FunTooltip.tsx
|
|
15884
|
-
var TooltipAnchorRefContext =
|
|
15561
|
+
var TooltipAnchorRefContext = createContext19(null);
|
|
15885
15562
|
var FunTooltip = ({
|
|
15886
15563
|
content: content2,
|
|
15887
15564
|
children = /* @__PURE__ */ React40.createElement(Box, { color: { base: "tertiaryText", hover: "primaryText" } }, /* @__PURE__ */ React40.createElement(InfoIcon, null)),
|
|
@@ -15892,7 +15569,7 @@ var FunTooltip = ({
|
|
|
15892
15569
|
startDelay = 0,
|
|
15893
15570
|
width
|
|
15894
15571
|
}) => {
|
|
15895
|
-
const anchorRef =
|
|
15572
|
+
const anchorRef = useContext18(TooltipAnchorRefContext);
|
|
15896
15573
|
const themeRootElement = useThemeRootElement();
|
|
15897
15574
|
const [open, setOpen] = useState19(false);
|
|
15898
15575
|
const hasHover = useHasHover();
|
|
@@ -16138,7 +15815,7 @@ function getCheckoutStateBooleans(checkoutState, refundState) {
|
|
|
16138
15815
|
}
|
|
16139
15816
|
|
|
16140
15817
|
// src/components/FunCheckoutHistory/FunCheckoutStatus.tsx
|
|
16141
|
-
import React52, { useEffect as
|
|
15818
|
+
import React52, { useEffect as useEffect28, useMemo as useMemo21, useState as useState23 } from "react";
|
|
16142
15819
|
|
|
16143
15820
|
// src/components/TransactionStatus/TransactionStatus.tsx
|
|
16144
15821
|
import {
|
|
@@ -16146,7 +15823,7 @@ import {
|
|
|
16146
15823
|
} from "motion/react";
|
|
16147
15824
|
import React47, {
|
|
16148
15825
|
useCallback as useCallback18,
|
|
16149
|
-
useEffect as
|
|
15826
|
+
useEffect as useEffect27,
|
|
16150
15827
|
useMemo as useMemo20,
|
|
16151
15828
|
useRef as useRef10,
|
|
16152
15829
|
useState as useState22
|
|
@@ -16521,7 +16198,7 @@ var AnimatedSpinner = ({
|
|
|
16521
16198
|
|
|
16522
16199
|
// src/components/TransactionStatus/AnimatedText.tsx
|
|
16523
16200
|
import { AnimatePresence as AnimatePresence2, motion as motion5 } from "motion/react";
|
|
16524
|
-
import React46, { useEffect as
|
|
16201
|
+
import React46, { useEffect as useEffect26, useState as useState21 } from "react";
|
|
16525
16202
|
var AnimatedText = ({
|
|
16526
16203
|
animationDelay = 0,
|
|
16527
16204
|
animationDirection = -1,
|
|
@@ -16534,7 +16211,7 @@ var AnimatedText = ({
|
|
|
16534
16211
|
...props
|
|
16535
16212
|
}) => {
|
|
16536
16213
|
const [initialTextKey, setInitialTextKey] = useState21(textKey);
|
|
16537
|
-
|
|
16214
|
+
useEffect26(() => {
|
|
16538
16215
|
setInitialTextKey((prev) => prev === textKey ? prev : "");
|
|
16539
16216
|
}, [textKey]);
|
|
16540
16217
|
return /* @__PURE__ */ React46.createElement(AnimatePresence2, { mode: animationMode }, /* @__PURE__ */ React46.createElement(
|
|
@@ -16751,12 +16428,12 @@ var TransactionStatus = ({
|
|
|
16751
16428
|
},
|
|
16752
16429
|
[animate]
|
|
16753
16430
|
);
|
|
16754
|
-
|
|
16431
|
+
useEffect27(() => {
|
|
16755
16432
|
if (initialStatus === "progress") {
|
|
16756
16433
|
startSpinning(initialStep);
|
|
16757
16434
|
}
|
|
16758
16435
|
}, [initialStatus, initialStep, startSpinning]);
|
|
16759
|
-
|
|
16436
|
+
useEffect27(() => {
|
|
16760
16437
|
if (transitioningToStatus !== currentStatus || transitioningToStep !== currentStep) {
|
|
16761
16438
|
return;
|
|
16762
16439
|
}
|
|
@@ -17201,14 +16878,14 @@ function FunCheckoutStatusLoaded({
|
|
|
17201
16878
|
[activeCheckoutItem, checkoutHistoryItem]
|
|
17202
16879
|
);
|
|
17203
16880
|
const [currentTimeMs, setCurrentTimeMs] = useState23(Date.now());
|
|
17204
|
-
|
|
16881
|
+
useEffect28(() => {
|
|
17205
16882
|
const interval = setInterval(() => setCurrentTimeMs(Date.now()), 1e3);
|
|
17206
16883
|
return () => clearInterval(interval);
|
|
17207
16884
|
}, []);
|
|
17208
16885
|
const onOrderDelayedEvent = useEffectEvent(() => onOrderDelayed?.());
|
|
17209
16886
|
const elapsedSeconds = (currentTimeMs - startTimeMs) / 1e3;
|
|
17210
16887
|
const isNewlyDelayed = isProcessing && elapsedSeconds >= 60;
|
|
17211
|
-
|
|
16888
|
+
useEffect28(() => {
|
|
17212
16889
|
if (isNewlyDelayed) {
|
|
17213
16890
|
onOrderDelayedEvent();
|
|
17214
16891
|
}
|
|
@@ -17240,7 +16917,7 @@ function extractStartTimeMs(historyCheckoutItemId, activeCheckoutItem, { created
|
|
|
17240
16917
|
}
|
|
17241
16918
|
|
|
17242
16919
|
// src/components/FunCheckoutHistory/FunDirectExecutionStatus.tsx
|
|
17243
|
-
import React53, { useEffect as
|
|
16920
|
+
import React53, { useEffect as useEffect29, useState as useState24 } from "react";
|
|
17244
16921
|
|
|
17245
16922
|
// src/hooks/useCheckoutDirectExecutionHistory.ts
|
|
17246
16923
|
import {
|
|
@@ -17444,7 +17121,7 @@ function FunDirectExecutionStatusLoaded({
|
|
|
17444
17121
|
const progress = getCheckoutProgress(directExecution.clientMetadata.id);
|
|
17445
17122
|
const startTimeMs = directExecution.createdTimeMs;
|
|
17446
17123
|
const [currentTimeMs, setCurrentTimeMs] = useState24(Date.now());
|
|
17447
|
-
|
|
17124
|
+
useEffect29(() => {
|
|
17448
17125
|
const interval = setInterval(() => setCurrentTimeMs(Date.now()), 1e3);
|
|
17449
17126
|
return () => clearInterval(interval);
|
|
17450
17127
|
}, []);
|
|
@@ -17572,7 +17249,7 @@ import React56 from "react";
|
|
|
17572
17249
|
|
|
17573
17250
|
// src/components/ModalHeightAnimationLayer/ModalHeightAnimationLayer.tsx
|
|
17574
17251
|
import { motion as motion6 } from "motion/react";
|
|
17575
|
-
import React55, { useEffect as
|
|
17252
|
+
import React55, { useEffect as useEffect30, useRef as useRef12, useState as useState26 } from "react";
|
|
17576
17253
|
var MODAL_HEIGHT_ANIMATION_TRANSITION = {
|
|
17577
17254
|
duration: 0.15,
|
|
17578
17255
|
ease: [0.33, 1, 0.68, 1]
|
|
@@ -17585,7 +17262,7 @@ function ModalHeightAnimationLayer({
|
|
|
17585
17262
|
const animationFrameRef = useRef12(null);
|
|
17586
17263
|
const resizeObserverRef = useRef12(null);
|
|
17587
17264
|
const [height, setHeight] = useState26("auto");
|
|
17588
|
-
|
|
17265
|
+
useEffect30(() => {
|
|
17589
17266
|
if (containerRef.current) {
|
|
17590
17267
|
resizeObserverRef.current = new ResizeObserver((entries) => {
|
|
17591
17268
|
animationFrameRef.current = requestAnimationFrame(() => {
|
|
@@ -17649,7 +17326,7 @@ function WithdrawalModalHeightAnimationWrapper({
|
|
|
17649
17326
|
}
|
|
17650
17327
|
|
|
17651
17328
|
// src/hooks/track/analytics/useWithdrawalAnalytics.ts
|
|
17652
|
-
import { useCallback as useCallback20, useEffect as
|
|
17329
|
+
import { useCallback as useCallback20, useEffect as useEffect31, useRef as useRef13 } from "react";
|
|
17653
17330
|
|
|
17654
17331
|
// src/hooks/track/useTrackV2.ts
|
|
17655
17332
|
import { useCallback as useCallback19 } from "react";
|
|
@@ -17690,6 +17367,272 @@ function useTrackV2() {
|
|
|
17690
17367
|
);
|
|
17691
17368
|
}
|
|
17692
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
|
+
|
|
17693
17636
|
// src/hooks/track/analytics/quote.ts
|
|
17694
17637
|
import { extractRelayFeeInfo } from "@funkit/connect-core";
|
|
17695
17638
|
var NULL_VISIBLE_QUOTE_FEE_PROPERTIES = {
|
|
@@ -17757,7 +17700,7 @@ function useWithdrawalAnalytics() {
|
|
|
17757
17700
|
const { checkoutItem } = useCheckoutContext();
|
|
17758
17701
|
const transferInteractionCountRef = useRef13(0);
|
|
17759
17702
|
const checkoutId = checkoutItem?.id;
|
|
17760
|
-
|
|
17703
|
+
useEffect31(() => {
|
|
17761
17704
|
transferInteractionCountRef.current = 0;
|
|
17762
17705
|
}, [checkoutId]);
|
|
17763
17706
|
const trackWithdrawalAmountConfirmed = useCallback20(
|
|
@@ -17850,7 +17793,7 @@ function useWithdrawalAnalytics() {
|
|
|
17850
17793
|
}
|
|
17851
17794
|
|
|
17852
17795
|
// src/hooks/useAnimatedNavigation.ts
|
|
17853
|
-
import { useCallback as useCallback21, useEffect as
|
|
17796
|
+
import { useCallback as useCallback21, useEffect as useEffect32, useRef as useRef14, useState as useState27 } from "react";
|
|
17854
17797
|
|
|
17855
17798
|
// src/css/modalTransitionStyles.css.ts
|
|
17856
17799
|
var animateContentInClass = "stgjxl2";
|
|
@@ -17881,7 +17824,7 @@ function useAnimatedNavigation(callback) {
|
|
|
17881
17824
|
const [isSkipped, setIsSkipped] = useState27(false);
|
|
17882
17825
|
const [isReversed, setIsReversed] = useState27(false);
|
|
17883
17826
|
const pendingTimers = useRef14(/* @__PURE__ */ new Set());
|
|
17884
|
-
|
|
17827
|
+
useEffect32(
|
|
17885
17828
|
() => () => {
|
|
17886
17829
|
for (const timer of pendingTimers.current) {
|
|
17887
17830
|
clearTimeout(timer);
|
|
@@ -17929,14 +17872,16 @@ function useAnimatedNavigation(callback) {
|
|
|
17929
17872
|
}
|
|
17930
17873
|
|
|
17931
17874
|
// src/modals/CheckoutModal/SwappedIframe/SwappedIframe.tsx
|
|
17932
|
-
import React58, { useEffect as
|
|
17875
|
+
import React58, { useEffect as useEffect33, useState as useState29 } from "react";
|
|
17933
17876
|
|
|
17934
17877
|
// src/providers/SwappedProvider.tsx
|
|
17935
|
-
import {
|
|
17878
|
+
import {
|
|
17879
|
+
useSwappedSession
|
|
17880
|
+
} from "@funkit/connect-core";
|
|
17936
17881
|
import React57, {
|
|
17937
|
-
createContext as
|
|
17882
|
+
createContext as createContext20,
|
|
17938
17883
|
useCallback as useCallback22,
|
|
17939
|
-
useContext as
|
|
17884
|
+
useContext as useContext19,
|
|
17940
17885
|
useMemo as useMemo23,
|
|
17941
17886
|
useRef as useRef15,
|
|
17942
17887
|
useState as useState28
|
|
@@ -18153,8 +18098,8 @@ function createIframeSwappedTransport({
|
|
|
18153
18098
|
}
|
|
18154
18099
|
|
|
18155
18100
|
// src/providers/SwappedProvider.tsx
|
|
18156
|
-
var SwappedContext =
|
|
18157
|
-
function useSwappedSlot(swappedTheme) {
|
|
18101
|
+
var SwappedContext = createContext20(null);
|
|
18102
|
+
function useSwappedSlot(swappedTheme, buyingCrypto) {
|
|
18158
18103
|
const [iframeUrl, setIframeUrlState] = useState28(null);
|
|
18159
18104
|
const iframeRef = useRef15(null);
|
|
18160
18105
|
const iframeUrlRef = useRef15(iframeUrl);
|
|
@@ -18166,7 +18111,12 @@ function useSwappedSlot(swappedTheme) {
|
|
|
18166
18111
|
}),
|
|
18167
18112
|
[]
|
|
18168
18113
|
);
|
|
18169
|
-
const session = useSwappedSession({
|
|
18114
|
+
const session = useSwappedSession({
|
|
18115
|
+
transport,
|
|
18116
|
+
swappedTheme,
|
|
18117
|
+
buyingCrypto,
|
|
18118
|
+
logger
|
|
18119
|
+
});
|
|
18170
18120
|
const setIframeRef = useCallback22((el) => {
|
|
18171
18121
|
iframeRef.current = el;
|
|
18172
18122
|
}, []);
|
|
@@ -18211,9 +18161,12 @@ function useSwappedSlot(swappedTheme) {
|
|
|
18211
18161
|
]
|
|
18212
18162
|
);
|
|
18213
18163
|
}
|
|
18214
|
-
function SwappedProvider({
|
|
18164
|
+
function SwappedProvider({
|
|
18165
|
+
children,
|
|
18166
|
+
buyingCrypto
|
|
18167
|
+
}) {
|
|
18215
18168
|
const swappedTheme = useSwappedIframeTheme();
|
|
18216
|
-
const deposit = useSwappedSlot(swappedTheme);
|
|
18169
|
+
const deposit = useSwappedSlot(swappedTheme, buyingCrypto);
|
|
18217
18170
|
const withdrawal = useSwappedSlot(swappedTheme);
|
|
18218
18171
|
const value = useMemo23(
|
|
18219
18172
|
() => ({ deposit, withdrawal, swappedTheme }),
|
|
@@ -18222,14 +18175,14 @@ function SwappedProvider({ children }) {
|
|
|
18222
18175
|
return /* @__PURE__ */ React57.createElement(SwappedContext.Provider, { value }, children);
|
|
18223
18176
|
}
|
|
18224
18177
|
function useSwappedContext(mode) {
|
|
18225
|
-
const ctx =
|
|
18178
|
+
const ctx = useContext19(SwappedContext);
|
|
18226
18179
|
if (!ctx) {
|
|
18227
18180
|
throw new Error("useSwappedContext must be used within SwappedProvider");
|
|
18228
18181
|
}
|
|
18229
18182
|
return ctx[mode];
|
|
18230
18183
|
}
|
|
18231
18184
|
function useSwappedTheme() {
|
|
18232
|
-
const ctx =
|
|
18185
|
+
const ctx = useContext19(SwappedContext);
|
|
18233
18186
|
if (!ctx) {
|
|
18234
18187
|
throw new Error("useSwappedTheme must be used within SwappedProvider");
|
|
18235
18188
|
}
|
|
@@ -18244,7 +18197,7 @@ var SwappedIframe = ({ mode }) => {
|
|
|
18244
18197
|
const { iframeUrl, isSwappedReady, isActive, setIframeRef } = useSwappedContext(mode);
|
|
18245
18198
|
const [visible, setVisible] = useState29(false);
|
|
18246
18199
|
const shouldShow = isActive && isSwappedReady;
|
|
18247
|
-
|
|
18200
|
+
useEffect33(() => {
|
|
18248
18201
|
if (shouldShow) {
|
|
18249
18202
|
const frame = requestAnimationFrame(() => setVisible(true));
|
|
18250
18203
|
return () => cancelAnimationFrame(frame);
|
|
@@ -18303,8 +18256,8 @@ import { isMobile as isMobile3 } from "@funkit/utils";
|
|
|
18303
18256
|
import clsx10 from "clsx";
|
|
18304
18257
|
import React77, {
|
|
18305
18258
|
useCallback as useCallback25,
|
|
18306
|
-
useContext as
|
|
18307
|
-
useEffect as
|
|
18259
|
+
useContext as useContext20,
|
|
18260
|
+
useEffect as useEffect37,
|
|
18308
18261
|
useRef as useRef17
|
|
18309
18262
|
} from "react";
|
|
18310
18263
|
import { createPortal as createPortal2 } from "react-dom";
|
|
@@ -18312,7 +18265,7 @@ import { RemoveScroll } from "react-remove-scroll";
|
|
|
18312
18265
|
import { AnimatePresence as AnimatePresence3, motion as motion8 } from "motion/react";
|
|
18313
18266
|
|
|
18314
18267
|
// src/hooks/useScrollDivider.ts
|
|
18315
|
-
import { useCallback as useCallback23, useEffect as
|
|
18268
|
+
import { useCallback as useCallback23, useEffect as useEffect34, useState as useState30 } from "react";
|
|
18316
18269
|
var useScrollDivider = () => {
|
|
18317
18270
|
const [refElement, setRefElement] = useState30(null);
|
|
18318
18271
|
const ref = useCallback23((node) => setRefElement(node), []);
|
|
@@ -18320,7 +18273,7 @@ var useScrollDivider = () => {
|
|
|
18320
18273
|
const [isAtBottom, setIsAtBottom] = useState30(false);
|
|
18321
18274
|
const [isScrollable, setIsScrollable] = useState30(false);
|
|
18322
18275
|
const [isScrolling, setIsScrolling] = useState30(false);
|
|
18323
|
-
|
|
18276
|
+
useEffect34(() => {
|
|
18324
18277
|
const content2 = refElement;
|
|
18325
18278
|
if (!content2 || !window.ResizeObserver) {
|
|
18326
18279
|
return;
|
|
@@ -19478,7 +19431,7 @@ var PaddedScrollableArea = React75.forwardRef(function PaddedScrollableArea2({ p
|
|
|
19478
19431
|
});
|
|
19479
19432
|
|
|
19480
19433
|
// src/components/Dialog/FocusTrap.tsx
|
|
19481
|
-
import React76, { useCallback as useCallback24, useEffect as
|
|
19434
|
+
import React76, { useCallback as useCallback24, useEffect as useEffect35, useRef as useRef16 } from "react";
|
|
19482
19435
|
var MAX_SHADOW_DEPTH = 32;
|
|
19483
19436
|
var getActiveElementAcrossShadowRoots = () => {
|
|
19484
19437
|
let active2 = document.activeElement;
|
|
@@ -19503,14 +19456,14 @@ var moveFocusWithin = (element2, position) => {
|
|
|
19503
19456
|
};
|
|
19504
19457
|
function FocusTrap(props) {
|
|
19505
19458
|
const contentRef = useRef16(null);
|
|
19506
|
-
|
|
19459
|
+
useEffect35(() => {
|
|
19507
19460
|
const previouslyActiveElement = getActiveElementAcrossShadowRoots();
|
|
19508
19461
|
return () => {
|
|
19509
19462
|
;
|
|
19510
19463
|
previouslyActiveElement.focus?.();
|
|
19511
19464
|
};
|
|
19512
19465
|
}, []);
|
|
19513
|
-
|
|
19466
|
+
useEffect35(() => {
|
|
19514
19467
|
if (contentRef.current) {
|
|
19515
19468
|
const elementToFocus = contentRef.current.querySelector("[data-auto-focus]");
|
|
19516
19469
|
if (elementToFocus) {
|
|
@@ -19551,7 +19504,7 @@ function FocusTrap(props) {
|
|
|
19551
19504
|
}
|
|
19552
19505
|
|
|
19553
19506
|
// src/components/Dialog/hooks.ts
|
|
19554
|
-
import { useEffect as
|
|
19507
|
+
import { useEffect as useEffect36, useState as useState32 } from "react";
|
|
19555
19508
|
var MODAL_BOTTOM_BAR_WRAPPER_ID = "fun-modal-bottom-bar-wrapper";
|
|
19556
19509
|
var MODAL_BOTTOM_BAR_IDS = {
|
|
19557
19510
|
checkout: "checkout-modal-bottom-bar",
|
|
@@ -19630,7 +19583,7 @@ function useBottomBarHasNoChildren() {
|
|
|
19630
19583
|
const withdrawalBottomBarElement = useWithdrawalBottomBarElement();
|
|
19631
19584
|
const connectWalletBottomBarElement = useConnectWalletBottomBarElement();
|
|
19632
19585
|
const [hasNoChildren, setHasNoChildren] = useState32(false);
|
|
19633
|
-
|
|
19586
|
+
useEffect36(() => {
|
|
19634
19587
|
const node = connectWalletBottomBarElement || checkoutBottomBarElement || withdrawalBottomBarElement || generalBottomBarElement;
|
|
19635
19588
|
if (!node) {
|
|
19636
19589
|
return;
|
|
@@ -19683,7 +19636,7 @@ function Dialog({
|
|
|
19683
19636
|
backgroundOverlay,
|
|
19684
19637
|
withoutBorder = false
|
|
19685
19638
|
}) {
|
|
19686
|
-
|
|
19639
|
+
useEffect37(() => {
|
|
19687
19640
|
const handleEscape = (event) => open && event.key === "Escape" && onClose();
|
|
19688
19641
|
if (isSmartCloseable) {
|
|
19689
19642
|
document.addEventListener("keydown", handleEscape);
|
|
@@ -19807,7 +19760,7 @@ var DialogWrapper = ({
|
|
|
19807
19760
|
withoutBorder = false
|
|
19808
19761
|
}) => {
|
|
19809
19762
|
const mobile = isMobile3();
|
|
19810
|
-
const modalSize =
|
|
19763
|
+
const modalSize = useContext20(ModalSizeContext);
|
|
19811
19764
|
const mapModalSizeToClassName = {
|
|
19812
19765
|
[ModalSizeOptions.MEDIUM]: dialogMedium,
|
|
19813
19766
|
[ModalSizeOptions.COMPACT]: dialogCompact,
|
|
@@ -20162,7 +20115,7 @@ import { formatAddress as formatAddress3, formatCryptoAndStringify as formatCryp
|
|
|
20162
20115
|
import { v4 as uuid3 } from "uuid";
|
|
20163
20116
|
import React93, {
|
|
20164
20117
|
useCallback as useCallback26,
|
|
20165
|
-
useEffect as
|
|
20118
|
+
useEffect as useEffect40,
|
|
20166
20119
|
useMemo as useMemo25,
|
|
20167
20120
|
useRef as useRef19,
|
|
20168
20121
|
useState as useState35
|
|
@@ -20341,7 +20294,7 @@ function FunTxSummarySections({
|
|
|
20341
20294
|
// src/components/FunInput/FunInput.tsx
|
|
20342
20295
|
import React83, {
|
|
20343
20296
|
forwardRef as forwardRef4,
|
|
20344
|
-
useEffect as
|
|
20297
|
+
useEffect as useEffect38,
|
|
20345
20298
|
useState as useState33
|
|
20346
20299
|
} from "react";
|
|
20347
20300
|
import clsx11 from "clsx";
|
|
@@ -20423,7 +20376,7 @@ var FunInput = forwardRef4(function FunInputWithRef({
|
|
|
20423
20376
|
const isFocused = alwaysFocused || focused;
|
|
20424
20377
|
const isValidDecimalColor = !!decimalsColor && activeTheme.colors?.[decimalsColor] !== "none";
|
|
20425
20378
|
const textareaRef = React83.useRef(null);
|
|
20426
|
-
|
|
20379
|
+
useEffect38(() => {
|
|
20427
20380
|
if (allowMultiline) {
|
|
20428
20381
|
adjustTextareaHeight(textareaRef.current);
|
|
20429
20382
|
}
|
|
@@ -20774,7 +20727,7 @@ import {
|
|
|
20774
20727
|
noop as noop2
|
|
20775
20728
|
} from "@funkit/utils";
|
|
20776
20729
|
import React89, {
|
|
20777
|
-
useEffect as
|
|
20730
|
+
useEffect as useEffect39,
|
|
20778
20731
|
useMemo as useMemo24,
|
|
20779
20732
|
useRef as useRef18,
|
|
20780
20733
|
useState as useState34
|
|
@@ -21331,7 +21284,7 @@ function PaymentFeesSummary({
|
|
|
21331
21284
|
}
|
|
21332
21285
|
}
|
|
21333
21286
|
};
|
|
21334
|
-
|
|
21287
|
+
useEffect39(() => {
|
|
21335
21288
|
if (valuesNotAvailable && isExpanded) {
|
|
21336
21289
|
controls.set("hiddenOverflow");
|
|
21337
21290
|
controls.start("collapsed");
|
|
@@ -21366,7 +21319,7 @@ function PaymentFeesSummary({
|
|
|
21366
21319
|
const isExpandable = expandedItems.length > 0 && !isLoading && !valuesNotAvailable;
|
|
21367
21320
|
const autoExpand = isWithdrawal ? uiCustomizations.withdrawalScreen.autoExpandFeesSummary : uiCustomizations.confirmationScreen.autoExpandFeesSummary;
|
|
21368
21321
|
const hasAutoExpandedRef = useRef18(false);
|
|
21369
|
-
|
|
21322
|
+
useEffect39(() => {
|
|
21370
21323
|
if (!autoExpand || hasAutoExpandedRef.current || !isExpandable) {
|
|
21371
21324
|
return;
|
|
21372
21325
|
}
|
|
@@ -21902,7 +21855,7 @@ function useLighterWithdrawalBalances({
|
|
|
21902
21855
|
const { account, isLoading, error } = useLighterAccount(
|
|
21903
21856
|
accountIndex ? { by: "index", value: accountIndex } : null
|
|
21904
21857
|
);
|
|
21905
|
-
|
|
21858
|
+
useEffect40(() => {
|
|
21906
21859
|
logger.debug("lighter:withdrawal:balances:query", {
|
|
21907
21860
|
accountIndex,
|
|
21908
21861
|
isLoading,
|
|
@@ -21924,7 +21877,7 @@ function useLighterWithdrawal(config, setRecipientAddress) {
|
|
|
21924
21877
|
const isLighterSecure = isLighterxyzCustomer(apiKey) && config.sourceChainId === mainnet6.id.toString();
|
|
21925
21878
|
const isLighterFast = isLighterFastWithdrawal(apiKey, config);
|
|
21926
21879
|
const { address: connectedAddress } = useAccount();
|
|
21927
|
-
|
|
21880
|
+
useEffect40(() => {
|
|
21928
21881
|
if (isLighterSecure && connectedAddress) {
|
|
21929
21882
|
setRecipientAddress(connectedAddress);
|
|
21930
21883
|
}
|
|
@@ -22049,7 +22002,7 @@ function useLighterL1Fallback({
|
|
|
22049
22002
|
const [isSubmitting, setIsSubmitting] = useState35(false);
|
|
22050
22003
|
const [l1FallbackError, setL1FallbackError] = useState35(null);
|
|
22051
22004
|
const submittingRef = useRef19(false);
|
|
22052
|
-
|
|
22005
|
+
useEffect40(() => {
|
|
22053
22006
|
if (isLighterSecure && isLighterWithdrawalRateLimitError2(withdrawalError)) {
|
|
22054
22007
|
setIsLatched((prev) => {
|
|
22055
22008
|
if (!prev) {
|
|
@@ -22062,14 +22015,14 @@ function useLighterL1Fallback({
|
|
|
22062
22015
|
}
|
|
22063
22016
|
}, [isLighterSecure, withdrawalError, connectedAddress]);
|
|
22064
22017
|
const prevResetKey = useRef19(resetKey);
|
|
22065
|
-
|
|
22018
|
+
useEffect40(() => {
|
|
22066
22019
|
if (prevResetKey.current !== resetKey) {
|
|
22067
22020
|
prevResetKey.current = resetKey;
|
|
22068
22021
|
setIsLatched(false);
|
|
22069
22022
|
setL1FallbackError(null);
|
|
22070
22023
|
}
|
|
22071
22024
|
}, [resetKey]);
|
|
22072
|
-
|
|
22025
|
+
useEffect40(() => {
|
|
22073
22026
|
if (!isLighterSecure) {
|
|
22074
22027
|
setIsLatched(false);
|
|
22075
22028
|
setL1FallbackError(null);
|
|
@@ -22320,7 +22273,7 @@ import {
|
|
|
22320
22273
|
useDirectExecutionForDepositAddress,
|
|
22321
22274
|
useLogOnce as useLogOnce3
|
|
22322
22275
|
} from "@funkit/connect-core";
|
|
22323
|
-
import { useEffect as
|
|
22276
|
+
import { useEffect as useEffect41, useMemo as useMemo26, useState as useState36 } from "react";
|
|
22324
22277
|
function useNadoWithdrawalStatus({
|
|
22325
22278
|
depositAddress,
|
|
22326
22279
|
pollIntervalMs
|
|
@@ -22344,7 +22297,7 @@ function useNadoWithdrawalStatus({
|
|
|
22344
22297
|
isCompleted: isCompleted && isFinalStep,
|
|
22345
22298
|
isFailed
|
|
22346
22299
|
});
|
|
22347
|
-
|
|
22300
|
+
useEffect41(() => {
|
|
22348
22301
|
if (status !== "pending") {
|
|
22349
22302
|
setHasSettled(true);
|
|
22350
22303
|
}
|
|
@@ -22518,7 +22471,7 @@ import {
|
|
|
22518
22471
|
DirectExecutionType as DirectExecutionType4,
|
|
22519
22472
|
RelayExecutionStatus as RelayExecutionStatus2
|
|
22520
22473
|
} from "@funkit/api-base";
|
|
22521
|
-
import React138, { useCallback as useCallback30, useEffect as
|
|
22474
|
+
import React138, { useCallback as useCallback30, useEffect as useEffect44, useMemo as useMemo40, useState as useState39 } from "react";
|
|
22522
22475
|
|
|
22523
22476
|
// src/domains/checkoutNotifications.ts
|
|
22524
22477
|
import {
|
|
@@ -22658,7 +22611,7 @@ function usePayerWallet(address) {
|
|
|
22658
22611
|
|
|
22659
22612
|
// src/hooks/usePaymentMethodIcon.tsx
|
|
22660
22613
|
import React130 from "react";
|
|
22661
|
-
import { bitcoinChain as
|
|
22614
|
+
import { bitcoinChain as bitcoinChain3 } from "@funkit/chains";
|
|
22662
22615
|
|
|
22663
22616
|
// src/components/FunPayments/FunPaymentMethods.tsx
|
|
22664
22617
|
import {
|
|
@@ -22667,7 +22620,7 @@ import {
|
|
|
22667
22620
|
} from "@funkit/api-base";
|
|
22668
22621
|
import { lightningChain as lightningChain2 } from "@funkit/chains";
|
|
22669
22622
|
import { formatCurrencyAndStringify as formatCurrencyAndStringify4 } from "@funkit/utils";
|
|
22670
|
-
import React117, { useEffect as
|
|
22623
|
+
import React117, { useEffect as useEffect42 } from "react";
|
|
22671
22624
|
|
|
22672
22625
|
// src/domains/bridge.ts
|
|
22673
22626
|
import {
|
|
@@ -23035,7 +22988,7 @@ function getExchangesComingSoon(iconSize) {
|
|
|
23035
22988
|
|
|
23036
22989
|
// src/hooks/queries/useSwappedExchanges.ts
|
|
23037
22990
|
import { RailConfigType, getFops } from "@funkit/api-base";
|
|
23038
|
-
import { bitcoinChain
|
|
22991
|
+
import { bitcoinChain, solanaChain as solanaChain3, tronChain as tronChain2 } from "@funkit/chains";
|
|
23039
22992
|
import { keepPreviousData as keepPreviousData3, useQuery as useQuery7 } from "@tanstack/react-query";
|
|
23040
22993
|
import { useMemo as useMemo30 } from "react";
|
|
23041
22994
|
|
|
@@ -23185,7 +23138,7 @@ var useSwappedExchanges = () => {
|
|
|
23185
23138
|
targets.push({
|
|
23186
23139
|
recipientAddress: transferInit.solanaAddr,
|
|
23187
23140
|
destinationToken: {
|
|
23188
|
-
chainId:
|
|
23141
|
+
chainId: solanaChain3.id.toString(),
|
|
23189
23142
|
address: SOLANA_USDC_ADDRESS
|
|
23190
23143
|
}
|
|
23191
23144
|
});
|
|
@@ -23194,7 +23147,7 @@ var useSwappedExchanges = () => {
|
|
|
23194
23147
|
targets.push({
|
|
23195
23148
|
recipientAddress: transferInit.tronAddr,
|
|
23196
23149
|
destinationToken: {
|
|
23197
|
-
chainId:
|
|
23150
|
+
chainId: tronChain2.id.toString(),
|
|
23198
23151
|
address: TRON_USDT_ADDRESS
|
|
23199
23152
|
}
|
|
23200
23153
|
});
|
|
@@ -23203,7 +23156,7 @@ var useSwappedExchanges = () => {
|
|
|
23203
23156
|
targets.push({
|
|
23204
23157
|
recipientAddress: transferInit.btcDepositAddr,
|
|
23205
23158
|
destinationToken: {
|
|
23206
|
-
chainId:
|
|
23159
|
+
chainId: bitcoinChain.id.toString(),
|
|
23207
23160
|
address: NATIVE_TOKEN
|
|
23208
23161
|
}
|
|
23209
23162
|
});
|
|
@@ -23212,9 +23165,9 @@ var useSwappedExchanges = () => {
|
|
|
23212
23165
|
(target) => target.destinationToken.chainId === targetChain && target.destinationToken.address === targetAsset
|
|
23213
23166
|
)) {
|
|
23214
23167
|
const recipientAddresses = {
|
|
23215
|
-
[
|
|
23216
|
-
[
|
|
23217
|
-
[
|
|
23168
|
+
[bitcoinChain.id]: transferInit.btcDepositAddr,
|
|
23169
|
+
[solanaChain3.id]: transferInit.solanaAddr,
|
|
23170
|
+
[tronChain2.id]: transferInit.tronAddr
|
|
23218
23171
|
};
|
|
23219
23172
|
const recipientAddress = recipientAddresses[targetChain] || transferInit.depositAddr;
|
|
23220
23173
|
targets.push({
|
|
@@ -25008,16 +24961,16 @@ function ExchangeIconCluster({
|
|
|
25008
24961
|
}
|
|
25009
24962
|
|
|
25010
24963
|
// src/components/FunPayments/TransferCryptoChainIcons.tsx
|
|
25011
|
-
import { bitcoinChain as
|
|
24964
|
+
import { bitcoinChain as bitcoinChain2, solanaChain as solanaChain4, tronChain as tronChain3 } from "@funkit/chains";
|
|
25012
24965
|
import React116 from "react";
|
|
25013
24966
|
import { base as base5, bsc as bsc2, mainnet as mainnet8 } from "viem/chains";
|
|
25014
24967
|
var previewChainIds = [
|
|
25015
|
-
|
|
24968
|
+
bitcoinChain2,
|
|
25016
24969
|
mainnet8,
|
|
25017
|
-
|
|
24970
|
+
solanaChain4,
|
|
25018
24971
|
bsc2,
|
|
25019
24972
|
base5,
|
|
25020
|
-
|
|
24973
|
+
tronChain3
|
|
25021
24974
|
].map((chain) => String(chain.id));
|
|
25022
24975
|
function TransferCryptoChainIcons() {
|
|
25023
24976
|
return /* @__PURE__ */ React116.createElement(SupportedChainList, { chainIdList: previewChainIds, showMore: true });
|
|
@@ -25131,7 +25084,7 @@ var ConnectedBluvoPaymentMethodItem = ({
|
|
|
25131
25084
|
const hasLowBalance = !isPending && sourceBalance < getUsdMinAmount();
|
|
25132
25085
|
const isDisabled = disabled || isPending || !!isBalanceError || hasLowBalance || isUserGeoblocked;
|
|
25133
25086
|
const icon = isPending ? /* @__PURE__ */ React117.createElement(SpinnerIcon, { size: 20 }) : /* @__PURE__ */ React117.createElement("div", { style: { borderRadius: "50%", overflow: "hidden" } }, label.icon);
|
|
25134
|
-
|
|
25087
|
+
useEffect42(() => {
|
|
25135
25088
|
if (isPending) {
|
|
25136
25089
|
return;
|
|
25137
25090
|
}
|
|
@@ -26010,7 +25963,7 @@ var PAYMENT_METHOD_ICONS = {
|
|
|
26010
25963
|
[PaymentMethod.REVOLUT_PAY]: (size) => /* @__PURE__ */ React130.createElement(RevolutPayIcon, { size }),
|
|
26011
25964
|
[PaymentMethod.TOKEN_TRANSFER]: (size) => /* @__PURE__ */ React130.createElement(CryptoTransferQRIcon, { size }),
|
|
26012
25965
|
[PaymentMethod.BITCOIN_LIGHTNING]: (size) => {
|
|
26013
|
-
const bitcoinIconUrl = chainMetadataById[
|
|
25966
|
+
const bitcoinIconUrl = chainMetadataById[bitcoinChain3.id]?.iconUrl ?? "";
|
|
26014
25967
|
return /* @__PURE__ */ React130.createElement(
|
|
26015
25968
|
AsyncImage,
|
|
26016
25969
|
{
|
|
@@ -26405,7 +26358,7 @@ function AddTokenToWalletButton({
|
|
|
26405
26358
|
import { CheckoutState as CheckoutState3 } from "@funkit/api-base";
|
|
26406
26359
|
import { SOLANA_MAINNET_CHAIN_ID as SOLANA_MAINNET_CHAIN_ID2 } from "@funkit/chains";
|
|
26407
26360
|
import { formatAddress as formatAddress6, formatTimestamp } from "@funkit/utils";
|
|
26408
|
-
import React136, { useEffect as
|
|
26361
|
+
import React136, { useEffect as useEffect43, useRef as useRef21, useState as useState37 } from "react";
|
|
26409
26362
|
|
|
26410
26363
|
// src/utils/checkoutHistory.ts
|
|
26411
26364
|
function getCheckoutCompletionTime(checkout) {
|
|
@@ -26490,7 +26443,7 @@ function StatusTag({ state, refundState, isDelayed: isDelayed2 }) {
|
|
|
26490
26443
|
const checkoutState = getCheckoutStateBooleans(state, refundState);
|
|
26491
26444
|
const [delayedCheckoutState, setDelayedCheckoutState] = useState37(checkoutState);
|
|
26492
26445
|
const { status, isCompleted, isRefundProceeded } = delayedCheckoutState;
|
|
26493
|
-
|
|
26446
|
+
useEffect43(() => {
|
|
26494
26447
|
const timeout = setTimeout(
|
|
26495
26448
|
() => {
|
|
26496
26449
|
setDelayedCheckoutState(getCheckoutStateBooleans(state, refundState));
|
|
@@ -27114,7 +27067,7 @@ var PendingSuccessScreen = ({
|
|
|
27114
27067
|
}
|
|
27115
27068
|
}, [directExecution, checkoutItem, setCheckoutProgress, quote, isWithdrawal]);
|
|
27116
27069
|
const firstMergedDirectExecution = mergedDirectExecutions?.[0];
|
|
27117
|
-
|
|
27070
|
+
useEffect44(() => {
|
|
27118
27071
|
if (firstMergedDirectExecution) {
|
|
27119
27072
|
onHistoryItemChange?.({
|
|
27120
27073
|
...firstMergedDirectExecution,
|
|
@@ -27141,7 +27094,7 @@ var PendingSuccessScreen = ({
|
|
|
27141
27094
|
firstMergedDirectExecution?.latestStep?.txHash,
|
|
27142
27095
|
firstMergedDirectExecution?.latestStep?.listenerInfo?.status
|
|
27143
27096
|
]);
|
|
27144
|
-
|
|
27097
|
+
useEffect44(() => {
|
|
27145
27098
|
if (!latestDirectExecution) {
|
|
27146
27099
|
return;
|
|
27147
27100
|
}
|
|
@@ -27539,7 +27492,7 @@ import {
|
|
|
27539
27492
|
formatCryptoAndStringify as formatCryptoAndStringify5,
|
|
27540
27493
|
formatCurrencyAndStringify as formatCurrencyAndStringify6
|
|
27541
27494
|
} from "@funkit/utils";
|
|
27542
|
-
import React156, { useCallback as useCallback38, useEffect as
|
|
27495
|
+
import React156, { useCallback as useCallback38, useEffect as useEffect54, useMemo as useMemo48, useState as useState50 } from "react";
|
|
27543
27496
|
import { createPortal as createPortal6 } from "react-dom";
|
|
27544
27497
|
import { useDebounce } from "use-debounce";
|
|
27545
27498
|
import { isAddress as isAddress2 } from "viem";
|
|
@@ -27553,7 +27506,7 @@ import {
|
|
|
27553
27506
|
useNadoFeeRates,
|
|
27554
27507
|
useNadoMaxWithdrawable
|
|
27555
27508
|
} from "@funkit/connect-core/clients/nado";
|
|
27556
|
-
import { useEffect as
|
|
27509
|
+
import { useEffect as useEffect45, useMemo as useMemo42, useState as useState40 } from "react";
|
|
27557
27510
|
|
|
27558
27511
|
// src/hooks/useAssetPrice.ts
|
|
27559
27512
|
import { getAssetPriceInfoWithFallback } from "@funkit/connect-core";
|
|
@@ -27602,7 +27555,7 @@ function useNadoWithdrawalForm(config, selectedSourceToken) {
|
|
|
27602
27555
|
() => nadoConfig?.defaultSpotLeverage ?? false
|
|
27603
27556
|
);
|
|
27604
27557
|
const { data: feeRates } = useNadoFeeRates({ sender: subaccount, logger });
|
|
27605
|
-
|
|
27558
|
+
useEffect45(() => {
|
|
27606
27559
|
setSpotLeverage(nadoConfig?.defaultSpotLeverage ?? false);
|
|
27607
27560
|
}, [subaccount, nadoConfig?.defaultSpotLeverage]);
|
|
27608
27561
|
const amountToggle = {
|
|
@@ -27682,7 +27635,7 @@ import React146, { useMemo as useMemo44 } from "react";
|
|
|
27682
27635
|
// src/components/Dropdown/BaseDropdown.tsx
|
|
27683
27636
|
import { isMobile as isMobile4 } from "@funkit/utils";
|
|
27684
27637
|
import * as DropdownMenu from "@radix-ui/react-dropdown-menu";
|
|
27685
|
-
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";
|
|
27686
27639
|
|
|
27687
27640
|
// src/components/FunNoResults/FunNoResults.tsx
|
|
27688
27641
|
import React142 from "react";
|
|
@@ -28110,7 +28063,7 @@ function BaseDropdown({
|
|
|
28110
28063
|
},
|
|
28111
28064
|
[onOpen, resetSearchOnClose]
|
|
28112
28065
|
);
|
|
28113
|
-
|
|
28066
|
+
useEffect46(() => {
|
|
28114
28067
|
if (isOpened && !prevIsOpenedRef.current) {
|
|
28115
28068
|
prevIsOpenedRef.current = true;
|
|
28116
28069
|
if (selectedOption) {
|
|
@@ -28821,13 +28774,13 @@ import React152 from "react";
|
|
|
28821
28774
|
import React151, { useState as useState43 } from "react";
|
|
28822
28775
|
|
|
28823
28776
|
// src/hooks/useInterval.ts
|
|
28824
|
-
import { useEffect as
|
|
28777
|
+
import { useEffect as useEffect47, useRef as useRef24 } from "react";
|
|
28825
28778
|
function useInterval(callback, delay) {
|
|
28826
28779
|
const savedCallback = useRef24(callback);
|
|
28827
28780
|
useIsomorphicLayoutEffect(() => {
|
|
28828
28781
|
savedCallback.current = callback;
|
|
28829
28782
|
}, [callback]);
|
|
28830
|
-
|
|
28783
|
+
useEffect47(() => {
|
|
28831
28784
|
const id = setInterval(() => {
|
|
28832
28785
|
savedCallback.current();
|
|
28833
28786
|
}, delay);
|
|
@@ -29267,12 +29220,12 @@ var useWithdrawalRisk = (apiKey, receiveAddress, chainId2) => {
|
|
|
29267
29220
|
};
|
|
29268
29221
|
|
|
29269
29222
|
// src/hooks/track/analytics/useTrackErrorShown.ts
|
|
29270
|
-
import { useEffect as
|
|
29223
|
+
import { useEffect as useEffect48, useRef as useRef25 } from "react";
|
|
29271
29224
|
function useTrackErrorShown({ error, flow, step }) {
|
|
29272
29225
|
const logEventV2 = useTrackV2();
|
|
29273
29226
|
const identity = error && `${step}:${error.code ?? error.messageKey}`;
|
|
29274
29227
|
const displayedErrorIdentityRef = useRef25(null);
|
|
29275
|
-
|
|
29228
|
+
useEffect48(() => {
|
|
29276
29229
|
if (!error) {
|
|
29277
29230
|
displayedErrorIdentityRef.current = null;
|
|
29278
29231
|
return;
|
|
@@ -29357,11 +29310,11 @@ function getErrorNotification({
|
|
|
29357
29310
|
}
|
|
29358
29311
|
|
|
29359
29312
|
// src/modals/WithdrawalModal/RecipientAddress.tsx
|
|
29360
|
-
import React154, { useCallback as useCallback33, useEffect as
|
|
29313
|
+
import React154, { useCallback as useCallback33, useEffect as useEffect49, useRef as useRef27, useState as useState45 } from "react";
|
|
29361
29314
|
import {
|
|
29362
29315
|
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO11,
|
|
29363
|
-
solanaChain as
|
|
29364
|
-
tronChain as
|
|
29316
|
+
solanaChain as solanaChain5,
|
|
29317
|
+
tronChain as tronChain4
|
|
29365
29318
|
} from "@funkit/chains";
|
|
29366
29319
|
import { isAddressEquivalent as isAddressEquivalent7 } from "@funkit/utils";
|
|
29367
29320
|
|
|
@@ -29545,7 +29498,7 @@ function useConnectedWalletShortcut({
|
|
|
29545
29498
|
isConnected,
|
|
29546
29499
|
hasMultipleWalletsConnected
|
|
29547
29500
|
});
|
|
29548
|
-
|
|
29501
|
+
useEffect49(() => {
|
|
29549
29502
|
logger.debug("withdrawalContent:showUseConnected", {
|
|
29550
29503
|
isConnected,
|
|
29551
29504
|
connectedWalletAddress,
|
|
@@ -29566,7 +29519,7 @@ function useConnectedWalletShortcut({
|
|
|
29566
29519
|
};
|
|
29567
29520
|
}
|
|
29568
29521
|
function getRecipientAddressPlaceholder(selectedChainId, t) {
|
|
29569
|
-
if (selectedChainId ===
|
|
29522
|
+
if (selectedChainId === solanaChain5.id || selectedChainId === tronChain4.id) {
|
|
29570
29523
|
return t("withdrawal.enterRecipientAddress")[0] + t("withdrawal.enterRecipientAddress").slice(1).toLowerCase();
|
|
29571
29524
|
}
|
|
29572
29525
|
return "0x...";
|
|
@@ -29622,7 +29575,7 @@ function WithdrawRecipientAddress({
|
|
|
29622
29575
|
textRef: inputRef
|
|
29623
29576
|
});
|
|
29624
29577
|
const shouldFocusAfterClear = useRef27(false);
|
|
29625
|
-
|
|
29578
|
+
useEffect49(() => {
|
|
29626
29579
|
if (shouldFocusAfterClear.current && !isShowingConnectedAddress) {
|
|
29627
29580
|
shouldFocusAfterClear.current = false;
|
|
29628
29581
|
inputRef.current?.focus();
|
|
@@ -29636,7 +29589,7 @@ function WithdrawRecipientAddress({
|
|
|
29636
29589
|
[setRecipientAddressProp, updateCustomRecipient]
|
|
29637
29590
|
);
|
|
29638
29591
|
const hasPrefilledConnectedAddress = useRef27(false);
|
|
29639
|
-
|
|
29592
|
+
useEffect49(() => {
|
|
29640
29593
|
if (hasPrefilledConnectedAddress.current || recipientAddress || !isPrefillConnectedAddressEnabled || !showUseConnected || !connectedWalletAddress) {
|
|
29641
29594
|
return;
|
|
29642
29595
|
}
|
|
@@ -30281,10 +30234,10 @@ function getRelayOutputCurrencyAmount(quote, fallback2) {
|
|
|
30281
30234
|
}
|
|
30282
30235
|
|
|
30283
30236
|
// src/modals/WithdrawalModal/withdrawalHooks.tsx
|
|
30284
|
-
import { useCallback as useCallback34, useEffect as
|
|
30237
|
+
import { useCallback as useCallback34, useEffect as useEffect51, useRef as useRef30 } from "react";
|
|
30285
30238
|
|
|
30286
30239
|
// src/hooks/useTokenAndChainDropdown.ts
|
|
30287
|
-
import { useEffect as
|
|
30240
|
+
import { useEffect as useEffect50, useRef as useRef29, useState as useState47 } from "react";
|
|
30288
30241
|
import { polygon as polygon6 } from "viem/chains";
|
|
30289
30242
|
|
|
30290
30243
|
// src/hooks/useEnabledTokenTransferChainTokens.ts
|
|
@@ -30376,12 +30329,12 @@ var useTokenAndChainDropdown = ({
|
|
|
30376
30329
|
noDefaultSelection ? void 0 : selectedDefaultToken
|
|
30377
30330
|
);
|
|
30378
30331
|
const hasUserSelectedRef = useRef29(false);
|
|
30379
|
-
|
|
30332
|
+
useEffect50(() => {
|
|
30380
30333
|
if (!noDefaultSelection && !hasUserSelectedRef.current) {
|
|
30381
30334
|
setSelectedChainId(selectedDefaultChainId);
|
|
30382
30335
|
}
|
|
30383
30336
|
}, [selectedDefaultChainId, noDefaultSelection]);
|
|
30384
|
-
|
|
30337
|
+
useEffect50(() => {
|
|
30385
30338
|
if (!noDefaultSelection && !hasUserSelectedRef.current) {
|
|
30386
30339
|
setSelectedToken(selectedDefaultToken);
|
|
30387
30340
|
}
|
|
@@ -30527,7 +30480,7 @@ function useWithdrawalLogging({
|
|
|
30527
30480
|
const lastQuoteErrorRef = useRef30(null);
|
|
30528
30481
|
const lastRiskyRecipientRef = useRef30(null);
|
|
30529
30482
|
const lastBlacklistedRecipientRef = useRef30(null);
|
|
30530
|
-
|
|
30483
|
+
useEffect51(() => {
|
|
30531
30484
|
if (!targetAssetFetchError) {
|
|
30532
30485
|
return;
|
|
30533
30486
|
}
|
|
@@ -30542,7 +30495,7 @@ function useWithdrawalLogging({
|
|
|
30542
30495
|
});
|
|
30543
30496
|
lastTargetAssetErrorRef.current = errorKey;
|
|
30544
30497
|
}, [targetAssetFetchError, selectedChainId, selectedToken]);
|
|
30545
|
-
|
|
30498
|
+
useEffect51(() => {
|
|
30546
30499
|
if (!sourceAssetFetchError) {
|
|
30547
30500
|
return;
|
|
30548
30501
|
}
|
|
@@ -30556,7 +30509,7 @@ function useWithdrawalLogging({
|
|
|
30556
30509
|
});
|
|
30557
30510
|
lastSourceAssetErrorRef.current = errorKey;
|
|
30558
30511
|
}, [sourceAssetFetchError, selectedSourceToken]);
|
|
30559
|
-
|
|
30512
|
+
useEffect51(() => {
|
|
30560
30513
|
if (!quoteErrorObject) {
|
|
30561
30514
|
return;
|
|
30562
30515
|
}
|
|
@@ -30584,7 +30537,7 @@ function useWithdrawalLogging({
|
|
|
30584
30537
|
debouncedInputAmount,
|
|
30585
30538
|
debouncedInputAmountUsd
|
|
30586
30539
|
]);
|
|
30587
|
-
|
|
30540
|
+
useEffect51(() => {
|
|
30588
30541
|
if (!isRisky) {
|
|
30589
30542
|
return;
|
|
30590
30543
|
}
|
|
@@ -30599,7 +30552,7 @@ function useWithdrawalLogging({
|
|
|
30599
30552
|
});
|
|
30600
30553
|
lastRiskyRecipientRef.current = warningKey;
|
|
30601
30554
|
}, [isRisky, recipientAddress, selectedChainId, selectedToken]);
|
|
30602
|
-
|
|
30555
|
+
useEffect51(() => {
|
|
30603
30556
|
if (!isRecipientBlacklisted) {
|
|
30604
30557
|
return;
|
|
30605
30558
|
}
|
|
@@ -30620,11 +30573,11 @@ function useWithdrawalLogging({
|
|
|
30620
30573
|
import { useState as useState49 } from "react";
|
|
30621
30574
|
|
|
30622
30575
|
// src/hooks/useAutoClearState.ts
|
|
30623
|
-
import { useCallback as useCallback35, useEffect as
|
|
30576
|
+
import { useCallback as useCallback35, useEffect as useEffect52, useRef as useRef31, useState as useState48 } from "react";
|
|
30624
30577
|
function useAutoClearState(initialValue = null) {
|
|
30625
30578
|
const [state, setState] = useState48(initialValue);
|
|
30626
30579
|
const timeoutRef = useRef31(void 0);
|
|
30627
|
-
|
|
30580
|
+
useEffect52(() => {
|
|
30628
30581
|
return () => {
|
|
30629
30582
|
if (timeoutRef.current !== void 0) {
|
|
30630
30583
|
clearTimeout(timeoutRef.current);
|
|
@@ -30813,7 +30766,7 @@ function useWithdrawal({
|
|
|
30813
30766
|
}
|
|
30814
30767
|
|
|
30815
30768
|
// src/modals/WithdrawalModal/useTrackWithdrawalQuoteEvents.ts
|
|
30816
|
-
import { useCallback as useCallback36, useEffect as
|
|
30769
|
+
import { useCallback as useCallback36, useEffect as useEffect53, useRef as useRef32 } from "react";
|
|
30817
30770
|
function useTrackWithdrawalQuoteEvents({
|
|
30818
30771
|
isQuoteLoading,
|
|
30819
30772
|
quote,
|
|
@@ -30825,11 +30778,11 @@ function useTrackWithdrawalQuoteEvents({
|
|
|
30825
30778
|
const checkoutId = checkoutItem?.id ?? null;
|
|
30826
30779
|
const lastDisplayedQuoteIdRef = useRef32(null);
|
|
30827
30780
|
const numQuoteRefreshesRef = useRef32(0);
|
|
30828
|
-
|
|
30781
|
+
useEffect53(() => {
|
|
30829
30782
|
lastDisplayedQuoteIdRef.current = null;
|
|
30830
30783
|
numQuoteRefreshesRef.current = 0;
|
|
30831
30784
|
}, [checkoutId]);
|
|
30832
|
-
|
|
30785
|
+
useEffect53(() => {
|
|
30833
30786
|
if (isQuoteLoading || !quote || !target) {
|
|
30834
30787
|
return;
|
|
30835
30788
|
}
|
|
@@ -31427,11 +31380,11 @@ function usePostClientCommonWithdrawalFlow({
|
|
|
31427
31380
|
sourceTokenUsdPrice
|
|
31428
31381
|
);
|
|
31429
31382
|
const targetAssetAmount = targetUnitPrice && debouncedInputAmountUsd !== void 0 ? debouncedInputAmountUsd / targetUnitPrice : void 0;
|
|
31430
|
-
|
|
31383
|
+
useEffect54(() => {
|
|
31431
31384
|
updateWithdrawalSourceAssetAmount(quoteInputAmount);
|
|
31432
31385
|
}, [quoteInputAmount, updateWithdrawalSourceAssetAmount]);
|
|
31433
31386
|
const isActiveTargetSynced = checkoutConfig?.targetAsset === targetAssetAddress && checkoutConfig?.targetChain === selectedChainId?.toString() && checkoutConfig?.targetAssetTicker === selectedToken;
|
|
31434
|
-
|
|
31387
|
+
useEffect54(() => {
|
|
31435
31388
|
if (!targetAssetAddress || !selectedChainId || !selectedToken || isActiveTargetSynced) {
|
|
31436
31389
|
return;
|
|
31437
31390
|
}
|
|
@@ -31449,7 +31402,7 @@ function usePostClientCommonWithdrawalFlow({
|
|
|
31449
31402
|
selectedToken,
|
|
31450
31403
|
isActiveTargetSynced
|
|
31451
31404
|
]);
|
|
31452
|
-
|
|
31405
|
+
useEffect54(() => {
|
|
31453
31406
|
setTimeout(() => {
|
|
31454
31407
|
updateTargetAssetAmount(targetAssetAmount ?? 0);
|
|
31455
31408
|
}, 0);
|
|
@@ -32328,7 +32281,7 @@ var useWithdrawFops = (params) => {
|
|
|
32328
32281
|
|
|
32329
32282
|
// src/hooks/useSwappedPreload.ts
|
|
32330
32283
|
import { isSwappedFop } from "@funkit/connect-core";
|
|
32331
|
-
import { useEffect as
|
|
32284
|
+
import { useEffect as useEffect55 } from "react";
|
|
32332
32285
|
|
|
32333
32286
|
// src/modals/CheckoutModal/SourceChange/FormOfPaymentsList.tsx
|
|
32334
32287
|
import { getFopKey, isSyntheticFop, sortFops as sortFops2 } from "@funkit/connect-core";
|
|
@@ -32718,7 +32671,7 @@ function FormOfPaymentsList({
|
|
|
32718
32671
|
function useSwappedPreload(fopsData, mode) {
|
|
32719
32672
|
const fopPriority = useDynamicConfig("foppriority");
|
|
32720
32673
|
const { setIframeUrl } = useSwappedContext(mode);
|
|
32721
|
-
|
|
32674
|
+
useEffect55(() => {
|
|
32722
32675
|
if (!fopsData) {
|
|
32723
32676
|
setIframeUrl(null);
|
|
32724
32677
|
return;
|
|
@@ -32900,7 +32853,7 @@ function WithdrawalMethodSelect({
|
|
|
32900
32853
|
|
|
32901
32854
|
// src/modals/WithdrawalModal/WithdrawalSwappedIframeController.tsx
|
|
32902
32855
|
import { useQueryClient as useQueryClient3 } from "@tanstack/react-query";
|
|
32903
|
-
import React164, { useEffect as
|
|
32856
|
+
import React164, { useEffect as useEffect58 } from "react";
|
|
32904
32857
|
|
|
32905
32858
|
// src/components/SwappedIframeSkeleton.tsx
|
|
32906
32859
|
import React163 from "react";
|
|
@@ -33019,7 +32972,7 @@ function SwappedIframeSkeleton({
|
|
|
33019
32972
|
}
|
|
33020
32973
|
|
|
33021
32974
|
// src/hooks/useSwappedIframeLifecycle.ts
|
|
33022
|
-
import { useEffect as
|
|
32975
|
+
import { useEffect as useEffect56, useRef as useRef34 } from "react";
|
|
33023
32976
|
var SWAPPED_IFRAME_TIMEOUT = 15e3;
|
|
33024
32977
|
function useSwappedIframeLifecycle({
|
|
33025
32978
|
fopType,
|
|
@@ -33029,11 +32982,11 @@ function useSwappedIframeLifecycle({
|
|
|
33029
32982
|
const { activateIframe, deactivateIframe, isSwappedReady } = useSwappedContext(mode);
|
|
33030
32983
|
const timeoutRef = useRef34(void 0);
|
|
33031
32984
|
const stableOnTimeout = useEffectEvent(onTimeout);
|
|
33032
|
-
|
|
32985
|
+
useEffect56(() => {
|
|
33033
32986
|
activateIframe(fopType);
|
|
33034
32987
|
return () => deactivateIframe();
|
|
33035
32988
|
}, [fopType, activateIframe, deactivateIframe]);
|
|
33036
|
-
|
|
32989
|
+
useEffect56(() => {
|
|
33037
32990
|
if (isSwappedReady) {
|
|
33038
32991
|
clearTimeout(timeoutRef.current);
|
|
33039
32992
|
return;
|
|
@@ -33050,7 +33003,7 @@ function useSwappedIframeLifecycle({
|
|
|
33050
33003
|
|
|
33051
33004
|
// src/modals/WithdrawalModal/useFiatWithdrawal.ts
|
|
33052
33005
|
import { getCheckoutQuoteV2 as getCheckoutQuoteV22 } from "@funkit/api-base";
|
|
33053
|
-
import { useEffect as
|
|
33006
|
+
import { useEffect as useEffect57, useRef as useRef35 } from "react";
|
|
33054
33007
|
import { safeBigInt } from "@funkit/connect-core";
|
|
33055
33008
|
import {
|
|
33056
33009
|
findSwappedSourceOverride as findSwappedSourceOverride2,
|
|
@@ -33158,7 +33111,7 @@ function useFiatWithdrawal({
|
|
|
33158
33111
|
tokenAddress: config.sourceTokenAddress
|
|
33159
33112
|
})
|
|
33160
33113
|
) : null;
|
|
33161
|
-
|
|
33114
|
+
useEffect57(() => {
|
|
33162
33115
|
if (!legs || !checkoutItem) {
|
|
33163
33116
|
return;
|
|
33164
33117
|
}
|
|
@@ -33189,7 +33142,7 @@ function useFiatWithdrawal({
|
|
|
33189
33142
|
onError();
|
|
33190
33143
|
}
|
|
33191
33144
|
});
|
|
33192
|
-
|
|
33145
|
+
useEffect57(() => {
|
|
33193
33146
|
if (withdrawalError) {
|
|
33194
33147
|
handleWithdrawalFailure();
|
|
33195
33148
|
}
|
|
@@ -33369,7 +33322,7 @@ function WithdrawalSwappedIframeController({
|
|
|
33369
33322
|
checkoutId: withdrawalItem?.id
|
|
33370
33323
|
})
|
|
33371
33324
|
);
|
|
33372
|
-
|
|
33325
|
+
useEffect58(() => {
|
|
33373
33326
|
if (isSwappedReady) {
|
|
33374
33327
|
const metadata = getTrackMetadata();
|
|
33375
33328
|
logger.info("swapped-withdrawal-iframe:ready", metadata);
|
|
@@ -33482,7 +33435,7 @@ function WithdrawalSwappedIframeController({
|
|
|
33482
33435
|
}
|
|
33483
33436
|
}
|
|
33484
33437
|
});
|
|
33485
|
-
|
|
33438
|
+
useEffect58(() => {
|
|
33486
33439
|
return swappedTransport.onMessage(handleSwappedMessage);
|
|
33487
33440
|
}, [swappedTransport]);
|
|
33488
33441
|
useSwappedIframeLifecycle({
|
|
@@ -33537,18 +33490,18 @@ import { noop as noop4 } from "@funkit/utils";
|
|
|
33537
33490
|
import React167 from "react";
|
|
33538
33491
|
|
|
33539
33492
|
// src/components/FunCheckoutHistory/FunCheckoutHistoryContent.tsx
|
|
33540
|
-
import React166, { useEffect as
|
|
33493
|
+
import React166, { useEffect as useEffect60 } from "react";
|
|
33541
33494
|
|
|
33542
33495
|
// src/components/FunCheckoutHistory/FunCheckoutHistoryDetail.tsx
|
|
33543
33496
|
import React165, { useCallback as useCallback39, useMemo as useMemo50, useState as useState52 } from "react";
|
|
33544
33497
|
import { createPortal as createPortal7 } from "react-dom";
|
|
33545
33498
|
|
|
33546
33499
|
// src/hooks/useFunListeners.ts
|
|
33547
|
-
import { useEffect as
|
|
33500
|
+
import { useEffect as useEffect59, useRef as useRef36 } from "react";
|
|
33548
33501
|
function useCheckoutHistoryListener(activate = true, singleDepositAddr) {
|
|
33549
33502
|
const activeIntervalRef = useRef36(void 0);
|
|
33550
33503
|
const { startCheckoutHistoryListener, stopCheckoutHistoryListener } = useCheckoutHistoryContext();
|
|
33551
|
-
|
|
33504
|
+
useEffect59(() => {
|
|
33552
33505
|
if (activate) {
|
|
33553
33506
|
const createdIntervalId = startCheckoutHistoryListener(
|
|
33554
33507
|
/* singleDepositAddr */
|
|
@@ -33701,7 +33654,7 @@ function FunCheckoutHistoryContent({
|
|
|
33701
33654
|
initDirectExecution: directExecutionInfo
|
|
33702
33655
|
});
|
|
33703
33656
|
const isDirectExecutionRecord = isCheckoutHistoryDirectExecution(depositAddress);
|
|
33704
|
-
|
|
33657
|
+
useEffect60(() => {
|
|
33705
33658
|
if (isDirectExecutionRecord) {
|
|
33706
33659
|
if (directExecution) {
|
|
33707
33660
|
onHistoryItemChange?.({
|
|
@@ -33809,7 +33762,7 @@ function WithdrawalTypeSelect({
|
|
|
33809
33762
|
}
|
|
33810
33763
|
|
|
33811
33764
|
// src/modals/WithdrawalModal/useTrackWithdrawalEvents.ts
|
|
33812
|
-
import { useCallback as useCallback40, useEffect as
|
|
33765
|
+
import { useCallback as useCallback40, useEffect as useEffect61, useRef as useRef37 } from "react";
|
|
33813
33766
|
function getCompletionState(step) {
|
|
33814
33767
|
switch (step) {
|
|
33815
33768
|
case "PENDING_CALLBACK" /* PENDING_CALLBACK */:
|
|
@@ -33853,7 +33806,7 @@ function useTrackWithdrawalEvents({
|
|
|
33853
33806
|
}));
|
|
33854
33807
|
});
|
|
33855
33808
|
const checkoutId = checkoutItem?.id;
|
|
33856
|
-
|
|
33809
|
+
useEffect61(() => {
|
|
33857
33810
|
if (checkoutId && claimAnalyticsEvent("fc_modal_opened" /* MODAL_OPENED */, checkoutId)) {
|
|
33858
33811
|
trackModalOpened();
|
|
33859
33812
|
}
|
|
@@ -33862,7 +33815,7 @@ function useTrackWithdrawalEvents({
|
|
|
33862
33815
|
const lastViewedStepRef = useRef37(null);
|
|
33863
33816
|
const stepIndexRef = useRef37(1);
|
|
33864
33817
|
const stepHistoryRef = useRef37([]);
|
|
33865
|
-
|
|
33818
|
+
useEffect61(() => {
|
|
33866
33819
|
if (!open) {
|
|
33867
33820
|
trackedCheckoutIdRef.current = null;
|
|
33868
33821
|
lastViewedStepRef.current = null;
|
|
@@ -33979,13 +33932,13 @@ function WithdrawalModal({
|
|
|
33979
33932
|
"SELECT_METHOD" /* SELECT_METHOD */,
|
|
33980
33933
|
"ENTER_AMOUNT" /* ENTER_AMOUNT */
|
|
33981
33934
|
].includes(step);
|
|
33982
|
-
|
|
33935
|
+
useEffect62(() => {
|
|
33983
33936
|
setNavigation({
|
|
33984
33937
|
isBackNavigation: false,
|
|
33985
33938
|
step: isInitialStepSelectMethod ? "SELECT_METHOD" /* SELECT_METHOD */ : "ENTER_AMOUNT" /* ENTER_AMOUNT */
|
|
33986
33939
|
});
|
|
33987
33940
|
}, [isInitialStepSelectMethod]);
|
|
33988
|
-
|
|
33941
|
+
useEffect62(() => {
|
|
33989
33942
|
if (step === "SELECT_METHOD" /* SELECT_METHOD */) {
|
|
33990
33943
|
isMethodSelectionInFlight.current = false;
|
|
33991
33944
|
}
|
|
@@ -34280,13 +34233,13 @@ import React185 from "react";
|
|
|
34280
34233
|
|
|
34281
34234
|
// src/modals/ProfileDetails/ActivityTraversalContext.tsx
|
|
34282
34235
|
import React170, {
|
|
34283
|
-
createContext as
|
|
34236
|
+
createContext as createContext21,
|
|
34284
34237
|
useCallback as useCallback42,
|
|
34285
|
-
useContext as
|
|
34238
|
+
useContext as useContext21,
|
|
34286
34239
|
useMemo as useMemo51,
|
|
34287
34240
|
useState as useState54
|
|
34288
34241
|
} from "react";
|
|
34289
|
-
var ActivityTraversalContext =
|
|
34242
|
+
var ActivityTraversalContext = createContext21({
|
|
34290
34243
|
selectedPurchaseId: void 0,
|
|
34291
34244
|
selectedPurchaseInitView: void 0,
|
|
34292
34245
|
returnView: void 0,
|
|
@@ -34347,7 +34300,7 @@ var ActivityTraversalProvider = ({
|
|
|
34347
34300
|
return /* @__PURE__ */ React170.createElement(ActivityTraversalContext.Provider, { value: contextValue }, children);
|
|
34348
34301
|
};
|
|
34349
34302
|
var useActivityTraversal = () => {
|
|
34350
|
-
return
|
|
34303
|
+
return useContext21(ActivityTraversalContext);
|
|
34351
34304
|
};
|
|
34352
34305
|
|
|
34353
34306
|
// src/modals/ProfileDetails/ProfileDetails.tsx
|
|
@@ -34412,7 +34365,7 @@ function useCheckoutModalTitle(depositAddress, defaultTitle) {
|
|
|
34412
34365
|
import { IN_PROGRESS_CHECKOUT_STATES as IN_PROGRESS_CHECKOUT_STATES2 } from "@funkit/api-base";
|
|
34413
34366
|
import { formatTimestampToDate, fullMonthNames } from "@funkit/utils";
|
|
34414
34367
|
import clsx20 from "clsx";
|
|
34415
|
-
import React180, { useEffect as
|
|
34368
|
+
import React180, { useEffect as useEffect64, useMemo as useMemo52, useRef as useRef40, useState as useState56 } from "react";
|
|
34416
34369
|
import { Virtuoso } from "react-virtuoso";
|
|
34417
34370
|
|
|
34418
34371
|
// src/consts/layout.ts
|
|
@@ -34801,14 +34754,14 @@ import { useCallback as useCallback43, useState as useState55 } from "react";
|
|
|
34801
34754
|
|
|
34802
34755
|
// src/components/FunSelect/FunClickOutside.tsx
|
|
34803
34756
|
import React177 from "react";
|
|
34804
|
-
import { useEffect as
|
|
34757
|
+
import { useEffect as useEffect63, useRef as useRef39 } from "react";
|
|
34805
34758
|
function FunClickOutside({
|
|
34806
34759
|
children,
|
|
34807
34760
|
onClick
|
|
34808
34761
|
}) {
|
|
34809
34762
|
const wrapperRef = useRef39(null);
|
|
34810
34763
|
const isShadowDomEnabled = useFeatureGate("enable-shadow-dom");
|
|
34811
|
-
|
|
34764
|
+
useEffect63(() => {
|
|
34812
34765
|
const handleClickListener = (event) => {
|
|
34813
34766
|
const wrapper = wrapperRef.current;
|
|
34814
34767
|
const clickedInside = isShadowDomEnabled ? !!wrapper && event.composedPath().includes(wrapper) : wrapper?.contains(event.target);
|
|
@@ -34993,7 +34946,7 @@ function Home({
|
|
|
34993
34946
|
const { checkoutHistoryList, isCheckoutHistoryInited } = useCheckoutHistoryContext();
|
|
34994
34947
|
const { returnViewPresets } = useActivityTraversal();
|
|
34995
34948
|
const { animation: tabAnimation, navigateTo } = useAnimatedNavigation(setSelectedView);
|
|
34996
|
-
|
|
34949
|
+
useEffect64(() => {
|
|
34997
34950
|
const virtuosoDiv = virtuosoParentRef.current?.firstChild;
|
|
34998
34951
|
virtuosoDiv?.classList.add(animateVirtuosoInClass);
|
|
34999
34952
|
}, []);
|
|
@@ -35168,7 +35121,7 @@ import React183 from "react";
|
|
|
35168
35121
|
import React182 from "react";
|
|
35169
35122
|
|
|
35170
35123
|
// src/hooks/useCopyToClipboard.ts
|
|
35171
|
-
import { useCallback as useCallback44, useEffect as
|
|
35124
|
+
import { useCallback as useCallback44, useEffect as useEffect65, useState as useState57 } from "react";
|
|
35172
35125
|
var useCopyToClipboard = (text, delay = 1500) => {
|
|
35173
35126
|
const [isCopied, setCopied] = useState57(false);
|
|
35174
35127
|
const handleCopy = useCallback44(() => {
|
|
@@ -35178,7 +35131,7 @@ var useCopyToClipboard = (text, delay = 1500) => {
|
|
|
35178
35131
|
navigator.clipboard.writeText(text);
|
|
35179
35132
|
setCopied(true);
|
|
35180
35133
|
}, [text]);
|
|
35181
|
-
|
|
35134
|
+
useEffect65(() => {
|
|
35182
35135
|
if (!isCopied) {
|
|
35183
35136
|
return;
|
|
35184
35137
|
}
|
|
@@ -35716,13 +35669,13 @@ function ChainModal({ onClose, open }) {
|
|
|
35716
35669
|
}
|
|
35717
35670
|
|
|
35718
35671
|
// src/modals/CheckoutModal/FunCheckoutModal.tsx
|
|
35719
|
-
import React330, { useEffect as
|
|
35672
|
+
import React330, { useEffect as useEffect100, useLayoutEffect as useLayoutEffect3, useRef as useRef62 } from "react";
|
|
35720
35673
|
|
|
35721
35674
|
// src/components/FunConnectOptions/FunConnectOptions.tsx
|
|
35722
35675
|
import React198, { useCallback as useCallback46, useMemo as useMemo54, useState as useState61 } from "react";
|
|
35723
35676
|
|
|
35724
35677
|
// src/components/FunConnectOptions/FunConnectResultStep.tsx
|
|
35725
|
-
import React193, { useEffect as
|
|
35678
|
+
import React193, { useEffect as useEffect66 } from "react";
|
|
35726
35679
|
|
|
35727
35680
|
// src/components/FunMessage/FunMessage.tsx
|
|
35728
35681
|
import React191 from "react";
|
|
@@ -35926,7 +35879,7 @@ var FunConnectResultStep = ({
|
|
|
35926
35879
|
qrCodeUri
|
|
35927
35880
|
}) => {
|
|
35928
35881
|
const hasAutoclose = type === "success";
|
|
35929
|
-
|
|
35882
|
+
useEffect66(() => {
|
|
35930
35883
|
if (!hasAutoclose) {
|
|
35931
35884
|
return;
|
|
35932
35885
|
}
|
|
@@ -36411,6 +36364,24 @@ function useIsCheckoutComplete(depositAddress) {
|
|
|
36411
36364
|
return false;
|
|
36412
36365
|
}
|
|
36413
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
|
+
|
|
36414
36385
|
// src/hooks/usePaymentSources.ts
|
|
36415
36386
|
import { isNotNullish as isNotNullish6 } from "@funkit/utils";
|
|
36416
36387
|
|
|
@@ -36656,10 +36627,10 @@ var FunCheckoutBlocked = ({ reason }) => {
|
|
|
36656
36627
|
};
|
|
36657
36628
|
|
|
36658
36629
|
// src/modals/CheckoutModal/CheckoutModalPrefetchedHooks.tsx
|
|
36659
|
-
import React201, { useEffect as
|
|
36630
|
+
import React201, { useEffect as useEffect68 } from "react";
|
|
36660
36631
|
|
|
36661
36632
|
// src/modals/PolymarketPerpsTransfer/PolymarketPerpsPrefetch.tsx
|
|
36662
|
-
import React200, { useEffect as
|
|
36633
|
+
import React200, { useEffect as useEffect67, useMemo as useMemo56 } from "react";
|
|
36663
36634
|
|
|
36664
36635
|
// src/domains/polymarketPerps.ts
|
|
36665
36636
|
import { getAddress as getAddress4 } from "viem";
|
|
@@ -36697,7 +36668,7 @@ import {
|
|
|
36697
36668
|
RailConfigType as RailConfigType3,
|
|
36698
36669
|
getFops as getFops3
|
|
36699
36670
|
} from "@funkit/api-base";
|
|
36700
|
-
import { solanaChain as
|
|
36671
|
+
import { solanaChain as solanaChain6 } from "@funkit/chains";
|
|
36701
36672
|
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
36702
36673
|
import {
|
|
36703
36674
|
buildSwappedThirdPartyPaymentConfigs as buildSwappedThirdPartyPaymentConfigs2,
|
|
@@ -36767,7 +36738,7 @@ var useFops = ({
|
|
|
36767
36738
|
}
|
|
36768
36739
|
const destinationToken = { chainId: targetChain, address: targetAsset };
|
|
36769
36740
|
const secondaryDestinationToken = {
|
|
36770
|
-
chainId:
|
|
36741
|
+
chainId: solanaChain6.id.toString(),
|
|
36771
36742
|
address: NATIVE_TOKEN
|
|
36772
36743
|
};
|
|
36773
36744
|
const thirdPartyPaymentConfigs = buildSwappedThirdPartyPaymentConfigs2({
|
|
@@ -36917,7 +36888,7 @@ var placeholderFops = {
|
|
|
36917
36888
|
// src/modals/PolymarketPerpsTransfer/PolymarketPerpsPrefetch.tsx
|
|
36918
36889
|
function InactiveAccountQueries({ routingId }) {
|
|
36919
36890
|
useFops({ trackStepReadiness: false });
|
|
36920
|
-
|
|
36891
|
+
useEffect67(() => {
|
|
36921
36892
|
logger.info("polymarket:prefetch:inactiveAccount", { routingId });
|
|
36922
36893
|
}, [routingId]);
|
|
36923
36894
|
return null;
|
|
@@ -36925,7 +36896,7 @@ function InactiveAccountQueries({ routingId }) {
|
|
|
36925
36896
|
function PolymarketPerpsPrefetch() {
|
|
36926
36897
|
const { checkoutItem } = useCheckoutContext();
|
|
36927
36898
|
const config = checkoutItem?.initSettings.config;
|
|
36928
|
-
const inactiveConfig =
|
|
36899
|
+
const inactiveConfig = useMemo56(
|
|
36929
36900
|
() => config ? resolveInactivePolymarketAccountConfig(config) : void 0,
|
|
36930
36901
|
[config]
|
|
36931
36902
|
);
|
|
@@ -37414,14 +37385,14 @@ function CheckoutModalPrefetchedHooks() {
|
|
|
37414
37385
|
const { address: walletAddress } = useAccount();
|
|
37415
37386
|
const { setTargetAssetSupportsPermit, setTargetAssetPoolAllowance } = useQuoteContext();
|
|
37416
37387
|
const aavePermitSupported = useAaveTargetReservePermit(checkoutItem);
|
|
37417
|
-
|
|
37388
|
+
useEffect68(() => {
|
|
37418
37389
|
setTargetAssetSupportsPermit(aavePermitSupported);
|
|
37419
37390
|
}, [aavePermitSupported, setTargetAssetSupportsPermit]);
|
|
37420
37391
|
const aavePoolAllowance = useAaveTargetPoolAllowance(
|
|
37421
37392
|
checkoutItem,
|
|
37422
37393
|
walletAddress
|
|
37423
37394
|
);
|
|
37424
|
-
|
|
37395
|
+
useEffect68(() => {
|
|
37425
37396
|
setTargetAssetPoolAllowance(aavePoolAllowance);
|
|
37426
37397
|
}, [aavePoolAllowance, setTargetAssetPoolAllowance]);
|
|
37427
37398
|
return /* @__PURE__ */ React201.createElement(PolymarketPerpsPrefetch, null);
|
|
@@ -37429,7 +37400,7 @@ function CheckoutModalPrefetchedHooks() {
|
|
|
37429
37400
|
|
|
37430
37401
|
// src/modals/CheckoutModal/TransferToken/CheckoutNotifications.tsx
|
|
37431
37402
|
import clsx23 from "clsx";
|
|
37432
|
-
import React207, { useCallback as useCallback52, useEffect as
|
|
37403
|
+
import React207, { useCallback as useCallback52, useEffect as useEffect74, useMemo as useMemo57, useState as useState65 } from "react";
|
|
37433
37404
|
|
|
37434
37405
|
// src/components/FunNotificationBanner/FunNotificationShowMoreButton.tsx
|
|
37435
37406
|
import React202 from "react";
|
|
@@ -37548,10 +37519,10 @@ function consumeQrNotificationObserved(checkoutId) {
|
|
|
37548
37519
|
|
|
37549
37520
|
// src/hooks/useOnNewNotification.ts
|
|
37550
37521
|
import { safeParseJson as safeParseJson3 } from "@funkit/utils";
|
|
37551
|
-
import { useEffect as
|
|
37522
|
+
import { useEffect as useEffect69 } from "react";
|
|
37552
37523
|
var storageKey5 = "fkc-processed-notifications";
|
|
37553
37524
|
var useOnNewNotification = (combinedNotifications, cb) => {
|
|
37554
|
-
|
|
37525
|
+
useEffect69(() => {
|
|
37555
37526
|
const alreadyProcessed = safeParseJsonObject(
|
|
37556
37527
|
sessionStorage.getItem(storageKey5)
|
|
37557
37528
|
);
|
|
@@ -37598,7 +37569,7 @@ import React205 from "react";
|
|
|
37598
37569
|
|
|
37599
37570
|
// src/components/FunNotificationBanner/FunNotificationBanner.tsx
|
|
37600
37571
|
import { AnimatePresence as AnimatePresence4, motion as motion11 } from "motion/react";
|
|
37601
|
-
import React204, { useEffect as
|
|
37572
|
+
import React204, { useEffect as useEffect71, useRef as useRef42, useState as useState63 } from "react";
|
|
37602
37573
|
import clsx22 from "clsx";
|
|
37603
37574
|
|
|
37604
37575
|
// src/components/FunNotificationBanner/FunNotificationBanner.css.ts
|
|
@@ -37608,7 +37579,7 @@ var showMoreButtonStyle = "_4yitd93 _1rsrm2f1rd _1rsrm2f1i _1rsrm2f1f _1rsrm2f11
|
|
|
37608
37579
|
// src/components/FunNotificationBanner/FunNotificationBannerIcon.tsx
|
|
37609
37580
|
import clsx21 from "clsx";
|
|
37610
37581
|
import { motion as motion10, useAnimate as useAnimate2 } from "motion/react";
|
|
37611
|
-
import React203, { useCallback as useCallback48, useEffect as
|
|
37582
|
+
import React203, { useCallback as useCallback48, useEffect as useEffect70, useRef as useRef41 } from "react";
|
|
37612
37583
|
|
|
37613
37584
|
// src/components/FunNotificationBanner/FunNotificationBannerIcon.css.ts
|
|
37614
37585
|
var STATUS_SPINNER_BOTTOM_POSITION = -5;
|
|
@@ -38090,7 +38061,7 @@ var FunNotificationBannerIcon = ({
|
|
|
38090
38061
|
]);
|
|
38091
38062
|
}, [animate]);
|
|
38092
38063
|
const statusRef = useRef41(status);
|
|
38093
|
-
|
|
38064
|
+
useEffect70(() => {
|
|
38094
38065
|
if (statusRef.current !== status) {
|
|
38095
38066
|
if (statusRef.current === "processing" && status === "completed") {
|
|
38096
38067
|
triggerAnimationProcessingToCompleted();
|
|
@@ -38159,7 +38130,7 @@ var FunNotificationBanner = ({
|
|
|
38159
38130
|
const [isOpen, setIsOpen] = useState63(true);
|
|
38160
38131
|
const prevStatusRef = useRef42(status);
|
|
38161
38132
|
const prevStatus = prevStatusRef.current;
|
|
38162
|
-
|
|
38133
|
+
useEffect71(() => {
|
|
38163
38134
|
prevStatusRef.current = status;
|
|
38164
38135
|
}, [status]);
|
|
38165
38136
|
const direction = status && prevStatus && prevStatus !== status && (STATUS_RANK[status] ?? 0) < (STATUS_RANK[prevStatus] ?? 0) ? -1 : 1;
|
|
@@ -38369,7 +38340,7 @@ var useCheckout = (depositAddress, initial) => {
|
|
|
38369
38340
|
};
|
|
38370
38341
|
|
|
38371
38342
|
// src/modals/CheckoutModal/TransferToken/useTransferTokenTracking.ts
|
|
38372
|
-
import { useCallback as useCallback50, useEffect as
|
|
38343
|
+
import { useCallback as useCallback50, useEffect as useEffect72, useRef as useRef43, useState as useState64 } from "react";
|
|
38373
38344
|
|
|
38374
38345
|
// src/hooks/track/analytics/useDepositAnalytics.ts
|
|
38375
38346
|
import { useCallback as useCallback49 } from "react";
|
|
@@ -38713,7 +38684,7 @@ function useTransferTokenTracking({
|
|
|
38713
38684
|
const nextInteractionIdRef = useRef43(0);
|
|
38714
38685
|
const lastEmittedInteractionIdRef = useRef43(0);
|
|
38715
38686
|
const interactionCountRef = useRef43(0);
|
|
38716
|
-
|
|
38687
|
+
useEffect72(() => {
|
|
38717
38688
|
if (checkoutId && depositAddress) {
|
|
38718
38689
|
registerQrPaymentTarget(checkoutId, depositAddress);
|
|
38719
38690
|
}
|
|
@@ -38726,7 +38697,7 @@ function useTransferTokenTracking({
|
|
|
38726
38697
|
},
|
|
38727
38698
|
[]
|
|
38728
38699
|
);
|
|
38729
|
-
|
|
38700
|
+
useEffect72(() => {
|
|
38730
38701
|
if (!pendingInteraction || pendingInteraction.expectedSourceChain !== fromChainId || pendingInteraction.expectedSourceTicker !== fromTokenSymbol || !fromTokenAddress || !depositAddress || !targetChainId || !targetTokenAddress || lastEmittedInteractionIdRef.current >= pendingInteraction.id) {
|
|
38731
38702
|
return;
|
|
38732
38703
|
}
|
|
@@ -38765,7 +38736,7 @@ function useTransferTokenTracking({
|
|
|
38765
38736
|
targetTokenSymbol,
|
|
38766
38737
|
trackDepositTransferInteracted
|
|
38767
38738
|
]);
|
|
38768
|
-
|
|
38739
|
+
useEffect72(() => {
|
|
38769
38740
|
if (depositAddress && fromChainId && toChainId && toTokenAddress) {
|
|
38770
38741
|
setTokenTransferAddressShownAtMs({
|
|
38771
38742
|
fromChainId,
|
|
@@ -38935,7 +38906,7 @@ function useNotificationTracking({
|
|
|
38935
38906
|
itemRef.current = item;
|
|
38936
38907
|
statusRef.current = status;
|
|
38937
38908
|
const id = item ? getNotificationId(item) : null;
|
|
38938
|
-
|
|
38909
|
+
useEffect72(() => {
|
|
38939
38910
|
if (!id || !itemRef.current) {
|
|
38940
38911
|
depositNotificationDisplayRef.current = null;
|
|
38941
38912
|
return;
|
|
@@ -38981,7 +38952,7 @@ function useNotificationTracking({
|
|
|
38981
38952
|
notificationDisplayedAtRef.current = null;
|
|
38982
38953
|
};
|
|
38983
38954
|
}, [id, logEvent]);
|
|
38984
|
-
|
|
38955
|
+
useEffect72(() => {
|
|
38985
38956
|
if (!itemRef.current || !notificationDisplayedAtRef.current) {
|
|
38986
38957
|
return;
|
|
38987
38958
|
}
|
|
@@ -39490,10 +39461,10 @@ function useSaveTransferTokenOnDeposit() {
|
|
|
39490
39461
|
}
|
|
39491
39462
|
|
|
39492
39463
|
// src/modals/CheckoutModal/TransferToken/useTrackDepositNotificationEvents.ts
|
|
39493
|
-
import { useEffect as
|
|
39464
|
+
import { useEffect as useEffect73 } from "react";
|
|
39494
39465
|
function useTrackDepositNotificationEvents(items) {
|
|
39495
39466
|
const { trackExecutionProgressEvents } = useTrackExecutionProgressEvents("deposit");
|
|
39496
|
-
|
|
39467
|
+
useEffect73(() => {
|
|
39497
39468
|
for (const item of items) {
|
|
39498
39469
|
trackExecutionProgressEvents(item);
|
|
39499
39470
|
}
|
|
@@ -39515,25 +39486,25 @@ var CheckoutNotifications = ({
|
|
|
39515
39486
|
const [closedNotifications, setClosedNotifications] = useState65([]);
|
|
39516
39487
|
const { data: checkouts } = useRecentCheckouts({ isVisible });
|
|
39517
39488
|
const { data: directExecutions } = useRecentDeposits({ isVisible });
|
|
39518
|
-
const mergedDirectExecutions =
|
|
39489
|
+
const mergedDirectExecutions = useMemo57(
|
|
39519
39490
|
() => processRecentDepositsForNotifications(directExecutions, {
|
|
39520
39491
|
variant
|
|
39521
39492
|
}),
|
|
39522
39493
|
[directExecutions, variant]
|
|
39523
39494
|
);
|
|
39524
|
-
|
|
39495
|
+
useEffect74(() => {
|
|
39525
39496
|
if (initialCheckouts || !checkouts) {
|
|
39526
39497
|
return;
|
|
39527
39498
|
}
|
|
39528
39499
|
setInitialCheckouts(checkouts);
|
|
39529
39500
|
}, [initialCheckouts, checkouts]);
|
|
39530
|
-
|
|
39501
|
+
useEffect74(() => {
|
|
39531
39502
|
if (initialDirectExecutions || !directExecutions) {
|
|
39532
39503
|
return;
|
|
39533
39504
|
}
|
|
39534
39505
|
setInitialDirectExecutions(directExecutions);
|
|
39535
39506
|
}, [initialDirectExecutions, directExecutions]);
|
|
39536
|
-
const displayedDirectExecutions =
|
|
39507
|
+
const displayedDirectExecutions = useMemo57(() => {
|
|
39537
39508
|
if (!mergedDirectExecutions || !initialDirectExecutions) {
|
|
39538
39509
|
return [];
|
|
39539
39510
|
}
|
|
@@ -39545,13 +39516,13 @@ var CheckoutNotifications = ({
|
|
|
39545
39516
|
return !closedNotifications.includes(notificationKey);
|
|
39546
39517
|
}).slice(0, MAX_COUNT);
|
|
39547
39518
|
}, [initialDirectExecutions, mergedDirectExecutions, closedNotifications]);
|
|
39548
|
-
const displayedCheckouts =
|
|
39519
|
+
const displayedCheckouts = useMemo57(() => {
|
|
39549
39520
|
if (!checkouts || !initialCheckouts) {
|
|
39550
39521
|
return [];
|
|
39551
39522
|
}
|
|
39552
39523
|
return getUpdatedCheckouts(checkouts, initialCheckouts).filter(({ depositAddr }) => !closedNotifications.includes(depositAddr)).slice(0, MAX_COUNT);
|
|
39553
39524
|
}, [initialCheckouts, checkouts, closedNotifications]);
|
|
39554
|
-
const combinedNotifications =
|
|
39525
|
+
const combinedNotifications = useMemo57(() => {
|
|
39555
39526
|
return [
|
|
39556
39527
|
...displayedDirectExecutions.map(
|
|
39557
39528
|
(item) => ({ ...item, isDirectExecution: true })
|
|
@@ -39562,7 +39533,7 @@ var CheckoutNotifications = ({
|
|
|
39562
39533
|
].sort((a, b) => b.createdTimeMs - a.createdTimeMs);
|
|
39563
39534
|
}, [displayedDirectExecutions, displayedCheckouts]);
|
|
39564
39535
|
useTrackDepositNotificationEvents(combinedNotifications);
|
|
39565
|
-
|
|
39536
|
+
useEffect74(() => {
|
|
39566
39537
|
if (!isVisible || !checkoutItem) {
|
|
39567
39538
|
return;
|
|
39568
39539
|
}
|
|
@@ -39574,7 +39545,7 @@ var CheckoutNotifications = ({
|
|
|
39574
39545
|
);
|
|
39575
39546
|
}
|
|
39576
39547
|
}, [checkoutItem, combinedNotifications, isVisible]);
|
|
39577
|
-
const displayedNotifications =
|
|
39548
|
+
const displayedNotifications = useMemo57(() => {
|
|
39578
39549
|
return isExpanded ? combinedNotifications : combinedNotifications.slice(0, COLLAPSED_COUNT);
|
|
39579
39550
|
}, [isExpanded, combinedNotifications]);
|
|
39580
39551
|
const handleNotificationClose = (id) => setClosedNotifications((prev) => [...prev, id]);
|
|
@@ -39957,17 +39928,17 @@ function selectSuccessScreenBackground({
|
|
|
39957
39928
|
// src/modals/CheckoutModal/stepTransition.ts
|
|
39958
39929
|
import {
|
|
39959
39930
|
useCallback as useCallback72,
|
|
39960
|
-
useEffect as
|
|
39931
|
+
useEffect as useEffect98,
|
|
39961
39932
|
useRef as useRef61,
|
|
39962
39933
|
useState as useState95
|
|
39963
39934
|
} from "react";
|
|
39964
39935
|
|
|
39965
39936
|
// src/hooks/useCheckoutQuoteNotification.ts
|
|
39966
|
-
import { useMemo as
|
|
39937
|
+
import { useMemo as useMemo58 } from "react";
|
|
39967
39938
|
function useCheckoutQuoteNotification() {
|
|
39968
39939
|
const { clearCheckoutQuoteMessages } = useQuoteContext();
|
|
39969
39940
|
const { quoteError, quoteStepMessage } = useQuoteContext();
|
|
39970
|
-
const quoteNotification =
|
|
39941
|
+
const quoteNotification = useMemo58(() => {
|
|
39971
39942
|
if (quoteError) {
|
|
39972
39943
|
return {
|
|
39973
39944
|
messageType: "error",
|
|
@@ -41379,7 +41350,7 @@ function VirtualFiatAccount({
|
|
|
41379
41350
|
|
|
41380
41351
|
// src/modals/PolymarketPerpsTransfer/PerpsTransferStep.tsx
|
|
41381
41352
|
import { useQueryClient as useQueryClient4 } from "@tanstack/react-query";
|
|
41382
|
-
import React238, { useEffect as
|
|
41353
|
+
import React238, { useEffect as useEffect76, useRef as useRef46, useState as useState69 } from "react";
|
|
41383
41354
|
import { createPortal as createPortal11 } from "react-dom";
|
|
41384
41355
|
|
|
41385
41356
|
// src/modals/PolymarketPerpsTransfer/useRecordPerpsTransfer.ts
|
|
@@ -42051,7 +42022,7 @@ function PerpsTransferBottomBar({ form }) {
|
|
|
42051
42022
|
|
|
42052
42023
|
// src/modals/PolymarketPerpsTransfer/usePerpsTransferForm.ts
|
|
42053
42024
|
import * as dnum8 from "dnum";
|
|
42054
|
-
import { useEffect as
|
|
42025
|
+
import { useEffect as useEffect75, useState as useState68 } from "react";
|
|
42055
42026
|
function parseAmount(amount) {
|
|
42056
42027
|
return Number(amount.replace(/,/g, ""));
|
|
42057
42028
|
}
|
|
@@ -42114,7 +42085,7 @@ function usePerpsTransferForm({
|
|
|
42114
42085
|
const [direction, setDirection] = useState68(
|
|
42115
42086
|
lockedDirection ?? initialDirection
|
|
42116
42087
|
);
|
|
42117
|
-
|
|
42088
|
+
useEffect75(() => {
|
|
42118
42089
|
logger.info("polymarket:perpsTransfer:directionResolved", {
|
|
42119
42090
|
access: {
|
|
42120
42091
|
predictions: predictionsAccessible,
|
|
@@ -42133,12 +42104,12 @@ function usePerpsTransferForm({
|
|
|
42133
42104
|
perpsAccessible,
|
|
42134
42105
|
predictionsAccessible
|
|
42135
42106
|
]);
|
|
42136
|
-
|
|
42107
|
+
useEffect75(() => {
|
|
42137
42108
|
if (lockedDirection) {
|
|
42138
42109
|
setDirection(lockedDirection);
|
|
42139
42110
|
}
|
|
42140
42111
|
}, [lockedDirection]);
|
|
42141
|
-
|
|
42112
|
+
useEffect75(() => {
|
|
42142
42113
|
if (status === "success") {
|
|
42143
42114
|
setAmount("");
|
|
42144
42115
|
setAmountSelection(null);
|
|
@@ -42287,7 +42258,7 @@ function PerpsTransferStepComponent({
|
|
|
42287
42258
|
successTimerRef.current = null;
|
|
42288
42259
|
}
|
|
42289
42260
|
};
|
|
42290
|
-
|
|
42261
|
+
useEffect76(() => clearSuccessTimer, []);
|
|
42291
42262
|
const perpsTransfer = checkoutItem?.initSettings.config.polymarketPerpsTransfer;
|
|
42292
42263
|
const balances = usePolymarketAccountBalances({
|
|
42293
42264
|
predictions: perpsTransfer?.predictions,
|
|
@@ -42886,7 +42857,7 @@ import React247 from "react";
|
|
|
42886
42857
|
|
|
42887
42858
|
// src/modals/CheckoutModal/Brokerage/components/BrokerageSuccess.tsx
|
|
42888
42859
|
import { capitalizeFirstLetter } from "@funkit/utils";
|
|
42889
|
-
import React246, { useMemo as
|
|
42860
|
+
import React246, { useMemo as useMemo59 } from "react";
|
|
42890
42861
|
var BrokerageSuccess = ({
|
|
42891
42862
|
bottomBarId,
|
|
42892
42863
|
onClose,
|
|
@@ -42894,7 +42865,7 @@ var BrokerageSuccess = ({
|
|
|
42894
42865
|
}) => {
|
|
42895
42866
|
const { t } = useFunkitTranslation();
|
|
42896
42867
|
const { exchangeType } = useBluvo();
|
|
42897
|
-
const customTextConfigSteps =
|
|
42868
|
+
const customTextConfigSteps = useMemo59(() => {
|
|
42898
42869
|
if (exchangeType) {
|
|
42899
42870
|
return {
|
|
42900
42871
|
...getDefaultTextConfigSteps(t),
|
|
@@ -42970,7 +42941,7 @@ import { bluvoExecuteWithdrawal as bluvoExecuteWithdrawal2 } from "@funkit/api-b
|
|
|
42970
42941
|
// src/components/FunInput/FunTwoFaInput.tsx
|
|
42971
42942
|
import React248, {
|
|
42972
42943
|
useCallback as useCallback55,
|
|
42973
|
-
useEffect as
|
|
42944
|
+
useEffect as useEffect77,
|
|
42974
42945
|
useRef as useRef48,
|
|
42975
42946
|
useState as useState71
|
|
42976
42947
|
} from "react";
|
|
@@ -42991,7 +42962,7 @@ var FunTwoFaInput = ({
|
|
|
42991
42962
|
const [currentLength, setCurrentLength] = useState71(initialInputLength);
|
|
42992
42963
|
const [focusIndex, setFocusIndex] = useState71(0);
|
|
42993
42964
|
const [isFocused, setIsFocused] = useState71(false);
|
|
42994
|
-
|
|
42965
|
+
useEffect77(() => {
|
|
42995
42966
|
if (!value) {
|
|
42996
42967
|
setFocusIndex(0);
|
|
42997
42968
|
}
|
|
@@ -43599,7 +43570,7 @@ var TwoFactorIcon = () => /* @__PURE__ */ React249.createElement(
|
|
|
43599
43570
|
);
|
|
43600
43571
|
|
|
43601
43572
|
// src/modals/CheckoutModal/Brokerage/ConnectExchange.tsx
|
|
43602
|
-
import React252, { useCallback as useCallback56, useEffect as
|
|
43573
|
+
import React252, { useCallback as useCallback56, useEffect as useEffect78, useRef as useRef49, useState as useState73 } from "react";
|
|
43603
43574
|
import { createPortal as createPortal13 } from "react-dom";
|
|
43604
43575
|
|
|
43605
43576
|
// src/components/Icons/HandIcon.tsx
|
|
@@ -43729,7 +43700,7 @@ function ConnectExchange({
|
|
|
43729
43700
|
isConnectingRef.current = false;
|
|
43730
43701
|
}
|
|
43731
43702
|
});
|
|
43732
|
-
|
|
43703
|
+
useEffect78(() => {
|
|
43733
43704
|
if (isConnected) {
|
|
43734
43705
|
navigateToBrokerage();
|
|
43735
43706
|
}
|
|
@@ -44187,7 +44158,7 @@ function CheckoutComplete({
|
|
|
44187
44158
|
|
|
44188
44159
|
// src/modals/CheckoutModal/ConfirmationStep/ConfirmationStep.tsx
|
|
44189
44160
|
import * as dnum9 from "dnum";
|
|
44190
|
-
import React270, { useEffect as
|
|
44161
|
+
import React270, { useEffect as useEffect83, useMemo as useMemo64, useState as useState83 } from "react";
|
|
44191
44162
|
import { createPortal as createPortal16 } from "react-dom";
|
|
44192
44163
|
import { DirectExecutionType as DirectExecutionType8 } from "@funkit/api-base";
|
|
44193
44164
|
|
|
@@ -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
|
}
|
|
@@ -45899,7 +45870,7 @@ function useQuoteRefresh({
|
|
|
45899
45870
|
const quoteCallbackRef = useRef51(void 0);
|
|
45900
45871
|
const [isPendingRefresh, setIsPendingRefresh] = useState82(false);
|
|
45901
45872
|
const [numQuoteRefreshes, setNumQuoteRefreshes] = useState82(0);
|
|
45902
|
-
|
|
45873
|
+
useEffect81(() => {
|
|
45903
45874
|
setNumQuoteRefreshes(0);
|
|
45904
45875
|
}, [checkoutId]);
|
|
45905
45876
|
const {
|
|
@@ -45976,7 +45947,7 @@ function useQuoteRefresh({
|
|
|
45976
45947
|
},
|
|
45977
45948
|
[isOnHold, restartCountdown, setCheckoutQuote, triggerAssetConfirm]
|
|
45978
45949
|
);
|
|
45979
|
-
const quoteError =
|
|
45950
|
+
const quoteError = useMemo63(() => {
|
|
45980
45951
|
if (contextQuoteError && !isQuoting) {
|
|
45981
45952
|
return {
|
|
45982
45953
|
...contextQuoteError,
|
|
@@ -45985,7 +45956,7 @@ function useQuoteRefresh({
|
|
|
45985
45956
|
}
|
|
45986
45957
|
return null;
|
|
45987
45958
|
}, [isQuoting, contextQuoteError]);
|
|
45988
|
-
|
|
45959
|
+
useEffect81(() => {
|
|
45989
45960
|
if (isPendingRefresh && !isOnHold) {
|
|
45990
45961
|
setIsPendingRefresh(false);
|
|
45991
45962
|
refreshQuote();
|
|
@@ -46003,7 +45974,7 @@ function useQuoteRefresh({
|
|
|
46003
45974
|
}
|
|
46004
45975
|
|
|
46005
45976
|
// src/modals/CheckoutModal/ConfirmationStep/useTrackDepositQuoteEvents.ts
|
|
46006
|
-
import { useCallback as useCallback64, useEffect as
|
|
45977
|
+
import { useCallback as useCallback64, useEffect as useEffect82, useRef as useRef52 } from "react";
|
|
46007
45978
|
function buildQuoteEventArgs({
|
|
46008
45979
|
checkoutConfig,
|
|
46009
45980
|
checkoutItem,
|
|
@@ -46066,10 +46037,10 @@ function useTrackDepositQuoteEvents({
|
|
|
46066
46037
|
const checkoutId = checkoutItem?.id ?? null;
|
|
46067
46038
|
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
46068
46039
|
const lastDisplayedQuoteIdRef = useRef52(null);
|
|
46069
|
-
|
|
46040
|
+
useEffect82(() => {
|
|
46070
46041
|
lastDisplayedQuoteIdRef.current = null;
|
|
46071
46042
|
}, [checkoutId]);
|
|
46072
|
-
|
|
46043
|
+
useEffect82(() => {
|
|
46073
46044
|
if (!checkoutItem?.finalDollarValue || !checkoutConfig || !latestQuote || isQuoteLoading) {
|
|
46074
46045
|
return;
|
|
46075
46046
|
}
|
|
@@ -46257,7 +46228,7 @@ function ConfirmationStep({
|
|
|
46257
46228
|
}
|
|
46258
46229
|
}
|
|
46259
46230
|
});
|
|
46260
|
-
|
|
46231
|
+
useEffect83(() => {
|
|
46261
46232
|
if (!isDirectWalletTransfer) {
|
|
46262
46233
|
triggerNewQuote({ maxRetries: 1 });
|
|
46263
46234
|
}
|
|
@@ -46285,7 +46256,7 @@ function ConfirmationStep({
|
|
|
46285
46256
|
flow: "deposit",
|
|
46286
46257
|
step: "confirmation" /* CONFIRMATION */
|
|
46287
46258
|
});
|
|
46288
|
-
const stepMessage =
|
|
46259
|
+
const stepMessage = useMemo64(() => {
|
|
46289
46260
|
if (initialQuoteStep) {
|
|
46290
46261
|
return initialQuoteStep;
|
|
46291
46262
|
}
|
|
@@ -46406,7 +46377,7 @@ function ConfirmationStep({
|
|
|
46406
46377
|
};
|
|
46407
46378
|
const isStepLoading = isInitialQuoting || isContinuing || isRefreshing || aaveSupply.isPending || nadoDirectTransfer.isPending;
|
|
46408
46379
|
const customRecipient = checkoutItem?.initSettings.config.customRecipient;
|
|
46409
|
-
const displayAmounts =
|
|
46380
|
+
const displayAmounts = useMemo64(() => {
|
|
46410
46381
|
if (!latestQuote || !checkoutConfig?.targetAssetAmount) {
|
|
46411
46382
|
return null;
|
|
46412
46383
|
}
|
|
@@ -46422,7 +46393,7 @@ function ConfirmationStep({
|
|
|
46422
46393
|
quoteBuilder
|
|
46423
46394
|
]);
|
|
46424
46395
|
const supplyHumanAmount = displayAmounts?.receiveAmount ?? (checkoutConfig?.targetAssetAmount != null ? String(checkoutConfig.targetAssetAmount) : null);
|
|
46425
|
-
const resolveHealthFactor =
|
|
46396
|
+
const resolveHealthFactor = useMemo64(
|
|
46426
46397
|
() => wrapResolveHealthFactor(checkoutConfig?.resolveHealthFactor),
|
|
46427
46398
|
[checkoutConfig?.resolveHealthFactor]
|
|
46428
46399
|
);
|
|
@@ -46436,7 +46407,7 @@ function ConfirmationStep({
|
|
|
46436
46407
|
const resolveDestinationLineItems = checkoutConfig?.resolveDestinationLineItems;
|
|
46437
46408
|
const targetHumanAmount = displayAmounts?.receiveAmount ?? (isExactIn ? null : supplyHumanAmount);
|
|
46438
46409
|
const sourceAssetInfo = checkoutItem?.selectedSourceAssetInfo;
|
|
46439
|
-
const destinationLineItems =
|
|
46410
|
+
const destinationLineItems = useMemo64(() => {
|
|
46440
46411
|
if (!resolveDestinationLineItems || !targetHumanAmount) {
|
|
46441
46412
|
return null;
|
|
46442
46413
|
}
|
|
@@ -46461,7 +46432,7 @@ function ConfirmationStep({
|
|
|
46461
46432
|
const hasStaticPrimaryInfoValue = isExactIn && checkoutItem?.inputFiatAmount != null || !isExactIn && !!checkoutConfig?.targetAssetAmount && isStablecoin(checkoutConfig.targetAssetTicker);
|
|
46462
46433
|
const checkoutId = checkoutItem?.id;
|
|
46463
46434
|
const isReady = !!checkoutItem?.finalDollarValue && !isQuoteLoading;
|
|
46464
|
-
|
|
46435
|
+
useEffect83(() => {
|
|
46465
46436
|
if (checkoutId && isReady) {
|
|
46466
46437
|
logMeasuredEvent({
|
|
46467
46438
|
eventName: "fc::ready::confirmation" /* READY_CONFIRMATION */,
|
|
@@ -46594,7 +46565,7 @@ function ConfirmationStep({
|
|
|
46594
46565
|
|
|
46595
46566
|
// src/modals/CheckoutModal/InputAmount/InputAmount.tsx
|
|
46596
46567
|
import { isMobile as isMobile13 } from "@funkit/utils";
|
|
46597
|
-
import React285, { useEffect as
|
|
46568
|
+
import React285, { useEffect as useEffect87 } from "react";
|
|
46598
46569
|
|
|
46599
46570
|
// src/hooks/queries/useMeldCurrencies.ts
|
|
46600
46571
|
import { getMeldSupportedFiat } from "@funkit/api-base";
|
|
@@ -46802,18 +46773,18 @@ import {
|
|
|
46802
46773
|
} from "@funkit/utils";
|
|
46803
46774
|
import * as dnum11 from "dnum";
|
|
46804
46775
|
import { motion as motion17 } from "motion/react";
|
|
46805
|
-
import React283, { useEffect as
|
|
46776
|
+
import React283, { useEffect as useEffect86, useMemo as useMemo68, useState as useState85 } from "react";
|
|
46806
46777
|
|
|
46807
46778
|
// src/components/AnimatedWidthWrapper/AnimatedWidthWrapper.tsx
|
|
46808
46779
|
import { motion as motion16 } from "motion/react";
|
|
46809
46780
|
import React271 from "react";
|
|
46810
|
-
import { useEffect as
|
|
46781
|
+
import { useEffect as useEffect84, useRef as useRef53, useState as useState84 } from "react";
|
|
46811
46782
|
function AnimatedWidthWrapper({ children }) {
|
|
46812
46783
|
const containerRef = useRef53(null);
|
|
46813
46784
|
const animationFrameRef = useRef53(null);
|
|
46814
46785
|
const resizeObserverRef = useRef53(null);
|
|
46815
46786
|
const [width, setWidth] = useState84("auto");
|
|
46816
|
-
|
|
46787
|
+
useEffect84(() => {
|
|
46817
46788
|
if (containerRef.current) {
|
|
46818
46789
|
resizeObserverRef.current = new ResizeObserver((entries) => {
|
|
46819
46790
|
animationFrameRef.current = requestAnimationFrame(() => {
|
|
@@ -46845,7 +46816,7 @@ function AnimatedWidthWrapper({ children }) {
|
|
|
46845
46816
|
}
|
|
46846
46817
|
|
|
46847
46818
|
// src/components/ApprovalMethodToggle/ApprovalMethodToggle.tsx
|
|
46848
|
-
import React272, { useCallback as useCallback65, useMemo as
|
|
46819
|
+
import React272, { useCallback as useCallback65, useMemo as useMemo65, useRef as useRef54 } from "react";
|
|
46849
46820
|
function ApprovalMethodToggle({
|
|
46850
46821
|
value,
|
|
46851
46822
|
onChange,
|
|
@@ -46854,7 +46825,7 @@ function ApprovalMethodToggle({
|
|
|
46854
46825
|
}) {
|
|
46855
46826
|
const { t } = useFunkitTranslation();
|
|
46856
46827
|
const tooltipAnchorRef = useRef54(null);
|
|
46857
|
-
const options =
|
|
46828
|
+
const options = useMemo65(
|
|
46858
46829
|
() => [
|
|
46859
46830
|
{ label: t("approvalMethodToggle.signedMessage"), value: "sign" },
|
|
46860
46831
|
{
|
|
@@ -48094,7 +48065,7 @@ var useCheckoutAmountLimits = ({
|
|
|
48094
48065
|
};
|
|
48095
48066
|
|
|
48096
48067
|
// src/modals/CheckoutModal/InputAmount/useAmountInput.ts
|
|
48097
|
-
import { useCallback as useCallback66, useMemo as
|
|
48068
|
+
import { useCallback as useCallback66, useMemo as useMemo66, useReducer as useReducer2, useRef as useRef55 } from "react";
|
|
48098
48069
|
|
|
48099
48070
|
// src/modals/CheckoutModal/InputAmount/state.ts
|
|
48100
48071
|
import { isTokenEquivalent as isTokenEquivalent13, round as round3 } from "@funkit/utils";
|
|
@@ -48866,7 +48837,7 @@ var MAX_AVAILABLE_WIDTH2 = 310;
|
|
|
48866
48837
|
function useAmountInput(options) {
|
|
48867
48838
|
const { t } = useFunkitTranslation();
|
|
48868
48839
|
const isMeldEnabled = useIsMeldEnabled();
|
|
48869
|
-
const [state, dispatch] =
|
|
48840
|
+
const [state, dispatch] = useReducer2(reduceState, options, initializeState);
|
|
48870
48841
|
const {
|
|
48871
48842
|
unitPrice: realUnitPrice,
|
|
48872
48843
|
checkoutConfig,
|
|
@@ -48874,7 +48845,7 @@ function useAmountInput(options) {
|
|
|
48874
48845
|
quickOptions,
|
|
48875
48846
|
paymentMethodInfo
|
|
48876
48847
|
} = options;
|
|
48877
|
-
const derivedState =
|
|
48848
|
+
const derivedState = useMemo66(
|
|
48878
48849
|
() => getDerivedState(state, checkoutConfig.targetAssetTicker),
|
|
48879
48850
|
[state, checkoutConfig]
|
|
48880
48851
|
);
|
|
@@ -49286,7 +49257,7 @@ import {
|
|
|
49286
49257
|
useQuery as useQuery23,
|
|
49287
49258
|
useQueryClient as useQueryClient5
|
|
49288
49259
|
} from "@tanstack/react-query";
|
|
49289
|
-
import { useEffect as
|
|
49260
|
+
import { useEffect as useEffect85, useMemo as useMemo67 } from "react";
|
|
49290
49261
|
import { useDebounce as useDebounce2 } from "use-debounce";
|
|
49291
49262
|
var DEBOUNCE_DELAY = 500;
|
|
49292
49263
|
var COUNTDOWN_INTERVAL_SEC = 60;
|
|
@@ -49302,7 +49273,7 @@ var useMeldQuotes = (sourceAmount, fiatCurrency, meldEnabled = true) => {
|
|
|
49302
49273
|
const checkoutId = checkoutItem?.id ?? null;
|
|
49303
49274
|
const destinationCurrencyCode = useMeldCryptoCurrencyCode();
|
|
49304
49275
|
const sourceCurrencyCode = fiatCurrency || "USD";
|
|
49305
|
-
const queryKey =
|
|
49276
|
+
const queryKey = useMemo67(
|
|
49306
49277
|
() => [
|
|
49307
49278
|
"meld",
|
|
49308
49279
|
"quotes",
|
|
@@ -49357,7 +49328,7 @@ var useMeldQuotes = (sourceAmount, fiatCurrency, meldEnabled = true) => {
|
|
|
49357
49328
|
autoRestart: true
|
|
49358
49329
|
});
|
|
49359
49330
|
const isOutdated = sourceAmount !== debouncedSourceAmount;
|
|
49360
|
-
|
|
49331
|
+
useEffect85(() => {
|
|
49361
49332
|
if (!checkoutId || isOutdated || query.isFetching || !query.isFetchedAfterMount || !query.data) {
|
|
49362
49333
|
return;
|
|
49363
49334
|
}
|
|
@@ -49581,7 +49552,7 @@ function InputAmountLoaded({
|
|
|
49581
49552
|
const isExactIn = quoteBuilder.isExactIn();
|
|
49582
49553
|
const sourceTokenKey = sourceHolding?.chainSymbolKey;
|
|
49583
49554
|
const sourceTokenChanged = modalState.sourceTokenKey != null && modalState.sourceTokenKey !== sourceTokenKey;
|
|
49584
|
-
|
|
49555
|
+
useEffect86(() => {
|
|
49585
49556
|
if (sourceTokenChanged) {
|
|
49586
49557
|
setAmountSelection({ selectType: "default", presetAmount: null });
|
|
49587
49558
|
}
|
|
@@ -49648,7 +49619,7 @@ function InputAmountLoaded({
|
|
|
49648
49619
|
}
|
|
49649
49620
|
return setFiatAmount(selectedFiat);
|
|
49650
49621
|
}
|
|
49651
|
-
|
|
49622
|
+
useEffect86(() => {
|
|
49652
49623
|
if (isInputInFiat !== modalState.isInputInFiat || fiatAmount !== modalState.fiatAmount || assetAmount !== modalState.assetAmount || sourceTokenKey !== modalState.sourceTokenKey || amountSelection.selectType !== modalState.amountSelection?.selectType || amountSelection.presetAmount !== modalState.amountSelection?.presetAmount) {
|
|
49653
49624
|
setModalState((state) => ({
|
|
49654
49625
|
...state,
|
|
@@ -49682,7 +49653,7 @@ function InputAmountLoaded({
|
|
|
49682
49653
|
fiatCurrency,
|
|
49683
49654
|
onNext
|
|
49684
49655
|
});
|
|
49685
|
-
const error =
|
|
49656
|
+
const error = useMemo68(() => {
|
|
49686
49657
|
if (isCardCheckout) {
|
|
49687
49658
|
const meldError = getMeldError();
|
|
49688
49659
|
if (meldError) {
|
|
@@ -50181,7 +50152,7 @@ function YouPayYouReceiveWrapper({
|
|
|
50181
50152
|
|
|
50182
50153
|
// src/modals/CheckoutModal/InputAmount/InputAmountLoading.tsx
|
|
50183
50154
|
import { formatCryptoAndStringify as formatCryptoAndStringify10 } from "@funkit/utils";
|
|
50184
|
-
import React284, { useMemo as
|
|
50155
|
+
import React284, { useMemo as useMemo69 } from "react";
|
|
50185
50156
|
function InputAmountLoading({
|
|
50186
50157
|
modalState,
|
|
50187
50158
|
sourceHoldingError,
|
|
@@ -50204,7 +50175,7 @@ function InputAmountLoading({
|
|
|
50204
50175
|
isExactIn,
|
|
50205
50176
|
sourceTokenSymbol: sourceAsset?.symbol
|
|
50206
50177
|
});
|
|
50207
|
-
const error =
|
|
50178
|
+
const error = useMemo69(() => {
|
|
50208
50179
|
if (sourceHoldingError) {
|
|
50209
50180
|
return {
|
|
50210
50181
|
code: "BALANCE_UNAVAILABLE",
|
|
@@ -50316,7 +50287,7 @@ function getLoadingAmountOptions(paymentMethod) {
|
|
|
50316
50287
|
}
|
|
50317
50288
|
|
|
50318
50289
|
// src/modals/CheckoutModal/InputAmount/useAvailableBalanceForCheckout.ts
|
|
50319
|
-
import { useMemo as
|
|
50290
|
+
import { useMemo as useMemo70 } from "react";
|
|
50320
50291
|
function useAvailableBalanceForCheckout(paymentMethodInfo, targetChainId, assetChainId, assetSymbol) {
|
|
50321
50292
|
const paymentMethod = paymentMethodInfo.paymentMethod;
|
|
50322
50293
|
const isBrokerage = paymentMethod === PaymentMethod.BROKERAGE;
|
|
@@ -50333,7 +50304,7 @@ function useAvailableBalanceForCheckout(paymentMethodInfo, targetChainId, assetC
|
|
|
50333
50304
|
[PaymentMethod.VIRTUAL_BANK]: null
|
|
50334
50305
|
}[paymentMethod];
|
|
50335
50306
|
const isLoading = isBrokerage ? isLoadingBrokerageBalance : isLoadingWalletAssetHoldings;
|
|
50336
|
-
const holdingItem =
|
|
50307
|
+
const holdingItem = useMemo70(() => {
|
|
50337
50308
|
if (!assetSymbol || !holdings) {
|
|
50338
50309
|
return;
|
|
50339
50310
|
}
|
|
@@ -50479,10 +50450,10 @@ function InputAmount(props) {
|
|
|
50479
50450
|
query: { enabled: gasFetchingEnabled }
|
|
50480
50451
|
});
|
|
50481
50452
|
const isLoaded = !!(checkoutItem && unitPrice && !sourceHoldingError && !isLoadingSourceHolding && !isMeldDefaultCurrencyLoading && (!gasFetchingEnabled || gasPriceWei !== void 0));
|
|
50482
|
-
|
|
50453
|
+
useEffect87(() => setCheckoutQuote(null), []);
|
|
50483
50454
|
const checkoutId = checkoutItem?.id;
|
|
50484
50455
|
const paymentMethod = paymentMethodInfo.paymentMethod;
|
|
50485
|
-
|
|
50456
|
+
useEffect87(() => {
|
|
50486
50457
|
if (checkoutId && isLoaded) {
|
|
50487
50458
|
logMeasuredEvent({
|
|
50488
50459
|
eventName: "fc::ready::input_amount" /* READY_INPUT_AMOUNT */,
|
|
@@ -50515,7 +50486,7 @@ function InputAmount(props) {
|
|
|
50515
50486
|
}
|
|
50516
50487
|
|
|
50517
50488
|
// src/modals/CheckoutModal/LightningInvoice/LightningInvoice.tsx
|
|
50518
|
-
import React289, { useEffect as
|
|
50489
|
+
import React289, { useEffect as useEffect89 } from "react";
|
|
50519
50490
|
import { createPortal as createPortal18 } from "react-dom";
|
|
50520
50491
|
|
|
50521
50492
|
// src/components/CopyAddress/CopyInputDisplayedAddress.tsx
|
|
@@ -50636,15 +50607,15 @@ function CopyInputDisplayedAddress(props) {
|
|
|
50636
50607
|
import {
|
|
50637
50608
|
getLightningQuote
|
|
50638
50609
|
} from "@funkit/api-base";
|
|
50639
|
-
import { LIGHTNING_MAINNET_CHAIN_ID, bitcoinChain as
|
|
50610
|
+
import { LIGHTNING_MAINNET_CHAIN_ID, bitcoinChain as bitcoinChain4 } from "@funkit/chains";
|
|
50640
50611
|
import { getAssetPriceInfoWithFallback as getAssetPriceInfoWithFallback2 } from "@funkit/connect-core";
|
|
50641
50612
|
import { keepPreviousData as keepPreviousData4, useQuery as useQuery24 } from "@tanstack/react-query";
|
|
50642
|
-
import { useEffect as
|
|
50613
|
+
import { useEffect as useEffect88, useRef as useRef56, useState as useState87 } from "react";
|
|
50643
50614
|
import { parseUnits as parseUnits5 } from "viem";
|
|
50644
50615
|
var QUOTE_REFRESH_LEAD_MS = 3e3;
|
|
50645
50616
|
var QUOTE_REFRESH_MIN_MS = 250;
|
|
50646
50617
|
var QUOTE_GC_MS = 1e4;
|
|
50647
|
-
var BTC_DECIMALS =
|
|
50618
|
+
var BTC_DECIMALS = bitcoinChain4.nativeCurrency.decimals;
|
|
50648
50619
|
var SATS_PER_BTC = 10n ** BigInt(BTC_DECIMALS);
|
|
50649
50620
|
function usdToSats(usd, btcPrice) {
|
|
50650
50621
|
if (usd && btcPrice) {
|
|
@@ -50657,7 +50628,7 @@ function useDeferredQuote(latestQuote) {
|
|
|
50657
50628
|
const [displayedQuote, setDisplayedQuote] = useState87(latestQuote);
|
|
50658
50629
|
const latestQuoteRef = useRef56(latestQuote);
|
|
50659
50630
|
latestQuoteRef.current = latestQuote;
|
|
50660
|
-
|
|
50631
|
+
useEffect88(() => {
|
|
50661
50632
|
if (!displayedQuote) {
|
|
50662
50633
|
if (latestQuote) {
|
|
50663
50634
|
setDisplayedQuote(latestQuote);
|
|
@@ -50697,7 +50668,7 @@ var useLightningQuote = ({
|
|
|
50697
50668
|
}
|
|
50698
50669
|
const btcPrice = await getAssetPriceInfoWithFallback2({
|
|
50699
50670
|
apiKey,
|
|
50700
|
-
chainId:
|
|
50671
|
+
chainId: bitcoinChain4.id.toString(),
|
|
50701
50672
|
assetTokenAddress: NATIVE_TOKEN,
|
|
50702
50673
|
logger
|
|
50703
50674
|
});
|
|
@@ -50890,12 +50861,12 @@ function LightningInvoice(props) {
|
|
|
50890
50861
|
isHidden: isLoading || !!error,
|
|
50891
50862
|
isPaused: isLoading || !!error
|
|
50892
50863
|
});
|
|
50893
|
-
|
|
50864
|
+
useEffect89(() => {
|
|
50894
50865
|
if (expiresAtMs !== void 0) {
|
|
50895
50866
|
restartCountdown();
|
|
50896
50867
|
}
|
|
50897
50868
|
}, [expiresAtMs, restartCountdown]);
|
|
50898
|
-
|
|
50869
|
+
useEffect89(() => {
|
|
50899
50870
|
if (checkoutItem?.id && displayedBolt11) {
|
|
50900
50871
|
registerQrPaymentTarget(checkoutItem.id, displayedBolt11);
|
|
50901
50872
|
}
|
|
@@ -50962,7 +50933,7 @@ function LightningInvoice(props) {
|
|
|
50962
50933
|
}
|
|
50963
50934
|
|
|
50964
50935
|
// src/modals/CheckoutModal/LoadingAccount.tsx
|
|
50965
|
-
import React297, { useEffect as
|
|
50936
|
+
import React297, { useEffect as useEffect91 } from "react";
|
|
50966
50937
|
|
|
50967
50938
|
// src/components/FunAsset/FunAssetLoading.tsx
|
|
50968
50939
|
import React291 from "react";
|
|
@@ -51202,10 +51173,10 @@ var CheckoutTopAnnouncementBanner = () => {
|
|
|
51202
51173
|
};
|
|
51203
51174
|
|
|
51204
51175
|
// src/hooks/usePaymentMethodTabs.ts
|
|
51205
|
-
import { useMemo as
|
|
51176
|
+
import { useMemo as useMemo71 } from "react";
|
|
51206
51177
|
|
|
51207
51178
|
// src/hooks/queries/useHasSavedFops.ts
|
|
51208
|
-
import { useEffect as
|
|
51179
|
+
import { useEffect as useEffect90, useState as useState88 } from "react";
|
|
51209
51180
|
function useHasSavedFops() {
|
|
51210
51181
|
const { userInfo } = useGeneralWallet();
|
|
51211
51182
|
const userId = userInfo.id;
|
|
@@ -51213,7 +51184,7 @@ function useHasSavedFops() {
|
|
|
51213
51184
|
() => !userId || userId === "0x" ? void 0 : readHasSavedFops(userId)
|
|
51214
51185
|
);
|
|
51215
51186
|
const { realQueryData: fops } = useFops();
|
|
51216
|
-
|
|
51187
|
+
useEffect90(() => {
|
|
51217
51188
|
if (!userId || userId === "0x") {
|
|
51218
51189
|
setHasSavedFops(void 0);
|
|
51219
51190
|
return;
|
|
@@ -51239,7 +51210,7 @@ function usePaymentMethodTabs({
|
|
|
51239
51210
|
);
|
|
51240
51211
|
const isWithdrawalTabEnabled = useDynamicConfig("enablecashierformfactor") && isCashier;
|
|
51241
51212
|
const defaultTab = isSavedCardDefaultsToFiatTabEnabled && hasSavedFops ? "fiat" : "crypto";
|
|
51242
|
-
const tabOrder =
|
|
51213
|
+
const tabOrder = useMemo71(() => {
|
|
51243
51214
|
const tabs2 = [];
|
|
51244
51215
|
if (defaultTab === "fiat") {
|
|
51245
51216
|
tabs2.push("fiat", "crypto");
|
|
@@ -51753,7 +51724,7 @@ function LoadingAccount({
|
|
|
51753
51724
|
const hasCustomStartingStep = !!checkoutConfig?.startingStep;
|
|
51754
51725
|
const startsOnConfirmationStep = checkoutConfig?.startingStep === "confirmation" /* CONFIRMATION */;
|
|
51755
51726
|
const startsOnSelectAssetStep = checkoutConfig?.startingStep === "select_asset" /* SELECT_ASSET */;
|
|
51756
|
-
|
|
51727
|
+
useEffect91(() => {
|
|
51757
51728
|
if (isLoadingFiat || !checkoutConfig) {
|
|
51758
51729
|
return;
|
|
51759
51730
|
}
|
|
@@ -51823,7 +51794,7 @@ function LoadingAccount({
|
|
|
51823
51794
|
|
|
51824
51795
|
// src/modals/CheckoutModal/MeldCurrencySelect/MeldCurrencySelect.tsx
|
|
51825
51796
|
import clsx26 from "clsx";
|
|
51826
|
-
import React298, { useMemo as
|
|
51797
|
+
import React298, { useMemo as useMemo72, useState as useState89 } from "react";
|
|
51827
51798
|
|
|
51828
51799
|
// src/modals/CheckoutModal/MeldCurrencySelect/currenciesWithMultipleCountries.ts
|
|
51829
51800
|
var currenciesWithMultipleCountries = {
|
|
@@ -51884,7 +51855,7 @@ function MeldCurrencySelect({
|
|
|
51884
51855
|
const [selectedCurrency, setSelectedCurrency] = useState89(
|
|
51885
51856
|
defaultCurrency
|
|
51886
51857
|
);
|
|
51887
|
-
const filteredOptions =
|
|
51858
|
+
const filteredOptions = useMemo72(() => {
|
|
51888
51859
|
const newOptions = data?.filter(
|
|
51889
51860
|
({ name, currencyCode }) => currencyCode.toLowerCase().includes(query.toLowerCase()) || name.toLowerCase().includes(query.toLowerCase())
|
|
51890
51861
|
) ?? [];
|
|
@@ -52086,15 +52057,15 @@ function MeldRedirect({
|
|
|
52086
52057
|
// src/modals/CheckoutModal/SelectAsset/SelectAsset.tsx
|
|
52087
52058
|
import { isTokenEquivalent as isTokenEquivalent15 } from "@funkit/utils";
|
|
52088
52059
|
import React304, {
|
|
52089
|
-
useEffect as
|
|
52060
|
+
useEffect as useEffect92,
|
|
52090
52061
|
useLayoutEffect as useLayoutEffect2,
|
|
52091
|
-
useMemo as
|
|
52062
|
+
useMemo as useMemo74,
|
|
52092
52063
|
useState as useState90
|
|
52093
52064
|
} from "react";
|
|
52094
52065
|
import { createPortal as createPortal21 } from "react-dom";
|
|
52095
52066
|
|
|
52096
52067
|
// src/hooks/useDynamicRoutes.ts
|
|
52097
|
-
import { useMemo as
|
|
52068
|
+
import { useMemo as useMemo73 } from "react";
|
|
52098
52069
|
import { DYNAMIC_ROUTES, initDynamicRouting } from "@funkit/fun-relay";
|
|
52099
52070
|
var toMutable = (obj) => {
|
|
52100
52071
|
return obj;
|
|
@@ -52104,7 +52075,7 @@ var useDynamicRoutes = (_dynamicRoutingId) => {
|
|
|
52104
52075
|
const { checkoutItem } = useCheckoutContext();
|
|
52105
52076
|
const config = checkoutItem?.initSettings.config;
|
|
52106
52077
|
const dynamicRoutingId = _dynamicRoutingId || config?.dynamicRoutingId;
|
|
52107
|
-
const findPath =
|
|
52078
|
+
const findPath = useMemo73(() => {
|
|
52108
52079
|
if (!dynamicRoutingId) {
|
|
52109
52080
|
return () => null;
|
|
52110
52081
|
}
|
|
@@ -52350,7 +52321,7 @@ function useEnrichedAccountHoldings({
|
|
|
52350
52321
|
const minTransferLimits = useDynamicConfig("mintokentransfervalue");
|
|
52351
52322
|
const isDynamicRoutingEnabled = useIsDynamicRoutingEnabled();
|
|
52352
52323
|
const isNadoDirectTransferSource = useIsNadoDirectTransferSource();
|
|
52353
|
-
const enrichedAccountHoldings =
|
|
52324
|
+
const enrichedAccountHoldings = useMemo74(() => {
|
|
52354
52325
|
if (!checkoutConfig) {
|
|
52355
52326
|
return [];
|
|
52356
52327
|
}
|
|
@@ -52413,7 +52384,7 @@ function useAssetOptions({
|
|
|
52413
52384
|
const { t } = useFunkitTranslation();
|
|
52414
52385
|
const { findPath } = useDynamicRoutes();
|
|
52415
52386
|
const isNadoDirectTransferSource = useIsNadoDirectTransferSource();
|
|
52416
|
-
const assetOptions =
|
|
52387
|
+
const assetOptions = useMemo74(() => {
|
|
52417
52388
|
return enrichedAccountHoldings.map(({ asset, usableForCheckout }) => {
|
|
52418
52389
|
const { isUsable, reason } = usableForCheckout;
|
|
52419
52390
|
const isKnown = isKnownAsset2(asset);
|
|
@@ -52496,7 +52467,7 @@ function getDefaultChainTokenSymbol(assetOptions, selectedSourceAssetInfo) {
|
|
|
52496
52467
|
}
|
|
52497
52468
|
function useScrollToSelectedAsset(selectedChainTokenSymbol) {
|
|
52498
52469
|
const rootNode = useRootNode();
|
|
52499
|
-
|
|
52470
|
+
useEffect92(() => {
|
|
52500
52471
|
const optionEl = rootNode.getElementById(
|
|
52501
52472
|
`option-${selectedChainTokenSymbol}`
|
|
52502
52473
|
);
|
|
@@ -52538,7 +52509,7 @@ function AccountSelectAsset({
|
|
|
52538
52509
|
const { setSelectedBrokerageAsset } = useFunkitBrokerageContext();
|
|
52539
52510
|
const [explicitlySelectedChainTokenSymbol, setSelectedChainTokenSymbol] = useState90("");
|
|
52540
52511
|
const checkoutConfig = checkoutItem?.initSettings.config;
|
|
52541
|
-
const defaultTargetAsset =
|
|
52512
|
+
const defaultTargetAsset = useMemo74(
|
|
52542
52513
|
() => getDefaultDynamicTargetAsset(checkoutConfig),
|
|
52543
52514
|
[checkoutConfig]
|
|
52544
52515
|
);
|
|
@@ -52644,11 +52615,11 @@ function AccountSelectAsset({
|
|
|
52644
52615
|
onFinish();
|
|
52645
52616
|
});
|
|
52646
52617
|
const selectedSourceAssetInfo = checkoutItem?.selectedSourceAssetInfo;
|
|
52647
|
-
const defaultSelectedChainTokenSymbol =
|
|
52618
|
+
const defaultSelectedChainTokenSymbol = useMemo74(
|
|
52648
52619
|
() => getDefaultChainTokenSymbol(assetOptions, selectedSourceAssetInfo),
|
|
52649
52620
|
[assetOptions, selectedSourceAssetInfo]
|
|
52650
52621
|
);
|
|
52651
|
-
const selectedChainTokenSymbol =
|
|
52622
|
+
const selectedChainTokenSymbol = useMemo74(() => {
|
|
52652
52623
|
if (explicitlySelectedChainTokenSymbol) {
|
|
52653
52624
|
const assetExists = assetOptions.some(
|
|
52654
52625
|
({ asset }) => asset.chainSymbolKey === explicitlySelectedChainTokenSymbol
|
|
@@ -52682,7 +52653,7 @@ function AccountSelectAsset({
|
|
|
52682
52653
|
const isDisabled = isAssetsEmpty || !selectedChainTokenSymbol || isLoading;
|
|
52683
52654
|
const onBalanceTopUpSwitch = checkoutItem?.initSettings.onBalanceTopUpSwitch;
|
|
52684
52655
|
const checkoutId = checkoutItem?.id;
|
|
52685
|
-
|
|
52656
|
+
useEffect92(() => {
|
|
52686
52657
|
if (checkoutId && !isLoading) {
|
|
52687
52658
|
logMeasuredEvent({
|
|
52688
52659
|
eventName: "fc::ready::select_asset" /* READY_SELECT_ASSET */,
|
|
@@ -52810,7 +52781,7 @@ import {
|
|
|
52810
52781
|
resolveWithdrawalSourceTokenBalance as resolveWithdrawalSourceTokenBalance4
|
|
52811
52782
|
} from "@funkit/connect-core";
|
|
52812
52783
|
import { isTokenEquivalent as isTokenEquivalent16, noop as noop6 } from "@funkit/utils";
|
|
52813
|
-
import React313, { useEffect as
|
|
52784
|
+
import React313, { useEffect as useEffect95, useMemo as useMemo75, useRef as useRef58, useState as useState91 } from "react";
|
|
52814
52785
|
import { createPortal as createPortal22 } from "react-dom";
|
|
52815
52786
|
|
|
52816
52787
|
// src/components/Dropdown/ReceiveTokenDropdown.tsx
|
|
@@ -52923,13 +52894,13 @@ function useIsUserUnderComplianceReview() {
|
|
|
52923
52894
|
}
|
|
52924
52895
|
|
|
52925
52896
|
// src/modals/CheckoutModal/SourceChange/ComplianceReviewBanner.tsx
|
|
52926
|
-
import React306, { useEffect as
|
|
52897
|
+
import React306, { useEffect as useEffect93 } from "react";
|
|
52927
52898
|
function ComplianceReviewBanner({
|
|
52928
52899
|
checkoutId
|
|
52929
52900
|
}) {
|
|
52930
52901
|
const { t } = useFunkitTranslation();
|
|
52931
52902
|
const { logEvent } = useTrack();
|
|
52932
|
-
|
|
52903
|
+
useEffect93(() => {
|
|
52933
52904
|
logEvent({
|
|
52934
52905
|
eventName: "fc::compliance_review::banner_shown" /* COMPLIANCE_REVIEW_BANNER_SHOWN */,
|
|
52935
52906
|
metadata: { checkoutId }
|
|
@@ -53267,7 +53238,7 @@ function useStartBitcoinLightning() {
|
|
|
53267
53238
|
}
|
|
53268
53239
|
|
|
53269
53240
|
// src/modals/CheckoutModal/SourceChange/useTrackSourceChangeEvents.ts
|
|
53270
|
-
import { useEffect as
|
|
53241
|
+
import { useEffect as useEffect94, useRef as useRef57 } from "react";
|
|
53271
53242
|
function useTrackSourceChangeEvents({
|
|
53272
53243
|
tab
|
|
53273
53244
|
}) {
|
|
@@ -53299,7 +53270,7 @@ function useTrackSourceChangeEvents({
|
|
|
53299
53270
|
}));
|
|
53300
53271
|
});
|
|
53301
53272
|
const checkoutId = checkoutItem?.id;
|
|
53302
|
-
|
|
53273
|
+
useEffect94(() => {
|
|
53303
53274
|
if (checkoutId && claimAnalyticsEvent("fc_modal_opened" /* MODAL_OPENED */, checkoutId)) {
|
|
53304
53275
|
trackModalOpened();
|
|
53305
53276
|
}
|
|
@@ -53495,7 +53466,7 @@ function SourceChange({
|
|
|
53495
53466
|
const { isUnifiedTradingMode: isLighterUnifiedAccount } = useLighterAccounts({
|
|
53496
53467
|
address: walletAddress
|
|
53497
53468
|
});
|
|
53498
|
-
const dynamicTargetAssets =
|
|
53469
|
+
const dynamicTargetAssets = useMemo75(() => {
|
|
53499
53470
|
const candidates = checkoutConfig?.dynamicTargetAssetCandidates;
|
|
53500
53471
|
if (!candidates || !isLighterUnifiedAccount) {
|
|
53501
53472
|
return candidates;
|
|
@@ -53558,7 +53529,7 @@ function SourceChange({
|
|
|
53558
53529
|
});
|
|
53559
53530
|
}
|
|
53560
53531
|
const [connectedSource, setConnectedSource] = useState91(paymentMethodInfo);
|
|
53561
|
-
const syntheticFops =
|
|
53532
|
+
const syntheticFops = useMemo75(
|
|
53562
53533
|
() => isCashAppLightningEnabled ? [createSyntheticFop(PaymentMethod.CASH_APP_LIGHTNING)] : [],
|
|
53563
53534
|
[isCashAppLightningEnabled]
|
|
53564
53535
|
);
|
|
@@ -53583,7 +53554,7 @@ function SourceChange({
|
|
|
53583
53554
|
const { trackTabSwitched } = useTrackSourceChangeEvents({
|
|
53584
53555
|
tab: paymentMethodTab
|
|
53585
53556
|
});
|
|
53586
|
-
const nativeHolding =
|
|
53557
|
+
const nativeHolding = useMemo75(() => {
|
|
53587
53558
|
if (!checkoutConfig || !walletHoldings || !isCustomerNativeFastPathEnabled(apiKey)) {
|
|
53588
53559
|
return void 0;
|
|
53589
53560
|
}
|
|
@@ -53597,7 +53568,7 @@ function SourceChange({
|
|
|
53597
53568
|
);
|
|
53598
53569
|
return holding && holding.usdAmount != null && holding.usdAmount > 0 ? holding : void 0;
|
|
53599
53570
|
}, [apiKey, walletHoldings, checkoutConfig]);
|
|
53600
|
-
const connectedWallet =
|
|
53571
|
+
const connectedWallet = useMemo75(
|
|
53601
53572
|
() => preferred.find(
|
|
53602
53573
|
(s) => isConnectablePaymentMethodInfo(s) && s.paymentMethod === PaymentMethod.ACCOUNT_BALANCE
|
|
53603
53574
|
),
|
|
@@ -53608,7 +53579,7 @@ function SourceChange({
|
|
|
53608
53579
|
const showTagline = useDynamicConfig("showpoweredtagline");
|
|
53609
53580
|
const hasBottomBar = showTagline || !isAutoContinue || bottomBarCloseButtonConfig.enabled;
|
|
53610
53581
|
useSwappedPreload(fopsData?.data, "deposit");
|
|
53611
|
-
|
|
53582
|
+
useEffect95(() => {
|
|
53612
53583
|
const nextWithdrawalConfig = shouldSeedSourceChangeWithdrawalConfig ? resolvedWithdrawalConfig : void 0;
|
|
53613
53584
|
setModalState((state) => {
|
|
53614
53585
|
if (state.withdrawalConfig === nextWithdrawalConfig) {
|
|
@@ -53624,7 +53595,7 @@ function SourceChange({
|
|
|
53624
53595
|
setModalState,
|
|
53625
53596
|
shouldSeedSourceChangeWithdrawalConfig
|
|
53626
53597
|
]);
|
|
53627
|
-
|
|
53598
|
+
useEffect95(() => {
|
|
53628
53599
|
if (!paymentMethodInfo) {
|
|
53629
53600
|
return;
|
|
53630
53601
|
}
|
|
@@ -53752,7 +53723,7 @@ function SourceChange({
|
|
|
53752
53723
|
)
|
|
53753
53724
|
);
|
|
53754
53725
|
});
|
|
53755
|
-
|
|
53726
|
+
useEffect95(() => {
|
|
53756
53727
|
sendPaymentMethodTabEvent(paymentMethodTab);
|
|
53757
53728
|
}, [paymentMethodTab]);
|
|
53758
53729
|
const analyticsTab = isSwappedEnabled ? paymentMethodTab : null;
|
|
@@ -54190,7 +54161,7 @@ function trackEventForTabChange(checkoutItem, tab) {
|
|
|
54190
54161
|
|
|
54191
54162
|
// src/modals/CheckoutModal/SwappedIframe/SwappedIframeController.tsx
|
|
54192
54163
|
import { useQueryClient as useQueryClient6 } from "@tanstack/react-query";
|
|
54193
|
-
import React314, { useEffect as
|
|
54164
|
+
import React314, { useEffect as useEffect96, useRef as useRef59 } from "react";
|
|
54194
54165
|
import { createPortal as createPortal23 } from "react-dom";
|
|
54195
54166
|
var SwappedIframeInfo = {
|
|
54196
54167
|
Component: SwappedIframeController,
|
|
@@ -54245,10 +54216,10 @@ function SwappedIframeController({
|
|
|
54245
54216
|
metadata: {}
|
|
54246
54217
|
});
|
|
54247
54218
|
});
|
|
54248
|
-
|
|
54219
|
+
useEffect96(() => {
|
|
54249
54220
|
startMeasuredEvent("fc::ready::swapped_iframe" /* READY_SWAPPED_IFRAME */);
|
|
54250
54221
|
}, [startMeasuredEvent]);
|
|
54251
|
-
|
|
54222
|
+
useEffect96(() => {
|
|
54252
54223
|
if (isSwappedReady) {
|
|
54253
54224
|
const event = getTrackEvent("fc::ready::swapped_iframe" /* READY_SWAPPED_IFRAME */);
|
|
54254
54225
|
logger.info("swapped-iframe:ready", event.metadata);
|
|
@@ -54413,7 +54384,7 @@ function SwappedIframeController({
|
|
|
54413
54384
|
}
|
|
54414
54385
|
}
|
|
54415
54386
|
}
|
|
54416
|
-
|
|
54387
|
+
useEffect96(() => {
|
|
54417
54388
|
return swappedTransport.onMessage(handleSwappedMessage);
|
|
54418
54389
|
}, [swappedTransport]);
|
|
54419
54390
|
useSwappedIframeLifecycle({
|
|
@@ -54770,7 +54741,7 @@ var TransferTokenDetails = ({
|
|
|
54770
54741
|
};
|
|
54771
54742
|
|
|
54772
54743
|
// src/modals/CheckoutModal/TransferToken/TransferToken.tsx
|
|
54773
|
-
import { bitcoinChain as
|
|
54744
|
+
import { bitcoinChain as bitcoinChain5, lightningChain as lightningChain7 } from "@funkit/chains";
|
|
54774
54745
|
var TransferTokenInfo = {
|
|
54775
54746
|
Component: TransferToken,
|
|
54776
54747
|
disableBack: ({ isSourceNavWidgetEnabled }) => isSourceNavWidgetEnabled,
|
|
@@ -54838,7 +54809,7 @@ function TransferToken({
|
|
|
54838
54809
|
transferInit
|
|
54839
54810
|
});
|
|
54840
54811
|
const dropdownAssets = isLightningEnabled ? { ...assets, [lightningChain7.id]: ["BTC"] } : assets;
|
|
54841
|
-
const dropdownChainIds = isLightningEnabled ? insertChainIdAfter(chainIdSortOrder, lightningChain7.id,
|
|
54812
|
+
const dropdownChainIds = isLightningEnabled ? insertChainIdAfter(chainIdSortOrder, lightningChain7.id, bitcoinChain5.id) : chainIdSortOrder;
|
|
54842
54813
|
const { addressBySymbolByChainId } = useTokenTransferConfig(false);
|
|
54843
54814
|
const { trackDepositAssetSelected, trackDepositMethodSelected } = useDepositAnalytics();
|
|
54844
54815
|
const trackTokenTransferAssetSelected = (source) => {
|
|
@@ -54974,8 +54945,8 @@ function TransferToken({
|
|
|
54974
54945
|
}
|
|
54975
54946
|
function getSelectionOverride() {
|
|
54976
54947
|
const sourceAsset = checkoutItem?.selectedSourceAssetInfo;
|
|
54977
|
-
if (sourceAsset?.symbol === "BTC" && sourceAsset.chainId === String(lightningChain7.id) && enabledChainSymbols[
|
|
54978
|
-
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 };
|
|
54979
54950
|
}
|
|
54980
54951
|
return transferToken ? void 0 : savedSelection;
|
|
54981
54952
|
}
|
|
@@ -55576,7 +55547,7 @@ var FiatAccountDetail = {
|
|
|
55576
55547
|
|
|
55577
55548
|
// src/modals/CheckoutModal/VirtualFiatAccount/KycIframe.tsx
|
|
55578
55549
|
import { BridgeCustomerStatus as BridgeCustomerStatus7 } from "@funkit/api-base";
|
|
55579
|
-
import React327, { useCallback as useCallback71, useEffect as
|
|
55550
|
+
import React327, { useCallback as useCallback71, useEffect as useEffect97, useMemo as useMemo76, useState as useState94 } from "react";
|
|
55580
55551
|
function useIframeListener(listeners, expectedOrigin) {
|
|
55581
55552
|
const handleMessage = useCallback71(
|
|
55582
55553
|
(event) => {
|
|
@@ -55603,7 +55574,7 @@ function useIframeListener(listeners, expectedOrigin) {
|
|
|
55603
55574
|
},
|
|
55604
55575
|
[listeners, expectedOrigin]
|
|
55605
55576
|
);
|
|
55606
|
-
|
|
55577
|
+
useEffect97(() => {
|
|
55607
55578
|
window.addEventListener("message", handleMessage);
|
|
55608
55579
|
return () => {
|
|
55609
55580
|
window.removeEventListener("message", handleMessage);
|
|
@@ -55633,14 +55604,14 @@ function KycIframe({
|
|
|
55633
55604
|
const { clearVirtualFiatAccounts } = useClearFrogAccountsCache();
|
|
55634
55605
|
const { data: kycLink, isLoading: isLinkLoading } = useLoadKycLink(modalState);
|
|
55635
55606
|
const [iframeLoading, setIframeLoading] = useState94(true);
|
|
55636
|
-
const kycOrigin =
|
|
55607
|
+
const kycOrigin = useMemo76(() => {
|
|
55637
55608
|
try {
|
|
55638
55609
|
return kycLink ? new URL(kycLink).origin : null;
|
|
55639
55610
|
} catch {
|
|
55640
55611
|
return null;
|
|
55641
55612
|
}
|
|
55642
55613
|
}, [kycLink]);
|
|
55643
|
-
const listeners =
|
|
55614
|
+
const listeners = useMemo76(
|
|
55644
55615
|
() => ({
|
|
55645
55616
|
load: () => {
|
|
55646
55617
|
logger.info("KYC iframe loaded");
|
|
@@ -55922,7 +55893,7 @@ function useCheckoutModalTransition(checkoutItem, onClose) {
|
|
|
55922
55893
|
ensureStepQueries(modalState.step);
|
|
55923
55894
|
}
|
|
55924
55895
|
});
|
|
55925
|
-
|
|
55896
|
+
useEffect98(() => {
|
|
55926
55897
|
ensureLoadingAccountScreen();
|
|
55927
55898
|
}, []);
|
|
55928
55899
|
const trackNextState = useCallback72(
|
|
@@ -56174,7 +56145,7 @@ function useTitleConfig(checkoutItem, state) {
|
|
|
56174
56145
|
}
|
|
56175
56146
|
|
|
56176
56147
|
// src/modals/CheckoutModal/useCheckoutBlocked.ts
|
|
56177
|
-
import { useEffect as
|
|
56148
|
+
import { useEffect as useEffect99 } from "react";
|
|
56178
56149
|
var geoblockedViewableSteps = /* @__PURE__ */ new Set([
|
|
56179
56150
|
"loading_account" /* LOADING_ACCOUNT */,
|
|
56180
56151
|
"source_change" /* SOURCE_CHANGE */
|
|
@@ -56212,7 +56183,7 @@ function useCheckoutBlocked(params) {
|
|
|
56212
56183
|
params.onCheckoutBlocked?.({ blockedReason: reason });
|
|
56213
56184
|
}
|
|
56214
56185
|
);
|
|
56215
|
-
|
|
56186
|
+
useEffect99(() => {
|
|
56216
56187
|
if (blockedReason) {
|
|
56217
56188
|
onCheckoutBlockedEvent(blockedReason);
|
|
56218
56189
|
}
|
|
@@ -56318,7 +56289,7 @@ function FunCheckoutModalInner({
|
|
|
56318
56289
|
setModalState
|
|
56319
56290
|
};
|
|
56320
56291
|
const connectionStatus = useConnectionStatus();
|
|
56321
|
-
|
|
56292
|
+
useEffect100(() => {
|
|
56322
56293
|
if (!modalState.showWalletOptions) {
|
|
56323
56294
|
return;
|
|
56324
56295
|
}
|
|
@@ -56355,6 +56326,9 @@ function FunCheckoutModalInner({
|
|
|
56355
56326
|
const resolvedHeaderTabs = useCheckoutHeaderTabsState(modalState);
|
|
56356
56327
|
const headerTabs = showBlockedUI ? void 0 : resolvedHeaderTabs;
|
|
56357
56328
|
const perpsTitleMeta = usePerpsTitleMeta(checkoutItem.initSettings.config);
|
|
56329
|
+
const swappedBuyingCrypto = useSwappedBuyingCrypto(
|
|
56330
|
+
checkoutItem.initSettings.config
|
|
56331
|
+
);
|
|
56358
56332
|
const getTitleMeta = () => {
|
|
56359
56333
|
if (!!headerTabs || HIDE_MODAL_META_TITLE_AND_DIVIDER.includes(modalState.step)) {
|
|
56360
56334
|
return void 0;
|
|
@@ -56412,7 +56386,7 @@ function FunCheckoutModalInner({
|
|
|
56412
56386
|
backgroundOverlay: successScreenBackgroundOverlay,
|
|
56413
56387
|
withoutBorder: modalState.step === "swapped_iframe" /* SWAPPED_IFRAME */ && !modalState.error
|
|
56414
56388
|
},
|
|
56415
|
-
/* @__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(
|
|
56416
56390
|
FunCheckoutModalHeightAnimationWrapper,
|
|
56417
56391
|
{
|
|
56418
56392
|
checkoutConfig,
|
|
@@ -56534,7 +56508,7 @@ function useModalStateValue() {
|
|
|
56534
56508
|
openModal: useCallback73(() => setModalOpen(true), [])
|
|
56535
56509
|
};
|
|
56536
56510
|
}
|
|
56537
|
-
var ModalContext =
|
|
56511
|
+
var ModalContext = createContext22({
|
|
56538
56512
|
accountModalOpen: false,
|
|
56539
56513
|
chainModalOpen: false,
|
|
56540
56514
|
connectModalOpen: false,
|
|
@@ -56608,7 +56582,7 @@ function ModalProvider({ children }) {
|
|
|
56608
56582
|
onConnect: () => closeModals(isUnauthenticated),
|
|
56609
56583
|
onDisconnect: closeModals
|
|
56610
56584
|
});
|
|
56611
|
-
|
|
56585
|
+
useEffect101(() => {
|
|
56612
56586
|
if (isUnauthenticated) {
|
|
56613
56587
|
closeModals();
|
|
56614
56588
|
}
|
|
@@ -56616,7 +56590,7 @@ function ModalProvider({ children }) {
|
|
|
56616
56590
|
return /* @__PURE__ */ React332.createElement(
|
|
56617
56591
|
ModalContext.Provider,
|
|
56618
56592
|
{
|
|
56619
|
-
value:
|
|
56593
|
+
value: useMemo77(
|
|
56620
56594
|
() => ({
|
|
56621
56595
|
accountModalOpen,
|
|
56622
56596
|
accountModalTab,
|
|
@@ -56690,7 +56664,7 @@ function ModalProvider({ children }) {
|
|
|
56690
56664
|
);
|
|
56691
56665
|
}
|
|
56692
56666
|
function useModalState() {
|
|
56693
|
-
const { accountModalOpen, chainModalOpen, connectModalOpen } =
|
|
56667
|
+
const { accountModalOpen, chainModalOpen, connectModalOpen } = useContext22(ModalContext);
|
|
56694
56668
|
return {
|
|
56695
56669
|
accountModalOpen,
|
|
56696
56670
|
chainModalOpen,
|
|
@@ -56698,22 +56672,22 @@ function useModalState() {
|
|
|
56698
56672
|
};
|
|
56699
56673
|
}
|
|
56700
56674
|
function useAccountModal() {
|
|
56701
|
-
const { accountModalOpen, openAccountModal } =
|
|
56675
|
+
const { accountModalOpen, openAccountModal } = useContext22(ModalContext);
|
|
56702
56676
|
return { accountModalOpen, openAccountModal };
|
|
56703
56677
|
}
|
|
56704
56678
|
function useChainModal() {
|
|
56705
|
-
const { chainModalOpen, openChainModal } =
|
|
56679
|
+
const { chainModalOpen, openChainModal } = useContext22(ModalContext);
|
|
56706
56680
|
return { chainModalOpen, openChainModal };
|
|
56707
56681
|
}
|
|
56708
56682
|
function useWalletConnectOpenState() {
|
|
56709
|
-
const { isWalletConnectModalOpen, setIsWalletConnectModalOpen } =
|
|
56683
|
+
const { isWalletConnectModalOpen, setIsWalletConnectModalOpen } = useContext22(ModalContext);
|
|
56710
56684
|
return { isWalletConnectModalOpen, setIsWalletConnectModalOpen };
|
|
56711
56685
|
}
|
|
56712
56686
|
function useConnectModal(onClose) {
|
|
56713
|
-
const { connectModalOpen, openConnectModal } =
|
|
56687
|
+
const { connectModalOpen, openConnectModal } = useContext22(ModalContext);
|
|
56714
56688
|
const { isWalletConnectModalOpen } = useWalletConnectOpenState();
|
|
56715
56689
|
const effectiveConnectModalOpen = connectModalOpen || isWalletConnectModalOpen;
|
|
56716
|
-
|
|
56690
|
+
useEffect101(() => {
|
|
56717
56691
|
if (!effectiveConnectModalOpen && onClose) {
|
|
56718
56692
|
onClose();
|
|
56719
56693
|
}
|
|
@@ -56724,11 +56698,11 @@ function useConnectModal(onClose) {
|
|
|
56724
56698
|
};
|
|
56725
56699
|
}
|
|
56726
56700
|
function useFunCheckoutModal() {
|
|
56727
|
-
const { funCheckoutModalOpen, openFunCheckoutModal } =
|
|
56701
|
+
const { funCheckoutModalOpen, openFunCheckoutModal } = useContext22(ModalContext);
|
|
56728
56702
|
return { funCheckoutModalOpen, openFunCheckoutModal };
|
|
56729
56703
|
}
|
|
56730
56704
|
function useWithdrawalModal() {
|
|
56731
|
-
const { openWithdrawalModal } =
|
|
56705
|
+
const { openWithdrawalModal } = useContext22(ModalContext);
|
|
56732
56706
|
return { openWithdrawalModal };
|
|
56733
56707
|
}
|
|
56734
56708
|
function useSoftHiddenCheckout() {
|
|
@@ -56737,7 +56711,7 @@ function useSoftHiddenCheckout() {
|
|
|
56737
56711
|
softHideFunCheckoutModal,
|
|
56738
56712
|
resumeSoftHiddenCheckout,
|
|
56739
56713
|
discardSoftHiddenCheckout
|
|
56740
|
-
} =
|
|
56714
|
+
} = useContext22(ModalContext);
|
|
56741
56715
|
return {
|
|
56742
56716
|
hasSoftHiddenCheckout: !!softHiddenCheckoutId,
|
|
56743
56717
|
softHiddenCheckoutId,
|
|
@@ -57027,7 +57001,7 @@ function ConnectButton({
|
|
|
57027
57001
|
const connectionStatus = useConnectionStatus();
|
|
57028
57002
|
const { setShowBalance } = useShowBalance();
|
|
57029
57003
|
const [ready, setReady] = useState97(false);
|
|
57030
|
-
|
|
57004
|
+
useEffect102(() => {
|
|
57031
57005
|
setShowBalance(showBalance);
|
|
57032
57006
|
if (!ready) {
|
|
57033
57007
|
setReady(true);
|
|
@@ -57615,12 +57589,12 @@ function createConnectedWithdrawalClient(config, ownerAddress, sourceChainId) {
|
|
|
57615
57589
|
}
|
|
57616
57590
|
|
|
57617
57591
|
// src/wallets/solanaWithdrawal.ts
|
|
57618
|
-
import { solanaChain as
|
|
57592
|
+
import { solanaChain as solanaChain7 } from "@funkit/chains";
|
|
57619
57593
|
import { toValidatedSolanaAddress as toValidatedSolanaAddress2, useLogOnce as useLogOnce6 } from "@funkit/connect-core";
|
|
57620
57594
|
import {
|
|
57621
57595
|
createSolanaWithdrawalClient
|
|
57622
57596
|
} from "@funkit/connect-core/clients/solana";
|
|
57623
|
-
import { useMemo as
|
|
57597
|
+
import { useMemo as useMemo78 } from "react";
|
|
57624
57598
|
function useSolanaWithdrawalConfig(params) {
|
|
57625
57599
|
const signer = params?.signer;
|
|
57626
57600
|
const address = toValidatedSolanaAddress2(signer?.address);
|
|
@@ -57632,7 +57606,7 @@ function useSolanaWithdrawalConfig(params) {
|
|
|
57632
57606
|
});
|
|
57633
57607
|
}
|
|
57634
57608
|
);
|
|
57635
|
-
return
|
|
57609
|
+
return useMemo78(() => {
|
|
57636
57610
|
if (!params || !signer || !address) {
|
|
57637
57611
|
return null;
|
|
57638
57612
|
}
|
|
@@ -57641,7 +57615,7 @@ function useSolanaWithdrawalConfig(params) {
|
|
|
57641
57615
|
...rest,
|
|
57642
57616
|
// TODO: Cast until #6751 widens the source address type.
|
|
57643
57617
|
sourceTokenAddress,
|
|
57644
|
-
sourceChainId: String(
|
|
57618
|
+
sourceChainId: String(solanaChain7.id),
|
|
57645
57619
|
wallet: createSolanaWithdrawalClient(
|
|
57646
57620
|
signer,
|
|
57647
57621
|
logger
|
|
@@ -57656,7 +57630,7 @@ import { useLogOnce as useLogOnce7 } from "@funkit/connect-core";
|
|
|
57656
57630
|
import {
|
|
57657
57631
|
createHypercoreAdaptedWallet as createHypercoreAdaptedWallet2
|
|
57658
57632
|
} from "@funkit/connect-core/clients/hypercore";
|
|
57659
|
-
import { useMemo as
|
|
57633
|
+
import { useMemo as useMemo79 } from "react";
|
|
57660
57634
|
import { getAddress as getAddress5, isAddress as isAddress4 } from "viem";
|
|
57661
57635
|
function unsupported(member) {
|
|
57662
57636
|
throw new Error(`HypercoreWithdrawalClient does not support ${member}`);
|
|
@@ -57685,7 +57659,7 @@ function useHypercoreWithdrawalConfig(options) {
|
|
|
57685
57659
|
});
|
|
57686
57660
|
}
|
|
57687
57661
|
);
|
|
57688
|
-
return
|
|
57662
|
+
return useMemo79(() => {
|
|
57689
57663
|
if (!options || !signer || !address) {
|
|
57690
57664
|
return null;
|
|
57691
57665
|
}
|