@lifi/widget 1.14.1 → 1.16.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 (311) hide show
  1. package/App.js +21 -0
  2. package/cjs/App.js +21 -0
  3. package/cjs/components/ActiveSwaps/ActiveSwapItem.d.ts +5 -0
  4. package/cjs/components/ActiveSwaps/ActiveSwapItem.js +45 -0
  5. package/cjs/components/{SwapInProgress/SwapInProgress.d.ts → ActiveSwaps/ActiveSwaps.d.ts} +1 -1
  6. package/cjs/components/ActiveSwaps/ActiveSwaps.js +30 -0
  7. package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +78 -0
  8. package/cjs/components/ActiveSwaps/ActiveSwaps.style.js +40 -0
  9. package/cjs/components/ActiveSwaps/index.d.ts +2 -0
  10. package/cjs/components/ActiveSwaps/index.js +18 -0
  11. package/cjs/components/Card/Card.d.ts +7 -4
  12. package/cjs/components/Card/Card.js +38 -28
  13. package/cjs/{pages/SelectTokenPage → components/ChainSelect}/ChainSelect.d.ts +1 -1
  14. package/cjs/components/ChainSelect/ChainSelect.js +35 -0
  15. package/cjs/components/{SwapInProgress/SwapInProgress.style.d.ts → ChainSelect/ChainSelect.style.d.ts} +10 -19
  16. package/cjs/components/ChainSelect/ChainSelect.style.js +19 -0
  17. package/cjs/components/ChainSelect/index.d.ts +2 -0
  18. package/cjs/components/ChainSelect/index.js +18 -0
  19. package/cjs/components/ChainSelect/useChainSelect.d.ts +8 -0
  20. package/cjs/components/ChainSelect/useChainSelect.js +33 -0
  21. package/cjs/components/Header/Header.js +3 -11
  22. package/cjs/components/Header/NavigationHeader.js +10 -17
  23. package/cjs/components/Header/WalletHeader.js +4 -5
  24. package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
  25. package/cjs/components/PoweredBy/PoweredBy.style.js +1 -0
  26. package/cjs/components/ReverseTokensButton/ReverseTokensButton.js +10 -10
  27. package/cjs/components/SelectTokenButton/SelectTokenButton.d.ts +1 -1
  28. package/cjs/components/SelectTokenButton/SelectTokenButton.js +3 -3
  29. package/{components/SwapInProgress/SwapInProgress.d.ts → cjs/components/SendToWallet/SendToWallet.d.ts} +1 -1
  30. package/cjs/components/SendToWallet/SendToWallet.js +53 -0
  31. package/cjs/components/SendToWallet/SendToWallet.style.d.ts +19 -0
  32. package/cjs/components/SendToWallet/SendToWallet.style.js +15 -0
  33. package/cjs/components/SendToWallet/index.d.ts +1 -0
  34. package/cjs/components/{SwapInProgress → SendToWallet}/index.js +1 -1
  35. package/cjs/components/Step/CircularProgress.js +1 -1
  36. package/cjs/components/Step/CircularProgress.style.js +1 -1
  37. package/cjs/components/Step/StepProcess.js +1 -5
  38. package/cjs/components/Step/StepProcess.style.d.ts +1 -1
  39. package/cjs/components/Step/StepTimer.d.ts +1 -0
  40. package/cjs/components/Step/StepTimer.js +6 -6
  41. package/cjs/components/SwapButton/SwapButton.js +10 -14
  42. package/cjs/components/SwapButton/types.d.ts +2 -2
  43. package/cjs/components/SwapInput/FormPriceHelperText.d.ts +1 -1
  44. package/cjs/components/SwapInput/FormPriceHelperText.js +4 -4
  45. package/cjs/components/SwapInput/SwapInput.d.ts +1 -1
  46. package/cjs/components/SwapInput/SwapInput.js +4 -4
  47. package/cjs/components/SwapInput/SwapInputAdornment.d.ts +1 -1
  48. package/cjs/components/SwapInput/SwapInputAdornment.js +4 -4
  49. package/cjs/components/SwapRouteCard/SwapRouteCard.js +5 -4
  50. package/cjs/components/SwapRouteCard/SwapRouteCard.style.js +3 -3
  51. package/cjs/components/TokenAvatar/TokenAvatar.style.js +0 -3
  52. package/cjs/components/TokenList/TokenList.js +14 -11
  53. package/cjs/components/TokenList/types.d.ts +1 -1
  54. package/cjs/config/theme.js +24 -23
  55. package/cjs/config/version.d.ts +1 -1
  56. package/cjs/config/version.js +1 -1
  57. package/cjs/hooks/index.d.ts +3 -0
  58. package/cjs/hooks/index.js +3 -0
  59. package/cjs/hooks/useChains.d.ts +1 -97
  60. package/cjs/hooks/useChains.js +8 -15
  61. package/cjs/hooks/useNavigateBack.d.ts +4 -0
  62. package/cjs/hooks/useNavigateBack.js +18 -0
  63. package/cjs/{components/Step/utils.d.ts → hooks/useProcessMessage.d.ts} +4 -0
  64. package/cjs/{components/Step/utils.js → hooks/useProcessMessage.js} +16 -10
  65. package/cjs/hooks/useRouteExecution.d.ts +1 -1
  66. package/cjs/hooks/useRouteExecution.js +20 -29
  67. package/cjs/hooks/useSwapRoutes.js +18 -7
  68. package/cjs/hooks/useWidgetEvents.d.ts +3 -0
  69. package/cjs/hooks/useWidgetEvents.js +13 -0
  70. package/cjs/i18n/en/translation.json +25 -15
  71. package/cjs/i18n/index.d.ts +20 -10
  72. package/cjs/index.d.ts +1 -0
  73. package/cjs/index.js +3 -1
  74. package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.d.ts +2 -0
  75. package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +18 -0
  76. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +2 -0
  77. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.js +21 -0
  78. package/cjs/pages/ActiveSwapsPage/index.d.ts +1 -0
  79. package/cjs/pages/ActiveSwapsPage/index.js +17 -0
  80. package/cjs/pages/MainPage/MainPage.js +2 -2
  81. package/cjs/pages/MainPage/MainSwapButton.js +3 -1
  82. package/cjs/pages/MainPage/SwapRoutes.js +4 -1
  83. package/cjs/pages/SelectChainPage/SelectChainPage.d.ts +3 -0
  84. package/cjs/pages/SelectChainPage/SelectChainPage.js +33 -0
  85. package/cjs/pages/SelectChainPage/SelectChainPage.style.d.ts +21 -0
  86. package/cjs/pages/SelectChainPage/SelectChainPage.style.js +20 -0
  87. package/cjs/pages/SelectChainPage/index.d.ts +1 -0
  88. package/cjs/pages/SelectChainPage/index.js +17 -0
  89. package/cjs/pages/SelectTokenPage/SearchTokenInput.js +3 -3
  90. package/cjs/pages/SelectTokenPage/SelectTokenPage.d.ts +2 -4
  91. package/cjs/pages/SelectTokenPage/SelectTokenPage.js +4 -8
  92. package/cjs/pages/SelectWalletPage/SelectWalletPage.js +10 -10
  93. package/cjs/pages/SelectWalletPage/SelectWalletPage.style.d.ts +2 -27
  94. package/cjs/pages/SelectWalletPage/SelectWalletPage.style.js +4 -14
  95. package/cjs/pages/SettingsPage/AdvancedPreferences.js +2 -2
  96. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.js +2 -2
  97. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  98. package/cjs/pages/SettingsPage/EnabledBridgesSelect.js +3 -6
  99. package/cjs/pages/SettingsPage/EnabledExchangesSelect.js +3 -5
  100. package/cjs/pages/SettingsPage/RoutePrioritySelect.js +5 -1
  101. package/cjs/pages/SettingsPage/SettingsPage.js +2 -1
  102. package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +2 -0
  103. package/cjs/pages/SettingsPage/ShowDestinationWallet.js +22 -0
  104. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +4 -3
  105. package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
  106. package/cjs/pages/SwapPage/StatusBottomSheet.js +29 -41
  107. package/cjs/pages/SwapPage/SwapPage.js +7 -3
  108. package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
  109. package/cjs/providers/SwapFormProvider/SwapFormProvider.d.ts +1 -0
  110. package/cjs/providers/SwapFormProvider/SwapFormProvider.js +43 -9
  111. package/cjs/providers/SwapFormProvider/types.d.ts +3 -1
  112. package/cjs/providers/SwapFormProvider/types.js +1 -0
  113. package/cjs/providers/WalletProvider/WalletProvider.js +10 -4
  114. package/cjs/providers/WalletProvider/types.d.ts +4 -2
  115. package/cjs/providers/WidgetProvider/WidgetProvider.js +3 -7
  116. package/cjs/providers/index.d.ts +4 -0
  117. package/cjs/providers/index.js +20 -0
  118. package/cjs/stores/chains/index.d.ts +4 -0
  119. package/cjs/stores/chains/index.js +20 -0
  120. package/cjs/stores/chains/types.d.ts +8 -0
  121. package/cjs/stores/chains/types.js +2 -0
  122. package/cjs/stores/chains/useChainOrder.d.ts +1 -0
  123. package/cjs/stores/chains/useChainOrder.js +12 -0
  124. package/cjs/stores/chains/useChainOrderStore.d.ts +19 -0
  125. package/cjs/stores/chains/useChainOrderStore.js +42 -0
  126. package/cjs/stores/chains/useInitializeChainOrder.d.ts +1 -0
  127. package/cjs/stores/chains/useInitializeChainOrder.js +12 -0
  128. package/cjs/stores/route/index.d.ts +2 -1
  129. package/cjs/stores/route/index.js +2 -1
  130. package/cjs/stores/route/useExecutingRoutesIds.d.ts +1 -0
  131. package/cjs/stores/route/useExecutingRoutesIds.js +20 -0
  132. package/cjs/stores/route/useRouteStore.js +5 -4
  133. package/cjs/stores/route/utils.d.ts +4 -0
  134. package/cjs/stores/route/utils.js +21 -0
  135. package/cjs/stores/settings/types.d.ts +2 -1
  136. package/cjs/stores/settings/useSettingsStore.d.ts +4 -2
  137. package/cjs/stores/settings/useSettingsStore.js +6 -2
  138. package/cjs/types/events.d.ts +5 -0
  139. package/cjs/types/events.js +9 -0
  140. package/cjs/types/index.d.ts +1 -0
  141. package/cjs/types/index.js +1 -0
  142. package/cjs/types/widget.d.ts +3 -1
  143. package/cjs/utils/format.js +7 -2
  144. package/cjs/utils/navigationRoutes.d.ts +5 -0
  145. package/cjs/utils/navigationRoutes.js +31 -4
  146. package/components/ActiveSwaps/ActiveSwapItem.d.ts +5 -0
  147. package/components/ActiveSwaps/ActiveSwapItem.js +41 -0
  148. package/components/ActiveSwaps/ActiveSwaps.d.ts +3 -0
  149. package/components/ActiveSwaps/ActiveSwaps.js +26 -0
  150. package/components/ActiveSwaps/ActiveSwaps.style.d.ts +78 -0
  151. package/components/ActiveSwaps/ActiveSwaps.style.js +37 -0
  152. package/components/ActiveSwaps/index.d.ts +2 -0
  153. package/components/ActiveSwaps/index.js +2 -0
  154. package/components/Card/Card.d.ts +7 -4
  155. package/components/Card/Card.js +39 -29
  156. package/{pages/SelectTokenPage → components/ChainSelect}/ChainSelect.d.ts +1 -1
  157. package/components/ChainSelect/ChainSelect.js +31 -0
  158. package/components/{SwapInProgress/SwapInProgress.style.d.ts → ChainSelect/ChainSelect.style.d.ts} +10 -19
  159. package/components/ChainSelect/ChainSelect.style.js +16 -0
  160. package/components/ChainSelect/index.d.ts +2 -0
  161. package/components/ChainSelect/index.js +2 -0
  162. package/components/ChainSelect/useChainSelect.d.ts +8 -0
  163. package/components/ChainSelect/useChainSelect.js +29 -0
  164. package/components/Header/Header.js +2 -10
  165. package/components/Header/NavigationHeader.js +11 -18
  166. package/components/Header/WalletHeader.js +1 -2
  167. package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
  168. package/components/PoweredBy/PoweredBy.style.js +1 -0
  169. package/components/ReverseTokensButton/ReverseTokensButton.js +1 -1
  170. package/components/SelectTokenButton/SelectTokenButton.d.ts +1 -1
  171. package/components/SelectTokenButton/SelectTokenButton.js +1 -1
  172. package/components/SendToWallet/SendToWallet.d.ts +3 -0
  173. package/components/SendToWallet/SendToWallet.js +49 -0
  174. package/components/SendToWallet/SendToWallet.style.d.ts +19 -0
  175. package/components/SendToWallet/SendToWallet.style.js +12 -0
  176. package/components/SendToWallet/index.d.ts +1 -0
  177. package/components/SendToWallet/index.js +1 -0
  178. package/components/Step/CircularProgress.js +3 -3
  179. package/components/Step/CircularProgress.style.js +1 -1
  180. package/components/Step/StepProcess.js +2 -6
  181. package/components/Step/StepProcess.style.d.ts +1 -1
  182. package/components/Step/StepTimer.d.ts +1 -0
  183. package/components/Step/StepTimer.js +6 -6
  184. package/components/SwapButton/SwapButton.js +7 -11
  185. package/components/SwapButton/types.d.ts +2 -2
  186. package/components/SwapInput/FormPriceHelperText.d.ts +1 -1
  187. package/components/SwapInput/FormPriceHelperText.js +1 -1
  188. package/components/SwapInput/SwapInput.d.ts +1 -1
  189. package/components/SwapInput/SwapInput.js +1 -1
  190. package/components/SwapInput/SwapInputAdornment.d.ts +1 -1
  191. package/components/SwapInput/SwapInputAdornment.js +1 -1
  192. package/components/SwapRouteCard/SwapRouteCard.js +5 -4
  193. package/components/SwapRouteCard/SwapRouteCard.style.js +3 -3
  194. package/components/TokenAvatar/TokenAvatar.style.js +0 -3
  195. package/components/TokenList/TokenList.js +7 -4
  196. package/components/TokenList/types.d.ts +1 -1
  197. package/config/theme.js +24 -23
  198. package/config/version.d.ts +1 -1
  199. package/config/version.js +1 -1
  200. package/hooks/index.d.ts +3 -0
  201. package/hooks/index.js +3 -0
  202. package/hooks/useChains.d.ts +1 -97
  203. package/hooks/useChains.js +8 -15
  204. package/hooks/useNavigateBack.d.ts +4 -0
  205. package/hooks/useNavigateBack.js +14 -0
  206. package/{components/Step/utils.d.ts → hooks/useProcessMessage.d.ts} +4 -0
  207. package/{pages/SwapPage/utils.js → hooks/useProcessMessage.js} +15 -10
  208. package/hooks/useRouteExecution.d.ts +1 -1
  209. package/hooks/useRouteExecution.js +21 -30
  210. package/hooks/useSwapRoutes.js +18 -7
  211. package/hooks/useWidgetEvents.d.ts +3 -0
  212. package/hooks/useWidgetEvents.js +6 -0
  213. package/i18n/en/translation.json +25 -15
  214. package/i18n/index.d.ts +20 -10
  215. package/index.d.ts +1 -0
  216. package/index.js +1 -0
  217. package/package.json +17 -19
  218. package/pages/ActiveSwapsPage/ActiveSwapsEmpty.d.ts +2 -0
  219. package/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +14 -0
  220. package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +2 -0
  221. package/pages/ActiveSwapsPage/ActiveSwapsPage.js +17 -0
  222. package/pages/ActiveSwapsPage/index.d.ts +1 -0
  223. package/pages/ActiveSwapsPage/index.js +1 -0
  224. package/pages/MainPage/MainPage.js +2 -2
  225. package/pages/MainPage/MainSwapButton.js +3 -1
  226. package/pages/MainPage/SwapRoutes.js +4 -1
  227. package/pages/SelectChainPage/SelectChainPage.d.ts +3 -0
  228. package/pages/SelectChainPage/SelectChainPage.js +29 -0
  229. package/pages/SelectChainPage/SelectChainPage.style.d.ts +21 -0
  230. package/pages/SelectChainPage/SelectChainPage.style.js +17 -0
  231. package/pages/SelectChainPage/index.d.ts +1 -0
  232. package/pages/SelectChainPage/index.js +1 -0
  233. package/pages/SelectTokenPage/SearchTokenInput.js +1 -1
  234. package/pages/SelectTokenPage/SelectTokenPage.d.ts +2 -4
  235. package/pages/SelectTokenPage/SelectTokenPage.js +5 -9
  236. package/pages/SelectWalletPage/SelectWalletPage.js +10 -10
  237. package/pages/SelectWalletPage/SelectWalletPage.style.d.ts +2 -27
  238. package/pages/SelectWalletPage/SelectWalletPage.style.js +4 -14
  239. package/pages/SettingsPage/AdvancedPreferences.js +2 -2
  240. package/pages/SettingsPage/ColorSchemeButtonGroup.js +1 -1
  241. package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  242. package/pages/SettingsPage/EnabledBridgesSelect.js +4 -7
  243. package/pages/SettingsPage/EnabledExchangesSelect.js +4 -6
  244. package/pages/SettingsPage/RoutePrioritySelect.js +5 -1
  245. package/pages/SettingsPage/SettingsPage.js +2 -1
  246. package/pages/SettingsPage/ShowDestinationWallet.d.ts +2 -0
  247. package/pages/SettingsPage/ShowDestinationWallet.js +18 -0
  248. package/pages/SwapDetailsPage/SwapDetailsPage.js +5 -4
  249. package/pages/SwapHistoryPage/SwapHistoryPage.js +1 -1
  250. package/pages/SwapPage/StatusBottomSheet.js +30 -42
  251. package/pages/SwapPage/SwapPage.js +9 -5
  252. package/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
  253. package/providers/SwapFormProvider/SwapFormProvider.d.ts +1 -0
  254. package/providers/SwapFormProvider/SwapFormProvider.js +43 -9
  255. package/providers/SwapFormProvider/types.d.ts +3 -1
  256. package/providers/SwapFormProvider/types.js +1 -0
  257. package/providers/WalletProvider/WalletProvider.js +10 -4
  258. package/providers/WalletProvider/types.d.ts +4 -2
  259. package/providers/WidgetProvider/WidgetProvider.js +3 -7
  260. package/providers/index.d.ts +4 -0
  261. package/providers/index.js +4 -0
  262. package/stores/chains/index.d.ts +4 -0
  263. package/stores/chains/index.js +4 -0
  264. package/stores/chains/types.d.ts +8 -0
  265. package/stores/chains/types.js +1 -0
  266. package/stores/chains/useChainOrder.d.ts +1 -0
  267. package/stores/chains/useChainOrder.js +5 -0
  268. package/stores/chains/useChainOrderStore.d.ts +19 -0
  269. package/stores/chains/useChainOrderStore.js +36 -0
  270. package/stores/chains/useInitializeChainOrder.d.ts +1 -0
  271. package/stores/chains/useInitializeChainOrder.js +5 -0
  272. package/stores/route/index.d.ts +2 -1
  273. package/stores/route/index.js +2 -1
  274. package/stores/route/useExecutingRoutesIds.d.ts +1 -0
  275. package/stores/route/useExecutingRoutesIds.js +13 -0
  276. package/stores/route/useRouteStore.js +5 -4
  277. package/stores/route/utils.d.ts +4 -0
  278. package/stores/route/utils.js +15 -0
  279. package/stores/settings/types.d.ts +2 -1
  280. package/stores/settings/useSettingsStore.d.ts +4 -2
  281. package/stores/settings/useSettingsStore.js +6 -2
  282. package/tsconfig.cjs.tsbuildinfo +1 -1
  283. package/types/events.d.ts +5 -0
  284. package/types/events.js +6 -0
  285. package/types/index.d.ts +1 -0
  286. package/types/index.js +1 -0
  287. package/types/widget.d.ts +3 -1
  288. package/utils/format.js +7 -2
  289. package/utils/navigationRoutes.d.ts +5 -0
  290. package/utils/navigationRoutes.js +30 -3
  291. package/cjs/components/SwapButton/SwapButton.style.d.ts +0 -65
  292. package/cjs/components/SwapButton/SwapButton.style.js +0 -15
  293. package/cjs/components/SwapInProgress/SwapInProgress.js +0 -29
  294. package/cjs/components/SwapInProgress/SwapInProgress.style.js +0 -17
  295. package/cjs/components/SwapInProgress/index.d.ts +0 -1
  296. package/cjs/pages/SelectTokenPage/ChainSelect.js +0 -32
  297. package/cjs/pages/SwapPage/utils.d.ts +0 -6
  298. package/cjs/pages/SwapPage/utils.js +0 -93
  299. package/cjs/stores/route/useExecutingRoutes.d.ts +0 -2
  300. package/cjs/stores/route/useExecutingRoutes.js +0 -13
  301. package/components/Step/utils.js +0 -89
  302. package/components/SwapButton/SwapButton.style.d.ts +0 -65
  303. package/components/SwapButton/SwapButton.style.js +0 -12
  304. package/components/SwapInProgress/SwapInProgress.js +0 -25
  305. package/components/SwapInProgress/SwapInProgress.style.js +0 -14
  306. package/components/SwapInProgress/index.d.ts +0 -1
  307. package/components/SwapInProgress/index.js +0 -1
  308. package/pages/SelectTokenPage/ChainSelect.js +0 -28
  309. package/pages/SwapPage/utils.d.ts +0 -6
  310. package/stores/route/useExecutingRoutes.d.ts +0 -2
  311. package/stores/route/useExecutingRoutes.js +0 -6
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.useChainSelect = void 0;
4
+ const react_hook_form_1 = require("react-hook-form");
5
+ const hooks_1 = require("../../hooks");
6
+ const providers_1 = require("../../providers");
7
+ const chains_1 = require("../../stores/chains");
8
+ const useChainSelect = (formType) => {
9
+ const { setValue } = (0, react_hook_form_1.useFormContext)();
10
+ const { chains, isLoading } = (0, hooks_1.useChains)();
11
+ const [chainOrder, setChainOrder] = (0, chains_1.useChainOrder)();
12
+ const chainKey = providers_1.SwapFormKeyHelper.getChainKey(formType);
13
+ const getChains = () => {
14
+ if (!chains) {
15
+ return [];
16
+ }
17
+ const selectedChains = chainOrder
18
+ .map((chainId) => chains.find((chain) => chain.id === chainId))
19
+ .filter((chain) => chain);
20
+ return selectedChains;
21
+ };
22
+ const setCurrentChain = (chainId) => {
23
+ setValue(chainKey, chainId, { shouldDirty: true });
24
+ setValue(providers_1.SwapFormKeyHelper.getTokenKey(formType), '', {
25
+ shouldDirty: false,
26
+ });
27
+ setValue(providers_1.SwapFormKeyHelper.getAmountKey(formType), '');
28
+ setValue(providers_1.SwapFormKey.TokenSearchFilter, '');
29
+ setChainOrder(chainId);
30
+ };
31
+ return { chains, getChains, setCurrentChain, isLoading };
32
+ };
33
+ exports.useChainSelect = useChainSelect;
@@ -3,25 +3,17 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Header = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const react_router_dom_1 = require("react-router-dom");
6
- const WidgetProvider_1 = require("../../providers/WidgetProvider");
6
+ const providers_1 = require("../../providers");
7
7
  const utils_1 = require("../../utils");
8
8
  const Header_style_1 = require("./Header.style");
9
9
  const NavigationHeader_1 = require("./NavigationHeader");
10
10
  const WalletHeader_1 = require("./WalletHeader");
11
- const stickyHeaderRoutes = [
12
- utils_1.navigationRoutes.selectWallet,
13
- utils_1.navigationRoutes.settings,
14
- utils_1.navigationRoutes.swapRoutes,
15
- utils_1.navigationRoutes.swapExecution,
16
- utils_1.navigationRoutes.swapHistory,
17
- utils_1.navigationRoutes.swapDetails,
18
- ];
19
11
  const HeaderContainer = ({ children }) => {
20
12
  const { pathname } = (0, react_router_dom_1.useLocation)();
21
- return ((0, jsx_runtime_1.jsx)(Header_style_1.Container, Object.assign({ id: utils_1.ElementId.Header, sticky: stickyHeaderRoutes.some((route) => pathname.includes(route)) }, { children: children })));
13
+ return ((0, jsx_runtime_1.jsx)(Header_style_1.Container, Object.assign({ id: utils_1.ElementId.Header, sticky: utils_1.stickyHeaderRoutes.some((route) => pathname.includes(route)) }, { children: children })));
22
14
  };
23
15
  const Header = () => {
24
- const { walletManagement } = (0, WidgetProvider_1.useWidgetConfig)();
16
+ const { walletManagement } = (0, providers_1.useWidgetConfig)();
25
17
  return ((0, jsx_runtime_1.jsxs)(HeaderContainer, { children: [!walletManagement ? (0, jsx_runtime_1.jsx)(WalletHeader_1.WalletHeader, {}) : null, (0, jsx_runtime_1.jsx)(NavigationHeader_1.NavigationHeader, {})] }));
26
18
  };
27
19
  exports.Header = Header;
@@ -6,31 +6,19 @@ const icons_material_1 = require("@mui/icons-material");
6
6
  const material_1 = require("@mui/material");
7
7
  const react_i18next_1 = require("react-i18next");
8
8
  const react_router_dom_1 = require("react-router-dom");
9
- const WalletProvider_1 = require("../../providers/WalletProvider");
9
+ const hooks_1 = require("../../hooks");
10
+ const providers_1 = require("../../providers");
10
11
  const utils_1 = require("../../utils");
11
12
  const Header_style_1 = require("./Header.style");
12
13
  const useHeaderActionStore_1 = require("./useHeaderActionStore");
13
- const backButtonRoutes = [
14
- utils_1.navigationRoutes.selectWallet,
15
- utils_1.navigationRoutes.settings,
16
- utils_1.navigationRoutes.swapHistory,
17
- utils_1.navigationRoutes.fromToken,
18
- utils_1.navigationRoutes.toToken,
19
- utils_1.navigationRoutes.swapRoutes,
20
- utils_1.navigationRoutes.swapExecution,
21
- utils_1.navigationRoutes.swapDetails,
22
- ];
23
14
  const NavigationHeader = () => {
24
15
  const { t } = (0, react_i18next_1.useTranslation)();
25
- const navigate = (0, react_router_dom_1.useNavigate)();
26
- const { account } = (0, WalletProvider_1.useWallet)();
16
+ const { navigate, navigateBack } = (0, hooks_1.useNavigateBack)();
17
+ const { account } = (0, providers_1.useWallet)();
27
18
  const { element } = (0, useHeaderActionStore_1.useHeaderActionStore)();
28
19
  const { pathname } = (0, react_router_dom_1.useLocation)();
29
20
  const path = pathname.substring(pathname.lastIndexOf('/') + 1);
30
21
  const hasPath = utils_1.navigationRoutesValues.includes(path);
31
- const handleBack = () => {
32
- navigate(-1);
33
- };
34
22
  const handleHeaderTitle = () => {
35
23
  switch (path) {
36
24
  case utils_1.navigationRoutes.selectWallet:
@@ -43,8 +31,13 @@ const NavigationHeader = () => {
43
31
  return t(`header.from`);
44
32
  case utils_1.navigationRoutes.toToken:
45
33
  return t(`header.to`);
34
+ case utils_1.navigationRoutes.fromChain:
35
+ case utils_1.navigationRoutes.toChain:
36
+ return t(`header.selectChain`);
46
37
  case utils_1.navigationRoutes.swapRoutes:
47
38
  return t(`header.routes`);
39
+ case utils_1.navigationRoutes.activeSwaps:
40
+ return t(`header.activeSwaps`);
48
41
  case utils_1.navigationRoutes.swapExecution:
49
42
  return t(`header.swap`);
50
43
  case utils_1.navigationRoutes.swapDetails:
@@ -53,6 +46,6 @@ const NavigationHeader = () => {
53
46
  return t(`header.swap`);
54
47
  }
55
48
  };
56
- return ((0, jsx_runtime_1.jsxs)(Header_style_1.HeaderAppBar, Object.assign({ elevation: 0 }, { children: [backButtonRoutes.includes(path) ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "start", onClick: handleBack }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.ArrowBack, {}) }))) : null, (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true }, { children: handleHeaderTitle() })), (0, jsx_runtime_1.jsxs)(react_router_dom_1.Routes, { children: [(0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: utils_1.navigationRoutes.home, element: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [account.isActive ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", "aria-label": "swap-history", edge: "start", onClick: () => navigate(utils_1.navigationRoutes.swapHistory) }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.History, {}) }))) : null, (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "end", onClick: () => navigate(utils_1.navigationRoutes.settings) }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.SettingsOutlined, {}) }))] }) }), (0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "*", element: element || (0, jsx_runtime_1.jsx)(material_1.Box, { width: 28, height: 40 }) })] })] })));
49
+ return ((0, jsx_runtime_1.jsxs)(Header_style_1.HeaderAppBar, Object.assign({ elevation: 0 }, { children: [utils_1.backButtonRoutes.includes(path) ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "start", onClick: navigateBack }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.ArrowBack, {}) }))) : null, (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true }, { children: handleHeaderTitle() })), (0, jsx_runtime_1.jsxs)(react_router_dom_1.Routes, { children: [(0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: utils_1.navigationRoutes.home, element: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [account.isActive ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", "aria-label": "swap-history", edge: "start", onClick: () => navigate(utils_1.navigationRoutes.swapHistory) }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.History, {}) }))) : null, (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "end", onClick: () => navigate(utils_1.navigationRoutes.settings) }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.SettingsOutlined, {}) }))] }) }), (0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "*", element: element || (0, jsx_runtime_1.jsx)(material_1.Box, { width: 28, height: 40 }) })] })] })));
57
50
  };
58
51
  exports.NavigationHeader = NavigationHeader;
@@ -15,13 +15,12 @@ const icons_material_1 = require("@mui/icons-material");
15
15
  const material_1 = require("@mui/material");
16
16
  const react_i18next_1 = require("react-i18next");
17
17
  const react_router_dom_1 = require("react-router-dom");
18
- const WalletProvider_1 = require("../../providers/WalletProvider");
19
- const WidgetProvider_1 = require("../../providers/WidgetProvider");
18
+ const providers_1 = require("../../providers");
20
19
  const utils_1 = require("../../utils");
21
20
  const Header_style_1 = require("./Header.style");
22
21
  const WalletHeader = () => {
23
22
  const { t } = (0, react_i18next_1.useTranslation)();
24
- const { account, disconnect } = (0, WalletProvider_1.useWallet)();
23
+ const { account, disconnect } = (0, providers_1.useWallet)();
25
24
  const walletAddress = account.address
26
25
  ? `${account.address.substring(0, 7)}...${account.address.substring(account.address.length - 7)}`
27
26
  : null;
@@ -34,8 +33,8 @@ const WalletHeader = () => {
34
33
  exports.WalletHeader = WalletHeader;
35
34
  const ConnectButton = () => {
36
35
  const { pathname } = (0, react_router_dom_1.useLocation)();
37
- const config = (0, WidgetProvider_1.useWidgetConfig)();
38
- const { connect: walletConnect } = (0, WalletProvider_1.useWallet)();
36
+ const config = (0, providers_1.useWidgetConfig)();
37
+ const { connect: walletConnect } = (0, providers_1.useWallet)();
39
38
  const navigate = (0, react_router_dom_1.useNavigate)();
40
39
  const connect = () => __awaiter(void 0, void 0, void 0, function* () {
41
40
  if (config.walletManagement) {
@@ -2,7 +2,7 @@
2
2
  export declare const Link: import("@emotion/styled").StyledComponent<Omit<import("@mui/material").LinkBaseProps, "classes"> & {
3
3
  children?: import("react").ReactNode;
4
4
  classes?: Partial<import("@mui/material").LinkClasses> | undefined;
5
- color?: import("@mui/system/styleFunctionSx").ResponsiveStyleValue<import("csstype").Property.Color | import("csstype").Property.Color[] | undefined> | ((theme: import("@mui/material").Theme) => import("@mui/system/styleFunctionSx").ResponsiveStyleValue<import("csstype").Property.Color | import("csstype").Property.Color[] | undefined>);
5
+ color?: import("@mui/system/styleFunctionSx").ResponsiveStyleValue<string[] | import("csstype").Property.Color | undefined> | ((theme: import("@mui/material").Theme) => import("@mui/system/styleFunctionSx").ResponsiveStyleValue<string[] | import("csstype").Property.Color | undefined>);
6
6
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
7
7
  TypographyClasses?: (Partial<import("@mui/material").TypographyClasses> & Partial<import("@mui/material").ClassNameMap<never>>) | undefined;
8
8
  underline?: "none" | "always" | "hover" | undefined;
@@ -6,6 +6,7 @@ const styles_1 = require("@mui/material/styles");
6
6
  exports.Link = (0, styles_1.styled)(material_1.Link)(({ theme }) => ({
7
7
  display: 'flex',
8
8
  alignItems: 'center',
9
+ border: 'none',
9
10
  ':hover': {
10
11
  color: theme.palette.primary.main,
11
12
  },
@@ -4,22 +4,22 @@ exports.ReverseTokensButton = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const icons_material_1 = require("@mui/icons-material");
6
6
  const react_hook_form_1 = require("react-hook-form");
7
- const SwapFormProvider_1 = require("../../providers/SwapFormProvider");
7
+ const providers_1 = require("../../providers");
8
8
  const ReverseTokensButton_style_1 = require("./ReverseTokensButton.style");
9
9
  const ReverseTokensButton = ({ vertical, }) => {
10
10
  const { setValue, getValues } = (0, react_hook_form_1.useFormContext)();
11
11
  const handleClick = () => {
12
12
  const [fromChain, fromToken, toChain, toToken] = getValues([
13
- SwapFormProvider_1.SwapFormKey.FromChain,
14
- SwapFormProvider_1.SwapFormKey.FromToken,
15
- SwapFormProvider_1.SwapFormKey.ToChain,
16
- SwapFormProvider_1.SwapFormKey.ToToken,
13
+ providers_1.SwapFormKey.FromChain,
14
+ providers_1.SwapFormKey.FromToken,
15
+ providers_1.SwapFormKey.ToChain,
16
+ providers_1.SwapFormKey.ToToken,
17
17
  ]);
18
- setValue(SwapFormProvider_1.SwapFormKey.FromAmount, '');
19
- setValue(SwapFormProvider_1.SwapFormKey.FromChain, toChain);
20
- setValue(SwapFormProvider_1.SwapFormKey.FromToken, toToken);
21
- setValue(SwapFormProvider_1.SwapFormKey.ToChain, fromChain);
22
- setValue(SwapFormProvider_1.SwapFormKey.ToToken, fromToken);
18
+ setValue(providers_1.SwapFormKey.FromAmount, '');
19
+ setValue(providers_1.SwapFormKey.FromChain, toChain);
20
+ setValue(providers_1.SwapFormKey.FromToken, toToken);
21
+ setValue(providers_1.SwapFormKey.ToChain, fromChain);
22
+ setValue(providers_1.SwapFormKey.ToToken, fromToken);
23
23
  };
24
24
  return ((0, jsx_runtime_1.jsx)(ReverseTokensButton_style_1.IconButton, Object.assign({ onClick: handleClick, size: "small", "aria-label": "swap-destinations" }, { children: vertical ? (0, jsx_runtime_1.jsx)(icons_material_1.SwapVert, {}) : (0, jsx_runtime_1.jsx)(icons_material_1.SwapHoriz, {}) })));
25
25
  };
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { SwapFormTypeProps } from '../../providers/SwapFormProvider';
2
+ import type { SwapFormTypeProps } from '../../providers';
3
3
  export declare const SelectTokenButton: React.FC<SwapFormTypeProps & {
4
4
  compact: boolean;
5
5
  }>;
@@ -8,7 +8,7 @@ const react_hook_form_1 = require("react-hook-form");
8
8
  const react_i18next_1 = require("react-i18next");
9
9
  const react_router_dom_1 = require("react-router-dom");
10
10
  const hooks_1 = require("../../hooks");
11
- const SwapFormProvider_1 = require("../../providers/SwapFormProvider");
11
+ const providers_1 = require("../../providers");
12
12
  const utils_1 = require("../../utils");
13
13
  const Card_1 = require("../Card");
14
14
  const TokenAvatar_1 = require("../TokenAvatar");
@@ -18,8 +18,8 @@ const SelectTokenButton = ({ formType, compact }) => {
18
18
  const navigate = (0, react_router_dom_1.useNavigate)();
19
19
  const [chainId, tokenAddress] = (0, react_hook_form_1.useWatch)({
20
20
  name: [
21
- SwapFormProvider_1.SwapFormKeyHelper.getChainKey(formType),
22
- SwapFormProvider_1.SwapFormKeyHelper.getTokenKey(formType),
21
+ providers_1.SwapFormKeyHelper.getChainKey(formType),
22
+ providers_1.SwapFormKeyHelper.getTokenKey(formType),
23
23
  ],
24
24
  });
25
25
  const { chain, isLoading: isChainLoading } = (0, hooks_1.useChain)(chainId);
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
2
  import type { BoxProps } from '@mui/material';
3
- export declare const SwapInProgress: React.FC<BoxProps>;
3
+ export declare const SendToWallet: React.FC<BoxProps>;
@@ -0,0 +1,53 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.SendToWallet = void 0;
13
+ const jsx_runtime_1 = require("react/jsx-runtime");
14
+ const address_1 = require("@ethersproject/address");
15
+ const material_1 = require("@mui/material");
16
+ const react_1 = require("react");
17
+ const react_hook_form_1 = require("react-hook-form");
18
+ const react_i18next_1 = require("react-i18next");
19
+ const providers_1 = require("../../providers");
20
+ const stores_1 = require("../../stores");
21
+ const Card_1 = require("../Card");
22
+ const SendToWallet_style_1 = require("./SendToWallet.style");
23
+ const SendToWallet = (props) => {
24
+ var _a;
25
+ const { t } = (0, react_i18next_1.useTranslation)();
26
+ const { showDestinationWallet } = (0, stores_1.useSettings)(['showDestinationWallet']);
27
+ const { account, provider } = (0, providers_1.useWallet)();
28
+ const { register, trigger, formState: { errors }, } = (0, react_hook_form_1.useFormContext)();
29
+ (0, react_1.useEffect)(() => {
30
+ trigger(providers_1.SwapFormKey.ToAddress);
31
+ }, [account.chainId, trigger]);
32
+ if (!showDestinationWallet) {
33
+ return null;
34
+ }
35
+ const { onChange, onBlur, name, ref } = register(providers_1.SwapFormKey.ToAddress, {
36
+ validate: (value) => __awaiter(void 0, void 0, void 0, function* () {
37
+ try {
38
+ if (!value) {
39
+ return true;
40
+ }
41
+ const address = yield (provider === null || provider === void 0 ? void 0 : provider.resolveName(value));
42
+ return ((0, address_1.isAddress)(address || value) ||
43
+ t('swap.error.title.walletAddressInvalid'));
44
+ }
45
+ catch (_b) {
46
+ return t('swap.error.title.walletEnsAddressInvalid');
47
+ }
48
+ }),
49
+ onBlur: () => trigger(providers_1.SwapFormKey.ToAddress),
50
+ });
51
+ return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({}, props, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('swap.sendToWallet') }), (0, jsx_runtime_1.jsxs)(SendToWallet_style_1.FormControl, Object.assign({ fullWidth: true }, { children: [(0, jsx_runtime_1.jsx)(SendToWallet_style_1.Input, { ref: ref, size: "small", autoComplete: "off", autoCorrect: "off", autoCapitalize: "off", spellCheck: "false", onChange: onChange, onBlur: onBlur, name: name, placeholder: t('swap.walletAddressOrEns') }), (0, jsx_runtime_1.jsx)(material_1.FormHelperText, Object.assign({ error: !!errors.toAddress }, { children: (_a = errors.toAddress) === null || _a === void 0 ? void 0 : _a.message }))] }))] })));
52
+ };
53
+ exports.SendToWallet = SendToWallet;
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ export declare const FormControl: import("@emotion/styled").StyledComponent<{
3
+ children?: import("react").ReactNode;
4
+ classes?: Partial<import("@mui/material").FormControlClasses> | undefined;
5
+ color?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | undefined;
6
+ disabled?: boolean | undefined;
7
+ error?: boolean | undefined;
8
+ fullWidth?: boolean | undefined;
9
+ focused?: boolean | undefined;
10
+ hiddenLabel?: boolean | undefined;
11
+ margin?: "none" | "normal" | "dense" | undefined;
12
+ required?: boolean | undefined;
13
+ size?: "small" | "medium" | undefined;
14
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
15
+ variant?: "outlined" | "filled" | "standard" | undefined;
16
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
17
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
18
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "color" | "children" | "disabled" | "sx" | "margin" | "fullWidth" | "size" | "variant" | "error" | "required" | "focused" | "hiddenLabel"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
19
+ export declare const Input: import("@emotion/styled").StyledComponent<import("@mui/material").InputBaseProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Input = exports.FormControl = void 0;
4
+ const material_1 = require("@mui/material");
5
+ const InputBase_1 = require("@mui/material/InputBase");
6
+ const styles_1 = require("@mui/material/styles");
7
+ exports.FormControl = (0, styles_1.styled)(material_1.FormControl)(({ theme }) => ({
8
+ padding: theme.spacing(1.5, 2, 1.5, 0),
9
+ }));
10
+ exports.Input = (0, styles_1.styled)(material_1.InputBase)(({ theme }) => ({
11
+ [`.${InputBase_1.inputBaseClasses.input}`]: {
12
+ height: 32,
13
+ padding: theme.spacing(0, 0, 0, 2),
14
+ },
15
+ }));
@@ -0,0 +1 @@
1
+ export * from './SendToWallet';
@@ -14,4 +14,4 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./SwapInProgress"), exports);
17
+ __exportStar(require("./SendToWallet"), exports);
@@ -10,7 +10,7 @@ function CircularProgress({ status }) {
10
10
  display: 'grid',
11
11
  position: 'relative',
12
12
  placeItems: 'center',
13
- } }, { children: [(0, jsx_runtime_1.jsx)(CircularProgress_style_1.CircularProgress, { variant: "determinate", status: status, size: 32, thickness: 3, value: 100 }), status === 'STARTED' || status === 'PENDING' ? ((0, jsx_runtime_1.jsx)(CircularProgress_style_1.CircularProgressPending, { size: 32, thickness: 3 })) : null, status === 'ACTION_REQUIRED' ? ((0, jsx_runtime_1.jsx)(icons_material_1.Info, { color: "primary", sx: {
13
+ } }, { children: [(0, jsx_runtime_1.jsx)(CircularProgress_style_1.CircularProgress, { variant: "determinate", status: status, size: 32, thickness: 3, value: 100 }), status === 'STARTED' || status === 'PENDING' ? ((0, jsx_runtime_1.jsx)(CircularProgress_style_1.CircularProgressPending, { size: 32, thickness: 3 })) : null, status === 'ACTION_REQUIRED' ? ((0, jsx_runtime_1.jsx)(icons_material_1.Info, { color: "info", sx: {
14
14
  position: 'absolute',
15
15
  fontSize: '1rem',
16
16
  } })) : null, status === 'DONE' ? ((0, jsx_runtime_1.jsx)(icons_material_1.Done, { color: "success", sx: {
@@ -21,7 +21,7 @@ const circleAnimation = (0, styles_1.keyframes)({
21
21
  const getStatusColor = (status, theme) => {
22
22
  switch (status) {
23
23
  case 'ACTION_REQUIRED':
24
- return theme.palette.primary.main;
24
+ return theme.palette.info.main;
25
25
  case 'DONE':
26
26
  return theme.palette.success.main;
27
27
  case 'FAILED':
@@ -4,15 +4,11 @@ exports.StepProcess = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const icons_material_1 = require("@mui/icons-material");
6
6
  const material_1 = require("@mui/material");
7
- const react_i18next_1 = require("react-i18next");
8
7
  const hooks_1 = require("../../hooks");
9
8
  const CircularProgress_1 = require("./CircularProgress");
10
9
  const StepProcess_style_1 = require("./StepProcess.style");
11
- const utils_1 = require("./utils");
12
10
  const StepProcess = ({ step, process }) => {
13
- const { t } = (0, react_i18next_1.useTranslation)();
14
- const { getChainById } = (0, hooks_1.useChains)();
15
- const { title, message } = (0, utils_1.getProcessMessage)(t, getChainById, step, process);
11
+ const { title, message } = (0, hooks_1.useProcessMessage)(step, process);
16
12
  return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ px: 2, py: 1 }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: {
17
13
  display: 'flex',
18
14
  alignItems: 'center',
@@ -29,7 +29,7 @@ export declare const LinkButton: import("@emotion/styled").StyledComponent<{
29
29
  }, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "color" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "size" | "edge"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & Omit<import("@mui/material").LinkBaseProps, "classes"> & {
30
30
  children?: import("react").ReactNode;
31
31
  classes?: Partial<import("@mui/material").LinkClasses> | undefined;
32
- color?: import("@mui/system/styleFunctionSx").ResponsiveStyleValue<import("csstype").Property.Color | import("csstype").Property.Color[] | undefined> | ((theme: import("@mui/material").Theme) => import("@mui/system/styleFunctionSx").ResponsiveStyleValue<import("csstype").Property.Color | import("csstype").Property.Color[] | undefined>);
32
+ color?: import("@mui/system/styleFunctionSx").ResponsiveStyleValue<string[] | import("csstype").Property.Color | undefined> | ((theme: import("@mui/material").Theme) => import("@mui/system/styleFunctionSx").ResponsiveStyleValue<string[] | import("csstype").Property.Color | undefined>);
33
33
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
34
34
  TypographyClasses?: (Partial<import("@mui/material").TypographyClasses> & Partial<import("@mui/material").ClassNameMap<never>>) | undefined;
35
35
  underline?: "none" | "always" | "hover" | undefined;
@@ -2,4 +2,5 @@
2
2
  import type { Step } from '@lifi/sdk';
3
3
  export declare const StepTimer: React.FC<{
4
4
  step: Step;
5
+ hideInProgress?: boolean;
5
6
  }>;
@@ -10,7 +10,7 @@ const getExpiryTimestamp = (step) => {
10
10
  return new Date(((_c = (_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.process[0]) === null || _b === void 0 ? void 0 : _b.startedAt) !== null && _c !== void 0 ? _c : Date.now()) +
11
11
  step.estimate.executionDuration * 1000);
12
12
  };
13
- const StepTimer = ({ step }) => {
13
+ const StepTimer = ({ step, hideInProgress, }) => {
14
14
  var _a, _b;
15
15
  const { t } = (0, react_i18next_1.useTranslation)();
16
16
  const [isExpired, setExpired] = (0, react_1.useState)(false);
@@ -29,9 +29,7 @@ const StepTimer = ({ step }) => {
29
29
  setExecutionStarted(true);
30
30
  restart(getExpiryTimestamp(step));
31
31
  }
32
- const shouldBePaused = step.execution.process.some((process) => process.status === 'ACTION_REQUIRED' ||
33
- process.status === 'CHAIN_SWITCH_REQUIRED' ||
34
- process.status === 'FAILED');
32
+ const shouldBePaused = step.execution.process.some((process) => process.status === 'ACTION_REQUIRED' || process.status === 'FAILED');
35
33
  if (isRunning && shouldBePaused) {
36
34
  pause();
37
35
  }
@@ -53,11 +51,13 @@ const StepTimer = ({ step }) => {
53
51
  value: (step.estimate.executionDuration / 60).toFixed(0),
54
52
  }) }));
55
53
  }
54
+ const isTimerExpired = isExpired || (!minutes && !seconds);
56
55
  if (((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'DONE' ||
57
- ((_b = step.execution) === null || _b === void 0 ? void 0 : _b.status) === 'FAILED') {
56
+ ((_b = step.execution) === null || _b === void 0 ? void 0 : _b.status) === 'FAILED' ||
57
+ (isTimerExpired && hideInProgress)) {
58
58
  return null;
59
59
  }
60
- return isExpired ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: t('swap.networkIsBusy') })) : (
60
+ return isTimerExpired ? ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: t('swap.inProgress') })) : (
61
61
  // eslint-disable-next-line react/jsx-no-useless-fragment
62
62
  (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: `${minutes}:${seconds < 10 ? `0${seconds}` : seconds}` }));
63
63
  };
@@ -12,25 +12,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.SwapButton = void 0;
13
13
  const jsx_runtime_1 = require("react/jsx-runtime");
14
14
  const sdk_1 = require("@lifi/sdk");
15
+ const material_1 = require("@mui/material");
15
16
  const react_hook_form_1 = require("react-hook-form");
16
17
  const react_i18next_1 = require("react-i18next");
17
18
  const react_router_dom_1 = require("react-router-dom");
18
19
  const hooks_1 = require("../../hooks");
19
- const SwapFormProvider_1 = require("../../providers/SwapFormProvider");
20
- const WalletProvider_1 = require("../../providers/WalletProvider");
21
- const WidgetProvider_1 = require("../../providers/WidgetProvider");
20
+ const providers_1 = require("../../providers");
22
21
  const utils_1 = require("../../utils");
23
- const SwapButton_style_1 = require("./SwapButton.style");
24
- const SwapButton = ({ onClick, currentRoute, text, loading, }) => {
22
+ const SwapButton = ({ onClick, currentRoute, text, disable, }) => {
25
23
  var _a;
26
- const navigate = (0, react_router_dom_1.useNavigate)();
27
24
  const { t } = (0, react_i18next_1.useTranslation)();
25
+ const navigate = (0, react_router_dom_1.useNavigate)();
28
26
  const { getChainById } = (0, hooks_1.useChains)();
29
- const config = (0, WidgetProvider_1.useWidgetConfig)();
30
- const { account, switchChain, connect: walletConnect } = (0, WalletProvider_1.useWallet)();
27
+ const config = (0, providers_1.useWidgetConfig)();
28
+ const { account, switchChain, connect: walletConnect } = (0, providers_1.useWallet)();
31
29
  const { insufficientFunds, insufficientGas } = (0, hooks_1.useGasSufficiency)(currentRoute);
32
30
  const [chainId] = (0, react_hook_form_1.useWatch)({
33
- name: [SwapFormProvider_1.SwapFormKeyHelper.getChainKey('from')],
31
+ name: [providers_1.SwapFormKeyHelper.getChainKey('from')],
34
32
  });
35
33
  // Allow switching chain only if execution is not started
36
34
  const switchChainAllowed = ((_a = getChainById(chainId || sdk_1.ChainId.ETH)) === null || _a === void 0 ? void 0 : _a.id) !== account.chainId &&
@@ -65,10 +63,8 @@ const SwapButton = ({ onClick, currentRoute, text, loading, }) => {
65
63
  }
66
64
  return t(`button.connectWallet`);
67
65
  };
68
- return ((0, jsx_runtime_1.jsx)(SwapButton_style_1.Button, Object.assign({ variant: "contained", color: account.isActive ? 'primary' : 'success', onClick: handleSwapButtonClick,
69
- // loading={isLoading || isFetching}
70
- disabled: (insufficientFunds || !!insufficientGas.length || loading) &&
71
- currentRoute &&
72
- !switchChainAllowed, fullWidth: true }, { children: getButtonText() })));
66
+ return ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "contained", color: account.isActive ? 'primary' : 'success', onClick: handleSwapButtonClick, disabled: currentRoute &&
67
+ !switchChainAllowed &&
68
+ (insufficientFunds || !!insufficientGas.length || disable), fullWidth: true }, { children: getButtonText() })));
73
69
  };
74
70
  exports.SwapButton = SwapButton;
@@ -1,7 +1,7 @@
1
- import { Route } from '@lifi/sdk';
1
+ import type { Route } from '@lifi/sdk';
2
2
  export interface SwapButtonProps {
3
3
  onClick?(): void;
4
4
  currentRoute?: Route;
5
5
  text?: string;
6
- loading?: boolean;
6
+ disable?: boolean;
7
7
  }
@@ -1,5 +1,5 @@
1
1
  /// <reference types="react" />
2
- import type { SwapFormTypeProps } from '../../providers/SwapFormProvider';
2
+ import type { SwapFormTypeProps } from '../../providers';
3
3
  export declare const FormPriceHelperText: React.FC<SwapFormTypeProps & {
4
4
  selected: boolean;
5
5
  }>;
@@ -6,15 +6,15 @@ const material_1 = require("@mui/material");
6
6
  const react_hook_form_1 = require("react-hook-form");
7
7
  const react_i18next_1 = require("react-i18next");
8
8
  const hooks_1 = require("../../hooks");
9
- const SwapFormProvider_1 = require("../../providers/SwapFormProvider");
9
+ const providers_1 = require("../../providers");
10
10
  const utils_1 = require("../../utils");
11
11
  const FormPriceHelperText = ({ formType, selected }) => {
12
12
  const { t } = (0, react_i18next_1.useTranslation)();
13
13
  const [amount, chainId, tokenAddress] = (0, react_hook_form_1.useWatch)({
14
14
  name: [
15
- SwapFormProvider_1.SwapFormKeyHelper.getAmountKey(formType),
16
- SwapFormProvider_1.SwapFormKeyHelper.getChainKey(formType),
17
- SwapFormProvider_1.SwapFormKeyHelper.getTokenKey(formType),
15
+ providers_1.SwapFormKeyHelper.getAmountKey(formType),
16
+ providers_1.SwapFormKeyHelper.getChainKey(formType),
17
+ providers_1.SwapFormKeyHelper.getTokenKey(formType),
18
18
  ],
19
19
  });
20
20
  const { token, isLoading } = (0, hooks_1.useTokenBalance)(chainId, tokenAddress);
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- import type { SwapFormTypeProps } from '../../providers/SwapFormProvider';
2
+ import type { SwapFormTypeProps } from '../../providers';
3
3
  export declare const SwapInput: React.FC<SwapFormTypeProps>;
@@ -6,7 +6,7 @@ const react_1 = require("react");
6
6
  const react_hook_form_1 = require("react-hook-form");
7
7
  const react_i18next_1 = require("react-i18next");
8
8
  const hooks_1 = require("../../hooks");
9
- const SwapFormProvider_1 = require("../../providers/SwapFormProvider");
9
+ const providers_1 = require("../../providers");
10
10
  const utils_1 = require("../../utils");
11
11
  const Card_1 = require("../Card");
12
12
  const TokenAvatar_1 = require("../TokenAvatar");
@@ -17,12 +17,12 @@ const SwapInput = ({ formType }) => {
17
17
  const { t } = (0, react_i18next_1.useTranslation)();
18
18
  const { setValue } = (0, react_hook_form_1.useFormContext)();
19
19
  const ref = (0, react_1.useRef)(null);
20
- const amountKey = SwapFormProvider_1.SwapFormKeyHelper.getAmountKey(formType);
20
+ const amountKey = providers_1.SwapFormKeyHelper.getAmountKey(formType);
21
21
  const [amount, chainId, tokenAddress] = (0, react_hook_form_1.useWatch)({
22
22
  name: [
23
23
  amountKey,
24
- SwapFormProvider_1.SwapFormKeyHelper.getChainKey(formType),
25
- SwapFormProvider_1.SwapFormKeyHelper.getTokenKey(formType),
24
+ providers_1.SwapFormKeyHelper.getChainKey(formType),
25
+ providers_1.SwapFormKeyHelper.getTokenKey(formType),
26
26
  ],
27
27
  });
28
28
  const { chain } = (0, hooks_1.useChain)(chainId);
@@ -1,3 +1,3 @@
1
1
  /// <reference types="react" />
2
- import type { SwapFormTypeProps } from '../../providers/SwapFormProvider';
2
+ import type { SwapFormTypeProps } from '../../providers';
3
3
  export declare const SwapInputAdornment: ({ formType }: SwapFormTypeProps) => JSX.Element;
@@ -6,21 +6,21 @@ const material_1 = require("@mui/material");
6
6
  const react_hook_form_1 = require("react-hook-form");
7
7
  const react_i18next_1 = require("react-i18next");
8
8
  const hooks_1 = require("../../hooks");
9
- const SwapFormProvider_1 = require("../../providers/SwapFormProvider");
9
+ const providers_1 = require("../../providers");
10
10
  const SwapInputAdornment_style_1 = require("./SwapInputAdornment.style");
11
11
  const SwapInputAdornment = ({ formType }) => {
12
12
  const { t } = (0, react_i18next_1.useTranslation)();
13
13
  const { setValue } = (0, react_hook_form_1.useFormContext)();
14
14
  const [chainId, tokenAddress] = (0, react_hook_form_1.useWatch)({
15
15
  name: [
16
- SwapFormProvider_1.SwapFormKeyHelper.getChainKey(formType),
17
- SwapFormProvider_1.SwapFormKeyHelper.getTokenKey(formType),
16
+ providers_1.SwapFormKeyHelper.getChainKey(formType),
17
+ providers_1.SwapFormKeyHelper.getTokenKey(formType),
18
18
  ],
19
19
  });
20
20
  const { token, isLoading } = (0, hooks_1.useTokenBalance)(chainId, tokenAddress);
21
21
  const handleMax = () => {
22
22
  var _a;
23
- setValue(SwapFormProvider_1.SwapFormKeyHelper.getAmountKey(formType), (_a = token === null || token === void 0 ? void 0 : token.amount) !== null && _a !== void 0 ? _a : '');
23
+ setValue(providers_1.SwapFormKeyHelper.getAmountKey(formType), (_a = token === null || token === void 0 ? void 0 : token.amount) !== null && _a !== void 0 ? _a : '');
24
24
  };
25
25
  return ((0, jsx_runtime_1.jsx)(material_1.InputAdornment, Object.assign({ position: "end" }, { children: isLoading && tokenAddress ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", width: 46, height: 20, sx: { borderRadius: 0.5 } })) : formType === 'from' && (token === null || token === void 0 ? void 0 : token.amount) ? ((0, jsx_runtime_1.jsx)(SwapInputAdornment_style_1.Button, Object.assign({ onClick: handleMax, variant: "outlined" }, { children: t('button.max') }))) : null })));
26
26
  };