@aurora-is-near/intents-swap-widget 3.21.0 → 3.22.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 (136) hide show
  1. package/dist/components/WidgetContainer.js +23 -14
  2. package/dist/components/WidgetContainer.js.map +1 -1
  3. package/dist/components/WidgetTabs.d.ts +8 -0
  4. package/dist/components/WidgetTabs.js +20 -0
  5. package/dist/components/WidgetTabs.js.map +1 -0
  6. package/dist/{config-CyBNYvb1.js → config-Opy5ppbU.js} +2 -2
  7. package/dist/{config-CyBNYvb1.js.map → config-Opy5ppbU.js.map} +1 -1
  8. package/dist/config.d.ts +1 -0
  9. package/dist/config.js +1 -1
  10. package/dist/errors.js +1 -1
  11. package/dist/ext/alchemy/index.js +1 -1
  12. package/dist/ext/index.js +1 -1
  13. package/dist/features/BalanceRpcLoader/TokenBalanceLoader.js +1 -1
  14. package/dist/features/BalanceRpcLoader/index.js +1 -1
  15. package/dist/features/BalanceRpcLoader/useTokenBalanceRpc.js +1 -1
  16. package/dist/features/ChainsDropdown/index.js +1 -1
  17. package/dist/features/ChainsSelector/index.js +1 -1
  18. package/dist/features/DepositMethodSwitcher.js +1 -1
  19. package/dist/features/ErrorBoundary.js +1 -1
  20. package/dist/features/ExternalDeposit.js +1 -1
  21. package/dist/features/SendAddress/index.js +1 -1
  22. package/dist/features/SendAddress/useNotification.js +1 -1
  23. package/dist/features/SubmitButton/index.js +1 -1
  24. package/dist/features/SuccessScreen/index.js +1 -1
  25. package/dist/features/SuccessScreen/useSummaryItemsCount.js +1 -1
  26. package/dist/features/SwapDirectionSwitcher.d.ts +1 -5
  27. package/dist/features/SwapDirectionSwitcher.js +10 -10
  28. package/dist/features/SwapDirectionSwitcher.js.map +1 -1
  29. package/dist/features/SwapQuote/SwapQuote.js +1 -1
  30. package/dist/features/SwapQuote/index.js +1 -1
  31. package/dist/features/TokenInput/TokenInput.js +1 -1
  32. package/dist/features/TokenInput/TokenInputEmpty.js +1 -1
  33. package/dist/features/TokenInput/TokenInputSource.js +1 -1
  34. package/dist/features/TokenInput/TokenInputTarget.js +1 -1
  35. package/dist/features/TokenInput/WalletBalance.js +1 -1
  36. package/dist/features/TokenInput/hooks/index.js +1 -1
  37. package/dist/features/TokenInput/hooks/useTokenInputBalance.js +1 -1
  38. package/dist/features/TokenInput/index.js +1 -1
  39. package/dist/features/TokensList/TokenItem.js +1 -1
  40. package/dist/features/TokensList/TokensList.js +1 -1
  41. package/dist/features/TokensList/index.js +1 -1
  42. package/dist/features/TokensModal.js +1 -1
  43. package/dist/features/WalletCompatibilityCheck/WalletCompatibilityModal.js +1 -1
  44. package/dist/features/WalletCompatibilityCheck/index.js +1 -1
  45. package/dist/features/index.js +1 -1
  46. package/dist/hooks/index.js +1 -1
  47. package/dist/hooks/useAllTokens.js +1 -1
  48. package/dist/hooks/useChains.js +1 -1
  49. package/dist/hooks/useCompatibilityCheck.js +1 -1
  50. package/dist/hooks/useDefaultToken.js +1 -1
  51. package/dist/hooks/useExternalDepositStatus/index.js +1 -1
  52. package/dist/hooks/useExternalDepositStatus/usePoaExternalDepositStatus.js +1 -1
  53. package/dist/hooks/useIntentsBalance.js +1 -1
  54. package/dist/hooks/useIsCompatibilityCheckRequired.js +1 -1
  55. package/dist/hooks/useMakeDepositAddress.js +1 -1
  56. package/dist/hooks/useMakeIntentsTransfer.js +1 -1
  57. package/dist/hooks/useMakeNEARFtTransferCall.js +1 -1
  58. package/dist/hooks/useMakeQuote.js +1 -1
  59. package/dist/hooks/useMakeQuoteTransfer.js +1 -1
  60. package/dist/hooks/useMakeTransfer.js +1 -1
  61. package/dist/hooks/useMergedBalance.js +1 -1
  62. package/dist/hooks/useSwitchChain.js +1 -1
  63. package/dist/hooks/useTheme.js +1 -1
  64. package/dist/hooks/useTokenInputPair.js +1 -1
  65. package/dist/hooks/useTokens.js +1 -1
  66. package/dist/hooks/useTokensFiltered.js +1 -1
  67. package/dist/hooks/useTokensIntentsUnique.js +1 -1
  68. package/dist/index.js +21 -19
  69. package/dist/index.js.map +1 -1
  70. package/dist/machine/effects/index.js +1 -1
  71. package/dist/machine/effects/useAlchemyBalanceEffect.js +1 -1
  72. package/dist/machine/effects/useBalancesUpdateEffect.js +1 -1
  73. package/dist/machine/effects/useMakeQuoteEffect.js +1 -1
  74. package/dist/machine/effects/useSelectedTokensEffect.js +1 -1
  75. package/dist/machine/effects/useSetTokenBalanceEffect.js +1 -1
  76. package/dist/machine/effects/useSetTokenIntentsTargetEffect.js +1 -1
  77. package/dist/machine/effects/useWalletConnEffect.js +1 -1
  78. package/dist/machine/events/index.js +1 -1
  79. package/dist/machine/events/tokenSelect.js +1 -1
  80. package/dist/machine/events/validateInputAndMoveTo.js +1 -1
  81. package/dist/machine/events/validateInputs.js +1 -1
  82. package/dist/machine/index.js +1 -1
  83. package/dist/machine/snap.js +1 -1
  84. package/dist/machine/subscriptions/checkers/isSendAddressAsConnected.js +1 -1
  85. package/dist/machine/subscriptions/index.js +1 -1
  86. package/dist/styles.css +1 -1
  87. package/dist/theme/ThemeProvider.js +1 -1
  88. package/dist/types/config.d.ts +1 -0
  89. package/dist/utils/intents/signers/near.js +1 -1
  90. package/dist/utils/intents/signers/privy.js +1 -1
  91. package/dist/utils/near/getNearNep141StorageBalance.js +1 -1
  92. package/dist/widgets/Widget/WidgetContent.d.ts +10 -0
  93. package/dist/widgets/Widget/WidgetContent.js +56 -0
  94. package/dist/widgets/Widget/WidgetContent.js.map +1 -0
  95. package/dist/widgets/Widget/index.d.ts +4 -0
  96. package/dist/widgets/Widget/index.js +23 -0
  97. package/dist/widgets/Widget/index.js.map +1 -0
  98. package/dist/widgets/WidgetDeposit/WidgetDepositContent.d.ts +1 -2
  99. package/dist/widgets/WidgetDeposit/WidgetDepositContent.js +1 -1
  100. package/dist/widgets/WidgetDeposit/WidgetDepositContent.js.map +1 -1
  101. package/dist/widgets/WidgetDeposit/WidgetDepositSkeleton.js +1 -1
  102. package/dist/widgets/WidgetDeposit/index.js +14 -15
  103. package/dist/widgets/WidgetDeposit/index.js.map +1 -1
  104. package/dist/widgets/WidgetSwap/WidgetSwapContent.d.ts +3 -6
  105. package/dist/widgets/WidgetSwap/WidgetSwapContent.js +43 -44
  106. package/dist/widgets/WidgetSwap/WidgetSwapContent.js.map +1 -1
  107. package/dist/widgets/WidgetSwap/WidgetSwapSkeleton.js +1 -1
  108. package/dist/widgets/WidgetSwap/index.js +14 -15
  109. package/dist/widgets/WidgetSwap/index.js.map +1 -1
  110. package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.d.ts +1 -2
  111. package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js +1 -1
  112. package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js.map +1 -1
  113. package/dist/widgets/WidgetWithdraw/WidgetWithdrawSkeleton.js +1 -1
  114. package/dist/widgets/WidgetWithdraw/index.js +12 -13
  115. package/dist/widgets/WidgetWithdraw/index.js.map +1 -1
  116. package/dist/widgets/index.d.ts +1 -0
  117. package/dist/widgets/index.js +8 -6
  118. package/dist/widgets/index.js.map +1 -1
  119. package/package.json +1 -1
  120. package/src/components/WidgetContainer.tsx +11 -1
  121. package/src/components/WidgetTabs.tsx +33 -0
  122. package/src/features/SwapDirectionSwitcher.tsx +4 -6
  123. package/src/types/config.ts +1 -0
  124. package/src/widgets/Widget/WidgetContent.tsx +99 -0
  125. package/src/widgets/Widget/index.tsx +23 -0
  126. package/src/widgets/WidgetDeposit/WidgetDepositContent.tsx +1 -1
  127. package/src/widgets/WidgetDeposit/index.tsx +7 -10
  128. package/src/widgets/WidgetSwap/WidgetSwapContent.tsx +3 -6
  129. package/src/widgets/WidgetSwap/index.tsx +7 -10
  130. package/src/widgets/WidgetWithdraw/WidgetWithdrawContent.tsx +1 -1
  131. package/src/widgets/WidgetWithdraw/index.tsx +7 -10
  132. package/src/widgets/index.ts +1 -0
  133. package/dist/components/BaseContainer.d.ts +0 -2
  134. package/dist/components/BaseContainer.js +0 -23
  135. package/dist/components/BaseContainer.js.map +0 -1
  136. package/src/components/BaseContainer.tsx +0 -19
@@ -1,24 +1,23 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { BaseContainer as m } from "../../components/BaseContainer.js";
3
- import { WidgetContainer as d } from "../../components/WidgetContainer.js";
4
- import { WidgetWithdrawContent as a } from "./WidgetWithdrawContent.js";
5
- const c = ({
6
- HeaderComponent: t,
1
+ import { jsx as t } from "react/jsx-runtime";
2
+ import { WidgetContainer as m } from "../../components/WidgetContainer.js";
3
+ import { WidgetWithdrawContent as n } from "./WidgetWithdrawContent.js";
4
+ const f = ({
5
+ HeaderComponent: r,
7
6
  FooterComponent: i,
8
7
  isFullPage: o,
9
8
  className: e,
10
- ...n
11
- }) => /* @__PURE__ */ r(m, { children: /* @__PURE__ */ r(
12
- d,
9
+ ...d
10
+ }) => /* @__PURE__ */ t(
11
+ m,
13
12
  {
14
13
  className: e,
15
14
  isFullPage: o,
16
- HeaderComponent: t,
15
+ HeaderComponent: r,
17
16
  FooterComponent: i,
18
- children: /* @__PURE__ */ r(a, { ...n })
17
+ children: /* @__PURE__ */ t(n, { ...d })
19
18
  }
20
- ) });
19
+ );
21
20
  export {
22
- c as WidgetWithdraw
21
+ f as WidgetWithdraw
23
22
  };
24
23
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/widgets/WidgetWithdraw/index.tsx"],"sourcesContent":["import { BaseContainer } from '../../components/BaseContainer';\nimport {\n WidgetContainer,\n WidgetContainerProps,\n} from '../../components/WidgetContainer';\nimport { Props, WidgetWithdrawContent } from './WidgetWithdrawContent';\n\nexport type WidgetWithdrawProps = Props &\n Omit<WidgetContainerProps, 'children'>;\n\nexport const WidgetWithdraw = ({\n HeaderComponent,\n FooterComponent,\n isFullPage,\n className,\n ...widgetProps\n}: WidgetWithdrawProps) => (\n <BaseContainer>\n <WidgetContainer\n className={className}\n isFullPage={isFullPage}\n HeaderComponent={HeaderComponent}\n FooterComponent={FooterComponent}>\n <WidgetWithdrawContent {...widgetProps} />\n </WidgetContainer>\n </BaseContainer>\n);\n"],"names":["WidgetWithdraw","HeaderComponent","FooterComponent","isFullPage","className","widgetProps","BaseContainer","jsx","WidgetContainer","WidgetWithdrawContent"],"mappings":";;;;AAUO,MAAMA,IAAiB,CAAC;AAAA,EAC7B,iBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,wBACGC,GAAA,EACC,UAAA,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,WAAAJ;AAAA,IACA,YAAAD;AAAA,IACA,iBAAAF;AAAA,IACA,iBAAAC;AAAA,IACA,UAAA,gBAAAK,EAACE,GAAA,EAAuB,GAAGJ,EAAA,CAAa;AAAA,EAAA;AAC1C,EAAA,CACF;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/widgets/WidgetWithdraw/index.tsx"],"sourcesContent":["import {\n WidgetContainer,\n WidgetContainerProps,\n} from '../../components/WidgetContainer';\nimport { Props, WidgetWithdrawContent } from './WidgetWithdrawContent';\n\nexport type WidgetWithdrawProps = Props &\n Omit<WidgetContainerProps, 'children'>;\n\nexport const WidgetWithdraw = ({\n HeaderComponent,\n FooterComponent,\n isFullPage,\n className,\n ...widgetProps\n}: WidgetWithdrawProps) => (\n <WidgetContainer\n className={className}\n isFullPage={isFullPage}\n HeaderComponent={HeaderComponent}\n FooterComponent={FooterComponent}>\n <WidgetWithdrawContent {...widgetProps} />\n </WidgetContainer>\n);\n"],"names":["WidgetWithdraw","HeaderComponent","FooterComponent","isFullPage","className","widgetProps","jsx","WidgetContainer","WidgetWithdrawContent"],"mappings":";;;AASO,MAAMA,IAAiB,CAAC;AAAA,EAC7B,iBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,MACE,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,WAAAH;AAAA,IACA,YAAAD;AAAA,IACA,iBAAAF;AAAA,IACA,iBAAAC;AAAA,IACA,UAAA,gBAAAI,EAACE,GAAA,EAAuB,GAAGH,EAAA,CAAa;AAAA,EAAA;AAC1C;"}
@@ -1,3 +1,4 @@
1
+ export { Widget } from './Widget';
1
2
  export { WidgetSwap } from './WidgetSwap';
2
3
  export { WidgetDeposit } from './WidgetDeposit';
3
4
  export { WidgetWithdraw } from './WidgetWithdraw';
@@ -1,9 +1,11 @@
1
- import { WidgetSwap as o } from "./WidgetSwap/index.js";
2
- import { WidgetDeposit as i } from "./WidgetDeposit/index.js";
3
- import { WidgetWithdraw as d } from "./WidgetWithdraw/index.js";
1
+ import { Widget as o } from "./Widget/index.js";
2
+ import { WidgetSwap as i } from "./WidgetSwap/index.js";
3
+ import { WidgetDeposit as d } from "./WidgetDeposit/index.js";
4
+ import { WidgetWithdraw as f } from "./WidgetWithdraw/index.js";
4
5
  export {
5
- i as WidgetDeposit,
6
- o as WidgetSwap,
7
- d as WidgetWithdraw
6
+ o as Widget,
7
+ d as WidgetDeposit,
8
+ i as WidgetSwap,
9
+ f as WidgetWithdraw
8
10
  };
9
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurora-is-near/intents-swap-widget",
3
- "version": "3.21.0",
3
+ "version": "3.22.0",
4
4
  "description": "Provides components and hooks to build your own Intents swap widget",
5
5
  "author": "Maksim Vashchuk",
6
6
  "license": "MIT",
@@ -45,7 +45,17 @@ export const WidgetContainer = ({
45
45
  );
46
46
 
47
47
  if (!isFullPage) {
48
- return jsx;
48
+ return (
49
+ <div
50
+ className={cn(
51
+ 'relative w-auto mx-auto',
52
+ theme?.showContainer
53
+ ? 'max-w-[496px] sm:w-[496px] p-csw-2xl bg-sw-container rounded-sw-lg'
54
+ : 'max-w-[456px] sm:w-[456px]',
55
+ )}>
56
+ {jsx}
57
+ </div>
58
+ );
49
59
  }
50
60
 
51
61
  return (
@@ -0,0 +1,33 @@
1
+ import { cn } from '../utils';
2
+
3
+ const TABS = ['swap', 'deposit', 'withdraw'] as const;
4
+
5
+ export type WidgetTab = (typeof TABS)[number];
6
+
7
+ type Props = {
8
+ activeTab: WidgetTab;
9
+ onSelect: (tab: WidgetTab) => void;
10
+ };
11
+
12
+ export const WidgetTabs = ({ activeTab, onSelect }: Props) => {
13
+ return (
14
+ <nav className="space-x-[10px] mb-sw-2xl w-full">
15
+ {TABS.map((tab) => {
16
+ const isActive = activeTab === tab;
17
+
18
+ return (
19
+ <button
20
+ onClick={() => onSelect(tab)}
21
+ className={cn(
22
+ 'rounded-sw-md text-sw-label-md cursor-pointer py-[10px] px-sw-lg',
23
+ isActive
24
+ ? 'bg-sw-gray-50 text-sw-gray-950'
25
+ : 'bg-transparent text-sw-gray-200',
26
+ )}>
27
+ {tab.charAt(0).toUpperCase() + tab.slice(1)}
28
+ </button>
29
+ );
30
+ })}
31
+ </nav>
32
+ );
33
+ };
@@ -1,18 +1,16 @@
1
+ import { useConfig } from '../config';
1
2
  import { DirectionSwitcher } from '@/components/DirectionSwitcher';
2
3
  import { useUnsafeSnapshot } from '@/machine/snap';
3
4
  import { fireEvent } from '@/machine';
4
5
 
5
- type Props = {
6
- disabled?: boolean;
7
- };
8
-
9
- export const SwapDirectionSwitcher = ({ disabled }: Props) => {
6
+ export const SwapDirectionSwitcher = () => {
10
7
  const { ctx } = useUnsafeSnapshot();
8
+ const { lockSwapDirection } = useConfig();
11
9
 
12
10
  return (
13
11
  <DirectionSwitcher
14
12
  isLoading={ctx.quoteStatus === 'pending'}
15
- isEnabled={!disabled && !!(ctx.sourceToken && ctx.targetToken)}
13
+ isEnabled={!lockSwapDirection && !!(ctx.sourceToken && ctx.targetToken)}
16
14
  onClick={() => fireEvent('tokenSelectRotate', null)}
17
15
  />
18
16
  );
@@ -74,4 +74,5 @@ export type WidgetConfig = {
74
74
  hideSendAddress?: boolean;
75
75
  hideTokenInputHeadings?: boolean;
76
76
  themeParentElementSelector?: string;
77
+ lockSwapDirection?: boolean;
77
78
  };
@@ -0,0 +1,99 @@
1
+ 'use client';
2
+
3
+ import { useState } from 'react';
4
+ import { WidgetTab, WidgetTabs } from '../../components/WidgetTabs';
5
+ import {
6
+ Msg as SwapMsg,
7
+ WidgetSwapContent,
8
+ Props as WidgetSwapProps,
9
+ } from '../WidgetSwap/WidgetSwapContent';
10
+ import {
11
+ Msg as DepositMsg,
12
+ WidgetDepositContent,
13
+ Props as WidgetDepositProps,
14
+ } from '../WidgetDeposit/WidgetDepositContent';
15
+ import {
16
+ WidgetWithdrawContent,
17
+ Props as WidgetWithdrawProps,
18
+ Msg as WithdrawMsg,
19
+ } from '../WidgetWithdraw/WidgetWithdrawContent';
20
+
21
+ type WidgetType = 'swap' | 'deposit' | 'withdraw';
22
+
23
+ export type Props = Omit<
24
+ WidgetSwapProps | WidgetDepositProps | WidgetWithdrawProps,
25
+ 'onMsg'
26
+ > & {
27
+ onMsg?: (msg: Msg, widget: WidgetType) => void;
28
+ };
29
+
30
+ type Msg = SwapMsg | DepositMsg | WithdrawMsg;
31
+
32
+ export const WidgetContent = ({ onMsg, ...restProps }: Props) => {
33
+ const [isTabsVisible, setIsTabsVisible] = useState(true);
34
+ const [activeTab, setActiveTab] = useState<WidgetTab>('swap');
35
+
36
+ const switchTab = (tab: WidgetTab) => {
37
+ setActiveTab(tab);
38
+ };
39
+
40
+ const handleMsg = <T extends Msg>(msg: T, widgetType: WidgetType) => {
41
+ if (msg.type === 'on_tokens_modal_toggled') {
42
+ setIsTabsVisible(!msg.isOpen);
43
+ }
44
+
45
+ if (msg.type === 'on_select_token') {
46
+ setIsTabsVisible(true);
47
+ }
48
+
49
+ onMsg?.(msg, widgetType);
50
+ };
51
+
52
+ return (
53
+ <>
54
+ {isTabsVisible && (
55
+ <WidgetTabs activeTab={activeTab} onSelect={switchTab} />
56
+ )}
57
+
58
+ {(() => {
59
+ switch (activeTab) {
60
+ case 'swap': {
61
+ return (
62
+ <WidgetSwapContent
63
+ {...restProps}
64
+ onMsg={(msg) => {
65
+ handleMsg(msg, 'swap');
66
+ }}
67
+ />
68
+ );
69
+ }
70
+
71
+ case 'deposit': {
72
+ return (
73
+ <WidgetDepositContent
74
+ {...restProps}
75
+ onMsg={(msg) => {
76
+ handleMsg(msg, 'deposit');
77
+ }}
78
+ />
79
+ );
80
+ }
81
+
82
+ case 'withdraw': {
83
+ return (
84
+ <WidgetWithdrawContent
85
+ {...restProps}
86
+ onMsg={(msg) => {
87
+ handleMsg(msg, 'withdraw');
88
+ }}
89
+ />
90
+ );
91
+ }
92
+
93
+ default:
94
+ return null;
95
+ }
96
+ })()}
97
+ </>
98
+ );
99
+ };
@@ -0,0 +1,23 @@
1
+ import {
2
+ WidgetContainer,
3
+ WidgetContainerProps,
4
+ } from '../../components/WidgetContainer';
5
+ import { Props, WidgetContent } from './WidgetContent';
6
+
7
+ export type WidgetProps = Props & Omit<WidgetContainerProps, 'children'>;
8
+
9
+ export const Widget = ({
10
+ HeaderComponent,
11
+ FooterComponent,
12
+ isFullPage,
13
+ className,
14
+ ...widgetProps
15
+ }: WidgetProps) => (
16
+ <WidgetContainer
17
+ className={className}
18
+ isFullPage={isFullPage}
19
+ HeaderComponent={HeaderComponent}
20
+ FooterComponent={FooterComponent}>
21
+ <WidgetContent {...widgetProps} />
22
+ </WidgetContainer>
23
+ );
@@ -32,7 +32,7 @@ import { isDebug, notReachable } from '@/utils';
32
32
 
33
33
  import type { Token, TransferResult } from '@/types';
34
34
 
35
- type Msg =
35
+ export type Msg =
36
36
  | { type: 'on_select_token'; token: Token; variant: TokenInputType }
37
37
  | { type: 'on_change_deposit_type'; isExternal: boolean }
38
38
  | { type: 'on_transfer_success' }
@@ -1,4 +1,3 @@
1
- import { BaseContainer } from '../../components/BaseContainer';
2
1
  import {
3
2
  WidgetContainer,
4
3
  WidgetContainerProps,
@@ -14,13 +13,11 @@ export const WidgetDeposit = ({
14
13
  className,
15
14
  ...widgetProps
16
15
  }: WidgetDepositProps) => (
17
- <BaseContainer>
18
- <WidgetContainer
19
- className={className}
20
- isFullPage={isFullPage}
21
- HeaderComponent={HeaderComponent}
22
- FooterComponent={FooterComponent}>
23
- <WidgetDepositContent {...widgetProps} />
24
- </WidgetContainer>
25
- </BaseContainer>
16
+ <WidgetContainer
17
+ className={className}
18
+ isFullPage={isFullPage}
19
+ HeaderComponent={HeaderComponent}
20
+ FooterComponent={FooterComponent}>
21
+ <WidgetDepositContent {...widgetProps} />
22
+ </WidgetContainer>
26
23
  );
@@ -32,21 +32,18 @@ import { isDebug, notReachable } from '@/utils';
32
32
 
33
33
  import type { Token, TransferResult } from '@/types';
34
34
 
35
- type Msg =
35
+ export type Msg =
36
36
  | { type: 'on_tokens_modal_toggled'; isOpen: boolean }
37
37
  | { type: 'on_select_token'; token: Token; variant: TokenInputType }
38
38
  | { type: 'on_transfer_success' };
39
39
 
40
- export type Props = CommonWidgetProps<Msg> & {
41
- isOneWay?: boolean;
42
- };
40
+ export type Props = CommonWidgetProps<Msg>;
43
41
 
44
42
  export const WidgetSwapContent = ({
45
43
  providers,
46
44
  makeTransfer,
47
45
  onMsg,
48
46
  isLoading,
49
- isOneWay,
50
47
  }: Props) => {
51
48
  const { ctx } = useUnsafeSnapshot();
52
49
  const { isDirectNearTokenWithdrawal } = useComputedSnapshot();
@@ -217,7 +214,7 @@ export const WidgetSwapContent = ({
217
214
  }}
218
215
  />
219
216
 
220
- <SwapDirectionSwitcher disabled={isOneWay} />
217
+ <SwapDirectionSwitcher />
221
218
 
222
219
  <TokenInput.Target
223
220
  heading={t('tokenInput.heading.target.swap', 'Buy')}
@@ -1,4 +1,3 @@
1
- import { BaseContainer } from '../../components/BaseContainer';
2
1
  import {
3
2
  WidgetContainer,
4
3
  WidgetContainerProps,
@@ -14,13 +13,11 @@ export const WidgetSwap = ({
14
13
  className,
15
14
  ...widgetProps
16
15
  }: WidgetSwapProps) => (
17
- <BaseContainer>
18
- <WidgetContainer
19
- className={className}
20
- isFullPage={isFullPage}
21
- HeaderComponent={HeaderComponent}
22
- FooterComponent={FooterComponent}>
23
- <WidgetSwapContent {...widgetProps} />
24
- </WidgetContainer>
25
- </BaseContainer>
16
+ <WidgetContainer
17
+ className={className}
18
+ isFullPage={isFullPage}
19
+ HeaderComponent={HeaderComponent}
20
+ FooterComponent={FooterComponent}>
21
+ <WidgetSwapContent {...widgetProps} />
22
+ </WidgetContainer>
26
23
  );
@@ -31,7 +31,7 @@ import { isDebug, notReachable } from '@/utils';
31
31
 
32
32
  import type { Token, TransferResult } from '@/types';
33
33
 
34
- type Msg =
34
+ export type Msg =
35
35
  | { type: 'on_select_token'; token: Token; variant: TokenInputType }
36
36
  | { type: 'on_transfer_success' }
37
37
  | { type: 'on_tokens_modal_toggled'; isOpen: boolean };
@@ -1,4 +1,3 @@
1
- import { BaseContainer } from '../../components/BaseContainer';
2
1
  import {
3
2
  WidgetContainer,
4
3
  WidgetContainerProps,
@@ -15,13 +14,11 @@ export const WidgetWithdraw = ({
15
14
  className,
16
15
  ...widgetProps
17
16
  }: WidgetWithdrawProps) => (
18
- <BaseContainer>
19
- <WidgetContainer
20
- className={className}
21
- isFullPage={isFullPage}
22
- HeaderComponent={HeaderComponent}
23
- FooterComponent={FooterComponent}>
24
- <WidgetWithdrawContent {...widgetProps} />
25
- </WidgetContainer>
26
- </BaseContainer>
17
+ <WidgetContainer
18
+ className={className}
19
+ isFullPage={isFullPage}
20
+ HeaderComponent={HeaderComponent}
21
+ FooterComponent={FooterComponent}>
22
+ <WidgetWithdrawContent {...widgetProps} />
23
+ </WidgetContainer>
27
24
  );
@@ -1,3 +1,4 @@
1
+ export { Widget } from './Widget';
1
2
  export { WidgetSwap } from './WidgetSwap';
2
3
  export { WidgetDeposit } from './WidgetDeposit';
3
4
  export { WidgetWithdraw } from './WidgetWithdraw';
@@ -1,2 +0,0 @@
1
- import { PropsWithChildren } from 'react';
2
- export declare const BaseContainer: ({ children }: PropsWithChildren) => import("react/jsx-runtime").JSX.Element;
@@ -1,23 +0,0 @@
1
- import { jsx as r } from "react/jsx-runtime";
2
- import { useTheme as t } from "../hooks/useTheme.js";
3
- import "../constants/chains.js";
4
- import "viem";
5
- import "ethers";
6
- import { cn as e } from "../utils/cn.js";
7
- const w = ({ children: o }) => {
8
- const m = t();
9
- return /* @__PURE__ */ r(
10
- "div",
11
- {
12
- className: e(
13
- "relative w-auto mx-auto",
14
- m?.showContainer ? "max-w-[496px] sm:w-[496px] p-csw-2xl bg-sw-container rounded-sw-lg" : "max-w-[456px] sm:w-[456px]"
15
- ),
16
- children: o
17
- }
18
- );
19
- };
20
- export {
21
- w as BaseContainer
22
- };
23
- //# sourceMappingURL=BaseContainer.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BaseContainer.js","sources":["../../src/components/BaseContainer.tsx"],"sourcesContent":["import { PropsWithChildren } from 'react';\nimport { useTheme } from '../hooks/useTheme';\nimport { cn } from '../utils';\n\nexport const BaseContainer = ({ children }: PropsWithChildren) => {\n const theme = useTheme();\n\n return (\n <div\n className={cn(\n 'relative w-auto mx-auto',\n theme?.showContainer\n ? 'max-w-[496px] sm:w-[496px] p-csw-2xl bg-sw-container rounded-sw-lg'\n : 'max-w-[456px] sm:w-[456px]',\n )}>\n {children}\n </div>\n );\n};\n"],"names":["BaseContainer","children","theme","useTheme","jsx","cn"],"mappings":";;;;;;AAIO,MAAMA,IAAgB,CAAC,EAAE,UAAAC,QAAkC;AAChE,QAAMC,IAAQC,EAAA;AAEd,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAH,GAAO,gBACH,uEACA;AAAA,MAAA;AAAA,MAEL,UAAAD;AAAA,IAAA;AAAA,EAAA;AAGP;"}
@@ -1,19 +0,0 @@
1
- import { PropsWithChildren } from 'react';
2
- import { useTheme } from '../hooks/useTheme';
3
- import { cn } from '../utils';
4
-
5
- export const BaseContainer = ({ children }: PropsWithChildren) => {
6
- const theme = useTheme();
7
-
8
- return (
9
- <div
10
- className={cn(
11
- 'relative w-auto mx-auto',
12
- theme?.showContainer
13
- ? 'max-w-[496px] sm:w-[496px] p-csw-2xl bg-sw-container rounded-sw-lg'
14
- : 'max-w-[456px] sm:w-[456px]',
15
- )}>
16
- {children}
17
- </div>
18
- );
19
- };