@funkit/connect 3.3.0 → 3.4.1

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 (98) hide show
  1. package/CHANGELOG.md +70 -0
  2. package/README.md +0 -3
  3. package/dist/{chunk-YOJVBRUJ.js → chunk-77C753LI.js} +2 -2
  4. package/dist/{chunk-HFT6OV3T.js → chunk-BY224HGT.js} +1 -1
  5. package/dist/{chunk-ZGK66FYG.js → chunk-XWW5QOD4.js} +2 -2
  6. package/dist/components/Box/Box.d.ts +36 -36
  7. package/dist/components/Dialog/Dialog.css.d.ts +2 -5
  8. package/dist/components/Dropdown/BaseDropdown.d.ts +4 -2
  9. package/dist/components/Dropdown/ChainDropdown.d.ts +3 -1
  10. package/dist/components/Dropdown/TokenDropdown.d.ts +7 -1
  11. package/dist/components/FunAssetAvatar/FunAssetAvatar.d.ts +1 -1
  12. package/dist/components/FunBottomBar/FunBottomBar.css.d.ts +1 -1
  13. package/dist/components/FunButton/FunIconButton.d.ts +1 -0
  14. package/dist/components/FunCheckoutBlocked/FunCheckoutBlocked.d.ts +6 -1
  15. package/dist/components/FunCountdown/FunCountdown.d.ts +2 -1
  16. package/dist/components/FunOptionBox/FunOptionBox.css.d.ts +1 -1
  17. package/dist/components/FunPayments/FunPaymentMethods.d.ts +5 -13
  18. package/dist/components/FunPayments/FunPaymentMoonpayType.d.ts +4 -2
  19. package/dist/components/Icons/BrokerageIcon.d.ts +4 -0
  20. package/dist/components/Icons/CreditCardIcon.d.ts +4 -0
  21. package/dist/components/Icons/EvmWallet.d.ts +3 -1
  22. package/dist/components/Icons/LightningBoltIcon.d.ts +3 -1
  23. package/dist/components/Icons/SocialMediaIcons.d.ts +12 -4
  24. package/dist/config/getDefaultConfig.d.ts +33 -33
  25. package/dist/consts/assets.d.ts +2 -3
  26. package/dist/consts/funkit.d.ts +5 -1
  27. package/dist/consts/mesh.d.ts +36 -0
  28. package/dist/css/sprinkles.css.d.ts +38 -38
  29. package/dist/domains/checkoutFees.d.ts +4 -2
  30. package/dist/domains/clientMetadata.d.ts +37 -0
  31. package/dist/domains/paymentMethods.d.ts +28 -17
  32. package/dist/domains/quote.d.ts +31 -0
  33. package/dist/hooks/useCheckoutAccountBalanceTransfer.d.ts +1 -1
  34. package/dist/hooks/useCheckoutQuoteNotification.d.ts +1 -1
  35. package/dist/hooks/useCheckoutTransferDepositAddress.d.ts +2 -1
  36. package/dist/hooks/useEnabledTokenTransferChainTokens.d.ts +2 -0
  37. package/dist/hooks/useIsCheckoutRisky.d.ts +2 -0
  38. package/dist/hooks/useMesh.d.ts +5 -22
  39. package/dist/hooks/usePaymentMethodIcon.d.ts +22 -0
  40. package/dist/hooks/useUsableWalletAssetsForCheckout.d.ts +3 -2
  41. package/dist/index.css +2156 -2135
  42. package/dist/index.js +13723 -13433
  43. package/dist/modals/CheckoutModal/CheckoutPrimaryInfo.d.ts +1 -2
  44. package/dist/modals/CheckoutModal/ConfirmationStep.d.ts +1 -1
  45. package/dist/modals/CheckoutModal/FunCheckoutModal.d.ts +1 -2
  46. package/dist/modals/CheckoutModal/InputAmount/InputAmountLayout.d.ts +11 -0
  47. package/dist/modals/CheckoutModal/InputAmount/InputAmountLoaded.d.ts +10 -0
  48. package/dist/modals/CheckoutModal/InputAmount/InputAmountLoading.d.ts +7 -0
  49. package/dist/modals/CheckoutModal/InputAmount/state.d.ts +73 -0
  50. package/dist/modals/CheckoutModal/InputAmount/useAmountInput.d.ts +9 -0
  51. package/dist/modals/CheckoutModal/InputAmount/useCheckoutQuote.d.ts +17 -0
  52. package/dist/modals/CheckoutModal/InputAmount/utils.d.ts +23 -0
  53. package/dist/modals/CheckoutModal/InputAmount.d.ts +1 -1
  54. package/dist/modals/CheckoutModal/LoadingAccount.d.ts +1 -1
  55. package/dist/modals/CheckoutModal/SelectBrokerage.d.ts +1 -1
  56. package/dist/modals/CheckoutModal/SelectPaymentMethod.d.ts +2 -5
  57. package/dist/modals/CheckoutModal/TransferToken.d.ts +6 -3
  58. package/dist/modals/CheckoutModal/useAccountBalancePostCheckout.d.ts +1 -1
  59. package/dist/modals/CheckoutModal/useAvailableBalanceForCheckout.d.ts +1 -1
  60. package/dist/modals/CheckoutModal/useSourceAssetConfirm.d.ts +2 -7
  61. package/dist/modals/CheckoutModal/useUpdateSourceAssetForCard.d.ts +1 -1
  62. package/dist/modals/FunCheckoutHistoryModal/FunCheckoutStatus.css.d.ts +2 -0
  63. package/dist/providers/FunkitCheckoutContext.d.ts +37 -60
  64. package/dist/providers/FunkitFlagsProvider.d.ts +2 -2
  65. package/dist/providers/FunkitMoonpayProvider.d.ts +3 -3
  66. package/dist/providers/FunkitThemeProvider.d.ts +4 -4
  67. package/dist/themes/baseTheme.js +1 -1
  68. package/dist/themes/darkTheme.d.ts +1 -1
  69. package/dist/themes/darkTheme.js +2 -2
  70. package/dist/themes/lightTheme.d.ts +1 -1
  71. package/dist/themes/lightTheme.js +2 -2
  72. package/dist/utils/assets.d.ts +2 -1
  73. package/dist/utils/checkout.d.ts +23 -2
  74. package/dist/utils/deposit.d.ts +10 -2
  75. package/dist/utils/flags/config.d.ts +11 -8
  76. package/dist/utils/formatFees.d.ts +12 -0
  77. package/dist/utils/formatNumber.d.ts +1 -1
  78. package/dist/utils/formatTimestamp.d.ts +8 -8
  79. package/dist/utils/mesh.d.ts +9 -54
  80. package/dist/wallets/walletConnectors/index.js +30 -30
  81. package/package.json +4 -4
  82. package/dist/components/FunToast/FunShortToast.css.d.ts +0 -10
  83. package/dist/components/FunToast/FunShortToast.d.ts +0 -3
  84. package/dist/components/FunToast/FunToast.d.ts +0 -18
  85. package/dist/components/Icons/PaymentMethodIcons.d.ts +0 -27
  86. package/dist/providers/FunToastProvider.d.ts +0 -11
  87. package/dist/providers/useAccountBalancePaymentDefaultInfo.d.ts +0 -4
  88. package/dist/wallets/walletConnectors/chunk-2EMZOYQI.js +0 -101
  89. package/dist/wallets/walletConnectors/chunk-5K4DIMYR.js +0 -95
  90. package/dist/wallets/walletConnectors/chunk-AUVBWDIK.js +0 -102
  91. package/dist/wallets/walletConnectors/chunk-AXPQHNUI.js +0 -71
  92. package/dist/wallets/walletConnectors/chunk-B7FHT3CB.js +0 -94
  93. package/dist/wallets/walletConnectors/chunk-EFIENLEE.js +0 -98
  94. package/dist/wallets/walletConnectors/chunk-FLTQRYFS.js +0 -27
  95. package/dist/wallets/walletConnectors/chunk-L7QI6PBN.js +0 -108
  96. package/dist/wallets/walletConnectors/chunk-QP2BIVXD.js +0 -73
  97. package/dist/wallets/walletConnectors/chunk-UWZQZY4S.js +0 -149
  98. package/dist/wallets/walletConnectors/chunk-UZEMNN3Q.js +0 -96
@@ -1,5 +1,4 @@
1
1
  import React from 'react';
2
- export declare function CheckoutPrimaryInfo({ checkoutId, showTokenAmount, }: {
3
- checkoutId: string;
2
+ export declare function CheckoutPrimaryInfo({ showTokenAmount, }: {
4
3
  showTokenAmount?: boolean;
5
4
  }): React.JSX.Element | null;
@@ -27,5 +27,5 @@ export type ConfirmationStepNext = {
27
27
  paymentMethodInfo: PaymentMethodInfo;
28
28
  };
29
29
  export declare function confirmationStepNext(state: ConfirmationStepState, payload: ConfirmationStepNext): StepTransition[FunCheckoutStep.CONFIRMATION];
30
- export declare function ConfirmationStep({ modalState, onNext, setModalState, }: StateTransitionProps<ConfirmationStepState, ConfirmationStepNext>): React.JSX.Element;
30
+ export declare function ConfirmationStep({ modalState, onNext, }: StateTransitionProps<ConfirmationStepState, ConfirmationStepNext>): React.JSX.Element;
31
31
  export {};
@@ -2,7 +2,6 @@ import React from 'react';
2
2
  interface FunCheckoutModalProps {
3
3
  open: boolean;
4
4
  onClose: () => void;
5
- checkoutId: string | null;
6
5
  }
7
- export declare function FunCheckoutModal({ onClose, open, checkoutId, }: FunCheckoutModalProps): React.JSX.Element | null;
6
+ export declare function FunCheckoutModal({ onClose, open }: FunCheckoutModalProps): React.JSX.Element | null;
8
7
  export {};
@@ -0,0 +1,11 @@
1
+ import React, { ReactNode } from 'react';
2
+ import { FunButtonProps } from '../../../components/FunButton/FunButton';
3
+ import { ErrorNotification } from './utils';
4
+ export declare function InputAmountLayout({ actionButtonProps, amountOptions, amountInput, amountInputSwitch, availableBalance, error, }: {
5
+ actionButtonProps: FunButtonProps;
6
+ availableBalance?: ReactNode;
7
+ amountOptions?: ReactNode;
8
+ amountInput: ReactNode;
9
+ amountInputSwitch: ReactNode;
10
+ error?: ErrorNotification;
11
+ }): React.JSX.Element;
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { FunkitActiveCheckoutItem } from '../../../providers/FunkitCheckoutContext';
3
+ import { AssetHoldingsItem } from '../../../utils/assets';
4
+ import { InputAmountNext, InputAmountState } from '../InputAmount';
5
+ import { StateTransitionProps } from '../stepTransition';
6
+ export declare function InputAmountLoaded({ checkoutItem, modalState, onNext, sourceHolding, unitPrice, }: StateTransitionProps<InputAmountState, InputAmountNext> & {
7
+ sourceHolding: AssetHoldingsItem | null;
8
+ checkoutItem: FunkitActiveCheckoutItem;
9
+ unitPrice: number;
10
+ }): React.JSX.Element;
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import { InputAmountNext, InputAmountState } from '../InputAmount';
3
+ import { StateTransitionProps } from '../stepTransition';
4
+ export declare function InputAmountLoading({ modalState, onBack, sourceHoldingError, unitPriceError, }: StateTransitionProps<InputAmountState, InputAmountNext> & {
5
+ sourceHoldingError: Error | null;
6
+ unitPriceError: Error | null;
7
+ }): React.JSX.Element;
@@ -0,0 +1,73 @@
1
+ import { PaymentMethod } from '~/domains/paymentMethods';
2
+ import { FunkitActiveCheckoutItem } from '../../../providers/FunkitCheckoutContext';
3
+ import { AssetHoldingsItem } from '../../../utils/assets';
4
+ export interface AmountInputInitOptions {
5
+ apiKey: string;
6
+ checkoutItem: FunkitActiveCheckoutItem;
7
+ paymentMethod: PaymentMethod;
8
+ sourceHolding: AssetHoldingsItem | null;
9
+ /** Target asset unit price, in USD */
10
+ unitPrice: number;
11
+ }
12
+ export interface AmountInputState {
13
+ /** Current amount, in target asset */
14
+ assetAmount: number;
15
+ /** Current input value (with leading $ if in USD) */
16
+ inputValue: string;
17
+ /** Whether the input is currently in USD */
18
+ isInputInUsd: boolean;
19
+ /** Current amount, in USD */
20
+ usdAmount: number;
21
+ /** Estimated available amount, in USD (defaults to unlimited) */
22
+ usdAvailableAmount: number | null;
23
+ /** Maximum amount, in USD (defaults to unlimited) */
24
+ usdMaxAmount: number | null;
25
+ /** Minimum amount, in USD (defaults to 0) */
26
+ usdMinAmount: number | null;
27
+ }
28
+ /** Derived state includes additional fields that are pure functions of base state */
29
+ export interface AmountInputDerivedState extends AmountInputState {
30
+ inputError: AmountInputError | null;
31
+ isValid: boolean;
32
+ }
33
+ export type AmountInputAction = {
34
+ /** Switches between USD and absolute input mode */
35
+ type: 'setInputInUsd';
36
+ isInputInUsd: boolean;
37
+ } | {
38
+ /** Sets the input value as string */
39
+ type: 'setInputValue';
40
+ inputValue: string;
41
+ unitPrice: number;
42
+ } | {
43
+ /** Sets the input value as USD amount */
44
+ type: 'setUsdAmount';
45
+ unitPrice: number;
46
+ usdAmount: number;
47
+ } | {
48
+ /** Updates the available USD amount */
49
+ type: 'setUsdAvailableAmount';
50
+ usdAvailableAmount: number;
51
+ };
52
+ export type AmountInputError = {
53
+ /** Current amount is above available balance */
54
+ type: 'aboveAvailable';
55
+ usdAvailableAmount: number;
56
+ } | {
57
+ /** Current amount is above maximum */
58
+ type: 'aboveMax';
59
+ usdMaxAmount: number;
60
+ } | {
61
+ /** Current amount is below minimum */
62
+ type: 'belowMin';
63
+ usdMinAmount: number;
64
+ } | {
65
+ /** Available balance is 0 */
66
+ type: 'noAvailableBalance';
67
+ } | {
68
+ /** Input is empty */
69
+ type: 'noInput';
70
+ };
71
+ export declare function initializeState(init: AmountInputInitOptions): AmountInputState;
72
+ export declare function reduceState(state: AmountInputState, action: AmountInputAction): AmountInputState;
73
+ export declare function getDerivedState(state: AmountInputState): AmountInputDerivedState;
@@ -0,0 +1,9 @@
1
+ import { AmountInputDerivedState, AmountInputInitOptions } from './state';
2
+ interface UseAmountInputResult extends AmountInputDerivedState {
3
+ onChange(event: React.ChangeEvent<HTMLInputElement>): void;
4
+ setInputInUsd(isInputInUsd: boolean): void;
5
+ setUsdAmount(usdAmount: number): AmountInputDerivedState;
6
+ setUsdAvailableAmount(usdAvailableAmount: number): void;
7
+ }
8
+ export declare function useAmountInput(options: AmountInputInitOptions): UseAmountInputResult;
9
+ export {};
@@ -0,0 +1,17 @@
1
+ interface TriggerNewQuoteOptions {
2
+ maxRetries: number;
3
+ targetAssetAmount: number;
4
+ }
5
+ interface UseCheckoutQuoteOptions {
6
+ checkoutId: string;
7
+ onFailure(maxTargetAssetAmount: number | undefined): void;
8
+ onSuccess(): void;
9
+ }
10
+ interface UseCheckoutQuoteResult {
11
+ error: string | null;
12
+ isQuoting: boolean;
13
+ step: string | null;
14
+ triggerNewQuote(options: TriggerNewQuoteOptions): void;
15
+ }
16
+ export declare function useCheckoutQuote({ onFailure, onSuccess, }: UseCheckoutQuoteOptions): UseCheckoutQuoteResult;
17
+ export {};
@@ -0,0 +1,23 @@
1
+ import { ReactNode } from 'react';
2
+ import { PaymentMethod } from '~/domains/paymentMethods';
3
+ import { FunkitActiveCheckoutItem } from '../../../providers/FunkitCheckoutContext';
4
+ import { AssetHoldingsItem } from '../../../utils/assets';
5
+ export declare const ASSET_DECIMALS = 5;
6
+ export declare const USD_DECIMALS = 2;
7
+ export declare const USD_INITIAL_AMOUNT = 100;
8
+ export declare const USD_PREFIX = "$";
9
+ export interface ErrorNotification {
10
+ message: ReactNode;
11
+ /** FunNotificationType */
12
+ type: 'error' | 'warning' | 'hint';
13
+ }
14
+ export declare function round(value: number, decimals: number,
15
+ /**
16
+ * Whether to round up ('ceil'), down ('floor'), or nearest ('round')
17
+ *
18
+ * Defauls to 'round'
19
+ **/
20
+ method?: 'ceil' | 'floor' | 'round'): number;
21
+ export declare function getUsdAvailableAmount(checkoutItem: FunkitActiveCheckoutItem, sourceBalance: AssetHoldingsItem | null): number | null;
22
+ export declare function getUsdMaxAmount(paymentMethod: PaymentMethod, apiKey: string): number | null;
23
+ export declare function getUsdMinAmount(paymentMethod: PaymentMethod): number;
@@ -9,4 +9,4 @@ export type InputAmountNext = {
9
9
  step: FunCheckoutStep.INPUT_AMOUNT;
10
10
  };
11
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;
12
+ export declare function InputAmount(props: StateTransitionProps<InputAmountState, InputAmountNext>): React.JSX.Element;
@@ -11,7 +11,7 @@ export type LoadingAccountNext = ({
11
11
  usablePaymentMethod: PaymentMethod.BROKERAGE;
12
12
  paymentMethodInfo: PaymentMethodBrokerageInfo;
13
13
  } | {
14
- usablePaymentMethod: null;
14
+ usablePaymentMethod: PaymentMethod.TOKEN_TRANSFER | null;
15
15
  }) & {
16
16
  step: FunCheckoutStep.LOADING_ACCOUNT;
17
17
  };
@@ -16,5 +16,5 @@ export type SelectBrokerageNext = {
16
16
  };
17
17
  export declare function selectBrokerageNext(state: SelectBrokerageState, payload: SelectBrokerageNext): StepTransition[FunCheckoutStep.SELECT_BROKERAGE];
18
18
  type Props = StateTransitionProps<SelectBrokerageState, SelectBrokerageNext>;
19
- export declare function SelectBrokerage({ modalState, onNext }: Props): React.JSX.Element;
19
+ export declare function SelectBrokerage({ onNext }: Props): React.JSX.Element;
20
20
  export {};
@@ -7,7 +7,7 @@ export interface SelectPaymentMethodState extends CheckoutModalCommonState {
7
7
  }
8
8
  export type SelectPaymentMethodNext = {
9
9
  step: FunCheckoutStep.SELECT_PAYMENT_METHOD;
10
- paymentMethod: PaymentMethod.BROKERAGE;
10
+ paymentMethod: PaymentMethod.BROKERAGE | PaymentMethod.TOKEN_TRANSFER;
11
11
  } | {
12
12
  step: FunCheckoutStep.SELECT_PAYMENT_METHOD;
13
13
  paymentMethod: PaymentMethod.CARD;
@@ -16,12 +16,9 @@ export type SelectPaymentMethodNext = {
16
16
  step: FunCheckoutStep.SELECT_PAYMENT_METHOD;
17
17
  paymentMethod: PaymentMethod.ACCOUNT_BALANCE;
18
18
  paymentMethodInfo: PaymentMethodAccountInfo;
19
- } | {
20
- step: FunCheckoutStep.SELECT_PAYMENT_METHOD;
21
- paymentMethod: PaymentMethod.TOKEN_TRANSFER;
22
19
  };
23
20
  export declare function selectPaymentMethodNext(state: SelectPaymentMethodState, payload: SelectPaymentMethodNext): StepTransition[FunCheckoutStep.SELECT_PAYMENT_METHOD];
24
21
  type Props = StateTransitionProps<SelectPaymentMethodState, SelectPaymentMethodNext>;
25
22
  export type SelectMethodPayloadData = UnionOmit<SelectPaymentMethodNext, 'step'>;
26
- export declare function SelectPaymentMethod({ modalState, onNext, onClose }: Props): React.JSX.Element;
23
+ export declare function SelectPaymentMethod({ onNext, onClose }: Props): React.JSX.Element;
27
24
  export {};
@@ -6,10 +6,13 @@ export interface TransferTokenState extends CheckoutModalCommonState {
6
6
  }
7
7
  export type TransferTokenNext = {
8
8
  step: FunCheckoutStep.TRANSFER_TOKEN;
9
- paymentMethodInfo: PaymentMethodAccountInfo;
10
- isLoggedIn: boolean;
9
+ paymentMethodInfo?: PaymentMethodAccountInfo;
10
+ isLoggedIn?: boolean;
11
11
  };
12
+ export interface TokenTransferSourceChainsAndAssets {
13
+ [chainId: number]: string[];
14
+ }
12
15
  export declare function transferTokenNext(state: TransferTokenState, payload: TransferTokenNext): StepTransition[FunCheckoutStep.TRANSFER_TOKEN];
13
16
  type Props = StateTransitionProps<TransferTokenState, TransferTokenNext>;
14
- export declare function TransferToken({ onBack, modalState }: Props): React.JSX.Element;
17
+ export declare function TransferToken({ onNext }: Props): React.JSX.Element;
15
18
  export {};
@@ -1,2 +1,2 @@
1
1
  import { Address } from 'viem';
2
- export declare function useAccountBalancePostCheckout(checkoutId: string, setPostCheckoutStepMessage: (s: string) => void, apiKey: string): (depositAddress: Address) => Promise<void>;
2
+ export declare function useAccountBalancePostCheckout(setPostCheckoutStepMessage: (s: string) => void, apiKey: string): (depositAddress: Address) => Promise<void>;
@@ -1,4 +1,4 @@
1
1
  import { PaymentMethodInfo } from '../../domains/paymentMethods';
2
2
  import { QueryResult } from '../../types/utils';
3
3
  import { AssetHoldingsItem } from '../../utils/assets';
4
- export declare function useAvailableBalanceForCheckout(checkoutId: string, paymentMethodInfo: PaymentMethodInfo, targetChainId: string, assetChainId: string, assetSymbol: string | null): QueryResult<AssetHoldingsItem>;
4
+ export declare function useAvailableBalanceForCheckout(paymentMethodInfo: PaymentMethodInfo, targetChainId: string, assetChainId: string, assetSymbol: string | null): QueryResult<AssetHoldingsItem>;
@@ -1,13 +1,8 @@
1
- import { PaymentMethodInfo } from '../../domains/paymentMethods';
2
1
  import { FunkitActiveCheckoutItem } from '../../providers/FunkitCheckoutContext';
3
2
  export interface SourceAssetConfirmed {
4
3
  isQuoteSuccess: boolean;
5
- newPaymentMethodInfo: PaymentMethodInfo;
6
- quoteObject: FunkitActiveCheckoutItem | undefined;
7
- totalFeesUsd: number | undefined;
8
- estSubtotalUsd: number | undefined;
4
+ maxTargetAssetAmount: number | undefined;
9
5
  }
10
- export type OnSourceAssetConfirmed = (confirmed: SourceAssetConfirmed | undefined) => void;
11
6
  /**
12
7
  *
13
8
  * Note: this hook is EXTREMELY confusing in what is doing
@@ -20,7 +15,7 @@ export type OnSourceAssetConfirmed = (confirmed: SourceAssetConfirmed | undefine
20
15
  *
21
16
  * USE THIS WITH CAUTION
22
17
  **/
23
- export declare function useTriggerQuoteAndOtherStuffsWithExtremeCaution(checkoutId: string, onSuccess: (confirmed: SourceAssetConfirmed | undefined) => void, setPreloadedQuoteData?: (quoteData: FunkitActiveCheckoutItem) => void): {
18
+ export declare function useTriggerQuoteAndOtherStuffsWithExtremeCaution(onSuccess: (confirmed: SourceAssetConfirmed | undefined) => void, setPreloadedQuoteData?: (quoteData: FunkitActiveCheckoutItem) => void): {
24
19
  isSourceAssetConfirming: boolean;
25
20
  triggerAssetConfirm: () => void;
26
21
  onSourceAssetConfirmed: (preloadQuoteData?: boolean) => Promise<SourceAssetConfirmed | undefined>;
@@ -1,4 +1,4 @@
1
- export declare function useUpdateCardSourceAsset(checkoutId: string): {
1
+ export declare function useUpdateCardSourceAsset(): {
2
2
  onSelectCard: () => Promise<void>;
3
3
  isUpdating: boolean;
4
4
  };
@@ -0,0 +1,2 @@
1
+ export declare const GradientErrorBox: string;
2
+ export declare const GradientSuccessBox: string;
@@ -1,10 +1,14 @@
1
- import { CheckoutHistoryItem, CheckoutQuoteResponse } from '@funkit/api-base';
1
+ import { CheckoutHistoryItem } from '@funkit/api-base';
2
+ import { Operation } from '@funkit/core';
2
3
  import React, { ReactNode } from 'react';
3
4
  import { Abi, Address } from 'viem';
4
- import { CheckoutFees } from '../domains/checkoutFees';
5
+ import { AssetHoldingsItem } from '~/utils/assets';
5
6
  import { PaymentMethod, PaymentMethodInfo } from '../domains/paymentMethods';
6
- import { CheckoutHistoryStateMap } from '../utils/checkout';
7
+ import type { FunkitCheckoutQuoteResult } from '../domains/quote';
8
+ import { CheckoutHistoryDepositAddrMap, CheckoutHistoryStateMap } from '../utils/checkout';
7
9
  import { PurifiedCheckoutHistoryItem } from '../utils/purifyCheckoutHistoryItem';
10
+ export type { HistoricalCheckoutItem, ServerCheckoutConfig, } from '~/domains/clientMetadata';
11
+ export type { FunkitCheckoutQuoteResult } from '~/domains/quote';
8
12
  export interface FunkitCheckoutActionParams {
9
13
  contractAbi: Abi;
10
14
  contractAddress: Address;
@@ -52,13 +56,6 @@ export interface FunkitCheckoutConfig {
52
56
  /** User identification within customer's app for logging and customer dashboard purposes (future). **/
53
57
  externalCheckoutUserId?: string;
54
58
  }
55
- type FunkitCheckoutQuoteResult = {
56
- baseQuote: CheckoutQuoteResponse;
57
- finalTimeEstimationMs: number;
58
- finalPaymentTokenAmount: string;
59
- finalTotalUsd: string;
60
- finalFeesBreakdown: CheckoutFees;
61
- };
62
59
  interface FunkitCheckoutValidationResult {
63
60
  isValid: boolean;
64
61
  message: string;
@@ -124,52 +121,44 @@ export interface FunkitActiveCheckoutItem {
124
121
  address: Address | null;
125
122
  symbol: string | null;
126
123
  chainId: string;
124
+ iconSrc: string | null;
127
125
  };
126
+ /** Time of completion of the active checkout item. For frontend use only. **/
127
+ completedTimestampMs: number | null;
128
128
  }
129
- export type ServerPaymentMethodInfo = Omit<PaymentMethodInfo, 'titleIcon' | 'descriptionIcon'>;
130
- export type ServerCheckoutConfig = Omit<FunkitCheckoutConfig, 'generateActionsParams'> & {
131
- generateActionsParams?: string;
132
- };
133
- /** Serializable data from FE checkout item */
134
- export type HistoricalCheckoutItem = {
135
- id: FunkitActiveCheckoutItem['id'];
136
- startTimestampMs: FunkitActiveCheckoutItem['startTimestampMs'];
137
- draftDollarValue: FunkitActiveCheckoutItem['draftDollarValue'];
138
- finalDollarValue: FunkitActiveCheckoutItem['finalDollarValue'];
139
- latestQuote: FunkitActiveCheckoutItem['latestQuote'];
140
- depositAddress: FunkitActiveCheckoutItem['depositAddress'];
141
- initSettings: {
142
- config: ServerCheckoutConfig;
143
- };
144
- selectedSourceAssetInfo: FunkitActiveCheckoutItem['selectedSourceAssetInfo'];
145
- selectedPaymentMethodInfo: ServerPaymentMethodInfo | null;
146
- };
147
- export declare function FunkitCheckoutProvider({ children }: {
148
- children: ReactNode;
149
- }): React.JSX.Element;
150
- interface useFunkitPreCheckoutInternalReturn {
151
- checkoutItem: null | FunkitActiveCheckoutItem;
129
+ interface FunkitCheckoutContextInterface {
130
+ checkoutItem: FunkitActiveCheckoutItem | null;
131
+ checkoutHistoryList: CheckoutHistoryItem[];
132
+ checkoutHistoryStateMap: CheckoutHistoryStateMap;
133
+ checkoutHistoryDepositAddrMap: CheckoutHistoryDepositAddrMap;
134
+ checkoutHistoryCurrentDepositAddrMap: CheckoutHistoryDepositAddrMap;
135
+ isCheckoutHistoryInited: boolean;
136
+ isRefreshingCheckoutHistory: boolean;
152
137
  reDraftSymbol: symbol;
153
- updateSourceAsset: (newSourceAsset: Address, newSourceAssetSymbol: string, newSourceAssetChainId: string) => void;
154
- updateTargetAssetAmount: (newTargetAssetAmount: number) => void;
155
- updateSelectedPaymentMethodInfo: (newPaymentMethodInfo: PaymentMethodInfo) => void;
156
- confirmCheckout: (shouldBatchOpBypassInit: boolean, stepMessageSetter: (m: string) => void) => Promise<Address>;
157
- cancelCheckout: (depositAddress: Address) => Promise<boolean>;
158
- getCheckoutDraftDollarValue: () => Promise<number>;
159
- clearCheckoutQuoteMessages: () => void;
160
- getCheckoutQuote: (sponsorInitialTransferGasLimit: number, newPaymentMethodInfo: PaymentMethodInfo, disableInformationStreaming?: boolean) => Promise<{
138
+ startCheckoutHistoryListener(recipientAddr?: Address | undefined): NodeJS.Timeout;
139
+ stopCheckoutHistoryListener(cancelIntervalId?: NodeJS.Timeout): void;
140
+ initNewCheckout(initSettings: useFunkitCheckoutPropsFinal): string;
141
+ updateSourceAsset(selectedSource: Omit<AssetHoldingsItem, 'amount' | 'usdAmount'>): void;
142
+ updateTargetAssetAmount(newTargetAssetAmount: number): void;
143
+ updateSelectedPaymentMethodInfo(newPaymentMethodInfo: PaymentMethodInfo): void;
144
+ confirmCheckout(shouldBatchOpBypassInit: boolean, stepMessageSetter: (m: string) => void): Promise<Address>;
145
+ cancelCheckout(depositAddress: Address): Promise<boolean>;
146
+ clearCheckoutQuoteMessages(): void;
147
+ getCheckoutQuote(sponsorInitialTransferGasLimit: number, newPaymentMethodInfo: PaymentMethodInfo, disableInformationStreaming?: boolean): Promise<{
161
148
  success: boolean;
162
149
  shellCheckoutItemWithNextQuote: FunkitActiveCheckoutItem | undefined;
163
- totalFeesUsd: number | undefined;
164
- estSubtotalUsd: number | undefined;
150
+ maxTargetAssetAmount: number | undefined;
165
151
  errorObject?: any;
166
152
  }>;
167
- setCheckoutQuote: (quote: FunkitActiveCheckoutItem) => void;
153
+ getCheckoutDraftDollarValue(): Promise<number>;
154
+ generateSignedBatchOperation(actionsParams: FunkitCheckoutActionParams[], assetChainId: string, bypassWalletInit: boolean, stepMessageSetter: (m: string) => void): Promise<null | Operation>;
155
+ setCheckoutQuote(quote: FunkitActiveCheckoutItem): void;
156
+ setCompletedTimestamp(timestampMs: number): void;
168
157
  }
169
- /**
170
- * Internal hook to handle frontend pre-checkout operations, PER-CHECKOUT ITEM.
171
- */
172
- export declare const useFunkitPreCheckoutInternal: (checkoutId: string) => useFunkitPreCheckoutInternalReturn;
158
+ export declare function FunkitCheckoutProvider({ children }: {
159
+ children: ReactNode;
160
+ }): React.JSX.Element;
161
+ export declare function useCheckoutContext(): FunkitCheckoutContextInterface;
173
162
  /**
174
163
  * Internal hook to handle post-checkout, PER-BACKEND-CHECKOUT ITEM.
175
164
  */
@@ -177,17 +166,6 @@ export declare const useFunkitPostCheckoutInternal: (depositAddress: Address) =>
177
166
  isLoading: boolean;
178
167
  checkoutHistoryInfo: CheckoutHistoryItem | undefined;
179
168
  };
180
- /**
181
- * Internal hook to get all post-checkout items
182
- */
183
- export declare const useFunkitAllPostCheckoutsInternal: () => {
184
- checkoutHistoryList: CheckoutHistoryItem[];
185
- checkoutHistoryStateMap: CheckoutHistoryStateMap;
186
- isCheckoutHistoryInited: boolean;
187
- isRefreshingCheckoutHistory: boolean;
188
- startCheckoutHistoryListener: (recipientAddr?: Address | undefined) => NodeJS.Timeout;
189
- stopCheckoutHistoryListener: (cancelIntervalId?: NodeJS.Timeout) => void;
190
- };
191
169
  /**
192
170
  * External hook for user to kickstart a checkout in their app
193
171
  */
@@ -208,4 +186,3 @@ export declare function useCheckoutsListenerByUserId(userId: string): PurifiedCh
208
186
  * @returns PurifiedCheckoutHistoryItem | undefined
209
187
  */
210
188
  export declare function useCheckoutListenerByCheckoutId(checkoutId: string): PurifiedCheckoutHistoryItem | undefined;
211
- export {};
@@ -6,7 +6,7 @@ export type FlagValue<K extends FlagKey> = InferFlagType<(typeof offlineConfig)[
6
6
  export type FlagValues = {
7
7
  [K in FlagKey]?: FlagValue<K>;
8
8
  };
9
- export type GetFlagFunction = <K extends FlagKey>(flagKey: K, fallback: FlagValue<K>) => FlagValue<K>;
9
+ export type GetFlagFunction = <K extends FlagKey>(flagKey: K, fallback?: FlagValue<K>) => FlagValue<K>;
10
10
  export interface FunkitFlagsContextValue {
11
11
  /** Error fetching flag config from server */
12
12
  error: Error | null;
@@ -22,4 +22,4 @@ export declare function FunkitFlagsProvider({ children }: {
22
22
  children: ReactNode;
23
23
  }): React.JSX.Element;
24
24
  export declare function useFlags(): FunkitFlagsContextValue;
25
- export declare function useFlag<K extends FlagKey>(flagKey: K, fallback: FlagValue<K>): FlagValue<K>;
25
+ export declare function useFlag<K extends FlagKey>(flagKey: K, fallback?: FlagValue<K>): FlagValue<K>;
@@ -1,7 +1,7 @@
1
- import React from 'react';
1
+ import React, { ReactNode } from 'react';
2
2
  import { FunButtonProps } from '../components/FunButton/FunButton';
3
3
  export declare function FunkitMoonpayProvider({ children, debug, }: {
4
- children: any;
4
+ children: ReactNode;
5
5
  debug: boolean;
6
6
  }): React.JSX.Element;
7
7
  export interface UserIpInfoFromMoonpay {
@@ -20,6 +20,6 @@ export interface UserIpInfoFromMoonpay {
20
20
  export declare const geoCheckInProgressProps: FunButtonProps;
21
21
  export declare function useFunkitUserIp(): {
22
22
  isLoadingGeoCheck: boolean;
23
- isUserBlockedForCheckout: boolean;
23
+ isUserGeoblocked: boolean;
24
24
  userIpInfo: UserIpInfoFromMoonpay | undefined;
25
25
  };
@@ -31,6 +31,7 @@ export declare const defaultTheme: {
31
31
  hoverState: string;
32
32
  offBackgroundInverse: string;
33
33
  lightStroke: string;
34
+ mediumStroke: string;
34
35
  strokeColor: string;
35
36
  dydxSwitchActiveBackground: string;
36
37
  primaryText: string;
@@ -60,7 +61,6 @@ export declare const defaultTheme: {
60
61
  buttonBackground: string;
61
62
  buttonBackgroundHover: string;
62
63
  buttonBackgroundDisabled: string;
63
- buttonText: string;
64
64
  buttonStroke: string;
65
65
  buttonTextSecondaryDisabled: string;
66
66
  buttonTextSecondary: string;
@@ -187,6 +187,7 @@ export declare const useActiveTheme: () => {
187
187
  hoverState: string;
188
188
  offBackgroundInverse: string;
189
189
  lightStroke: string;
190
+ mediumStroke: string;
190
191
  strokeColor: string;
191
192
  dydxSwitchActiveBackground: string;
192
193
  primaryText: string;
@@ -216,7 +217,6 @@ export declare const useActiveTheme: () => {
216
217
  buttonBackground: string;
217
218
  buttonBackgroundHover: string;
218
219
  buttonBackgroundDisabled: string;
219
- buttonText: string;
220
220
  buttonStroke: string;
221
221
  buttonTextSecondaryDisabled: string;
222
222
  buttonTextSecondary: string;
@@ -331,6 +331,7 @@ export declare const useActiveTheme: () => {
331
331
  hoverState: string;
332
332
  offBackgroundInverse: string;
333
333
  lightStroke: string;
334
+ mediumStroke: string;
334
335
  strokeColor: string;
335
336
  dydxSwitchActiveBackground: string;
336
337
  primaryText: string;
@@ -360,7 +361,6 @@ export declare const useActiveTheme: () => {
360
361
  buttonBackground: string;
361
362
  buttonBackgroundHover: string;
362
363
  buttonBackgroundDisabled: string;
363
- buttonText: string;
364
364
  buttonStroke: string;
365
365
  buttonTextSecondaryDisabled: string;
366
366
  buttonTextSecondary: string;
@@ -474,6 +474,7 @@ export declare const useActiveTheme: () => {
474
474
  hoverState: string;
475
475
  offBackgroundInverse: string;
476
476
  lightStroke: string;
477
+ mediumStroke: string;
477
478
  strokeColor: string;
478
479
  dydxSwitchActiveBackground: string;
479
480
  primaryText: string;
@@ -503,7 +504,6 @@ export declare const useActiveTheme: () => {
503
504
  buttonBackground: string;
504
505
  buttonBackgroundHover: string;
505
506
  buttonBackgroundDisabled: string;
506
- buttonText: string;
507
507
  buttonStroke: string;
508
508
  buttonTextSecondaryDisabled: string;
509
509
  buttonTextSecondary: string;
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  baseTheme
4
- } from "../chunk-HFT6OV3T.js";
4
+ } from "../chunk-BY224HGT.js";
5
5
  export {
6
6
  baseTheme
7
7
  };
@@ -31,6 +31,7 @@ export declare const darkTheme: {
31
31
  hoverState: string;
32
32
  offBackgroundInverse: string;
33
33
  lightStroke: string;
34
+ mediumStroke: string;
34
35
  strokeColor: string;
35
36
  dydxSwitchActiveBackground: string;
36
37
  primaryText: string;
@@ -60,7 +61,6 @@ export declare const darkTheme: {
60
61
  buttonBackground: string;
61
62
  buttonBackgroundHover: string;
62
63
  buttonBackgroundDisabled: string;
63
- buttonText: string;
64
64
  buttonStroke: string;
65
65
  buttonTextSecondaryDisabled: string;
66
66
  buttonTextSecondary: string;
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  darkTheme
4
- } from "../chunk-ZGK66FYG.js";
5
- import "../chunk-HFT6OV3T.js";
4
+ } from "../chunk-XWW5QOD4.js";
5
+ import "../chunk-BY224HGT.js";
6
6
  export {
7
7
  darkTheme
8
8
  };
@@ -31,6 +31,7 @@ export declare const lightTheme: {
31
31
  hoverState: string;
32
32
  offBackgroundInverse: string;
33
33
  lightStroke: string;
34
+ mediumStroke: string;
34
35
  strokeColor: string;
35
36
  dydxSwitchActiveBackground: string;
36
37
  primaryText: string;
@@ -60,7 +61,6 @@ export declare const lightTheme: {
60
61
  buttonBackground: string;
61
62
  buttonBackgroundHover: string;
62
63
  buttonBackgroundDisabled: string;
63
- buttonText: string;
64
64
  buttonStroke: string;
65
65
  buttonTextSecondaryDisabled: string;
66
66
  buttonTextSecondary: string;
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  lightTheme
4
- } from "../chunk-YOJVBRUJ.js";
5
- import "../chunk-HFT6OV3T.js";
4
+ } from "../chunk-77C753LI.js";
5
+ import "../chunk-BY224HGT.js";
6
6
  export {
7
7
  lightTheme
8
8
  };
@@ -26,7 +26,7 @@ export interface AssetHoldingsMap {
26
26
  }
27
27
  export declare const getFeesUsdEstimate: (checkoutItem: FunkitActiveCheckoutItem, asset: AssetHoldingsItem) => 1 | 20;
28
28
  export declare const isAssetUsdAmountSufficient: (checkoutItem: FunkitActiveCheckoutItem, asset: AssetHoldingsItem | null) => boolean;
29
- export type RecommendedAsset = {
29
+ type RecommendedAsset = {
30
30
  symbol: string;
31
31
  label: string | null;
32
32
  } | null;
@@ -41,3 +41,4 @@ export declare const getTotalAssetBalance: (assets: AssetHoldingsMap) => string;
41
41
  * @returns targetChain either from the provided config or arbitrum chainId for dydxChain since that's a non evm chain processed with evm tech
42
42
  */
43
43
  export declare const getMockedTargetChainId: ({ targetChain }: FunkitCheckoutConfig, mockedChains?: string[]) => string;
44
+ export {};