@funkit/connect 12.12.0 → 12.13.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 (33) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/dist/clients/{chunk-GPI6LBBB.js → chunk-5GX6G7JR.js} +1 -1
  3. package/dist/clients/{chunk-PK7BKCPR.js → chunk-I75AI3N7.js} +2 -2
  4. package/dist/clients/{chunk-JN52EBYV.js → chunk-P6UM36G5.js} +64 -0
  5. package/dist/clients/{chunk-RBMOSICG.js → chunk-YMBIRJQF.js} +1 -1
  6. package/dist/clients/{chunk-WXHSEFYH.js → chunk-ZOQQL2QX.js} +1 -1
  7. package/dist/clients/fanatics.js +2 -2
  8. package/dist/clients/internal/nado/withdrawalCallback.js +3 -3
  9. package/dist/clients/internal/nado/withdrawalErrors.js +2 -2
  10. package/dist/clients/internal/nado/withdrawalForm.js +3 -3
  11. package/dist/clients/internal/nado/withdrawalStatus.js +3 -3
  12. package/dist/clients/lighter.js +3 -3
  13. package/dist/clients/mallard.js +2 -2
  14. package/dist/clients/nado.js +3 -3
  15. package/dist/components/FunTransactionSummary/PaymentFeesSummary.d.ts +6 -1
  16. package/dist/components/LargeAmountInput/LargeAmountInput.css.d.ts +8 -0
  17. package/dist/components/LargeAmountInput/LargeAmountInput.d.ts +26 -0
  18. package/dist/components/SwapDirectionButton/SwapDirectionButton.d.ts +12 -0
  19. package/dist/components/TokenSwapWidget/AmountUnitToggle/AmountUnitToggle.d.ts +13 -0
  20. package/dist/components/TokenSwapWidget/AmountUnitToggle/useAmountUnitToggle.d.ts +46 -0
  21. package/dist/components/TokenSwapWidget/TokenSelectButton/TokenSelectButton.d.ts +17 -0
  22. package/dist/components/TokenSwapWidget/TokenSwapCard/TokenSwapCard.d.ts +24 -0
  23. package/dist/components/TokenSwapWidget/TokenSwapWidget.css.d.ts +5 -0
  24. package/dist/components/TokenSwapWidget/TokenSwapWidget.d.ts +36 -0
  25. package/dist/index.d.ts +1 -1
  26. package/dist/index.js +589 -394
  27. package/dist/modals/CheckoutModal/isSourceChangeLike.d.ts +3 -0
  28. package/dist/modals/ProfileDetails/FunProfileViews/Home/index.d.ts +3 -0
  29. package/dist/modals/WithdrawalModal/useWithdrawalExtraFeeItems.d.ts +8 -0
  30. package/dist/providers/FunkitCheckoutContext/types.d.ts +29 -0
  31. package/dist/providers/FunkitQuoteContext.d.ts +2 -1
  32. package/dist/wallets/walletConnectors/index.js +30 -30
  33. package/package.json +3 -3
package/CHANGELOG.md CHANGED
@@ -1,5 +1,36 @@
1
1
  # @funkit/connect
2
2
 
3
+ ## 12.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 219d767: Integrators can add their own rows, such as a margin requirement, to the withdrawal screen's transaction breakdown.
8
+
9
+ ### Patch Changes
10
+
11
+ - bd971f7: Add the building blocks for an upcoming token swap screen; nothing changes for users yet.
12
+ - Updated dependencies [cb9de15]
13
+ - @funkit/api-base@8.6.0
14
+ - @funkit/connect-core@8.6.0
15
+
16
+ ## 12.12.1
17
+
18
+ ### Patch Changes
19
+
20
+ - 2f3eadd: No consumer-facing behavior changes.
21
+ - 2f3eadd: No consumer-facing behavior changes.
22
+ - 2f3eadd: No consumer-facing behavior changes.
23
+ - 2f3eadd: No consumer-facing behavior changes.
24
+ - 2f3eadd: No consumer-facing behavior changes.
25
+ - 2f3eadd: No consumer-facing behavior changes.
26
+ - 2f3eadd: No consumer-facing behavior changes.
27
+ - Updated dependencies [fb5996c]
28
+ - Updated dependencies [9ffe53d]
29
+ - Updated dependencies [ea451cf]
30
+ - Updated dependencies [2d378e2]
31
+ - @funkit/connect-core@8.5.1
32
+ - @funkit/api-base@8.5.3
33
+
3
34
  ## 12.12.0
4
35
 
5
36
  ### Minor Changes
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  i18n_default
4
- } from "./chunk-JN52EBYV.js";
4
+ } from "./chunk-P6UM36G5.js";
5
5
 
6
6
  // src/hooks/useFunkitTranslation.ts
7
7
  import { useTranslation } from "react-i18next";
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  isExpectedNadoWithdrawalFailure,
4
4
  toNadoWithdrawalErrorMessage
5
- } from "./chunk-WXHSEFYH.js";
5
+ } from "./chunk-ZOQQL2QX.js";
6
6
  import {
7
7
  toWithdrawalAmountBaseUnit
8
8
  } from "./chunk-4DBUYTEE.js";
@@ -13,7 +13,7 @@ import {
13
13
  } from "./chunk-OODIKHYE.js";
14
14
  import {
15
15
  i18n_default
16
- } from "./chunk-JN52EBYV.js";
16
+ } from "./chunk-P6UM36G5.js";
17
17
  import {
18
18
  generateClientMetadataForTokenTransfer
19
19
  } from "./chunk-I5GSXPFE.js";
@@ -687,6 +687,14 @@ var en_default = {
687
687
  belowMinimum: "{{amount}} minimum transfer",
688
688
  pending: "Transfer pending"
689
689
  },
690
+ tokenSwap: {
691
+ from: "From",
692
+ to: "To",
693
+ switchDirection: "Switch direction",
694
+ switchUnit: "Switch between USD and token amount",
695
+ selectToken: "Select token, {{symbol}} selected",
696
+ balance: "Balance: {{amount}}"
697
+ },
690
698
  errorFallback: {
691
699
  title: "Something went wrong",
692
700
  description: "Close this window and try again.",
@@ -1293,6 +1301,14 @@ var es_default = {
1293
1301
  belowMinimum: "{{amount}} transferencia m\xEDnima",
1294
1302
  pending: "Transferencia pendiente"
1295
1303
  },
1304
+ tokenSwap: {
1305
+ from: "Desde",
1306
+ to: "A",
1307
+ switchDirection: "Cambiar direcci\xF3n",
1308
+ switchUnit: "Cambiar entre monto en USD y en token",
1309
+ selectToken: "Seleccionar token, {{symbol}} seleccionado",
1310
+ balance: "Saldo: {{amount}}"
1311
+ },
1296
1312
  errorFallback: {
1297
1313
  title: "Algo sali\xF3 mal",
1298
1314
  description: "Cierra esta ventana e int\xE9ntalo de nuevo.",
@@ -1899,6 +1915,14 @@ var fr_default = {
1899
1915
  belowMinimum: "Transfert minimum de {{amount}}",
1900
1916
  pending: "Transfert en attente"
1901
1917
  },
1918
+ tokenSwap: {
1919
+ from: "De",
1920
+ to: "Vers",
1921
+ switchDirection: "Inverser le sens",
1922
+ switchUnit: "Basculer entre le montant en USD et en jeton",
1923
+ selectToken: "S\xE9lectionner un jeton, {{symbol}} s\xE9lectionn\xE9",
1924
+ balance: "Solde : {{amount}}"
1925
+ },
1902
1926
  errorFallback: {
1903
1927
  title: "Un probl\xE8me est survenu",
1904
1928
  description: "Fermez cette fen\xEAtre et r\xE9essayez.",
@@ -2505,6 +2529,14 @@ var ja_default = {
2505
2529
  belowMinimum: "{{amount}} \u6700\u5C0F\u9001\u91D1\u984D",
2506
2530
  pending: "\u9001\u91D1\u4FDD\u7559\u4E2D"
2507
2531
  },
2532
+ tokenSwap: {
2533
+ from: "\u9001\u4FE1\u5143",
2534
+ to: "\u9001\u4FE1\u5148",
2535
+ switchDirection: "\u65B9\u5411\u3092\u5207\u308A\u66FF\u3048\u308B",
2536
+ switchUnit: "USD\u3068\u30C8\u30FC\u30AF\u30F3\u306E\u91D1\u984D\u3092\u5207\u308A\u66FF\u3048\u308B",
2537
+ selectToken: "\u30C8\u30FC\u30AF\u30F3\u3092\u9078\u629E\uFF08{{symbol}}\u3092\u9078\u629E\u4E2D\uFF09",
2538
+ balance: "\u6B8B\u9AD8\uFF1A{{amount}}"
2539
+ },
2508
2540
  errorFallback: {
2509
2541
  title: "\u554F\u984C\u304C\u767A\u751F\u3057\u307E\u3057\u305F",
2510
2542
  description: "\u3053\u306E\u30A6\u30A3\u30F3\u30C9\u30A6\u3092\u9589\u3058\u3066\u3001\u3082\u3046\u4E00\u5EA6\u304A\u8A66\u3057\u304F\u3060\u3055\u3044\u3002",
@@ -3111,6 +3143,14 @@ var ko_default = {
3111
3143
  belowMinimum: "{{amount}} \uCD5C\uC18C \uC804\uC1A1 \uAE08\uC561",
3112
3144
  pending: "\uC774\uCCB4 \uB300\uAE30 \uC911"
3113
3145
  },
3146
+ tokenSwap: {
3147
+ from: "\uBCF4\uB0B4\uB294 \uC790\uC0B0",
3148
+ to: "\uBC1B\uB294 \uC790\uC0B0",
3149
+ switchDirection: "\uBC29\uD5A5 \uC804\uD658",
3150
+ switchUnit: "USD\uC640 \uD1A0\uD070 \uAE08\uC561 \uC804\uD658",
3151
+ selectToken: "\uD1A0\uD070 \uC120\uD0DD, {{symbol}} \uC120\uD0DD\uB428",
3152
+ balance: "\uC794\uC561: {{amount}}"
3153
+ },
3114
3154
  errorFallback: {
3115
3155
  title: "\uBB38\uC81C\uAC00 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4",
3116
3156
  description: "\uC774 \uCC3D\uC744 \uB2EB\uACE0 \uB2E4\uC2DC \uC2DC\uB3C4\uD574 \uC8FC\uC138\uC694.",
@@ -3717,6 +3757,14 @@ var ru_default = {
3717
3757
  belowMinimum: "{{amount}} \u043C\u0438\u043D\u0438\u043C\u0430\u043B\u044C\u043D\u044B\u0439 \u043F\u0435\u0440\u0435\u0432\u043E\u0434",
3718
3758
  pending: "\u041F\u0435\u0440\u0435\u0432\u043E\u0434 \u0432 \u043E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0435"
3719
3759
  },
3760
+ tokenSwap: {
3761
+ from: "\u0418\u0437",
3762
+ to: "\u0412",
3763
+ switchDirection: "\u0418\u0437\u043C\u0435\u043D\u0438\u0442\u044C \u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435",
3764
+ switchUnit: "\u041F\u0435\u0440\u0435\u043A\u043B\u044E\u0447\u0438\u0442\u044C \u043C\u0435\u0436\u0434\u0443 \u0441\u0443\u043C\u043C\u043E\u0439 \u0432 USD \u0438 \u0432 \u0442\u043E\u043A\u0435\u043D\u0430\u0445",
3765
+ selectToken: "\u0412\u044B\u0431\u0440\u0430\u0442\u044C \u0442\u043E\u043A\u0435\u043D, \u0432\u044B\u0431\u0440\u0430\u043D {{symbol}}",
3766
+ balance: "\u0411\u0430\u043B\u0430\u043D\u0441: {{amount}}"
3767
+ },
3720
3768
  errorFallback: {
3721
3769
  title: "\u0427\u0442\u043E-\u0442\u043E \u043F\u043E\u0448\u043B\u043E \u043D\u0435 \u0442\u0430\u043A",
3722
3770
  description: "\u0417\u0430\u043A\u0440\u043E\u0439\u0442\u0435 \u044D\u0442\u043E \u043E\u043A\u043D\u043E \u0438 \u043F\u043E\u043F\u0440\u043E\u0431\u0443\u0439\u0442\u0435 \u0441\u043D\u043E\u0432\u0430.",
@@ -4323,6 +4371,14 @@ var tr_default = {
4323
4371
  belowMinimum: "{{amount}} minimum transfer",
4324
4372
  pending: "Transfer beklemede"
4325
4373
  },
4374
+ tokenSwap: {
4375
+ from: "Kaynak",
4376
+ to: "Hedef",
4377
+ switchDirection: "Y\xF6n\xFC de\u011Fi\u015Ftir",
4378
+ switchUnit: "USD ve token tutar\u0131 aras\u0131nda ge\xE7i\u015F yap",
4379
+ selectToken: "Token se\xE7, {{symbol}} se\xE7ili",
4380
+ balance: "Bakiye: {{amount}}"
4381
+ },
4326
4382
  errorFallback: {
4327
4383
  title: "Bir \u015Feyler yanl\u0131\u015F gitti",
4328
4384
  description: "Bu pencereyi kapat\u0131p tekrar deneyin.",
@@ -4929,6 +4985,14 @@ var zh_default = {
4929
4985
  belowMinimum: "{{amount}} \u6700\u5C0F\u8F6C\u8D26",
4930
4986
  pending: "\u8F6C\u8D26\u5904\u7406\u4E2D"
4931
4987
  },
4988
+ tokenSwap: {
4989
+ from: "\u4ECE",
4990
+ to: "\u81F3",
4991
+ switchDirection: "\u5207\u6362\u65B9\u5411",
4992
+ switchUnit: "\u5728\u7F8E\u5143\u548C\u4EE3\u5E01\u91D1\u989D\u4E4B\u95F4\u5207\u6362",
4993
+ selectToken: "\u9009\u62E9\u4EE3\u5E01\uFF0C\u5DF2\u9009 {{symbol}}",
4994
+ balance: "\u4F59\u989D\uFF1A{{amount}}"
4995
+ },
4932
4996
  errorFallback: {
4933
4997
  title: "\u51FA\u73B0\u95EE\u9898",
4934
4998
  description: "\u8BF7\u5173\u95ED\u6B64\u7A97\u53E3\u540E\u91CD\u8BD5\u3002",
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  useFunkitTranslation
4
- } from "./chunk-GPI6LBBB.js";
4
+ } from "./chunk-5GX6G7JR.js";
5
5
 
6
6
  // src/providers/FunkitConfigContext.tsx
7
7
  import {
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  i18n_default
4
- } from "./chunk-JN52EBYV.js";
4
+ } from "./chunk-P6UM36G5.js";
5
5
 
6
6
  // src/clients/internal/nado/withdrawalErrors.ts
7
7
  import {
@@ -10,8 +10,8 @@ import {
10
10
  } from "./chunk-RQALGV5U.js";
11
11
  import {
12
12
  useFunkitTranslation
13
- } from "./chunk-GPI6LBBB.js";
14
- import "./chunk-JN52EBYV.js";
13
+ } from "./chunk-5GX6G7JR.js";
14
+ import "./chunk-P6UM36G5.js";
15
15
  import "./chunk-AHYOV7AV.js";
16
16
 
17
17
  // src/clients/fanatics.tsx
@@ -1,11 +1,11 @@
1
1
  "use client";
2
2
  import {
3
3
  createNadoWithdrawalCallback
4
- } from "../../chunk-PK7BKCPR.js";
5
- import "../../chunk-WXHSEFYH.js";
4
+ } from "../../chunk-I75AI3N7.js";
5
+ import "../../chunk-ZOQQL2QX.js";
6
6
  import "../../chunk-4DBUYTEE.js";
7
7
  import "../../chunk-OODIKHYE.js";
8
- import "../../chunk-JN52EBYV.js";
8
+ import "../../chunk-P6UM36G5.js";
9
9
  import "../../chunk-I5GSXPFE.js";
10
10
  import "../../chunk-AHYOV7AV.js";
11
11
  export {
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  isExpectedNadoWithdrawalFailure,
4
4
  toNadoWithdrawalErrorMessage
5
- } from "../../chunk-WXHSEFYH.js";
6
- import "../../chunk-JN52EBYV.js";
5
+ } from "../../chunk-ZOQQL2QX.js";
6
+ import "../../chunk-P6UM36G5.js";
7
7
  export {
8
8
  isExpectedNadoWithdrawalFailure,
9
9
  toNadoWithdrawalErrorMessage
@@ -8,13 +8,13 @@ import {
8
8
  import "../../chunk-6EU6CXNH.js";
9
9
  import {
10
10
  useFunkitConfig
11
- } from "../../chunk-RBMOSICG.js";
11
+ } from "../../chunk-YMBIRJQF.js";
12
12
  import {
13
13
  useFunkitTranslation
14
- } from "../../chunk-GPI6LBBB.js";
14
+ } from "../../chunk-5GX6G7JR.js";
15
15
  import "../../chunk-4DBUYTEE.js";
16
16
  import "../../chunk-2W2P3OS6.js";
17
- import "../../chunk-JN52EBYV.js";
17
+ import "../../chunk-P6UM36G5.js";
18
18
  import {
19
19
  logger
20
20
  } from "../../chunk-AHYOV7AV.js";
@@ -1,12 +1,12 @@
1
1
  "use client";
2
2
  import {
3
3
  useFunkitConfig
4
- } from "../../chunk-RBMOSICG.js";
5
- import "../../chunk-GPI6LBBB.js";
4
+ } from "../../chunk-YMBIRJQF.js";
5
+ import "../../chunk-5GX6G7JR.js";
6
6
  import {
7
7
  useAccount
8
8
  } from "../../chunk-2W2P3OS6.js";
9
- import "../../chunk-JN52EBYV.js";
9
+ import "../../chunk-P6UM36G5.js";
10
10
  import {
11
11
  logger
12
12
  } from "../../chunk-AHYOV7AV.js";
@@ -5,7 +5,7 @@ import {
5
5
  } from "./chunk-6EU6CXNH.js";
6
6
  import {
7
7
  useFunkitConfig
8
- } from "./chunk-RBMOSICG.js";
8
+ } from "./chunk-YMBIRJQF.js";
9
9
  import {
10
10
  AsyncImage,
11
11
  Box,
@@ -13,10 +13,10 @@ import {
13
13
  } from "./chunk-RQALGV5U.js";
14
14
  import {
15
15
  useFunkitTranslation
16
- } from "./chunk-GPI6LBBB.js";
16
+ } from "./chunk-5GX6G7JR.js";
17
17
  import "./chunk-OODIKHYE.js";
18
18
  import "./chunk-2W2P3OS6.js";
19
- import "./chunk-JN52EBYV.js";
19
+ import "./chunk-P6UM36G5.js";
20
20
  import {
21
21
  logger
22
22
  } from "./chunk-AHYOV7AV.js";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import {
3
3
  useFunkitTranslation
4
- } from "./chunk-GPI6LBBB.js";
4
+ } from "./chunk-5GX6G7JR.js";
5
5
  import {
6
6
  getAccount,
7
7
  sendTransaction,
@@ -14,7 +14,7 @@ import {
14
14
  useAccount,
15
15
  useConfig
16
16
  } from "./chunk-2W2P3OS6.js";
17
- import "./chunk-JN52EBYV.js";
17
+ import "./chunk-P6UM36G5.js";
18
18
  import {
19
19
  logger
20
20
  } from "./chunk-AHYOV7AV.js";
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import {
3
3
  createNadoWithdrawalCallback
4
- } from "./chunk-PK7BKCPR.js";
5
- import "./chunk-WXHSEFYH.js";
4
+ } from "./chunk-I75AI3N7.js";
5
+ import "./chunk-ZOQQL2QX.js";
6
6
  import "./chunk-4DBUYTEE.js";
7
7
  import "./chunk-OODIKHYE.js";
8
8
  import {
@@ -11,7 +11,7 @@ import {
11
11
  } from "./chunk-2W2P3OS6.js";
12
12
  import {
13
13
  i18n_default
14
- } from "./chunk-JN52EBYV.js";
14
+ } from "./chunk-P6UM36G5.js";
15
15
  import "./chunk-I5GSXPFE.js";
16
16
  import {
17
17
  logger
@@ -15,8 +15,13 @@ interface PaymentFeesSummaryProps {
15
15
  isWithdrawal: boolean;
16
16
  extraSourceChainGasUsd?: number;
17
17
  step: FunCheckoutStep | WithdrawalModalStep;
18
+ /**
19
+ * Integrator rows rendered before the SDK's own rows.
20
+ * - Display-only: excluded from the total, expandability and analytics.
21
+ */
22
+ extraFeeItems?: FeeItem[];
18
23
  }
19
- export declare function PaymentFeesSummary({ isLoading, quote, fallbackFees, isWithdrawal, valuesNotAvailable, extraSourceChainGasUsd, step, }: PaymentFeesSummaryProps): React.JSX.Element;
24
+ export declare function PaymentFeesSummary({ isLoading, quote, fallbackFees, isWithdrawal, valuesNotAvailable, extraSourceChainGasUsd, step, extraFeeItems, }: PaymentFeesSummaryProps): React.JSX.Element;
20
25
  export interface FeeItem {
21
26
  label: string;
22
27
  value: string;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Borderless big-number input; the wrapper owns the (fitted) font size, so
3
+ * everything here inherits.
4
+ * - `!important` beats host pages that style bare `input` selectors.
5
+ * - The family comes from the wrapper's theme `inputAmount` font, like
6
+ * checkout's amount field.
7
+ */
8
+ export declare const largeAmountInput: string;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ export interface LargeAmountInputProps {
3
+ /** Controlled amount string (raw user input). */
4
+ amount: string;
5
+ /** Omit together with `readOnly` for a display-only amount. */
6
+ onAmountChange?: (next: string) => void;
7
+ ariaLabel: string;
8
+ /** Defaults to `center`. */
9
+ align?: 'center' | 'start';
10
+ /** Rendered outside the field so the caret sits on the digits, e.g. `$`. */
11
+ prefix?: string;
12
+ /** e.g. ` SOL` when the amount is in token units. */
13
+ suffix?: string;
14
+ placeholder?: string;
15
+ readOnly?: boolean;
16
+ autoFocus?: boolean;
17
+ /** Defaults to the theme `inputAmount` size. */
18
+ maxFontSize?: number;
19
+ /** Caps the width the text shrinks to fit, on top of the measured container. */
20
+ maxAvailableWidth?: number;
21
+ testId?: string;
22
+ }
23
+ /**
24
+ * Big "$<amount>" field that shrinks its font to fit the available width.
25
+ */
26
+ export declare function LargeAmountInput({ amount, onAmountChange, ariaLabel, align, prefix, suffix, placeholder, readOnly, autoFocus, maxFontSize: maxFontSizeProp, maxAvailableWidth, testId, }: LargeAmountInputProps): React.JSX.Element;
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ export type SwapDirectionButtonShape = 'circle' | 'rounded';
3
+ export interface SwapDirectionButtonProps {
4
+ onClick: () => void;
5
+ /** Defaults to `circle`. */
6
+ shape?: SwapDirectionButtonShape;
7
+ ariaLabel?: string;
8
+ isDisabled?: boolean;
9
+ testId?: string;
10
+ }
11
+ /** Flips which side of a From/To pair is the source. */
12
+ export declare function SwapDirectionButton({ onClick, shape, ariaLabel, isDisabled, testId, }: SwapDirectionButtonProps): React.JSX.Element;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ export interface AmountUnitToggleProps {
3
+ /** The amount in the unit that isn't being typed, already formatted. */
4
+ convertedAmount: string;
5
+ /** Omit to show the amount without the switch (e.g. price unknown). */
6
+ onToggle?: () => void;
7
+ testId?: string;
8
+ }
9
+ /**
10
+ * "28.05 ⇅": shows the other unit and switches the input to it on click.
11
+ * Without `onToggle` it's plain text, so it isn't a dead tab stop.
12
+ */
13
+ export declare function AmountUnitToggle({ convertedAmount, onToggle, testId, }: AmountUnitToggleProps): React.JSX.Element;
@@ -0,0 +1,46 @@
1
+ export type AmountUnit = 'usd' | 'token';
2
+ /**
3
+ * The next input value reformatted like checkout's amount field (leading zeros
4
+ * dropped, group separators, decimals capped), or `null` when it holds
5
+ * anything but digits and separators (the caller keeps the previous value).
6
+ */
7
+ export declare function sanitizeAmountInput(next: string, locale: Intl.LocalesArgument): string | null;
8
+ /** Floats, not base units: fine for display and quotes, not for an exact Max. */
9
+ export interface AmountInUnits {
10
+ /** `undefined` when the input is empty, or in token mode without a price. */
11
+ usdAmount: number | undefined;
12
+ /** `undefined` when the input is empty, or in USD mode without a price. */
13
+ tokenAmount: number | undefined;
14
+ }
15
+ export declare function getAmountInUnits(inputValue: string, unit: AmountUnit, unitPriceUsd: number | undefined, locale: Intl.LocalesArgument): AmountInUnits;
16
+ /**
17
+ * The input value re-expressed in `nextUnit`, rounded the way checkout's
18
+ * reducer does (USD floors so it never exceeds what the tokens are worth).
19
+ */
20
+ export declare function convertInputValue(inputValue: string, nextUnit: AmountUnit, unitPriceUsd: number, locale: Intl.LocalesArgument): string;
21
+ export interface AmountUnitToggleState extends AmountInUnits {
22
+ /**
23
+ * Locale-formatted text for the field ("1,000.50"). Display only: pass
24
+ * `tokenAmount`/`usdAmount` on, since this breaks `parseUnits` and quotes.
25
+ */
26
+ inputValue: string;
27
+ unit: AmountUnit;
28
+ /** Ignores input that isn't digits and separators. */
29
+ setInputValue: (next: string) => void;
30
+ /** `undefined` while the token price is unknown, so there's nothing to convert with. */
31
+ toggleUnit: (() => void) | undefined;
32
+ }
33
+ /**
34
+ * Amount entry that can be typed in either USD or token units, converting the
35
+ * typed value when the unit flips.
36
+ * - Placeholder until checkout's exact-in amount logic is shared: no frozen
37
+ * price, no base-unit amount, no balance cap.
38
+ * - `initialUnit`/`initialInputValue` are read on mount only; the caller must
39
+ * reset or convert the value when the token changes (picker or direction swap).
40
+ */
41
+ export declare function useAmountUnitToggle({ unitPriceUsd, initialUnit, initialInputValue, locale, }: {
42
+ unitPriceUsd: number | undefined;
43
+ initialUnit?: AmountUnit;
44
+ initialInputValue?: string;
45
+ locale?: Intl.LocalesArgument;
46
+ }): AmountUnitToggleState;
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ export interface TokenSwapToken {
3
+ symbol: string;
4
+ iconSrc?: string;
5
+ chainId?: string | number;
6
+ }
7
+ export interface TokenSelectButtonProps {
8
+ token: TokenSwapToken;
9
+ /** Omit to render the token without the picker affordance. */
10
+ onClick?: () => void;
11
+ testId?: string;
12
+ }
13
+ /**
14
+ * Token icon (with chain badge), symbol and ">" that opens the token picker.
15
+ * Without `onClick` it renders as plain content, so it isn't a dead tab stop.
16
+ */
17
+ export declare function TokenSelectButton({ token, onClick, testId, }: TokenSelectButtonProps): React.JSX.Element;
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { type TokenSwapToken } from '../TokenSelectButton/TokenSelectButton';
3
+ export interface TokenSwapCardProps {
4
+ label: string;
5
+ token: TokenSwapToken;
6
+ onTokenClick?: () => void;
7
+ /** The big amount, without prefix/suffix. */
8
+ amount: string;
9
+ amountPrefix?: string;
10
+ /** Present only on the editable (source) card. */
11
+ onAmountChange?: (next: string) => void;
12
+ /** The amount in the other unit, already formatted. */
13
+ convertedAmount: string;
14
+ onToggleUnit?: () => void;
15
+ balance?: string;
16
+ isLoading?: boolean;
17
+ testId: string;
18
+ }
19
+ /**
20
+ * One side of the swap widget.
21
+ * - Editable (has `onAmountChange`): filled background, unit toggle, highlighted balance.
22
+ * - Read-only: outlined, amount comes from the quote.
23
+ */
24
+ export declare function TokenSwapCard({ label, token, onTokenClick, amount, amountPrefix, onAmountChange, convertedAmount, onToggleUnit, balance, isLoading, testId, }: TokenSwapCardProps): React.JSX.Element;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Centers the swap button over the gap between the two cards. The ring in the
3
+ * modal background color makes it look cut out of both cards.
4
+ */
5
+ export declare const swapDirectionButtonSlot: string;
@@ -0,0 +1,36 @@
1
+ import React from 'react';
2
+ import type { AmountUnit } from './AmountUnitToggle/useAmountUnitToggle';
3
+ import type { TokenSwapToken } from './TokenSelectButton/TokenSelectButton';
4
+ export type { TokenSwapToken };
5
+ interface TokenSwapSideAmounts {
6
+ token: TokenSwapToken;
7
+ onTokenClick?: () => void;
8
+ usdAmount: number | undefined;
9
+ tokenAmount: number | undefined;
10
+ /** The user's holding of `token`, in token units. */
11
+ tokenBalance?: number;
12
+ }
13
+ export interface TokenSwapFromSide extends TokenSwapSideAmounts {
14
+ /** What the user typed, in `unit`. */
15
+ inputValue: string;
16
+ onInputChange: (next: string) => void;
17
+ }
18
+ export interface TokenSwapToSide extends TokenSwapSideAmounts {
19
+ /** Shows a skeleton in place of the amount while the quote loads. */
20
+ isLoading?: boolean;
21
+ }
22
+ export interface TokenSwapWidgetProps {
23
+ from: TokenSwapFromSide;
24
+ to: TokenSwapToSide;
25
+ /** Unit the amounts are entered and shown in. */
26
+ unit: AmountUnit;
27
+ /** Omit to hide the unit switch (e.g. price unknown). */
28
+ onToggleUnit?: () => void;
29
+ onSwapDirection: () => void;
30
+ isSwapDirectionDisabled?: boolean;
31
+ }
32
+ /**
33
+ * From card, swap-direction button, To card. Layout and callbacks only; the
34
+ * caller owns amounts, quotes and token selection.
35
+ */
36
+ export declare function TokenSwapWidget({ from, to, unit, onToggleUnit, onSwapDirection, isSwapDirectionDisabled, }: TokenSwapWidgetProps): React.JSX.Element;
package/dist/index.d.ts CHANGED
@@ -20,7 +20,7 @@ export { createAuthenticationAdapter, FunkitConnectAuthenticationProvider, } fro
20
20
  export type { AuthenticationAdapter, FunkitConnectAuthenticationProviderProps, } from './providers/AuthenticationContext';
21
21
  export type { AvatarComponent } from './providers/AvatarContext';
22
22
  export type { CheckoutBlockedReason } from './modals/CheckoutModal/CheckoutBlockedReason';
23
- export type { FunkitCheckoutActionParams, FunkitCheckoutConfig, FunkitCheckoutOnCloseResult, FunkitWithdrawalConfig, WalletWithdrawalConfig, CustomWithdrawalConfig, MultiMethodWithdrawalConfig, WithdrawalMethodOption, WithdrawalParam, WithdrawalFormData, WithdrawalSourceTokenBalanceParams, WithdrawalSourceCustomData, SourceTokenOption, WithdrawalCustomerData, LighterWithdrawalCustomerData, LighterRouteType, WithdrawalCustomerConfig, UseFunkitCheckoutPropsWithFullConfig, UseFunkitCheckoutProps, FunkitCheckoutValidationResult, FunkitCheckoutResult, DynamicTargetAssetCandidate, AddToWalletToken, TokenInfo, ModalTitleContext, DestinationLineItem, DestinationLineItemContext, LineItemSlot, LineItemValue, LineItemValueColor, } from './providers/FunkitCheckoutContext';
23
+ export type { FunkitCheckoutActionParams, FunkitCheckoutConfig, FunkitCheckoutOnCloseResult, FunkitWithdrawalConfig, WalletWithdrawalConfig, CustomWithdrawalConfig, MultiMethodWithdrawalConfig, WithdrawalMethodOption, WithdrawalParam, WithdrawalFormData, WithdrawalSourceTokenBalanceParams, WithdrawalSourceCustomData, SourceTokenOption, WithdrawalCustomerData, LighterWithdrawalCustomerData, LighterRouteType, WithdrawalCustomerConfig, UseFunkitCheckoutPropsWithFullConfig, UseFunkitCheckoutProps, FunkitCheckoutValidationResult, FunkitCheckoutResult, DynamicTargetAssetCandidate, AddToWalletToken, TokenInfo, ModalTitleContext, DestinationLineItem, DestinationLineItemContext, LineItemSlot, LineItemValue, LineItemValueColor, WithdrawalFeeItem, WithdrawalFeeItemContext, } from './providers/FunkitCheckoutContext';
24
24
  export { useFunkitCheckout, FunCheckoutStartingStep, } from './providers/FunkitCheckoutContext';
25
25
  export type { FunkitCheckoutQuoteResult } from './domains/quote';
26
26
  export type { FunkitConfig, FunkitUiCustomizationsConfig, FunkitTextCustomizationsConfig, } from './providers/FunkitConfigContext';