@funkit/connect 4.1.7 → 5.0.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 (61) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/{chunk-TKJVOYWW.js → chunk-2LVAEHB2.js} +19 -5
  3. package/dist/{chunk-QCYFMAKN.js → chunk-7RFJFAFX.js} +5 -1
  4. package/dist/{chunk-C7BDNBKV.js → chunk-ZQ7UHAVV.js} +5 -1
  5. package/dist/components/Box/Box.d.ts +23 -23
  6. package/dist/components/CopyAddress/CopyInputDisplayedAddress.d.ts +2 -1
  7. package/dist/components/Dialog/Dialog.css.d.ts +6 -0
  8. package/dist/components/Dialog/Dialog.d.ts +1 -1
  9. package/dist/components/Dialog/DialogContent.css.d.ts +2 -0
  10. package/dist/components/Dropdown/BaseDropdown.d.ts +1 -1
  11. package/dist/components/Dropdown/BaseDropdownItem.css.d.ts +2 -0
  12. package/dist/components/Dropdown/BaseDropdownItem.d.ts +2 -1
  13. package/dist/components/Dropdown/ChainDropdown.d.ts +3 -1
  14. package/dist/components/Dropdown/TokenDropdown.d.ts +3 -2
  15. package/dist/components/FunAlert/FunAlert.d.ts +2 -1
  16. package/dist/components/FunAsset/FunAssetBadge.d.ts +8 -1
  17. package/dist/components/FunAsset/FunAssetItem.d.ts +3 -1
  18. package/dist/components/FunButton/FunButton.d.ts +2 -1
  19. package/dist/components/FunTransactionSummary/FunTxSummaryComponents.d.ts +1 -1
  20. package/dist/components/FunTransactionSummary/PaymentMethodSummary.d.ts +3 -3
  21. package/dist/consts/customers.d.ts +1 -0
  22. package/dist/css/sprinkles.css.d.ts +41 -23
  23. package/dist/domains/asset.d.ts +10 -1
  24. package/dist/domains/checkoutState.d.ts +3 -2
  25. package/dist/domains/wallet.d.ts +10 -0
  26. package/dist/hooks/useCheckoutItemDisplay.d.ts +8 -0
  27. package/dist/index.css +2095 -1852
  28. package/dist/index.d.ts +1 -0
  29. package/dist/index.js +1936 -1720
  30. package/dist/modals/CheckoutModal/ConfirmationStep/DisclaimerText.d.ts +5 -1
  31. package/dist/modals/CheckoutModal/ConfirmationStep/usePostCheckout.d.ts +1 -0
  32. package/dist/modals/CheckoutModal/InputAmount/state.d.ts +4 -2
  33. package/dist/modals/CheckoutModal/InputAmount/utils.d.ts +1 -1
  34. package/dist/modals/FunCheckoutHistoryModal/FunCheckoutHistoryContent.d.ts +2 -1
  35. package/dist/modals/FunCheckoutHistoryModal/FunCheckoutHistoryDetail.d.ts +2 -1
  36. package/dist/modals/FunCheckoutHistoryModal/useCustomStatusAnimationAboveTopbar.d.ts +26 -0
  37. package/dist/providers/FunkitCheckoutContext.d.ts +28 -5
  38. package/dist/providers/FunkitConfigContext.d.ts +5 -5
  39. package/dist/providers/FunkitThemeProvider.d.ts +27 -0
  40. package/dist/providers/ModalSizeContext.d.ts +1 -0
  41. package/dist/themes/baseTheme.d.ts +2 -1
  42. package/dist/themes/baseTheme.js +1 -1
  43. package/dist/themes/darkTheme.js +2 -2
  44. package/dist/themes/lightTheme.js +2 -2
  45. package/dist/utils/assets.d.ts +1 -16
  46. package/dist/utils/checkout.d.ts +7 -2
  47. package/dist/utils/consts.d.ts +1 -0
  48. package/dist/utils/flags/config.d.ts +9 -15
  49. package/dist/wallets/walletConnectors/index.js +41 -41
  50. package/package.json +5 -5
  51. package/dist/Arc-VPZRUJGC.js +0 -7
  52. package/dist/Brave-CNIOSZJS.js +0 -7
  53. package/dist/Browser-3D4QDCGS.js +0 -7
  54. package/dist/Chrome-CBNGC2ZN.js +0 -7
  55. package/dist/Edge-6CGHSI4D.js +0 -7
  56. package/dist/Firefox-XTYBPISX.js +0 -7
  57. package/dist/Linux-X65XN6MG.js +0 -7
  58. package/dist/Macos-5QL4JBJE.js +0 -7
  59. package/dist/Opera-PAFQG2LC.js +0 -7
  60. package/dist/Safari-MV3S3IGE.js +0 -7
  61. package/dist/Windows-F4SQNFRR.js +0 -7
@@ -1,7 +1,11 @@
1
1
  import React from 'react';
2
+ import type { FunkitActiveCheckoutItem } from '~/providers/FunkitCheckoutContext';
2
3
  interface DisclaimerTextProps {
3
4
  showDydxDisclaimer: boolean;
5
+ checkoutItem: FunkitActiveCheckoutItem | null;
4
6
  continueText: string;
7
+ isCardPayment?: boolean;
8
+ finalConvertedAssetName?: string;
5
9
  }
6
- export declare const DisclaimerText: ({ showDydxDisclaimer, continueText, }: DisclaimerTextProps) => React.JSX.Element;
10
+ export declare const DisclaimerText: ({ showDydxDisclaimer, continueText, isCardPayment, finalConvertedAssetName, checkoutItem, }: DisclaimerTextProps) => React.JSX.Element;
7
11
  export {};
@@ -24,5 +24,6 @@ interface UsePostCheckoutResult {
24
24
  postCheckoutError: PostCheckoutError | null;
25
25
  postCheckoutStepMessage: string | null;
26
26
  }
27
+ export declare function isUserRejectedError(error: unknown): boolean;
27
28
  export declare function usePostCheckout({ onSuccess, }: UsePostCheckoutOptions): UsePostCheckoutResult;
28
29
  export {};
@@ -1,5 +1,5 @@
1
1
  import type { PaymentMethod } from '~/domains/paymentMethods';
2
- import { type AssetHoldingsItem } from '~/utils/assets';
2
+ import type { AssetHoldingsItem } from '~/utils/assets';
3
3
  import type { FunkitCheckoutConfig } from '../../../providers/FunkitCheckoutContext';
4
4
  export interface AmountInputInitOptions {
5
5
  checkoutConfig: FunkitCheckoutConfig;
@@ -9,6 +9,8 @@ export interface AmountInputInitOptions {
9
9
  unitPrice: number;
10
10
  /** Maximum checkout amount, in USD */
11
11
  maxUsd: number;
12
+ /** Minimum checkout amount, in USD */
13
+ minUsd?: number;
12
14
  }
13
15
  export interface AmountInputState {
14
16
  /** Current amount, in target asset */
@@ -69,6 +71,6 @@ export type AmountInputError = {
69
71
  /** Input is empty */
70
72
  type: 'noInput';
71
73
  };
72
- export declare function initializeState(init: AmountInputInitOptions): AmountInputState;
74
+ export declare function initializeState({ checkoutConfig, maxUsd, minUsd, paymentMethod, sourceHolding, unitPrice, }: AmountInputInitOptions): AmountInputState;
73
75
  export declare function reduceState(state: AmountInputState, action: AmountInputAction): AmountInputState;
74
76
  export declare function getDerivedState(state: AmountInputState): AmountInputDerivedState;
@@ -4,4 +4,4 @@ export declare const USD_DECIMALS = 2;
4
4
  export declare const USD_INITIAL_AMOUNT = 100;
5
5
  export declare const USD_PREFIX = "$";
6
6
  export declare function getUsdMaxAmount(paymentMethod: PaymentMethod, maxUsd: number): number | null;
7
- export declare function getUsdMinAmount(paymentMethod: PaymentMethod): number;
7
+ export declare function getUsdMinAmount(paymentMethod: PaymentMethod, minUsd?: number): number;
@@ -3,11 +3,12 @@ import { HistoryContentPages } from '../../utils/checkoutHistory';
3
3
  interface FunCheckoutHistoryContentProps {
4
4
  depositAddress: `0x${string}`;
5
5
  currentPage: HistoryContentPages;
6
+ hideStatus?: boolean;
6
7
  onHelp: () => void;
7
8
  onBackFromHelpPage: () => void;
8
9
  onClose: () => void;
9
10
  }
10
11
  export declare const HISTORY_BOTTOM_BAR_ID = "history-bottom-section";
11
12
  export declare const DEFAULT_CHECKOUT_HISTORY_DETAIL_TITLE = "Your Purchase";
12
- export declare function FunCheckoutHistoryContent({ depositAddress, currentPage, onHelp, onBackFromHelpPage, onClose, }: FunCheckoutHistoryContentProps): React.JSX.Element;
13
+ export declare function FunCheckoutHistoryContent({ depositAddress, currentPage, hideStatus, onHelp, onBackFromHelpPage, onClose, }: FunCheckoutHistoryContentProps): React.JSX.Element;
13
14
  export {};
@@ -2,11 +2,12 @@ import type { CheckoutHistoryItem } from '@funkit/api-base';
2
2
  import React from 'react';
3
3
  interface FunCheckoutHistoryDetailProps {
4
4
  checkoutHistoryInfo: CheckoutHistoryItem | undefined;
5
+ hideStatus?: boolean;
5
6
  onHelp: () => void;
6
7
  onClose: () => void;
7
8
  }
8
9
  /**
9
10
  * Processing info about a checkout history item (already created in backend)
10
11
  */
11
- export declare function FunCheckoutHistoryDetail({ checkoutHistoryInfo, onHelp, onClose, }: FunCheckoutHistoryDetailProps): React.JSX.Element;
12
+ export declare function FunCheckoutHistoryDetail({ checkoutHistoryInfo, hideStatus, onHelp, onClose, }: FunCheckoutHistoryDetailProps): React.JSX.Element;
12
13
  export {};
@@ -0,0 +1,26 @@
1
+ import React, { type ReactNode, type RefCallback } from 'react';
2
+ import type { Address } from 'viem';
3
+ /**
4
+ * Hook for sharing the logic for the custom status icon animation in checkout details. This is very
5
+ * much _not_ generic or intended to be reused anywhere, but the component itself is duplicated.
6
+ */
7
+ export declare function useCustomStatusAnimationAboveTopbar({ depositAddress, isCheckoutDetailView, paddingTop, topbar, withTopDivider, }: {
8
+ depositAddress: Address | undefined;
9
+ /** Whether status icon is currently shown */
10
+ isCheckoutDetailView: boolean;
11
+ /** Top padding of the scrolling container (required to set the correct position) */
12
+ paddingTop: number;
13
+ /** Modal topbar */
14
+ topbar: ReactNode;
15
+ /** Whether to show the topbar divider when _not_ in checkout detail view */
16
+ withTopDivider: 'always' | 'never' | 'scroll' | undefined;
17
+ }): {
18
+ /** To be passed to scrolling container, to sync the scroll position */
19
+ onScroll: React.UIEventHandler<HTMLElement>;
20
+ /** To be passed to scrolling container, to initialize the scroll position */
21
+ ref: RefCallback<HTMLElement>;
22
+ /** Modal topbar, to which a modulated-opacity background was added */
23
+ topbar: ReactNode;
24
+ /** Whether to show the topbar divider */
25
+ withTopDivider: 'always' | 'never' | 'scroll' | undefined;
26
+ };
@@ -11,9 +11,20 @@ export interface FunkitCheckoutActionParams {
11
11
  functionArgs: unknown[];
12
12
  value?: bigint;
13
13
  }
14
- export interface FunkitCheckoutConfig extends Omit<ApiFunkitCheckoutConfig, 'generateActionsParams' | 'customRecipient' | 'modalTitle' | 'iconSrc' | 'modalTitleMeta' | 'checkoutItemAmount' | 'externalCheckoutUserId'> {
14
+ export interface DynamicTargetAssetCandidate {
15
+ tokenAddress: Address;
16
+ tokenChainId: string;
17
+ iconSrc: string;
18
+ tokenSymbol: string;
19
+ isDefault?: boolean;
20
+ badgeText?: string;
21
+ }
22
+ export interface FunkitCheckoutConfig extends Omit<ApiFunkitCheckoutConfig, 'generateActionsParams' | 'customRecipient' | 'modalTitle' | 'iconSrc' | 'modalTitleMeta' | 'externalCheckoutUserId'> {
15
23
  /** List of contract action params **/
16
- generateActionsParams?: (targetAssetAmount: number) => FunkitCheckoutActionParams[];
24
+ generateActionsParams?: (targetAssetAmount: number, config?: {
25
+ targetAsset: Address;
26
+ targetChain: string;
27
+ }) => FunkitCheckoutActionParams[];
17
28
  /** Custom recipient address of the checkout. If specified, a different checkout flow will be executed. It is not recommended to set this unless the Fun.xyz team advises it. **/
18
29
  customRecipient?: FunAddress;
19
30
  /** ****************************************
@@ -27,13 +38,15 @@ export interface FunkitCheckoutConfig extends Omit<ApiFunkitCheckoutConfig, 'gen
27
38
  iconSrc?: null | string;
28
39
  /** Title of the item being checked out. e.g. Staked Ether, XYZ Option, Solar Bond ABC **/
29
40
  checkoutItemTitle: string;
30
- /** The quantity of the item being checked out. If not specified (0, null, undefined), it will default to blank. **/
41
+ /** @deprecated use targetAssetAmount **/
31
42
  checkoutItemAmount?: number;
32
43
  /** *****************************
33
44
  * Miscellaneous configurations *
34
45
  ********************************/
35
46
  /** User identification within customer's app for logging and customer dashboard purposes (future). **/
36
47
  externalCheckoutUserId?: string;
48
+ /** a list of candidate assets to be chosen dynamically */
49
+ dynamicTargetAssetCandidates?: DynamicTargetAssetCandidate[];
37
50
  }
38
51
  interface FunkitCheckoutValidationResult {
39
52
  isValid: boolean;
@@ -93,6 +106,12 @@ interface FunkitCheckoutContextInterface {
93
106
  initNewCheckout(initSettings: UseFunkitCheckoutPropsWithFullConfig): string;
94
107
  updateSourceAsset(selectedSource: Omit<AssetHoldingsItem, 'amount' | 'usdAmount' | 'chainSymbolKey'>): void;
95
108
  updateTargetAssetAmount(newTargetAssetAmount: number): void;
109
+ updateTargetAsset(asset: {
110
+ targetAsset: Address;
111
+ targetChain: string;
112
+ targetAssetTicker: string;
113
+ iconSrc: string | undefined;
114
+ }): void;
96
115
  updateSelectedPaymentMethodInfo(newPaymentMethodInfo: PaymentMethodInfo): void;
97
116
  confirmCheckout(shouldBatchOpBypassInit: boolean, quote: FunkitCheckoutQuoteResult, stepMessageSetter: (m: string) => void): Promise<Address>;
98
117
  cancelCheckout(depositAddress: Address): Promise<boolean>;
@@ -108,9 +127,13 @@ export declare function useCheckoutContext(): FunkitCheckoutContextInterface;
108
127
  * External hook for user to kickstart a checkout in their app
109
128
  */
110
129
  export declare function useFunkitCheckout(props: UseFunkitCheckoutPropsWithFullConfig): {
111
- beginCheckout: (config?: Partial<FunkitCheckoutConfig>) => Promise<void>;
130
+ beginCheckout: (config?: Partial<FunkitCheckoutConfig>) => Promise<{
131
+ isActivated: boolean;
132
+ }>;
112
133
  };
113
134
  export declare function useFunkitCheckout(props: UseFunkitCheckoutProps): {
114
- beginCheckout: (config: FunkitCheckoutConfig) => Promise<void>;
135
+ beginCheckout: (config: FunkitCheckoutConfig) => Promise<{
136
+ isActivated: boolean;
137
+ }>;
115
138
  };
116
139
  export {};
@@ -11,11 +11,11 @@ export interface FunkitTextCustomizationsConfig {
11
11
  receiveAmountLabel: string;
12
12
  };
13
13
  }
14
- export interface FunkitUiCustomRecipientConfig {
14
+ export interface FunkitUiDestinationConfig {
15
15
  /** What icon (15x15) to show in the `destination` row - defaults to user wallet icon */
16
- destinationIcon?: ReactNode;
16
+ icon?: ReactNode;
17
17
  /** What text to show in the `destination` row - defaults to formatted destination wallet address */
18
- destinationText?: string;
18
+ text?: string;
19
19
  }
20
20
  export interface FunkitUiCustomizationsConfig {
21
21
  confirmationScreen?: {
@@ -23,8 +23,8 @@ export interface FunkitUiCustomizationsConfig {
23
23
  showTokenAmount?: boolean;
24
24
  /** Whether to show the total payment amount in USD below the token amount equivalent. Defaults to false */
25
25
  showPaymentAmountUsd?: boolean;
26
- /** Configure UI when `customRecipient` is specified in the config */
27
- customRecipientConfig?: FunkitUiCustomRecipientConfig;
26
+ /** Custom destination icon and text used in checkout summary */
27
+ destinationConfig?: FunkitUiDestinationConfig;
28
28
  };
29
29
  inputAmountScreen?: {
30
30
  /** Whether to allow entering an amount of tokens, rather than only USD - defaults to true */
@@ -83,6 +83,9 @@ export declare const useActiveTheme: () => {
83
83
  buttonIconBackgroundHover: string;
84
84
  buttonIconBackgroundPressed: string;
85
85
  buttonIconStroke: string;
86
+ badgeBackgroundSuccess: string;
87
+ badgeBorderSuccess: string;
88
+ badgeTextSuccess: string;
86
89
  };
87
90
  fonts: {
88
91
  body: string;
@@ -123,6 +126,10 @@ export declare const useActiveTheme: () => {
123
126
  fontSize: string;
124
127
  lineHeight: string;
125
128
  };
129
+ '21': {
130
+ fontSize: string;
131
+ lineHeight: string;
132
+ };
126
133
  '40': {
127
134
  fontSize: string;
128
135
  lineHeight: string;
@@ -138,6 +145,8 @@ export declare const useActiveTheme: () => {
138
145
  menuButton: string;
139
146
  modal: string;
140
147
  modalMobile: string;
148
+ modalActionButton: string;
149
+ modalActionButtonMobile: string;
141
150
  };
142
151
  shadows: {
143
152
  connectButton: string;
@@ -216,6 +225,9 @@ export declare const useActiveTheme: () => {
216
225
  buttonIconBackgroundHover: string;
217
226
  buttonIconBackgroundPressed: string;
218
227
  buttonIconStroke: string;
228
+ badgeBackgroundSuccess: string;
229
+ badgeBorderSuccess: string;
230
+ badgeTextSuccess: string;
219
231
  };
220
232
  fonts: {
221
233
  body: string;
@@ -256,6 +268,10 @@ export declare const useActiveTheme: () => {
256
268
  fontSize: string;
257
269
  lineHeight: string;
258
270
  };
271
+ '21': {
272
+ fontSize: string;
273
+ lineHeight: string;
274
+ };
259
275
  '40': {
260
276
  fontSize: string;
261
277
  lineHeight: string;
@@ -271,6 +287,8 @@ export declare const useActiveTheme: () => {
271
287
  menuButton: string;
272
288
  modal: string;
273
289
  modalMobile: string;
290
+ modalActionButton: string;
291
+ modalActionButtonMobile: string;
274
292
  };
275
293
  shadows: {
276
294
  connectButton: string;
@@ -347,6 +365,9 @@ export declare const useActiveTheme: () => {
347
365
  buttonIconBackgroundHover: string;
348
366
  buttonIconBackgroundPressed: string;
349
367
  buttonIconStroke: string;
368
+ badgeBackgroundSuccess: string;
369
+ badgeBorderSuccess: string;
370
+ badgeTextSuccess: string;
350
371
  };
351
372
  fonts: {
352
373
  body: string;
@@ -387,6 +408,10 @@ export declare const useActiveTheme: () => {
387
408
  fontSize: string;
388
409
  lineHeight: string;
389
410
  };
411
+ '21': {
412
+ fontSize: string;
413
+ lineHeight: string;
414
+ };
390
415
  '40': {
391
416
  fontSize: string;
392
417
  lineHeight: string;
@@ -402,6 +427,8 @@ export declare const useActiveTheme: () => {
402
427
  menuButton: string;
403
428
  modal: string;
404
429
  modalMobile: string;
430
+ modalActionButton: string;
431
+ modalActionButtonMobile: string;
405
432
  };
406
433
  shadows: {
407
434
  connectButton: string;
@@ -2,6 +2,7 @@ import React, { type ReactNode } from 'react';
2
2
  export declare const ModalSizeOptions: {
3
3
  readonly COMPACT: "compact";
4
4
  readonly WIDE: "wide";
5
+ readonly MEDIUM: "medium";
5
6
  };
6
7
  export type ModalSizes = (typeof ModalSizeOptions)[keyof typeof ModalSizeOptions];
7
8
  export declare const ModalSizeContext: React.Context<ModalSizes>;
@@ -14,12 +14,13 @@ interface BaseThemeOptions {
14
14
  customFontWeights?: Partial<ThemeVars['fontWeight']>;
15
15
  customFontFamily?: string;
16
16
  customFontSizings?: Partial<ThemeVars['fontSize']>;
17
+ customBorderRadiuses?: Partial<ThemeVars['radii']>;
17
18
  fontSizing?: FontSizeType;
18
19
  borderRadius?: RadiusScale;
19
20
  fontStack?: FontStack;
20
21
  overlayBlur?: Blurs;
21
22
  }
22
- export declare const baseTheme: ({ borderRadius, fontStack, fontSizing, customFontFamily, customFontWeights, customFontSizings, overlayBlur, }: BaseThemeOptions) => Pick<ThemeVars, "radii" | "fonts" | "fontWeight" | "fontSize" | "blurs">;
23
+ export declare const baseTheme: ({ borderRadius, fontStack, fontSizing, customFontFamily, customFontWeights, customFontSizings, customBorderRadiuses, overlayBlur, }: BaseThemeOptions) => Pick<ThemeVars, "radii" | "fonts" | "fontWeight" | "fontSize" | "blurs">;
23
24
  export interface AccentColor {
24
25
  accentColor: string;
25
26
  accentColorForeground: string;
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  baseTheme,
4
4
  systemFontStack
5
- } from "../chunk-TKJVOYWW.js";
5
+ } from "../chunk-2LVAEHB2.js";
6
6
  export {
7
7
  baseTheme,
8
8
  systemFontStack
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  darkTheme
4
- } from "../chunk-C7BDNBKV.js";
5
- import "../chunk-TKJVOYWW.js";
4
+ } from "../chunk-ZQ7UHAVV.js";
5
+ import "../chunk-2LVAEHB2.js";
6
6
  export {
7
7
  darkTheme
8
8
  };
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  lightTheme
4
- } from "../chunk-QCYFMAKN.js";
5
- import "../chunk-TKJVOYWW.js";
4
+ } from "../chunk-7RFJFAFX.js";
5
+ import "../chunk-2LVAEHB2.js";
6
6
  export {
7
7
  lightTheme
8
8
  };
@@ -1,22 +1,7 @@
1
- import type { KnownAssetHoldingsItem } from '~/domains/wallet';
2
- import { LoginType } from '~/providers/GeneralWalletProvider';
3
- import { PaymentMethod } from '../domains/paymentMethods';
4
- import type { FunkitActiveCheckoutItem, FunkitCheckoutConfig } from '../providers/FunkitCheckoutContext';
5
- import type { FlagValues } from '../providers/FunkitFlagsProvider';
1
+ import type { FunkitCheckoutConfig } from '../providers/FunkitCheckoutContext';
6
2
  export type { AssetHoldingsItem, AssetHoldingsMap, KnownAssetHoldingsItem, } from '~/domains/wallet';
7
3
  export declare const ASSETS_LOW_VALUE_THRESHOLD = 0.1;
8
4
  export declare const getNormalizedTokenBalance: (tokenBalance: bigint | number | string, decimals: number) => number;
9
- export declare function getUsdAvailableAmount(targetChainId: string, assetChainId: string | undefined, assetUsdAmount: number | null | undefined, paymentMethod: PaymentMethod | undefined): number | null;
10
- export declare const isAssetUsableToPayForCheckout: (flags: FlagValues, checkoutItem: FunkitActiveCheckoutItem, paymentMethod: PaymentMethod, assetChainId: string, assetTokenAddress: string, assetUsdAmount: number | null, loginType: LoginType, isAllowedForCheckout: boolean) => {
11
- isUsable: boolean;
12
- reason: string;
13
- };
14
- export declare const L2_COST_MARGIN_MULTIPLIER = 1.2;
15
- type RecommendedAsset = {
16
- chainSymbolKey: string;
17
- label: string | null;
18
- };
19
- export declare const getRecommendedAsset: (checkoutItem: FunkitActiveCheckoutItem, accountHoldings: KnownAssetHoldingsItem[]) => RecommendedAsset | null;
20
5
  /**
21
6
  *
22
7
  * @param {FunkitCheckoutConfig} checkoutConfig
@@ -87,12 +87,17 @@ export declare function formatTokenAmountForMoonpay(amount: number, mpCurrencyCo
87
87
  export declare function getTimeFromNowSeconds(startTimeMs: number, durationMs: number): number;
88
88
  /**
89
89
  * Given a checkout config, returns the display string for the checkout item.
90
- * Arbitary action checkouts: Display the checkoutItemAmount if it is greater than 0, otherwise display the checkoutItemTitle.
90
+ * Arbitrary action checkouts: Display the targetAssetAmount
91
+ * - not 100% accurate since userOp will consume some tokens, but FINE now.
91
92
  * - e.g. "2.1234 aArbUSDCn" or "Staked VRTX"
92
93
  * Basic buy checkouts: Display the targetAssetAmount with the targetAssetTicker.
93
94
  * - e.g. "0.12345 ETH"
95
+ * Ideally, should be used via the hook `useCheckoutItemDisplay` to handle the customer cutomization check.
94
96
  */
95
- export declare function getCheckoutItemDisplay(checkoutConfig: FunkitCheckoutConfig | ServerCheckoutConfig, hideAmount?: boolean): string;
97
+ export declare function getCheckoutItemDisplay({ checkoutConfig, hideAmount, }: {
98
+ checkoutConfig: FunkitCheckoutConfig | ServerCheckoutConfig;
99
+ hideAmount?: boolean;
100
+ }): string;
96
101
  /**
97
102
  * Given the result of a quote, estimate the maximum targetAssetAmount for which the checkout should succeed.
98
103
  * The result is then reduced by 1% to further reduce the risk of insufficient funds.
@@ -0,0 +1 @@
1
+ export declare const MIN_CHECKOUT_AMOUNT_USD = 1;
@@ -61,21 +61,7 @@ export declare const flagConfig: {
61
61
  };
62
62
  enable_token_transfer_universal_deposit_address: {
63
63
  type: "boolean";
64
- default_value: false;
65
- overrides: {
66
- if_any: ({
67
- key: "userId";
68
- pct: number;
69
- type: "pctRollout";
70
- values?: undefined;
71
- } | {
72
- key: "userId";
73
- type: "isAnyOf";
74
- values: string[];
75
- pct?: undefined;
76
- })[];
77
- value: true;
78
- }[];
64
+ default_value: true;
79
65
  };
80
66
  max_checkout_usd: {
81
67
  type: "string";
@@ -112,4 +98,12 @@ export declare const flagConfig: {
112
98
  value: string;
113
99
  }[];
114
100
  };
101
+ token_transfer_default_chain_id: {
102
+ type: "string";
103
+ default_value: string;
104
+ };
105
+ is_checkout_activated: {
106
+ type: "boolean";
107
+ default_value: true;
108
+ };
115
109
  };
@@ -1,28 +1,25 @@
1
1
  "use client";
2
+ import {
3
+ walletConnectWallet
4
+ } from "./chunk-NP5QGWNL.js";
2
5
  import {
3
6
  zerionWallet
4
7
  } from "./chunk-AXWP3GD4.js";
5
8
  import {
6
9
  zealWallet
7
10
  } from "./chunk-JROWU5BP.js";
8
- import {
9
- xdefiWallet
10
- } from "./chunk-NO7XMBB5.js";
11
- import {
12
- tahoWallet
13
- } from "./chunk-6P2EMPZI.js";
14
11
  import {
15
12
  talismanWallet
16
13
  } from "./chunk-ABFSXBE6.js";
17
14
  import {
18
- tokenaryWallet
19
- } from "./chunk-SLOIIJGP.js";
15
+ safepalWallet
16
+ } from "./chunk-MSFKSQBY.js";
20
17
  import {
21
18
  tokenPocketWallet
22
19
  } from "./chunk-IDKVN5CF.js";
23
20
  import {
24
- safepalWallet
25
- } from "./chunk-MSFKSQBY.js";
21
+ tokenaryWallet
22
+ } from "./chunk-SLOIIJGP.js";
26
23
  import {
27
24
  trustWallet
28
25
  } from "./chunk-ISIBREBO.js";
@@ -30,23 +27,26 @@ import {
30
27
  uniswapWallet
31
28
  } from "./chunk-LH7BMNFZ.js";
32
29
  import {
33
- walletConnectWallet
34
- } from "./chunk-NP5QGWNL.js";
30
+ xdefiWallet
31
+ } from "./chunk-NO7XMBB5.js";
32
+ import {
33
+ tahoWallet
34
+ } from "./chunk-6P2EMPZI.js";
35
35
  import {
36
36
  phantomWallet
37
37
  } from "./chunk-ZSVTX6EK.js";
38
- import {
39
- rabbyWallet
40
- } from "./chunk-BVX4XGNP.js";
41
38
  import {
42
39
  ramperWallet
43
40
  } from "./chunk-PIUNLQJG.js";
44
41
  import {
45
- okxWallet
46
- } from "./chunk-4WEHDI4Y.js";
42
+ rabbyWallet
43
+ } from "./chunk-BVX4XGNP.js";
47
44
  import {
48
45
  roninWallet
49
46
  } from "./chunk-63YLN6R5.js";
47
+ import {
48
+ rainbowWallet
49
+ } from "./chunk-2UCNRD7H.js";
50
50
  import {
51
51
  safeWallet
52
52
  } from "./chunk-BQQQL6UD.js";
@@ -59,9 +59,6 @@ import {
59
59
  import {
60
60
  metaMaskWallet
61
61
  } from "./chunk-G73C6P5P.js";
62
- import {
63
- imTokenWallet
64
- } from "./chunk-COZ7MIQS.js";
65
62
  import {
66
63
  mewWallet
67
64
  } from "./chunk-V57WLZEE.js";
@@ -71,72 +68,75 @@ import {
71
68
  import {
72
69
  oneInchWallet
73
70
  } from "./chunk-OESTDX6I.js";
71
+ import {
72
+ oneKeyWallet
73
+ } from "./chunk-4AD7VI2P.js";
74
74
  import {
75
75
  omniWallet
76
76
  } from "./chunk-7CUY5G6R.js";
77
77
  import {
78
- oneKeyWallet
79
- } from "./chunk-4AD7VI2P.js";
78
+ okxWallet
79
+ } from "./chunk-4WEHDI4Y.js";
80
80
  import {
81
- rainbowWallet
82
- } from "./chunk-2UCNRD7H.js";
81
+ ledgerWallet
82
+ } from "./chunk-BRBKM4PW.js";
83
83
  import {
84
- frontierWallet
85
- } from "./chunk-3S2U24BJ.js";
84
+ foxWallet
85
+ } from "./chunk-LMZMXEXL.js";
86
86
  import {
87
87
  frameWallet
88
88
  } from "./chunk-ZMYVTWDF.js";
89
89
  import {
90
- gateWallet
91
- } from "./chunk-GSOYKKIS.js";
90
+ frontierWallet
91
+ } from "./chunk-3S2U24BJ.js";
92
92
  import {
93
93
  injectedWallet
94
94
  } from "./chunk-VCVVV2K7.js";
95
95
  import {
96
- ledgerWallet
97
- } from "./chunk-BRBKM4PW.js";
96
+ gateWallet
97
+ } from "./chunk-GSOYKKIS.js";
98
98
  import {
99
99
  kresusWallet
100
100
  } from "./chunk-MJXPRJZT.js";
101
101
  import {
102
- coreWallet
103
- } from "./chunk-HBA36GW3.js";
102
+ imTokenWallet
103
+ } from "./chunk-COZ7MIQS.js";
104
104
  import {
105
105
  bybitWallet
106
106
  } from "./chunk-6ONTSPEY.js";
107
107
  import {
108
108
  clvWallet
109
109
  } from "./chunk-KR6JBW5E.js";
110
- import {
111
- coin98Wallet
112
- } from "./chunk-DTRYS3MO.js";
113
110
  import {
114
111
  coinbaseWallet
115
112
  } from "./chunk-H4IRCEZN.js";
116
113
  import {
117
114
  dawnWallet
118
115
  } from "./chunk-LN7OD5EC.js";
116
+ import {
117
+ coreWallet
118
+ } from "./chunk-HBA36GW3.js";
119
119
  import {
120
120
  desigWallet
121
121
  } from "./chunk-CTU6JCOK.js";
122
+ import {
123
+ coin98Wallet
124
+ } from "./chunk-DTRYS3MO.js";
122
125
  import {
123
126
  enkryptWallet
124
127
  } from "./chunk-SJTXS4ZW.js";
125
- import {
126
- foxWallet
127
- } from "./chunk-LMZMXEXL.js";
128
128
  import {
129
129
  argentWallet
130
130
  } from "./chunk-WSQ2YJO2.js";
131
- import {
132
- bifrostWallet
133
- } from "./chunk-W6N74MS3.js";
134
131
  import {
135
132
  bitgetWallet
136
133
  } from "./chunk-A5APNTGL.js";
137
134
  import {
138
135
  bitskiWallet
139
136
  } from "./chunk-P74YPRF6.js";
137
+ import {
138
+ bifrostWallet
139
+ } from "./chunk-W6N74MS3.js";
140
140
  import {
141
141
  bitverseWallet
142
142
  } from "./chunk-3HZRRP4Y.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/connect",
3
- "version": "4.1.7",
3
+ "version": "5.0.0",
4
4
  "description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
5
5
  "files": [
6
6
  "dist",
@@ -88,11 +88,11 @@
88
88
  "react-virtuoso": "4.10.1",
89
89
  "ua-parser-js": "^1.0.37",
90
90
  "uuid": "^9.0.1",
91
- "@funkit/api-base": "1.5.3",
92
- "@funkit/wagmi-tools": "3.0.26",
93
91
  "@funkit/chains": "0.1.2",
94
- "@funkit/utils": "1.0.5",
95
- "@funkit/core": "2.3.4"
92
+ "@funkit/api-base": "1.5.4",
93
+ "@funkit/core": "2.3.5",
94
+ "@funkit/wagmi-tools": "3.0.27",
95
+ "@funkit/utils": "1.0.6"
96
96
  },
97
97
  "repository": {
98
98
  "type": "git",
@@ -1,7 +0,0 @@
1
- "use client";
2
-
3
- // src/components/Icons/Arc.svg
4
- var Arc_default = 'data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" viewBox="0 0 78 78"><defs><path id="a" fill="%231A007F" fill-rule="evenodd" d="m26.722 56.452 6.608-13.904c-5.047-1.073-10.126-4.195-12.999-7.993l-6.91 14.529a39.3 39.3 0 0 0 13.3 7.368Z" clip-rule="evenodd"/><path id="b" fill="%234E000A" fill-rule="evenodd" d="M54.304 34.138c-3.32 4.07-7.931 7.087-12.864 8.263l6.588 13.863c4.809-1.623 9.304-4.245 13.185-7.608l-6.91-14.518Z" clip-rule="evenodd"/><path id="c" fill="%231A007F" fill-rule="evenodd" d="m13.422 49.084-3.455 7.265c-1.76 3.694-.437 8.242 3.184 10.167 3.84 2.04 8.566.448 10.419-3.434l3.152-6.63a39.4 39.4 0 0 1-13.3-7.368" clip-rule="evenodd"/><path id="d" fill="%23FF9396" fill-rule="evenodd" d="M68.02 18.277a7.586 7.586 0 0 0-8.93 5.952c-.729 3.642-2.436 7.035-4.787 9.92l6.9 14.528c6.369-5.527 11.074-13.052 12.759-21.471.823-4.122-1.842-8.117-5.943-8.93" clip-rule="evenodd"/><path id="e" fill="%23002DC8" fill-rule="evenodd" d="M41.438 42.403a19.3 19.3 0 0 1-4.496.54 17.3 17.3 0 0 1-3.61-.395c-5.048-1.072-10.128-4.194-13-7.993-.718-.947-1.301-1.936-1.706-2.945-1.572-3.882-5.996-5.756-9.878-4.195-3.881 1.572-5.755 5.995-4.194 9.877 1.78 4.414 4.923 8.462 8.867 11.791a39.4 39.4 0 0 0 13.291 7.37c3.341 1.071 6.807 1.665 10.22 1.665 3.788 0 7.525-.656 11.084-1.853z" clip-rule="evenodd"/><path id="f" fill="%23FF536A" fill-rule="evenodd" d="m64.846 56.316-3.643-7.66-6.9-14.518-.011.01s0-.01.011-.01L44.27 13.032a7.59 7.59 0 0 0-6.848-4.33 7.59 7.59 0 0 0-6.848 4.33L20.343 34.554c2.872 3.799 7.95 6.921 12.999 7.993l3.309-6.952a.866.866 0 0 1 1.561 0l3.238 6.806h.02-.02l6.588 13.863 3.236 6.807a7.58 7.58 0 0 0 6.858 4.33 7.4 7.4 0 0 0 2.02-.281c4.569-1.26 6.734-6.515 4.694-10.804" clip-rule="evenodd"/></defs><path fill="%23000" fill-rule="evenodd" d="M37.422 8.702a7.59 7.59 0 0 1 6.848 4.33l10.033 21.107s0 .01-.011.01c0 0 0-.011.01-.011 2.353-2.883 4.06-6.276 4.788-9.919.822-4.11 4.818-6.764 8.93-5.952a7.585 7.585 0 0 1 5.953 8.93c-1.686 8.419-6.39 15.944-12.76 21.47l3.643 7.66c2.019 4.246-.094 9.44-4.57 10.771l-.135.043a7.5 7.5 0 0 1-2.019.28 7.6 7.6 0 0 1-6.858-4.33l-3.238-6.805-6.587-13.863h.022-.022l-3.237-6.807a.865.865 0 0 0-1.56 0l-3.31 6.952c-5.048-1.07-10.127-4.194-13-7.993l10.231-21.523a7.55 7.55 0 0 1 6.848-4.35ZM8.749 27.414a7.58 7.58 0 0 1 9.876 4.195c.407 1.01.99 1.998 1.707 2.945l.01.011.344.436c.032.042.063.074.094.116l.093.114c.053.052.094.115.146.166.01.01.021.022.021.032l-.02-.032c.197.24.415.468.634.699.01.009.01.02.02.02a20 20 0 0 0 2.385 2.112c.405.313.822.603 1.248.895.042.021.073.052.115.074 2.404 1.58 5.162 2.767 7.91 3.35 1.165.25 2.33.386 3.465.396h.146c1.509 0 3.018-.188 4.495-.542l6.589 13.863c-3.56 1.198-7.296 1.853-11.084 1.853-3.414 0-6.869-.593-10.22-1.665l-3.154 6.63a7.583 7.583 0 0 1-10.418 3.434C9.53 64.59 8.207 60.053 9.967 56.348l3.455-7.264c-3.903-3.3-7.015-7.307-8.815-11.657l-.052-.135c-1.56-3.883.312-8.305 4.194-9.878" clip-rule="evenodd"/><path fill="%23fff" fill-rule="evenodd" stroke="%23fff" stroke-linecap="round" stroke-linejoin="round" stroke-width="6.021" d="M37.422 8.702a7.59 7.59 0 0 1 6.848 4.33l10.033 21.107s0 .01-.011.01c0 0 0-.011.01-.011 2.353-2.883 4.06-6.276 4.788-9.919.822-4.11 4.818-6.764 8.93-5.952a7.585 7.585 0 0 1 5.953 8.93c-1.686 8.419-6.39 15.944-12.76 21.47l3.643 7.66c2.019 4.246-.094 9.44-4.57 10.771l-.135.043a7.5 7.5 0 0 1-2.019.28 7.6 7.6 0 0 1-6.858-4.33l-3.238-6.805-6.587-13.863h.022-.022l-3.237-6.807a.865.865 0 0 0-1.56 0l-3.31 6.952c-5.048-1.07-10.127-4.194-13-7.993l10.231-21.523a7.55 7.55 0 0 1 6.848-4.35h0ZM8.749 27.414a7.58 7.58 0 0 1 9.876 4.195c.407 1.01.99 1.998 1.707 2.945l.01.011.344.436c.032.042.063.074.094.116l.093.114c.053.052.094.115.146.166.01.01.021.022.021.032l-.02-.032c.197.24.415.468.634.699.01.009.01.02.02.02a20 20 0 0 0 2.385 2.112c.405.313.822.603 1.248.895.042.021.073.052.115.074 2.404 1.58 5.162 2.767 7.91 3.35 1.165.25 2.33.386 3.465.396h.146c1.509 0 3.018-.188 4.495-.542l6.589 13.863c-3.56 1.198-7.296 1.853-11.084 1.853-3.414 0-6.869-.593-10.22-1.665l-3.154 6.63a7.583 7.583 0 0 1-10.418 3.434C9.53 64.59 8.207 60.053 9.967 56.348l3.455-7.264c-3.903-3.3-7.015-7.307-8.815-11.657l-.052-.135c-1.56-3.883.312-8.305 4.194-9.878" clip-rule="evenodd"/><use xlink:href="%23a" fill-rule="evenodd" clip-rule="evenodd"/><use xlink:href="%23b" fill-rule="evenodd" clip-rule="evenodd"/><use xlink:href="%23c" fill-rule="evenodd" clip-rule="evenodd"/><use xlink:href="%23d" fill-rule="evenodd" clip-rule="evenodd"/><use xlink:href="%23e" fill-rule="evenodd" clip-rule="evenodd"/><use xlink:href="%23f" fill-rule="evenodd" clip-rule="evenodd"/><use xlink:href="%23a" fill-rule="evenodd" clip-rule="evenodd"/><use xlink:href="%23b" fill-rule="evenodd" clip-rule="evenodd"/><use xlink:href="%23c" fill-rule="evenodd" clip-rule="evenodd"/><use xlink:href="%23d" fill-rule="evenodd" clip-rule="evenodd"/><use xlink:href="%23e" fill-rule="evenodd" clip-rule="evenodd"/><use xlink:href="%23f" fill-rule="evenodd" clip-rule="evenodd"/></svg>';
5
- export {
6
- Arc_default as default
7
- };