@aurora-is-near/intents-swap-widget 3.23.0 → 3.24.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 (95) hide show
  1. package/dist/{config-0TjbjBo5.js → config-Bg5hUlJL.js} +2 -2
  2. package/dist/{config-0TjbjBo5.js.map → config-Bg5hUlJL.js.map} +1 -1
  3. package/dist/config.js +1 -1
  4. package/dist/errors.js +1 -1
  5. package/dist/ext/alchemy/index.js +1 -1
  6. package/dist/ext/index.js +1 -1
  7. package/dist/features/BalanceRpcLoader/TokenBalanceLoader.js +1 -1
  8. package/dist/features/BalanceRpcLoader/index.js +1 -1
  9. package/dist/features/BalanceRpcLoader/useTokenBalanceRpc.js +1 -1
  10. package/dist/features/ChainsDropdown/index.js +1 -1
  11. package/dist/features/ChainsSelector/index.js +1 -1
  12. package/dist/features/DepositMethodSwitcher.js +1 -1
  13. package/dist/features/ErrorBoundary.js +1 -1
  14. package/dist/features/ExternalDeposit.js +1 -1
  15. package/dist/features/SendAddress/index.js +1 -1
  16. package/dist/features/SendAddress/useNotification.js +1 -1
  17. package/dist/features/SubmitButton/index.js +1 -1
  18. package/dist/features/SuccessScreen/index.js +1 -1
  19. package/dist/features/SuccessScreen/useSummaryItemsCount.js +1 -1
  20. package/dist/features/SwapDirectionSwitcher.js +1 -1
  21. package/dist/features/SwapQuote/SwapQuote.js +1 -1
  22. package/dist/features/SwapQuote/index.js +1 -1
  23. package/dist/features/TokenInput/TokenInput.js +1 -1
  24. package/dist/features/TokenInput/TokenInputEmpty.js +1 -1
  25. package/dist/features/TokenInput/TokenInputSource.js +1 -1
  26. package/dist/features/TokenInput/TokenInputTarget.js +1 -1
  27. package/dist/features/TokenInput/WalletBalance.js +1 -1
  28. package/dist/features/TokenInput/hooks/index.js +1 -1
  29. package/dist/features/TokenInput/hooks/useTokenInputBalance.js +1 -1
  30. package/dist/features/TokenInput/index.js +1 -1
  31. package/dist/features/TokensList/TokenItem.js +1 -1
  32. package/dist/features/TokensList/TokensList.js +1 -1
  33. package/dist/features/TokensList/index.js +1 -1
  34. package/dist/features/TokensModal.js +1 -1
  35. package/dist/features/WalletCompatibilityCheck/WalletCompatibilityModal.js +1 -1
  36. package/dist/features/WalletCompatibilityCheck/index.js +1 -1
  37. package/dist/features/index.js +1 -1
  38. package/dist/hooks/index.js +1 -1
  39. package/dist/hooks/useAllTokens.js +1 -1
  40. package/dist/hooks/useChains.js +1 -1
  41. package/dist/hooks/useCompatibilityCheck.js +1 -1
  42. package/dist/hooks/useDefaultToken.js +1 -1
  43. package/dist/hooks/useExternalDepositStatus/index.js +1 -1
  44. package/dist/hooks/useExternalDepositStatus/usePoaExternalDepositStatus.js +1 -1
  45. package/dist/hooks/useIntentsBalance.js +1 -1
  46. package/dist/hooks/useIsCompatibilityCheckRequired.js +1 -1
  47. package/dist/hooks/useMakeDepositAddress.js +1 -1
  48. package/dist/hooks/useMakeIntentsTransfer.js +1 -1
  49. package/dist/hooks/useMakeNEARFtTransferCall.js +1 -1
  50. package/dist/hooks/useMakeQuote.js +1 -1
  51. package/dist/hooks/useMakeQuoteTransfer.js +1 -1
  52. package/dist/hooks/useMakeTransfer.js +1 -1
  53. package/dist/hooks/useMergedBalance.js +1 -1
  54. package/dist/hooks/useSwitchChain.js +1 -1
  55. package/dist/hooks/useTheme.js +1 -1
  56. package/dist/hooks/useTokenInputPair.js +1 -1
  57. package/dist/hooks/useTokens.js +1 -1
  58. package/dist/hooks/useTokensFiltered.js +1 -1
  59. package/dist/hooks/useTokensIntentsUnique.js +1 -1
  60. package/dist/index.js +1 -1
  61. package/dist/machine/effects/index.js +1 -1
  62. package/dist/machine/effects/useAlchemyBalanceEffect.js +1 -1
  63. package/dist/machine/effects/useBalancesUpdateEffect.js +1 -1
  64. package/dist/machine/effects/useMakeQuoteEffect.js +1 -1
  65. package/dist/machine/effects/useSelectedTokensEffect.js +1 -1
  66. package/dist/machine/effects/useSetTokenBalanceEffect.js +1 -1
  67. package/dist/machine/effects/useSetTokenIntentsTargetEffect.js +1 -1
  68. package/dist/machine/effects/useWalletConnEffect.js +1 -1
  69. package/dist/machine/events/index.js +1 -1
  70. package/dist/machine/events/tokenSelect.js +1 -1
  71. package/dist/machine/events/validateInputAndMoveTo.js +1 -1
  72. package/dist/machine/events/validateInputs.js +1 -1
  73. package/dist/machine/index.js +1 -1
  74. package/dist/machine/snap.js +1 -1
  75. package/dist/machine/subscriptions/checkers/isSendAddressAsConnected.js +1 -1
  76. package/dist/machine/subscriptions/index.js +1 -1
  77. package/dist/theme/ThemeProvider.js +1 -1
  78. package/dist/types/widget.d.ts +1 -0
  79. package/dist/types/widget.js +2 -0
  80. package/dist/types/widget.js.map +1 -0
  81. package/dist/utils/intents/signers/near.js +1 -1
  82. package/dist/utils/intents/signers/privy.js +1 -1
  83. package/dist/utils/near/getNearNep141StorageBalance.js +1 -1
  84. package/dist/widgets/Widget/WidgetContent.d.ts +6 -4
  85. package/dist/widgets/Widget/WidgetContent.js +27 -24
  86. package/dist/widgets/Widget/WidgetContent.js.map +1 -1
  87. package/dist/widgets/WidgetDeposit/WidgetDepositContent.js +1 -1
  88. package/dist/widgets/WidgetDeposit/WidgetDepositSkeleton.js +1 -1
  89. package/dist/widgets/WidgetSwap/WidgetSwapContent.js +1 -1
  90. package/dist/widgets/WidgetSwap/WidgetSwapSkeleton.js +1 -1
  91. package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js +1 -1
  92. package/dist/widgets/WidgetWithdraw/WidgetWithdrawSkeleton.js +1 -1
  93. package/package.json +1 -1
  94. package/src/types/widget.ts +1 -0
  95. package/src/widgets/Widget/WidgetContent.tsx +9 -5
@@ -1,6 +1,6 @@
1
1
  import "valtio";
2
2
  import "./tokenSelectRotate.js";
3
- import { Z as p } from "../../config-0TjbjBo5.js";
3
+ import { Z as p } from "../../config-Bg5hUlJL.js";
4
4
  import "../../utils/notReachable.js";
5
5
  export {
6
6
  p as tokenSelect
@@ -1,4 +1,4 @@
1
- import { O as m } from "../../config-0TjbjBo5.js";
1
+ import { O as m } from "../../config-Bg5hUlJL.js";
2
2
  import "ethers";
3
3
  import "../machine.js";
4
4
  import "../guards/checks/isDryQuote.js";
@@ -3,7 +3,7 @@ import "../../utils/near/checkNearAccountExists.js";
3
3
  import "../../utils/checkers/isNotEmptyAmount.js";
4
4
  import "../../utils/checkers/isValidBigint.js";
5
5
  import "../../utils/near/isNearAddress.js";
6
- import { K as I, L as d, N as u } from "../../config-0TjbjBo5.js";
6
+ import { K as I, L as d, N as u } from "../../config-Bg5hUlJL.js";
7
7
  import "../guards/index.js";
8
8
  import "../machine.js";
9
9
  import "../guards/checks/isBalanceSufficient.js";
@@ -1,4 +1,4 @@
1
- import { r as o, u as t, a as r, c as a, b as f } from "../config-0TjbjBo5.js";
1
+ import { r as o, u as t, a as r, c as a, b as f } from "../config-Bg5hUlJL.js";
2
2
  import { guardStates as S } from "./guards/index.js";
3
3
  import { machine as n, moveTo as u } from "./machine.js";
4
4
  import { fireEvent as i } from "./events/utils/fireEvent.js";
@@ -2,7 +2,7 @@ import "valtio";
2
2
  import "derive-valtio";
3
3
  import "./computed/getIsNativeNearDeposit.js";
4
4
  import "./computed/getIsDirectTokenOnNearDeposit.js";
5
- import { u as h, a as b, b as d } from "../config-0TjbjBo5.js";
5
+ import { u as h, a as b, b as d } from "../config-Bg5hUlJL.js";
6
6
  import "./machine.js";
7
7
  import "./guards/index.js";
8
8
  import "./computed/getUsdTradeDelta.js";
@@ -1,5 +1,5 @@
1
1
  import "valtio";
2
- import { V as o } from "../../../config-0TjbjBo5.js";
2
+ import { V as o } from "../../../config-Bg5hUlJL.js";
3
3
  export {
4
4
  o as isSendAddressAsConnected
5
5
  };
@@ -5,7 +5,7 @@ import "./checkers/isOnlyErrorChanged.js";
5
5
  import "./checkers/isValidInitialState.js";
6
6
  import "./checkers/isWalletDisconnected.js";
7
7
  import "./checkers/isSendAddressForbidden.js";
8
- import { X as g, Y as u } from "../../config-0TjbjBo5.js";
8
+ import { X as g, Y as u } from "../../config-Bg5hUlJL.js";
9
9
  import "./checkers/isAmountChangedFromQuote.js";
10
10
  import "ethers";
11
11
  import "../machine.js";
@@ -1,7 +1,7 @@
1
1
  import "react/jsx-runtime";
2
2
  import "react";
3
3
  import "./createColorPalette.js";
4
- import { C as i, ad as p } from "../config-0TjbjBo5.js";
4
+ import { C as i, ad as p } from "../config-Bg5hUlJL.js";
5
5
  export {
6
6
  i as ThemeContext,
7
7
  p as ThemeProvider
@@ -0,0 +1 @@
1
+ export type WidgetType = 'swap' | 'deposit' | 'withdraw';
@@ -0,0 +1,2 @@
1
+
2
+ //# sourceMappingURL=widget.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"widget.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -1,6 +1,6 @@
1
1
  import "../../../index-DEq3oXQF.js";
2
2
  import "@defuse-protocol/intents-sdk";
3
- import { a2 as o } from "../../../config-0TjbjBo5.js";
3
+ import { a2 as o } from "../../../config-Bg5hUlJL.js";
4
4
  export {
5
5
  o as createNearWalletSigner
6
6
  };
@@ -1,5 +1,5 @@
1
1
  import "@defuse-protocol/internal-utils";
2
- import { a1 as i } from "../../../config-0TjbjBo5.js";
2
+ import { a1 as i } from "../../../config-Bg5hUlJL.js";
3
3
  export {
4
4
  i as IntentSignerPrivy
5
5
  };
@@ -2,7 +2,7 @@ import "../../index-DEq3oXQF.js";
2
2
  import "zod";
3
3
  import "./decodeQueryResult.js";
4
4
  import "./rpc.js";
5
- import { $ as m } from "../../config-0TjbjBo5.js";
5
+ import { $ as m } from "../../config-Bg5hUlJL.js";
6
6
  export {
7
7
  m as getNearNep141StorageBalance
8
8
  };
@@ -1,10 +1,12 @@
1
1
  import { Msg as SwapMsg, Props as WidgetSwapProps } from '../WidgetSwap/WidgetSwapContent';
2
2
  import { Msg as DepositMsg, Props as WidgetDepositProps } from '../WidgetDeposit/WidgetDepositContent';
3
3
  import { Props as WidgetWithdrawProps, Msg as WithdrawMsg } from '../WidgetWithdraw/WidgetWithdrawContent';
4
- type WidgetType = 'swap' | 'deposit' | 'withdraw';
5
- export type Props = Omit<WidgetSwapProps | WidgetDepositProps | WidgetWithdrawProps, 'onMsg'> & {
6
- onMsg?: (msg: Msg, widget: WidgetType) => void;
4
+ import { MakeTransferArgs } from '../../types';
5
+ import { WidgetType } from '../../types/widget';
6
+ export type Props = Omit<WidgetSwapProps | WidgetDepositProps | WidgetWithdrawProps, 'onMsg' | 'makeTransfer'> & {
7
+ onMsg?: (msg: Msg, widgetType: WidgetType) => void;
8
+ makeTransfer?: (args: MakeTransferArgs, widgetType: WidgetType) => void;
7
9
  };
8
10
  type Msg = SwapMsg | DepositMsg | WithdrawMsg;
9
- export declare const WidgetContent: ({ onMsg, ...restProps }: Props) => import("react/jsx-runtime").JSX.Element;
11
+ export declare const WidgetContent: ({ onMsg, makeTransfer, ...restProps }: Props) => import("react/jsx-runtime").JSX.Element;
10
12
  export {};
@@ -1,49 +1,52 @@
1
1
  import { jsxs as u, Fragment as l, jsx as e } from "react/jsx-runtime";
2
- import { useState as c, useEffect as w } from "react";
3
- import { WidgetTabs as b } from "../../components/WidgetTabs.js";
4
- import { WidgetSwapContent as g } from "../WidgetSwap/WidgetSwapContent.js";
5
- import { WidgetDepositContent as h } from "../WidgetDeposit/WidgetDepositContent.js";
6
- import { WidgetWithdrawContent as T } from "../WidgetWithdraw/WidgetWithdrawContent.js";
7
- import { y as W } from "../../config-0TjbjBo5.js";
8
- const j = ({ onMsg: p, ...o }) => {
9
- const [d, i] = c(!0), [r, a] = c("swap"), { enableAccountAbstraction: n } = W(), f = (t) => {
10
- a(t);
11
- }, s = (t, m) => {
12
- t.type === "on_tokens_modal_toggled" && i(!t.isOpen), t.type === "on_select_token" && i(!0), p?.(t, m);
2
+ import { useState as p, useEffect as b } from "react";
3
+ import { WidgetTabs as g } from "../../components/WidgetTabs.js";
4
+ import { WidgetSwapContent as h } from "../WidgetSwap/WidgetSwapContent.js";
5
+ import { WidgetDepositContent as T } from "../WidgetDeposit/WidgetDepositContent.js";
6
+ import { WidgetWithdrawContent as W } from "../WidgetWithdraw/WidgetWithdrawContent.js";
7
+ import { y as C } from "../../config-Bg5hUlJL.js";
8
+ const j = ({ onMsg: d, makeTransfer: o, ...s }) => {
9
+ const [f, r] = p(!0), [a, c] = p("swap"), { enableAccountAbstraction: n } = C(), w = (t) => {
10
+ c(t);
11
+ }, i = (t, m) => {
12
+ t.type === "on_tokens_modal_toggled" && r(!t.isOpen), t.type === "on_select_token" && r(!0), d?.(t, m);
13
13
  };
14
- return w(() => {
15
- n || a("swap");
14
+ return b(() => {
15
+ n || c("swap");
16
16
  }, [n]), /* @__PURE__ */ u(l, { children: [
17
- n && d && /* @__PURE__ */ e(b, { activeTab: r, onSelect: f }),
17
+ n && f && /* @__PURE__ */ e(g, { activeTab: a, onSelect: w }),
18
18
  (() => {
19
- switch (r) {
19
+ switch (a) {
20
20
  case "swap":
21
21
  return /* @__PURE__ */ e(
22
- g,
22
+ h,
23
23
  {
24
- ...o,
24
+ ...s,
25
+ makeTransfer: (t) => o?.(t, "swap"),
25
26
  onMsg: (t) => {
26
- s(t, "swap");
27
+ i(t, "swap");
27
28
  }
28
29
  }
29
30
  );
30
31
  case "deposit":
31
32
  return /* @__PURE__ */ e(
32
- h,
33
+ T,
33
34
  {
34
- ...o,
35
+ ...s,
36
+ makeTransfer: (t) => o?.(t, "deposit"),
35
37
  onMsg: (t) => {
36
- s(t, "deposit");
38
+ i(t, "deposit");
37
39
  }
38
40
  }
39
41
  );
40
42
  case "withdraw":
41
43
  return /* @__PURE__ */ e(
42
- T,
44
+ W,
43
45
  {
44
- ...o,
46
+ ...s,
47
+ makeTransfer: (t) => o?.(t, "withdraw"),
45
48
  onMsg: (t) => {
46
- s(t, "withdraw");
49
+ i(t, "withdraw");
47
50
  }
48
51
  }
49
52
  );
@@ -1 +1 @@
1
- {"version":3,"file":"WidgetContent.js","sources":["../../../src/widgets/Widget/WidgetContent.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\nimport { WidgetTab, WidgetTabs } from '../../components/WidgetTabs';\nimport {\n Msg as SwapMsg,\n WidgetSwapContent,\n Props as WidgetSwapProps,\n} from '../WidgetSwap/WidgetSwapContent';\nimport {\n Msg as DepositMsg,\n WidgetDepositContent,\n Props as WidgetDepositProps,\n} from '../WidgetDeposit/WidgetDepositContent';\nimport {\n WidgetWithdrawContent,\n Props as WidgetWithdrawProps,\n Msg as WithdrawMsg,\n} from '../WidgetWithdraw/WidgetWithdrawContent';\nimport { useConfig } from '../../config';\n\ntype WidgetType = 'swap' | 'deposit' | 'withdraw';\n\nexport type Props = Omit<\n WidgetSwapProps | WidgetDepositProps | WidgetWithdrawProps,\n 'onMsg'\n> & {\n onMsg?: (msg: Msg, widget: WidgetType) => void;\n};\n\ntype Msg = SwapMsg | DepositMsg | WithdrawMsg;\n\nexport const WidgetContent = ({ onMsg, ...restProps }: Props) => {\n const [isTabsVisible, setIsTabsVisible] = useState(true);\n const [activeTab, setActiveTab] = useState<WidgetTab>('swap');\n const { enableAccountAbstraction } = useConfig();\n\n const switchTab = (tab: WidgetTab) => {\n setActiveTab(tab);\n };\n\n const handleMsg = <T extends Msg>(msg: T, widgetType: WidgetType) => {\n if (msg.type === 'on_tokens_modal_toggled') {\n setIsTabsVisible(!msg.isOpen);\n }\n\n if (msg.type === 'on_select_token') {\n setIsTabsVisible(true);\n }\n\n onMsg?.(msg, widgetType);\n };\n\n useEffect(() => {\n if (!enableAccountAbstraction) {\n setActiveTab('swap');\n }\n }, [enableAccountAbstraction]);\n\n return (\n <>\n {enableAccountAbstraction && isTabsVisible && (\n <WidgetTabs activeTab={activeTab} onSelect={switchTab} />\n )}\n\n {(() => {\n switch (activeTab) {\n case 'swap': {\n return (\n <WidgetSwapContent\n {...restProps}\n onMsg={(msg) => {\n handleMsg(msg, 'swap');\n }}\n />\n );\n }\n\n case 'deposit': {\n return (\n <WidgetDepositContent\n {...restProps}\n onMsg={(msg) => {\n handleMsg(msg, 'deposit');\n }}\n />\n );\n }\n\n case 'withdraw': {\n return (\n <WidgetWithdrawContent\n {...restProps}\n onMsg={(msg) => {\n handleMsg(msg, 'withdraw');\n }}\n />\n );\n }\n\n default:\n return null;\n }\n })()}\n </>\n );\n};\n"],"names":["WidgetContent","onMsg","restProps","isTabsVisible","setIsTabsVisible","useState","activeTab","setActiveTab","enableAccountAbstraction","useConfig","switchTab","tab","handleMsg","msg","widgetType","useEffect","jsxs","Fragment","jsx","WidgetTabs","WidgetSwapContent","WidgetDepositContent","WidgetWithdrawContent"],"mappings":";;;;;;;AAgCO,MAAMA,IAAgB,CAAC,EAAE,OAAAC,GAAO,GAAGC,QAAuB;AAC/D,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAS,EAAI,GACjD,CAACC,GAAWC,CAAY,IAAIF,EAAoB,MAAM,GACtD,EAAE,0BAAAG,EAAA,IAA6BC,EAAA,GAE/BC,IAAY,CAACC,MAAmB;AACpC,IAAAJ,EAAaI,CAAG;AAAA,EAClB,GAEMC,IAAY,CAAgBC,GAAQC,MAA2B;AACnE,IAAID,EAAI,SAAS,6BACfT,EAAiB,CAACS,EAAI,MAAM,GAG1BA,EAAI,SAAS,qBACfT,EAAiB,EAAI,GAGvBH,IAAQY,GAAKC,CAAU;AAAA,EACzB;AAEA,SAAAC,EAAU,MAAM;AACd,IAAKP,KACHD,EAAa,MAAM;AAAA,EAEvB,GAAG,CAACC,CAAwB,CAAC,GAG3B,gBAAAQ,EAAAC,GAAA,EACG,UAAA;AAAA,IAAAT,KAA4BL,KAC3B,gBAAAe,EAACC,GAAA,EAAW,WAAAb,GAAsB,UAAUI,GAAW;AAAA,KAGvD,MAAM;AACN,cAAQJ,GAAA;AAAA,QACN,KAAK;AACH,iBACE,gBAAAY;AAAA,YAACE;AAAA,YAAA;AAAA,cACE,GAAGlB;AAAA,cACJ,OAAO,CAACW,MAAQ;AACd,gBAAAD,EAAUC,GAAK,MAAM;AAAA,cACvB;AAAA,YAAA;AAAA,UAAA;AAAA,QAKN,KAAK;AACH,iBACE,gBAAAK;AAAA,YAACG;AAAA,YAAA;AAAA,cACE,GAAGnB;AAAA,cACJ,OAAO,CAACW,MAAQ;AACd,gBAAAD,EAAUC,GAAK,SAAS;AAAA,cAC1B;AAAA,YAAA;AAAA,UAAA;AAAA,QAKN,KAAK;AACH,iBACE,gBAAAK;AAAA,YAACI;AAAA,YAAA;AAAA,cACE,GAAGpB;AAAA,cACJ,OAAO,CAACW,MAAQ;AACd,gBAAAD,EAAUC,GAAK,UAAU;AAAA,cAC3B;AAAA,YAAA;AAAA,UAAA;AAAA,QAKN;AACE,iBAAO;AAAA,MAAA;AAAA,IAEb,GAAA;AAAA,EAAG,GACL;AAEJ;"}
1
+ {"version":3,"file":"WidgetContent.js","sources":["../../../src/widgets/Widget/WidgetContent.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\nimport { WidgetTab, WidgetTabs } from '../../components/WidgetTabs';\nimport {\n Msg as SwapMsg,\n WidgetSwapContent,\n Props as WidgetSwapProps,\n} from '../WidgetSwap/WidgetSwapContent';\nimport {\n Msg as DepositMsg,\n WidgetDepositContent,\n Props as WidgetDepositProps,\n} from '../WidgetDeposit/WidgetDepositContent';\nimport {\n WidgetWithdrawContent,\n Props as WidgetWithdrawProps,\n Msg as WithdrawMsg,\n} from '../WidgetWithdraw/WidgetWithdrawContent';\nimport { useConfig } from '../../config';\nimport { MakeTransferArgs } from '../../types';\nimport { WidgetType } from '../../types/widget';\n\nexport type Props = Omit<\n WidgetSwapProps | WidgetDepositProps | WidgetWithdrawProps,\n 'onMsg' | 'makeTransfer'\n> & {\n onMsg?: (msg: Msg, widgetType: WidgetType) => void;\n makeTransfer?: (args: MakeTransferArgs, widgetType: WidgetType) => void;\n};\n\ntype Msg = SwapMsg | DepositMsg | WithdrawMsg;\n\nexport const WidgetContent = ({ onMsg, makeTransfer, ...restProps }: Props) => {\n const [isTabsVisible, setIsTabsVisible] = useState(true);\n const [activeTab, setActiveTab] = useState<WidgetTab>('swap');\n const { enableAccountAbstraction } = useConfig();\n\n const switchTab = (tab: WidgetTab) => {\n setActiveTab(tab);\n };\n\n const handleMsg = <T extends Msg>(msg: T, widgetType: WidgetType) => {\n if (msg.type === 'on_tokens_modal_toggled') {\n setIsTabsVisible(!msg.isOpen);\n }\n\n if (msg.type === 'on_select_token') {\n setIsTabsVisible(true);\n }\n\n onMsg?.(msg, widgetType);\n };\n\n useEffect(() => {\n if (!enableAccountAbstraction) {\n setActiveTab('swap');\n }\n }, [enableAccountAbstraction]);\n\n return (\n <>\n {enableAccountAbstraction && isTabsVisible && (\n <WidgetTabs activeTab={activeTab} onSelect={switchTab} />\n )}\n\n {(() => {\n switch (activeTab) {\n case 'swap': {\n return (\n <WidgetSwapContent\n {...restProps}\n makeTransfer={(args) => makeTransfer?.(args, 'swap')}\n onMsg={(msg) => {\n handleMsg(msg, 'swap');\n }}\n />\n );\n }\n\n case 'deposit': {\n return (\n <WidgetDepositContent\n {...restProps}\n makeTransfer={(args) => makeTransfer?.(args, 'deposit')}\n onMsg={(msg) => {\n handleMsg(msg, 'deposit');\n }}\n />\n );\n }\n\n case 'withdraw': {\n return (\n <WidgetWithdrawContent\n {...restProps}\n makeTransfer={(args) => makeTransfer?.(args, 'withdraw')}\n onMsg={(msg) => {\n handleMsg(msg, 'withdraw');\n }}\n />\n );\n }\n\n default:\n return null;\n }\n })()}\n </>\n );\n};\n"],"names":["WidgetContent","onMsg","makeTransfer","restProps","isTabsVisible","setIsTabsVisible","useState","activeTab","setActiveTab","enableAccountAbstraction","useConfig","switchTab","tab","handleMsg","msg","widgetType","useEffect","jsxs","Fragment","jsx","WidgetTabs","WidgetSwapContent","args","WidgetDepositContent","WidgetWithdrawContent"],"mappings":";;;;;;;AAiCO,MAAMA,IAAgB,CAAC,EAAE,OAAAC,GAAO,cAAAC,GAAc,GAAGC,QAAuB;AAC7E,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAS,EAAI,GACjD,CAACC,GAAWC,CAAY,IAAIF,EAAoB,MAAM,GACtD,EAAE,0BAAAG,EAAA,IAA6BC,EAAA,GAE/BC,IAAY,CAACC,MAAmB;AACpC,IAAAJ,EAAaI,CAAG;AAAA,EAClB,GAEMC,IAAY,CAAgBC,GAAQC,MAA2B;AACnE,IAAID,EAAI,SAAS,6BACfT,EAAiB,CAACS,EAAI,MAAM,GAG1BA,EAAI,SAAS,qBACfT,EAAiB,EAAI,GAGvBJ,IAAQa,GAAKC,CAAU;AAAA,EACzB;AAEA,SAAAC,EAAU,MAAM;AACd,IAAKP,KACHD,EAAa,MAAM;AAAA,EAEvB,GAAG,CAACC,CAAwB,CAAC,GAG3B,gBAAAQ,EAAAC,GAAA,EACG,UAAA;AAAA,IAAAT,KAA4BL,KAC3B,gBAAAe,EAACC,GAAA,EAAW,WAAAb,GAAsB,UAAUI,GAAW;AAAA,KAGvD,MAAM;AACN,cAAQJ,GAAA;AAAA,QACN,KAAK;AACH,iBACE,gBAAAY;AAAA,YAACE;AAAA,YAAA;AAAA,cACE,GAAGlB;AAAA,cACJ,cAAc,CAACmB,MAASpB,IAAeoB,GAAM,MAAM;AAAA,cACnD,OAAO,CAACR,MAAQ;AACd,gBAAAD,EAAUC,GAAK,MAAM;AAAA,cACvB;AAAA,YAAA;AAAA,UAAA;AAAA,QAKN,KAAK;AACH,iBACE,gBAAAK;AAAA,YAACI;AAAA,YAAA;AAAA,cACE,GAAGpB;AAAA,cACJ,cAAc,CAACmB,MAASpB,IAAeoB,GAAM,SAAS;AAAA,cACtD,OAAO,CAACR,MAAQ;AACd,gBAAAD,EAAUC,GAAK,SAAS;AAAA,cAC1B;AAAA,YAAA;AAAA,UAAA;AAAA,QAKN,KAAK;AACH,iBACE,gBAAAK;AAAA,YAACK;AAAA,YAAA;AAAA,cACE,GAAGrB;AAAA,cACJ,cAAc,CAACmB,MAASpB,IAAeoB,GAAM,UAAU;AAAA,cACvD,OAAO,CAACR,MAAQ;AACd,gBAAAD,EAAUC,GAAK,UAAU;AAAA,cAC3B;AAAA,YAAA;AAAA,UAAA;AAAA,QAKN;AACE,iBAAO;AAAA,MAAA;AAAA,IAEb,GAAA;AAAA,EAAG,GACL;AAEJ;"}
@@ -3,7 +3,7 @@ import { useState as y, useEffect as p, useCallback as B } from "react";
3
3
  import { useTokenModal as R } from "../../hooks/useTokenModal.js";
4
4
  import { useTypedTranslation as A } from "../../localisation.js";
5
5
  import { WidgetDepositSkeleton as b } from "./WidgetDepositSkeleton.js";
6
- import { b as F, u as q, y as j, n as N, c as O, p as Q, o as U, S as K } from "../../config-0TjbjBo5.js";
6
+ import { b as F, u as q, y as j, n as N, c as O, p as Q, o as U, S as K } from "../../config-Bg5hUlJL.js";
7
7
  import "@tanstack/react-query";
8
8
  import "@headlessui/react";
9
9
  import "@material-symbols-svg/react-rounded/icons/chevron-left";
@@ -1,7 +1,7 @@
1
1
  import { jsxs as o, jsx as e } from "react/jsx-runtime";
2
2
  import a from "clsx";
3
3
  import { SkeletonBox as s } from "../../components/SkeletonBox.js";
4
- import { y as i } from "../../config-0TjbjBo5.js";
4
+ import { y as i } from "../../config-Bg5hUlJL.js";
5
5
  const p = () => {
6
6
  const { hideTokenInputHeadings: l } = i();
7
7
  return /* @__PURE__ */ o("div", { className: "w-full gap-sw-xl relative flex flex-col", children: [
@@ -3,7 +3,7 @@ import { useState as b, useEffect as w } from "react";
3
3
  import { useTokenModal as D } from "../../hooks/useTokenModal.js";
4
4
  import { WidgetSwapSkeleton as T } from "./WidgetSwapSkeleton.js";
5
5
  import { useTypedTranslation as F } from "../../localisation.js";
6
- import { b as N, u as O, y as Q, n as j, c as q, p as y, o as U, S as K } from "../../config-0TjbjBo5.js";
6
+ import { b as N, u as O, y as Q, n as j, c as q, p as y, o as U, S as K } from "../../config-Bg5hUlJL.js";
7
7
  import "@tanstack/react-query";
8
8
  import "@headlessui/react";
9
9
  import "@material-symbols-svg/react-rounded/icons/chevron-left";
@@ -1,7 +1,7 @@
1
1
  import { jsxs as a, jsx as l } from "react/jsx-runtime";
2
2
  import o from "clsx";
3
3
  import { SkeletonBox as s } from "../../components/SkeletonBox.js";
4
- import { y as i } from "../../config-0TjbjBo5.js";
4
+ import { y as i } from "../../config-Bg5hUlJL.js";
5
5
  const m = () => {
6
6
  const { hideTokenInputHeadings: e } = i();
7
7
  return /* @__PURE__ */ a("div", { className: "w-full gap-sw-lg relative flex flex-col", children: [
@@ -3,7 +3,7 @@ import { useState as w, useEffect as _ } from "react";
3
3
  import { useTokenModal as D } from "../../hooks/useTokenModal.js";
4
4
  import { WidgetWithdrawSkeleton as b } from "./WidgetWithdrawSkeleton.js";
5
5
  import { useTypedTranslation as N } from "../../localisation.js";
6
- import { b as O, u as Q, y as j, n as q, c as U, p as y, o as F, S as K } from "../../config-0TjbjBo5.js";
6
+ import { b as O, u as Q, y as j, n as q, c as U, p as y, o as F, S as K } from "../../config-Bg5hUlJL.js";
7
7
  import "@tanstack/react-query";
8
8
  import "@headlessui/react";
9
9
  import "@material-symbols-svg/react-rounded/icons/chevron-left";
@@ -1,7 +1,7 @@
1
1
  import { jsxs as a, jsx as e } from "react/jsx-runtime";
2
2
  import o from "clsx";
3
3
  import { SkeletonBox as l } from "../../components/SkeletonBox.js";
4
- import { y as x } from "../../config-0TjbjBo5.js";
4
+ import { y as x } from "../../config-Bg5hUlJL.js";
5
5
  const p = () => {
6
6
  const { hideTokenInputHeadings: s } = x();
7
7
  return /* @__PURE__ */ a("div", { className: "w-full gap-sw-xl relative flex flex-col", children: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurora-is-near/intents-swap-widget",
3
- "version": "3.23.0",
3
+ "version": "3.24.0",
4
4
  "description": "Provides components and hooks to build your own Intents swap widget",
5
5
  "author": "Maksim Vashchuk",
6
6
  "license": "MIT",
@@ -0,0 +1 @@
1
+ export type WidgetType = 'swap' | 'deposit' | 'withdraw';
@@ -18,19 +18,20 @@ import {
18
18
  Msg as WithdrawMsg,
19
19
  } from '../WidgetWithdraw/WidgetWithdrawContent';
20
20
  import { useConfig } from '../../config';
21
-
22
- type WidgetType = 'swap' | 'deposit' | 'withdraw';
21
+ import { MakeTransferArgs } from '../../types';
22
+ import { WidgetType } from '../../types/widget';
23
23
 
24
24
  export type Props = Omit<
25
25
  WidgetSwapProps | WidgetDepositProps | WidgetWithdrawProps,
26
- 'onMsg'
26
+ 'onMsg' | 'makeTransfer'
27
27
  > & {
28
- onMsg?: (msg: Msg, widget: WidgetType) => void;
28
+ onMsg?: (msg: Msg, widgetType: WidgetType) => void;
29
+ makeTransfer?: (args: MakeTransferArgs, widgetType: WidgetType) => void;
29
30
  };
30
31
 
31
32
  type Msg = SwapMsg | DepositMsg | WithdrawMsg;
32
33
 
33
- export const WidgetContent = ({ onMsg, ...restProps }: Props) => {
34
+ export const WidgetContent = ({ onMsg, makeTransfer, ...restProps }: Props) => {
34
35
  const [isTabsVisible, setIsTabsVisible] = useState(true);
35
36
  const [activeTab, setActiveTab] = useState<WidgetTab>('swap');
36
37
  const { enableAccountAbstraction } = useConfig();
@@ -69,6 +70,7 @@ export const WidgetContent = ({ onMsg, ...restProps }: Props) => {
69
70
  return (
70
71
  <WidgetSwapContent
71
72
  {...restProps}
73
+ makeTransfer={(args) => makeTransfer?.(args, 'swap')}
72
74
  onMsg={(msg) => {
73
75
  handleMsg(msg, 'swap');
74
76
  }}
@@ -80,6 +82,7 @@ export const WidgetContent = ({ onMsg, ...restProps }: Props) => {
80
82
  return (
81
83
  <WidgetDepositContent
82
84
  {...restProps}
85
+ makeTransfer={(args) => makeTransfer?.(args, 'deposit')}
83
86
  onMsg={(msg) => {
84
87
  handleMsg(msg, 'deposit');
85
88
  }}
@@ -91,6 +94,7 @@ export const WidgetContent = ({ onMsg, ...restProps }: Props) => {
91
94
  return (
92
95
  <WidgetWithdrawContent
93
96
  {...restProps}
97
+ makeTransfer={(args) => makeTransfer?.(args, 'withdraw')}
94
98
  onMsg={(msg) => {
95
99
  handleMsg(msg, 'withdraw');
96
100
  }}