@funkit/connect 3.1.0 → 3.2.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 (91) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/dist/components/Box/Box.d.ts +21 -21
  3. package/dist/components/Dialog/Dialog.d.ts +4 -12
  4. package/dist/components/Dialog/hooks.d.ts +4 -0
  5. package/dist/components/FunAsset/FunAssetLoading.d.ts +4 -0
  6. package/dist/components/FunBottomBar/FunBottomBar.css.d.ts +1 -0
  7. package/dist/components/FunButton/FunButton.d.ts +3 -1
  8. package/dist/components/FunButton/FunIconButton.d.ts +2 -9
  9. package/dist/components/FunNotification/FunNotification.d.ts +1 -1
  10. package/dist/components/FunOptionBox/FunOptionBox.d.ts +2 -4
  11. package/dist/components/FunPaymentMethodItem/FunPaymentMethodItem.d.ts +4 -2
  12. package/dist/components/FunPayments/FunPaymentMethods.d.ts +20 -6
  13. package/dist/config/getDefaultConfig.d.ts +9 -9
  14. package/dist/consts/payment.d.ts +28 -2
  15. package/dist/css/sprinkles.css.d.ts +21 -21
  16. package/dist/hooks/useFunListeners.d.ts +0 -4
  17. package/dist/hooks/useMesh.d.ts +7 -5
  18. package/dist/hooks/useWalletAssets.d.ts +11 -0
  19. package/dist/index.css +1922 -1904
  20. package/dist/index.d.ts +1 -0
  21. package/dist/index.js +14989 -14277
  22. package/dist/modals/CheckoutModal/CheckoutPrimaryInfo.d.ts +4 -2
  23. package/dist/modals/CheckoutModal/ConfirmationStep.d.ts +4 -9
  24. package/dist/modals/CheckoutModal/ConnectExchange.d.ts +5 -5
  25. package/dist/modals/CheckoutModal/InputAmount.d.ts +7 -5
  26. package/dist/modals/CheckoutModal/LoadingAccount.d.ts +20 -0
  27. package/dist/modals/CheckoutModal/MeshVerification.d.ts +3 -3
  28. package/dist/modals/CheckoutModal/MoonpaySetup.d.ts +18 -0
  29. package/dist/modals/CheckoutModal/SelectAsset.d.ts +8 -7
  30. package/dist/modals/CheckoutModal/SelectBrokerage.d.ts +20 -0
  31. package/dist/modals/CheckoutModal/SelectPaymentMethod.d.ts +13 -7
  32. package/dist/modals/CheckoutModal/SourceChange.d.ts +26 -0
  33. package/dist/modals/CheckoutModal/TransferSetup.d.ts +14 -0
  34. package/dist/modals/CheckoutModal/stepTransition.d.ts +26 -26
  35. package/dist/modals/CheckoutModal/useAvailableBalanceForCheckout.d.ts +4 -0
  36. package/dist/modals/CheckoutModal/useSourceAssetConfirm.d.ts +4 -2
  37. package/dist/modals/CheckoutModal/useUpdateSourceAssetForCard.d.ts +4 -2
  38. package/dist/modals/CheckoutModal/useWalletAssetHoldings.d.ts +5 -0
  39. package/dist/providers/FunkitCheckoutContext.d.ts +5 -5
  40. package/dist/providers/FunkitConfigContext.d.ts +14 -0
  41. package/dist/providers/FunkitFlagsProvider.d.ts +25 -0
  42. package/dist/providers/FunkitMeshProvider.d.ts +14 -9
  43. package/dist/providers/FunkitMoonpayProvider.d.ts +1 -2
  44. package/dist/providers/GeneralWalletProvider.d.ts +14 -22
  45. package/dist/providers/ModalContext.d.ts +1 -1
  46. package/dist/types/utils.d.ts +5 -0
  47. package/dist/utils/address.d.ts +4 -0
  48. package/dist/utils/assets.d.ts +7 -3
  49. package/dist/utils/checkout.d.ts +2 -6
  50. package/dist/utils/deposit.d.ts +2 -3
  51. package/dist/utils/flags/impl.d.ts +5 -22
  52. package/dist/utils/mesh.d.ts +14 -1
  53. package/dist/wallets/walletConnectors/bifrostWallet/bifrostWallet.js +2 -2
  54. package/dist/wallets/walletConnectors/bitgetWallet/bitgetWallet.js +2 -2
  55. package/dist/wallets/walletConnectors/bybitWallet/bybitWallet.js +2 -2
  56. package/dist/wallets/walletConnectors/clvWallet/clvWallet.js +2 -2
  57. package/dist/wallets/walletConnectors/coin98Wallet/coin98Wallet.js +2 -2
  58. package/dist/wallets/walletConnectors/coreWallet/coreWallet.js +2 -2
  59. package/dist/wallets/walletConnectors/foxWallet/foxWallet.js +2 -2
  60. package/dist/wallets/walletConnectors/frontierWallet/frontierWallet.js +2 -2
  61. package/dist/wallets/walletConnectors/gateWallet/gateWallet.js +2 -2
  62. package/dist/wallets/walletConnectors/index.js +63 -63
  63. package/dist/wallets/walletConnectors/metaMaskWallet/metaMaskWallet.js +2 -2
  64. package/dist/wallets/walletConnectors/okxWallet/okxWallet.js +2 -2
  65. package/dist/wallets/walletConnectors/rainbowWallet/rainbowWallet.js +2 -2
  66. package/dist/wallets/walletConnectors/roninWallet/roninWallet.js +2 -2
  67. package/dist/wallets/walletConnectors/safepalWallet/safepalWallet.js +2 -2
  68. package/dist/wallets/walletConnectors/subWallet/subWallet.js +2 -2
  69. package/dist/wallets/walletConnectors/tokenPocketWallet/tokenPocketWallet.js +2 -2
  70. package/dist/wallets/walletConnectors/trustWallet/trustWallet.js +2 -2
  71. package/dist/wallets/walletConnectors/zerionWallet/zerionWallet.js +2 -2
  72. package/package.json +5 -5
  73. package/dist/components/ConnectButton/formatAddress.d.ts +0 -2
  74. package/dist/components/FunPayments/FunPaymentSetup.d.ts +0 -17
  75. package/dist/components/Icons/WalletIcon.d.ts +0 -2
  76. package/dist/hooks/useInputAmountRestriction.d.ts +0 -7
  77. package/dist/modals/CheckoutModal/PaymentSetup.d.ts +0 -38
  78. package/dist/modals/CheckoutModal/useBottomSection.d.ts +0 -2
  79. package/dist/utils/flags/index.d.ts +0 -12
  80. package/dist/wallets/walletConnectors/chunk-2EMZOYQI.js +0 -101
  81. package/dist/wallets/walletConnectors/chunk-5K4DIMYR.js +0 -95
  82. package/dist/wallets/walletConnectors/chunk-AUVBWDIK.js +0 -102
  83. package/dist/wallets/walletConnectors/chunk-AXPQHNUI.js +0 -71
  84. package/dist/wallets/walletConnectors/chunk-B7FHT3CB.js +0 -94
  85. package/dist/wallets/walletConnectors/chunk-EFIENLEE.js +0 -98
  86. package/dist/wallets/walletConnectors/chunk-FLTQRYFS.js +0 -27
  87. package/dist/wallets/walletConnectors/chunk-L7QI6PBN.js +0 -108
  88. package/dist/wallets/walletConnectors/chunk-QP2BIVXD.js +0 -73
  89. package/dist/wallets/walletConnectors/chunk-UWZQZY4S.js +0 -149
  90. package/dist/wallets/walletConnectors/chunk-UZEMNN3Q.js +0 -96
  91. /package/dist/components/Icons/{Checked.d.ts → CheckIcon.d.ts} +0 -0
@@ -1,13 +1,15 @@
1
1
  import React from 'react';
2
2
  import { FunkitActiveCheckoutItem } from '../../providers/FunkitCheckoutContext';
3
- export declare function CheckoutPrimaryInfoSnapshot({ checkoutItem, isLoading, prioritizeDraftValue, preserveMinHeight, }: {
3
+ export declare function CheckoutPrimaryInfoSnapshot({ checkoutItem, isLoading, prioritizeDraftValue, preserveMinHeight, showTokenAmount, }: {
4
4
  checkoutItem: FunkitActiveCheckoutItem;
5
5
  isLoading: boolean;
6
6
  prioritizeDraftValue: boolean;
7
7
  preserveMinHeight?: boolean;
8
+ showTokenAmount?: boolean;
8
9
  }): React.JSX.Element;
9
- export declare function CheckoutPrimaryInfo({ checkoutId, prioritizeDraftValue, preserveMinHeight, }: {
10
+ export declare function CheckoutPrimaryInfo({ checkoutId, prioritizeDraftValue, preserveMinHeight, showTokenAmount, }: {
10
11
  checkoutId: string;
11
12
  prioritizeDraftValue: boolean;
12
13
  preserveMinHeight?: boolean;
14
+ showTokenAmount?: boolean;
13
15
  }): React.JSX.Element | null;
@@ -1,7 +1,7 @@
1
1
  import React from 'react';
2
2
  import { Address } from 'viem';
3
3
  import { PaymentMethodInfo } from '../../consts/payment';
4
- import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition, TransitionPayload } from './stepTransition';
4
+ import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition } from './stepTransition';
5
5
  interface MoonpayDepositData {
6
6
  depositToken: string;
7
7
  depositTokenAmount: number;
@@ -18,19 +18,14 @@ export declare const BEFORE_COUNTDOWN_ENDS_SEC = 10;
18
18
  export interface ConfirmationStepState extends CheckoutModalCommonState {
19
19
  step: FunCheckoutStep.CONFIRMATION;
20
20
  paymentMethodInfo: PaymentMethodInfo;
21
- countdown: number;
22
- countdownKey: number;
23
- beforeCountdownEndsSeconds: number;
24
- onBeforeCountdownEnds?: () => void;
25
- onCountdownLastSecond?: () => void;
26
- onCountdownEnded?: () => void;
21
+ isCloseButtonHidden: boolean;
27
22
  }
28
- export type ConfirmationStepNext = TransitionPayload<{
23
+ export type ConfirmationStepNext = {
29
24
  depositAddress: Address;
30
25
  step: FunCheckoutStep.CONFIRMATION;
31
26
  moonpayData?: MoonpayDepositData;
32
27
  paymentMethodInfo: PaymentMethodInfo;
33
- }>;
28
+ };
34
29
  export declare function confirmationStepNext(state: ConfirmationStepState, payload: ConfirmationStepNext): StepTransition[FunCheckoutStep.CONFIRMATION];
35
30
  export declare function ConfirmationStep({ modalState, onNext, setModalState, }: StateTransitionProps<ConfirmationStepState, ConfirmationStepNext>): React.JSX.Element;
36
31
  export {};
@@ -1,15 +1,15 @@
1
1
  import React from 'react';
2
- import { PaymentMethodInfo } from '../../consts/payment';
2
+ import { PaymentMethodBrokerageInfo } from '../../consts/payment';
3
3
  import { MeshExchanges } from '../../utils/mesh';
4
- import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition, TransitionPayload } from './stepTransition';
4
+ import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition } from './stepTransition';
5
5
  export interface ConnectExchangeState extends CheckoutModalCommonState {
6
6
  step: FunCheckoutStep.CONNECT_EXCHANGE;
7
7
  exchange: MeshExchanges;
8
8
  }
9
- export type ConnectExchangeNext = TransitionPayload<{
9
+ export type ConnectExchangeNext = {
10
10
  step: FunCheckoutStep.CONNECT_EXCHANGE;
11
- paymentMethodInfo: PaymentMethodInfo;
12
- }>;
11
+ paymentMethodInfo: PaymentMethodBrokerageInfo;
12
+ };
13
13
  export declare function connectExchangeNext(state: ConnectExchangeState, payload: ConnectExchangeNext): StepTransition[FunCheckoutStep.CONNECT_EXCHANGE];
14
14
  type Props = StateTransitionProps<ConnectExchangeState, ConnectExchangeNext>;
15
15
  export declare function ConnectExchange({ modalState, onNext, setModalState }: Props): React.JSX.Element;
@@ -1,10 +1,12 @@
1
1
  import React from 'react';
2
- import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition, TransitionPayload } from './stepTransition';
2
+ import { PaymentMethodInfo } from '../../consts/payment';
3
+ import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition } from './stepTransition';
3
4
  export interface InputAmountState extends CheckoutModalCommonState {
4
5
  step: FunCheckoutStep.INPUT_AMOUNT;
6
+ paymentMethodInfo: PaymentMethodInfo;
5
7
  }
6
- export type InputAmountNext = TransitionPayload<{
8
+ export type InputAmountNext = {
7
9
  step: FunCheckoutStep.INPUT_AMOUNT;
8
- }>;
9
- export declare function inputAmountNext(state: InputAmountState, payload: InputAmountNext): StepTransition[FunCheckoutStep.INPUT_AMOUNT];
10
- export declare function InputAmount({ modalState, onNext, }: StateTransitionProps<InputAmountState, InputAmountNext>): React.JSX.Element;
10
+ };
11
+ export declare function inputAmountNext(state: InputAmountState, _payload: InputAmountNext): StepTransition[FunCheckoutStep.INPUT_AMOUNT];
12
+ export declare function InputAmount({ modalState, onBack, onNext, }: StateTransitionProps<InputAmountState, InputAmountNext>): React.JSX.Element;
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { PaymentMethod, PaymentMethodAccountInfo, PaymentMethodBrokerageInfo } from '../../consts/payment';
3
+ import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition } from './stepTransition';
4
+ export interface LoadingAccountState extends CheckoutModalCommonState {
5
+ step: FunCheckoutStep.LOADING_ACCOUNT;
6
+ }
7
+ export type LoadingAccountNext = ({
8
+ usablePaymentMethod: PaymentMethod.ACCOUNT_BALANCE;
9
+ paymentMethodInfo: PaymentMethodAccountInfo;
10
+ } | {
11
+ usablePaymentMethod: PaymentMethod.BROKERAGE;
12
+ paymentMethodInfo: PaymentMethodBrokerageInfo;
13
+ } | {
14
+ usablePaymentMethod: null;
15
+ }) & {
16
+ step: FunCheckoutStep.LOADING_ACCOUNT;
17
+ };
18
+ export declare function loadingAccountNext(state: LoadingAccountState, payload: LoadingAccountNext): StepTransition[FunCheckoutStep.LOADING_ACCOUNT];
19
+ /** A placeholder component to handle redirecting to the checkout history page */
20
+ export declare function LoadingAccount({ modalState, onNext, }: StateTransitionProps<LoadingAccountState, LoadingAccountNext>): React.JSX.Element;
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
2
  import { Address } from 'viem';
3
3
  import { PaymentMethodInfo } from '../../consts/payment';
4
- import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition, TransitionPayload } from './stepTransition';
4
+ import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition } from './stepTransition';
5
5
  export interface MeshVerificationState extends CheckoutModalCommonState {
6
6
  step: FunCheckoutStep.MESH_VERIFICATION;
7
7
  paymentMethodInfo: PaymentMethodInfo;
8
8
  }
9
- export type MeshVerificationNext = TransitionPayload<{
9
+ export type MeshVerificationNext = {
10
10
  depositAddress: Address;
11
11
  step: FunCheckoutStep.MESH_VERIFICATION;
12
- }>;
12
+ };
13
13
  export declare function meshVerificationNext(state: MeshVerificationState, payload: MeshVerificationNext): StepTransition[FunCheckoutStep.MESH_VERIFICATION];
14
14
  export declare function MeshVerification({ modalState, onNext, }: StateTransitionProps<MeshVerificationState, MeshVerificationNext>): React.JSX.Element;
@@ -0,0 +1,18 @@
1
+ import React from 'react';
2
+ import { Address } from 'viem';
3
+ import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition } from './stepTransition';
4
+ export interface MoonpaySetupState extends CheckoutModalCommonState {
5
+ step: FunCheckoutStep.MOONPAY_SETUP;
6
+ paymentAddress: Address;
7
+ token: string;
8
+ tokenChainId: string;
9
+ depositAmount: number;
10
+ }
11
+ export type MoonpaySetupNext = {
12
+ step: FunCheckoutStep.MOONPAY_SETUP;
13
+ depositAddress: Address;
14
+ };
15
+ export declare function moonpaySetupNext(state: MoonpaySetupState, payload: MoonpaySetupNext): StepTransition[FunCheckoutStep.MOONPAY_SETUP];
16
+ type Props = StateTransitionProps<MoonpaySetupState, MoonpaySetupNext>;
17
+ export declare function MoonpaySetup({ modalState, onNext }: Props): React.JSX.Element;
18
+ export {};
@@ -1,15 +1,16 @@
1
1
  import React from 'react';
2
- import { PaymentMethodInfo } from '../../consts/payment';
3
- import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition, TransitionPayload } from './stepTransition';
2
+ import { PaymentMethodAccountInfo, PaymentMethodBrokerageInfo } from '../../consts/payment';
3
+ import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition } from './stepTransition';
4
4
  export interface SelectAssetState extends CheckoutModalCommonState {
5
5
  step: FunCheckoutStep.SELECT_ASSET;
6
- paymentMethodInfo: PaymentMethodInfo;
6
+ paymentMethodInfo: PaymentMethodBrokerageInfo | PaymentMethodAccountInfo;
7
7
  }
8
- export type SelectAssetNext = TransitionPayload<{
8
+ export type SelectAssetNext = {
9
9
  step: FunCheckoutStep.SELECT_ASSET;
10
- isQuoteSuccess: true;
11
- }>;
10
+ paymentMethodInfo?: PaymentMethodBrokerageInfo | PaymentMethodAccountInfo;
11
+ disconnectedBrokerage?: boolean;
12
+ };
12
13
  export declare function selectAssetNext(state: SelectAssetState, payload: SelectAssetNext): StepTransition[FunCheckoutStep.SELECT_ASSET];
13
14
  type Props = StateTransitionProps<SelectAssetState, SelectAssetNext>;
14
- export declare function SelectAsset({ modalState, onBack, onNext }: Props): React.JSX.Element;
15
+ export declare function SelectAsset({ modalState, onNext }: Props): React.JSX.Element;
15
16
  export {};
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import { PaymentMethodBrokerageInfo } from '../../consts/payment';
3
+ import { MeshExchanges } from '../../utils/mesh';
4
+ import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition } from './stepTransition';
5
+ export interface SelectBrokerageState extends CheckoutModalCommonState {
6
+ step: FunCheckoutStep.SELECT_BROKERAGE;
7
+ }
8
+ export type SelectBrokerageNext = {
9
+ step: FunCheckoutStep.SELECT_BROKERAGE;
10
+ hasActiveConnection: true;
11
+ paymentInfo: PaymentMethodBrokerageInfo;
12
+ } | {
13
+ step: FunCheckoutStep.SELECT_BROKERAGE;
14
+ hasActiveConnection: false;
15
+ exchange: MeshExchanges;
16
+ };
17
+ export declare function selectBrokerageNext(state: SelectBrokerageState, payload: SelectBrokerageNext): StepTransition[FunCheckoutStep.SELECT_BROKERAGE];
18
+ type Props = StateTransitionProps<SelectBrokerageState, SelectBrokerageNext>;
19
+ export declare function SelectBrokerage({ modalState, onNext }: Props): React.JSX.Element;
20
+ export {};
@@ -1,18 +1,24 @@
1
1
  import React from 'react';
2
- import { PaymentMethod, PaymentMethodInfo } from '../../consts/payment';
3
- import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition, TransitionPayload } from './stepTransition';
2
+ import { UnionOmit } from 'viem';
3
+ import { PaymentMethod, PaymentMethodAccountInfo, PaymentMethodCardInfo } from '../../consts/payment';
4
+ import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition } from './stepTransition';
4
5
  export interface SelectPaymentMethodState extends CheckoutModalCommonState {
5
6
  step: FunCheckoutStep.SELECT_PAYMENT_METHOD;
6
7
  }
7
- export type SelectPaymentMethodNext = TransitionPayload<{
8
+ export type SelectPaymentMethodNext = {
8
9
  step: FunCheckoutStep.SELECT_PAYMENT_METHOD;
9
- paymentMethod: PaymentMethod.TRANSFER | PaymentMethod.BROKERAGE;
10
+ paymentMethod: PaymentMethod.BROKERAGE;
10
11
  } | {
11
12
  step: FunCheckoutStep.SELECT_PAYMENT_METHOD;
12
- paymentMethod: PaymentMethod.CARD | PaymentMethod.ACCOUNT_BALANCE;
13
- paymentMethodInfo: PaymentMethodInfo;
14
- }>;
13
+ paymentMethod: PaymentMethod.CARD;
14
+ paymentMethodInfo: PaymentMethodCardInfo;
15
+ } | {
16
+ step: FunCheckoutStep.SELECT_PAYMENT_METHOD;
17
+ paymentMethod: PaymentMethod.ACCOUNT_BALANCE;
18
+ paymentMethodInfo: PaymentMethodAccountInfo;
19
+ };
15
20
  export declare function selectPaymentMethodNext(state: SelectPaymentMethodState, payload: SelectPaymentMethodNext): StepTransition[FunCheckoutStep.SELECT_PAYMENT_METHOD];
16
21
  type Props = StateTransitionProps<SelectPaymentMethodState, SelectPaymentMethodNext>;
22
+ export type SelectMethodPayloadData = UnionOmit<SelectPaymentMethodNext, 'step'>;
17
23
  export declare function SelectPaymentMethod({ modalState, onNext, onClose }: Props): React.JSX.Element;
18
24
  export {};
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { PaymentMethod, PaymentMethodAccountInfo, PaymentMethodBrokerageInfo, PaymentMethodCardInfo } from '../../consts/payment';
3
+ import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition } from './stepTransition';
4
+ type ConnectablePaymentMethodInfo = PaymentMethodAccountInfo | PaymentMethodBrokerageInfo;
5
+ export interface SourceChangeState extends CheckoutModalCommonState {
6
+ step: FunCheckoutStep.SOURCE_CHANGE;
7
+ paymentMethodInfo: ConnectablePaymentMethodInfo;
8
+ }
9
+ export type SourceChangeNext = {
10
+ step: FunCheckoutStep.SOURCE_CHANGE;
11
+ connectNew: false;
12
+ paymentMethodInfo: ConnectablePaymentMethodInfo;
13
+ } | {
14
+ step: FunCheckoutStep.SOURCE_CHANGE;
15
+ connectNew: true;
16
+ paymentMethod: Exclude<PaymentMethod, PaymentMethod.CARD>;
17
+ } | {
18
+ step: FunCheckoutStep.SOURCE_CHANGE;
19
+ connectNew: true;
20
+ paymentMethod: PaymentMethod.CARD;
21
+ paymentMethodInfo: PaymentMethodCardInfo;
22
+ };
23
+ export declare const sourceChangeNext: (state: SourceChangeState, payload: SourceChangeNext) => StepTransition[FunCheckoutStep.SOURCE_CHANGE];
24
+ type Props = StateTransitionProps<SourceChangeState, SourceChangeNext>;
25
+ export declare const SourceChange: ({ modalState, onNext, onClose }: Props) => React.JSX.Element;
26
+ export {};
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { Address } from 'viem';
3
+ import { CheckoutModalCommonState, FunCheckoutStep, StateTransitionProps, StepTransition } from './stepTransition';
4
+ export type TransferSetupState = CheckoutModalCommonState & {
5
+ step: FunCheckoutStep.TRANSFER_SETUP;
6
+ address: Address;
7
+ };
8
+ export type TransferSetupNext = {
9
+ step: FunCheckoutStep.TRANSFER_SETUP;
10
+ };
11
+ export declare function transferSetupNext(_state: TransferSetupState, _payload: TransferSetupNext): StepTransition[FunCheckoutStep.TRANSFER_SETUP];
12
+ type Props = StateTransitionProps<TransferSetupState, TransferSetupNext>;
13
+ export declare function TransferSetup({ modalState }: Props): React.JSX.Element;
14
+ export {};
@@ -4,19 +4,19 @@ import { CheckoutCompleteState } from './CheckoutComplete';
4
4
  import { ConfirmationStepNext, ConfirmationStepState } from './ConfirmationStep';
5
5
  import { ConnectExchangeNext, ConnectExchangeState } from './ConnectExchange';
6
6
  import { InputAmountNext, InputAmountState } from './InputAmount';
7
+ import { LoadingAccountNext, LoadingAccountState } from './LoadingAccount';
7
8
  import { MeshVerificationNext, MeshVerificationState } from './MeshVerification';
8
- import { PaymentSetupNext, PaymentSetupState } from './PaymentSetup';
9
+ import { MoonpaySetupNext, MoonpaySetupState } from './MoonpaySetup';
9
10
  import { SelectAssetNext, SelectAssetState } from './SelectAsset';
11
+ import { SelectBrokerageNext, SelectBrokerageState } from './SelectBrokerage';
10
12
  import { SelectPaymentMethodNext, SelectPaymentMethodState } from './SelectPaymentMethod';
13
+ import { SourceChangeNext, SourceChangeState } from './SourceChange';
14
+ import { TransferSetupNext } from './TransferSetup';
11
15
  export interface CheckoutModalCommonState {
12
16
  checkoutId: string;
17
+ targetChainId: string;
13
18
  isSoftHidden: boolean;
14
- countdown?: number;
15
- countdownKey?: number;
16
- beforeCountdownEndsSeconds?: number;
17
- onBeforeCountdownEnds?: () => void;
18
- onCountdownLastSecond?: () => void;
19
- onCountdownEnded?: () => void;
19
+ isCloseButtonHidden?: boolean;
20
20
  }
21
21
  export interface StateTransitionProps<T, N> {
22
22
  modalState: T;
@@ -26,37 +26,37 @@ export interface StateTransitionProps<T, N> {
26
26
  onClose: () => void;
27
27
  }
28
28
  export declare function extractCommonState(state: CheckoutModalState): CheckoutModalCommonState;
29
- type CheckoutModalState = ConfirmationStepState | ConnectExchangeState | InputAmountState | SelectAssetState | SelectPaymentMethodState | PaymentSetupState | MeshVerificationState | CheckoutCompleteState;
29
+ type CheckoutModalState = LoadingAccountState | ConfirmationStepState | ConnectExchangeState | InputAmountState | SelectAssetState | SelectPaymentMethodState | SelectBrokerageState | SourceChangeState | MoonpaySetupState | MeshVerificationState | CheckoutCompleteState;
30
30
  export declare enum FunCheckoutStep {
31
+ LOADING_ACCOUNT = "loading_account",
31
32
  INPUT_AMOUNT = "input_amount",
32
33
  SELECT_PAYMENT_METHOD = "select_payment",
34
+ SOURCE_CHANGE = "source_change",
33
35
  CONFIRMATION = "confirmation",
34
- PAYMENT_SETUP = "payment_setup",
36
+ MOONPAY_SETUP = "payment_setup",
37
+ SELECT_BROKERAGE = "select_brokerage",
38
+ TRANSFER_SETUP = "transfer_setup",
35
39
  CONNECT_EXCHANGE = "connect_exchange",
36
40
  SELECT_ASSET = "select_asset",
37
41
  MESH_VERIFICATION = "mesh_verification",
38
42
  CHECKOUT_COMPLETE = "checkout_complete"
39
43
  }
40
44
  export interface StepTransition {
41
- [FunCheckoutStep.INPUT_AMOUNT]: SelectPaymentMethodState | InputAmountState;
42
- [FunCheckoutStep.SELECT_PAYMENT_METHOD]: SelectAssetState | PaymentSetupState | ConfirmationStepState | InputAmountState;
43
- [FunCheckoutStep.CONFIRMATION]: MeshVerificationState | PaymentSetupState | SelectPaymentMethodState | SelectAssetState | ConfirmationStepState | CheckoutCompleteState;
44
- [FunCheckoutStep.PAYMENT_SETUP]: SelectAssetState | ConnectExchangeState | SelectPaymentMethodState | CheckoutCompleteState;
45
- [FunCheckoutStep.CONNECT_EXCHANGE]: SelectAssetState | PaymentSetupState;
46
- [FunCheckoutStep.SELECT_ASSET]: SelectPaymentMethodState | PaymentSetupState | ConfirmationStepState;
47
- [FunCheckoutStep.MESH_VERIFICATION]: ConfirmationStepState | MeshVerificationState | CheckoutCompleteState;
45
+ [FunCheckoutStep.LOADING_ACCOUNT]: SelectPaymentMethodState | SelectAssetState;
46
+ [FunCheckoutStep.INPUT_AMOUNT]: ConfirmationStepState;
47
+ [FunCheckoutStep.SELECT_PAYMENT_METHOD]: SelectBrokerageState | InputAmountState | SelectAssetState;
48
+ [FunCheckoutStep.CONFIRMATION]: MeshVerificationState | MoonpaySetupState | CheckoutCompleteState;
49
+ [FunCheckoutStep.MOONPAY_SETUP]: CheckoutCompleteState;
50
+ [FunCheckoutStep.SELECT_BROKERAGE]: ConnectExchangeState | SelectAssetState;
51
+ [FunCheckoutStep.TRANSFER_SETUP]: CheckoutModalState;
52
+ [FunCheckoutStep.CONNECT_EXCHANGE]: SelectAssetState;
53
+ [FunCheckoutStep.SELECT_ASSET]: InputAmountState | SourceChangeState | LoadingAccountState;
54
+ [FunCheckoutStep.MESH_VERIFICATION]: CheckoutCompleteState;
55
+ [FunCheckoutStep.SOURCE_CHANGE]: SelectAssetState | SelectBrokerageState | InputAmountState;
48
56
  }
49
- export type TransitionPayload<T extends {
50
- step: FunCheckoutStep;
51
- }> = (T & {
52
- isBack?: false;
53
- }) | {
54
- step: T['step'];
55
- isBack: true;
56
- };
57
- type NextPayload = ConfirmationStepNext | ConnectExchangeNext | InputAmountNext | MeshVerificationNext | PaymentSetupNext | SelectAssetNext | SelectPaymentMethodNext | TransitionPayload<{
57
+ type NextPayload = LoadingAccountNext | ConfirmationStepNext | ConnectExchangeNext | InputAmountNext | MeshVerificationNext | MoonpaySetupNext | TransferSetupNext | SelectAssetNext | SelectPaymentMethodNext | SelectBrokerageNext | SourceChangeNext | {
58
58
  step: FunCheckoutStep.CHECKOUT_COMPLETE;
59
- }>;
59
+ };
60
60
  export declare function useCheckoutModalTransition(checkoutItem: FunkitActiveCheckoutItem, onClose: () => void): {
61
61
  animateOut: boolean;
62
62
  modalState: CheckoutModalState;
@@ -0,0 +1,4 @@
1
+ import { PaymentMethodInfo } from '../../consts/payment';
2
+ import { QueryResult } from '../../types/utils';
3
+ import { AssetHoldingsItem } from '../../utils/assets';
4
+ export declare function useAvailableBalanceForCheckout(checkoutId: string, paymentMethodInfo: PaymentMethodInfo, targetChainId: string, assetChainId: string, assetSymbol: string | null): QueryResult<AssetHoldingsItem>;
@@ -3,13 +3,15 @@ import { FunkitActiveCheckoutItem } from '../../providers/FunkitCheckoutContext'
3
3
  export interface SourceAssetConfirmed {
4
4
  isQuoteSuccess: boolean;
5
5
  newPaymentMethodInfo: PaymentMethodInfo;
6
- quoteObject?: FunkitActiveCheckoutItem;
6
+ quoteObject: FunkitActiveCheckoutItem | undefined;
7
+ totalFeesUsd: number | undefined;
8
+ estSubtotalUsd: number | undefined;
7
9
  }
8
10
  export type OnSourceAssetConfirmed = (confirmed: SourceAssetConfirmed | undefined) => void;
9
11
  /**
10
12
  *
11
13
  * Note: this hook is EXTREMELY confusing in what is doing
12
- * first, it uses useSymbolRefresh to wait React's setState
14
+ * first, it useHackyTriggerWorkaroundReactDevBrainExplode to wait React's setState
13
15
  * and read the latest update of the checkoutItem
14
16
  * second, it will trigger a quote request to the backend
15
17
  * and write the value back to the checkoutItem
@@ -1,2 +1,4 @@
1
- import { OnSourceAssetConfirmed } from './useSourceAssetConfirm';
2
- export declare function useUpdateCardSourceAsset(checkoutId: string, onSuccess: OnSourceAssetConfirmed): () => Promise<void>;
1
+ export declare function useUpdateCardSourceAsset(checkoutId: string): {
2
+ onSelectCard: () => Promise<void>;
3
+ isUpdating: boolean;
4
+ };
@@ -0,0 +1,5 @@
1
+ import { AssetHoldingsMap } from '../../utils/assets';
2
+ export declare function useWalletAssetHoldings(targetChain: string): {
3
+ data: AssetHoldingsMap | undefined;
4
+ isLoading: boolean;
5
+ };
@@ -21,8 +21,8 @@ export interface FunkitCheckoutConfig {
21
21
  targetChain: string;
22
22
  /** The wanted asset for the checkout operation. This can be either a chain native token (by specifying NATIVE_TOKEN) or an ERC-20 token (by specifying actual token address) on the target chain. **/
23
23
  targetAsset: Address;
24
- /** The amount of wanted asset for the checkout operation. **/
25
- targetAssetAmount: number;
24
+ /** The amount of wanted asset for the checkout operation (defaults to $100 equivalent). **/
25
+ targetAssetAmount?: number;
26
26
  /** The ticker information of the wanted asset for the checkout operation. e.g. USDC. **/
27
27
  targetAssetTicker: string;
28
28
  /** Timestamp (in milliseconds) after which the checkout should not be performed, and the funds will become rescuable. Min: 300000 (5 mins), Max: 3600000 (1 hour). **/
@@ -46,8 +46,6 @@ export interface FunkitCheckoutConfig {
46
46
  checkoutItemTitle: string;
47
47
  /** The quantity of the item being checked out. If not specified (0, null, undefined), it will default to blank. **/
48
48
  checkoutItemAmount?: number;
49
- /** Whether editing is skipped and disabled for checkouts with empty actionsParams. **/
50
- disableEditing?: boolean;
51
49
  /** *****************************
52
50
  * Miscellaneous configurations *
53
51
  ********************************/
@@ -139,11 +137,13 @@ interface useFunkitPreCheckoutInternalReturn {
139
137
  updateSelectedPaymentMethodInfo: (newPaymentMethodInfo: PaymentMethodInfo) => void;
140
138
  confirmCheckout: (shouldBatchOpBypassInit: boolean, stepMessageSetter: (m: string) => void) => Promise<Address>;
141
139
  cancelCheckout: (depositAddress: Address) => Promise<boolean>;
142
- getCheckoutDraftDollarValue: () => Promise<void>;
140
+ getCheckoutDraftDollarValue: () => Promise<number>;
143
141
  clearCheckoutQuoteMessages: () => void;
144
142
  getCheckoutQuote: (sponsorInitialTransferGasLimit: number, newPaymentMethodInfo: PaymentMethodInfo, disableInformationStreaming?: boolean) => Promise<{
145
143
  success: boolean;
146
144
  shellCheckoutItemWithNextQuote: FunkitActiveCheckoutItem | undefined;
145
+ totalFeesUsd: number | undefined;
146
+ estSubtotalUsd: number | undefined;
147
147
  errorObject?: any;
148
148
  }>;
149
149
  setCheckoutQuote: (quote: FunkitActiveCheckoutItem) => void;
@@ -6,6 +6,18 @@ export interface FunkitTextCustomizationsConfig {
6
6
  transferCrypto: string;
7
7
  selectAccount: string;
8
8
  }
9
+ export interface FunkitUiCustomizationsConfig {
10
+ confirmationScreen?: {
11
+ /** Whether to show the amount of tokens below the USD equivalent - defaults to true */
12
+ showTokenAmount?: boolean;
13
+ };
14
+ inputAmountScreen?: {
15
+ /** Whether to allow entering an amount of tokens, rather than only USD - defaults to true */
16
+ allowTokenAmountInput?: boolean;
17
+ /** Whether to show available balance in Input Amount screen (wallet/brokerage only) - defaults to true */
18
+ showAvailableBalance?: boolean;
19
+ };
20
+ }
9
21
  export declare const DEFAULT_TEXT_CUSTOMIZATIONS: FunkitTextCustomizationsConfig;
10
22
  interface FunkitLoginOptionsConfig {
11
23
  web2: boolean;
@@ -32,6 +44,8 @@ export type FunkitConfig = {
32
44
  allowBackgroundScroll?: boolean;
33
45
  /** Text customizations across all widgets **/
34
46
  textCustomizations?: Partial<FunkitTextCustomizationsConfig>;
47
+ /** UI customizations across all widgets **/
48
+ uiCustomizations?: FunkitUiCustomizationsConfig;
35
49
  /** Login modal configuration **/
36
50
  loginConfig: Partial<FunkitLoginOptionsConfig>;
37
51
  };
@@ -0,0 +1,25 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { flagConfig as offlineConfig, FlagKey } from '../utils/flags/config';
3
+ import { InferFlagType } from '../utils/flags/types';
4
+ export { FlagKey } from '../utils/flags/config';
5
+ export type FlagValue<K extends FlagKey> = InferFlagType<(typeof offlineConfig)[K]>;
6
+ export type FlagValues = {
7
+ [K in FlagKey]?: FlagValue<K>;
8
+ };
9
+ export type GetFlagFunction = <K extends FlagKey>(flagKey: K, fallback: FlagValue<K>) => FlagValue<K>;
10
+ export interface FunkitFlagsContextValue {
11
+ /** Error fetching flag config from server */
12
+ error: Error | null;
13
+ /** Loaded flags - each flag may be undefined if configuration from server was missing or invalid */
14
+ flags: FlagValues;
15
+ /** Synchronously reads a single flag (derived for current user) - returns fallback while loading */
16
+ getFlag: GetFlagFunction;
17
+ /** Whether flags are currently loading */
18
+ isLoading: boolean;
19
+ }
20
+ export declare const FunkitFlagsContext: React.Context<FunkitFlagsContextValue>;
21
+ export declare function FunkitFlagsProvider({ children }: {
22
+ children: ReactNode;
23
+ }): React.JSX.Element;
24
+ export declare function useFlags(): FunkitFlagsContextValue;
25
+ export declare function useFlag<K extends FlagKey>(flagKey: K, fallback: FlagValue<K>): FlagValue<K>;
@@ -1,20 +1,25 @@
1
1
  import { LinkPayload } from '@meshconnect/web-link-sdk';
2
2
  import React from 'react';
3
3
  import { MeshExchanges } from '../utils/mesh';
4
- interface MeshBrokerDataMap {
5
- [brokerName: string]: LinkPayload & {
6
- connectionExpiresAtMs: number;
7
- };
8
- }
9
4
  export declare function FunkitMeshProvider({ children }: any): React.JSX.Element;
10
- export declare function useFunkitMesh(_notUsedToDelete?: unknown): {
11
- meshBrokerDataMap: MeshBrokerDataMap;
5
+ export declare function useFunkitMesh(): {
12
6
  unlinkBrokerage: (exchange: MeshExchanges) => void;
13
- hasActiveConnectionCheck: (brokerage: MeshExchanges) => boolean;
7
+ getActiveConnection: (brokerage: MeshExchanges) => (LinkPayload & {
8
+ connectionExpiresAtMs: number;
9
+ }) | null;
10
+ getFirstActiveConnection: () => {
11
+ accessToken?: import("@meshconnect/web-link-sdk").AccessTokenPayload;
12
+ delayedAuth?: import("@meshconnect/web-link-sdk").DelayedAuthPayload;
13
+ connectionExpiresAtMs: number;
14
+ brokerage: MeshExchanges;
15
+ } | null;
14
16
  };
15
17
  interface FunkitMeshHook {
16
18
  onBeforeConnect(): void;
17
- onConnected(brokerData: LinkPayload | null): void;
19
+ onConnected(data: {
20
+ brokerData: LinkPayload;
21
+ brokerage: MeshExchanges;
22
+ } | null): void;
18
23
  onMeshModalClose(): void;
19
24
  }
20
25
  /**
@@ -4,7 +4,7 @@ export declare function FunkitMoonpayProvider({ children, debug, }: {
4
4
  children: any;
5
5
  debug: boolean;
6
6
  }): React.JSX.Element;
7
- interface UserIpInfoFromMoonpay {
7
+ export interface UserIpInfoFromMoonpay {
8
8
  alpha2: string;
9
9
  alpha3: string;
10
10
  country: string;
@@ -23,4 +23,3 @@ export declare function useFunkitUserIp(): {
23
23
  isUserBlockedForCheckout: boolean;
24
24
  userIpInfo: UserIpInfoFromMoonpay | undefined;
25
25
  };
26
- export {};
@@ -2,26 +2,18 @@ import { AssetBalanceInfo } from '@funkit/api-base';
2
2
  import { Auth, FunWallet } from '@funkit/core';
3
3
  import React from 'react';
4
4
  import { FunkitUserInfo } from '../consts/funkit';
5
- import { PaymentMethodInfo } from '../consts/payment';
5
+ import { PaymentMethodAccountInfo } from '../consts/payment';
6
6
  export interface KnownAssetBalanceInfo extends AssetBalanceInfo {
7
7
  price: number;
8
8
  totalUsdValue: number;
9
9
  }
10
- export type GeneralWalletAssets = null | {
11
- [x: string]: KnownAssetBalanceInfo;
12
- };
13
10
  interface GeneralWalletContextProps {
14
11
  walletAddress: string;
15
- accountBalancePaymentDefaultInfo: PaymentMethodInfo | null;
12
+ accountBalancePaymentDefaultInfo: PaymentMethodAccountInfo | null;
16
13
  isUserLoggedIn: boolean;
17
14
  isWeb2Login: boolean;
18
15
  isWeb3Login: boolean;
19
16
  userInfo: FunkitUserInfo;
20
- isFetchingAssets: boolean;
21
- walletAssets: GeneralWalletAssets;
22
- totalWalletAssetsUsd: number;
23
- startAssetsListener: () => void;
24
- stopAssetsListener: () => void;
25
17
  funWallet: FunWallet | null;
26
18
  funWalletAuth: Auth | null;
27
19
  handleLogout: () => void;
@@ -99,15 +91,15 @@ export declare const useFunkitDisconnect: () => {
99
91
  error: null;
100
92
  data: undefined;
101
93
  status: "idle";
102
- variables: undefined;
103
94
  isError: false;
104
- isIdle: true;
105
95
  isPending: false;
106
96
  isSuccess: false;
107
- context: unknown;
108
97
  failureCount: number;
109
98
  failureReason: import("@wagmi/core").DisconnectErrorType | null;
110
99
  isPaused: boolean;
100
+ variables: undefined;
101
+ isIdle: true;
102
+ context: unknown;
111
103
  submittedAt: number;
112
104
  connectors: readonly import("wagmi").Connector[];
113
105
  } | {
@@ -117,15 +109,15 @@ export declare const useFunkitDisconnect: () => {
117
109
  error: null;
118
110
  data: undefined;
119
111
  status: "pending";
120
- variables: import("wagmi/query").DisconnectVariables;
121
112
  isError: false;
122
- isIdle: false;
123
113
  isPending: true;
124
114
  isSuccess: false;
125
- context: unknown;
126
115
  failureCount: number;
127
116
  failureReason: import("@wagmi/core").DisconnectErrorType | null;
128
117
  isPaused: boolean;
118
+ variables: import("wagmi/query").DisconnectVariables;
119
+ isIdle: false;
120
+ context: unknown;
129
121
  submittedAt: number;
130
122
  connectors: readonly import("wagmi").Connector[];
131
123
  } | {
@@ -135,15 +127,15 @@ export declare const useFunkitDisconnect: () => {
135
127
  error: import("@wagmi/core").DisconnectErrorType;
136
128
  data: undefined;
137
129
  status: "error";
138
- variables: import("wagmi/query").DisconnectVariables;
139
130
  isError: true;
140
- isIdle: false;
141
131
  isPending: false;
142
132
  isSuccess: false;
143
- context: unknown;
144
133
  failureCount: number;
145
134
  failureReason: import("@wagmi/core").DisconnectErrorType | null;
146
135
  isPaused: boolean;
136
+ variables: import("wagmi/query").DisconnectVariables;
137
+ isIdle: false;
138
+ context: unknown;
147
139
  submittedAt: number;
148
140
  connectors: readonly import("wagmi").Connector[];
149
141
  } | {
@@ -153,15 +145,15 @@ export declare const useFunkitDisconnect: () => {
153
145
  error: null;
154
146
  data: void;
155
147
  status: "success";
156
- variables: import("wagmi/query").DisconnectVariables;
157
148
  isError: false;
158
- isIdle: false;
159
149
  isPending: false;
160
150
  isSuccess: true;
161
- context: unknown;
162
151
  failureCount: number;
163
152
  failureReason: import("@wagmi/core").DisconnectErrorType | null;
164
153
  isPaused: boolean;
154
+ variables: import("wagmi/query").DisconnectVariables;
155
+ isIdle: false;
156
+ context: unknown;
165
157
  submittedAt: number;
166
158
  connectors: readonly import("wagmi").Connector[];
167
159
  };