@funkit/connect 5.5.6 → 5.5.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -0
- package/dist/components/Dialog/Dialog.d.ts +5 -3
- package/dist/components/Dialog/DialogContent.css.d.ts +2 -1
- package/dist/domains/fees.d.ts +2 -0
- package/dist/hooks/queries/useMeldLimits.d.ts +158 -2
- package/dist/hooks/useCheckoutDirectExecution.d.ts +3 -1
- package/dist/hooks/useReceiveAmountLabel.d.ts +2 -2
- package/dist/index.css +19 -17
- package/dist/index.js +568 -391
- package/dist/modals/CheckoutModal/InputAmount/QuickOptions.d.ts +6 -3
- package/dist/modals/CheckoutModal/InputAmount/state.d.ts +19 -17
- package/dist/modals/CheckoutModal/InputAmount/useAmountInput.d.ts +2 -2
- package/dist/modals/CheckoutModal/InputAmount/utils.d.ts +1 -0
- package/dist/modals/CheckoutModal/MeldCurrencySelect/MeldCurrencySelect.d.ts +0 -2
- package/dist/utils/flags/config.d.ts +9 -1
- package/dist/wallets/walletConnectors/index.js +47 -47
- package/package.json +13 -17
package/dist/index.js
CHANGED
|
@@ -12,18 +12,19 @@ import {
|
|
|
12
12
|
// src/components/Dialog/DialogContent.css.ts
|
|
13
13
|
var BASE_DIALOG_PADDING = "6";
|
|
14
14
|
var SCROLL_BAR_WIDTH = 6;
|
|
15
|
-
var contentCollapsed = "
|
|
16
|
-
var contentExpanded = "
|
|
15
|
+
var contentCollapsed = "_1pzt423f";
|
|
16
|
+
var contentExpanded = "_1pzt423e";
|
|
17
17
|
var dialog = "_1pzt4231 _1rsrm2fjf _1rsrm2fzx _1rsrm2fw _1rsrm2f1b _1rsrm2f1f _1rsrm2f1cx _1rsrm2fa _1rsrm2f1p _1rsrm2fbs _1rsrm2fev _1rsrm2fca _1rsrm2fdh _1rsrm2fcq";
|
|
18
18
|
var dialogCompact = "_1pzt4232 _1pzt4231 _1rsrm2fjf _1rsrm2fzx _1rsrm2fw _1rsrm2f1b _1rsrm2f1f _1rsrm2f1cx _1rsrm2fa _1rsrm2f1p _1rsrm2fbs _1rsrm2fev _1rsrm2fca _1rsrm2fdh _1rsrm2fcq";
|
|
19
19
|
var dialogMedium = "_1pzt4233 _1pzt4231 _1rsrm2fjf _1rsrm2fzx _1rsrm2fw _1rsrm2f1b _1rsrm2f1f _1rsrm2f1cx _1rsrm2fa _1rsrm2f1p _1rsrm2fbs _1rsrm2fev _1rsrm2fca _1rsrm2fdh _1rsrm2fcq";
|
|
20
|
-
var dialogMobile = "
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
20
|
+
var dialogMobile = "_1pzt4237 _1rsrm2fx _1rsrm2f1f";
|
|
21
|
+
var dividerTransition = "_1pzt423d";
|
|
22
|
+
var fullHeightContent = "_1pzt423b";
|
|
23
|
+
var noPaddingContent = "_1pzt423c";
|
|
24
|
+
var scrollContent = "_1pzt4239 _1rsrm2fg0";
|
|
25
|
+
var scrollbarHidden = "_1pzt423a";
|
|
26
|
+
var withoutBottomPadding = "_1pzt4235";
|
|
27
|
+
var withoutSidePadding = "_1pzt4234";
|
|
27
28
|
|
|
28
29
|
// src/modals/DevTest/DevEmbed.tsx
|
|
29
30
|
import React2 from "react";
|
|
@@ -509,7 +510,7 @@ import React256, {
|
|
|
509
510
|
useCallback as useCallback47,
|
|
510
511
|
useContext as useContext18,
|
|
511
512
|
useEffect as useEffect48,
|
|
512
|
-
useMemo as
|
|
513
|
+
useMemo as useMemo43,
|
|
513
514
|
useState as useState67
|
|
514
515
|
} from "react";
|
|
515
516
|
import { useConfig as useConfig5, useConnect as useConnect2, useDisconnect as useDisconnect2 } from "wagmi";
|
|
@@ -1031,7 +1032,7 @@ import React255, {
|
|
|
1031
1032
|
useCallback as useCallback46,
|
|
1032
1033
|
useContext as useContext17,
|
|
1033
1034
|
useEffect as useEffect47,
|
|
1034
|
-
useMemo as
|
|
1035
|
+
useMemo as useMemo42,
|
|
1035
1036
|
useState as useState66
|
|
1036
1037
|
} from "react";
|
|
1037
1038
|
import { useAccount as useAccount9, useAccountEffect as useAccountEffect2, useConfig as useConfig4 } from "wagmi";
|
|
@@ -3237,7 +3238,7 @@ var flagConfig = {
|
|
|
3237
3238
|
{
|
|
3238
3239
|
key: "userId",
|
|
3239
3240
|
type: "pctRollout",
|
|
3240
|
-
pct:
|
|
3241
|
+
pct: 50
|
|
3241
3242
|
},
|
|
3242
3243
|
{
|
|
3243
3244
|
key: "apiKey",
|
|
@@ -3603,8 +3604,12 @@ var flagConfig = {
|
|
|
3603
3604
|
"0x2A8Bd916E85d98d8175258De99fc0ddbcC102eF6",
|
|
3604
3605
|
"0xda6b07Eb94f699F511a943e9bFC12B64B7fe3486",
|
|
3605
3606
|
"0x0D6e43CA32545B3dc2FE6f93AafBD7e640F548d4",
|
|
3606
|
-
"0x236c60C57a8B9ca563Fb0dA5199FDdCB686d91E8"
|
|
3607
|
+
"0x236c60C57a8B9ca563Fb0dA5199FDdCB686d91E8",
|
|
3607
3608
|
// greg
|
|
3609
|
+
"0x4a1457fa2845bAfE8D3909cA3C5ac6107be312Dd",
|
|
3610
|
+
// william PM
|
|
3611
|
+
"0xfCB8B2d294eD7373B3B590dd7C0CBC430d41a9a0"
|
|
3612
|
+
// Arun from Meld
|
|
3608
3613
|
]
|
|
3609
3614
|
}
|
|
3610
3615
|
],
|
|
@@ -3623,7 +3628,13 @@ var flagConfig = {
|
|
|
3623
3628
|
values: [POLYMARKET_API_KEY2]
|
|
3624
3629
|
}
|
|
3625
3630
|
],
|
|
3626
|
-
if_any: [
|
|
3631
|
+
if_any: [
|
|
3632
|
+
{
|
|
3633
|
+
key: "userId",
|
|
3634
|
+
type: "pctRollout",
|
|
3635
|
+
pct: 0
|
|
3636
|
+
}
|
|
3637
|
+
],
|
|
3627
3638
|
value: true
|
|
3628
3639
|
},
|
|
3629
3640
|
{
|
|
@@ -3657,6 +3668,14 @@ var flagConfig = {
|
|
|
3657
3668
|
PLN: [370, 1860, 3715],
|
|
3658
3669
|
SGD: [130, 645, 1285]
|
|
3659
3670
|
})
|
|
3671
|
+
},
|
|
3672
|
+
[FlagKey.MinTokenTransferValue]: {
|
|
3673
|
+
type: "string",
|
|
3674
|
+
default_value: JSON.stringify({
|
|
3675
|
+
CA: { mainnet: 80, nonMainnet: 15 },
|
|
3676
|
+
AU: { mainnet: 90, nonMainnet: 20 },
|
|
3677
|
+
DEFAULT: { mainnet: 50, nonMainnet: 10 }
|
|
3678
|
+
})
|
|
3660
3679
|
}
|
|
3661
3680
|
};
|
|
3662
3681
|
|
|
@@ -3922,7 +3941,7 @@ import {
|
|
|
3922
3941
|
isTokenEquivalent as isTokenEquivalent2,
|
|
3923
3942
|
round
|
|
3924
3943
|
} from "@funkit/utils";
|
|
3925
|
-
import { polygon as polygon2 } from "viem/chains";
|
|
3944
|
+
import { arbitrum as arbitrum2, polygon as polygon2 } from "viem/chains";
|
|
3926
3945
|
|
|
3927
3946
|
// src/hooks/useCheckoutDirectExecution.ts
|
|
3928
3947
|
import { DirectExecutionType } from "@funkit/api-base";
|
|
@@ -4042,13 +4061,17 @@ function isVertexDirectExecution({
|
|
|
4042
4061
|
config,
|
|
4043
4062
|
paymentMethod,
|
|
4044
4063
|
sourceAsset,
|
|
4045
|
-
sourceChain
|
|
4064
|
+
sourceChain,
|
|
4065
|
+
targetAsset,
|
|
4066
|
+
targetChain
|
|
4046
4067
|
}) {
|
|
4047
4068
|
return isVertexCustomer(apiKey) && isCheckoutPostActionRequired(config) && paymentMethod === "balance" /* ACCOUNT_BALANCE */ && isTokenEquivalent({
|
|
4048
4069
|
firstTokenAddress: sourceAsset,
|
|
4049
4070
|
firstTokenChainId: sourceChain,
|
|
4050
|
-
|
|
4051
|
-
|
|
4071
|
+
// consider the current target asset and chain first before the config values, reasoning is the real values get updated after submitting the Select Asset step, not when the Receive token dropdown changes value
|
|
4072
|
+
// if needed, we can still provide config values as current target asset and chain
|
|
4073
|
+
secondTokenAddress: targetAsset ?? config.targetAsset,
|
|
4074
|
+
secondTokenChainId: targetChain ?? config.targetChain
|
|
4052
4075
|
});
|
|
4053
4076
|
}
|
|
4054
4077
|
function useCheckoutDirectExecution() {
|
|
@@ -4223,6 +4246,9 @@ var DEFAULT_CHECKOUT_HISTORY_DETAIL_TITLE = "Your Purchase";
|
|
|
4223
4246
|
var ASSET_DECIMALS = 5;
|
|
4224
4247
|
var USD_DECIMALS = 2;
|
|
4225
4248
|
var USD_INITIAL_AMOUNT = 100;
|
|
4249
|
+
function getDefaultAmountFromQuickOptions(quickOptions) {
|
|
4250
|
+
return quickOptions?.[Math.floor((quickOptions.length - 1) / 2)];
|
|
4251
|
+
}
|
|
4226
4252
|
function getUsdMaxAmount(maxUsd) {
|
|
4227
4253
|
if (maxUsd < Number.MAX_VALUE) return maxUsd;
|
|
4228
4254
|
return null;
|
|
@@ -4345,6 +4371,10 @@ function isDefaultToken(asset, checkoutConfig) {
|
|
|
4345
4371
|
);
|
|
4346
4372
|
}
|
|
4347
4373
|
var isPolygonEcosystemToken = (chainId, tokenAddress) => chainId === polygon2.id.toString() && tokenAddress === "0x0000000000000000000000000000000000001010";
|
|
4374
|
+
var isVertexTokenOnArbitrum = (chainId, tokenAddress) => chainId === arbitrum2.id.toString() && isTokenAddressEquivalent2({
|
|
4375
|
+
firstTokenAddress: tokenAddress,
|
|
4376
|
+
secondTokenAddress: "0x95146881b86b3ee99e63705ec87afe29fcc044d9"
|
|
4377
|
+
});
|
|
4348
4378
|
var isAssetUsableToPayForCheckout = ({
|
|
4349
4379
|
apiKey,
|
|
4350
4380
|
config,
|
|
@@ -4372,24 +4402,28 @@ var isAssetUsableToPayForCheckout = ({
|
|
|
4372
4402
|
if (isSameAsPurchasingToken) {
|
|
4373
4403
|
return { isUsable: false, reason: "Not Applicable" };
|
|
4374
4404
|
}
|
|
4405
|
+
const isVertexDirectExecutionCase = isVertexDirectExecution({
|
|
4406
|
+
apiKey,
|
|
4407
|
+
config,
|
|
4408
|
+
paymentMethod,
|
|
4409
|
+
targetAsset: targetTokenAddress,
|
|
4410
|
+
targetChain: targetChainId,
|
|
4411
|
+
sourceAsset: assetTokenAddress,
|
|
4412
|
+
sourceChain: assetChainId
|
|
4413
|
+
});
|
|
4375
4414
|
const usableAmountEstimation = getUsdAvailableAmount(
|
|
4376
4415
|
targetChainId,
|
|
4377
4416
|
assetChainId,
|
|
4378
4417
|
assetUsdAmount,
|
|
4379
4418
|
paymentMethod,
|
|
4380
|
-
|
|
4381
|
-
apiKey,
|
|
4382
|
-
config,
|
|
4383
|
-
paymentMethod,
|
|
4384
|
-
sourceAsset: assetTokenAddress,
|
|
4385
|
-
sourceChain: assetChainId
|
|
4386
|
-
})
|
|
4419
|
+
isVertexDirectExecutionCase
|
|
4387
4420
|
);
|
|
4388
4421
|
if (usableAmountEstimation !== null && usableAmountEstimation < getUsdMinAmount(paymentMethod)) {
|
|
4389
4422
|
return { isUsable: false, reason: LOW_BALANCE };
|
|
4390
4423
|
}
|
|
4424
|
+
const isVertexTokenDisabledOnArbitrum = isVertexTokenOnArbitrum(assetChainId, assetTokenAddress) && !isVertexDirectExecutionCase;
|
|
4391
4425
|
const isConnectedAccountSupported = loginType !== "web2" /* Web2 */ || FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO[assetChainId]?.isFunWalletSupported;
|
|
4392
|
-
const isSupported = isAllowedForCheckout && isConnectedAccountSupported && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO[assetChainId]?.isCheckoutSupported;
|
|
4426
|
+
const isSupported = isAllowedForCheckout && isConnectedAccountSupported && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO[assetChainId]?.isCheckoutSupported && !isVertexTokenDisabledOnArbitrum;
|
|
4393
4427
|
return {
|
|
4394
4428
|
isUsable: !!isSupported,
|
|
4395
4429
|
reason: !isSupported ? "Unsupported" : ""
|
|
@@ -6062,7 +6096,7 @@ var HelpIcon = () => {
|
|
|
6062
6096
|
fill: "none",
|
|
6063
6097
|
xmlns: "http://www.w3.org/2000/svg"
|
|
6064
6098
|
},
|
|
6065
|
-
/* @__PURE__ */ React57.createElement("g", {
|
|
6099
|
+
/* @__PURE__ */ React57.createElement("g", { clipPath: "url(#clip0_29018_24767)" }, /* @__PURE__ */ React57.createElement(
|
|
6066
6100
|
"path",
|
|
6067
6101
|
{
|
|
6068
6102
|
d: "M6.09825 6.50016C6.25498 6.05461 6.56435 5.6789 6.97155 5.43958C7.37875 5.20027 7.85751 5.11279 8.32303 5.19264C8.78855 5.27249 9.21079 5.51451 9.51497 5.87585C9.81914 6.23718 9.98562 6.69451 9.98491 7.16683C9.98491 8.50016 7.98492 9.16683 7.98492 9.16683M8.03825 11.8335H8.04492M14.7049 8.50016C14.7049 12.1821 11.7201 15.1668 8.03825 15.1668C4.35635 15.1668 1.37158 12.1821 1.37158 8.50016C1.37158 4.81826 4.35635 1.8335 8.03825 1.8335C11.7201 1.8335 14.7049 4.81826 14.7049 8.50016Z",
|
|
@@ -6183,7 +6217,8 @@ function Dialog({
|
|
|
6183
6217
|
titleId,
|
|
6184
6218
|
isHidden = false,
|
|
6185
6219
|
isSmartCloseable = false,
|
|
6186
|
-
|
|
6220
|
+
withoutSidePadding: withoutSidePadding2 = false,
|
|
6221
|
+
withoutBottomPadding: withoutBottomPadding2 = false,
|
|
6187
6222
|
withTransition = true
|
|
6188
6223
|
}) {
|
|
6189
6224
|
const { allowBackgroundScroll } = useFunkitConfig();
|
|
@@ -6269,7 +6304,8 @@ function Dialog({
|
|
|
6269
6304
|
/* @__PURE__ */ React59.createElement(FocusTrap, { className: content }, /* @__PURE__ */ React59.createElement(
|
|
6270
6305
|
DialogWrapper,
|
|
6271
6306
|
{
|
|
6272
|
-
|
|
6307
|
+
withoutSidePadding: withoutSidePadding2,
|
|
6308
|
+
withoutBottomPadding: withoutBottomPadding2
|
|
6273
6309
|
},
|
|
6274
6310
|
children
|
|
6275
6311
|
))
|
|
@@ -6281,7 +6317,8 @@ function Dialog({
|
|
|
6281
6317
|
}
|
|
6282
6318
|
var DialogWrapper = ({
|
|
6283
6319
|
children,
|
|
6284
|
-
|
|
6320
|
+
withoutSidePadding: withoutSidePadding2 = false,
|
|
6321
|
+
withoutBottomPadding: withoutBottomPadding2 = false
|
|
6285
6322
|
}) => {
|
|
6286
6323
|
const mobile = isMobile2();
|
|
6287
6324
|
const modalSize = useContext9(ModalSizeContext);
|
|
@@ -6296,7 +6333,8 @@ var DialogWrapper = ({
|
|
|
6296
6333
|
className: clsx6(
|
|
6297
6334
|
mapModalSizeToClassName[modalSize],
|
|
6298
6335
|
mobile && dialogMobile,
|
|
6299
|
-
|
|
6336
|
+
withoutSidePadding2 && withoutSidePadding,
|
|
6337
|
+
withoutBottomPadding2 && withoutBottomPadding
|
|
6300
6338
|
)
|
|
6301
6339
|
},
|
|
6302
6340
|
children
|
|
@@ -7022,7 +7060,7 @@ function getCheckoutCompletionTime(checkout) {
|
|
|
7022
7060
|
}
|
|
7023
7061
|
|
|
7024
7062
|
// src/components/FunCheckoutHistory/FunCheckoutHistoryDetail.tsx
|
|
7025
|
-
import React221, { useCallback as useCallback40, useMemo as
|
|
7063
|
+
import React221, { useCallback as useCallback40, useMemo as useMemo36, useState as useState57 } from "react";
|
|
7026
7064
|
import { createPortal as createPortal14 } from "react-dom";
|
|
7027
7065
|
|
|
7028
7066
|
// src/components/HelpAlert/HelpAlert.tsx
|
|
@@ -7777,7 +7815,7 @@ import {
|
|
|
7777
7815
|
getAllWalletTokens
|
|
7778
7816
|
} from "@funkit/api-base";
|
|
7779
7817
|
import { keepPreviousData, useQuery as useQuery5 } from "@tanstack/react-query";
|
|
7780
|
-
import { arbitrum as
|
|
7818
|
+
import { arbitrum as arbitrum3, polygon as polygon3 } from "viem/chains";
|
|
7781
7819
|
import { useAccount as useAccount3 } from "wagmi";
|
|
7782
7820
|
|
|
7783
7821
|
// src/utils/assets.ts
|
|
@@ -7812,7 +7850,7 @@ function normalizeAssetSymbol(asset) {
|
|
|
7812
7850
|
if (isTokenEquivalent3({
|
|
7813
7851
|
firstTokenChainId: asset.chainId,
|
|
7814
7852
|
firstTokenAddress: asset.contractAddress,
|
|
7815
|
-
secondTokenChainId:
|
|
7853
|
+
secondTokenChainId: arbitrum3.id.toString(),
|
|
7816
7854
|
secondTokenAddress: ARBITRUM_USDCE_TOKEN
|
|
7817
7855
|
})) {
|
|
7818
7856
|
return { ...asset, symbol: "USDC.e" };
|
|
@@ -8513,6 +8551,8 @@ var isCountryBlocked = (blockedList, userIpInfo) => {
|
|
|
8513
8551
|
function useFunkitUserIp() {
|
|
8514
8552
|
const { moonpayApiKey } = useContext14(FunkitMoonpayContext);
|
|
8515
8553
|
const { getFlag, isLoading: isLoadingFlags } = useFlags();
|
|
8554
|
+
const { apiKey } = useFunkitConfig();
|
|
8555
|
+
const isPolymarket = isPolymarketCustomer(apiKey);
|
|
8516
8556
|
const { data: userIpInfo, isLoading: isLoadingGeoCheck } = useQuery6({
|
|
8517
8557
|
queryKey: ["getUserIpInfo"],
|
|
8518
8558
|
queryFn: async () => {
|
|
@@ -8535,7 +8575,7 @@ function useFunkitUserIp() {
|
|
|
8535
8575
|
refetchOnWindowFocus: false
|
|
8536
8576
|
});
|
|
8537
8577
|
const isUserGeoblocked = useMemo9(() => {
|
|
8538
|
-
if (isLoadingFlags || isLoadingGeoCheck) {
|
|
8578
|
+
if (isLoadingFlags || isLoadingGeoCheck || isPolymarket) {
|
|
8539
8579
|
return false;
|
|
8540
8580
|
}
|
|
8541
8581
|
if (!userIpInfo) {
|
|
@@ -8543,7 +8583,7 @@ function useFunkitUserIp() {
|
|
|
8543
8583
|
}
|
|
8544
8584
|
const blockedList = getFlag(FlagKey7.BlockedCountries, ALL_MATCH).split(",");
|
|
8545
8585
|
return isCountryBlocked(blockedList, userIpInfo);
|
|
8546
|
-
}, [getFlag, isLoadingFlags, isLoadingGeoCheck, userIpInfo]);
|
|
8586
|
+
}, [getFlag, isLoadingFlags, isLoadingGeoCheck, userIpInfo, isPolymarket]);
|
|
8547
8587
|
return {
|
|
8548
8588
|
isLoadingGeoCheck: isLoadingFlags || isLoadingGeoCheck,
|
|
8549
8589
|
isUserGeoblocked,
|
|
@@ -10695,7 +10735,7 @@ var BankIconActive = ({ size = 20 }) => {
|
|
|
10695
10735
|
|
|
10696
10736
|
// src/components/FunConnectOptions/FunSignInStep.tsx
|
|
10697
10737
|
import { groupBy, isMobile as isMobile8, isSafari as isSafari3, redirectInMobile as redirectInMobile2 } from "@funkit/utils";
|
|
10698
|
-
import React214, { Fragment as Fragment3, useCallback as useCallback39, useMemo as
|
|
10738
|
+
import React214, { Fragment as Fragment3, useCallback as useCallback39, useMemo as useMemo34, useState as useState55 } from "react";
|
|
10699
10739
|
|
|
10700
10740
|
// src/providers/walletConnectDeepLink.ts
|
|
10701
10741
|
var storageKey2 = "WALLETCONNECT_DEEPLINK_CHOICE";
|
|
@@ -11292,7 +11332,7 @@ var SocialsIcon = () => {
|
|
|
11292
11332
|
};
|
|
11293
11333
|
|
|
11294
11334
|
// src/components/FunConnectOptions/FunConnectOptions.tsx
|
|
11295
|
-
import React213, { useCallback as useCallback38, useMemo as
|
|
11335
|
+
import React213, { useCallback as useCallback38, useMemo as useMemo33, useState as useState54 } from "react";
|
|
11296
11336
|
|
|
11297
11337
|
// src/hooks/useAnimatedNavigation.ts
|
|
11298
11338
|
import { useCallback as useCallback16, useState as useState17 } from "react";
|
|
@@ -11537,6 +11577,7 @@ async function evaluateAccountWalletFees({
|
|
|
11537
11577
|
loginType,
|
|
11538
11578
|
apiKey
|
|
11539
11579
|
}) {
|
|
11580
|
+
const relayQuote = baseQuote.metadata?.relayQuote;
|
|
11540
11581
|
const nativeCurrencySymbol = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO13[selectedSourceAssetInfo.chainId]?.nativeCurrency.symbol || "";
|
|
11541
11582
|
const walletCheckoutFees = {
|
|
11542
11583
|
paymentMethod: "balance" /* ACCOUNT_BALANCE */,
|
|
@@ -11545,7 +11586,8 @@ async function evaluateAccountWalletFees({
|
|
|
11545
11586
|
eoaWalletFeeUsd: 0,
|
|
11546
11587
|
totalFeesUsd: baseQuote.estFeesUsd,
|
|
11547
11588
|
totalFeesTokenWithoutGas: Number(baseQuote.estFeesFromAmount),
|
|
11548
|
-
nativeCurrencySymbol
|
|
11589
|
+
nativeCurrencySymbol,
|
|
11590
|
+
relayQuote
|
|
11549
11591
|
};
|
|
11550
11592
|
if (loginType !== "web3" /* Web3 */ || selectedSourceAssetInfo.chainId === zkSync.id.toString()) {
|
|
11551
11593
|
return { fees: walletCheckoutFees };
|
|
@@ -13613,7 +13655,7 @@ function CheckoutHelp({
|
|
|
13613
13655
|
}
|
|
13614
13656
|
|
|
13615
13657
|
// src/modals/CheckoutModal/ConfirmationStep/ConfirmationStep.tsx
|
|
13616
|
-
import React132, { useEffect as useEffect25, useMemo as
|
|
13658
|
+
import React132, { useEffect as useEffect25, useMemo as useMemo21, useState as useState32 } from "react";
|
|
13617
13659
|
import { createPortal as createPortal5 } from "react-dom";
|
|
13618
13660
|
|
|
13619
13661
|
// src/providers/UserPresenceContext.tsx
|
|
@@ -13650,7 +13692,7 @@ var UserPresenceProvider = ({ children }) => {
|
|
|
13650
13692
|
var useUserPresence = () => useContext16(UserPresenceContext);
|
|
13651
13693
|
|
|
13652
13694
|
// src/modals/CheckoutModal/ConfirmationStep/ConfirmationStep.tsx
|
|
13653
|
-
import { DirectExecutionType as
|
|
13695
|
+
import { DirectExecutionType as DirectExecutionType2 } from "@funkit/api-base";
|
|
13654
13696
|
import { FlagKey as FlagKey17 } from "@funkit/utils";
|
|
13655
13697
|
|
|
13656
13698
|
// src/components/FunInfoBanner/FunInfoBanner.tsx
|
|
@@ -13945,7 +13987,7 @@ import {
|
|
|
13945
13987
|
} from "@funkit/utils";
|
|
13946
13988
|
import NumberFlow from "@number-flow/react";
|
|
13947
13989
|
import { motion as motion3 } from "motion/react";
|
|
13948
|
-
import React122, { useMemo as
|
|
13990
|
+
import React122, { useMemo as useMemo16 } from "react";
|
|
13949
13991
|
|
|
13950
13992
|
// src/consts/design.ts
|
|
13951
13993
|
var mapFontLineHeightToNumberFlowHeight = {
|
|
@@ -13955,23 +13997,15 @@ var mapFontLineHeightToNumberFlowHeight = {
|
|
|
13955
13997
|
};
|
|
13956
13998
|
|
|
13957
13999
|
// src/hooks/useReceiveAmountLabel.ts
|
|
13958
|
-
|
|
13959
|
-
import { useMemo as useMemo15 } from "react";
|
|
13960
|
-
function useReceiveAmountLabel({
|
|
13961
|
-
directExecutionType,
|
|
13962
|
-
isSameToken
|
|
13963
|
-
}) {
|
|
14000
|
+
function useReceiveAmountLabel(_) {
|
|
13964
14001
|
const { textCustomizations } = useFunkitConfig();
|
|
13965
|
-
return
|
|
13966
|
-
const showAtLeast = directExecutionType === DirectExecutionType2.RELAY && !isSameToken;
|
|
13967
|
-
return `${textCustomizations.confirmationScreen.receiveAmountLabel}${showAtLeast ? " at least" : ""}`;
|
|
13968
|
-
}, [textCustomizations, directExecutionType, isSameToken]);
|
|
14002
|
+
return textCustomizations.confirmationScreen.receiveAmountLabel;
|
|
13969
14003
|
}
|
|
13970
14004
|
|
|
13971
14005
|
// src/components/FunAssetAvatar/FunAssetAvatar.tsx
|
|
13972
14006
|
import { isNotNullish as isNotNullish7 } from "@funkit/utils";
|
|
13973
14007
|
import clsx12 from "clsx";
|
|
13974
|
-
import React121, { useMemo as
|
|
14008
|
+
import React121, { useMemo as useMemo15 } from "react";
|
|
13975
14009
|
|
|
13976
14010
|
// src/components/FunAssetAvatar/FunAssetAvatar.css.ts
|
|
13977
14011
|
var chainContainerStyle = "uwrdc22 _1rsrm2f18 _1rsrm2fa _1rsrm2f4 _1rsrm2f41";
|
|
@@ -13991,7 +14025,7 @@ function FunAssetAvatar({
|
|
|
13991
14025
|
largeChainIcon = false
|
|
13992
14026
|
}) {
|
|
13993
14027
|
const chainMetadata = chainMetadataById[Number.parseInt((chainId || "").toString())] || null;
|
|
13994
|
-
const finalAssetSrc =
|
|
14028
|
+
const finalAssetSrc = useMemo15(() => {
|
|
13995
14029
|
const normalizedTicker = assetTicker?.toUpperCase() || "";
|
|
13996
14030
|
const defaultSrc = ASSET_LOGO_SRCS[normalizedTicker];
|
|
13997
14031
|
if (prioritizeDefaults) {
|
|
@@ -14089,13 +14123,13 @@ function PaymentAmountSummary({
|
|
|
14089
14123
|
})
|
|
14090
14124
|
});
|
|
14091
14125
|
const sourceTokenAmount = quote?.finalPaymentTokenAmount ? Number.parseFloat(quote.finalPaymentTokenAmount) : void 0;
|
|
14092
|
-
const paymentTokenUsdAmount =
|
|
14126
|
+
const paymentTokenUsdAmount = useMemo16(() => {
|
|
14093
14127
|
if (!quote) return void 0;
|
|
14094
14128
|
return formatCurrencyAndStringify3(
|
|
14095
14129
|
quote.baseQuote.estSubtotalUsd + Number.parseFloat(quote.finalPaymentFeeUsd) - Number.parseFloat(quote.finalSpreadUsd)
|
|
14096
14130
|
);
|
|
14097
14131
|
}, [quote]);
|
|
14098
|
-
const receiveTokenUsdAmount =
|
|
14132
|
+
const receiveTokenUsdAmount = useMemo16(() => {
|
|
14099
14133
|
if (!quote) return void 0;
|
|
14100
14134
|
return formatCurrencyAndStringify3(
|
|
14101
14135
|
Number.parseFloat(quote.finalTotalUsd) - Number.parseFloat(quote.finalPaymentFeeUsd) - Number.parseFloat(quote.finalSpreadUsd)
|
|
@@ -14215,9 +14249,11 @@ function PaymentAmountSummaryItem({
|
|
|
14215
14249
|
import {
|
|
14216
14250
|
formatCurrencyAndStringify as formatCurrencyAndStringify4,
|
|
14217
14251
|
formatDynamicFeeUsd,
|
|
14252
|
+
formatPercent,
|
|
14218
14253
|
noop as noop4
|
|
14219
14254
|
} from "@funkit/utils";
|
|
14220
|
-
import React124, { useMemo as
|
|
14255
|
+
import React124, { useMemo as useMemo17, useState as useState23 } from "react";
|
|
14256
|
+
import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO14 } from "@funkit/chains";
|
|
14221
14257
|
import clsx13 from "clsx";
|
|
14222
14258
|
import { motion as motion4, useAnimationControls } from "motion/react";
|
|
14223
14259
|
|
|
@@ -14254,6 +14290,88 @@ var NO_DATA = {
|
|
|
14254
14290
|
collapsed: null,
|
|
14255
14291
|
expanded: []
|
|
14256
14292
|
};
|
|
14293
|
+
function renderRelayFee(relayQuote) {
|
|
14294
|
+
const { details, fees } = relayQuote;
|
|
14295
|
+
const gasUsd = Number.parseFloat(fees?.gas?.amountUsd || "0");
|
|
14296
|
+
const destinationChainId = details?.currencyOut?.currency?.chainId || "";
|
|
14297
|
+
const chainName = FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO14[destinationChainId]?.name;
|
|
14298
|
+
const totalImpactStr = (details?.totalImpact?.percent || "0").replace("-", "");
|
|
14299
|
+
const totalImpact = Number.parseFloat(totalImpactStr);
|
|
14300
|
+
const swapImpactStr = (details?.swapImpact?.percent || "0").replace("-", "");
|
|
14301
|
+
const swapImpact = Number.parseFloat(swapImpactStr);
|
|
14302
|
+
const relayGas = Number.parseFloat(fees?.relayer?.amountUsd || "0");
|
|
14303
|
+
const totalUsd = Number.parseFloat(details?.currencyIn?.amountUsd || "0");
|
|
14304
|
+
const appFeePercent = Number.parseFloat(fees?.app?.amountUsd || "0") / totalUsd * 100;
|
|
14305
|
+
const maxSlippage = Number.parseFloat(
|
|
14306
|
+
details?.slippageTolerance?.destination?.percent || "0"
|
|
14307
|
+
);
|
|
14308
|
+
return {
|
|
14309
|
+
collapsed: {
|
|
14310
|
+
value: formatCurrencyAndStringify4(gasUsd),
|
|
14311
|
+
valueIcon: /* @__PURE__ */ React124.createElement(GasIcon, null)
|
|
14312
|
+
},
|
|
14313
|
+
expanded: [
|
|
14314
|
+
// {
|
|
14315
|
+
// label: 'Rate',
|
|
14316
|
+
// value: `1.000 ${details?.currencyIn?.currency?.symbol} = ${ratePretty} ${details?.currencyOut?.currency?.symbol}`,
|
|
14317
|
+
// tooltipText:
|
|
14318
|
+
// 'The conversion rate between ETH on Arbitrum and USDCe on Polygon.',
|
|
14319
|
+
// },
|
|
14320
|
+
{
|
|
14321
|
+
label: "Network cost",
|
|
14322
|
+
valueIcon: /* @__PURE__ */ React124.createElement(GasIcon, null),
|
|
14323
|
+
value: formatCurrencyAndStringify4(gasUsd),
|
|
14324
|
+
tooltipText: /* @__PURE__ */ React124.createElement(React124.Fragment, null, "Estimated gas cost for completing your transaction, including the network fee and routing gas fees. The final cost may vary based on network conditions.")
|
|
14325
|
+
},
|
|
14326
|
+
{
|
|
14327
|
+
label: "Price impact",
|
|
14328
|
+
value: formatPercent(totalImpact),
|
|
14329
|
+
tooltipText: /* @__PURE__ */ React124.createElement(Box, { display: "flex", flexDirection: "column", gap: "4" }, /* @__PURE__ */ React124.createElement(Box, { display: "flex", flexDirection: "column", gap: "2" }, /* @__PURE__ */ React124.createElement(
|
|
14330
|
+
Box,
|
|
14331
|
+
{
|
|
14332
|
+
alignItems: "center",
|
|
14333
|
+
display: "flex",
|
|
14334
|
+
justifyContent: "space-between"
|
|
14335
|
+
},
|
|
14336
|
+
/* @__PURE__ */ React124.createElement(Text, { size: "10", weight: "medium" }, "Total impact"),
|
|
14337
|
+
/* @__PURE__ */ React124.createElement(Text, { size: "10", weight: "medium" }, formatPercent(totalImpact))
|
|
14338
|
+
), /* @__PURE__ */ React124.createElement(
|
|
14339
|
+
Box,
|
|
14340
|
+
{
|
|
14341
|
+
alignItems: "center",
|
|
14342
|
+
display: "flex",
|
|
14343
|
+
justifyContent: "space-between"
|
|
14344
|
+
},
|
|
14345
|
+
/* @__PURE__ */ React124.createElement(Text, { size: "10" }, "Swap impact"),
|
|
14346
|
+
/* @__PURE__ */ React124.createElement(Text, { size: "10", weight: "medium" }, formatPercent(swapImpact))
|
|
14347
|
+
), /* @__PURE__ */ React124.createElement(
|
|
14348
|
+
Box,
|
|
14349
|
+
{
|
|
14350
|
+
alignItems: "center",
|
|
14351
|
+
display: "flex",
|
|
14352
|
+
justifyContent: "space-between"
|
|
14353
|
+
},
|
|
14354
|
+
/* @__PURE__ */ React124.createElement(Text, { size: "10" }, "Fill gas ", chainName ? `(${chainName})` : ""),
|
|
14355
|
+
/* @__PURE__ */ React124.createElement(Text, { size: "10", weight: "medium" }, formatCurrencyAndStringify4(relayGas))
|
|
14356
|
+
), /* @__PURE__ */ React124.createElement(
|
|
14357
|
+
Box,
|
|
14358
|
+
{
|
|
14359
|
+
alignItems: "center",
|
|
14360
|
+
display: "flex",
|
|
14361
|
+
justifyContent: "space-between"
|
|
14362
|
+
},
|
|
14363
|
+
/* @__PURE__ */ React124.createElement(Text, { size: "10" }, "Fun.xyz fee"),
|
|
14364
|
+
/* @__PURE__ */ React124.createElement(Text, { size: "10", weight: "medium" }, formatPercent(appFeePercent))
|
|
14365
|
+
)), /* @__PURE__ */ React124.createElement(FunDivider, null), /* @__PURE__ */ React124.createElement(Box, null, "Price impact is the difference between the expected and executed price.", /* @__PURE__ */ React124.createElement("br", null), /* @__PURE__ */ React124.createElement("br", null), "Final cost may vary based on network conditions."))
|
|
14366
|
+
},
|
|
14367
|
+
{
|
|
14368
|
+
label: "Max slippage",
|
|
14369
|
+
value: formatPercent(maxSlippage),
|
|
14370
|
+
tooltipText: /* @__PURE__ */ React124.createElement(React124.Fragment, null, "Slippage occurs due to price changes during trade execution. Slippage limits are adjusted based on your asset to ensure a reliable, timely execution.", /* @__PURE__ */ React124.createElement("br", null), /* @__PURE__ */ React124.createElement("br", null), "The slippage is set as low as possible. If it is required to be higher than 1.50% during execution, Fun.xyz will cover the difference.")
|
|
14371
|
+
}
|
|
14372
|
+
]
|
|
14373
|
+
};
|
|
14374
|
+
}
|
|
14257
14375
|
var extractFeeItems = (fees, totalUsd, isDydx) => {
|
|
14258
14376
|
const marketMakerFee = {
|
|
14259
14377
|
label: "Market maker gas costs",
|
|
@@ -14268,6 +14386,9 @@ var extractFeeItems = (fees, totalUsd, isDydx) => {
|
|
|
14268
14386
|
}),
|
|
14269
14387
|
tooltipText: "Charged to cover the costs of providing on-chain liquidity."
|
|
14270
14388
|
};
|
|
14389
|
+
if (fees.paymentMethod === "balance" /* ACCOUNT_BALANCE */ && fees.relayQuote) {
|
|
14390
|
+
return renderRelayFee(fees.relayQuote);
|
|
14391
|
+
}
|
|
14271
14392
|
if (fees.paymentMethod === "balance" /* ACCOUNT_BALANCE */) {
|
|
14272
14393
|
const { eoaWalletFeeUsd, marketMakerFeeUsd } = fees;
|
|
14273
14394
|
const fillGasCost = formatDynamicFeeUsd(eoaWalletFeeUsd, totalUsd, {
|
|
@@ -14352,7 +14473,7 @@ function PaymentFeesSummary({
|
|
|
14352
14473
|
}
|
|
14353
14474
|
};
|
|
14354
14475
|
const isDydx = isDydxCustomer(apiKey);
|
|
14355
|
-
const { collapsed: collapsedItem, expanded: expandedItems } =
|
|
14476
|
+
const { collapsed: collapsedItem, expanded: expandedItems } = useMemo17(() => {
|
|
14356
14477
|
if (!quote) return NO_DATA;
|
|
14357
14478
|
const fees = quote.finalFeesBreakdown;
|
|
14358
14479
|
const totalUsd = Number(quote.finalTotalUsd);
|
|
@@ -14570,7 +14691,7 @@ function CheckoutPrimaryInfo({
|
|
|
14570
14691
|
}
|
|
14571
14692
|
|
|
14572
14693
|
// src/modals/CheckoutModal/ConfirmationStep/DisclaimerText.tsx
|
|
14573
|
-
import React128, { useMemo as
|
|
14694
|
+
import React128, { useMemo as useMemo18 } from "react";
|
|
14574
14695
|
|
|
14575
14696
|
// src/utils/customer.ts
|
|
14576
14697
|
function isKatanaEarnFlow({
|
|
@@ -14625,7 +14746,7 @@ var DisclaimerText = ({
|
|
|
14625
14746
|
), ", and the ", /* @__PURE__ */ React128.createElement(FunLinkButton, { href: "https://morpho.org/", inline: true, text: "terms" }), " applicable to third-party Morpho vaults", ".") : /* @__PURE__ */ React128.createElement(React128.Fragment, null, isVertex && vertexText ? `${vertexText} ` : showCardDisclaimer && `${cardDisclaimer} `, "By clicking on ", continueText, ", you agree to our", " ", /* @__PURE__ */ React128.createElement(FunLinkButton, { href: FUN_TERMS_URL, inline: true, text: "terms" }), ".");
|
|
14626
14747
|
};
|
|
14627
14748
|
function useCardDisclaimer(checkoutItem, finalConvertedAssetName) {
|
|
14628
|
-
const cardDisclaimer =
|
|
14749
|
+
const cardDisclaimer = useMemo18(() => {
|
|
14629
14750
|
if (!checkoutItem || !finalConvertedAssetName) {
|
|
14630
14751
|
return null;
|
|
14631
14752
|
}
|
|
@@ -14707,10 +14828,10 @@ function useAutoClearState(initialValue = null) {
|
|
|
14707
14828
|
|
|
14708
14829
|
// src/hooks/useIsBlacklisted.ts
|
|
14709
14830
|
import { FlagKey as FlagKey15 } from "@funkit/utils";
|
|
14710
|
-
import { useMemo as
|
|
14831
|
+
import { useMemo as useMemo19 } from "react";
|
|
14711
14832
|
var useIsBlacklisted = (walletAddress, customRecipient) => {
|
|
14712
14833
|
const flagStr = useFlag(FlagKey15.AddressBlacklist);
|
|
14713
|
-
const blacklist =
|
|
14834
|
+
const blacklist = useMemo19(
|
|
14714
14835
|
() => safeJSONParse(flagStr)?.map((addr) => addr.toLowerCase()) || [],
|
|
14715
14836
|
[flagStr]
|
|
14716
14837
|
);
|
|
@@ -15530,7 +15651,7 @@ function usePostCheckout({
|
|
|
15530
15651
|
}
|
|
15531
15652
|
|
|
15532
15653
|
// src/modals/CheckoutModal/ConfirmationStep/useQuoteRefresh.ts
|
|
15533
|
-
import { useCallback as useCallback25, useEffect as useEffect24, useMemo as
|
|
15654
|
+
import { useCallback as useCallback25, useEffect as useEffect24, useMemo as useMemo20, useRef as useRef10, useState as useState31 } from "react";
|
|
15534
15655
|
|
|
15535
15656
|
// src/hooks/useCountdown.tsx
|
|
15536
15657
|
import React131 from "react";
|
|
@@ -15799,7 +15920,7 @@ function useQuoteRefresh({
|
|
|
15799
15920
|
},
|
|
15800
15921
|
[isOnHold, restartCountdown, setCheckoutQuote, triggerAssetConfirm]
|
|
15801
15922
|
);
|
|
15802
|
-
const quoteError =
|
|
15923
|
+
const quoteError = useMemo20(() => {
|
|
15803
15924
|
if (quoteErrorMessage && !isQuoting) {
|
|
15804
15925
|
return {
|
|
15805
15926
|
message: quoteErrorMessage,
|
|
@@ -15932,10 +16053,10 @@ function ConfirmationStep({
|
|
|
15932
16053
|
// Block updates to the current quote during confirmation, post-checkout, and if its a direct execution
|
|
15933
16054
|
useQuoteRefresh({
|
|
15934
16055
|
isOnHold: isInitialQuoting || isContinuing || isAway,
|
|
15935
|
-
refreshIntervalSeconds: directExecutionType ===
|
|
16056
|
+
refreshIntervalSeconds: directExecutionType === DirectExecutionType2.RELAY ? RELAY_ESTIMATE_REFRESH_INTERVAL_SEC : DEFAULT_ESTIMATE_REFRESH_INTERVAL_SEC
|
|
15936
16057
|
})
|
|
15937
16058
|
);
|
|
15938
|
-
const error =
|
|
16059
|
+
const error = useMemo21(() => {
|
|
15939
16060
|
if (!isInitialQuoting && moonpayAmountCheck?.isInvalid) {
|
|
15940
16061
|
return {
|
|
15941
16062
|
message: moonpayAmountCheck.message,
|
|
@@ -15950,7 +16071,7 @@ function ConfirmationStep({
|
|
|
15950
16071
|
quoteError,
|
|
15951
16072
|
isInitialQuoting
|
|
15952
16073
|
]);
|
|
15953
|
-
const stepMessage =
|
|
16074
|
+
const stepMessage = useMemo21(() => {
|
|
15954
16075
|
if (initialQuoteStep) return initialQuoteStep;
|
|
15955
16076
|
if (postCheckoutStepMessage) return postCheckoutStepMessage;
|
|
15956
16077
|
if (confirmationStepMessage) return confirmationStepMessage;
|
|
@@ -16367,7 +16488,7 @@ var useMeldDefaultCurrency = (paymentMethod) => {
|
|
|
16367
16488
|
const { userIpInfo } = useFunkitUserIp();
|
|
16368
16489
|
const enableMeld = useFlag(FlagKey18.EnableMeldPayment);
|
|
16369
16490
|
const query = useQuery12({
|
|
16370
|
-
queryKey: ["meld", "defaultCurrency"],
|
|
16491
|
+
queryKey: ["meld", "defaultCurrency", paymentMethod],
|
|
16371
16492
|
queryFn: async () => {
|
|
16372
16493
|
if (!apiKey) return "";
|
|
16373
16494
|
const response = await getMeldDefaultFiat({
|
|
@@ -16386,15 +16507,101 @@ var useMeldDefaultCurrency = (paymentMethod) => {
|
|
|
16386
16507
|
return query;
|
|
16387
16508
|
};
|
|
16388
16509
|
|
|
16510
|
+
// src/hooks/queries/useMeldLimits.ts
|
|
16511
|
+
import { getMeldFiatLimits } from "@funkit/api-base";
|
|
16512
|
+
import { formatCurrencyAndStringify as formatCurrencyAndStringify5 } from "@funkit/utils";
|
|
16513
|
+
import { useQuery as useQuery13 } from "@tanstack/react-query";
|
|
16514
|
+
|
|
16515
|
+
// src/hooks/queries/useMeldCryptoCurrencyCode.ts
|
|
16516
|
+
function useMeldCryptoCurrencyCode() {
|
|
16517
|
+
const { checkoutItem } = useCheckoutContext();
|
|
16518
|
+
const _targetChain = checkoutItem?.initSettings.config.targetChain;
|
|
16519
|
+
const _targetAsset = checkoutItem?.initSettings.config.targetAsset;
|
|
16520
|
+
return "USDC_POLYGON";
|
|
16521
|
+
}
|
|
16522
|
+
|
|
16523
|
+
// src/hooks/queries/useMeldLimits.ts
|
|
16524
|
+
var useMeldLimits = (isEnabled = true) => {
|
|
16525
|
+
const { apiKey } = useFunkitConfig();
|
|
16526
|
+
const { userIpInfo } = useFunkitUserIp();
|
|
16527
|
+
const cryptoCurrency = useMeldCryptoCurrencyCode();
|
|
16528
|
+
const countryCode = userIpInfo?.alpha2;
|
|
16529
|
+
const query = useQuery13({
|
|
16530
|
+
queryKey: ["meld", "limits", countryCode, cryptoCurrency],
|
|
16531
|
+
queryFn: async () => {
|
|
16532
|
+
if (!apiKey || !countryCode) return void 0;
|
|
16533
|
+
const response = await getMeldFiatLimits({
|
|
16534
|
+
params: {
|
|
16535
|
+
countries: [countryCode],
|
|
16536
|
+
cryptoCurrencies: cryptoCurrency ? [cryptoCurrency] : [],
|
|
16537
|
+
// left out intentionally to preload other currency limits
|
|
16538
|
+
fiatCurrencies: []
|
|
16539
|
+
},
|
|
16540
|
+
apiKey
|
|
16541
|
+
});
|
|
16542
|
+
return response?.limits;
|
|
16543
|
+
},
|
|
16544
|
+
enabled: isEnabled && !!apiKey && !!countryCode && !!cryptoCurrency,
|
|
16545
|
+
refetchOnMount: false,
|
|
16546
|
+
refetchOnReconnect: false,
|
|
16547
|
+
refetchOnWindowFocus: false,
|
|
16548
|
+
staleTime: 1e3 * 60 * 60
|
|
16549
|
+
// 1 hour
|
|
16550
|
+
});
|
|
16551
|
+
return query;
|
|
16552
|
+
};
|
|
16553
|
+
var useMeldLimit = (fiatCurrency) => {
|
|
16554
|
+
const query = useMeldLimits();
|
|
16555
|
+
return {
|
|
16556
|
+
...query,
|
|
16557
|
+
data: query.data?.find((limit) => limit.currencyCode === fiatCurrency)
|
|
16558
|
+
};
|
|
16559
|
+
};
|
|
16560
|
+
var useMeldLimitError = (amount, fiatCurrency) => {
|
|
16561
|
+
const { data: meldLimit } = useMeldLimit(fiatCurrency);
|
|
16562
|
+
if (!meldLimit) return void 0;
|
|
16563
|
+
if (amount < meldLimit.minimumAmount) {
|
|
16564
|
+
const limit = formatCurrencyAndStringify5(
|
|
16565
|
+
meldLimit.minimumAmount ?? 0,
|
|
16566
|
+
{},
|
|
16567
|
+
{
|
|
16568
|
+
currency: fiatCurrency,
|
|
16569
|
+
currencyDisplay: "narrowSymbol",
|
|
16570
|
+
minimumFractionDigits: 0
|
|
16571
|
+
}
|
|
16572
|
+
);
|
|
16573
|
+
return {
|
|
16574
|
+
issue: "Amount below minimum",
|
|
16575
|
+
suggestion: `Input an amount greater than ${limit}.`
|
|
16576
|
+
};
|
|
16577
|
+
}
|
|
16578
|
+
if (amount > meldLimit.maximumAmount) {
|
|
16579
|
+
const limit = formatCurrencyAndStringify5(
|
|
16580
|
+
meldLimit.maximumAmount ?? 0,
|
|
16581
|
+
{},
|
|
16582
|
+
{
|
|
16583
|
+
currency: fiatCurrency,
|
|
16584
|
+
currencyDisplay: "narrowSymbol",
|
|
16585
|
+
minimumFractionDigits: 0
|
|
16586
|
+
}
|
|
16587
|
+
);
|
|
16588
|
+
return {
|
|
16589
|
+
issue: "Amount above maximum",
|
|
16590
|
+
suggestion: `Input an amount lower than ${limit}.`
|
|
16591
|
+
};
|
|
16592
|
+
}
|
|
16593
|
+
return void 0;
|
|
16594
|
+
};
|
|
16595
|
+
|
|
16389
16596
|
// src/modals/CheckoutModal/InputAmount/InputAmountLoaded.tsx
|
|
16390
16597
|
import {
|
|
16391
|
-
FlagKey as
|
|
16598
|
+
FlagKey as FlagKey21,
|
|
16392
16599
|
formatCryptoAndStringify as formatCryptoAndStringify4,
|
|
16393
16600
|
formatCurrencyAndStringify as formatCurrencyAndStringify9,
|
|
16394
16601
|
isTokenEquivalent as isTokenEquivalent6,
|
|
16395
16602
|
round as round3
|
|
16396
16603
|
} from "@funkit/utils";
|
|
16397
|
-
import React150, { useMemo as
|
|
16604
|
+
import React150, { useMemo as useMemo22 } from "react";
|
|
16398
16605
|
|
|
16399
16606
|
// src/components/CurrencySelector/CurrencySelector.tsx
|
|
16400
16607
|
import React139 from "react";
|
|
@@ -16471,7 +16678,7 @@ import React142 from "react";
|
|
|
16471
16678
|
// src/components/MeldQuoteItem/MeldQuoteItem.tsx
|
|
16472
16679
|
import {
|
|
16473
16680
|
formatCryptoAndStringify as formatCryptoAndStringify2,
|
|
16474
|
-
formatCurrencyAndStringify as
|
|
16681
|
+
formatCurrencyAndStringify as formatCurrencyAndStringify6
|
|
16475
16682
|
} from "@funkit/utils";
|
|
16476
16683
|
import React141 from "react";
|
|
16477
16684
|
|
|
@@ -16541,7 +16748,7 @@ var MeldQuoteItem = ({
|
|
|
16541
16748
|
}
|
|
16542
16749
|
}
|
|
16543
16750
|
);
|
|
16544
|
-
const fiatAmount =
|
|
16751
|
+
const fiatAmount = formatCurrencyAndStringify6(
|
|
16545
16752
|
quote.sourceAmount,
|
|
16546
16753
|
{},
|
|
16547
16754
|
{ currency: quote.sourceCurrencyCode }
|
|
@@ -16560,8 +16767,8 @@ var MeldQuoteItem = ({
|
|
|
16560
16767
|
/* @__PURE__ */ React141.createElement(Box, { display: "flex", alignItems: "center", gap: "8" }, /* @__PURE__ */ React141.createElement(Box, { justifyContent: "center", display: "flex", alignItems: "center" }, /* @__PURE__ */ React141.createElement(
|
|
16561
16768
|
AsyncImage,
|
|
16562
16769
|
{
|
|
16563
|
-
width: "
|
|
16564
|
-
height: "
|
|
16770
|
+
width: "28",
|
|
16771
|
+
height: "28",
|
|
16565
16772
|
src: getMeldProviderIconUrl(quote.serviceProvider),
|
|
16566
16773
|
fallbackSrc: FALLBACK_ASSET,
|
|
16567
16774
|
alt: quote.serviceProvider,
|
|
@@ -16647,6 +16854,7 @@ var MeldProviderLabel = ({
|
|
|
16647
16854
|
};
|
|
16648
16855
|
|
|
16649
16856
|
// src/components/SourcePaymentMethodItem/SourcePaymentMethodItem.tsx
|
|
16857
|
+
import { FlagKey as FlagKey19 } from "@funkit/utils";
|
|
16650
16858
|
import clsx14 from "clsx";
|
|
16651
16859
|
import { useAnimate } from "motion/react";
|
|
16652
16860
|
import React144 from "react";
|
|
@@ -17225,6 +17433,40 @@ var SourcePaymentMethodItem = ({
|
|
|
17225
17433
|
);
|
|
17226
17434
|
};
|
|
17227
17435
|
const backdropColor = themeVars.colors.offBackground;
|
|
17436
|
+
const icons = [
|
|
17437
|
+
{
|
|
17438
|
+
paymentMethod: "balance" /* ACCOUNT_BALANCE */,
|
|
17439
|
+
icon: /* @__PURE__ */ React144.createElement(MetamaskPillIcon, { key: "metamask", backdropColor })
|
|
17440
|
+
},
|
|
17441
|
+
{
|
|
17442
|
+
paymentMethod: "brokerage" /* BROKERAGE */,
|
|
17443
|
+
icon: /* @__PURE__ */ React144.createElement(BinancePillIcon, { key: "binance", backdropColor })
|
|
17444
|
+
},
|
|
17445
|
+
{
|
|
17446
|
+
paymentMethod: "card" /* CARD */,
|
|
17447
|
+
icon: /* @__PURE__ */ React144.createElement(VisaPillIcon, { key: "visa", backdropColor })
|
|
17448
|
+
},
|
|
17449
|
+
{
|
|
17450
|
+
paymentMethod: "brokerage" /* BROKERAGE */,
|
|
17451
|
+
icon: /* @__PURE__ */ React144.createElement(CoinbasePillIcon, { key: "coinbase", backdropColor })
|
|
17452
|
+
},
|
|
17453
|
+
{
|
|
17454
|
+
paymentMethod: "balance" /* ACCOUNT_BALANCE */,
|
|
17455
|
+
icon: /* @__PURE__ */ React144.createElement(RainbowPillIcon, { key: "rainbow", backdropColor })
|
|
17456
|
+
},
|
|
17457
|
+
{
|
|
17458
|
+
paymentMethod: "card" /* CARD */,
|
|
17459
|
+
icon: /* @__PURE__ */ React144.createElement(MasterCardPillIcon, { key: "mastercard", backdropColor })
|
|
17460
|
+
}
|
|
17461
|
+
];
|
|
17462
|
+
const isCardEnabled = useFlag(FlagKey19.EnableCard);
|
|
17463
|
+
const isBrokerageEnabled = useFlag(FlagKey19.EnableBrokerage);
|
|
17464
|
+
const usableAlternativeIcons = icons.filter(({ paymentMethod }) => {
|
|
17465
|
+
if (paymentMethod === type || paymentMethod === "card" /* CARD */ && !isCardEnabled || paymentMethod === "brokerage" /* BROKERAGE */ && !isBrokerageEnabled) {
|
|
17466
|
+
return false;
|
|
17467
|
+
}
|
|
17468
|
+
return true;
|
|
17469
|
+
});
|
|
17228
17470
|
return /* @__PURE__ */ React144.createElement(
|
|
17229
17471
|
Box,
|
|
17230
17472
|
{
|
|
@@ -17279,7 +17521,7 @@ var SourcePaymentMethodItem = ({
|
|
|
17279
17521
|
className: "framer-spmi-animated-logos",
|
|
17280
17522
|
color: "primaryText"
|
|
17281
17523
|
},
|
|
17282
|
-
|
|
17524
|
+
usableAlternativeIcons.slice(0, 3).map(({ icon }) => icon)
|
|
17283
17525
|
)
|
|
17284
17526
|
), /* @__PURE__ */ React144.createElement(ArrowIcon, { direction: "right", size: 20 }))
|
|
17285
17527
|
)
|
|
@@ -17407,90 +17649,6 @@ var YouPayYouReceiveBottomBarLayoutWrapper = ({
|
|
|
17407
17649
|
);
|
|
17408
17650
|
};
|
|
17409
17651
|
|
|
17410
|
-
// src/hooks/queries/useMeldLimits.ts
|
|
17411
|
-
import { getMeldFiatLimits } from "@funkit/api-base";
|
|
17412
|
-
import { formatCurrencyAndStringify as formatCurrencyAndStringify6 } from "@funkit/utils";
|
|
17413
|
-
import { useQuery as useQuery13 } from "@tanstack/react-query";
|
|
17414
|
-
import { useMemo as useMemo23 } from "react";
|
|
17415
|
-
|
|
17416
|
-
// src/hooks/queries/useMeldCryptoCurrencyCode.ts
|
|
17417
|
-
function useMeldCryptoCurrencyCode() {
|
|
17418
|
-
const { checkoutItem } = useCheckoutContext();
|
|
17419
|
-
const _targetChain = checkoutItem?.initSettings.config.targetChain;
|
|
17420
|
-
const _targetAsset = checkoutItem?.initSettings.config.targetAsset;
|
|
17421
|
-
return "USDC_POLYGON";
|
|
17422
|
-
}
|
|
17423
|
-
|
|
17424
|
-
// src/hooks/queries/useMeldLimits.ts
|
|
17425
|
-
var useMeldLimits = (fiatCurrency) => {
|
|
17426
|
-
const { apiKey } = useFunkitConfig();
|
|
17427
|
-
const { userIpInfo } = useFunkitUserIp();
|
|
17428
|
-
const cryptoCurrency = useMeldCryptoCurrencyCode();
|
|
17429
|
-
const query = useQuery13({
|
|
17430
|
-
queryKey: ["meld", "limits", userIpInfo?.alpha2, cryptoCurrency],
|
|
17431
|
-
queryFn: async () => {
|
|
17432
|
-
if (!apiKey || !userIpInfo) return void 0;
|
|
17433
|
-
const { alpha2: countryCode } = userIpInfo;
|
|
17434
|
-
const response = await getMeldFiatLimits({
|
|
17435
|
-
params: {
|
|
17436
|
-
countries: [countryCode],
|
|
17437
|
-
cryptoCurrencies: cryptoCurrency ? [cryptoCurrency] : [],
|
|
17438
|
-
// left out intentionally to preload other currency limits
|
|
17439
|
-
fiatCurrencies: []
|
|
17440
|
-
},
|
|
17441
|
-
apiKey
|
|
17442
|
-
});
|
|
17443
|
-
return response?.limits;
|
|
17444
|
-
},
|
|
17445
|
-
enabled: !!apiKey && !!userIpInfo && !!fiatCurrency && !!cryptoCurrency,
|
|
17446
|
-
refetchOnMount: false,
|
|
17447
|
-
refetchOnReconnect: false,
|
|
17448
|
-
refetchOnWindowFocus: false,
|
|
17449
|
-
staleTime: 1e3 * 60 * 60
|
|
17450
|
-
// 1 hour
|
|
17451
|
-
});
|
|
17452
|
-
return query;
|
|
17453
|
-
};
|
|
17454
|
-
var useMeldLimitError = (amount, fiatCurrency) => {
|
|
17455
|
-
const { data } = useMeldLimits(fiatCurrency);
|
|
17456
|
-
const meldLimit = useMemo23(
|
|
17457
|
-
() => data?.find((lim) => lim.currencyCode === fiatCurrency),
|
|
17458
|
-
[data, fiatCurrency]
|
|
17459
|
-
);
|
|
17460
|
-
if (!meldLimit) return void 0;
|
|
17461
|
-
if (amount < meldLimit.minimumAmount) {
|
|
17462
|
-
const limit = formatCurrencyAndStringify6(
|
|
17463
|
-
meldLimit.minimumAmount ?? 0,
|
|
17464
|
-
{},
|
|
17465
|
-
{
|
|
17466
|
-
currency: fiatCurrency,
|
|
17467
|
-
currencyDisplay: "narrowSymbol",
|
|
17468
|
-
minimumFractionDigits: 0
|
|
17469
|
-
}
|
|
17470
|
-
);
|
|
17471
|
-
return {
|
|
17472
|
-
issue: "Amount below minimum",
|
|
17473
|
-
suggestion: `Input an amount greater than ${limit}.`
|
|
17474
|
-
};
|
|
17475
|
-
}
|
|
17476
|
-
if (amount > meldLimit.maximumAmount) {
|
|
17477
|
-
const limit = formatCurrencyAndStringify6(
|
|
17478
|
-
meldLimit.maximumAmount ?? 0,
|
|
17479
|
-
{},
|
|
17480
|
-
{
|
|
17481
|
-
currency: fiatCurrency,
|
|
17482
|
-
currencyDisplay: "narrowSymbol",
|
|
17483
|
-
minimumFractionDigits: 0
|
|
17484
|
-
}
|
|
17485
|
-
);
|
|
17486
|
-
return {
|
|
17487
|
-
issue: "Amount above maximum",
|
|
17488
|
-
suggestion: `Input an amount lower than ${limit}.`
|
|
17489
|
-
};
|
|
17490
|
-
}
|
|
17491
|
-
return void 0;
|
|
17492
|
-
};
|
|
17493
|
-
|
|
17494
17652
|
// src/components/Icons/SwitchIcon.tsx
|
|
17495
17653
|
import React147 from "react";
|
|
17496
17654
|
var SwitchIcon = () => {
|
|
@@ -17742,36 +17900,23 @@ function InputAmountLayout({
|
|
|
17742
17900
|
}
|
|
17743
17901
|
|
|
17744
17902
|
// src/modals/CheckoutModal/InputAmount/QuickOptions.tsx
|
|
17745
|
-
import { FlagKey as
|
|
17746
|
-
import React149
|
|
17903
|
+
import { FlagKey as FlagKey20, clamp, formatCurrencyAndStringify as formatCurrencyAndStringify7 } from "@funkit/utils";
|
|
17904
|
+
import React149 from "react";
|
|
17747
17905
|
var USD_AMOUNT_OPTIONS_PCT = [25, 50, 75, 100];
|
|
17748
|
-
var USD_AMOUNT_OPTIONS = [100, 500, 1e3];
|
|
17749
17906
|
function deduplicateArray(arr) {
|
|
17750
17907
|
return Array.from(new Set(arr));
|
|
17751
17908
|
}
|
|
17752
|
-
function useFiatAmountOptions(
|
|
17753
|
-
const currencyQuickOptionStr = useFlag(
|
|
17909
|
+
function useFiatAmountOptions(currency) {
|
|
17910
|
+
const currencyQuickOptionStr = useFlag(FlagKey20.MeldQuickOptions);
|
|
17754
17911
|
const currencyQuickOption = safeJSONParse(
|
|
17755
17912
|
currencyQuickOptionStr
|
|
17756
17913
|
);
|
|
17757
|
-
const { data:
|
|
17758
|
-
const meldLimit = useMemo24(
|
|
17759
|
-
() => limits?.find((lim) => lim.currencyCode === currency),
|
|
17760
|
-
[limits, currency]
|
|
17761
|
-
);
|
|
17762
|
-
if (percentMode) {
|
|
17763
|
-
return USD_AMOUNT_OPTIONS_PCT;
|
|
17764
|
-
}
|
|
17914
|
+
const { data: meldLimit, isPending } = useMeldLimit(currency);
|
|
17765
17915
|
if (isPending || !meldLimit) {
|
|
17766
17916
|
return [];
|
|
17767
17917
|
}
|
|
17768
17918
|
const minimumAmount = meldLimit.minimumAmount;
|
|
17769
17919
|
const maximumAmount = meldLimit.maximumAmount;
|
|
17770
|
-
if (currency === "USD") {
|
|
17771
|
-
return deduplicateArray(
|
|
17772
|
-
USD_AMOUNT_OPTIONS.map((val) => clamp(val, minimumAmount, maximumAmount))
|
|
17773
|
-
);
|
|
17774
|
-
}
|
|
17775
17920
|
return deduplicateArray(
|
|
17776
17921
|
currencyQuickOption?.[currency]?.map(
|
|
17777
17922
|
(val) => clamp(val, minimumAmount, maximumAmount)
|
|
@@ -17779,42 +17924,44 @@ function useFiatAmountOptions(percentMode, currency) {
|
|
|
17779
17924
|
);
|
|
17780
17925
|
}
|
|
17781
17926
|
var QuickOptions = ({
|
|
17782
|
-
|
|
17783
|
-
percentMode = true,
|
|
17927
|
+
currency = "USD",
|
|
17784
17928
|
disabled = false,
|
|
17785
|
-
|
|
17929
|
+
onSelect,
|
|
17930
|
+
options,
|
|
17931
|
+
percentMode = true
|
|
17786
17932
|
}) => {
|
|
17787
|
-
|
|
17788
|
-
|
|
17789
|
-
|
|
17790
|
-
{
|
|
17791
|
-
borderRadius: "actionButton",
|
|
17792
|
-
fontSize: "14",
|
|
17793
|
-
fontWeight: "medium",
|
|
17794
|
-
color: "primaryText",
|
|
17795
|
-
icon: null,
|
|
17796
|
-
isDisabled: disabled,
|
|
17797
|
-
key: `${option}-${index}`,
|
|
17798
|
-
onClick: () => onSelect?.(option),
|
|
17799
|
-
paddingX: "12",
|
|
17800
|
-
size: "36",
|
|
17801
|
-
variant: "filled",
|
|
17802
|
-
colorOverrides: {
|
|
17803
|
-
baseBackground: "inputAmountQuickOptionBaseBackground",
|
|
17804
|
-
hoverBackground: "inputAmountQuickOptionHoverBackground",
|
|
17805
|
-
activeBackground: "inputAmountQuickOptionActiveBackground"
|
|
17806
|
-
}
|
|
17807
|
-
},
|
|
17808
|
-
!percentMode ? formatCurrencyAndStringify7(
|
|
17809
|
-
option,
|
|
17810
|
-
{},
|
|
17933
|
+
return (percentMode ? USD_AMOUNT_OPTIONS_PCT : options)?.map(
|
|
17934
|
+
(option, index) => /* @__PURE__ */ React149.createElement(
|
|
17935
|
+
FunIconButton,
|
|
17811
17936
|
{
|
|
17812
|
-
|
|
17813
|
-
|
|
17814
|
-
|
|
17815
|
-
|
|
17816
|
-
|
|
17817
|
-
|
|
17937
|
+
borderRadius: "actionButton",
|
|
17938
|
+
fontSize: "14",
|
|
17939
|
+
fontWeight: "medium",
|
|
17940
|
+
color: "primaryText",
|
|
17941
|
+
icon: null,
|
|
17942
|
+
isDisabled: disabled,
|
|
17943
|
+
key: `${option}-${index}`,
|
|
17944
|
+
onClick: () => onSelect?.(option),
|
|
17945
|
+
paddingX: "12",
|
|
17946
|
+
size: "36",
|
|
17947
|
+
variant: "filled",
|
|
17948
|
+
colorOverrides: {
|
|
17949
|
+
baseBackground: "inputAmountQuickOptionBaseBackground",
|
|
17950
|
+
hoverBackground: "inputAmountQuickOptionHoverBackground",
|
|
17951
|
+
activeBackground: "inputAmountQuickOptionActiveBackground"
|
|
17952
|
+
}
|
|
17953
|
+
},
|
|
17954
|
+
!percentMode ? formatCurrencyAndStringify7(
|
|
17955
|
+
option,
|
|
17956
|
+
{},
|
|
17957
|
+
{
|
|
17958
|
+
minimumFractionDigits: 0,
|
|
17959
|
+
currency,
|
|
17960
|
+
currencyDisplay: "narrowSymbol"
|
|
17961
|
+
}
|
|
17962
|
+
) : option === 100 ? "Max" : `${option}%`
|
|
17963
|
+
)
|
|
17964
|
+
);
|
|
17818
17965
|
};
|
|
17819
17966
|
|
|
17820
17967
|
// src/modals/CheckoutModal/InputAmount/useAmountInput.ts
|
|
@@ -17827,12 +17974,12 @@ import {
|
|
|
17827
17974
|
// src/modals/CheckoutModal/InputAmount/state.ts
|
|
17828
17975
|
import { round as round2 } from "@funkit/utils";
|
|
17829
17976
|
function getInputValueFromAmount(params) {
|
|
17830
|
-
const amount = params.
|
|
17977
|
+
const amount = params.isInputInFiat ? params.fiatAmount : params.assetAmount;
|
|
17831
17978
|
if (!amount) return "";
|
|
17832
17979
|
const formattedAmount = amount.toFixed(
|
|
17833
|
-
params.
|
|
17980
|
+
params.isInputInFiat ? USD_DECIMALS : ASSET_DECIMALS
|
|
17834
17981
|
);
|
|
17835
|
-
return params.
|
|
17982
|
+
return params.isInputInFiat ? params.currencySymbol + formattedAmount : formattedAmount;
|
|
17836
17983
|
}
|
|
17837
17984
|
function initializeState({
|
|
17838
17985
|
apiKey,
|
|
@@ -17843,10 +17990,12 @@ function initializeState({
|
|
|
17843
17990
|
sourceHolding,
|
|
17844
17991
|
unitPrice,
|
|
17845
17992
|
defaultAmount,
|
|
17846
|
-
fiatCurrency = "USD"
|
|
17993
|
+
fiatCurrency = "USD",
|
|
17994
|
+
quickOptions
|
|
17847
17995
|
}) {
|
|
17848
17996
|
const { targetAssetAmount, targetChain } = checkoutConfig;
|
|
17849
|
-
const
|
|
17997
|
+
const isCardCheckout = paymentMethod === "card" /* CARD */;
|
|
17998
|
+
const isInputInFiat = true;
|
|
17850
17999
|
const usdAvailableAmount = getUsdAvailableAmount(
|
|
17851
18000
|
targetChain,
|
|
17852
18001
|
sourceHolding?.pickedChainId,
|
|
@@ -17862,26 +18011,27 @@ function initializeState({
|
|
|
17862
18011
|
);
|
|
17863
18012
|
const usdMaxAmount = getUsdMaxAmount(maxUsd);
|
|
17864
18013
|
const usdMinAmount = getUsdMinAmount(paymentMethod, minUsd);
|
|
17865
|
-
const
|
|
17866
|
-
const
|
|
17867
|
-
Math.max(
|
|
18014
|
+
const initialFiatAmount = defaultAmount ?? (isCardCheckout ? getDefaultAmountFromQuickOptions(quickOptions) : targetAssetAmount === void 0 ? USD_INITIAL_AMOUNT : targetAssetAmount * unitPrice);
|
|
18015
|
+
const finalFiatAmount = initialFiatAmount === void 0 ? void 0 : Math.min(
|
|
18016
|
+
Math.max(initialFiatAmount, usdMinAmount, 0),
|
|
17868
18017
|
usdAvailableAmount ?? Number.MAX_VALUE,
|
|
17869
18018
|
usdMaxAmount ?? Number.MAX_VALUE
|
|
17870
18019
|
);
|
|
17871
|
-
const rounding =
|
|
17872
|
-
const assetAmount =
|
|
17873
|
-
const
|
|
18020
|
+
const rounding = finalFiatAmount === initialFiatAmount ? "round" : finalFiatAmount === usdMinAmount ? "ceil" : "floor";
|
|
18021
|
+
const assetAmount = finalFiatAmount ? targetAssetAmount && finalFiatAmount === targetAssetAmount * unitPrice ? targetAssetAmount : finalFiatAmount / unitPrice || 0 : 0;
|
|
18022
|
+
const fiatAmount = finalFiatAmount ? round2(finalFiatAmount, USD_DECIMALS, rounding) : 0;
|
|
17874
18023
|
const inputValue = getInputValueFromAmount({
|
|
17875
18024
|
assetAmount,
|
|
17876
|
-
|
|
17877
|
-
|
|
17878
|
-
|
|
18025
|
+
currencySymbol: getCurrencySymbol(fiatCurrency),
|
|
18026
|
+
isInputInFiat,
|
|
18027
|
+
fiatAmount
|
|
17879
18028
|
});
|
|
17880
18029
|
return {
|
|
17881
18030
|
assetAmount,
|
|
18031
|
+
fiatAmount,
|
|
18032
|
+
fiatCurrency,
|
|
17882
18033
|
inputValue,
|
|
17883
|
-
|
|
17884
|
-
usdAmount,
|
|
18034
|
+
isInputInFiat,
|
|
17885
18035
|
usdAvailableAmount,
|
|
17886
18036
|
usdMaxAmount,
|
|
17887
18037
|
usdMinAmount
|
|
@@ -17889,10 +18039,10 @@ function initializeState({
|
|
|
17889
18039
|
}
|
|
17890
18040
|
function reduceState(state, action) {
|
|
17891
18041
|
switch (action.type) {
|
|
17892
|
-
case "
|
|
18042
|
+
case "toggleInputInFiat": {
|
|
17893
18043
|
const newState = {
|
|
17894
18044
|
...state,
|
|
17895
|
-
|
|
18045
|
+
isInputInFiat: !state.isInputInFiat
|
|
17896
18046
|
};
|
|
17897
18047
|
const inputValue = getInputValueFromAmount({
|
|
17898
18048
|
...newState,
|
|
@@ -17901,83 +18051,84 @@ function reduceState(state, action) {
|
|
|
17901
18051
|
return { ...newState, inputValue };
|
|
17902
18052
|
}
|
|
17903
18053
|
case "setInputValue": {
|
|
17904
|
-
const { inputValue: rawInputValue, unitPrice
|
|
17905
|
-
const currencySymbol = getCurrencySymbol(fiatCurrency);
|
|
17906
|
-
const regex = state.
|
|
18054
|
+
const { inputValue: rawInputValue, unitPrice } = action;
|
|
18055
|
+
const currencySymbol = getCurrencySymbol(state.fiatCurrency);
|
|
18056
|
+
const regex = state.isInputInFiat ? /\d+(\.\d{0,2})?/ : /\d+(\.\d{0,5})?/;
|
|
17907
18057
|
const match = regex.exec(rawInputValue);
|
|
17908
18058
|
const numericInputValue = match?.[0] || "";
|
|
17909
|
-
const newInputValue = numericInputValue && state.
|
|
18059
|
+
const newInputValue = numericInputValue && state.isInputInFiat ? `${currencySymbol}${numericInputValue}` : numericInputValue;
|
|
17910
18060
|
if (newInputValue === state.inputValue) return state;
|
|
17911
18061
|
const newInputAmount = Number.parseFloat(numericInputValue) || 0;
|
|
17912
|
-
if (state.
|
|
18062
|
+
if (state.isInputInFiat) {
|
|
17913
18063
|
return {
|
|
17914
18064
|
...state,
|
|
17915
18065
|
assetAmount: newInputAmount / unitPrice || 0,
|
|
17916
18066
|
inputValue: newInputValue,
|
|
17917
|
-
|
|
18067
|
+
fiatAmount: newInputAmount
|
|
17918
18068
|
};
|
|
17919
18069
|
}
|
|
17920
18070
|
return {
|
|
17921
18071
|
...state,
|
|
17922
18072
|
assetAmount: newInputAmount,
|
|
17923
18073
|
inputValue: newInputValue,
|
|
17924
|
-
|
|
18074
|
+
fiatAmount: round2(newInputAmount * unitPrice, USD_DECIMALS)
|
|
17925
18075
|
};
|
|
17926
18076
|
}
|
|
17927
|
-
case "
|
|
18077
|
+
case "setFiatCurrency": {
|
|
17928
18078
|
const inputValue = getInputValueFromAmount({
|
|
17929
18079
|
...state,
|
|
17930
18080
|
currencySymbol: getCurrencySymbol(action.fiatCurrency)
|
|
17931
18081
|
});
|
|
17932
18082
|
return {
|
|
17933
18083
|
...state,
|
|
18084
|
+
fiatCurrency: action.fiatCurrency,
|
|
17934
18085
|
inputValue
|
|
17935
18086
|
};
|
|
17936
18087
|
}
|
|
17937
|
-
case "
|
|
17938
|
-
const { unitPrice,
|
|
17939
|
-
const assetAmount =
|
|
18088
|
+
case "setFiatAmount": {
|
|
18089
|
+
const { unitPrice, fiatAmount } = action;
|
|
18090
|
+
const assetAmount = fiatAmount / unitPrice || 0;
|
|
17940
18091
|
const inputValue = getInputValueFromAmount({
|
|
17941
|
-
isInputInUsd: state.isInputInUsd,
|
|
17942
18092
|
assetAmount,
|
|
17943
|
-
|
|
17944
|
-
|
|
18093
|
+
currencySymbol: getCurrencySymbol(state.fiatCurrency),
|
|
18094
|
+
fiatAmount,
|
|
18095
|
+
isInputInFiat: state.isInputInFiat
|
|
17945
18096
|
});
|
|
17946
18097
|
return {
|
|
17947
18098
|
...state,
|
|
17948
18099
|
assetAmount,
|
|
17949
|
-
|
|
18100
|
+
fiatAmount,
|
|
17950
18101
|
inputValue
|
|
17951
18102
|
};
|
|
17952
18103
|
}
|
|
17953
18104
|
}
|
|
17954
18105
|
}
|
|
17955
18106
|
function getAmountInputError(state) {
|
|
17956
|
-
const {
|
|
18107
|
+
const { fiatAmount, usdAvailableAmount, usdMaxAmount, usdMinAmount } = state;
|
|
17957
18108
|
if (usdAvailableAmount === 0) {
|
|
17958
18109
|
return {
|
|
17959
18110
|
type: "noAvailableBalance"
|
|
17960
18111
|
};
|
|
17961
18112
|
}
|
|
17962
|
-
if (usdAvailableAmount &&
|
|
18113
|
+
if (usdAvailableAmount && fiatAmount > usdAvailableAmount) {
|
|
17963
18114
|
return {
|
|
17964
18115
|
type: "aboveAvailable",
|
|
17965
18116
|
usdAvailableAmount
|
|
17966
18117
|
};
|
|
17967
18118
|
}
|
|
17968
|
-
if (usdMaxAmount &&
|
|
18119
|
+
if (usdMaxAmount && fiatAmount > usdMaxAmount) {
|
|
17969
18120
|
return {
|
|
17970
18121
|
type: "aboveMax",
|
|
17971
18122
|
usdMaxAmount
|
|
17972
18123
|
};
|
|
17973
18124
|
}
|
|
17974
|
-
if (usdMinAmount &&
|
|
18125
|
+
if (usdMinAmount && fiatAmount < usdMinAmount) {
|
|
17975
18126
|
return {
|
|
17976
18127
|
type: "belowMin",
|
|
17977
18128
|
usdMinAmount
|
|
17978
18129
|
};
|
|
17979
18130
|
}
|
|
17980
|
-
if (
|
|
18131
|
+
if (fiatAmount === 0) {
|
|
17981
18132
|
return {
|
|
17982
18133
|
type: "noInput"
|
|
17983
18134
|
};
|
|
@@ -17995,10 +18146,12 @@ function getDerivedState(state) {
|
|
|
17995
18146
|
// src/modals/CheckoutModal/InputAmount/useAmountInput.ts
|
|
17996
18147
|
function useAmountInput(options) {
|
|
17997
18148
|
const [state, dispatch] = useReducer3(reduceState, options, initializeState);
|
|
18149
|
+
const isCardCheckout = options.paymentMethod === "card" /* CARD */;
|
|
17998
18150
|
const {
|
|
17999
18151
|
unitPrice: realUnitPrice,
|
|
18000
18152
|
checkoutConfig,
|
|
18001
|
-
fiatCurrency = "USD"
|
|
18153
|
+
fiatCurrency = "USD",
|
|
18154
|
+
quickOptions
|
|
18002
18155
|
} = options;
|
|
18003
18156
|
const unitPrice = isStablecoin(checkoutConfig.targetAssetTicker) ? 1 : realUnitPrice;
|
|
18004
18157
|
const dispatchAndGetNewState = useCallback28(
|
|
@@ -18013,41 +18166,60 @@ function useAmountInput(options) {
|
|
|
18013
18166
|
dispatch({
|
|
18014
18167
|
type: "setInputValue",
|
|
18015
18168
|
inputValue: event.target.value,
|
|
18016
|
-
unitPrice
|
|
18017
|
-
fiatCurrency
|
|
18169
|
+
unitPrice
|
|
18018
18170
|
});
|
|
18019
18171
|
},
|
|
18020
|
-
[unitPrice
|
|
18021
|
-
);
|
|
18022
|
-
useEffect27(
|
|
18023
|
-
() => dispatch({ type: "changeFiatCurrency", fiatCurrency }),
|
|
18024
|
-
[fiatCurrency]
|
|
18172
|
+
[unitPrice]
|
|
18025
18173
|
);
|
|
18026
|
-
const
|
|
18027
|
-
|
|
18028
|
-
|
|
18029
|
-
|
|
18030
|
-
|
|
18031
|
-
|
|
18174
|
+
const defaultAmount = isCardCheckout ? getDefaultAmountFromQuickOptions(quickOptions) : void 0;
|
|
18175
|
+
useEffect27(() => {
|
|
18176
|
+
if (state.fiatCurrency !== fiatCurrency) {
|
|
18177
|
+
dispatch({
|
|
18178
|
+
type: "setFiatCurrency",
|
|
18179
|
+
fiatCurrency
|
|
18180
|
+
});
|
|
18181
|
+
if (state.isInputInFiat) {
|
|
18182
|
+
dispatch({
|
|
18183
|
+
type: "setFiatAmount",
|
|
18184
|
+
fiatAmount: defaultAmount ?? 0,
|
|
18185
|
+
unitPrice
|
|
18186
|
+
});
|
|
18187
|
+
}
|
|
18188
|
+
}
|
|
18189
|
+
}, [fiatCurrency]);
|
|
18190
|
+
useEffect27(() => {
|
|
18191
|
+
if (defaultAmount && state.inputValue === "") {
|
|
18192
|
+
dispatch({
|
|
18193
|
+
type: "setFiatAmount",
|
|
18194
|
+
fiatAmount: defaultAmount,
|
|
18195
|
+
unitPrice
|
|
18196
|
+
});
|
|
18197
|
+
}
|
|
18198
|
+
}, [defaultAmount]);
|
|
18199
|
+
const setFiatAmount = useCallback28(
|
|
18200
|
+
(fiatAmount) => dispatchAndGetNewState({
|
|
18201
|
+
type: "setFiatAmount",
|
|
18202
|
+
fiatAmount,
|
|
18203
|
+
unitPrice
|
|
18032
18204
|
}),
|
|
18033
|
-
[dispatchAndGetNewState, unitPrice
|
|
18205
|
+
[dispatchAndGetNewState, unitPrice]
|
|
18034
18206
|
);
|
|
18035
18207
|
const derivedState = getDerivedState(state);
|
|
18036
|
-
const
|
|
18037
|
-
() => dispatch({ type: "
|
|
18208
|
+
const toggleInputInFiat = useCallback28(
|
|
18209
|
+
() => dispatch({ type: "toggleInputInFiat" }),
|
|
18038
18210
|
[]
|
|
18039
18211
|
);
|
|
18040
18212
|
return {
|
|
18041
18213
|
...derivedState,
|
|
18042
18214
|
onChange,
|
|
18043
|
-
|
|
18044
|
-
setUsdAmount,
|
|
18045
|
-
placeholder: state.isInputInUsd ? formatCurrencyAndStringify8(
|
|
18215
|
+
placeholder: state.isInputInFiat ? formatCurrencyAndStringify8(
|
|
18046
18216
|
0,
|
|
18047
18217
|
{},
|
|
18048
18218
|
{ currency: fiatCurrency, currencyDisplay: "narrowSymbol" }
|
|
18049
18219
|
) : formatCryptoAndStringify3(0),
|
|
18050
|
-
|
|
18220
|
+
setFiatAmount,
|
|
18221
|
+
suggestion: getInputAmountSuggestion(derivedState.inputError),
|
|
18222
|
+
toggleInputInFiat
|
|
18051
18223
|
};
|
|
18052
18224
|
}
|
|
18053
18225
|
|
|
@@ -18080,29 +18252,30 @@ function InputAmountLoaded({
|
|
|
18080
18252
|
onNext,
|
|
18081
18253
|
sourceHolding,
|
|
18082
18254
|
unitPrice,
|
|
18083
|
-
defaultFiatCurrency,
|
|
18255
|
+
defaultFiatCurrency = "USD",
|
|
18084
18256
|
textCustomizations
|
|
18085
18257
|
}) {
|
|
18086
|
-
const maxCheckoutUsdString = useFlag(
|
|
18258
|
+
const maxCheckoutUsdString = useFlag(FlagKey21.MaxCheckoutUsd);
|
|
18087
18259
|
const { apiKey } = useFunkitConfig();
|
|
18088
18260
|
const { paymentMethod } = modalState.paymentMethodInfo;
|
|
18089
18261
|
const { quote: manuallySelectedQuote } = modalState;
|
|
18090
18262
|
const isCardCheckout = paymentMethod === "card" /* CARD */;
|
|
18091
|
-
const meldEnabled = useFlag(
|
|
18263
|
+
const meldEnabled = useFlag(FlagKey21.EnableMeldPayment) && isCardCheckout;
|
|
18092
18264
|
const { targetAssetTicker, targetAssetMinAmount } = checkoutConfig;
|
|
18093
18265
|
const { updateTargetAssetAmount } = useCheckoutContext();
|
|
18094
18266
|
const minUsd = targetAssetMinAmount && unitPrice ? Math.ceil(targetAssetMinAmount * unitPrice * 100) / 100 : void 0;
|
|
18095
18267
|
const fiatCurrency = modalState.fiatCurrency ?? defaultFiatCurrency;
|
|
18268
|
+
const quickOptions = useFiatAmountOptions(fiatCurrency);
|
|
18096
18269
|
const {
|
|
18097
18270
|
assetAmount,
|
|
18098
18271
|
inputError,
|
|
18099
18272
|
inputValue,
|
|
18100
|
-
|
|
18273
|
+
isInputInFiat,
|
|
18101
18274
|
isValid,
|
|
18102
18275
|
onChange,
|
|
18103
|
-
|
|
18104
|
-
|
|
18105
|
-
|
|
18276
|
+
toggleInputInFiat,
|
|
18277
|
+
setFiatAmount,
|
|
18278
|
+
fiatAmount,
|
|
18106
18279
|
usdAvailableAmount,
|
|
18107
18280
|
placeholder,
|
|
18108
18281
|
suggestion
|
|
@@ -18115,6 +18288,7 @@ function InputAmountLoaded({
|
|
|
18115
18288
|
unitPrice,
|
|
18116
18289
|
maxUsd: Number.parseFloat(maxCheckoutUsdString),
|
|
18117
18290
|
minUsd,
|
|
18291
|
+
quickOptions,
|
|
18118
18292
|
fiatCurrency
|
|
18119
18293
|
});
|
|
18120
18294
|
const {
|
|
@@ -18125,8 +18299,8 @@ function InputAmountLoaded({
|
|
|
18125
18299
|
bestRateQuote,
|
|
18126
18300
|
selectedQuote,
|
|
18127
18301
|
isSelectedQuoteUnavailable
|
|
18128
|
-
} = useMeld(manuallySelectedQuote,
|
|
18129
|
-
const error =
|
|
18302
|
+
} = useMeld(manuallySelectedQuote, fiatAmount, fiatCurrency);
|
|
18303
|
+
const error = useMemo22(() => {
|
|
18130
18304
|
if (isCardCheckout) {
|
|
18131
18305
|
if (isSelectedQuoteUnavailable) {
|
|
18132
18306
|
return {
|
|
@@ -18164,7 +18338,7 @@ function InputAmountLoaded({
|
|
|
18164
18338
|
]);
|
|
18165
18339
|
const { ref, fontSize, resetText } = useDynamicFont(inputValue || placeholder);
|
|
18166
18340
|
const handleIsAmountInAbsoluteToggle = () => {
|
|
18167
|
-
|
|
18341
|
+
toggleInputInFiat();
|
|
18168
18342
|
resetText();
|
|
18169
18343
|
};
|
|
18170
18344
|
const handleContinue = async (assetAmount2) => {
|
|
@@ -18177,7 +18351,7 @@ function InputAmountLoaded({
|
|
|
18177
18351
|
};
|
|
18178
18352
|
const handleSubmit = () => {
|
|
18179
18353
|
if (!suggestion) return handleContinue(assetAmount);
|
|
18180
|
-
const newState =
|
|
18354
|
+
const newState = setFiatAmount(suggestion.usdAmount);
|
|
18181
18355
|
if (suggestion.autoConfirm && newState.isValid) {
|
|
18182
18356
|
handleContinue(newState.assetAmount);
|
|
18183
18357
|
}
|
|
@@ -18188,10 +18362,10 @@ function InputAmountLoaded({
|
|
|
18188
18362
|
handleSubmit();
|
|
18189
18363
|
};
|
|
18190
18364
|
const displayAssetAmount = round3(
|
|
18191
|
-
isStablecoin(targetAssetTicker) ?
|
|
18365
|
+
isStablecoin(targetAssetTicker) ? fiatAmount : assetAmount,
|
|
18192
18366
|
ASSET_DECIMALS
|
|
18193
18367
|
);
|
|
18194
|
-
const isConvertedAmountShown = targetAssetTicker && (!
|
|
18368
|
+
const isConvertedAmountShown = targetAssetTicker && (!isInputInFiat || isCardCheckout && fiatCurrency === "USD" || !isCardCheckout);
|
|
18195
18369
|
const isMeldContinueDisabled = meldEnabled && (!!meldLimitError || isMeldLinkPending || !!meldQuotesQuery.error || meldQuotesQuery.isFetching || isSelectedQuoteUnavailable);
|
|
18196
18370
|
return /* @__PURE__ */ React150.createElement(
|
|
18197
18371
|
InputAmountLayout,
|
|
@@ -18207,7 +18381,7 @@ function InputAmountLoaded({
|
|
|
18207
18381
|
{
|
|
18208
18382
|
selectedCurrency: fiatCurrency,
|
|
18209
18383
|
onClick: (fiatCurrency2) => onNext({
|
|
18210
|
-
fiatAmount
|
|
18384
|
+
fiatAmount,
|
|
18211
18385
|
fiatCurrency: fiatCurrency2,
|
|
18212
18386
|
nextStep: "meld_currency_select" /* MELD_CURRENCY_SELECT */
|
|
18213
18387
|
})
|
|
@@ -18221,8 +18395,7 @@ function InputAmountLoaded({
|
|
|
18221
18395
|
keyIcon: /* @__PURE__ */ React150.createElement(CreditCardIcon, { size: 16 }),
|
|
18222
18396
|
onClick: () => onNext({
|
|
18223
18397
|
nextStep: "source_change" /* SOURCE_CHANGE */,
|
|
18224
|
-
fiatAmount
|
|
18225
|
-
navigateToHistoryStep: true
|
|
18398
|
+
fiatAmount
|
|
18226
18399
|
})
|
|
18227
18400
|
}
|
|
18228
18401
|
)),
|
|
@@ -18244,7 +18417,7 @@ function InputAmountLoaded({
|
|
|
18244
18417
|
onChange,
|
|
18245
18418
|
onKeyDown: handleKeyDown,
|
|
18246
18419
|
inputProps: {
|
|
18247
|
-
type:
|
|
18420
|
+
type: isInputInFiat ? "text" : "number",
|
|
18248
18421
|
autoFocus: true,
|
|
18249
18422
|
spellCheck: false,
|
|
18250
18423
|
// get ios to use numpad key with period
|
|
@@ -18280,28 +18453,29 @@ function InputAmountLoaded({
|
|
|
18280
18453
|
borderRadius: "inputAmountSwitcher",
|
|
18281
18454
|
isDisabled: isCardCheckout
|
|
18282
18455
|
},
|
|
18283
|
-
/* @__PURE__ */ React150.createElement(Text, { color: "secondaryText", size: "14" },
|
|
18456
|
+
/* @__PURE__ */ React150.createElement(Text, { color: "secondaryText", size: "14" }, isInputInFiat ? formatCryptoAndStringify4(
|
|
18284
18457
|
displayAssetAmount,
|
|
18285
18458
|
targetAssetTicker
|
|
18286
|
-
) : formatCurrencyAndStringify9(
|
|
18459
|
+
) : formatCurrencyAndStringify9(fiatAmount))
|
|
18287
18460
|
)
|
|
18288
18461
|
),
|
|
18289
18462
|
amountOptions: (!!usdAvailableAmount || isCardCheckout) && /* @__PURE__ */ React150.createElement(
|
|
18290
18463
|
QuickOptions,
|
|
18291
18464
|
{
|
|
18292
|
-
percentMode: !isCardCheckout,
|
|
18293
18465
|
currency: fiatCurrency,
|
|
18294
18466
|
onSelect: (option) => {
|
|
18295
18467
|
const selectedOption = usdAvailableAmount && !isCardCheckout ? usdAvailableAmount * (option / 100) : option;
|
|
18296
|
-
|
|
18297
|
-
}
|
|
18468
|
+
setFiatAmount(selectedOption);
|
|
18469
|
+
},
|
|
18470
|
+
options: quickOptions,
|
|
18471
|
+
percentMode: !isCardCheckout
|
|
18298
18472
|
}
|
|
18299
18473
|
),
|
|
18300
18474
|
footer: meldEnabled ? /* @__PURE__ */ React150.createElement(Box, { paddingX: "6" }, /* @__PURE__ */ React150.createElement(
|
|
18301
18475
|
SourceMeldQuoteItem,
|
|
18302
18476
|
{
|
|
18303
18477
|
onClick: () => onNext({
|
|
18304
|
-
fiatAmount
|
|
18478
|
+
fiatAmount,
|
|
18305
18479
|
fiatCurrency,
|
|
18306
18480
|
provider: selectedQuote?.serviceProvider,
|
|
18307
18481
|
nextStep: "meld_quotes" /* MELD_QUOTES */
|
|
@@ -18369,8 +18543,8 @@ function YouPayYouReceiveWrapper({
|
|
|
18369
18543
|
}
|
|
18370
18544
|
|
|
18371
18545
|
// src/modals/CheckoutModal/InputAmount/InputAmountLoading.tsx
|
|
18372
|
-
import { FlagKey as
|
|
18373
|
-
import React151, { useMemo as
|
|
18546
|
+
import { FlagKey as FlagKey22, formatCryptoAndStringify as formatCryptoAndStringify5 } from "@funkit/utils";
|
|
18547
|
+
import React151, { useMemo as useMemo23 } from "react";
|
|
18374
18548
|
function InputAmountLoading({
|
|
18375
18549
|
modalState,
|
|
18376
18550
|
onBack,
|
|
@@ -18380,10 +18554,10 @@ function InputAmountLoading({
|
|
|
18380
18554
|
const { paymentMethodInfo } = modalState;
|
|
18381
18555
|
const { checkoutItem } = useCheckoutContext();
|
|
18382
18556
|
const { unlinkBrokerage } = useFunkitMesh();
|
|
18383
|
-
const meldEnabled = useFlag(
|
|
18557
|
+
const meldEnabled = useFlag(FlagKey22.EnableMeldPayment);
|
|
18384
18558
|
const targetAssetAmount = checkoutItem?.initSettings.config.targetAssetAmount;
|
|
18385
18559
|
const targetAssetTicker = checkoutItem?.initSettings.config.targetAssetTicker;
|
|
18386
|
-
const error =
|
|
18560
|
+
const error = useMemo23(() => {
|
|
18387
18561
|
if (sourceHoldingError) {
|
|
18388
18562
|
return {
|
|
18389
18563
|
message: /* @__PURE__ */ React151.createElement("div", null, "Unable to retrieve your account balance. Please try re-linking your account.", " ", paymentMethodInfo.paymentMethod === "brokerage" /* BROKERAGE */ && /* @__PURE__ */ React151.createElement(
|
|
@@ -18462,7 +18636,7 @@ function InputAmountLoading({
|
|
|
18462
18636
|
)
|
|
18463
18637
|
)
|
|
18464
18638
|
),
|
|
18465
|
-
amountOptions: /* @__PURE__ */ React151.createElement(QuickOptions, { disabled: true, percentMode:
|
|
18639
|
+
amountOptions: !isCardCheckout && /* @__PURE__ */ React151.createElement(QuickOptions, { disabled: true, options: USD_AMOUNT_OPTIONS_PCT, percentMode: true }),
|
|
18466
18640
|
footer: isMeldCheckout ? /* @__PURE__ */ React151.createElement(Box, { paddingX: "6" }, /* @__PURE__ */ React151.createElement(SourceMeldQuoteItem, { isLoading: true })) : /* @__PURE__ */ React151.createElement(YouPayYouReceiveBottomBarLayoutWrapper, null, /* @__PURE__ */ React151.createElement(
|
|
18467
18641
|
FunSkeletonBlock,
|
|
18468
18642
|
{
|
|
@@ -18551,7 +18725,7 @@ function useAssetPrice({
|
|
|
18551
18725
|
}
|
|
18552
18726
|
|
|
18553
18727
|
// src/modals/CheckoutModal/InputAmount/useAvailableBalanceForCheckout.ts
|
|
18554
|
-
import { useMemo as
|
|
18728
|
+
import { useMemo as useMemo24 } from "react";
|
|
18555
18729
|
function useAvailableBalanceForCheckout(paymentMethodInfo, targetChainId, assetChainId, assetSymbol) {
|
|
18556
18730
|
const {
|
|
18557
18731
|
data: meshAssetHoldings,
|
|
@@ -18569,7 +18743,7 @@ function useAvailableBalanceForCheckout(paymentMethodInfo, targetChainId, assetC
|
|
|
18569
18743
|
["token_transfer" /* TOKEN_TRANSFER */]: null,
|
|
18570
18744
|
["virtual_bank" /* VIRTUAL_BANK */]: null
|
|
18571
18745
|
}[paymentMethodInfo.paymentMethod];
|
|
18572
|
-
const holdingItem =
|
|
18746
|
+
const holdingItem = useMemo24(() => {
|
|
18573
18747
|
if (!assetSymbol || !holdings) {
|
|
18574
18748
|
return;
|
|
18575
18749
|
}
|
|
@@ -18645,7 +18819,9 @@ function InputAmount(props) {
|
|
|
18645
18819
|
checkoutItem?.selectedSourceAssetInfo.symbol ?? null
|
|
18646
18820
|
);
|
|
18647
18821
|
const { data: defaultCurrency, isLoading: isMeldDefaultCurrencyLoading } = useMeldDefaultCurrency(paymentMethodInfo.paymentMethod);
|
|
18648
|
-
|
|
18822
|
+
const isMeld = paymentMethodInfo.paymentMethod === "card" /* CARD */;
|
|
18823
|
+
useMeldCurrencies(isMeld);
|
|
18824
|
+
useMeldLimits(isMeld);
|
|
18649
18825
|
const { error: unitPriceError, unitPrice } = useAssetPrice({
|
|
18650
18826
|
chainId: checkoutItem?.initSettings.config.targetChain,
|
|
18651
18827
|
assetTokenAddress: checkoutItem?.initSettings.config.targetAsset
|
|
@@ -18679,7 +18855,7 @@ function InputAmount(props) {
|
|
|
18679
18855
|
import React155, { useEffect as useEffect29 } from "react";
|
|
18680
18856
|
|
|
18681
18857
|
// src/hooks/usePaymentSources.ts
|
|
18682
|
-
import { FlagKey as
|
|
18858
|
+
import { FlagKey as FlagKey23, isNotNullish as isNotNullish8 } from "@funkit/utils";
|
|
18683
18859
|
function useRemainingMeshExchangeConnections(selected) {
|
|
18684
18860
|
const { getActiveConnection } = useFunkitMesh();
|
|
18685
18861
|
const supportedExchanges = useSupportedExchanges();
|
|
@@ -18708,10 +18884,10 @@ function usePaymentMethodEnablement({
|
|
|
18708
18884
|
checkoutConfig
|
|
18709
18885
|
}) {
|
|
18710
18886
|
const { apiKey, uiCustomizations } = useFunkitConfig();
|
|
18711
|
-
const isTokenTransferFlagEnabled = useFlag(
|
|
18887
|
+
const isTokenTransferFlagEnabled = useFlag(FlagKey23.EnableTokenTransfer);
|
|
18712
18888
|
const isFiatFlagEnabled = useFiatEnabled();
|
|
18713
|
-
const isCardFlagEnabled = useFlag(
|
|
18714
|
-
const isBrokerageFlagEnabled = useFlag(
|
|
18889
|
+
const isCardFlagEnabled = useFlag(FlagKey23.EnableCard);
|
|
18890
|
+
const isBrokerageFlagEnabled = useFlag(FlagKey23.EnableBrokerage);
|
|
18715
18891
|
const isKatanaEarnFlowAction = isKatanaEarnFlow({ apiKey, checkoutConfig });
|
|
18716
18892
|
const isUsKatanaUser = useIsUsKatanaUser();
|
|
18717
18893
|
const isFiatEnabled = isFiatFlagEnabled && !isKatanaEarnFlowAction;
|
|
@@ -19068,9 +19244,8 @@ function LoadingAccount({
|
|
|
19068
19244
|
}
|
|
19069
19245
|
|
|
19070
19246
|
// src/modals/CheckoutModal/MeldCurrencySelect/MeldCurrencySelect.tsx
|
|
19071
|
-
import { clamp as clamp2 } from "@funkit/utils";
|
|
19072
19247
|
import clsx15 from "clsx";
|
|
19073
|
-
import React159, { useMemo as
|
|
19248
|
+
import React159, { useMemo as useMemo25, useState as useState35 } from "react";
|
|
19074
19249
|
|
|
19075
19250
|
// src/components/FunNoResults/FunNoResults.tsx
|
|
19076
19251
|
import React158 from "react";
|
|
@@ -19226,14 +19401,13 @@ var selectWrapperStyle = "_163ehmk1";
|
|
|
19226
19401
|
// src/modals/CheckoutModal/MeldCurrencySelect/MeldCurrencySelect.tsx
|
|
19227
19402
|
var MeldCurrencySelectInfo = {
|
|
19228
19403
|
Component: MeldCurrencySelect,
|
|
19229
|
-
//TODO: improve needless inflating of history if changing currency multiple times
|
|
19230
19404
|
onNext: (state, payload) => {
|
|
19231
19405
|
const common = extractCommonState(state);
|
|
19232
19406
|
return {
|
|
19233
19407
|
...common,
|
|
19234
19408
|
step: "input_amount" /* INPUT_AMOUNT */,
|
|
19409
|
+
// fiatAmount: payload.fiatAmount,
|
|
19235
19410
|
fiatCurrency: payload.currency,
|
|
19236
|
-
fiatAmount: payload.fiatAmount,
|
|
19237
19411
|
paymentMethodInfo: state.paymentMethodInfo
|
|
19238
19412
|
};
|
|
19239
19413
|
},
|
|
@@ -19243,7 +19417,7 @@ var MeldCurrencySelectInfo = {
|
|
|
19243
19417
|
return {
|
|
19244
19418
|
...common,
|
|
19245
19419
|
step: "input_amount" /* INPUT_AMOUNT */,
|
|
19246
|
-
fiatAmount: state.fiatAmount,
|
|
19420
|
+
// fiatAmount: state.fiatAmount,
|
|
19247
19421
|
fiatCurrency: state.defaultCurrency,
|
|
19248
19422
|
paymentMethodInfo: state.paymentMethodInfo
|
|
19249
19423
|
};
|
|
@@ -19253,14 +19427,13 @@ function MeldCurrencySelect({
|
|
|
19253
19427
|
modalState,
|
|
19254
19428
|
onNext
|
|
19255
19429
|
}) {
|
|
19256
|
-
const { defaultCurrency
|
|
19430
|
+
const { defaultCurrency } = modalState;
|
|
19257
19431
|
const { data, isPending } = useMeldCurrencies();
|
|
19258
|
-
const { data: meldLimits } = useMeldLimits();
|
|
19259
19432
|
const [query, setQuery] = useState35("");
|
|
19260
19433
|
const [selectedCurrency, setSelectedCurrency] = useState35(
|
|
19261
19434
|
defaultCurrency
|
|
19262
19435
|
);
|
|
19263
|
-
const filteredOptions =
|
|
19436
|
+
const filteredOptions = useMemo25(() => {
|
|
19264
19437
|
const newOptions = data?.filter(
|
|
19265
19438
|
({ name, currencyCode }) => currencyCode.toLowerCase().includes(query.toLowerCase()) || name.toLowerCase().includes(query.toLowerCase())
|
|
19266
19439
|
) ?? [];
|
|
@@ -19273,13 +19446,9 @@ function MeldCurrencySelect({
|
|
|
19273
19446
|
};
|
|
19274
19447
|
const handleSelect = (value) => {
|
|
19275
19448
|
setSelectedCurrency(value.currencyCode);
|
|
19276
|
-
const newLimit = meldLimits?.find(
|
|
19277
|
-
(limit) => limit.currencyCode === value.currencyCode
|
|
19278
|
-
);
|
|
19279
|
-
const newFiatAmount = newLimit ? clamp2(fiatAmount, newLimit.minimumAmount, newLimit.maximumAmount) : fiatAmount;
|
|
19280
19449
|
onNext({
|
|
19281
19450
|
currency: value.currencyCode,
|
|
19282
|
-
fiatAmount: newFiatAmount,
|
|
19451
|
+
// fiatAmount: newFiatAmount,
|
|
19283
19452
|
navigateToHistoryStep: true
|
|
19284
19453
|
});
|
|
19285
19454
|
};
|
|
@@ -19380,8 +19549,8 @@ import {
|
|
|
19380
19549
|
meshExecuteTransfer,
|
|
19381
19550
|
meshExecuteTransferProxy
|
|
19382
19551
|
} from "@funkit/api-base";
|
|
19383
|
-
import { ClientError as ClientError4, FlagKey as
|
|
19384
|
-
import React172, { useMemo as
|
|
19552
|
+
import { ClientError as ClientError4, FlagKey as FlagKey24, formatAddress as formatAddress4 } from "@funkit/utils";
|
|
19553
|
+
import React172, { useMemo as useMemo26, useState as useState38 } from "react";
|
|
19385
19554
|
import { createPortal as createPortal9 } from "react-dom";
|
|
19386
19555
|
|
|
19387
19556
|
// src/components/CopyAddress/CopyAddressButton.tsx
|
|
@@ -19878,7 +20047,7 @@ function MeshVerification({
|
|
|
19878
20047
|
const executionStatus = executionContent?.status;
|
|
19879
20048
|
const { checkoutItem } = useCheckoutContext();
|
|
19880
20049
|
const bottomSectionRef = useBottomSectionRef();
|
|
19881
|
-
const enableFrogProxyServer = useFlag(
|
|
20050
|
+
const enableFrogProxyServer = useFlag(FlagKey24.EnableFrogProxyServer);
|
|
19882
20051
|
const handleCompletion = useEffectEvent(async (finalOtpInput) => {
|
|
19883
20052
|
try {
|
|
19884
20053
|
setIsExecuting(true);
|
|
@@ -19961,7 +20130,7 @@ function MeshVerification({
|
|
|
19961
20130
|
return () => setScreen(0 /* INITIAL */);
|
|
19962
20131
|
});
|
|
19963
20132
|
const brokerName = getExchangeName(brokerType);
|
|
19964
|
-
const verificationTitle =
|
|
20133
|
+
const verificationTitle = useMemo26(() => {
|
|
19965
20134
|
switch (executionStatus) {
|
|
19966
20135
|
case MeshExecuteTransferStatus.secondMfaRequired:
|
|
19967
20136
|
return `Additional ${brokerName} 2FA required`;
|
|
@@ -19988,7 +20157,7 @@ function MeshVerification({
|
|
|
19988
20157
|
executionContent?.verificationSteps?.length,
|
|
19989
20158
|
isSecond2fa
|
|
19990
20159
|
]);
|
|
19991
|
-
const verificationDescription =
|
|
20160
|
+
const verificationDescription = useMemo26(() => {
|
|
19992
20161
|
switch (executionStatus) {
|
|
19993
20162
|
case MeshExecuteTransferStatus.secondMfaRequired:
|
|
19994
20163
|
return `Please enable at least two 2FA methods on your ${brokerName} account. Once enabled, you will have to reconnect your account.`;
|
|
@@ -20133,7 +20302,7 @@ var VerificationPopup = ({
|
|
|
20133
20302
|
};
|
|
20134
20303
|
|
|
20135
20304
|
// src/modals/CheckoutModal/MoonpaySetup.tsx
|
|
20136
|
-
import React174, { useCallback as useCallback31, useMemo as
|
|
20305
|
+
import React174, { useCallback as useCallback31, useMemo as useMemo28, useState as useState40 } from "react";
|
|
20137
20306
|
|
|
20138
20307
|
// src/components/FunPayments/FunPaymentMoonpayType.css.ts
|
|
20139
20308
|
var mpClass = "_1kmpeyf0";
|
|
@@ -20142,7 +20311,7 @@ var stretchStyle = "_1kmpeyf1";
|
|
|
20142
20311
|
// src/components/FunPayments/FunPaymentMoonpayType.tsx
|
|
20143
20312
|
import { getMoonpayUrlSignature } from "@funkit/api-base";
|
|
20144
20313
|
import { colorToHex } from "@funkit/utils";
|
|
20145
|
-
import React173, { Fragment as Fragment2, useEffect as useEffect33, useMemo as
|
|
20314
|
+
import React173, { Fragment as Fragment2, useEffect as useEffect33, useMemo as useMemo27, useState as useState39 } from "react";
|
|
20146
20315
|
var LazyMoonPayBuyWidget = (props) => {
|
|
20147
20316
|
const [MoonPayBuyWidget, setMoonPayBuyWidget] = useState39(null);
|
|
20148
20317
|
useEffect33(() => {
|
|
@@ -20173,7 +20342,7 @@ function FunPaymentMoonpayType({
|
|
|
20173
20342
|
const isSandboxMode = useIsFunkitSandboxMode();
|
|
20174
20343
|
const funkitConfig = useFunkitConfig();
|
|
20175
20344
|
const { userInfo } = useGeneralWallet();
|
|
20176
|
-
const currencyCode =
|
|
20345
|
+
const currencyCode = useMemo27(() => {
|
|
20177
20346
|
return generateMoonpayCurrencyCode(depositToken, depositTokenChainId);
|
|
20178
20347
|
}, [depositToken, depositTokenChainId]);
|
|
20179
20348
|
const depositTokenAmountStringFormatted = formatTokenAmountForMoonpay(
|
|
@@ -20196,7 +20365,7 @@ function FunPaymentMoonpayType({
|
|
|
20196
20365
|
});
|
|
20197
20366
|
return signature || "";
|
|
20198
20367
|
};
|
|
20199
|
-
const moonpayButtonColor =
|
|
20368
|
+
const moonpayButtonColor = useMemo27(() => {
|
|
20200
20369
|
const primaryButtonHex = colorToHex(activeTheme.colors.buttonPrimary);
|
|
20201
20370
|
if (["#FFF", "#FFFF", "#FFFFFF", "#FFFFFFFF"].includes(primaryButtonHex)) {
|
|
20202
20371
|
return void 0;
|
|
@@ -20251,7 +20420,7 @@ function MoonpaySetup({
|
|
|
20251
20420
|
depositAddress: paymentAddress
|
|
20252
20421
|
});
|
|
20253
20422
|
}, [onNext, paymentAddress]);
|
|
20254
|
-
const MoonpayWidget =
|
|
20423
|
+
const MoonpayWidget = useMemo28(() => {
|
|
20255
20424
|
return /* @__PURE__ */ React174.createElement(
|
|
20256
20425
|
FunPaymentMoonpayType,
|
|
20257
20426
|
{
|
|
@@ -20282,7 +20451,7 @@ function MoonpaySetup({
|
|
|
20282
20451
|
// src/modals/CheckoutModal/SelectAsset.tsx
|
|
20283
20452
|
import { FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST as FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST2 } from "@funkit/chains";
|
|
20284
20453
|
import { formatCurrencyAndStringify as formatCurrencyAndStringify11, isTokenEquivalent as isTokenEquivalent7 } from "@funkit/utils";
|
|
20285
|
-
import React183, { useEffect as useEffect35, useMemo as
|
|
20454
|
+
import React183, { useEffect as useEffect35, useMemo as useMemo30, useState as useState42 } from "react";
|
|
20286
20455
|
import { createPortal as createPortal10 } from "react-dom";
|
|
20287
20456
|
|
|
20288
20457
|
// src/components/Dropdown/ChainDropdown.tsx
|
|
@@ -20291,7 +20460,7 @@ import React180 from "react";
|
|
|
20291
20460
|
// src/components/Dropdown/BaseDropdown.tsx
|
|
20292
20461
|
import { isMobile as isMobile6, noop as noop6 } from "@funkit/utils";
|
|
20293
20462
|
import { AnimatePresence as AnimatePresence4, motion as motion6 } from "motion/react";
|
|
20294
|
-
import React178, { useCallback as useCallback32, useMemo as
|
|
20463
|
+
import React178, { useCallback as useCallback32, useMemo as useMemo29, useState as useState41 } from "react";
|
|
20295
20464
|
|
|
20296
20465
|
// src/components/FunSelect/FunClickOutside.tsx
|
|
20297
20466
|
import React175 from "react";
|
|
@@ -20497,7 +20666,7 @@ function BaseDropdown({
|
|
|
20497
20666
|
const handleSearch = (event) => {
|
|
20498
20667
|
setSearchInput(event.target.value);
|
|
20499
20668
|
};
|
|
20500
|
-
const filteredOptions =
|
|
20669
|
+
const filteredOptions = useMemo29(
|
|
20501
20670
|
() => options.filter(
|
|
20502
20671
|
(singleOption) => singleOption.label.toLowerCase().includes(searchInput?.toLowerCase())
|
|
20503
20672
|
),
|
|
@@ -20906,13 +21075,13 @@ var ReceiveTokenDropdown = ({
|
|
|
20906
21075
|
|
|
20907
21076
|
// src/components/NewTokenDepositAlert/NewTokenDepositAlert.tsx
|
|
20908
21077
|
import React182 from "react";
|
|
20909
|
-
import { FlagKey as
|
|
21078
|
+
import { FlagKey as FlagKey25, safeParseJson as safeParseJson4 } from "@funkit/utils";
|
|
20910
21079
|
var NewTokenDepositAlert = ({
|
|
20911
21080
|
onClick
|
|
20912
21081
|
}) => {
|
|
20913
|
-
const alertJson = useFlag(
|
|
21082
|
+
const alertJson = useFlag(FlagKey25.NewTokenAssetSelectionBanner);
|
|
20914
21083
|
const alertData = safeParseJson4(alertJson);
|
|
20915
|
-
const isTokenTransferEnabled = useFlag(
|
|
21084
|
+
const isTokenTransferEnabled = useFlag(FlagKey25.EnableTokenTransfer);
|
|
20916
21085
|
if (!alertData || !isTokenTransferEnabled) return null;
|
|
20917
21086
|
return /* @__PURE__ */ React182.createElement(
|
|
20918
21087
|
FunAlert,
|
|
@@ -20980,7 +21149,7 @@ function useEnrichedAccountHoldings({
|
|
|
20980
21149
|
const { apiKey } = useFunkitConfig();
|
|
20981
21150
|
const { isAllowed, isLoading } = useAllowedAssets();
|
|
20982
21151
|
const { loginType, walletAddress } = useGeneralWallet();
|
|
20983
|
-
const enrichedAccountHoldings =
|
|
21152
|
+
const enrichedAccountHoldings = useMemo30(() => {
|
|
20984
21153
|
if (!checkoutConfig) return [];
|
|
20985
21154
|
return Object.values(accountHoldings).map((asset) => {
|
|
20986
21155
|
const usableForCheckout = isAssetUsableToPayForCheckout({
|
|
@@ -21022,7 +21191,7 @@ function useAssetOptions({
|
|
|
21022
21191
|
userSelectedTargetAsset,
|
|
21023
21192
|
chainId
|
|
21024
21193
|
}) {
|
|
21025
|
-
const assetOptions =
|
|
21194
|
+
const assetOptions = useMemo30(() => {
|
|
21026
21195
|
return enrichedAccountHoldings.filter(
|
|
21027
21196
|
({ asset }) => chainId !== void 0 ? asset.pickedChainId === chainId.toString() : true
|
|
21028
21197
|
).map(({ asset, usableForCheckout }) => {
|
|
@@ -21093,7 +21262,7 @@ function MeshOrAccountSelectAsset({
|
|
|
21093
21262
|
targetAssetMinAmount: 0
|
|
21094
21263
|
};
|
|
21095
21264
|
const [selectedTargetAsset, setSelectedTargetAsset] = useState42(defaultTargetAsset);
|
|
21096
|
-
const defaultTokenSymbols =
|
|
21265
|
+
const defaultTokenSymbols = useMemo30(() => {
|
|
21097
21266
|
if (!checkoutConfig) {
|
|
21098
21267
|
return [];
|
|
21099
21268
|
}
|
|
@@ -21157,7 +21326,7 @@ function MeshOrAccountSelectAsset({
|
|
|
21157
21326
|
handleTargetAssetUpdate(tokenItem);
|
|
21158
21327
|
onFinish();
|
|
21159
21328
|
});
|
|
21160
|
-
const selectedChainTokenSymbol =
|
|
21329
|
+
const selectedChainTokenSymbol = useMemo30(() => {
|
|
21161
21330
|
if (explicitlySelectedChainTokenSymbol) {
|
|
21162
21331
|
const assetExists = assetOptions.find(
|
|
21163
21332
|
({ asset }) => asset.chainSymbolKey === explicitlySelectedChainTokenSymbol
|
|
@@ -21569,13 +21738,13 @@ function SelectBrokerage({
|
|
|
21569
21738
|
|
|
21570
21739
|
// src/modals/CheckoutModal/SourceChange/SourceChange.tsx
|
|
21571
21740
|
import { BridgeCustomerStatus as BridgeCustomerStatus6 } from "@funkit/api-base";
|
|
21572
|
-
import { FlagKey as
|
|
21741
|
+
import { FlagKey as FlagKey26 } from "@funkit/utils";
|
|
21573
21742
|
import React186, { useEffect as useEffect36, useState as useState45 } from "react";
|
|
21574
21743
|
import { createPortal as createPortal12 } from "react-dom";
|
|
21575
21744
|
|
|
21576
21745
|
// src/modals/CheckoutModal/SourceChange/useUpdateSourceAssetForCard.ts
|
|
21577
21746
|
import {
|
|
21578
|
-
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as
|
|
21747
|
+
FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO15,
|
|
21579
21748
|
dydxChain as dydxChain3,
|
|
21580
21749
|
katanaChain
|
|
21581
21750
|
} from "@funkit/chains";
|
|
@@ -21601,7 +21770,7 @@ var pickSourceAssetForCard = async (checkoutItem, userIpInfo) => {
|
|
|
21601
21770
|
const wethAddrOnTargetChain = (await getTokenAddressBySymbolAndChainId2("weth", moonpayChainId)).toLowerCase();
|
|
21602
21771
|
const isTargetAssetEthOrWeth = [NATIVE_TOKEN, wethAddrOnTargetChain].includes(
|
|
21603
21772
|
checkoutItem.initSettings.config.targetAsset
|
|
21604
|
-
) &&
|
|
21773
|
+
) && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO15[moonpayChainId]?.nativeCurrency.symbol === "ETH" /* ETH */;
|
|
21605
21774
|
let sourceTokenAddress;
|
|
21606
21775
|
let sourceTokenTicker;
|
|
21607
21776
|
let sourceTokenChainId;
|
|
@@ -21786,7 +21955,7 @@ function SourceChange({
|
|
|
21786
21955
|
const { data: fiatAccounts } = useVirtualFiatAccounts();
|
|
21787
21956
|
const matchingFiatAccount = useMatchingVirtualFiatAccount(fiatAccounts);
|
|
21788
21957
|
const { apiKey, textCustomizations } = useFunkitConfig();
|
|
21789
|
-
const enableMeldPayment = useFlag(
|
|
21958
|
+
const enableMeldPayment = useFlag(FlagKey26.EnableMeldPayment);
|
|
21790
21959
|
const hasAutoContinue = !isOstiumCustomer(apiKey);
|
|
21791
21960
|
useEffect36(() => {
|
|
21792
21961
|
if (!paymentMethodInfo) return;
|
|
@@ -21853,6 +22022,7 @@ function SourceChange({
|
|
|
21853
22022
|
if (!enableMeldPayment) await onSelectCard();
|
|
21854
22023
|
onNext({
|
|
21855
22024
|
connectNew: true,
|
|
22025
|
+
reverseAnimation: true,
|
|
21856
22026
|
paymentMethod: newSource2,
|
|
21857
22027
|
paymentMethodInfo: paymentMethodInfo2,
|
|
21858
22028
|
brokerageFailed: false
|
|
@@ -21957,7 +22127,7 @@ function SourceChange({
|
|
|
21957
22127
|
}
|
|
21958
22128
|
|
|
21959
22129
|
// src/modals/CheckoutModal/TransferToken/TransferToken.tsx
|
|
21960
|
-
import { FlagKey as
|
|
22130
|
+
import { FlagKey as FlagKey29 } from "@funkit/utils";
|
|
21961
22131
|
import { motion as motion8, useAnimationControls as useAnimationControls3 } from "motion/react";
|
|
21962
22132
|
import React200, { useEffect as useEffect37, useRef as useRef15, useState as useState48 } from "react";
|
|
21963
22133
|
import { createPortal as createPortal13 } from "react-dom";
|
|
@@ -22019,13 +22189,13 @@ function CopyInputDisplayedAddress({
|
|
|
22019
22189
|
}
|
|
22020
22190
|
|
|
22021
22191
|
// src/components/Dropdown/TokenDropdown.tsx
|
|
22022
|
-
import { FlagKey as
|
|
22192
|
+
import { FlagKey as FlagKey27, safeParseJson as safeParseJson5 } from "@funkit/utils";
|
|
22023
22193
|
import React189, { useState as useState46 } from "react";
|
|
22024
22194
|
var TOKEN_ICON_SIZE2 = 16;
|
|
22025
22195
|
var useNewTokens = () => {
|
|
22026
|
-
const bannerJson = useFlag(
|
|
22196
|
+
const bannerJson = useFlag(FlagKey27.NewTokenAssetSelectionBanner);
|
|
22027
22197
|
const bannerData = safeParseJson5(bannerJson);
|
|
22028
|
-
const newBadgeTokensJson = useFlag(
|
|
22198
|
+
const newBadgeTokensJson = useFlag(FlagKey27.TokenTransferNewTokens);
|
|
22029
22199
|
const newBadgeData = safeParseJson5(newBadgeTokensJson);
|
|
22030
22200
|
const newTokens = newBadgeData && Object.values(newBadgeData).flat();
|
|
22031
22201
|
const newUniqueTokens = new Set(newTokens);
|
|
@@ -22141,7 +22311,7 @@ var LightningBoltIcon = ({ size = 16 }) => /* @__PURE__ */ React190.createElemen
|
|
|
22141
22311
|
|
|
22142
22312
|
// src/components/QRCode/QRCode.tsx
|
|
22143
22313
|
import QRCodeUtil from "qrcode";
|
|
22144
|
-
import React191, { useMemo as
|
|
22314
|
+
import React191, { useMemo as useMemo31 } from "react";
|
|
22145
22315
|
var generateMatrix = (value, errorCorrectionLevel) => {
|
|
22146
22316
|
const { data } = QRCodeUtil.create(value, { errorCorrectionLevel }).modules;
|
|
22147
22317
|
const sqrt = Math.sqrt(data.length);
|
|
@@ -22169,7 +22339,7 @@ function QRCode({
|
|
|
22169
22339
|
}) {
|
|
22170
22340
|
const { activeTheme } = useActiveTheme();
|
|
22171
22341
|
const size = sizeProp - Number.parseInt(outsidePadding, 10) * 2;
|
|
22172
|
-
const dots =
|
|
22342
|
+
const dots = useMemo31(() => {
|
|
22173
22343
|
const dots2 = [];
|
|
22174
22344
|
const matrix = generateMatrix(uri, ecl);
|
|
22175
22345
|
const cellSize = size / matrix.length;
|
|
@@ -22716,12 +22886,12 @@ var TransferTokenDetails = ({
|
|
|
22716
22886
|
|
|
22717
22887
|
// src/hooks/useTokenTransfer.ts
|
|
22718
22888
|
import { solanaChain as solanaChain2 } from "@funkit/chains";
|
|
22719
|
-
import { FlagKey as
|
|
22889
|
+
import { FlagKey as FlagKey28 } from "@funkit/utils";
|
|
22720
22890
|
import { mainnet as mainnet8, polygon as polygon5 } from "viem/chains";
|
|
22721
22891
|
var useTokenTransfer = (selectedChainId, selectedToken) => {
|
|
22722
22892
|
const { checkoutItem } = useCheckoutContext();
|
|
22723
22893
|
const enableUniversal = useFlag(
|
|
22724
|
-
|
|
22894
|
+
FlagKey28.EnableTokenTransferUniversalDepositAddress,
|
|
22725
22895
|
false
|
|
22726
22896
|
);
|
|
22727
22897
|
const estPriceImpact = usePriceImpactEstimation(selectedToken);
|
|
@@ -22752,11 +22922,16 @@ var useTokenTransfer = (selectedChainId, selectedToken) => {
|
|
|
22752
22922
|
};
|
|
22753
22923
|
};
|
|
22754
22924
|
var useMinTransferValue = (selectedChainId) => {
|
|
22925
|
+
const minTransferValueJsonString = useFlag(FlagKey28.MinTokenTransferValue);
|
|
22926
|
+
const minTransferValue = safeJSONParse(
|
|
22927
|
+
minTransferValueJsonString
|
|
22928
|
+
);
|
|
22755
22929
|
const { userIpInfo } = useFunkitUserIp();
|
|
22756
22930
|
const isMainnet = selectedChainId === mainnet8.id;
|
|
22757
|
-
if (
|
|
22758
|
-
|
|
22759
|
-
|
|
22931
|
+
if (!minTransferValue) return 0;
|
|
22932
|
+
const transferLimitKey = userIpInfo?.alpha2 || "DEFAULT";
|
|
22933
|
+
const minTransferLimit = minTransferValue[transferLimitKey] ?? minTransferValue.DEFAULT;
|
|
22934
|
+
return isMainnet ? minTransferLimit.mainnet : minTransferLimit.nonMainnet;
|
|
22760
22935
|
};
|
|
22761
22936
|
var usePriceImpactEstimation = (selectedToken) => {
|
|
22762
22937
|
const { apiKey } = useFunkitConfig();
|
|
@@ -22807,7 +22982,7 @@ function TransferToken({
|
|
|
22807
22982
|
const filteredAssets = useEnabledTokenTransferChainTokens(
|
|
22808
22983
|
transferInit ?? null
|
|
22809
22984
|
);
|
|
22810
|
-
const defaultChainIdFlag = useFlag(
|
|
22985
|
+
const defaultChainIdFlag = useFlag(FlagKey29.TokenTransferDefaultChainId);
|
|
22811
22986
|
const defaultChainId = defaultValues?.chainId ?? Number(defaultChainIdFlag);
|
|
22812
22987
|
const validDefaultChainId = filteredAssets[defaultChainId] !== void 0 ? defaultChainId : polygon6.id;
|
|
22813
22988
|
const [selectedChainId, setSelectedChainId] = useState48(validDefaultChainId);
|
|
@@ -23340,7 +23515,7 @@ var FiatAccountDetail = {
|
|
|
23340
23515
|
|
|
23341
23516
|
// src/modals/CheckoutModal/VirtualFiatAccount/KycIframe.tsx
|
|
23342
23517
|
import { BridgeCustomerStatus as BridgeCustomerStatus7 } from "@funkit/api-base";
|
|
23343
|
-
import React205, { useCallback as useCallback34, useEffect as useEffect38, useMemo as
|
|
23518
|
+
import React205, { useCallback as useCallback34, useEffect as useEffect38, useMemo as useMemo32, useState as useState50 } from "react";
|
|
23344
23519
|
function useIframeListener(listeners) {
|
|
23345
23520
|
const handleMessage = useCallback34(
|
|
23346
23521
|
(event) => {
|
|
@@ -23393,7 +23568,7 @@ function KycIframe({
|
|
|
23393
23568
|
const { clearVirtualFiatAccounts } = useClearFrogAccountsCache();
|
|
23394
23569
|
const { data: kycLink, isLoading: isLinkLoading } = useLoadKycLink(modalState);
|
|
23395
23570
|
const [iframeLoading, setIframeLoading] = useState50(true);
|
|
23396
|
-
const listeners =
|
|
23571
|
+
const listeners = useMemo32(
|
|
23397
23572
|
() => ({
|
|
23398
23573
|
load: () => {
|
|
23399
23574
|
logger.info("KYC iframe loaded");
|
|
@@ -23422,7 +23597,8 @@ function KycIframe({
|
|
|
23422
23597
|
onClose: onBack,
|
|
23423
23598
|
open: true,
|
|
23424
23599
|
titleId: "rk_kyc_title",
|
|
23425
|
-
|
|
23600
|
+
withoutSidePadding: !loading,
|
|
23601
|
+
withoutBottomPadding: !loading,
|
|
23426
23602
|
withTransition: false
|
|
23427
23603
|
},
|
|
23428
23604
|
loading && /* @__PURE__ */ React205.createElement(React205.Fragment, null, /* @__PURE__ */ React205.createElement(
|
|
@@ -24113,7 +24289,7 @@ function FunConnectOptions({
|
|
|
24113
24289
|
}
|
|
24114
24290
|
}
|
|
24115
24291
|
};
|
|
24116
|
-
const stepComponent =
|
|
24292
|
+
const stepComponent = useMemo33(() => {
|
|
24117
24293
|
switch (step) {
|
|
24118
24294
|
case 0 /* SIGNIN_PRIMARY */:
|
|
24119
24295
|
case 1 /* SIGNIN_SECONDARY */:
|
|
@@ -24222,7 +24398,7 @@ var FULL_SOCIAL_LOGIN_OPTIONS = [
|
|
|
24222
24398
|
function useEnabledSocialLogins() {
|
|
24223
24399
|
const funkitConfig = useFunkitConfig();
|
|
24224
24400
|
const { web2SocialLogins } = funkitConfig.loginConfig;
|
|
24225
|
-
const enabledSocialItems =
|
|
24401
|
+
const enabledSocialItems = useMemo34(() => {
|
|
24226
24402
|
return FULL_SOCIAL_LOGIN_OPTIONS.filter(
|
|
24227
24403
|
(oAuthItem) => !!web2SocialLogins[oAuthItem.funkitKey]
|
|
24228
24404
|
);
|
|
@@ -24251,7 +24427,7 @@ function FunSignInStep({
|
|
|
24251
24427
|
handleOauthRedirect,
|
|
24252
24428
|
handleGenerateFcUri
|
|
24253
24429
|
} = useFunkitWeb2Login();
|
|
24254
|
-
const isEmailInputValid =
|
|
24430
|
+
const isEmailInputValid = useMemo34(() => {
|
|
24255
24431
|
return validateEmailString(emailInput);
|
|
24256
24432
|
}, [emailInput]);
|
|
24257
24433
|
const [emailError, setEmailError] = useState55();
|
|
@@ -24790,7 +24966,7 @@ var getTimestamp = (timestampMs) => formatTimestamp(new Date(timestampMs), {
|
|
|
24790
24966
|
// src/components/FunCheckoutHistory/FunCheckoutStatus.tsx
|
|
24791
24967
|
import { formatSecondsToCountdownForm } from "@funkit/utils";
|
|
24792
24968
|
import { motion as motion11 } from "motion/react";
|
|
24793
|
-
import React220, { useMemo as
|
|
24969
|
+
import React220, { useMemo as useMemo35 } from "react";
|
|
24794
24970
|
|
|
24795
24971
|
// src/components/FunCheckoutHistory/FunCheckoutStatus.css.ts
|
|
24796
24972
|
var GradientLoadingBox = "_101aujm0";
|
|
@@ -24851,7 +25027,7 @@ function PendingCheckoutStatus({
|
|
|
24851
25027
|
checkoutItem.latestQuote?.finalTimeEstimationMs,
|
|
24852
25028
|
checkoutItem.selectedPaymentMethodInfo?.paymentMethod
|
|
24853
25029
|
);
|
|
24854
|
-
const estimatedRemainingSeconds =
|
|
25030
|
+
const estimatedRemainingSeconds = useMemo35(() => {
|
|
24855
25031
|
const startTimeMs = extractStartTimeMs(
|
|
24856
25032
|
checkoutItem.id,
|
|
24857
25033
|
activeCheckoutItem,
|
|
@@ -24977,7 +25153,7 @@ function FunCheckoutHistoryDetail({
|
|
|
24977
25153
|
includeGenerateActionsParams
|
|
24978
25154
|
]
|
|
24979
25155
|
);
|
|
24980
|
-
const buttonProps =
|
|
25156
|
+
const buttonProps = useMemo36(() => {
|
|
24981
25157
|
if (!isCheckoutLoaded) {
|
|
24982
25158
|
return { title: "", isDisabled: true, isLoading: true };
|
|
24983
25159
|
}
|
|
@@ -25059,7 +25235,7 @@ var CheckoutAlert = ({ state, refundState, onHelp }) => {
|
|
|
25059
25235
|
|
|
25060
25236
|
// src/components/FunCheckoutHistory/FunCheckoutHistoryHelp.tsx
|
|
25061
25237
|
import { sendSupportMessage } from "@funkit/api-base";
|
|
25062
|
-
import React224, { useEffect as useEffect43, useMemo as
|
|
25238
|
+
import React224, { useEffect as useEffect43, useMemo as useMemo37, useRef as useRef19, useState as useState58 } from "react";
|
|
25063
25239
|
import { createPortal as createPortal15 } from "react-dom";
|
|
25064
25240
|
|
|
25065
25241
|
// src/components/FunInput/FunTextAreaInput.tsx
|
|
@@ -25206,7 +25382,7 @@ function FunCheckoutHistoryHelp({
|
|
|
25206
25382
|
);
|
|
25207
25383
|
const [descriptionInput, setDescriptionInput] = useState58("");
|
|
25208
25384
|
const [errorMessage, setErrorMessage] = useState58();
|
|
25209
|
-
const isEmailInputValid =
|
|
25385
|
+
const isEmailInputValid = useMemo37(() => {
|
|
25210
25386
|
return validateEmailString(emailInput);
|
|
25211
25387
|
}, [emailInput]);
|
|
25212
25388
|
const [processStage, setProcessStage] = useState58(
|
|
@@ -25395,11 +25571,11 @@ import {
|
|
|
25395
25571
|
formatTimestamp as formatTimestamp2,
|
|
25396
25572
|
isTokenEquivalent as isTokenEquivalent8
|
|
25397
25573
|
} from "@funkit/utils";
|
|
25398
|
-
import React226, { useCallback as useCallback41, useMemo as
|
|
25574
|
+
import React226, { useCallback as useCallback41, useMemo as useMemo39, useRef as useRef20, useState as useState59 } from "react";
|
|
25399
25575
|
import { createPortal as createPortal16 } from "react-dom";
|
|
25400
25576
|
|
|
25401
25577
|
// src/components/FunCheckoutHistory/FunDirectExecutionStatus.tsx
|
|
25402
|
-
import React225, { useMemo as
|
|
25578
|
+
import React225, { useMemo as useMemo38 } from "react";
|
|
25403
25579
|
function FunDirectExecutionStatus({
|
|
25404
25580
|
directExecution
|
|
25405
25581
|
}) {
|
|
@@ -25421,11 +25597,11 @@ function FunDirectExecutionStatus({
|
|
|
25421
25597
|
function PendingDirectExecutionStatus({
|
|
25422
25598
|
directExecution
|
|
25423
25599
|
}) {
|
|
25424
|
-
const totalSeconds =
|
|
25600
|
+
const totalSeconds = useMemo38(() => {
|
|
25425
25601
|
const timeEstimation = directExecution.clientMetadata.latestQuote?.finalTimeEstimationMs || 0;
|
|
25426
25602
|
return Math.ceil(timeEstimation / 1e3);
|
|
25427
25603
|
}, [directExecution]);
|
|
25428
|
-
const estimatedRemainingSeconds =
|
|
25604
|
+
const estimatedRemainingSeconds = useMemo38(() => {
|
|
25429
25605
|
const startTimeMs = directExecution.createdTimeMs;
|
|
25430
25606
|
return getTimeFromNowSeconds(startTimeMs, totalSeconds * 1e3);
|
|
25431
25607
|
}, [totalSeconds, directExecution]);
|
|
@@ -25477,7 +25653,7 @@ function FunDirectExecutionHistoryDetail({
|
|
|
25477
25653
|
includeGenerateActionsParams
|
|
25478
25654
|
]
|
|
25479
25655
|
);
|
|
25480
|
-
const buttonProps =
|
|
25656
|
+
const buttonProps = useMemo39(() => {
|
|
25481
25657
|
if (!isLoaded) {
|
|
25482
25658
|
return void 0;
|
|
25483
25659
|
}
|
|
@@ -25689,7 +25865,7 @@ function FunCheckoutHistoryContent({
|
|
|
25689
25865
|
}
|
|
25690
25866
|
|
|
25691
25867
|
// src/components/FunCheckoutHistory/useCustomStatusAnimationAboveTopbar.tsx
|
|
25692
|
-
import { clamp as
|
|
25868
|
+
import { clamp as clamp2 } from "@funkit/utils";
|
|
25693
25869
|
import React228, { useRef as useRef21, useState as useState60 } from "react";
|
|
25694
25870
|
var TOPBAR_HEIGHT = 56;
|
|
25695
25871
|
var DURATION_MS = 200;
|
|
@@ -25747,7 +25923,7 @@ function useCustomStatusAnimationAboveTopbar({
|
|
|
25747
25923
|
style: {
|
|
25748
25924
|
// Apply a position-based opacity to the icon if it gets too far into the topbar, so it fades out faster
|
|
25749
25925
|
// This helps (slightly) when scrolling much faster than the normal background fade animation
|
|
25750
|
-
opacity:
|
|
25926
|
+
opacity: clamp2(
|
|
25751
25927
|
1 - (scrollPos - startFadePos - statusIconSize) / TOPBAR_HEIGHT,
|
|
25752
25928
|
0,
|
|
25753
25929
|
1
|
|
@@ -25773,7 +25949,7 @@ function useCheckoutModalTitle(depositAddress, defaultTitle) {
|
|
|
25773
25949
|
import { IN_PROGRESS_CHECKOUT_STATES as IN_PROGRESS_CHECKOUT_STATES2 } from "@funkit/api-base";
|
|
25774
25950
|
import { formatTimestampToDate, fullMonthNames } from "@funkit/utils";
|
|
25775
25951
|
import clsx20 from "clsx";
|
|
25776
|
-
import React237, { useEffect as useEffect44, useMemo as
|
|
25952
|
+
import React237, { useEffect as useEffect44, useMemo as useMemo40, useRef as useRef22, useState as useState62 } from "react";
|
|
25777
25953
|
import { Virtuoso } from "react-virtuoso";
|
|
25778
25954
|
import { useAccount as useAccount6 } from "wagmi";
|
|
25779
25955
|
|
|
@@ -26321,7 +26497,7 @@ function Home({
|
|
|
26321
26497
|
const virtuosoDiv = virtuosoParentRef.current?.firstChild;
|
|
26322
26498
|
virtuosoDiv?.classList.add(animateVirtuosoInClass);
|
|
26323
26499
|
}, []);
|
|
26324
|
-
const AssetsList =
|
|
26500
|
+
const AssetsList = useMemo40(() => {
|
|
26325
26501
|
if (walletAssets && !Object.keys(walletAssets).length) {
|
|
26326
26502
|
return /* @__PURE__ */ React237.createElement(EmptyTabAlert, null);
|
|
26327
26503
|
}
|
|
@@ -26348,7 +26524,7 @@ function Home({
|
|
|
26348
26524
|
}
|
|
26349
26525
|
));
|
|
26350
26526
|
}, [walletAssets]);
|
|
26351
|
-
const CheckoutsList =
|
|
26527
|
+
const CheckoutsList = useMemo40(() => {
|
|
26352
26528
|
if (checkoutHistoryList.length === 0 && isCheckoutHistoryInited) {
|
|
26353
26529
|
return /* @__PURE__ */ React237.createElement(EmptyTabAlert, null);
|
|
26354
26530
|
}
|
|
@@ -26952,16 +27128,16 @@ function ChainModal({ onClose, open }) {
|
|
|
26952
27128
|
// src/modals/CheckoutModal/FunCheckoutModal.tsx
|
|
26953
27129
|
import { FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST as FUNKIT_CONNECT_SUPPORTED_CHECKOUT_CHAINS_INFO_LIST3 } from "@funkit/chains";
|
|
26954
27130
|
import { LogLevel, initializeRelayClient } from "@funkit/fun-relay";
|
|
26955
|
-
import { FlagKey as
|
|
27131
|
+
import { FlagKey as FlagKey32 } from "@funkit/utils";
|
|
26956
27132
|
import React253, { useRef as useRef24 } from "react";
|
|
26957
27133
|
|
|
26958
27134
|
// src/components/DydxSwitchModalTab/DydxSwitchModalTab.tsx
|
|
26959
27135
|
import React245, { useCallback as useCallback44 } from "react";
|
|
26960
27136
|
|
|
26961
27137
|
// src/hooks/useFunkitMaxCheckoutUsdInfo.ts
|
|
26962
|
-
import { FlagKey as
|
|
27138
|
+
import { FlagKey as FlagKey30, formatCurrencyAndStringify as formatCurrencyAndStringify15 } from "@funkit/utils";
|
|
26963
27139
|
var useFunkitMaxCheckoutUsdInfo = () => {
|
|
26964
|
-
const maxCheckoutUsd = Number(useFlag(
|
|
27140
|
+
const maxCheckoutUsd = Number(useFlag(FlagKey30.MaxCheckoutUsd));
|
|
26965
27141
|
const limitText = maxCheckoutUsd === Number.MAX_VALUE ? "no" : formatCurrencyAndStringify15(maxCheckoutUsd, {
|
|
26966
27142
|
decimalPrecisionForSuffix: 0,
|
|
26967
27143
|
minimumSignificantDigits: 0,
|
|
@@ -27101,7 +27277,7 @@ var FunCheckoutBlocked = ({ reason }) => {
|
|
|
27101
27277
|
|
|
27102
27278
|
// src/modals/CheckoutModal/TransferToken/CheckoutNotifications.tsx
|
|
27103
27279
|
import clsx23 from "clsx";
|
|
27104
|
-
import React252, { useEffect as useEffect46, useMemo as
|
|
27280
|
+
import React252, { useEffect as useEffect46, useMemo as useMemo41, useState as useState65 } from "react";
|
|
27105
27281
|
|
|
27106
27282
|
// src/components/FunNotificationBanner/FunNotificationShowMoreButton.tsx
|
|
27107
27283
|
import React247 from "react";
|
|
@@ -27149,13 +27325,13 @@ var FunNotificationShowMoreButton = ({
|
|
|
27149
27325
|
import {
|
|
27150
27326
|
getCheckoutsByUserId as getCheckoutsByUserId2
|
|
27151
27327
|
} from "@funkit/api-base";
|
|
27152
|
-
import { FlagKey as
|
|
27328
|
+
import { FlagKey as FlagKey31 } from "@funkit/utils";
|
|
27153
27329
|
import { useQuery as useQuery16 } from "@tanstack/react-query";
|
|
27154
27330
|
var hasCorrectPaymentMethod = (checkout, paymentMethod) => !paymentMethod || checkout.clientMetadata.selectedPaymentMethodInfo?.paymentMethod === paymentMethod;
|
|
27155
27331
|
var isRecent = (checkout, timestampCutoff) => checkout.createdTimeMs > timestampCutoff;
|
|
27156
27332
|
var DEFAULT_NOTIF_CUTOFF = 7 * 24 * 60 * 60 * 1e3;
|
|
27157
27333
|
function useCheckoutRefreshInterval() {
|
|
27158
|
-
const str = useFlag(
|
|
27334
|
+
const str = useFlag(FlagKey31.CheckoutNotificationsRefreshInterval);
|
|
27159
27335
|
return safeJSONParse(str) || { listRefresh: 50 * 1e3, itemRefresh: 5 * 1e3 };
|
|
27160
27336
|
}
|
|
27161
27337
|
var useRecentCheckouts = ({
|
|
@@ -28142,15 +28318,15 @@ var CheckoutNotifications = ({
|
|
|
28142
28318
|
if (initialDirectExecutions || !directExecutions) return;
|
|
28143
28319
|
setInitialDirectExecutions(directExecutions);
|
|
28144
28320
|
}, [initialDirectExecutions, directExecutions]);
|
|
28145
|
-
const displayedDirectExecutions =
|
|
28321
|
+
const displayedDirectExecutions = useMemo41(() => {
|
|
28146
28322
|
if (!directExecutions) return [];
|
|
28147
28323
|
return getUpdatedDirectExecutions(directExecutions, initialDirectExecutions).filter(({ txHash }) => !closedNotifications.includes(txHash)).slice(0, MAX_COUNT);
|
|
28148
28324
|
}, [initialDirectExecutions, directExecutions, closedNotifications]);
|
|
28149
|
-
const displayedCheckouts =
|
|
28325
|
+
const displayedCheckouts = useMemo41(() => {
|
|
28150
28326
|
if (!checkouts) return [];
|
|
28151
28327
|
return getUpdatedCheckouts(checkouts, initialCheckouts).filter(({ depositAddr }) => !closedNotifications.includes(depositAddr)).slice(0, MAX_COUNT);
|
|
28152
28328
|
}, [initialCheckouts, checkouts, closedNotifications]);
|
|
28153
|
-
const combinedNotifications =
|
|
28329
|
+
const combinedNotifications = useMemo41(() => {
|
|
28154
28330
|
return [
|
|
28155
28331
|
...displayedDirectExecutions.map(
|
|
28156
28332
|
(item) => ({ ...item, isDirectExecution: true })
|
|
@@ -28160,7 +28336,7 @@ var CheckoutNotifications = ({
|
|
|
28160
28336
|
)
|
|
28161
28337
|
].sort((a, b) => b.createdTimeMs - a.createdTimeMs);
|
|
28162
28338
|
}, [displayedDirectExecutions, displayedCheckouts]);
|
|
28163
|
-
const displayedNotifications =
|
|
28339
|
+
const displayedNotifications = useMemo41(() => {
|
|
28164
28340
|
return isExpanded ? combinedNotifications : combinedNotifications.slice(0, COLLAPSED_COUNT);
|
|
28165
28341
|
}, [isExpanded, combinedNotifications]);
|
|
28166
28342
|
const handleNotificationClose = (id) => setClosedNotifications((prev) => [...prev, id]);
|
|
@@ -28286,7 +28462,7 @@ function FunCheckoutModalInner({
|
|
|
28286
28462
|
const hasBack = hasHistoryEntry && !disableBack;
|
|
28287
28463
|
const checkoutConfig = checkoutItem.initSettings.config;
|
|
28288
28464
|
const showDydxSwitch = !hasBack && modalState.step !== "checkout_complete" /* CHECKOUT_COMPLETE */;
|
|
28289
|
-
const helpButtonUrl = useFlag(
|
|
28465
|
+
const helpButtonUrl = useFlag(FlagKey32.HelpTutorialUrl);
|
|
28290
28466
|
const { onScroll, topbar, withTopDivider } = useCustomStatusAnimationAboveTopbar({
|
|
28291
28467
|
depositAddress: checkoutItem.depositAddress ?? void 0,
|
|
28292
28468
|
isCheckoutDetailView: modalState.step === "checkout_complete" /* CHECKOUT_COMPLETE */,
|
|
@@ -28314,7 +28490,8 @@ function FunCheckoutModalInner({
|
|
|
28314
28490
|
onClose: onCloseWrapper,
|
|
28315
28491
|
onAnimationComplete: handleAnimationComplete,
|
|
28316
28492
|
titleId: "fun-checkout-modal",
|
|
28317
|
-
isHidden: modalState.isSoftHidden
|
|
28493
|
+
isHidden: modalState.isSoftHidden,
|
|
28494
|
+
withoutBottomPadding: modalState.step === "meld_currency_select" /* MELD_CURRENCY_SELECT */
|
|
28318
28495
|
},
|
|
28319
28496
|
/* @__PURE__ */ React253.createElement(FunCheckoutModalHeightAnimationWrapper, { checkoutStep: modalState.step }, topbar, /* @__PURE__ */ React253.createElement(
|
|
28320
28497
|
Dialog.Content,
|
|
@@ -28485,7 +28662,7 @@ function ModalProvider({ children }) {
|
|
|
28485
28662
|
return /* @__PURE__ */ React255.createElement(
|
|
28486
28663
|
ModalContext.Provider,
|
|
28487
28664
|
{
|
|
28488
|
-
value:
|
|
28665
|
+
value: useMemo42(
|
|
28489
28666
|
() => ({
|
|
28490
28667
|
accountModalOpen,
|
|
28491
28668
|
accountModalTab,
|
|
@@ -29211,7 +29388,7 @@ var FunkitWeb2Provider = ({
|
|
|
29211
29388
|
},
|
|
29212
29389
|
[privy]
|
|
29213
29390
|
);
|
|
29214
|
-
const web2UserInfo =
|
|
29391
|
+
const web2UserInfo = useMemo43(() => {
|
|
29215
29392
|
if (!loggedInUser || !loggedInUser?.linked_accounts || !loggedInUser?.linked_accounts?.length) {
|
|
29216
29393
|
return PLACEHOLDER_FUNKIT_USER_INFO;
|
|
29217
29394
|
}
|
|
@@ -30119,9 +30296,9 @@ function cssStringFromTheme(theme, options = {}) {
|
|
|
30119
30296
|
}
|
|
30120
30297
|
|
|
30121
30298
|
// src/hooks/useIsFunkitCheckoutActivated.ts
|
|
30122
|
-
import { FlagKey as
|
|
30299
|
+
import { FlagKey as FlagKey33 } from "@funkit/utils";
|
|
30123
30300
|
var useIsFunkitCheckoutActivated = () => {
|
|
30124
|
-
const isCheckoutActivated = useFlag(
|
|
30301
|
+
const isCheckoutActivated = useFlag(FlagKey33.IsCheckoutActivated);
|
|
30125
30302
|
return {
|
|
30126
30303
|
isActivated: isCheckoutActivated
|
|
30127
30304
|
};
|
|
@@ -30226,7 +30403,7 @@ function setFunkitConnectVersion({ version }) {
|
|
|
30226
30403
|
localStorage.setItem(storageKey5, version);
|
|
30227
30404
|
}
|
|
30228
30405
|
function getCurrentSdkVersion() {
|
|
30229
|
-
return "5.5.
|
|
30406
|
+
return "5.5.9";
|
|
30230
30407
|
}
|
|
30231
30408
|
function useFingerprint() {
|
|
30232
30409
|
const fingerprint = useCallback49(() => {
|