@lifi/widget 2.0.0-beta.0 → 2.0.0-beta.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.
Files changed (289) hide show
  1. package/App.d.ts +4 -3
  2. package/AppDrawer.d.ts +1 -1
  3. package/AppDrawer.js +2 -1
  4. package/AppProvider.js +1 -1
  5. package/README.md +11 -12
  6. package/cjs/App.d.ts +4 -3
  7. package/cjs/AppDrawer.d.ts +1 -1
  8. package/cjs/AppDrawer.js +2 -1
  9. package/cjs/AppProvider.js +1 -1
  10. package/cjs/components/ChainSelect/ChainSelect.d.ts +1 -1
  11. package/cjs/components/ChainSelect/ChainSelect.style.js +1 -1
  12. package/cjs/components/ChainSelect/useChainSelect.js +6 -0
  13. package/cjs/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -1
  14. package/cjs/components/GasMessage/GasMessage.js +1 -6
  15. package/cjs/components/Header/Header.js +2 -2
  16. package/cjs/components/Header/Header.style.d.ts +10 -3
  17. package/cjs/components/Header/Header.style.js +3 -0
  18. package/cjs/components/Header/NavigationHeader.js +23 -7
  19. package/cjs/components/Header/NavigationTabs.d.ts +1 -0
  20. package/cjs/components/Header/NavigationTabs.js +26 -0
  21. package/cjs/components/Header/NavigationTabs.style.d.ts +34 -0
  22. package/cjs/components/Header/NavigationTabs.style.js +61 -0
  23. package/cjs/components/Header/WalletHeader.d.ts +1 -0
  24. package/cjs/components/Header/WalletHeader.js +16 -9
  25. package/cjs/components/Header/useHeaderActionStore.js +0 -1
  26. package/cjs/components/Insurance/Insurance.js +2 -2
  27. package/cjs/components/Insurance/InsuranceCard.js +34 -12
  28. package/cjs/components/Insurance/InsuranceCollapsed.js +9 -11
  29. package/cjs/components/Insurance/index.d.ts +1 -0
  30. package/cjs/components/Insurance/index.js +1 -0
  31. package/cjs/components/Insurance/types.d.ts +12 -9
  32. package/cjs/components/NFT/NFT.js +2 -2
  33. package/cjs/components/NFT/types.d.ts +1 -1
  34. package/cjs/components/PoweredBy/PoweredBy.js +2 -3
  35. package/cjs/components/SelectChainAndToken.js +8 -7
  36. package/cjs/components/SelectTokenButton/SelectTokenButton.js +6 -3
  37. package/cjs/components/SendToWallet/SendToWallet.js +2 -2
  38. package/cjs/components/SmallAvatar.d.ts +1 -1
  39. package/cjs/components/Step/CircularProgress.d.ts +1 -1
  40. package/cjs/components/Step/Step.js +15 -5
  41. package/cjs/components/Step/StepList.d.ts +1 -1
  42. package/cjs/components/StepActions/StepActions.js +4 -20
  43. package/cjs/components/SwapButton/SwapButton.js +16 -4
  44. package/cjs/components/SwapInput/FormPriceHelperText.js +1 -1
  45. package/cjs/components/SwapInput/SwapInput.js +2 -2
  46. package/cjs/components/SwapInput/SwapInputEndAdornment.d.ts +1 -1
  47. package/cjs/components/SwapInput/SwapInputEndAdornment.js +2 -2
  48. package/cjs/components/SwapRouteCard/SwapRouteCard.js +19 -3
  49. package/cjs/components/SwapRouteCard/SwapRouteCardEssentials.js +1 -1
  50. package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +1 -1
  51. package/cjs/components/SwapRoutes/SwapRoutes.js +1 -1
  52. package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -2
  53. package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +2 -2
  54. package/cjs/components/SwapRoutes/SwapRoutesExpanded.style.js +1 -0
  55. package/cjs/components/Token/Token.js +1 -1
  56. package/cjs/components/TokenAvatar/TokenAvatar.d.ts +4 -4
  57. package/cjs/components/TokenList/TokenList.js +9 -4
  58. package/cjs/components/TokenList/TokenList.style.d.ts +5 -2
  59. package/cjs/components/TokenList/TokenList.style.js +20 -1
  60. package/cjs/components/TokenList/TokenListItem.d.ts +1 -1
  61. package/cjs/components/TokenList/TokenListItem.js +28 -5
  62. package/cjs/components/TokenList/VirtualizedTokenList.js +3 -3
  63. package/cjs/components/TokenList/types.d.ts +6 -3
  64. package/cjs/config/theme.js +15 -3
  65. package/cjs/config/version.d.ts +1 -1
  66. package/cjs/config/version.js +1 -1
  67. package/cjs/hooks/index.d.ts +2 -1
  68. package/cjs/hooks/index.js +2 -1
  69. package/cjs/hooks/useContentHeight.js +3 -5
  70. package/cjs/hooks/useFeaturedTokens.d.ts +1 -1
  71. package/cjs/hooks/useFundsSufficiency.js +2 -2
  72. package/cjs/hooks/useGasRefuel.d.ts +1 -1
  73. package/cjs/hooks/useGasRefuel.js +5 -15
  74. package/cjs/hooks/useGasSufficiency.js +12 -3
  75. package/cjs/hooks/useInitializer.js +0 -1
  76. package/cjs/hooks/useProcessMessage.d.ts +2 -1
  77. package/cjs/hooks/useProcessMessage.js +27 -9
  78. package/cjs/hooks/useRouteExecution.js +6 -5
  79. package/cjs/hooks/useSwapOnly.d.ts +1 -0
  80. package/cjs/hooks/useSwapOnly.js +9 -0
  81. package/cjs/hooks/useSwapRoutes.d.ts +1 -2
  82. package/cjs/hooks/useSwapRoutes.js +32 -18
  83. package/cjs/hooks/useToken.d.ts +1 -1
  84. package/cjs/hooks/useTokenAddressBalance.d.ts +2 -2
  85. package/cjs/hooks/useTokenBalance.js +6 -7
  86. package/cjs/hooks/useTokenBalances.d.ts +5 -5
  87. package/cjs/hooks/useTokenBalances.js +4 -19
  88. package/cjs/hooks/useTokenSearch.d.ts +2 -2
  89. package/cjs/hooks/useTokens.d.ts +2 -2
  90. package/cjs/i18n/bn.json +8 -0
  91. package/cjs/i18n/en.json +30 -5
  92. package/cjs/i18n/fr.json +8 -0
  93. package/cjs/i18n/id.json +22 -7
  94. package/cjs/i18n/ko.json +22 -7
  95. package/cjs/i18n/pt.json +40 -12
  96. package/cjs/i18n/th.json +21 -6
  97. package/cjs/i18n/uk.json +45 -20
  98. package/cjs/i18n/zh.json +23 -8
  99. package/cjs/icons/InsuraceLogo.d.ts +1 -1
  100. package/cjs/icons/LiFiFullLogo.d.ts +1 -1
  101. package/cjs/icons/LiFiLogo.d.ts +1 -1
  102. package/cjs/icons/LiFiToolLogo.d.ts +1 -1
  103. package/cjs/index.d.ts +1 -1
  104. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -1
  105. package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -1
  106. package/cjs/pages/SelectTokenPage/SelectTokenPage.js +3 -1
  107. package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -1
  108. package/cjs/pages/SelectWalletPage/SelectWalletPage.js +5 -5
  109. package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +1 -1
  110. package/cjs/pages/SettingsPage/LanguageSelect.js +1 -1
  111. package/cjs/pages/SettingsPage/SettingsPage.d.ts +1 -1
  112. package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -1
  113. package/cjs/pages/SettingsPage/SlippageInput.d.ts +1 -1
  114. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +6 -2
  115. package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +1 -1
  116. package/cjs/pages/SwapPage/StatusBottomSheet.js +15 -9
  117. package/cjs/pages/SwapPage/StatusBottomSheet.style.d.ts +1 -1
  118. package/cjs/pages/SwapPage/StatusBottomSheet.style.js +2 -2
  119. package/cjs/pages/SwapPage/SwapPage.js +31 -10
  120. package/cjs/pages/SwapPage/TokenValueBottomSheet.js +7 -12
  121. package/cjs/pages/SwapPage/utils.d.ts +2 -0
  122. package/cjs/pages/SwapPage/utils.js +10 -0
  123. package/cjs/providers/I18nProvider/I18nProvider.js +3 -3
  124. package/cjs/providers/SDKProvider/SDKProvider.js +2 -0
  125. package/cjs/providers/SwapFormProvider/FormUpdater.js +3 -0
  126. package/cjs/providers/WalletProvider/WalletProvider.js +107 -35
  127. package/cjs/providers/WalletProvider/index.d.ts +1 -1
  128. package/cjs/providers/WalletProvider/index.js +1 -1
  129. package/cjs/providers/WalletProvider/types.d.ts +4 -6
  130. package/cjs/providers/WidgetProvider/WidgetProvider.js +1 -1
  131. package/cjs/stores/StoreProvider.d.ts +2 -2
  132. package/cjs/stores/StoreProvider.js +3 -2
  133. package/cjs/stores/routes/RouteExecutionStore.d.ts +1 -1
  134. package/cjs/stores/routes/RouteExecutionStore.js +0 -1
  135. package/cjs/stores/settings/index.d.ts +1 -0
  136. package/cjs/stores/settings/index.js +1 -0
  137. package/cjs/stores/settings/types.d.ts +11 -0
  138. package/cjs/stores/settings/useSplitSubvariantStore.d.ts +7 -0
  139. package/cjs/stores/settings/useSplitSubvariantStore.js +44 -0
  140. package/cjs/types/events.d.ts +9 -1
  141. package/cjs/types/events.js +1 -0
  142. package/cjs/types/token.d.ts +2 -2
  143. package/cjs/types/widget.d.ts +13 -8
  144. package/cjs/types/widget.js +4 -2
  145. package/cjs/utils/format.d.ts +1 -1
  146. package/cjs/utils/format.js +7 -12
  147. package/cjs/utils/wallet.d.ts +1 -1
  148. package/cjs/utils/wallet.js +3 -3
  149. package/components/ChainSelect/ChainSelect.d.ts +1 -1
  150. package/components/ChainSelect/ChainSelect.style.js +1 -1
  151. package/components/ChainSelect/useChainSelect.js +7 -1
  152. package/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -1
  153. package/components/GasMessage/GasMessage.js +2 -7
  154. package/components/Header/Header.js +3 -3
  155. package/components/Header/Header.style.d.ts +10 -3
  156. package/components/Header/Header.style.js +3 -0
  157. package/components/Header/NavigationHeader.js +23 -7
  158. package/components/Header/NavigationTabs.d.ts +1 -0
  159. package/components/Header/NavigationTabs.js +22 -0
  160. package/components/Header/NavigationTabs.style.d.ts +34 -0
  161. package/components/Header/NavigationTabs.style.js +58 -0
  162. package/components/Header/WalletHeader.d.ts +1 -0
  163. package/components/Header/WalletHeader.js +14 -8
  164. package/components/Header/useHeaderActionStore.js +0 -1
  165. package/components/Insurance/Insurance.js +2 -2
  166. package/components/Insurance/InsuranceCard.js +37 -15
  167. package/components/Insurance/InsuranceCollapsed.js +9 -11
  168. package/components/Insurance/index.d.ts +1 -0
  169. package/components/Insurance/index.js +1 -0
  170. package/components/Insurance/types.d.ts +12 -9
  171. package/components/NFT/NFT.js +2 -2
  172. package/components/NFT/types.d.ts +1 -1
  173. package/components/PoweredBy/PoweredBy.js +2 -3
  174. package/components/SelectChainAndToken.js +9 -8
  175. package/components/SelectTokenButton/SelectTokenButton.js +7 -4
  176. package/components/SendToWallet/SendToWallet.js +2 -2
  177. package/components/SmallAvatar.d.ts +1 -1
  178. package/components/Step/CircularProgress.d.ts +1 -1
  179. package/components/Step/Step.js +16 -6
  180. package/components/Step/StepList.d.ts +1 -1
  181. package/components/StepActions/StepActions.js +4 -20
  182. package/components/SwapButton/SwapButton.js +16 -4
  183. package/components/SwapInput/FormPriceHelperText.js +2 -2
  184. package/components/SwapInput/SwapInput.js +3 -3
  185. package/components/SwapInput/SwapInputEndAdornment.d.ts +1 -1
  186. package/components/SwapInput/SwapInputEndAdornment.js +2 -2
  187. package/components/SwapRouteCard/SwapRouteCard.js +21 -5
  188. package/components/SwapRouteCard/SwapRouteCardEssentials.js +1 -1
  189. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +1 -1
  190. package/components/SwapRoutes/SwapRoutes.js +1 -1
  191. package/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -2
  192. package/components/SwapRoutes/SwapRoutesExpanded.js +2 -2
  193. package/components/SwapRoutes/SwapRoutesExpanded.style.js +1 -0
  194. package/components/Token/Token.js +1 -1
  195. package/components/TokenAvatar/TokenAvatar.d.ts +4 -4
  196. package/components/TokenList/TokenList.js +10 -5
  197. package/components/TokenList/TokenList.style.d.ts +5 -2
  198. package/components/TokenList/TokenList.style.js +21 -2
  199. package/components/TokenList/TokenListItem.d.ts +1 -1
  200. package/components/TokenList/TokenListItem.js +32 -9
  201. package/components/TokenList/VirtualizedTokenList.js +3 -3
  202. package/components/TokenList/types.d.ts +6 -3
  203. package/config/theme.js +15 -3
  204. package/config/version.d.ts +1 -1
  205. package/config/version.js +1 -1
  206. package/hooks/index.d.ts +2 -1
  207. package/hooks/index.js +2 -1
  208. package/hooks/useContentHeight.js +4 -6
  209. package/hooks/useFeaturedTokens.d.ts +1 -1
  210. package/hooks/useFundsSufficiency.js +2 -2
  211. package/hooks/useGasRefuel.d.ts +1 -1
  212. package/hooks/useGasRefuel.js +5 -15
  213. package/hooks/useGasSufficiency.js +13 -4
  214. package/hooks/useInitializer.js +0 -1
  215. package/hooks/useProcessMessage.d.ts +2 -1
  216. package/hooks/useProcessMessage.js +27 -9
  217. package/hooks/useRouteExecution.js +6 -5
  218. package/hooks/useSwapOnly.d.ts +1 -0
  219. package/hooks/useSwapOnly.js +5 -0
  220. package/hooks/useSwapRoutes.d.ts +1 -2
  221. package/hooks/useSwapRoutes.js +32 -18
  222. package/hooks/useToken.d.ts +1 -1
  223. package/hooks/useTokenAddressBalance.d.ts +2 -2
  224. package/hooks/useTokenBalance.js +6 -7
  225. package/hooks/useTokenBalances.d.ts +5 -5
  226. package/hooks/useTokenBalances.js +4 -19
  227. package/hooks/useTokenSearch.d.ts +2 -2
  228. package/hooks/useTokens.d.ts +2 -2
  229. package/i18n/bn.json +8 -0
  230. package/i18n/en.json +30 -5
  231. package/i18n/fr.json +8 -0
  232. package/i18n/id.json +22 -7
  233. package/i18n/ko.json +22 -7
  234. package/i18n/pt.json +40 -12
  235. package/i18n/th.json +21 -6
  236. package/i18n/uk.json +45 -20
  237. package/i18n/zh.json +23 -8
  238. package/icons/InsuraceLogo.d.ts +1 -1
  239. package/icons/LiFiFullLogo.d.ts +1 -1
  240. package/icons/LiFiLogo.d.ts +1 -1
  241. package/icons/LiFiToolLogo.d.ts +1 -1
  242. package/index.d.ts +1 -1
  243. package/package.json +13 -13
  244. package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -1
  245. package/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -1
  246. package/pages/SelectTokenPage/SelectTokenPage.js +4 -2
  247. package/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -1
  248. package/pages/SelectWalletPage/SelectWalletPage.js +5 -5
  249. package/pages/SettingsPage/GasPriceSelect.d.ts +1 -1
  250. package/pages/SettingsPage/LanguageSelect.js +1 -1
  251. package/pages/SettingsPage/SettingsPage.d.ts +1 -1
  252. package/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -1
  253. package/pages/SettingsPage/SlippageInput.d.ts +1 -1
  254. package/pages/SwapDetailsPage/SwapDetailsPage.js +6 -2
  255. package/pages/SwapPage/ExchangeRateBottomSheet.js +2 -2
  256. package/pages/SwapPage/StatusBottomSheet.js +18 -12
  257. package/pages/SwapPage/StatusBottomSheet.style.d.ts +1 -1
  258. package/pages/SwapPage/StatusBottomSheet.style.js +1 -1
  259. package/pages/SwapPage/SwapPage.js +33 -12
  260. package/pages/SwapPage/TokenValueBottomSheet.js +8 -13
  261. package/pages/SwapPage/utils.d.ts +2 -0
  262. package/pages/SwapPage/utils.js +6 -0
  263. package/providers/I18nProvider/I18nProvider.js +3 -3
  264. package/providers/SDKProvider/SDKProvider.js +2 -0
  265. package/providers/SwapFormProvider/FormUpdater.js +3 -0
  266. package/providers/WalletProvider/WalletProvider.js +108 -36
  267. package/providers/WalletProvider/index.d.ts +1 -1
  268. package/providers/WalletProvider/index.js +1 -1
  269. package/providers/WalletProvider/types.d.ts +4 -6
  270. package/providers/WidgetProvider/WidgetProvider.js +2 -2
  271. package/stores/StoreProvider.d.ts +2 -2
  272. package/stores/StoreProvider.js +3 -2
  273. package/stores/routes/RouteExecutionStore.d.ts +1 -1
  274. package/stores/routes/RouteExecutionStore.js +0 -1
  275. package/stores/settings/index.d.ts +1 -0
  276. package/stores/settings/index.js +1 -0
  277. package/stores/settings/types.d.ts +11 -0
  278. package/stores/settings/useSplitSubvariantStore.d.ts +7 -0
  279. package/stores/settings/useSplitSubvariantStore.js +37 -0
  280. package/tsconfig.cjs.tsbuildinfo +1 -1
  281. package/types/events.d.ts +9 -1
  282. package/types/events.js +1 -0
  283. package/types/token.d.ts +2 -2
  284. package/types/widget.d.ts +13 -8
  285. package/types/widget.js +4 -2
  286. package/utils/format.d.ts +1 -1
  287. package/utils/format.js +5 -10
  288. package/utils/wallet.d.ts +1 -1
  289. package/utils/wallet.js +1 -1
@@ -1,10 +1,11 @@
1
1
  import type { Signer } from '@ethersproject/abstract-signer';
2
- import type { ChainKey, ConfigUpdate, Order, RouteOptions, Token } from '@lifi/sdk';
2
+ import type { BaseToken, ChainKey, ConfigUpdate, Order, RouteOptions, StaticToken } from '@lifi/sdk';
3
3
  import type { Components, PaletteMode, PaletteOptions, Shape, Theme } from '@mui/material';
4
4
  import type { TypographyOptions } from '@mui/material/styles/createTypography';
5
5
  import type { CSSProperties, ReactNode, RefObject } from 'react';
6
6
  import type { LanguageKey, LanguageResources } from '../providers';
7
7
  export type WidgetVariant = 'default' | 'expandable' | 'drawer' | 'refuel' | 'nft';
8
+ export type WidgetSubvariant = 'default' | 'split';
8
9
  export declare enum DisabledUI {
9
10
  FromAmount = "fromAmount",
10
11
  FromToken = "fromToken",
@@ -14,9 +15,13 @@ export declare enum DisabledUI {
14
15
  export type DisabledUIType = `${DisabledUI}`;
15
16
  export declare enum HiddenUI {
16
17
  Appearance = "appearance",
18
+ DrawerButton = "drawerButton",
19
+ History = "history",
17
20
  Language = "language",
18
21
  PoweredBy = "poweredBy",
19
- ToAddress = "toAddress"
22
+ ToAddress = "toAddress",
23
+ ToToken = "toToken",
24
+ WalletMenu = "walletMenu"
20
25
  }
21
26
  export type HiddenUIType = `${HiddenUI}`;
22
27
  export declare enum RequiredUI {
@@ -34,7 +39,7 @@ export interface WidgetWalletManagement {
34
39
  connect(): Promise<Signer>;
35
40
  disconnect(): Promise<void>;
36
41
  switchChain?(chainId: number): Promise<Signer>;
37
- addToken?(token: Token, chainId: number): Promise<void>;
42
+ addToken?(token: StaticToken, chainId: number): Promise<void>;
38
43
  addChain?(chainId: number): Promise<boolean>;
39
44
  signer?: Signer;
40
45
  }
@@ -72,10 +77,10 @@ export interface WidgetConfig {
72
77
  slippage?: number;
73
78
  insurance?: boolean;
74
79
  variant?: WidgetVariant;
80
+ subvariant?: WidgetSubvariant;
75
81
  appearance?: Appearance;
76
82
  theme?: ThemeConfig;
77
83
  containerStyle?: CSSProperties;
78
- disableTelemetry?: boolean;
79
84
  disabledUI?: DisabledUIType[];
80
85
  hiddenUI?: HiddenUIType[];
81
86
  requiredUI?: RequiredUIType[];
@@ -97,9 +102,9 @@ export interface WidgetConfig {
97
102
  deny?: number[];
98
103
  };
99
104
  tokens?: {
100
- featured?: Token[];
101
- allow?: Token[];
102
- deny?: (Partial<Token> & Pick<Token, 'address' | 'chainId'>)[];
105
+ featured?: StaticToken[];
106
+ allow?: BaseToken[];
107
+ deny?: BaseToken[];
103
108
  };
104
109
  languages?: {
105
110
  default?: LanguageKey;
@@ -107,7 +112,7 @@ export interface WidgetConfig {
107
112
  deny?: LanguageKey[];
108
113
  };
109
114
  languageResources?: LanguageResources;
110
- disableI18n?: boolean;
115
+ disableLanguageDetector?: boolean;
111
116
  }
112
117
  export type WidgetDrawerProps = {
113
118
  elementRef?: RefObject<HTMLDivElement>;
@@ -11,11 +11,13 @@ var DisabledUI;
11
11
  var HiddenUI;
12
12
  (function (HiddenUI) {
13
13
  HiddenUI["Appearance"] = "appearance";
14
- // FromAmount = 'fromAmount',
14
+ HiddenUI["DrawerButton"] = "drawerButton";
15
+ HiddenUI["History"] = "history";
15
16
  HiddenUI["Language"] = "language";
16
17
  HiddenUI["PoweredBy"] = "poweredBy";
17
18
  HiddenUI["ToAddress"] = "toAddress";
18
- // ToToken = 'toToken',
19
+ HiddenUI["ToToken"] = "toToken";
20
+ HiddenUI["WalletMenu"] = "walletMenu";
19
21
  })(HiddenUI = exports.HiddenUI || (exports.HiddenUI = {}));
20
22
  var RequiredUI;
21
23
  (function (RequiredUI) {
@@ -5,5 +5,5 @@
5
5
  */
6
6
  export declare const formatTokenAmount: (amount?: string, decimals?: number, decimalPlaces?: number) => string;
7
7
  export declare const formatSlippage: (slippage?: string, defaultValue?: string, returnInitial?: boolean) => string;
8
- export declare const formatAmount: (amount?: string, returnInitial?: boolean) => string;
8
+ export declare const formatInputAmount: (amount: string, returnInitial?: boolean) => string;
9
9
  export declare const formatTokenPrice: (amount?: string, price?: string) => number;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatTokenPrice = exports.formatAmount = exports.formatSlippage = exports.formatTokenAmount = void 0;
3
+ exports.formatTokenPrice = exports.formatInputAmount = exports.formatSlippage = exports.formatTokenAmount = void 0;
4
4
  const big_js_1 = require("big.js");
5
5
  // JavaScript numbers use exponential notation for positive exponents of 21 and above. We need more.
6
6
  big_js_1.default.PE = 42;
@@ -24,7 +24,7 @@ const formatTokenAmount = (amount = '0', decimals = 0, decimalPlaces = 3) => {
24
24
  while (absAmount < 1 / 10 ** decimalPlaces) {
25
25
  decimalPlaces++;
26
26
  }
27
- return (0, big_js_1.default)(parseFloat((0, big_js_1.default)(parsedAmount).toFixed(decimalPlaces + 1, 0))).toString();
27
+ return (0, big_js_1.default)(parsedAmount).toFixed(decimalPlaces + 1, 0);
28
28
  };
29
29
  exports.formatTokenAmount = formatTokenAmount;
30
30
  const formatSlippage = (slippage = '', defaultValue = '', returnInitial = false) => {
@@ -50,7 +50,7 @@ const formatSlippage = (slippage = '', defaultValue = '', returnInitial = false)
50
50
  return parsedSlippage.toString();
51
51
  };
52
52
  exports.formatSlippage = formatSlippage;
53
- const formatAmount = (amount = '', returnInitial = false) => {
53
+ const formatInputAmount = (amount, returnInitial = false) => {
54
54
  if (!amount) {
55
55
  return amount;
56
56
  }
@@ -62,23 +62,18 @@ const formatAmount = (amount = '', returnInitial = false) => {
62
62
  if (isNaN(Number(formattedAmount)) && !isNaN(parsedAmount)) {
63
63
  return parsedAmount.toString();
64
64
  }
65
- if (isNaN(parsedAmount)) {
66
- return '';
67
- }
68
- if (parsedAmount < 0) {
69
- return Math.abs(parsedAmount).toString();
70
- }
71
65
  try {
72
- if (returnInitial && (0, big_js_1.default)(formattedAmount)) {
66
+ const absFormattedAmount = (0, big_js_1.default)(formattedAmount).abs();
67
+ if (returnInitial) {
73
68
  return formattedAmount;
74
69
  }
70
+ return absFormattedAmount.toString();
75
71
  }
76
72
  catch {
77
73
  return '';
78
74
  }
79
- return (0, big_js_1.default)(parsedAmount).toString();
80
75
  };
81
- exports.formatAmount = formatAmount;
76
+ exports.formatInputAmount = formatInputAmount;
82
77
  const formatTokenPrice = (amount, price) => {
83
78
  if (!amount || !price) {
84
79
  return 0;
@@ -1 +1 @@
1
- export declare const shortenWalletAddress: (address?: string) => string | null;
1
+ export declare const shortenAddress: (address?: string) => string | null;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.shortenWalletAddress = void 0;
4
- const shortenWalletAddress = (address) => address
3
+ exports.shortenAddress = void 0;
4
+ const shortenAddress = (address) => address
5
5
  ? `${address.substring(0, 5)}...${address.substring(address.length - 4)}`
6
6
  : null;
7
- exports.shortenWalletAddress = shortenWalletAddress;
7
+ exports.shortenAddress = shortenAddress;
@@ -1,2 +1,2 @@
1
1
  import type { SwapFormTypeProps } from '../../providers';
2
- export declare const ChainSelect: ({ formType }: SwapFormTypeProps) => JSX.Element;
2
+ export declare const ChainSelect: ({ formType }: SwapFormTypeProps) => import("react/jsx-runtime").JSX.Element;
@@ -9,7 +9,7 @@ export const ChainCard = styled(Card)({
9
9
  });
10
10
  export const ChainContainer = styled(Box)(({ theme }) => ({
11
11
  display: 'grid',
12
- gridTemplateColumns: 'repeat(5, 1fr)',
12
+ gridTemplateColumns: 'repeat(auto-fit, minmax(52px, 1fr))',
13
13
  gridAutoRows: '56px',
14
14
  justifyContent: 'space-between',
15
15
  gap: theme.spacing(1.5),
@@ -1,5 +1,5 @@
1
1
  import { useController, useFormContext } from 'react-hook-form';
2
- import { useChains } from '../../hooks';
2
+ import { useChains, useSwapOnly } from '../../hooks';
3
3
  import { SwapFormKey, SwapFormKeyHelper } from '../../providers';
4
4
  import { useChainOrder } from '../../stores';
5
5
  export const useChainSelect = (formType) => {
@@ -8,6 +8,7 @@ export const useChainSelect = (formType) => {
8
8
  const { setValue } = useFormContext();
9
9
  const { chains, isLoading } = useChains();
10
10
  const [chainOrder, setChainOrder] = useChainOrder();
11
+ const swapOnly = useSwapOnly();
11
12
  const getChains = () => {
12
13
  if (!chains) {
13
14
  return [];
@@ -20,6 +21,11 @@ export const useChainSelect = (formType) => {
20
21
  const setCurrentChain = (chainId) => {
21
22
  onChange(chainId);
22
23
  onBlur();
24
+ if (swapOnly) {
25
+ setValue(SwapFormKeyHelper.getChainKey('to'), chainId, {
26
+ shouldTouch: true,
27
+ });
28
+ }
23
29
  setValue(SwapFormKeyHelper.getTokenKey(formType), '');
24
30
  setValue(SwapFormKeyHelper.getAmountKey(formType), '');
25
31
  setValue(SwapFormKey.TokenSearchFilter, '');
@@ -1 +1 @@
1
- export declare const FundsSufficiencyMessage: () => JSX.Element;
1
+ export declare const FundsSufficiencyMessage: () => import("react/jsx-runtime").JSX.Element;
@@ -1,15 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { Box, Collapse } from '@mui/material';
3
- import { useFundsSufficiency, useGasRefuel, useGasSufficiency, } from '../../hooks';
4
- import { useSettings } from '../../stores';
3
+ import { useFundsSufficiency, useGasSufficiency } from '../../hooks';
5
4
  import { FundsSufficiencyMessage } from './FundsSufficiencyMessage';
6
5
  import { GasSufficiencyMessage } from './GasSufficiencyMessage';
7
6
  export const GasMessage = ({ route, ...props }) => {
8
7
  const { insufficientGas } = useGasSufficiency(route);
9
8
  const { insufficientFunds } = useFundsSufficiency(route);
10
- const { enabledAutoRefuel } = useSettings(['enabledAutoRefuel']);
11
- const { enabled, isLoading: isRefuelLoading } = useGasRefuel();
12
- const enabledRefuel = enabled && enabledAutoRefuel;
13
- const showGasSufficiencyMessage = insufficientGas?.length && !isRefuelLoading && !enabledRefuel;
14
- return (_jsx(Collapse, { timeout: 225, in: Boolean(insufficientFunds || showGasSufficiencyMessage), unmountOnExit: true, mountOnEnter: true, children: _jsx(Box, { ...props, children: insufficientFunds ? (_jsx(FundsSufficiencyMessage, {})) : showGasSufficiencyMessage ? (_jsx(GasSufficiencyMessage, { insufficientGas: insufficientGas })) : null }) }));
9
+ return (_jsx(Collapse, { timeout: 225, in: Boolean(insufficientFunds || insufficientGas?.length), unmountOnExit: true, mountOnEnter: true, children: _jsx(Box, { ...props, children: insufficientFunds ? (_jsx(FundsSufficiencyMessage, {})) : insufficientGas?.length ? (_jsx(GasSufficiencyMessage, { insufficientGas: insufficientGas })) : null }) }));
15
10
  };
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useLocation } from 'react-router-dom';
3
3
  import { useDefaultElementId } from '../../hooks';
4
4
  import { useWidgetConfig } from '../../providers';
5
- import { createElementId, ElementId, stickyHeaderRoutes } from '../../utils';
5
+ import { ElementId, createElementId, stickyHeaderRoutes } from '../../utils';
6
6
  import { Container } from './Header.style';
7
7
  import { NavigationHeader } from './NavigationHeader';
8
8
  import { WalletHeader } from './WalletHeader';
@@ -12,6 +12,6 @@ export const HeaderContainer = ({ children }) => {
12
12
  return (_jsx(Container, { id: createElementId(ElementId.Header, elementId), sticky: stickyHeaderRoutes.some((route) => pathname.includes(route)), children: children }));
13
13
  };
14
14
  export const Header = () => {
15
- const { walletManagement } = useWidgetConfig();
16
- return (_jsxs(HeaderContainer, { children: [!walletManagement ? _jsx(WalletHeader, {}) : null, _jsx(NavigationHeader, {})] }));
15
+ const { walletManagement, subvariant } = useWidgetConfig();
16
+ return (_jsxs(HeaderContainer, { children: [!walletManagement && subvariant !== 'split' ? _jsx(WalletHeader, {}) : null, _jsx(NavigationHeader, {})] }));
17
17
  };
@@ -1,13 +1,20 @@
1
1
  /// <reference types="react" />
2
- export declare const HeaderAppBar: import("@emotion/styled").StyledComponent<Omit<import("@mui/material").PaperProps, "classes" | "color" | "position"> & {
2
+ export declare const HeaderAppBar: import("@emotion/styled").StyledComponent<{
3
3
  classes?: Partial<import("@mui/material").AppBarClasses> | undefined;
4
4
  color?: import("@mui/types").OverridableStringUnion<"transparent" | import("@mui/material").PropTypes.Color, import("@mui/material").AppBarPropsColorOverrides> | undefined;
5
5
  enableColorOnDark?: boolean | undefined;
6
6
  position?: "fixed" | "absolute" | "relative" | "static" | "sticky" | undefined;
7
7
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
8
- } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & {
8
+ } & Omit<{
9
+ children?: import("react").ReactNode;
10
+ classes?: Partial<import("@mui/material").PaperClasses> | undefined;
11
+ elevation?: number | undefined;
12
+ square?: boolean | undefined;
13
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
14
+ variant?: import("@mui/types").OverridableStringUnion<"outlined" | "elevation", import("@mui/material").PaperPropsVariantOverrides> | undefined;
15
+ }, "classes" | "color" | "position"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & {
9
16
  ref?: ((instance: HTMLElement | null) => void) | import("react").RefObject<HTMLElement> | null | undefined;
10
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoFocus" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "nonce" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "content" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "ref" | "key" | "position" | "variant" | "square" | "elevation" | "enableColorOnDark"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
17
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "color" | "children" | "sx" | "position" | "variant" | "square" | "elevation" | "enableColorOnDark"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
11
18
  export declare const Container: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
12
19
  children?: import("react").ReactNode;
13
20
  component?: import("react").ElementType<any> | undefined;
@@ -39,4 +39,7 @@ export const WalletButton = styled(Button)(({ theme }) => ({
39
39
  [`.${buttonClasses.endIcon} > *:nth-of-type(1)`]: {
40
40
  fontSize: '24px',
41
41
  },
42
+ [`.${buttonClasses.startIcon} > *:nth-of-type(1)`]: {
43
+ fontSize: '24px',
44
+ },
42
45
  }));
@@ -7,12 +7,15 @@ import { useTranslation } from 'react-i18next';
7
7
  import { Route, Routes, useLocation } from 'react-router-dom';
8
8
  import { useNavigateBack } from '../../hooks';
9
9
  import { useWallet, useWidgetConfig } from '../../providers';
10
+ import { HiddenUI } from '../../types';
10
11
  import { backButtonRoutes, navigationRoutes, navigationRoutesValues, } from '../../utils';
11
12
  import { HeaderAppBar } from './Header.style';
13
+ import { NavigationTabs } from './NavigationTabs';
14
+ import { WalletMenuButton } from './WalletHeader';
12
15
  import { useHeaderActionStore } from './useHeaderActionStore';
13
16
  export const NavigationHeader = () => {
14
17
  const { t } = useTranslation();
15
- const { variant } = useWidgetConfig();
18
+ const { variant, subvariant, hiddenUI } = useWidgetConfig();
16
19
  const { navigate, navigateBack } = useNavigateBack();
17
20
  const { account } = useWallet();
18
21
  const { element } = useHeaderActionStore();
@@ -22,6 +25,7 @@ export const NavigationHeader = () => {
22
25
  : pathname;
23
26
  const path = cleanedPathname.substring(cleanedPathname.lastIndexOf('/') + 1);
24
27
  const hasPath = navigationRoutesValues.includes(path);
28
+ const splitSubvariant = subvariant === 'split' && !hasPath;
25
29
  const handleHeaderTitle = () => {
26
30
  switch (path) {
27
31
  case navigationRoutes.selectWallet:
@@ -34,8 +38,12 @@ export const NavigationHeader = () => {
34
38
  return t(`settings.enabledExchanges`);
35
39
  case navigationRoutes.swapHistory:
36
40
  return t(`header.swapHistory`);
37
- case navigationRoutes.fromToken:
41
+ case navigationRoutes.fromToken: {
42
+ if (variant === 'nft') {
43
+ return t(`header.payWith`);
44
+ }
38
45
  return t(`header.from`);
46
+ }
39
47
  case navigationRoutes.toToken:
40
48
  return t(`header.to`);
41
49
  case navigationRoutes.fromChain:
@@ -46,10 +54,18 @@ export const NavigationHeader = () => {
46
54
  return t(`header.routes`);
47
55
  case navigationRoutes.activeSwaps:
48
56
  return t(`header.activeSwaps`);
49
- case navigationRoutes.swapExecution:
57
+ case navigationRoutes.swapExecution: {
58
+ if (variant === 'nft') {
59
+ return t(`header.purchase`);
60
+ }
50
61
  return t(`header.swap`);
51
- case navigationRoutes.swapDetails:
62
+ }
63
+ case navigationRoutes.swapDetails: {
64
+ if (variant === 'nft') {
65
+ return t(`header.purchaseDetails`);
66
+ }
52
67
  return t(`header.swapDetails`);
68
+ }
53
69
  default: {
54
70
  switch (variant) {
55
71
  case 'nft':
@@ -62,7 +78,7 @@ export const NavigationHeader = () => {
62
78
  }
63
79
  }
64
80
  };
65
- return (_jsxs(HeaderAppBar, { elevation: 0, children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, { size: "medium", edge: "start", onClick: navigateBack, children: _jsx(ArrowBackIcon, {}) })) : null, _jsx(Typography, { fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true, children: handleHeaderTitle() }), _jsxs(Routes, { children: [_jsx(Route, { path: navigationRoutes.home, element: _jsxs(_Fragment, { children: [account.isActive ? (_jsx(Tooltip, { title: t(`header.swapHistory`), enterDelay: 400, arrow: true, children: _jsx(IconButton, { size: "medium", edge: "start", onClick: () => navigate(navigationRoutes.swapHistory), children: _jsx(ReceiptLongIcon, {}) }) })) : null, _jsx(Tooltip, { title: t(`header.settings`), enterDelay: 400, arrow: true, children: _jsx(IconButton, { size: "medium", onClick: () => navigate(navigationRoutes.settings), sx: {
66
- marginRight: -1.25,
67
- }, children: _jsx(SettingsIcon, {}) }) })] }) }), _jsx(Route, { path: "*", element: element || _jsx(Box, { width: 28, height: 40 }) })] })] }));
81
+ return (_jsxs(_Fragment, { children: [_jsxs(HeaderAppBar, { elevation: 0, children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, { size: "medium", edge: "start", onClick: navigateBack, children: _jsx(ArrowBackIcon, {}) })) : null, splitSubvariant ? (_jsx(Box, { flex: 1, children: !hiddenUI?.includes(HiddenUI.WalletMenu) ? (_jsx(WalletMenuButton, {})) : null })) : (_jsx(Typography, { fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true, children: handleHeaderTitle() })), _jsxs(Routes, { children: [_jsx(Route, { path: navigationRoutes.home, element: _jsxs(_Fragment, { children: [account.isActive && !hiddenUI?.includes(HiddenUI.History) ? (_jsx(Tooltip, { title: t(`header.swapHistory`), enterDelay: 400, arrow: true, children: _jsx(IconButton, { size: "medium", edge: "start", onClick: () => navigate(navigationRoutes.swapHistory), children: _jsx(ReceiptLongIcon, {}) }) })) : null, _jsx(Tooltip, { title: t(`header.settings`), enterDelay: 400, arrow: true, children: _jsx(IconButton, { size: "medium", onClick: () => navigate(navigationRoutes.settings), sx: {
82
+ marginRight: -1.25,
83
+ }, children: _jsx(SettingsIcon, {}) }) })] }) }), _jsx(Route, { path: "*", element: element || _jsx(Box, { width: 28, height: 40 }) })] })] }), splitSubvariant ? _jsx(NavigationTabs, {}) : null] }));
68
84
  };
@@ -0,0 +1 @@
1
+ export declare const NavigationTabs: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,22 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useFormContext } from 'react-hook-form';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { SwapFormKey } from '../../providers';
5
+ import { useSplitSubvariantStore } from '../../stores';
6
+ import { HeaderAppBar } from './Header.style';
7
+ import { NavbarTab, NavbarTabs } from './NavigationTabs.style';
8
+ export const NavigationTabs = () => {
9
+ const { t } = useTranslation();
10
+ const [state, setState] = useSplitSubvariantStore((state) => [
11
+ state.state,
12
+ state.setState,
13
+ ]);
14
+ const { setValue } = useFormContext();
15
+ const handleChange = (_, value) => {
16
+ setValue(SwapFormKey.FromAmount, '');
17
+ setValue(SwapFormKey.FromToken, '');
18
+ setValue(SwapFormKey.ToToken, '');
19
+ setState(value === 0 ? 'swap' : 'bridge');
20
+ };
21
+ return (_jsx(HeaderAppBar, { elevation: 0, sx: { py: 1 }, children: _jsxs(NavbarTabs, { value: state === 'swap' ? 0 : 1, onChange: handleChange, "aria-label": "tabs", indicatorColor: "primary", children: [_jsx(NavbarTab, { label: t('header.swap'), disableRipple: true }), _jsx(NavbarTab, { label: t('header.bridge'), disableRipple: true })] }) }));
22
+ };
@@ -0,0 +1,34 @@
1
+ /// <reference types="react" />
2
+ import type { StyledComponent } from '@emotion/styled';
3
+ import type { TabsProps } from '@mui/material';
4
+ export declare const NavbarTabs: StyledComponent<TabsProps>;
5
+ export declare const NavbarTab: StyledComponent<{
6
+ children?: null | undefined;
7
+ classes?: Partial<import("@mui/material").TabClasses> | undefined;
8
+ disabled?: boolean | undefined;
9
+ disableFocusRipple?: boolean | undefined;
10
+ icon?: string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
11
+ iconPosition?: "bottom" | "top" | "end" | "start" | undefined;
12
+ label?: import("react").ReactNode;
13
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
14
+ value?: any;
15
+ wrapped?: boolean | undefined;
16
+ } & Omit<{
17
+ action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
18
+ centerRipple?: boolean | undefined;
19
+ children?: import("react").ReactNode;
20
+ classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
21
+ disabled?: boolean | undefined;
22
+ disableRipple?: boolean | undefined;
23
+ disableTouchRipple?: boolean | undefined;
24
+ focusRipple?: boolean | undefined;
25
+ focusVisibleClassName?: string | undefined;
26
+ LinkComponent?: import("react").ElementType<any> | undefined;
27
+ onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
28
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
29
+ tabIndex?: number | undefined;
30
+ TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
31
+ touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
32
+ }, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
33
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
34
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "label" | "tabIndex" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "value" | "icon" | "iconPosition" | "wrapped"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -0,0 +1,58 @@
1
+ import { Tab, Tabs, tabClasses, tabsClasses } from '@mui/material';
2
+ import { alpha, styled } from '@mui/material/styles';
3
+ export const NavbarTabs = styled(Tabs)(({ theme }) => ({
4
+ backgroundColor: theme.palette.mode === 'dark'
5
+ ? theme.palette.common.white
6
+ : alpha(theme.palette.common.black, 0.04),
7
+ borderRadius: theme.shape.borderRadius,
8
+ padding: theme.spacing(0.5),
9
+ flex: 1,
10
+ display: 'flex',
11
+ alignItems: 'center',
12
+ height: 56,
13
+ [`.${tabsClasses.flexContainer}`]: {
14
+ alignItems: 'center',
15
+ },
16
+ [`.${tabsClasses.scroller}`]: {
17
+ overflow: 'initial !important',
18
+ },
19
+ [`.${tabsClasses.indicator}`]: {
20
+ position: 'absolute',
21
+ top: '50%',
22
+ transform: 'translateY(-50%)',
23
+ height: 48,
24
+ backgroundColor: theme.palette.mode === 'dark'
25
+ ? theme.palette.common.black
26
+ : theme.palette.common.white,
27
+ borderRadius: theme.shape.borderRadiusSecondary,
28
+ boxShadow: `0px 2px 4px ${alpha(theme.palette.common.black, 0.04)}`,
29
+ },
30
+ }));
31
+ export const NavbarTab = styled(Tab, {
32
+ shouldForwardProp: (prop) => prop !== 'isDarkMode',
33
+ })(({ theme }) => ({
34
+ zIndex: 1,
35
+ display: 'flex',
36
+ flex: 1,
37
+ justifyContent: 'center',
38
+ alignItems: 'center',
39
+ flexDirection: 'row',
40
+ textTransform: 'none',
41
+ height: 48,
42
+ minHeight: 48,
43
+ fontSize: '1rem',
44
+ fontWeight: 700,
45
+ color: theme.palette.mode === 'dark'
46
+ ? theme.palette.common.white
47
+ : theme.palette.common.black,
48
+ textDecoration: 'none',
49
+ [`&.${tabClasses.selected}`]: {
50
+ color: theme.palette.mode === 'dark'
51
+ ? theme.palette.common.white
52
+ : theme.palette.common.black,
53
+ backgroundColor: 'transparent',
54
+ },
55
+ [`.${tabClasses.iconWrapper}`]: {
56
+ margin: theme.spacing(0, 1, 0, 0),
57
+ },
58
+ }));
@@ -1,2 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  export declare const WalletHeader: React.FC;
3
+ export declare const WalletMenuButton: React.FC;
@@ -10,34 +10,39 @@ import { useTranslation } from 'react-i18next';
10
10
  import { useLocation, useNavigate } from 'react-router-dom';
11
11
  import { useChain } from '../../hooks';
12
12
  import { useWallet, useWidgetConfig } from '../../providers';
13
- import { navigationRoutes, shortenWalletAddress } from '../../utils';
13
+ import { navigationRoutes, shortenAddress } from '../../utils';
14
14
  import { HeaderAppBar, WalletButton } from './Header.style';
15
15
  import { WalletMenu } from './WalletMenu';
16
16
  export const WalletHeader = () => {
17
+ return (_jsx(HeaderAppBar, { elevation: 0, sx: { justifyContent: 'flex-end' }, children: _jsx(WalletMenuButton, {}) }));
18
+ };
19
+ export const WalletMenuButton = () => {
17
20
  const { account } = useWallet();
18
- return (_jsx(HeaderAppBar, { elevation: 0, sx: { justifyContent: 'flex-end' }, children: account.isActive ? _jsx(ConnectedButton, {}) : _jsx(ConnectButton, {}) }));
21
+ return account.isActive ? _jsx(ConnectedButton, {}) : _jsx(ConnectButton, {});
19
22
  };
20
23
  const ConnectButton = () => {
21
24
  const { t } = useTranslation();
22
25
  const { pathname } = useLocation();
23
- const config = useWidgetConfig();
26
+ const { walletManagement, subvariant } = useWidgetConfig();
24
27
  const { connect: connectWallet } = useWallet();
25
28
  const navigate = useNavigate();
26
29
  const connect = async () => {
27
- if (config.walletManagement) {
30
+ if (walletManagement) {
28
31
  await connectWallet();
29
32
  return;
30
33
  }
31
34
  navigate(navigationRoutes.selectWallet);
32
35
  };
33
- return (_jsx(WalletButton, { endIcon: _jsx(WalletIcon, {}), onClick: !pathname.includes(navigationRoutes.selectWallet) ? connect : undefined, sx: {
34
- marginRight: -1.25,
36
+ return (_jsx(WalletButton, { endIcon: subvariant !== 'split' ? _jsx(WalletIcon, {}) : undefined, startIcon: subvariant === 'split' ? _jsx(WalletIcon, {}) : undefined, onClick: !pathname.includes(navigationRoutes.selectWallet) ? connect : undefined, sx: {
37
+ marginRight: subvariant === 'split' ? 0 : -1.25,
38
+ marginLeft: subvariant === 'split' ? -1.25 : 0,
35
39
  }, children: t(`button.connectWallet`) }));
36
40
  };
37
41
  const ConnectedButton = () => {
38
42
  const { t } = useTranslation();
43
+ const { subvariant } = useWidgetConfig();
39
44
  const { account, disconnect } = useWallet();
40
- const walletAddress = shortenWalletAddress(account.address);
45
+ const walletAddress = shortenAddress(account.address);
41
46
  const { chain } = useChain(account.chainId);
42
47
  const [anchorEl, setAnchorEl] = useState(null);
43
48
  const handleClick = (event) => {
@@ -55,7 +60,8 @@ const ConnectedButton = () => {
55
60
  handleClose();
56
61
  };
57
62
  return (_jsxs(_Fragment, { children: [_jsx(WalletButton, { endIcon: _jsx(ExpandMoreIcon, {}), startIcon: _jsx(Avatar, { src: chain?.logoURI, alt: chain?.key, sx: { width: 24, height: 24 }, children: chain?.name[0] }), sx: {
58
- marginRight: -1.25,
63
+ marginRight: subvariant === 'split' ? 0 : -1.25,
64
+ marginLeft: subvariant === 'split' ? -1 : 0,
59
65
  }, onClick: handleClick, children: walletAddress }), _jsxs(WalletMenu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, children: [_jsxs(MenuItem, { onClick: handleCopyAddress, children: [_jsx(ContentCopyIcon, {}), t(`button.copyAddress`)] }), _jsxs(MenuItem, { component: "a", onClick: handleClose, href: `${chain?.metamask.blockExplorerUrls[0]}address/${account.address}`, target: "_blank", children: [_jsx(OpenInNewIcon, {}), t(`button.viewOnExplorer`)] }), _jsx(Button, { onClick: handleDisconnect, fullWidth: true, startIcon: _jsx(PowerSettingsNewIcon, {}), sx: {
60
66
  marginTop: 1,
61
67
  }, children: t(`button.disconnect`) })] })] }));
@@ -1,4 +1,3 @@
1
- /* eslint-disable no-underscore-dangle */
2
1
  import { create } from 'zustand';
3
2
  export const useHeaderActionStore = create((set, get) => ({
4
3
  setAction: (element) => {
@@ -2,6 +2,6 @@ import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import { RouteExecutionStatus } from '../../stores';
3
3
  import { InsuranceCard } from './InsuranceCard';
4
4
  import { InsuranceCollapsed } from './InsuranceCollapsed';
5
- export const Insurance = ({ status, insurableRouteId, feeAmountUsd, insuranceCoverageId, onChange, ...props }) => {
6
- return status === RouteExecutionStatus.Idle ? (_jsx(InsuranceCollapsed, { insurableRouteId: insurableRouteId, feeAmountUsd: feeAmountUsd, insuranceCoverageId: insuranceCoverageId, status: status, onChange: onChange, ...props })) : (_jsx(InsuranceCard, { feeAmountUsd: feeAmountUsd, status: status, insuranceCoverageId: insuranceCoverageId, ...props }));
5
+ export const Insurance = ({ status, insurableRouteId, onChange, ...props }) => {
6
+ return status === RouteExecutionStatus.Idle ? (_jsx(InsuranceCollapsed, { status: status, insurableRouteId: insurableRouteId, onChange: onChange, ...props })) : (_jsx(InsuranceCard, { status: status, ...props }));
7
7
  };