@funkit/connect 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/components/FunCheckoutModal/FunCheckoutSelectAssetStep.d.ts +2 -1
  3. package/dist/components/FunInput/FunInput.d.ts +1 -3
  4. package/dist/components/FunkitProvider/FunkitConfigContext.d.ts +0 -2
  5. package/dist/index.js +130 -187
  6. package/dist/utils/flags/config.d.ts +4 -1
  7. package/dist/utils/flags/index.d.ts +1 -0
  8. package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
  9. package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
  10. package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
  11. package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
  12. package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
  13. package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
  14. package/dist/wallets/walletConnectors/dawnWallet/dawnWallet.js +2 -2
  15. package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
  16. package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
  17. package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
  18. package/dist/wallets/walletConnectors/index.js +66 -66
  19. package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
  20. package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
  21. package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
  22. package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
  23. package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
  24. package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
  25. package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
  26. package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
  27. package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
  28. package/package.json +3 -5
  29. package/dist/wallets/walletConnectors/chunk-KZFAL4RZ.js +0 -27
  30. package/dist/wallets/walletConnectors/{chunk-32KBKKGT.js → chunk-3F5GNHAG.js} +4 -4
  31. package/dist/wallets/walletConnectors/{chunk-7YDZTPO4.js → chunk-3R3RNCGE.js} +3 -3
  32. package/dist/wallets/walletConnectors/{chunk-F4EJ42XO.js → chunk-MFS6NY6T.js} +3 -3
  33. package/dist/wallets/walletConnectors/{chunk-LJRV5JY7.js → chunk-MOAWRDEM.js} +3 -3
  34. package/dist/wallets/walletConnectors/{chunk-IIJOJ6AD.js → chunk-OPO2D6GL.js} +3 -3
  35. package/dist/wallets/walletConnectors/{chunk-MSRKKVDE.js → chunk-OXWTS7HX.js} +3 -3
  36. package/dist/wallets/walletConnectors/{chunk-FL2VIO76.js → chunk-PJRUHFBT.js} +3 -3
  37. package/dist/wallets/walletConnectors/{chunk-CMXZK5RR.js → chunk-S2IWMXKX.js} +3 -3
  38. package/dist/wallets/walletConnectors/{chunk-3CLNL7LR.js → chunk-WH7S23VZ.js} +4 -4
  39. package/dist/wallets/walletConnectors/{chunk-7GGRZNT3.js → chunk-XUXFYTCV.js} +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,26 @@
1
1
  # @funkit/connect
2
2
 
3
+ ## 1.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - e466e0f: fix: remove node-fetch in favor of esm's native fetch
8
+
9
+ ## 1.3.1
10
+
11
+ ### Patch Changes
12
+
13
+ - 5417c66: fix: better handling & fallback for mesh get holdings error
14
+ - d3b6b3f: fix: 2FA input for email uses numeric keyboard
15
+ - cd5b2dd: refactor: disable mantle assets for payment
16
+ - cd5b2dd: feat: add new flag disable_mantle_source_assets
17
+ - 5417c66: refactor: deprecate allowBrokerageUnlinking config
18
+ - cf610d8: refactor: Clean up implementation of the FunInput component
19
+ - e2b9215: fix: cleanup logging
20
+ - Updated dependencies [e2b9215]
21
+ - @funkit/core@1.0.19
22
+ - @funkit/wagmi-tools@2.0.4
23
+
3
24
  ## 1.3.0
4
25
 
5
26
  ### Minor Changes
@@ -3,10 +3,11 @@ import { FunCheckoutStep } from './FunCheckoutModal';
3
3
  /**
4
4
  * Based on which payment method was selected, allow users to select which asset they want to fund
5
5
  */
6
- export declare function FunCheckoutSelectAssetStep({ checkoutId, checkoutStep, onFinish, isOnFinishLoading, animateOut, }: {
6
+ export declare function FunCheckoutSelectAssetStep({ checkoutId, checkoutStep, onFinish, onBack, isOnFinishLoading, animateOut, }: {
7
7
  checkoutId: string | null;
8
8
  checkoutStep: FunCheckoutStep;
9
9
  isOnFinishLoading: boolean;
10
10
  onFinish: () => void;
11
+ onBack: () => void;
11
12
  animateOut?: boolean;
12
13
  }): React.JSX.Element;
@@ -24,6 +24,4 @@ export interface FunInputProps {
24
24
  textColor?: BoxProps['color'];
25
25
  overrideBorderWidth?: undefined | BoxProps['borderWidth'];
26
26
  }
27
- export declare function FunInputDefault({ prefix, prefixIcon, placeholder, value, label, onChange, onKeyDown, onKeySubmit, onPaste, onMouseDown, hasBackground, textColor, inputStyle, inputProps, error, focused: _focused, overrideBorderWidth, }: FunInputProps): React.JSX.Element;
28
- export declare const FunInputWithRef: React.ForwardRefExoticComponent<Omit<FunInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
29
- export declare function FunInput(props: FunInputProps): React.JSX.Element;
27
+ export declare const FunInput: React.ForwardRefExoticComponent<Omit<FunInputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
@@ -36,8 +36,6 @@ interface FunkitAccountOptionsConfig {
36
36
  interface FunkitPaymentsConfig {
37
37
  /** If available, the specified payment method will be selected by default during checkout or deposits **/
38
38
  defaultPaymentMethod?: PaymentMethod | undefined;
39
- /** Whether end users are given the option to unlink a previously connected brokerage **/
40
- allowBrokerageUnlinking?: boolean;
41
39
  /** Max width of the title of each payment method **/
42
40
  paymentTitleMaxWidth?: BoxProps['maxWidth'];
43
41
  /** Payment method options styling **/
package/dist/index.js CHANGED
@@ -371,6 +371,16 @@ var flagConfig = {
371
371
  }
372
372
  ],
373
373
  value: true
374
+ },
375
+ {
376
+ if_any: [
377
+ {
378
+ key: "userId",
379
+ type: "pctRollout",
380
+ pct: 50
381
+ }
382
+ ],
383
+ value: true
374
384
  }
375
385
  ]
376
386
  },
@@ -399,18 +409,21 @@ var flagConfig = {
399
409
  {
400
410
  key: "userId",
401
411
  type: "pctRollout",
402
- pct: 100
412
+ pct: 50
403
413
  }
404
414
  ],
405
415
  value: true
406
416
  }
407
417
  ]
418
+ },
419
+ ["disable_mantle_source_assets" /* DisableMantleSourceAssets */]: {
420
+ type: "boolean",
421
+ default_value: true
408
422
  }
409
423
  };
410
424
 
411
425
  // src/utils/flags/impl.ts
412
426
  import { datadogLogs as datadogLogs2 } from "@datadog/browser-logs";
413
- import fetch2 from "node-fetch";
414
427
 
415
428
  // src/utils/flags/endpoint.ts
416
429
  var FLAG_ENDPOINT_HOST = "sdk-cdn.fun.xyz";
@@ -443,18 +456,16 @@ async function fetchWithTimeout(url, options = {}, timeout = 15e3) {
443
456
  const id = setTimeout(() => controller.abort(), timeout);
444
457
  options.signal = controller.signal;
445
458
  try {
446
- const response = await fetch2(url, options);
459
+ const response = await fetch(url, options);
447
460
  clearTimeout(id);
448
461
  return response;
449
462
  } catch (error) {
450
- if (error.name === "AbortError") {
463
+ if ((error == null ? void 0 : error.name) === "AbortError") {
451
464
  throw new Error(`Request timed out after ${timeout / 1e3} seconds`);
452
465
  }
453
466
  throw error;
454
467
  }
455
468
  }
456
- var warn = (...args) => {
457
- };
458
469
  var fetchConfigFromServer = async () => {
459
470
  const response = await fetchWithTimeout(FLAG_PROD_ENDPOINT, {}, 5e3);
460
471
  const configData = await response.json();
@@ -483,7 +494,7 @@ var FeatureFlag = class {
483
494
  this.deriveAllFlags(userContext);
484
495
  }
485
496
  } catch (err) {
486
- warn("Failed to fetch config:", err);
497
+ logger.error("flag_initError", err);
487
498
  this.flagConfig = this._config;
488
499
  this.isUsingOnlineConfig = false;
489
500
  this.deriveAllFlags(userContext);
@@ -501,10 +512,6 @@ var FeatureFlag = class {
501
512
  ])
502
513
  );
503
514
  this.userContext = userContext;
504
- logger.log("flag_deriveAllFlags", {
505
- flags: this.derivedFlags,
506
- userContext
507
- });
508
515
  datadogLogs2.setGlobalContextProperty("flags", this.derivedFlags);
509
516
  }
510
517
  deriveFlag(flagKey, flagConfig2, context) {
@@ -827,7 +834,6 @@ var DEFAULT_FUNKIT_CONFIG = {
827
834
  },
828
835
  accountModalConfig: { showUnknownTokens: false, allowDepositing: false },
829
836
  paymentsConfig: {
830
- allowBrokerageUnlinking: false,
831
837
  defaultPaymentMethod: void 0,
832
838
  paymentTitleMaxWidth: "240",
833
839
  methodsConfig: {
@@ -1728,6 +1734,7 @@ var useSymbolRefresh_default = useSymbolRefresh;
1728
1734
  // src/utils/assets.ts
1729
1735
  import { FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO } from "@funkit/core";
1730
1736
  import { formatUnits } from "viem";
1737
+ import { mantle } from "viem/chains";
1731
1738
 
1732
1739
  // src/hooks/useCheckoutType.ts
1733
1740
  function getCheckoutType(checkoutItem) {
@@ -1768,7 +1775,12 @@ var isAssetUsableToPayForCheckout = (checkoutItem, paymentMethod, assetChainId,
1768
1775
  const { isCheckoutPostActionRequired } = getCheckoutType(checkoutItem);
1769
1776
  const isSameAsPurchasingToken = !isCheckoutPostActionRequired && paymentMethod === "balance" /* ACCOUNT_BALANCE */ && checkoutItem.initSettings.config.targetChain === assetChainId && checkoutItem.initSettings.config.targetAsset.toLowerCase() === assetTokenAddress.toLowerCase();
1770
1777
  const isConnectedAccountSupported = isWeb2Login && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO[assetChainId].isFunWalletSupported || isWeb3Login || !isWeb2Login && !isWeb3Login;
1771
- const isPickedChainSupportedForCheckout = isConnectedAccountSupported && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO[assetChainId].isCheckoutSupported;
1778
+ const isMantleAssetsDisabled = flags.getBool(
1779
+ "disable_mantle_source_assets" /* DisableMantleSourceAssets */,
1780
+ true
1781
+ );
1782
+ const isAssetDisabled = isMantleAssetsDisabled && assetChainId === mantle.id.toString();
1783
+ const isPickedChainSupportedForCheckout = isConnectedAccountSupported && FUNKIT_CONNECT_SUPPORTED_CHAINS_INFO[assetChainId].isCheckoutSupported && !isAssetDisabled;
1772
1784
  const isUsable = !isSameAsPurchasingToken && isPickedChainSupportedForCheckout;
1773
1785
  return {
1774
1786
  isUsable,
@@ -4414,112 +4426,8 @@ var inputClassDisabled = "zue0i63 _1rsrm2fxv";
4414
4426
 
4415
4427
  // src/components/FunInput/FunInput.tsx
4416
4428
  var InputTextSize = "57px";
4417
- function FunInputDefault({
4418
- prefix,
4419
- prefixIcon,
4420
- placeholder,
4421
- value,
4422
- label,
4423
- onChange,
4424
- onKeyDown,
4425
- onKeySubmit,
4426
- onPaste,
4427
- onMouseDown,
4428
- hasBackground = true,
4429
- textColor = "modalTextSecondary",
4430
- inputStyle = {},
4431
- inputProps = {
4432
- type: "text"
4433
- },
4434
- error,
4435
- focused: _focused,
4436
- overrideBorderWidth
4437
- }) {
4438
- const { paymentsConfig } = useFunkitConfig();
4439
- const [focused, setFocused] = React29.useState(false);
4440
- const onFocus = () => setFocused(true);
4441
- const onBlur = () => setFocused(false);
4442
- return /* @__PURE__ */ React29.createElement(Box, {
4443
- color: "modalText",
4444
- display: "flex",
4445
- flexDirection: "column",
4446
- gap: "8",
4447
- width: "full"
4448
- }, label && /* @__PURE__ */ React29.createElement(Text, {
4449
- color: textColor,
4450
- size: "14",
4451
- weight: "medium"
4452
- }, label), /* @__PURE__ */ React29.createElement(Box, {
4453
- background: hasBackground ? "actionButtonSecondaryBackground" : void 0,
4454
- borderRadius: "connectButton",
4455
- fontFamily: "body",
4456
- minWidth: "full",
4457
- display: "flex",
4458
- color: textColor,
4459
- alignItems: "center",
4460
- borderColor: error ? "error" : focused && _focused ? "accentColor" : void 0,
4461
- borderWidth: overrideBorderWidth ? overrideBorderWidth : error && focused ? "2" : error ? "1" : focused && _focused ? "1" : "0",
4462
- borderStyle: "solid",
4463
- fontWeight: value ? "semibold" : "medium"
4464
- }, prefix ? /* @__PURE__ */ React29.createElement(Box, {
4465
- paddingLeft: paymentsConfig.optionsConfig.optionsPadding,
4466
- height: "max"
4467
- }, prefix) : null, prefixIcon && (prefixIcon === "SearchIcon" ? /* @__PURE__ */ React29.createElement(Box, {
4468
- display: "flex",
4469
- paddingLeft: paymentsConfig.optionsConfig.optionsPadding,
4470
- height: "max",
4471
- alignItems: "center"
4472
- }, /* @__PURE__ */ React29.createElement(SearchIcon, {
4473
- selected: focused
4474
- })) : prefixIcon === "$" ? /* @__PURE__ */ React29.createElement(Box, {
4475
- display: "flex",
4476
- alignItems: "center",
4477
- paddingLeft: "32"
4478
- }, /* @__PURE__ */ React29.createElement(Text, {
4479
- color: "modalText",
4480
- style: {
4481
- paddingBottom: 2,
4482
- fontSize: inputStyle.fontSize || InputTextSize,
4483
- fontWeight: 800
4484
- }
4485
- }, "$")) : void 0), /* @__PURE__ */ React29.createElement("input", {
4486
- type: (inputProps == null ? void 0 : inputProps.type) || "text",
4487
- value,
4488
- placeholder,
4489
- onChange: (e) => onChange(e),
4490
- onKeyDown: (e) => {
4491
- e.stopPropagation();
4492
- if (onKeyDown) {
4493
- onKeyDown(e);
4494
- }
4495
- if (e.key === "Enter" && onKeySubmit) {
4496
- onKeySubmit();
4497
- e.stopPropagation();
4498
- }
4499
- },
4500
- onPaste,
4501
- onMouseDown: (e) => {
4502
- if (onMouseDown) {
4503
- onMouseDown(e);
4504
- }
4505
- },
4506
- onFocus,
4507
- onBlur,
4508
- onWheel: (e) => e.currentTarget.blur(),
4509
- className: inputProps.disabled ? inputClassDisabled : inputClass,
4510
- ...inputProps,
4511
- style: {
4512
- fontWeight: "inherit",
4513
- ...inputStyle
4514
- }
4515
- })), error && typeof error === "string" && /* @__PURE__ */ React29.createElement(Text, {
4516
- color: "error",
4517
- size: "14",
4518
- weight: "medium"
4519
- }, error));
4520
- }
4521
- var FunInputWithRef = forwardRef2(
4522
- function FunInputWithRef2({
4429
+ var FunInput = forwardRef2(
4430
+ function FunInputWithRef({
4523
4431
  prefix,
4524
4432
  prefixIcon,
4525
4433
  placeholder,
@@ -4548,7 +4456,8 @@ var FunInputWithRef = forwardRef2(
4548
4456
  color: "modalText",
4549
4457
  display: "flex",
4550
4458
  flexDirection: "column",
4551
- gap: "8"
4459
+ gap: "8",
4460
+ width: "full"
4552
4461
  }, label && /* @__PURE__ */ React29.createElement(Text, {
4553
4462
  color: textColor,
4554
4463
  size: "14",
@@ -4557,6 +4466,7 @@ var FunInputWithRef = forwardRef2(
4557
4466
  background: hasBackground ? "actionButtonSecondaryBackground" : void 0,
4558
4467
  borderRadius: "connectButton",
4559
4468
  fontFamily: "body",
4469
+ minWidth: "full",
4560
4470
  display: "flex",
4561
4471
  color: textColor,
4562
4472
  alignItems: "center",
@@ -4589,7 +4499,7 @@ var FunInputWithRef = forwardRef2(
4589
4499
  ref,
4590
4500
  type: (inputProps == null ? void 0 : inputProps.type) || "text",
4591
4501
  value,
4592
- placeholder: placeholder == null ? void 0 : placeholder.toString(),
4502
+ placeholder,
4593
4503
  onChange: (e) => onChange(e),
4594
4504
  onKeyDown: (e) => {
4595
4505
  e.stopPropagation();
@@ -4600,7 +4510,6 @@ var FunInputWithRef = forwardRef2(
4600
4510
  onKeySubmit();
4601
4511
  }
4602
4512
  },
4603
- onWheel: (e) => e.currentTarget.blur(),
4604
4513
  onPaste,
4605
4514
  onMouseDown: (e) => {
4606
4515
  if (onMouseDown) {
@@ -4609,6 +4518,7 @@ var FunInputWithRef = forwardRef2(
4609
4518
  },
4610
4519
  onFocus,
4611
4520
  onBlur,
4521
+ onWheel: (e) => e.currentTarget.blur(),
4612
4522
  className: inputProps.disabled ? inputClassDisabled : inputClass,
4613
4523
  ...inputProps,
4614
4524
  style: {
@@ -4622,13 +4532,6 @@ var FunInputWithRef = forwardRef2(
4622
4532
  }, error));
4623
4533
  }
4624
4534
  );
4625
- function FunInput(props) {
4626
- return props.ref ? /* @__PURE__ */ React29.createElement(FunInputWithRef, {
4627
- ...props
4628
- }) : /* @__PURE__ */ React29.createElement(FunInputDefault, {
4629
- ...props
4630
- });
4631
- }
4632
4535
 
4633
4536
  // src/components/FunKeyValue/FunKeyValue.tsx
4634
4537
  import React30 from "react";
@@ -4764,7 +4667,7 @@ import {
4764
4667
  getTokenInfo as getTokenInfo2
4765
4668
  } from "@funkit/core";
4766
4669
  import React83, { useCallback as useCallback20, useEffect as useEffect20, useMemo as useMemo22, useState as useState23 } from "react";
4767
- import { arbitrum, mainnet as mainnet3, mantle, zkSync as zkSync2 } from "viem/chains";
4670
+ import { arbitrum, mainnet as mainnet3, mantle as mantle2, zkSync as zkSync2 } from "viem/chains";
4768
4671
 
4769
4672
  // src/hooks/useCheckoutAccountBalanceTransfer.ts
4770
4673
  import { useCallback as useCallback9 } from "react";
@@ -4877,38 +4780,38 @@ import {
4877
4780
  } from "@funkit/api-base";
4878
4781
  import { FUNKIT_CONNECT_SUPPORTED_CHAINS_ID_LIST } from "@funkit/core";
4879
4782
  var FUNKIT_MESH_CLIENT_ID = "8132aff4-56c9-4b1d-85b4-08dbdcc6199d";
4880
- var MeshExchanges = /* @__PURE__ */ ((MeshExchanges4) => {
4881
- MeshExchanges4["Robinhood"] = "Robinhood";
4882
- MeshExchanges4["ETrade"] = "ETrade";
4883
- MeshExchanges4["Alpaca"] = "Alpaca";
4884
- MeshExchanges4["WeBull"] = "WeBull";
4885
- MeshExchanges4["Stash"] = "Stash";
4886
- MeshExchanges4["InteractiveBrokers"] = "InteractiveBrokers";
4887
- MeshExchanges4["Public"] = "Public";
4888
- MeshExchanges4["Coinbase"] = "Coinbase";
4889
- MeshExchanges4["Kraken"] = "Kraken";
4890
- MeshExchanges4["CoinbasePro"] = "CoinbasePro";
4891
- MeshExchanges4["CryptoCom"] = "CryptoCom";
4892
- MeshExchanges4["Binance"] = "Binance";
4893
- MeshExchanges4["BinanceUs"] = "BinanceUs";
4894
- MeshExchanges4["Gemini"] = "Gemini";
4895
- MeshExchanges4["OkCoin"] = "OkCoin";
4896
- MeshExchanges4["KuCoin"] = "KuCoin";
4897
- MeshExchanges4["Etoro"] = "Etoro";
4898
- MeshExchanges4["CexIo"] = "CexIo";
4899
- MeshExchanges4["Bitstamp"] = "Bitstamp";
4900
- MeshExchanges4["GateIo"] = "GateIo";
4901
- MeshExchanges4["Acorns"] = "Acorns";
4902
- MeshExchanges4["Okx"] = "Okx";
4903
- MeshExchanges4["BitFlyer"] = "BitFlyer";
4904
- MeshExchanges4["Coinlist"] = "Coinlist";
4905
- MeshExchanges4["Huobi"] = "Huobi";
4906
- MeshExchanges4["Bitfinex"] = "Bitfinex";
4907
- MeshExchanges4["KrakenDirect"] = "KrakenDirect";
4908
- MeshExchanges4["Vanguard"] = "Vanguard";
4909
- MeshExchanges4["BitfinexDirect"] = "BitfinexDirect";
4910
- MeshExchanges4["Bybit"] = "Bybit";
4911
- return MeshExchanges4;
4783
+ var MeshExchanges = /* @__PURE__ */ ((MeshExchanges5) => {
4784
+ MeshExchanges5["Robinhood"] = "Robinhood";
4785
+ MeshExchanges5["ETrade"] = "ETrade";
4786
+ MeshExchanges5["Alpaca"] = "Alpaca";
4787
+ MeshExchanges5["WeBull"] = "WeBull";
4788
+ MeshExchanges5["Stash"] = "Stash";
4789
+ MeshExchanges5["InteractiveBrokers"] = "InteractiveBrokers";
4790
+ MeshExchanges5["Public"] = "Public";
4791
+ MeshExchanges5["Coinbase"] = "Coinbase";
4792
+ MeshExchanges5["Kraken"] = "Kraken";
4793
+ MeshExchanges5["CoinbasePro"] = "CoinbasePro";
4794
+ MeshExchanges5["CryptoCom"] = "CryptoCom";
4795
+ MeshExchanges5["Binance"] = "Binance";
4796
+ MeshExchanges5["BinanceUs"] = "BinanceUs";
4797
+ MeshExchanges5["Gemini"] = "Gemini";
4798
+ MeshExchanges5["OkCoin"] = "OkCoin";
4799
+ MeshExchanges5["KuCoin"] = "KuCoin";
4800
+ MeshExchanges5["Etoro"] = "Etoro";
4801
+ MeshExchanges5["CexIo"] = "CexIo";
4802
+ MeshExchanges5["Bitstamp"] = "Bitstamp";
4803
+ MeshExchanges5["GateIo"] = "GateIo";
4804
+ MeshExchanges5["Acorns"] = "Acorns";
4805
+ MeshExchanges5["Okx"] = "Okx";
4806
+ MeshExchanges5["BitFlyer"] = "BitFlyer";
4807
+ MeshExchanges5["Coinlist"] = "Coinlist";
4808
+ MeshExchanges5["Huobi"] = "Huobi";
4809
+ MeshExchanges5["Bitfinex"] = "Bitfinex";
4810
+ MeshExchanges5["KrakenDirect"] = "KrakenDirect";
4811
+ MeshExchanges5["Vanguard"] = "Vanguard";
4812
+ MeshExchanges5["BitfinexDirect"] = "BitfinexDirect";
4813
+ MeshExchanges5["Bybit"] = "Bybit";
4814
+ return MeshExchanges5;
4912
4815
  })(MeshExchanges || {});
4913
4816
  var EXCHANGE_NAME_TO_TYPE = {
4914
4817
  ["Robinhood" /* Robinhood */]: "robinhood",
@@ -5900,11 +5803,14 @@ var FunTwoFaInput = ({
5900
5803
  return /* @__PURE__ */ React50.createElement(Box, {
5901
5804
  key: i,
5902
5805
  style: { display: "flex", flex: 1 }
5903
- }, /* @__PURE__ */ React50.createElement(FunInputWithRef, {
5806
+ }, /* @__PURE__ */ React50.createElement(FunInput, {
5904
5807
  ref: (el) => inputRefs.current[i] = el,
5905
5808
  inputStyle: {
5906
5809
  textAlign: "center"
5907
5810
  },
5811
+ inputProps: {
5812
+ inputMode: "numeric"
5813
+ },
5908
5814
  value: value[i] || "",
5909
5815
  onChange: (e) => {
5910
5816
  e.stopPropagation();
@@ -6618,12 +6524,7 @@ function FunPaymentMeshType({
6618
6524
  gap: "24"
6619
6525
  }, (filteredOptions == null ? void 0 : filteredOptions.length) > 0 ? /* @__PURE__ */ React58.createElement(FunNotification, {
6620
6526
  type: hasMeshPreError ? "error" : "default",
6621
- description: hasMeshPreError ? meshPreError : hasActiveConnectionCheck(exchange) ? /* @__PURE__ */ React58.createElement("div", null, `You will be directed to your linked ${exchange} account.`, funkitConfig.paymentsConfig.allowBrokerageUnlinking ? /* @__PURE__ */ React58.createElement(FunLinkButton, {
6622
- text: "Unlink.",
6623
- color: "buttonPrimary",
6624
- textProps: { weight: "medium" },
6625
- onClick: () => unlinkBrokerage(exchange)
6626
- }) : null) : "You will be redirected to Mesh to securely link your account."
6527
+ description: hasMeshPreError ? meshPreError : hasActiveConnectionCheck(exchange) ? `You will be directed to your linked ${exchange} account.` : "You will be redirected to Mesh to securely link your account."
6627
6528
  }) : null, /* @__PURE__ */ React58.createElement(FunButton, {
6628
6529
  title: "Continue",
6629
6530
  onClick: onClickContinue,
@@ -8824,6 +8725,8 @@ var SwitchIcon = () => {
8824
8725
  };
8825
8726
 
8826
8727
  // src/components/FunCheckoutModal/FunCheckoutInputAmountStep.tsx
8728
+ var USD_REGEX = /^\$?\d*(\.\d{0,2})?/;
8729
+ var ABSOLUTE_REGEX = /^\d*(\.\d{0,5})?/;
8827
8730
  function FunCheckoutInputAmountStep({
8828
8731
  checkoutId,
8829
8732
  onContinue,
@@ -8853,6 +8756,7 @@ function FunCheckoutInputAmountStep({
8853
8756
  setUnitPrice(info.unitPrice);
8854
8757
  }
8855
8758
  } catch (err) {
8759
+ logger.error("Error fetching price for token", err);
8856
8760
  setErrorMessage("Unable to fetch price for token. Please try again.");
8857
8761
  }
8858
8762
  };
@@ -8925,20 +8829,23 @@ function FunCheckoutInputAmountStep({
8925
8829
  value: amountInput === "" ? "" : isAmountInAbsolute ? amountInput : `$${amountInput}`,
8926
8830
  placeholder: isAmountInAbsolute ? "0.00000" : "$0.00",
8927
8831
  onChange: (newAmount) => {
8832
+ const regex = isAmountInAbsolute ? ABSOLUTE_REGEX : USD_REGEX;
8928
8833
  let newValue = newAmount.target.value;
8834
+ const match = newValue.match(regex);
8835
+ if (!match) {
8836
+ return;
8837
+ }
8838
+ newValue = match[0];
8929
8839
  if (!isAmountInAbsolute && newValue.startsWith("$")) {
8930
- if (newValue === "$") {
8931
- newValue = "";
8932
- } else if (newValue.length > 0) {
8933
- newValue = newValue.slice(1);
8934
- }
8840
+ newValue = newValue.slice(1);
8935
8841
  }
8936
8842
  setAmountInput(newValue);
8937
8843
  },
8938
8844
  inputProps: {
8939
8845
  type: isAmountInAbsolute ? "number" : "text",
8940
8846
  autoFocus: true,
8941
- disabled: isContinuing || unitPrice == null
8847
+ disabled: isContinuing || unitPrice == null,
8848
+ inputMode: "decimal"
8942
8849
  },
8943
8850
  inputStyle: {
8944
8851
  textAlign: "center",
@@ -9105,16 +9012,20 @@ function MeshOrAccountSelectAsset({
9105
9012
  checkoutId,
9106
9013
  checkoutStep,
9107
9014
  onFinish,
9015
+ onBack,
9108
9016
  isOnFinishLoading
9109
9017
  }) {
9110
9018
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
9111
9019
  const [accountHoldingsMap, setAccountHoldingsMap] = useState22({});
9112
9020
  const [isLoadingAssets, setIsLoadingAssets] = useState22(true);
9021
+ const [fetchAssetsError, setFetchAssetsError] = useState22("");
9022
+ const hasFetchAssetsError = !!fetchAssetsError;
9113
9023
  const [selectedChainTokenSymbol, setSelectedChainTokenSymbol] = useState22("");
9114
9024
  const { checkoutItem, updateSourceAsset } = useFunkitPreCheckoutInternal(checkoutId);
9115
9025
  const { isCheckoutCrFlow } = useCheckoutType(checkoutItem);
9116
9026
  const draftDollarValueNormalized = (checkoutItem == null ? void 0 : checkoutItem.draftDollarValue) || 0;
9117
9027
  const funkitConfig = useFunkitConfig();
9028
+ const { unlinkBrokerage } = useFunkitMesh({});
9118
9029
  const { fetchInfo: manualFetchNetworkInfo } = useMeshNetworkInfo(
9119
9030
  (_c = (_b = (_a = checkoutItem == null ? void 0 : checkoutItem.selectedPaymentMethodInfo) == null ? void 0 : _a.meta) == null ? void 0 : _b.accessToken) == null ? void 0 : _c.brokerName
9120
9031
  );
@@ -9124,7 +9035,7 @@ function MeshOrAccountSelectAsset({
9124
9035
  const { walletAssets, isWeb2Login, isWeb3Login } = useGeneralWallet();
9125
9036
  const generateAccountHoldingsMapForMesh = useCallback19(async () => {
9126
9037
  var _a2, _b2, _c2, _d2, _e2, _f2, _g2;
9127
- if (funkitConfig == null ? void 0 : funkitConfig.apiKey) {
9038
+ try {
9128
9039
  const [cryptoHoldings, meshNetworkInfo] = await Promise.all([
9129
9040
  fetchMeshAccountCryptoHoldings({
9130
9041
  authToken: (_d2 = (_c2 = (_b2 = (_a2 = checkoutItem == null ? void 0 : checkoutItem.selectedPaymentMethodInfo) == null ? void 0 : _a2.meta) == null ? void 0 : _b2.accessToken) == null ? void 0 : _c2.accountTokens) == null ? void 0 : _d2[0].accessToken,
@@ -9191,8 +9102,13 @@ function MeshOrAccountSelectAsset({
9191
9102
  });
9192
9103
  logger.log("generateAccountHoldingsMapForMesh_itemMap", itemMap);
9193
9104
  return itemMap;
9105
+ } catch (err) {
9106
+ logger.error("generateAccountHoldingsMapForMesh:error", err);
9107
+ setFetchAssetsError(
9108
+ "Unable to retrieve your account balance. Please try re-linking your account."
9109
+ );
9110
+ return {};
9194
9111
  }
9195
- return {};
9196
9112
  }, [
9197
9113
  checkoutItem == null ? void 0 : checkoutItem.initSettings.config.targetChain,
9198
9114
  (_g = (_f = (_e = checkoutItem == null ? void 0 : checkoutItem.selectedPaymentMethodInfo) == null ? void 0 : _e.meta) == null ? void 0 : _f.accessToken) == null ? void 0 : _g.accountTokens,
@@ -9200,7 +9116,7 @@ function MeshOrAccountSelectAsset({
9200
9116
  funkitConfig == null ? void 0 : funkitConfig.apiKey,
9201
9117
  manualFetchNetworkInfo
9202
9118
  ]);
9203
- const generateAccountHoldingsMapForBalance = useCallback19(async () => {
9119
+ const generateAccountHoldingsMapForBalance = useCallback19(() => {
9204
9120
  var _a2, _b2;
9205
9121
  const itemMap = {};
9206
9122
  const checkoutTargetChainId = checkoutItem == null ? void 0 : checkoutItem.initSettings.config.targetChain;
@@ -9248,14 +9164,19 @@ function MeshOrAccountSelectAsset({
9248
9164
  if (paymentMethod === "brokerage" /* BROKERAGE */) {
9249
9165
  itemMap = await generateAccountHoldingsMapForMesh();
9250
9166
  } else if (paymentMethod === "balance" /* ACCOUNT_BALANCE */) {
9251
- itemMap = await generateAccountHoldingsMapForBalance();
9167
+ itemMap = generateAccountHoldingsMapForBalance();
9252
9168
  }
9253
9169
  setAccountHoldingsMap(itemMap);
9254
9170
  setIsLoadingAssets(false);
9255
9171
  }
9256
- fetchAccountHoldings().catch(
9257
- (reason) => logger.error("fetchAccountHoldings:error", reason)
9258
- );
9172
+ fetchAccountHoldings().catch((reason) => {
9173
+ logger.error("fetchAccountHoldings:error", reason);
9174
+ setFetchAssetsError(
9175
+ "Unable to retrieve your account balance. Please try again."
9176
+ );
9177
+ setAccountHoldingsMap({});
9178
+ setIsLoadingAssets(false);
9179
+ });
9259
9180
  }, [
9260
9181
  (_k = checkoutItem == null ? void 0 : checkoutItem.selectedPaymentMethodInfo) == null ? void 0 : _k.paymentMethod,
9261
9182
  manualFetchNetworkInfo,
@@ -9340,7 +9261,26 @@ function MeshOrAccountSelectAsset({
9340
9261
  } = useCheckoutQuoteNotification(checkoutId || "");
9341
9262
  const [insufficientAssetError, setInsufficientAssetError] = useState22("");
9342
9263
  const hasInsufficientAssetError = !!insufficientAssetError;
9343
- const showNotification = hasInsufficientAssetError || showQuoteNotification;
9264
+ const showNotification = hasFetchAssetsError || hasInsufficientAssetError || showQuoteNotification;
9265
+ const notificationDescription = useMemo21(() => {
9266
+ return hasFetchAssetsError ? /* @__PURE__ */ React81.createElement("div", null, fetchAssetsError, /* @__PURE__ */ React81.createElement(FunLinkButton, {
9267
+ text: "Unlink.",
9268
+ color: "buttonPrimary",
9269
+ textProps: { weight: "medium" },
9270
+ onClick: () => {
9271
+ var _a2, _b2, _c2;
9272
+ unlinkBrokerage(
9273
+ (_c2 = (_b2 = (_a2 = checkoutItem == null ? void 0 : checkoutItem.selectedPaymentMethodInfo) == null ? void 0 : _a2.meta) == null ? void 0 : _b2.accessToken) == null ? void 0 : _c2.brokerName
9274
+ );
9275
+ onBack();
9276
+ }
9277
+ })) : quoteNotificationMessage || insufficientAssetError;
9278
+ }, [
9279
+ hasFetchAssetsError,
9280
+ fetchAssetsError,
9281
+ quoteNotificationMessage,
9282
+ insufficientAssetError
9283
+ ]);
9344
9284
  useEffect19(() => {
9345
9285
  if (checkoutItem == null ? void 0 : checkoutItem.isDrafting) {
9346
9286
  setSelectedChainTokenSymbol("");
@@ -9393,8 +9333,8 @@ function MeshOrAccountSelectAsset({
9393
9333
  paddingBottom: showNotification ? "24" : "0"
9394
9334
  }, /* @__PURE__ */ React81.createElement(FunNotification, {
9395
9335
  isVisible: showNotification,
9396
- type: hasQuoteError ? "error" : "default",
9397
- description: quoteNotificationMessage || insufficientAssetError
9336
+ type: hasQuoteError || hasFetchAssetsError ? "error" : "default",
9337
+ description: notificationDescription
9398
9338
  })), /* @__PURE__ */ React81.createElement(FunButton, {
9399
9339
  type: "primary",
9400
9340
  title: "Continue",
@@ -9414,6 +9354,7 @@ function FunCheckoutSelectAssetStep({
9414
9354
  checkoutId,
9415
9355
  checkoutStep,
9416
9356
  onFinish,
9357
+ onBack,
9417
9358
  isOnFinishLoading,
9418
9359
  animateOut = false
9419
9360
  }) {
@@ -9430,6 +9371,7 @@ function FunCheckoutSelectAssetStep({
9430
9371
  ) ? /* @__PURE__ */ React81.createElement(MeshOrAccountSelectAsset, {
9431
9372
  isOnFinishLoading,
9432
9373
  onFinish,
9374
+ onBack,
9433
9375
  checkoutId,
9434
9376
  checkoutStep
9435
9377
  }) : /* @__PURE__ */ React81.createElement(Text, {
@@ -9735,7 +9677,7 @@ function FunCheckoutModal({
9735
9677
  const originalTargetChainId = checkoutItem == null ? void 0 : checkoutItem.initSettings.config.targetChain.toString();
9736
9678
  const moonpayChainId = [
9737
9679
  zkSync2.id.toString(),
9738
- mantle.id.toString()
9680
+ mantle2.id.toString()
9739
9681
  ].includes(originalTargetChainId) ? arbitrum.id.toString() : originalTargetChainId;
9740
9682
  const wethAddrOnTargetChain = (await getTokenInfo2("weth", moonpayChainId)).toLowerCase();
9741
9683
  const isTargetAssetEthOrWeth = [NATIVE_TOKEN, wethAddrOnTargetChain].includes(
@@ -9860,6 +9802,7 @@ function FunCheckoutModal({
9860
9802
  checkoutStep,
9861
9803
  isOnFinishLoading: isSourceAssetConfirming,
9862
9804
  onFinish: triggerSourceAssetConfirmedFn,
9805
+ onBack: titleConfig.onBack,
9863
9806
  animateOut
9864
9807
  }) : checkoutStep === "confirmation" /* CONFIRMATION */ ? /* @__PURE__ */ React83.createElement(FunCheckoutConfirmationStep, {
9865
9808
  checkoutId,
@@ -17351,7 +17294,7 @@ function setFunkitConnectVersion({ version }) {
17351
17294
  localStorage.setItem(storageKey6, version);
17352
17295
  }
17353
17296
  function getCurrentSdkVersion() {
17354
- return "1.3.0";
17297
+ return "1.4.0";
17355
17298
  }
17356
17299
  function useFingerprint() {
17357
17300
  const fingerprint = useCallback33(() => {
@@ -15,10 +15,13 @@ export declare enum FlagKey {
15
15
  * - “Debit or Credit” → Card
16
16
  * - “Brokerage or Exchange” → Exchange
17
17
  */
18
- PaymentMethodCopyV1 = "payment_method_copy_v1"
18
+ PaymentMethodCopyV1 = "payment_method_copy_v1",
19
+ /** Whether mantle assets can be used as source asset for payment in `isAssetUsableToPayForCheckout` */
20
+ DisableMantleSourceAssets = "disable_mantle_source_assets"
19
21
  }
20
22
  export declare const flagConfig: {
21
23
  [FlagKey.ConnectSignInShowSocialLabel]: BooleanFlagConfig;
22
24
  [FlagKey.SelectPaymentMethodText]: StringFlagConfig;
23
25
  [FlagKey.PaymentMethodCopyV1]: BooleanFlagConfig;
26
+ [FlagKey.DisableMantleSourceAssets]: BooleanFlagConfig;
24
27
  };
@@ -5,5 +5,6 @@ declare const singleton: FeatureFlag<{
5
5
  connect_sign_in_show_social_label: import("./types").BooleanFlagConfig;
6
6
  select_payment_method_text: import("./types").StringFlagConfig;
7
7
  payment_method_copy_v1: import("./types").BooleanFlagConfig;
8
+ disable_mantle_source_assets: import("./types").BooleanFlagConfig;
8
9
  }>;
9
10
  export declare const flags: Pick<typeof singleton, "init" | "getBool" | "getNumber" | "getString">;