@funkit/connect 5.5.7 → 5.5.10

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.
@@ -1,9 +1,12 @@
1
1
  import React from 'react';
2
+ export declare const USD_AMOUNT_OPTIONS_PCT: number[];
2
3
  interface QuickOptionsProps {
4
+ currency?: string;
5
+ disabled?: boolean;
3
6
  onSelect?: (percentage: number) => void;
7
+ options?: number[];
4
8
  percentMode?: boolean;
5
- disabled?: boolean;
6
- currency?: string;
7
9
  }
8
- export declare const QuickOptions: ({ onSelect, percentMode, disabled, currency, }: QuickOptionsProps) => React.JSX.Element[];
10
+ export declare function useFiatAmountOptions(currency: string): number[];
11
+ export declare const QuickOptions: ({ currency, disabled, onSelect, options, percentMode, }: QuickOptionsProps) => React.JSX.Element[] | undefined;
9
12
  export {};
@@ -1,4 +1,4 @@
1
- import type { PaymentMethod } from '~/domains/paymentMethods';
1
+ import { PaymentMethod } from '~/domains/paymentMethods';
2
2
  import type { AssetHoldingsItem } from '~/utils/assets';
3
3
  import type { FunkitCheckoutConfig } from '../../../providers/FunkitCheckoutContext';
4
4
  export interface AmountInputInitOptions {
@@ -16,16 +16,20 @@ export interface AmountInputInitOptions {
16
16
  minUsd?: number;
17
17
  /** Currency code for the currently selected fiat currency. Defaults to USD */
18
18
  fiatCurrency?: string;
19
+ /** Quick options, in fiat (not %) */
20
+ quickOptions?: number[];
19
21
  }
20
22
  export interface AmountInputState {
21
23
  /** Current amount, in target asset */
22
24
  assetAmount: number;
23
- /** Current input value (with leading $ if in USD) */
25
+ /** Current amount, in fiat */
26
+ fiatAmount: number;
27
+ /** Fiat currency */
28
+ fiatCurrency: string;
29
+ /** Current input value (with leading currency symbol if in fiat) */
24
30
  inputValue: string;
25
- /** Whether the input is currently in USD */
26
- isInputInUsd: boolean;
27
- /** Current amount, in USD */
28
- usdAmount: number;
31
+ /** Whether the input is currently in fiat */
32
+ isInputInFiat: boolean;
29
33
  /** Estimated available amount, in USD (defaults to unlimited) */
30
34
  usdAvailableAmount: number | null;
31
35
  /** Maximum amount, in USD (defaults to unlimited) */
@@ -39,24 +43,22 @@ export interface AmountInputDerivedState extends AmountInputState {
39
43
  isValid: boolean;
40
44
  }
41
45
  export type AmountInputAction = {
42
- /** Switches between USD and absolute input mode */
43
- type: 'toggleInputInUsd';
44
- } | {
45
- /** Changes formatting to new currency code */
46
- type: 'changeFiatCurrency';
47
- fiatCurrency: string;
46
+ /** Switches between fiat and crypto input mode */
47
+ type: 'toggleInputInFiat';
48
48
  } | {
49
49
  /** Sets the input value as string */
50
50
  type: 'setInputValue';
51
51
  inputValue: string;
52
52
  unitPrice: number;
53
- fiatCurrency: string;
54
53
  } | {
55
- /** Sets the input value as USD amount */
56
- type: 'setUsdAmount';
54
+ /** Sets the input value as fiat amount */
55
+ type: 'setFiatAmount';
56
+ fiatAmount: number;
57
57
  unitPrice: number;
58
+ } | {
59
+ /** Changes formatting to new currency code */
60
+ type: 'setFiatCurrency';
58
61
  fiatCurrency: string;
59
- usdAmount: number;
60
62
  };
61
63
  export type AmountInputError = {
62
64
  /** Current amount is above available balance */
@@ -77,6 +79,6 @@ export type AmountInputError = {
77
79
  /** Input is empty */
78
80
  type: 'noInput';
79
81
  };
80
- export declare function initializeState({ apiKey, checkoutConfig, maxUsd, minUsd, paymentMethod, sourceHolding, unitPrice, defaultAmount, fiatCurrency, }: AmountInputInitOptions): AmountInputState;
82
+ export declare function initializeState({ apiKey, checkoutConfig, maxUsd, minUsd, paymentMethod, sourceHolding, unitPrice, defaultAmount, fiatCurrency, quickOptions, }: AmountInputInitOptions): AmountInputState;
81
83
  export declare function reduceState(state: AmountInputState, action: AmountInputAction): AmountInputState;
82
84
  export declare function getDerivedState(state: AmountInputState): AmountInputDerivedState;
@@ -2,11 +2,11 @@ import { type AmountInputDerivedState, type AmountInputInitOptions } from './sta
2
2
  import { type InputAmountSuggestion } from './utils';
3
3
  interface UseAmountInputResult extends AmountInputDerivedState {
4
4
  onChange(event: React.ChangeEvent<HTMLInputElement>): void;
5
- toggleInputInUsd: () => void;
6
- setUsdAmount(usdAmount: number): AmountInputDerivedState;
7
5
  placeholder: string;
6
+ setFiatAmount(usdAmount: number): AmountInputDerivedState;
8
7
  /** Possible user action to recover from the current error */
9
8
  suggestion: InputAmountSuggestion | undefined;
9
+ toggleInputInFiat: () => void;
10
10
  }
11
11
  export declare function useAmountInput(options: AmountInputInitOptions): UseAmountInputResult;
12
12
  export {};
@@ -4,6 +4,7 @@ import type { AmountInputError } from './state';
4
4
  export declare const ASSET_DECIMALS = 5;
5
5
  export declare const USD_DECIMALS = 2;
6
6
  export declare const USD_INITIAL_AMOUNT = 100;
7
+ export declare function getDefaultAmountFromQuickOptions(quickOptions: number[] | undefined): number | undefined;
7
8
  export declare function getUsdMaxAmount(maxUsd: number): number | null;
8
9
  export declare function getUsdMinAmount(paymentMethod: PaymentMethod, defaultMin?: number): number;
9
10
  export interface InputAmountSuggestion {
@@ -3,12 +3,10 @@ import type { PaymentMethodCardInfo } from '~/domains/paymentMethods';
3
3
  import { type CheckoutModalCommonState, FunCheckoutStep, type ModalStepComponentProps, type ModalStepInfo } from '../stepTransition';
4
4
  export type MeldCurrencySelectState = CheckoutModalCommonState & {
5
5
  defaultCurrency: string;
6
- fiatAmount: number;
7
6
  paymentMethodInfo: PaymentMethodCardInfo;
8
7
  };
9
8
  export type MeldCurrencySelectNext = {
10
9
  currency: string;
11
- fiatAmount: number;
12
10
  };
13
11
  export declare const MeldCurrencySelectInfo: ModalStepInfo<FunCheckoutStep.MELD_CURRENCY_SELECT>;
14
12
  export declare function MeldCurrencySelect({ modalState, onNext, }: ModalStepComponentProps<FunCheckoutStep.MELD_CURRENCY_SELECT>): React.JSX.Element;
@@ -255,44 +255,21 @@ export declare const flagConfig: {
255
255
  enable_meld_payment: {
256
256
  type: "boolean";
257
257
  default_value: false;
258
- overrides: ({
259
- if_any: {
260
- key: "userId";
261
- type: "isAnyOf";
262
- values: string[];
263
- }[];
264
- value: true;
265
- if_all?: undefined;
266
- } | {
267
- if_all: ({
268
- key: "userId";
269
- type: "pctRollout";
270
- pct: number;
271
- values?: undefined;
272
- } | {
273
- key: "apiKey";
274
- type: "isAnyOf";
275
- values: string[];
276
- pct?: undefined;
277
- })[];
278
- if_any: {
279
- key: "userId";
280
- type: "pctRollout";
281
- pct: number;
282
- }[];
283
- value: true;
284
- } | {
258
+ overrides: {
285
259
  if_any: {
286
260
  key: "userId";
287
261
  type: "pctRollout";
288
262
  pct: number;
289
263
  }[];
290
264
  value: false;
291
- if_all?: undefined;
292
- })[];
265
+ }[];
293
266
  };
294
267
  meld_quick_options: {
295
268
  type: "string";
296
269
  default_value: string;
297
270
  };
271
+ min_token_transfer_value: {
272
+ type: "string";
273
+ default_value: string;
274
+ };
298
275
  };
@@ -3,77 +3,77 @@ import {
3
3
  xdefiWallet
4
4
  } from "./chunk-NO7XMBB5.js";
5
5
  import {
6
- walletConnectWallet
7
- } from "./chunk-NP5QGWNL.js";
6
+ zealWallet
7
+ } from "./chunk-JROWU5BP.js";
8
8
  import {
9
9
  zerionWallet
10
10
  } from "./chunk-ETTNDQQG.js";
11
- import {
12
- subWallet
13
- } from "./chunk-4UM4GTKZ.js";
14
11
  import {
15
12
  tahoWallet
16
13
  } from "./chunk-6P2EMPZI.js";
17
14
  import {
18
- talismanWallet
19
- } from "./chunk-ABFSXBE6.js";
15
+ safeheronWallet
16
+ } from "./chunk-R6RWZRFF.js";
17
+ import {
18
+ subWallet
19
+ } from "./chunk-4UM4GTKZ.js";
20
+ import {
21
+ tokenPocketWallet
22
+ } from "./chunk-FRGSRLTS.js";
20
23
  import {
21
24
  tokenaryWallet
22
25
  } from "./chunk-SLOIIJGP.js";
23
26
  import {
24
27
  trustWallet
25
28
  } from "./chunk-IPOC2VJX.js";
26
- import {
27
- tokenPocketWallet
28
- } from "./chunk-FRGSRLTS.js";
29
29
  import {
30
30
  uniswapWallet
31
31
  } from "./chunk-LH7BMNFZ.js";
32
32
  import {
33
- zealWallet
34
- } from "./chunk-JROWU5BP.js";
33
+ walletConnectWallet
34
+ } from "./chunk-NP5QGWNL.js";
35
35
  import {
36
36
  phantomWallet
37
37
  } from "./chunk-ZSVTX6EK.js";
38
- import {
39
- ramperWallet
40
- } from "./chunk-PIUNLQJG.js";
41
- import {
42
- roninWallet
43
- } from "./chunk-25VW5TZP.js";
44
38
  import {
45
39
  rainbowWallet
46
40
  } from "./chunk-MOOBCMMB.js";
41
+ import {
42
+ ramperWallet
43
+ } from "./chunk-PIUNLQJG.js";
47
44
  import {
48
45
  rabbyWallet
49
46
  } from "./chunk-BVX4XGNP.js";
47
+ import {
48
+ roninWallet
49
+ } from "./chunk-25VW5TZP.js";
50
50
  import {
51
51
  safeWallet
52
52
  } from "./chunk-BQQQL6UD.js";
53
- import {
54
- safeheronWallet
55
- } from "./chunk-R6RWZRFF.js";
56
53
  import {
57
54
  safepalWallet
58
55
  } from "./chunk-6LPM6LUQ.js";
59
56
  import {
60
- imTokenWallet
61
- } from "./chunk-COZ7MIQS.js";
62
- import {
63
- mewWallet
64
- } from "./chunk-V57WLZEE.js";
57
+ talismanWallet
58
+ } from "./chunk-ABFSXBE6.js";
65
59
  import {
66
60
  ledgerWallet
67
61
  } from "./chunk-BRBKM4PW.js";
62
+ import {
63
+ metaMaskWallet
64
+ } from "./chunk-N2NIIUW6.js";
65
+ import {
66
+ mewWallet
67
+ } from "./chunk-V57WLZEE.js";
68
68
  import {
69
69
  oktoWallet
70
70
  } from "./chunk-ADIXAKUL.js";
71
- import {
72
- omniWallet
73
- } from "./chunk-7CUY5G6R.js";
74
71
  import {
75
72
  okxWallet
76
73
  } from "./chunk-3U3BMEH5.js";
74
+ import {
75
+ omniWallet
76
+ } from "./chunk-7CUY5G6R.js";
77
77
  import {
78
78
  oneInchWallet
79
79
  } from "./chunk-OESTDX6I.js";
@@ -81,50 +81,50 @@ import {
81
81
  oneKeyWallet
82
82
  } from "./chunk-4AD7VI2P.js";
83
83
  import {
84
- foxWallet
85
- } from "./chunk-XYBEMO3C.js";
86
- import {
87
- frameWallet
88
- } from "./chunk-ZMYVTWDF.js";
84
+ enkryptWallet
85
+ } from "./chunk-SJTXS4ZW.js";
89
86
  import {
90
87
  frontierWallet
91
88
  } from "./chunk-HKV7EMYZ.js";
89
+ import {
90
+ desigWallet
91
+ } from "./chunk-CTU6JCOK.js";
92
92
  import {
93
93
  gateWallet
94
94
  } from "./chunk-3NC26XLM.js";
95
95
  import {
96
- injectedWallet
97
- } from "./chunk-VCVVV2K7.js";
96
+ imTokenWallet
97
+ } from "./chunk-COZ7MIQS.js";
98
98
  import {
99
99
  kresusWallet
100
100
  } from "./chunk-MJXPRJZT.js";
101
101
  import {
102
- metaMaskWallet
103
- } from "./chunk-N2NIIUW6.js";
104
- import {
105
- bybitWallet
106
- } from "./chunk-W5O4YSZN.js";
102
+ injectedWallet
103
+ } from "./chunk-VCVVV2K7.js";
107
104
  import {
108
- coinbaseWallet
109
- } from "./chunk-H4IRCEZN.js";
105
+ clvWallet
106
+ } from "./chunk-LEXSM5KI.js";
110
107
  import {
111
108
  coin98Wallet
112
109
  } from "./chunk-KFFJPS5R.js";
113
110
  import {
114
- clvWallet
115
- } from "./chunk-LEXSM5KI.js";
111
+ braveWallet
112
+ } from "./chunk-PB254NQ4.js";
113
+ import {
114
+ coreWallet
115
+ } from "./chunk-JXP2QPW7.js";
116
116
  import {
117
117
  dawnWallet
118
118
  } from "./chunk-LN7OD5EC.js";
119
119
  import {
120
- coreWallet
121
- } from "./chunk-JXP2QPW7.js";
120
+ coinbaseWallet
121
+ } from "./chunk-H4IRCEZN.js";
122
122
  import {
123
- desigWallet
124
- } from "./chunk-CTU6JCOK.js";
123
+ foxWallet
124
+ } from "./chunk-XYBEMO3C.js";
125
125
  import {
126
- enkryptWallet
127
- } from "./chunk-SJTXS4ZW.js";
126
+ frameWallet
127
+ } from "./chunk-ZMYVTWDF.js";
128
128
  import {
129
129
  argentWallet
130
130
  } from "./chunk-WSQ2YJO2.js";
@@ -140,13 +140,13 @@ import {
140
140
  import {
141
141
  bitverseWallet
142
142
  } from "./chunk-3HZRRP4Y.js";
143
- import {
144
- braveWallet
145
- } from "./chunk-PB254NQ4.js";
146
- import "./chunk-WRA2DVJ7.js";
147
143
  import {
148
144
  bloomWallet
149
145
  } from "./chunk-S27IADFU.js";
146
+ import {
147
+ bybitWallet
148
+ } from "./chunk-W5O4YSZN.js";
149
+ import "./chunk-WRA2DVJ7.js";
150
150
  import "./chunk-23WIEY36.js";
151
151
  export {
152
152
  argentWallet,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funkit/connect",
3
- "version": "5.5.7",
3
+ "version": "5.5.10",
4
4
  "description": "Funkit Connect SDK elevates DeFi apps via web2 sign-ins and one-click checkouts.",
5
5
  "files": [
6
6
  "dist",
@@ -45,16 +45,11 @@
45
45
  },
46
46
  "devDependencies": {
47
47
  "@aws-sdk/client-cloudfront": "3.645.0",
48
- "@aws-sdk/client-s3": "3.645.0",
49
- "@chromatic-com/storybook": "^3.2.6",
48
+ "@aws-sdk/client-s3": "3.840.0",
49
+ "@chromatic-com/storybook": "^4.0.1",
50
50
  "@meshconnect/node-api": "2.0.14",
51
- "@storybook/addon-essentials": "^8.6.7",
52
- "@storybook/addon-interactions": "^8.6.7",
53
- "@storybook/addon-links": "^8.6.7",
54
- "@storybook/blocks": "^8.6.7",
55
- "@storybook/react": "^8.6.7",
56
- "@storybook/react-vite": "^8.6.7",
57
- "@storybook/test": "^8.6.7",
51
+ "@storybook/addon-links": "^9.0.15",
52
+ "@storybook/react-vite": "^9.0.15",
58
53
  "@testing-library/jest-dom": "^6.2.0",
59
54
  "@testing-library/react": "^16.0.1",
60
55
  "@testing-library/user-event": "^14.5.2",
@@ -68,9 +63,10 @@
68
63
  "jsdom": "^26.1.0",
69
64
  "postcss": "^8.4.33",
70
65
  "react": "^18.3.0",
71
- "storybook": "^8.6.7",
66
+ "storybook": "^9.0.15",
72
67
  "tsx": "^4.19.2",
73
- "vitest": "^3.0.9"
68
+ "vitest": "^3.0.9",
69
+ "@storybook/addon-docs": "^9.0.15"
74
70
  },
75
71
  "dependencies": {
76
72
  "@datadog/browser-logs": "5.22.0",
@@ -92,12 +88,12 @@
92
88
  "ua-parser-js": "^1.0.37",
93
89
  "use-debounce": "^10.0.5",
94
90
  "uuid": "^9.0.1",
95
- "@funkit/api-base": "1.9.3",
96
- "@funkit/core": "2.3.25",
91
+ "@funkit/api-base": "1.9.4",
92
+ "@funkit/core": "2.3.26",
93
+ "@funkit/wagmi-tools": "3.0.48",
94
+ "@funkit/utils": "1.1.3",
97
95
  "@funkit/chains": "0.3.1",
98
- "@funkit/wagmi-tools": "3.0.47",
99
- "@funkit/fun-relay": "0.1.7",
100
- "@funkit/utils": "1.1.2"
96
+ "@funkit/fun-relay": "0.1.7"
101
97
  },
102
98
  "repository": {
103
99
  "type": "git",