@funkit/connect 3.0.0-next.4 → 3.0.0-next.6

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.
Files changed (40) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/dist/components/Dialog/Dialog.d.ts +2 -1
  3. package/dist/components/FunkitProvider/FunkitCheckoutContext.d.ts +2 -2
  4. package/dist/hooks/useDynamicFont.d.ts +0 -1
  5. package/dist/hooks/useInputAmountRestriction.d.ts +7 -0
  6. package/dist/hooks/useUsableWalletAssetsForCheckout.d.ts +4 -0
  7. package/dist/index.js +250 -245
  8. package/dist/utils/colors.d.ts +1 -1
  9. package/dist/utils/moonpay.d.ts +0 -1
  10. package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
  11. package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
  12. package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
  13. package/dist/wallets/walletConnectors/chunk-2EMZOYQI.js +101 -0
  14. package/dist/wallets/walletConnectors/chunk-5K4DIMYR.js +95 -0
  15. package/dist/wallets/walletConnectors/chunk-AUVBWDIK.js +102 -0
  16. package/dist/wallets/walletConnectors/chunk-AXPQHNUI.js +71 -0
  17. package/dist/wallets/walletConnectors/chunk-B7FHT3CB.js +94 -0
  18. package/dist/wallets/walletConnectors/chunk-EFIENLEE.js +98 -0
  19. package/dist/wallets/walletConnectors/chunk-FLTQRYFS.js +27 -0
  20. package/dist/wallets/walletConnectors/chunk-L7QI6PBN.js +108 -0
  21. package/dist/wallets/walletConnectors/chunk-QP2BIVXD.js +73 -0
  22. package/dist/wallets/walletConnectors/chunk-UWZQZY4S.js +149 -0
  23. package/dist/wallets/walletConnectors/chunk-UZEMNN3Q.js +96 -0
  24. package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
  25. package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
  26. package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
  27. package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
  28. package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
  29. package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
  30. package/dist/wallets/walletConnectors/index.js +70 -70
  31. package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
  32. package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
  33. package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
  34. package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
  35. package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
  36. package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
  37. package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
  38. package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
  39. package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
  40. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -2,12 +2,12 @@
2
2
  import {
3
3
  en_US_default
4
4
  } from "./chunk-FRCBBARC.js";
5
- import {
6
- lightTheme
7
- } from "./chunk-76VEFMWE.js";
8
5
  import {
9
6
  darkTheme
10
7
  } from "./chunk-Z3QREJ3Q.js";
8
+ import {
9
+ lightTheme
10
+ } from "./chunk-76VEFMWE.js";
11
11
  import "./chunk-HFT6OV3T.js";
12
12
 
13
13
  // src/components/DevTest/DevEmbed.tsx
@@ -522,7 +522,7 @@ import React169, {
522
522
  useCallback as useCallback31,
523
523
  useContext as useContext18,
524
524
  useEffect as useEffect35,
525
- useMemo as useMemo33,
525
+ useMemo as useMemo34,
526
526
  useState as useState43
527
527
  } from "react";
528
528
  import { useConfig as useConfig5, useConnect as useConnect2, useDisconnect as useDisconnect2 } from "wagmi";
@@ -733,22 +733,6 @@ import React9, {
733
733
  } from "react";
734
734
  import { useConfig } from "wagmi";
735
735
 
736
- // src/utils/memoize.ts
737
- var memoize = (fn) => {
738
- const cache = /* @__PURE__ */ new Map();
739
- const memoizedFn = (...args) => {
740
- const key = JSON.stringify(args);
741
- if (cache.has(key)) {
742
- return cache.get(key);
743
- }
744
- const result = fn(...args);
745
- cache.set(key, result);
746
- return result;
747
- };
748
- memoizedFn.cache = cache;
749
- return memoizedFn;
750
- };
751
-
752
736
  // src/utils/mesh.ts
753
737
  import {
754
738
  meshGetCryptocurrencyHoldings,
@@ -941,6 +925,22 @@ var flagConfig = {
941
925
  // src/utils/flags/impl.ts
942
926
  import { datadogLogs as datadogLogs2 } from "@datadog/browser-logs";
943
927
 
928
+ // src/utils/memoize.ts
929
+ var memoize = (fn) => {
930
+ const cache = /* @__PURE__ */ new Map();
931
+ const memoizedFn = (...args) => {
932
+ const key = JSON.stringify(args);
933
+ if (cache.has(key)) {
934
+ return cache.get(key);
935
+ }
936
+ const result = fn(...args);
937
+ cache.set(key, result);
938
+ return result;
939
+ };
940
+ memoizedFn.cache = cache;
941
+ return memoizedFn;
942
+ };
943
+
944
944
  // src/utils/flags/endpoint.ts
945
945
  var FLAG_ENDPOINT_HOST = "sdk-cdn.fun.xyz";
946
946
  var FLAG_PROD_ENDPOINT_PATH = "flags/v0/config.json";
@@ -1073,7 +1073,14 @@ var FeatureFlag = class _FeatureFlag {
1073
1073
  return fallback;
1074
1074
  }
1075
1075
  const flagValue = this.derivedFlags?.[flagKey];
1076
- return typeof flagValue === "boolean" ? flagValue : fallback;
1076
+ const flagResult = typeof flagValue === "boolean" ? flagValue : fallback;
1077
+ logger.log("flagExposure_getBool", {
1078
+ flagKey,
1079
+ fallback,
1080
+ flagValue,
1081
+ type: "number"
1082
+ });
1083
+ return flagResult;
1077
1084
  }
1078
1085
  getNumber(flagKey, fallback) {
1079
1086
  if (this.derivedFlags === null) {
@@ -1084,7 +1091,14 @@ var FeatureFlag = class _FeatureFlag {
1084
1091
  return fallback;
1085
1092
  }
1086
1093
  const flagValue = this.derivedFlags?.[flagKey];
1087
- return typeof flagValue === "number" ? flagValue : fallback;
1094
+ const flagResult = typeof flagValue === "number" ? flagValue : fallback;
1095
+ logger.log("flagExposure_getNumber", {
1096
+ flagKey,
1097
+ fallback,
1098
+ flagValue,
1099
+ type: "number"
1100
+ });
1101
+ return flagResult;
1088
1102
  }
1089
1103
  getString(flagKey, fallback) {
1090
1104
  if (this.derivedFlags === null) {
@@ -1095,47 +1109,30 @@ var FeatureFlag = class _FeatureFlag {
1095
1109
  return fallback;
1096
1110
  }
1097
1111
  const flagValue = this.derivedFlags?.[flagKey];
1098
- return typeof flagValue === "string" ? flagValue : fallback;
1112
+ const flagResult = typeof flagValue === "string" ? flagValue : fallback;
1113
+ logger.log("flagExposure_getString", {
1114
+ flagKey,
1115
+ fallback,
1116
+ flagValue,
1117
+ type: "bool"
1118
+ });
1119
+ return flagResult;
1099
1120
  }
1100
1121
  };
1101
1122
 
1102
1123
  // src/utils/flags/index.ts
1103
1124
  var singleton = new FeatureFlag(flagConfig);
1104
- var getBool = memoize((...args) => {
1105
- const result = singleton.getBool(...args);
1106
- logger.log("flag_exposure", {
1107
- flagKey: args[0],
1108
- fallback: args[1],
1109
- flagValue: result,
1110
- type: "bool"
1111
- });
1112
- return result;
1113
- });
1114
- var getNumber = memoize((...args) => {
1115
- const result = singleton.getNumber(...args);
1116
- logger.log("flag_exposure", {
1117
- flagKey: args[0],
1118
- fallback: args[1],
1119
- flagValue: result,
1120
- type: "number"
1121
- });
1122
- return result;
1123
- });
1124
- var getString = memoize((...args) => {
1125
- const result = singleton.getString(...args);
1126
- logger.log("flag_exposure", {
1127
- flagKey: args[0],
1128
- fallback: args[1],
1129
- flagValue: result,
1130
- type: "string"
1131
- });
1132
- return result;
1133
- });
1125
+ var getBool = (...args) => {
1126
+ return singleton.getBool(...args);
1127
+ };
1128
+ var getNumber = (...args) => {
1129
+ return singleton.getNumber(...args);
1130
+ };
1131
+ var getString = (...args) => {
1132
+ return singleton.getString(...args);
1133
+ };
1134
1134
  var init = (context) => {
1135
1135
  singleton.init(context);
1136
- getBool.cache = /* @__PURE__ */ new Map();
1137
- getNumber.cache = /* @__PURE__ */ new Map();
1138
- getString.cache = /* @__PURE__ */ new Map();
1139
1136
  };
1140
1137
  var flags = {
1141
1138
  init,
@@ -1417,7 +1414,7 @@ import React168, {
1417
1414
  useCallback as useCallback30,
1418
1415
  useContext as useContext17,
1419
1416
  useEffect as useEffect34,
1420
- useMemo as useMemo32,
1417
+ useMemo as useMemo33,
1421
1418
  useState as useState42
1422
1419
  } from "react";
1423
1420
  import { useAccount as useAccount10, useAccountEffect as useAccountEffect2, useConfig as useConfig4 } from "wagmi";
@@ -2618,9 +2615,9 @@ var DialogBottom = ({
2618
2615
  return /* @__PURE__ */ React27.createElement(Box, { paddingX, ...boxProps });
2619
2616
  };
2620
2617
  var DYDX_API = "NJq0CGrsE19xBbP1vHyBOp8xJvzYo9kayJHqDFP5";
2621
- function useDydxHideBack(hasBackButton) {
2618
+ function useDydxHideBack(hasBackButton, dydxHideBack) {
2622
2619
  const { apiKey } = useFunkitConfig();
2623
- return apiKey === DYDX_API && !hasBackButton;
2620
+ return apiKey === DYDX_API && !hasBackButton && dydxHideBack;
2624
2621
  }
2625
2622
  var DialogTitle = ({
2626
2623
  title,
@@ -2632,7 +2629,8 @@ var DialogTitle = ({
2632
2629
  skipBackDelay = false,
2633
2630
  countdownSeconds,
2634
2631
  countdownKey,
2635
- delayCountdownReturnByBuffer = false
2632
+ delayCountdownReturnByBuffer = false,
2633
+ dydxHideBack
2636
2634
  }) => {
2637
2635
  const hasTimeLeft = countdownSeconds !== void 0 && countdownSeconds > 0;
2638
2636
  const [isCountdownVisible, setIsCountdownVisible] = useState7(hasTimeLeft);
@@ -2654,7 +2652,7 @@ var DialogTitle = ({
2654
2652
  useEffect10(() => {
2655
2653
  setIsCountdownVisible(hasTimeLeft);
2656
2654
  }, [hasTimeLeft, countdownKey]);
2657
- const hideAllBackSection = useDydxHideBack(hasBackButton);
2655
+ const hideAllBackSection = useDydxHideBack(hasBackButton, !!dydxHideBack);
2658
2656
  return /* @__PURE__ */ React27.createElement(
2659
2657
  Box,
2660
2658
  {
@@ -4809,22 +4807,6 @@ var generateMoonpayCurrencyCode = (tokenSymbol, chainId) => {
4809
4807
  const mpCurrencyCode = `${tokenSymbol}${moonpayChainName}`.toLowerCase();
4810
4808
  return mpCurrencyCode;
4811
4809
  };
4812
- function colorToHex(color) {
4813
- let hexColor = color;
4814
- const rgbMatch = color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
4815
- if (rgbMatch) {
4816
- const [, r, g, b] = rgbMatch.map(Number);
4817
- const rHex = r.toString(16).padStart(2, "0");
4818
- const gHex = g.toString(16).padStart(2, "0");
4819
- const bHex = b.toString(16).padStart(2, "0");
4820
- hexColor = `#${rHex}${gHex}${bHex}`;
4821
- }
4822
- const hexMatch = color.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);
4823
- if (hexMatch) {
4824
- hexColor = hexMatch[0].toLowerCase();
4825
- }
4826
- return hexColor;
4827
- }
4828
4810
 
4829
4811
  // src/utils/payment.ts
4830
4812
  function generateSourceOfFundString({
@@ -5603,7 +5585,7 @@ function FunkitCheckoutProvider({ children }) {
5603
5585
  }),
5604
5586
  clientMetadata: _generateClientMetadataForBackend(checkoutId)
5605
5587
  });
5606
- checkoutItem?.initSettings?.onConfirmation?.();
5588
+ checkoutItem?.initSettings?.onConfirmation?.(depositAddress);
5607
5589
  logger.log("checkoutConfirmed", { depositAddress });
5608
5590
  setActiveCheckouts({
5609
5591
  ...activeCheckouts,
@@ -5980,7 +5962,8 @@ function FunKeyValue({
5980
5962
  flexDirection: "row",
5981
5963
  display: "flex",
5982
5964
  alignItems: "center",
5983
- justifyContent: "flex-end"
5965
+ justifyContent: "flex-end",
5966
+ color: valueTextColor
5984
5967
  },
5985
5968
  valueIcon
5986
5969
  ) : null;
@@ -6407,10 +6390,8 @@ var FunTwoFaInput = ({
6407
6390
  borderWidth: "1",
6408
6391
  borderColor: getBorderColor(),
6409
6392
  borderRadius: "10",
6410
- style: {
6411
- overflowX: "auto",
6412
- cursor: isFocused ? "default" : "pointer"
6413
- },
6393
+ cursor: isFocused ? "default" : "pointer",
6394
+ style: { overflowX: "auto" },
6414
6395
  onFocus,
6415
6396
  onBlur,
6416
6397
  onMouseDown: handleMouseDown
@@ -6425,7 +6406,7 @@ var FunTwoFaInput = ({
6425
6406
  style: {
6426
6407
  textAlign: "center",
6427
6408
  padding: 0,
6428
- width: "min-content",
6409
+ width: "20px",
6429
6410
  fontSize: 13,
6430
6411
  fontWeight: "inherit",
6431
6412
  cursor: "inherit"
@@ -10907,7 +10888,7 @@ import {
10907
10888
  FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO8,
10908
10889
  getTokenInfo as getTokenInfo2
10909
10890
  } from "@funkit/core";
10910
- import React167, { useCallback as useCallback29, useEffect as useEffect33, useMemo as useMemo31, useRef as useRef15, useState as useState41 } from "react";
10891
+ import React167, { useCallback as useCallback29, useEffect as useEffect33, useMemo as useMemo32, useRef as useRef15, useState as useState41 } from "react";
10911
10892
  import { arbitrum, mainnet as mainnet6, mantle as mantle2, zkSync as zkSync3 } from "viem/chains";
10912
10893
 
10913
10894
  // src/hooks/useCheckoutAccountBalanceTransfer.ts
@@ -12294,6 +12275,7 @@ function DydxSwitchTab({
12294
12275
  /* @__PURE__ */ React130.createElement(
12295
12276
  Box,
12296
12277
  {
12278
+ width: "half",
12297
12279
  borderRadius: "10",
12298
12280
  borderWidth: "2",
12299
12281
  borderStyle: "solid",
@@ -12310,10 +12292,11 @@ function DydxSwitchTab({
12310
12292
  /* @__PURE__ */ React130.createElement(
12311
12293
  Box,
12312
12294
  {
12313
- style: { cursor: "pointer" },
12295
+ width: "half",
12314
12296
  paddingLeft: "16",
12315
12297
  paddingRight: "12",
12316
12298
  paddingY: "12",
12299
+ cursor: "pointer",
12317
12300
  onClick: onSwitch
12318
12301
  },
12319
12302
  /* @__PURE__ */ React130.createElement(Text, { color: "tertiaryText", style: { float: "right" } }, Standard),
@@ -12950,6 +12933,27 @@ function FunPaymentMeshType({
12950
12933
  import { getMoonpayUrlSignature } from "@funkit/api-base";
12951
12934
  import React141, { memo, useEffect as useEffect28, useMemo as useMemo24, useState as useState32 } from "react";
12952
12935
 
12936
+ // src/utils/colors.ts
12937
+ function colorToHex(color) {
12938
+ let hexColor = color;
12939
+ const rgbMatch = color.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
12940
+ if (rgbMatch) {
12941
+ const [, r, g, b] = rgbMatch.map(Number);
12942
+ const rHex = r.toString(16).padStart(2, "0");
12943
+ const gHex = g.toString(16).padStart(2, "0");
12944
+ const bHex = b.toString(16).padStart(2, "0");
12945
+ hexColor = `#${rHex}${gHex}${bHex}`;
12946
+ }
12947
+ const hexMatch = color.match(/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i);
12948
+ if (hexMatch) {
12949
+ hexColor = hexMatch[0].toLowerCase();
12950
+ }
12951
+ return hexColor;
12952
+ }
12953
+ var isHexString = (color) => {
12954
+ return /^#([0-9a-f]{3}){1,2}$/i.test(color);
12955
+ };
12956
+
12953
12957
  // src/components/FunPayments/FunPaymentMoonpayType.css.ts
12954
12958
  var mpClass = "_1kmpeyf0";
12955
12959
  var stretchStyle = "_1kmpeyf1";
@@ -13198,7 +13202,7 @@ import {
13198
13202
  meshPreviewTransfer as meshPreviewTransfer2
13199
13203
  } from "@funkit/api-base";
13200
13204
  import { ERC20_ABI, isAddress as isAddress3, USDT_ABI } from "@funkit/core";
13201
- import React154, { useCallback as useCallback24, useMemo as useMemo28, useState as useState36 } from "react";
13205
+ import React154, { useCallback as useCallback24, useMemo as useMemo29, useState as useState36 } from "react";
13202
13206
  import { createPortal as createPortal5 } from "react-dom";
13203
13207
  import { useAccount as useAccount9, useSendTransaction, useWriteContract } from "wagmi";
13204
13208
 
@@ -13222,9 +13226,34 @@ function isMainnetUsdt(chainId, address) {
13222
13226
 
13223
13227
  // src/components/FunPayments/FunPaymentMethods.tsx
13224
13228
  import { getAssetPriceInfo as getAssetPriceInfo3 } from "@funkit/api-base";
13225
- import React148, { useCallback as useCallback23, useMemo as useMemo25, useState as useState33 } from "react";
13229
+ import React148, { useCallback as useCallback23, useMemo as useMemo26, useState as useState33 } from "react";
13226
13230
  import { createPortal as createPortal4 } from "react-dom";
13227
13231
 
13232
+ // src/hooks/useUsableWalletAssetsForCheckout.ts
13233
+ import { useMemo as useMemo25 } from "react";
13234
+ function useUsableWalletAssetsForCheckout(checkoutId) {
13235
+ const { checkoutItem } = useFunkitPreCheckoutInternal(checkoutId);
13236
+ const { walletAssets, isWeb3Login, isWeb2Login } = useGeneralWallet();
13237
+ return useMemo25(() => {
13238
+ if (!walletAssets || !checkoutItem) return;
13239
+ const usableAssets = {};
13240
+ for (const [assetKey, asset] of Object.entries(walletAssets)) {
13241
+ const { isUsable } = isAssetUsableToPayForCheckout(
13242
+ checkoutItem,
13243
+ "balance" /* ACCOUNT_BALANCE */,
13244
+ asset.chainId,
13245
+ asset.contractAddress,
13246
+ isWeb2Login,
13247
+ isWeb3Login
13248
+ );
13249
+ if (isUsable) {
13250
+ usableAssets[assetKey] = asset;
13251
+ }
13252
+ }
13253
+ return usableAssets;
13254
+ }, [checkoutItem, isWeb2Login, isWeb3Login, walletAssets]);
13255
+ }
13256
+
13228
13257
  // src/components/FunPaymentMethodItem/FunPaymentMethodItem.tsx
13229
13258
  import React145 from "react";
13230
13259
  function FunPaymentMethodItem({
@@ -13410,6 +13439,7 @@ function AddPaymentMethodItem({
13410
13439
  const { textCustomizations } = useFunkitConfig();
13411
13440
  const { walletAddress, walletAssets, isWeb3Login, isWeb2Login, userInfo } = useGeneralWallet();
13412
13441
  const { checkoutItem } = useFunkitPreCheckoutInternal(checkoutId);
13442
+ const usableWalletAssets = useUsableWalletAssetsForCheckout(checkoutId);
13413
13443
  const isEnabledForFlow = config.isEnabledForCheckout;
13414
13444
  const labelText = config.labelDynamic(
13415
13445
  textCustomizations,
@@ -13425,36 +13455,27 @@ function AddPaymentMethodItem({
13425
13455
  return /* @__PURE__ */ React148.createElement(React148.Fragment, null);
13426
13456
  }
13427
13457
  const getDynamicValueIconComponent = () => {
13428
- if (paymentMethod !== "balance" /* ACCOUNT_BALANCE */ || !checkoutItem) {
13458
+ if (paymentMethod !== "balance" /* ACCOUNT_BALANCE */ || !checkoutItem || !usableWalletAssets) {
13429
13459
  return config.conditionalIcon;
13430
13460
  }
13431
- const availableChainMetadata = Object.values(walletAssets ?? {}).filter(
13432
- (asset) => isAssetUsableToPayForCheckout(
13433
- checkoutItem,
13434
- paymentMethod,
13435
- asset.chainId,
13436
- asset.contractAddress,
13437
- isWeb2Login,
13438
- isWeb3Login
13439
- ).isUsable
13440
- ).map((asset) => {
13441
- return chainMetadataById[asset.chainId];
13442
- });
13443
- const uniqueChains = Array.from(new Set(availableChainMetadata));
13444
- return /* @__PURE__ */ React148.createElement(Box, { display: "flex", alignItems: "center", justifyContent: "flex-end" }, uniqueChains.map((chain, index) => {
13461
+ const uniqueChainIds = Array.from(
13462
+ new Set(Object.values(usableWalletAssets).map((asset) => asset.chainId))
13463
+ );
13464
+ return /* @__PURE__ */ React148.createElement(Box, { display: "flex", alignItems: "center", justifyContent: "flex-end" }, uniqueChainIds.map((chainId, index) => {
13465
+ const metadata = chainMetadataById[chainId];
13445
13466
  return /* @__PURE__ */ React148.createElement(
13446
13467
  Box,
13447
13468
  {
13448
- key: chain.name,
13469
+ key: metadata.name,
13449
13470
  position: "relative",
13450
- style: { right: `${(uniqueChains.length - index - 1) * -2}px` }
13471
+ style: { right: `${(uniqueChainIds.length - index - 1) * -2}px` }
13451
13472
  },
13452
13473
  /* @__PURE__ */ React148.createElement(
13453
13474
  AsyncImage,
13454
13475
  {
13455
- alt: chain.name,
13476
+ alt: metadata.name,
13456
13477
  borderRadius: "full",
13457
- src: chain.iconUrl,
13478
+ src: metadata.iconUrl,
13458
13479
  height: 12,
13459
13480
  width: 12
13460
13481
  }
@@ -13531,46 +13552,50 @@ function FunPaymentMethods({
13531
13552
  }) {
13532
13553
  const { apiKey } = useFunkitConfig();
13533
13554
  useWalletAssetsListener();
13534
- const {
13535
- walletAssets,
13536
- totalWalletAssetsUsd,
13537
- isWeb3Login,
13538
- isWeb2Login,
13539
- isUserLoggedIn
13540
- } = useGeneralWallet();
13555
+ const { isUserLoggedIn } = useGeneralWallet();
13541
13556
  const { checkoutItem, updateTargetAssetAmount, getCheckoutDraftDollarValue } = useFunkitPreCheckoutInternal(checkoutId);
13542
13557
  const defaultPaymentMethod = checkoutItem?.initSettings.config.defaultPaymentMethod;
13543
13558
  const [selectedOption, setSelectedOption] = useState33(
13544
13559
  defaultPaymentMethod || null
13545
13560
  );
13546
- const maxUsdUsableAsset = useMemo25(() => {
13547
- if (!checkoutItem || !depositAmount || !walletAssets) {
13561
+ const usableWalletAssets = useUsableWalletAssetsForCheckout(checkoutId);
13562
+ const totalUsableWalletAssetsUsd = Object.values(
13563
+ usableWalletAssets ?? {}
13564
+ ).reduce((total, asset) => total + (asset.totalUsdValue || 0), 0);
13565
+ const maxUsdUsableAsset = useMemo26(() => {
13566
+ if (!depositAmount || !usableWalletAssets) {
13548
13567
  return null;
13549
13568
  }
13550
- let maybeAsset = null;
13551
- for (const assetKey of Object.keys(walletAssets)) {
13552
- const asset = walletAssets[assetKey];
13553
- if (!asset || assetKey == "nfts") {
13554
- continue;
13555
- }
13556
- const { isUsable } = isAssetUsableToPayForCheckout(
13557
- checkoutItem,
13558
- "balance" /* ACCOUNT_BALANCE */,
13559
- asset.chainId,
13560
- asset.contractAddress,
13561
- isWeb2Login,
13562
- isWeb3Login
13563
- );
13564
- if (!isUsable) {
13565
- continue;
13566
- }
13567
- if (!maybeAsset || maybeAsset.totalUsdValue < asset.totalUsdValue) {
13568
- maybeAsset = asset;
13569
+ let maxAsset = null;
13570
+ for (const assetKey in usableWalletAssets) {
13571
+ const asset = usableWalletAssets[assetKey];
13572
+ if (!maxAsset || maxAsset.totalUsdValue < asset.totalUsdValue) {
13573
+ maxAsset = asset;
13569
13574
  }
13570
13575
  }
13571
- return maybeAsset;
13572
- }, [checkoutItem, depositAmount, isWeb2Login, isWeb3Login, walletAssets]);
13573
- const hasSufficientBalance2 = useMemo25(() => {
13576
+ return maxAsset;
13577
+ }, [depositAmount, usableWalletAssets]);
13578
+ const recommendedCheckoutUsdAmountWithMaxUsdUsableAsset = useMemo26(() => {
13579
+ if (!maxUsdUsableAsset || !checkoutItem || selectedOption !== "balance" /* ACCOUNT_BALANCE */) {
13580
+ return 0;
13581
+ }
13582
+ const maxUsdAssetHoldingItem = {
13583
+ iconSrc: maxUsdUsableAsset.logo,
13584
+ symbol: maxUsdUsableAsset.symbol,
13585
+ amount: getNormalizedTokenBalance(
13586
+ Number(maxUsdUsableAsset.tokenBalance),
13587
+ maxUsdUsableAsset.decimals
13588
+ ),
13589
+ usdAmount: maxUsdUsableAsset.totalUsdValue,
13590
+ tokenAddress: maxUsdUsableAsset.contractAddress,
13591
+ pickedChainId: maxUsdUsableAsset.chainId
13592
+ };
13593
+ return Math.max(
13594
+ maxUsdAssetHoldingItem.usdAmount - getFeesUsdEstimate(checkoutItem, maxUsdAssetHoldingItem),
13595
+ 1
13596
+ );
13597
+ }, [checkoutItem, maxUsdUsableAsset, selectedOption]);
13598
+ const hasSufficientBalance2 = useMemo26(() => {
13574
13599
  if (!depositAmount) return true;
13575
13600
  return maxUsdUsableAsset && maxUsdUsableAsset.totalUsdValue >= parseFloat(depositAmount);
13576
13601
  }, [depositAmount, maxUsdUsableAsset]);
@@ -13588,26 +13613,7 @@ function FunPaymentMethods({
13588
13613
  assetTokenAddress: checkoutItem.initSettings.config.targetAsset
13589
13614
  });
13590
13615
  if (!info || !info.unitPrice) return;
13591
- const maxUsdAmountFromHolding = () => {
13592
- const maxUsdAsset = maxUsdUsableAsset;
13593
- if (!maxUsdAsset) return 0;
13594
- const maxUsdAssetHoldingItem = {
13595
- iconSrc: maxUsdAsset.logo,
13596
- symbol: maxUsdAsset.symbol,
13597
- amount: getNormalizedTokenBalance(
13598
- Number(maxUsdAsset.tokenBalance),
13599
- maxUsdAsset.decimals
13600
- ),
13601
- usdAmount: maxUsdAsset.totalUsdValue,
13602
- tokenAddress: maxUsdAsset.contractAddress,
13603
- pickedChainId: maxUsdAsset.chainId
13604
- };
13605
- return Math.max(
13606
- maxUsdAssetHoldingItem.usdAmount - getFeesUsdEstimate(checkoutItem, maxUsdAssetHoldingItem),
13607
- 1
13608
- );
13609
- };
13610
- const newTargetAmountUsd = selectedOption === "card" /* CARD */ ? MINIMUM_MOONPAY_DEPOSIT_AMOUNT_USD : selectedOption === "balance" /* ACCOUNT_BALANCE */ ? maxUsdAmountFromHolding() : 0;
13616
+ const newTargetAmountUsd = selectedOption === "card" /* CARD */ ? MINIMUM_MOONPAY_DEPOSIT_AMOUNT_USD : selectedOption === "balance" /* ACCOUNT_BALANCE */ ? recommendedCheckoutUsdAmountWithMaxUsdUsableAsset : 0;
13611
13617
  const minTargetAmount = roundUpToXDecimalPlaces(
13612
13618
  (newTargetAmountUsd / info.unitPrice).toString(),
13613
13619
  5
@@ -13616,21 +13622,22 @@ function FunPaymentMethods({
13616
13622
  await getCheckoutDraftDollarValue();
13617
13623
  }, [
13618
13624
  apiKey,
13619
- checkoutItem,
13625
+ checkoutItem?.initSettings.config.targetAsset,
13626
+ checkoutItem?.initSettings.config.targetChain,
13620
13627
  getCheckoutDraftDollarValue,
13621
- maxUsdUsableAsset,
13628
+ recommendedCheckoutUsdAmountWithMaxUsdUsableAsset,
13622
13629
  selectedOption,
13623
13630
  updateTargetAssetAmount
13624
13631
  ]);
13625
- const isWalletEmpty = totalWalletAssetsUsd === 0;
13626
- const notificationConfig = useMemo25(() => {
13632
+ const notificationConfig = useMemo26(() => {
13627
13633
  const isInvalidMoonpay = "card" /* CARD */ === selectedOption && isAmountInvalidForMoonpay({ amountUsd: depositAmount });
13628
13634
  const isInvalidAccBalance = "balance" /* ACCOUNT_BALANCE */ === selectedOption && !hasSufficientBalance2;
13629
13635
  const isContinuable = !isDisabled && !isInvalidMoonpay && !isInvalidAccBalance;
13630
- const continueErrorText = isInvalidMoonpay ? generateInsufficientAmountForMoonpayError(true) : isInvalidAccBalance ? totalWalletAssetsUsd > 0.01 ? `${formatCurrencyAndStringify(
13631
- maxUsdUsableAsset?.totalUsdValue || 0
13636
+ const continueErrorText = isInvalidMoonpay ? generateInsufficientAmountForMoonpayError(true) : isInvalidAccBalance ? recommendedCheckoutUsdAmountWithMaxUsdUsableAsset > 0.01 ? `${formatCurrencyAndStringify(
13637
+ recommendedCheckoutUsdAmountWithMaxUsdUsableAsset
13632
13638
  )} maximum order` : `Insufficient balance.` : "";
13633
13639
  const hasQuoteError = messageType === "error";
13640
+ const isWalletEmpty = totalUsableWalletAssetsUsd === 0;
13634
13641
  return {
13635
13642
  isUpdateNeeded: !isContinuable || hasQuoteError,
13636
13643
  isUpdatePossible: "balance" /* ACCOUNT_BALANCE */ !== selectedOption || !isWalletEmpty,
@@ -13639,24 +13646,23 @@ function FunPaymentMethods({
13639
13646
  notificationType: hasQuoteError ? "error" : !isContinuable ? "warning" : "default"
13640
13647
  };
13641
13648
  }, [
13642
- totalWalletAssetsUsd,
13643
- maxUsdUsableAsset?.totalUsdValue,
13649
+ recommendedCheckoutUsdAmountWithMaxUsdUsableAsset,
13644
13650
  depositAmount,
13645
13651
  hasSufficientBalance2,
13646
13652
  isDisabled,
13647
- isWalletEmpty,
13648
13653
  messageType,
13649
13654
  quoteMessage,
13650
- selectedOption
13655
+ selectedOption,
13656
+ totalUsableWalletAssetsUsd
13651
13657
  ]);
13652
- const enabledPaymentMethods = useMemo25(() => {
13658
+ const enabledPaymentMethods = useMemo26(() => {
13653
13659
  return Object.keys(PAYMENT_METHOD_CONFIG).filter((paymentMethod) => {
13654
13660
  const disabled = paymentMethod === "transfer" /* TRANSFER */ || paymentMethod === "balance" /* ACCOUNT_BALANCE */ && !isUserLoggedIn;
13655
13661
  return !disabled;
13656
13662
  });
13657
13663
  }, [isUserLoggedIn]);
13658
13664
  const [isContinuing, setIsContinuing] = useState33(false);
13659
- const canContinue = useMemo25(() => {
13665
+ const canContinue = useMemo26(() => {
13660
13666
  return isNotNullish(selectedOption) && Object.values(PaymentMethod).includes(selectedOption) && !isContinuing && !checkoutItem?.isDrafting && enabledPaymentMethods.includes(selectedOption);
13661
13667
  }, [
13662
13668
  isContinuing,
@@ -13691,7 +13697,7 @@ function FunPaymentMethods({
13691
13697
  isClickable: !isContinuing,
13692
13698
  onClick: () => setSelectedOption(expressOption),
13693
13699
  disclaimerText: PAYMENT_METHOD_CONFIG[expressOption].disclaimerTextFn(
13694
- formatCurrencyAndStringify(totalWalletAssetsUsd)
13700
+ formatCurrencyAndStringify(totalUsableWalletAssetsUsd)
13695
13701
  )
13696
13702
  }
13697
13703
  ), /* @__PURE__ */ React148.createElement(Text, { size: "13", weight: "medium", color: "secondaryText" }, "More options"), enabledPaymentMethods.filter((pm) => pm !== expressOption).map((paymentMethod) => {
@@ -13705,7 +13711,7 @@ function FunPaymentMethods({
13705
13711
  isClickable: !isContinuing,
13706
13712
  onClick: () => setSelectedOption(paymentMethod),
13707
13713
  disclaimerText: PAYMENT_METHOD_CONFIG[paymentMethod].disclaimerTextFn(
13708
- formatCurrencyAndStringify(totalWalletAssetsUsd)
13714
+ formatCurrencyAndStringify(totalUsableWalletAssetsUsd)
13709
13715
  )
13710
13716
  }
13711
13717
  );
@@ -13748,7 +13754,7 @@ function FunPaymentMethods({
13748
13754
  }
13749
13755
 
13750
13756
  // src/components/FunTransactionSummary/FunTransactionSummary.tsx
13751
- import React151, { useMemo as useMemo26, useState as useState34 } from "react";
13757
+ import React151, { useMemo as useMemo27, useState as useState34 } from "react";
13752
13758
 
13753
13759
  // src/components/Icons/CaretDownIcon.tsx
13754
13760
  import React149 from "react";
@@ -14030,7 +14036,7 @@ function FunTransactionSummary({
14030
14036
  )
14031
14037
  };
14032
14038
  const estTime = (checkoutItem?.latestQuote?.finalTimeEstimationMs || 0) / 1e3 || 0;
14033
- const paymentTokenString = useMemo26(() => {
14039
+ const paymentTokenString = useMemo27(() => {
14034
14040
  return formatCryptoAndStringify(
14035
14041
  parseFloat(checkoutItem?.latestQuote?.finalPaymentTokenAmount || "0"),
14036
14042
  `${checkoutItem?.selectedSourceAssetInfo?.symbol}` || ""
@@ -14111,7 +14117,7 @@ var FunInfoIcon = ({ size = 14 }) => /* @__PURE__ */ React152.createElement(
14111
14117
  );
14112
14118
 
14113
14119
  // src/components/FunCheckoutModal/FunCheckoutPrimaryInfo.tsx
14114
- import React153, { useEffect as useEffect29, useMemo as useMemo27, useState as useState35 } from "react";
14120
+ import React153, { useEffect as useEffect29, useMemo as useMemo28, useState as useState35 } from "react";
14115
14121
  function CheckoutPrimaryInfoSnapshot({
14116
14122
  checkoutItem,
14117
14123
  isLoading,
@@ -14119,10 +14125,10 @@ function CheckoutPrimaryInfoSnapshot({
14119
14125
  preserveMinHeight = true
14120
14126
  }) {
14121
14127
  const checkoutConfig = checkoutItem.initSettings.config;
14122
- const displaySubtitle = useMemo27(() => {
14128
+ const displaySubtitle = useMemo28(() => {
14123
14129
  return getCheckoutItemDisplay(checkoutConfig, checkoutItem);
14124
14130
  }, [checkoutConfig, checkoutItem]);
14125
- const displayDollarValue = useMemo27(() => {
14131
+ const displayDollarValue = useMemo28(() => {
14126
14132
  const prioritizedValue = prioritizeDraftValue ? checkoutItem.draftDollarValue : checkoutItem.finalDollarValue;
14127
14133
  const fallbackValue = prioritizeDraftValue ? checkoutItem.finalDollarValue : checkoutItem.draftDollarValue;
14128
14134
  return prioritizedValue || fallbackValue || 0;
@@ -14541,7 +14547,7 @@ function FunCheckoutConfirmationStep({
14541
14547
  const stepMessage = isRegeneratingQuote ? "Regenerating quote..." : postCheckoutStepMessage || checkoutStepMessage;
14542
14548
  const hasStepMessage = !hasError && Boolean(stepMessage);
14543
14549
  const bottomSectionRef = document.getElementById(CHECKOUT_MODAL_BOTTOM_BAR_ID);
14544
- const cardDisclaimer = useMemo28(() => {
14550
+ const cardDisclaimer = useMemo29(() => {
14545
14551
  const finalConvertedAssetName = getCheckoutItemDisplay(
14546
14552
  // @ts-expect-error - TODO: Add guardrail for this being undefined (technically it should never be undefined)
14547
14553
  checkoutItem?.initSettings.config,
@@ -14822,17 +14828,14 @@ var FunCheckoutConnectExchangeStep = ({
14822
14828
 
14823
14829
  // src/components/FunCheckoutModal/FunCheckoutInputAmountStep.tsx
14824
14830
  import { getAssetPriceInfo as getAssetPriceInfo4 } from "@funkit/api-base";
14825
- import React162, { useCallback as useCallback27, useEffect as useEffect31, useMemo as useMemo29, useState as useState39 } from "react";
14831
+ import React162, { useCallback as useCallback27, useEffect as useEffect31, useMemo as useMemo30, useState as useState39 } from "react";
14826
14832
  import { createPortal as createPortal7 } from "react-dom";
14827
14833
 
14828
14834
  // src/hooks/useDynamicFont.ts
14829
14835
  import { useCallback as useCallback26, useEffect as useEffect30, useRef as useRef14, useState as useState38 } from "react";
14830
14836
  var SIZE_STEP = 1;
14831
- var MIN_WIDTH = 10;
14832
- var MAX_WIDTH = 235;
14833
14837
  var ALLOWANCE = 20;
14834
14838
  var useDynamicFont = (inputValue, max, min = 16) => {
14835
- const [textWidth, setTextWidth] = useState38(MIN_WIDTH);
14836
14839
  const [fontSize, setFontSize] = useState38(max);
14837
14840
  const inputRef = useRef14(null);
14838
14841
  const canvasRef = useRef14(document.createElement("canvas"));
@@ -14848,22 +14851,30 @@ var useDynamicFont = (inputValue, max, min = 16) => {
14848
14851
  };
14849
14852
  const resizeText = () => {
14850
14853
  if (!inputRef.current) return;
14851
- const textWidth2 = measureTextWidth(inputValue);
14852
- if (textWidth2 === void 0) return;
14853
- if (textWidth2 > MIN_WIDTH) setTextWidth(textWidth2 + ALLOWANCE);
14854
- if (fontSize > min && textWidth2 > MAX_WIDTH) {
14854
+ const textWidth = measureTextWidth(inputValue);
14855
+ if (textWidth === void 0) return;
14856
+ const maxWidth = inputRef.current.getBoundingClientRect().width;
14857
+ if (fontSize > min && textWidth > maxWidth) {
14855
14858
  setFontSize((prevSize) => prevSize - SIZE_STEP);
14856
- } else if (fontSize < max && textWidth2 < MAX_WIDTH - ALLOWANCE) {
14859
+ } else if (fontSize < max && textWidth < maxWidth - ALLOWANCE) {
14857
14860
  setFontSize((prevSize) => prevSize + SIZE_STEP);
14858
14861
  }
14859
14862
  };
14860
14863
  resizeText();
14861
14864
  }, [max, min, inputValue, fontSize]);
14862
- const resetText = useCallback26(() => {
14863
- setTextWidth(MAX_WIDTH);
14864
- setFontSize(max);
14865
- }, [max]);
14866
- return { ref: inputRef, fontSize, textWidth, resetText };
14865
+ const resetText = useCallback26(() => setFontSize(max), [max]);
14866
+ return { ref: inputRef, fontSize, resetText };
14867
+ };
14868
+
14869
+ // src/hooks/useInputAmountRestriction.ts
14870
+ var MAX_AMOUNT = 2e3;
14871
+ var useAmountRestriction = (currentAmount) => {
14872
+ const { apiKey } = useFunkitConfig();
14873
+ const isDydx = apiKey === "NJq0CGrsE19xBbP1vHyBOp8xJvzYo9kayJHqDFP5";
14874
+ const isOverLimit = currentAmount > MAX_AMOUNT && isDydx;
14875
+ return {
14876
+ error: isOverLimit && `$${MAX_AMOUNT} maximum order`
14877
+ };
14867
14878
  };
14868
14879
 
14869
14880
  // src/components/Icons/SwitchIcon.tsx
@@ -14912,7 +14923,7 @@ var FunCheckoutInputAmountStep = ({
14912
14923
  const [errorMessage, setErrorMessage] = useState39("");
14913
14924
  const inputPlaceholder = isAmountInAbsolute ? "0.0000" : "$0";
14914
14925
  const inputValue = amountInput === "" ? "" : isAmountInAbsolute ? amountInput : `$${amountInput}`;
14915
- const { ref, fontSize, textWidth, resetText } = useDynamicFont(
14926
+ const { ref, fontSize, resetText } = useDynamicFont(
14916
14927
  inputValue || inputPlaceholder,
14917
14928
  BASE_FONT_SIZE
14918
14929
  );
@@ -14949,7 +14960,7 @@ var FunCheckoutInputAmountStep = ({
14949
14960
  }
14950
14961
  setIsInited(true);
14951
14962
  }, [initialAssetAmount, isAmountInAbsolute, isInited, unitPrice]);
14952
- const finalAmounts = useMemo29(() => {
14963
+ const finalAmounts = useMemo30(() => {
14953
14964
  if (unitPrice == null) {
14954
14965
  return {
14955
14966
  usdEquivalent: 0,
@@ -14963,6 +14974,9 @@ var FunCheckoutInputAmountStep = ({
14963
14974
  absoluteEquivalent: parseFloat(absoluteEquivalent.toFixed(5))
14964
14975
  };
14965
14976
  }, [amountInput, isAmountInAbsolute, unitPrice]);
14977
+ const { error: inputLimitError } = useAmountRestriction(
14978
+ finalAmounts.usdEquivalent
14979
+ );
14966
14980
  const [isContinuing, setIsContinuing] = useState39(false);
14967
14981
  const onClickContinue = useCallback27(async () => {
14968
14982
  setIsContinuing(true);
@@ -15026,10 +15040,10 @@ var FunCheckoutInputAmountStep = ({
15026
15040
  flexDirection: "column",
15027
15041
  alignItems: "center",
15028
15042
  justifyContent: "center",
15029
- gap: "10",
15043
+ gap: "8",
15030
15044
  width: "full"
15031
15045
  },
15032
- unitPrice == null && !errorMessage ? /* @__PURE__ */ React162.createElement(Box, { style: { marginBottom: "8px", marginTop: "11px" } }, /* @__PURE__ */ React162.createElement(FunSkeletonBlock, { height: fontSize, width: fontSize * 3 })) : /* @__PURE__ */ React162.createElement(
15046
+ unitPrice == null && !errorMessage ? /* @__PURE__ */ React162.createElement(FunSkeletonBlock, { height: fontSize, width: fontSize * 3 }) : /* @__PURE__ */ React162.createElement(
15033
15047
  Box,
15034
15048
  {
15035
15049
  display: "flex",
@@ -15038,41 +15052,29 @@ var FunCheckoutInputAmountStep = ({
15038
15052
  alignItems: "flex-end"
15039
15053
  },
15040
15054
  /* @__PURE__ */ React162.createElement(
15041
- Box,
15055
+ FunInput,
15042
15056
  {
15043
- style: {
15044
- maxWidth: `${textWidth}px`,
15045
- transform: "translateY(15%)"
15046
- }
15047
- },
15048
- /* @__PURE__ */ React162.createElement(
15049
- FunInput,
15050
- {
15051
- ref,
15052
- value: inputValue,
15053
- placeholder: inputPlaceholder,
15054
- onChange: handleInputChange,
15055
- inputProps: {
15056
- type: isAmountInAbsolute ? "number" : "text",
15057
- autoFocus: true,
15058
- disabled: unitPrice == null,
15059
- // get ios to use numpad key with period
15060
- inputMode: "decimal"
15061
- },
15062
- inputStyle: {
15063
- textAlign: "center",
15064
- padding: "0px",
15065
- fontSize: `${fontSize}px`,
15066
- lineHeight: `${fontSize}px`,
15067
- maxWidth: `${textWidth}px`
15068
- },
15069
- textColor: "primaryText",
15070
- overrideBorderWidth: "0",
15071
- overrideBackground: "transparent"
15072
- }
15073
- )
15074
- ),
15075
- ticker && isAmountInAbsolute && /* @__PURE__ */ React162.createElement(Text, { size: "20", color: "primaryText", weight: "semibold" }, ticker)
15057
+ ref,
15058
+ value: inputValue,
15059
+ placeholder: inputPlaceholder,
15060
+ onChange: handleInputChange,
15061
+ inputProps: {
15062
+ type: isAmountInAbsolute ? "number" : "text",
15063
+ autoFocus: true,
15064
+ disabled: unitPrice == null,
15065
+ // get ios to use numpad key with period
15066
+ inputMode: "decimal"
15067
+ },
15068
+ inputStyle: {
15069
+ textAlign: "center",
15070
+ padding: "0px",
15071
+ fontSize: `${fontSize}px`
15072
+ },
15073
+ textColor: "primaryText",
15074
+ overrideBorderWidth: "0",
15075
+ overrideBackground: "transparent"
15076
+ }
15077
+ )
15076
15078
  ),
15077
15079
  ticker && /* @__PURE__ */ React162.createElement(
15078
15080
  Box,
@@ -15109,6 +15111,13 @@ var FunCheckoutInputAmountStep = ({
15109
15111
  type: "error",
15110
15112
  description: errorMessage
15111
15113
  }
15114
+ ), /* @__PURE__ */ React162.createElement(
15115
+ FunNotification,
15116
+ {
15117
+ isVisible: !!inputLimitError,
15118
+ type: "warning",
15119
+ description: inputLimitError
15120
+ }
15112
15121
  ), showAssetAvailableElement && targetAssetInWallet && !!targetAssetInWallet.totalUsdValue && /* @__PURE__ */ React162.createElement(
15113
15122
  Box,
15114
15123
  {
@@ -15135,7 +15144,7 @@ var FunCheckoutInputAmountStep = ({
15135
15144
  actionButtonProps: {
15136
15145
  title: "Continue",
15137
15146
  onClick: onClickContinue,
15138
- isDisabled: unitPrice == null || isContinuing || (finalAmounts.absoluteEquivalent || 0) <= 0 || finalAmounts.usdEquivalent <= 0,
15147
+ isDisabled: unitPrice == null || isContinuing || (finalAmounts.absoluteEquivalent || 0) <= 0 || finalAmounts.usdEquivalent <= 0 || !!inputLimitError,
15139
15148
  isLoading: isContinuing
15140
15149
  }
15141
15150
  }
@@ -15149,7 +15158,7 @@ import {
15149
15158
  FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS as FUNKIT_CONNECT_CHECKOUT_NATIVE_CURRENCY_ADDRESS3,
15150
15159
  FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO as FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO7
15151
15160
  } from "@funkit/core";
15152
- import React165, { useCallback as useCallback28, useEffect as useEffect32, useMemo as useMemo30, useState as useState40 } from "react";
15161
+ import React165, { useCallback as useCallback28, useEffect as useEffect32, useMemo as useMemo31, useState as useState40 } from "react";
15153
15162
  import { createPortal as createPortal8 } from "react-dom";
15154
15163
 
15155
15164
  // src/components/FunAsset/FunAssetItem.tsx
@@ -15432,7 +15441,7 @@ function MeshOrAccountSelectAsset({
15432
15441
  generateAccountHoldingsMapForMesh,
15433
15442
  generateAccountHoldingsMapForBalance
15434
15443
  ]);
15435
- const defaultTokenSymbols = useMemo30(() => {
15444
+ const defaultTokenSymbols = useMemo31(() => {
15436
15445
  if (!checkoutItem) {
15437
15446
  return [];
15438
15447
  }
@@ -15449,7 +15458,7 @@ function MeshOrAccountSelectAsset({
15449
15458
  }
15450
15459
  return [];
15451
15460
  }, [checkoutItem, accountHoldingsMap]);
15452
- const assetOptions = useMemo30(() => {
15461
+ const assetOptions = useMemo31(() => {
15453
15462
  if (!checkoutItem || !checkoutItem.selectedPaymentMethodInfo?.paymentMethod)
15454
15463
  return [];
15455
15464
  return Object.keys(accountHoldingsMap).map((chainSymbolKey) => {
@@ -15517,7 +15526,7 @@ function MeshOrAccountSelectAsset({
15517
15526
  const { messageType, quoteMessage } = quoteNotification;
15518
15527
  const hasError = hasFetchAssetsError || hasInsufficientAssetError || messageType === "error";
15519
15528
  const showQuoteMessage = messageType === "step" && !hasError;
15520
- const errorMessage = useMemo30(() => {
15529
+ const errorMessage = useMemo31(() => {
15521
15530
  if (hasFetchAssetsError) {
15522
15531
  return /* @__PURE__ */ React165.createElement("div", null, fetchAssetsError, /* @__PURE__ */ React165.createElement(
15523
15532
  FunLinkButton,
@@ -15960,7 +15969,7 @@ function FunCheckoutModal({
15960
15969
  setAnimateOut(false);
15961
15970
  }, ANIMATION_DELAY4);
15962
15971
  };
15963
- const titleConfig = useMemo31(() => {
15972
+ const titleConfig = useMemo32(() => {
15964
15973
  const baseTitle = checkoutItem?.initSettings?.config?.modalTitle || "Checkout";
15965
15974
  const selectedPaymentMethod2 = checkoutItem?.selectedPaymentMethodInfo?.paymentMethod;
15966
15975
  switch (checkoutStep) {
@@ -16134,7 +16143,8 @@ function FunCheckoutModal({
16134
16143
  onClose: onCloseWrapper,
16135
16144
  countdownSeconds: checkoutStep === "confirmation" /* CONFIRMATION */ ? countdown : 0,
16136
16145
  countdownKey: countdownKey.toString(),
16137
- delayCountdownReturnByBuffer: true
16146
+ delayCountdownReturnByBuffer: true,
16147
+ dydxHideBack: checkoutStep === "input_amount" /* INPUT_AMOUNT */
16138
16148
  }
16139
16149
  ),
16140
16150
  /* @__PURE__ */ React167.createElement(
@@ -16331,7 +16341,7 @@ function ModalProvider({ children }) {
16331
16341
  return /* @__PURE__ */ React168.createElement(
16332
16342
  ModalContext.Provider,
16333
16343
  {
16334
- value: useMemo32(
16344
+ value: useMemo33(
16335
16345
  () => ({
16336
16346
  accountModalOpen,
16337
16347
  chainModalOpen,
@@ -17073,7 +17083,7 @@ var FunkitWeb2Provider = ({
17073
17083
  },
17074
17084
  [privy]
17075
17085
  );
17076
- const web2UserInfo = useMemo33(() => {
17086
+ const web2UserInfo = useMemo34(() => {
17077
17087
  if (!loggedInUser || !loggedInUser?.linked_accounts || !loggedInUser?.linked_accounts?.length) {
17078
17088
  return PLACEHOLDER_FUNKIT_USER_INFO;
17079
17089
  }
@@ -17571,11 +17581,6 @@ var computeWalletConnectMetaData = ({
17571
17581
  };
17572
17582
  };
17573
17583
 
17574
- // src/utils/colors.ts
17575
- var isHexString = (color) => {
17576
- return /^#([0-9a-f]{3}){1,2}$/i.test(color);
17577
- };
17578
-
17579
17584
  // src/utils/omitUndefinedValues.ts
17580
17585
  function omitUndefinedValues(obj) {
17581
17586
  return Object.fromEntries(
@@ -18355,7 +18360,7 @@ function setFunkitConnectVersion({ version }) {
18355
18360
  localStorage.setItem(storageKey5, version);
18356
18361
  }
18357
18362
  function getCurrentSdkVersion() {
18358
- return "3.0.0-next.4";
18363
+ return "3.0.0-next.6";
18359
18364
  }
18360
18365
  function useFingerprint() {
18361
18366
  const fingerprint = useCallback33(() => {