@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
@@ -1,15 +1,42 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.navigationRoutesValues = exports.navigationRoutes = void 0;
3
+ exports.backButtonRoutes = exports.stickyHeaderRoutes = exports.navigationRoutesValues = exports.navigationRoutes = void 0;
4
4
  exports.navigationRoutes = {
5
5
  home: '/',
6
- selectWallet: 'select-wallet',
6
+ selectWallet: 'wallet',
7
7
  settings: 'settings',
8
- fromToken: 'select-from-token',
9
- toToken: 'select-to-token',
8
+ fromToken: 'from-token',
9
+ toToken: 'to-token',
10
+ fromChain: 'from-chain',
11
+ toChain: 'to-chain',
10
12
  swapRoutes: 'swap-routes',
11
13
  swapExecution: 'swap-execution',
12
14
  swapHistory: 'swap-history',
15
+ activeSwaps: 'active-swaps',
13
16
  swapDetails: 'swap-details',
14
17
  };
15
18
  exports.navigationRoutesValues = Object.values(exports.navigationRoutes);
19
+ exports.stickyHeaderRoutes = [
20
+ exports.navigationRoutes.selectWallet,
21
+ exports.navigationRoutes.fromChain,
22
+ exports.navigationRoutes.toChain,
23
+ exports.navigationRoutes.settings,
24
+ exports.navigationRoutes.swapRoutes,
25
+ exports.navigationRoutes.swapExecution,
26
+ exports.navigationRoutes.swapHistory,
27
+ exports.navigationRoutes.activeSwaps,
28
+ exports.navigationRoutes.swapDetails,
29
+ ];
30
+ exports.backButtonRoutes = [
31
+ exports.navigationRoutes.selectWallet,
32
+ exports.navigationRoutes.settings,
33
+ exports.navigationRoutes.swapHistory,
34
+ exports.navigationRoutes.activeSwaps,
35
+ exports.navigationRoutes.fromToken,
36
+ exports.navigationRoutes.toToken,
37
+ exports.navigationRoutes.fromChain,
38
+ exports.navigationRoutes.toChain,
39
+ exports.navigationRoutes.swapRoutes,
40
+ exports.navigationRoutes.swapExecution,
41
+ exports.navigationRoutes.swapDetails,
42
+ ];
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ export declare const ActiveSwapItem: React.FC<{
3
+ routeId: string;
4
+ dense?: boolean;
5
+ }>;
@@ -0,0 +1,41 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ArrowForward as ArrowForwardIcon, Info as InfoIcon, Warning as WarningIcon, } from '@mui/icons-material';
3
+ import { ListItemAvatar, ListItemText, Typography } from '@mui/material';
4
+ import { useNavigate } from 'react-router-dom';
5
+ import { useProcessMessage, useRouteExecution } from '../../hooks';
6
+ import { navigationRoutes } from '../../utils';
7
+ import { StepTimer } from '../Step/StepTimer';
8
+ import { TokenAvatar, TokenAvatarGroup } from '../TokenAvatar';
9
+ import { ListItem, ListItemButton } from './ActiveSwaps.style';
10
+ export const ActiveSwapItem = ({ routeId, dense }) => {
11
+ var _a;
12
+ const navigate = useNavigate();
13
+ const { route, status } = useRouteExecution(routeId, true);
14
+ // TODO: replace with ES2023 findLast
15
+ const lastActiveStep = route === null || route === void 0 ? void 0 : route.steps.slice().reverse().find((step) => step.execution);
16
+ const lastActiveProcess = (_a = lastActiveStep === null || lastActiveStep === void 0 ? void 0 : lastActiveStep.execution) === null || _a === void 0 ? void 0 : _a.process.at(-1);
17
+ const { title } = useProcessMessage(lastActiveStep, lastActiveProcess);
18
+ if (!route || !lastActiveStep) {
19
+ return null;
20
+ }
21
+ const handleClick = () => {
22
+ navigate(navigationRoutes.swapExecution, { state: { routeId } });
23
+ };
24
+ const getStatusComponent = () => {
25
+ switch (lastActiveProcess === null || lastActiveProcess === void 0 ? void 0 : lastActiveProcess.status) {
26
+ case 'ACTION_REQUIRED':
27
+ return _jsx(InfoIcon, { color: "info", fontSize: "small" });
28
+ case 'FAILED':
29
+ return _jsx(WarningIcon, { color: "error", fontSize: "small" });
30
+ default:
31
+ return (_jsx(Typography, Object.assign({ fontSize: 14, fontWeight: 500 }, { children: _jsx(StepTimer, { step: lastActiveStep, hideInProgress: true }) })));
32
+ }
33
+ };
34
+ const ListItemComponent = dense ? ListItem : ListItemButton;
35
+ return (_jsxs(ListItemComponent, Object.assign({ onClick: handleClick, dense: true, disableRipple: true }, { children: [_jsx(ListItemAvatar, { children: _jsxs(TokenAvatarGroup, Object.assign({ total: 2 }, { children: [_jsx(TokenAvatar, { token: route.fromToken }), _jsx(TokenAvatar, { token: route.toToken })] })) }), _jsx(ListItemText, { sx: { margin: 0 }, disableTypography: true, primary: _jsxs(Typography, Object.assign({ fontWeight: 500, lineHeight: 1, sx: {
36
+ display: 'flex',
37
+ alignItems: 'center',
38
+ marginLeft: 2,
39
+ height: 16,
40
+ } }, { children: [route.fromToken.symbol, _jsx(ArrowForwardIcon, { sx: { paddingX: 0.5 } }), route.toToken.symbol] })), secondary: status !== 'success' ? (_jsx(Typography, Object.assign({ fontWeight: 400, fontSize: 12, color: "text.secondary", lineHeight: 1, mt: 0.75, ml: 2 }, { children: title }))) : null }), getStatusComponent()] })));
41
+ };
@@ -0,0 +1,3 @@
1
+ /// <reference types="react" />
2
+ import type { BoxProps } from '@mui/material';
3
+ export declare const ActiveSwaps: React.FC<BoxProps>;
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Stack } from '@mui/material';
3
+ import { useTranslation } from 'react-i18next';
4
+ import { useNavigate } from 'react-router-dom';
5
+ import { useWallet } from '../../providers';
6
+ import { useExecutingRoutesIds } from '../../stores';
7
+ import { navigationRoutes } from '../../utils';
8
+ import { CardTitle } from '../Card';
9
+ import { ActiveSwapItem } from './ActiveSwapItem';
10
+ import { ProgressCard, ShowAllButton } from './ActiveSwaps.style';
11
+ export const ActiveSwaps = (props) => {
12
+ const { t } = useTranslation();
13
+ const navigate = useNavigate();
14
+ const { account } = useWallet();
15
+ const executingRoutes = useExecutingRoutesIds(account.address);
16
+ if (!(executingRoutes === null || executingRoutes === void 0 ? void 0 : executingRoutes.length)) {
17
+ return null;
18
+ }
19
+ const handleShowAll = () => {
20
+ navigate(navigationRoutes.activeSwaps);
21
+ };
22
+ const hasShowAll = (executingRoutes === null || executingRoutes === void 0 ? void 0 : executingRoutes.length) > 2;
23
+ return (_jsxs(ProgressCard, Object.assign({}, props, { children: [_jsx(CardTitle, { children: t('header.activeSwaps') }), _jsx(Stack, Object.assign({ spacing: 1.5, pt: 1.5, pb: hasShowAll ? 0 : 2 }, { children: executingRoutes.slice(0, 2).map((routeId) => (_jsx(ActiveSwapItem, { routeId: routeId, dense: true }, routeId))) })), hasShowAll ? (_jsx(ShowAllButton, Object.assign({ disableRipple: true, fullWidth: true, onClick: handleShowAll, sx: (theme) => ({
24
+ padding: theme.spacing(0.75, 2),
25
+ }) }, { children: t('button.showAll') }))) : null] })));
26
+ };
@@ -0,0 +1,78 @@
1
+ /// <reference types="react" />
2
+ export declare const ProgressCard: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
3
+ children?: import("react").ReactNode;
4
+ component?: import("react").ElementType<any> | undefined;
5
+ ref?: import("react").Ref<unknown> | undefined;
6
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
7
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
8
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
9
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
10
+ variant?: ("default" | "error" | "selected") | undefined;
11
+ dense?: boolean | undefined;
12
+ indented?: boolean | undefined;
13
+ onClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
14
+ }, {}, {}>;
15
+ export declare const ListItemButton: import("@emotion/styled").StyledComponent<import("@mui/material").ListItemButtonBaseProps & Omit<{
16
+ action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
17
+ centerRipple?: boolean | undefined;
18
+ children?: import("react").ReactNode;
19
+ classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
20
+ disabled?: boolean | undefined;
21
+ disableRipple?: boolean | undefined;
22
+ disableTouchRipple?: boolean | undefined;
23
+ focusRipple?: boolean | undefined;
24
+ focusVisibleClassName?: string | undefined;
25
+ LinkComponent?: import("react").ElementType<any> | undefined;
26
+ onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
27
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
28
+ tabIndex?: number | undefined;
29
+ TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
30
+ touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
31
+ }, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
32
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
33
+ }, "className" | "style" | "classes" | "tabIndex" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "alignItems" | "autoFocus" | "dense" | "divider" | "selected" | "disableGutters"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
34
+ export declare const ListItem: import("@emotion/styled").StyledComponent<{
35
+ button?: false | undefined;
36
+ } & import("@mui/material").ListItemBaseProps & {
37
+ components?: {
38
+ Root?: import("react").ElementType<any> | undefined;
39
+ } | undefined;
40
+ componentsProps?: {
41
+ root?: (import("react").HTMLAttributes<HTMLDivElement> & import("@mui/material").ListItemComponentsPropsOverrides) | undefined;
42
+ } | undefined;
43
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").LiHTMLAttributes<HTMLLIElement>, HTMLLIElement>, "key" | keyof import("react").LiHTMLAttributes<HTMLLIElement>> & {
44
+ ref?: ((instance: HTMLLIElement | null) => void) | import("react").RefObject<HTMLLIElement> | null | undefined;
45
+ }, "button" | "className" | "style" | "classes" | "children" | "disabled" | "sx" | "alignItems" | "autoFocus" | "dense" | "divider" | "components" | "componentsProps" | "selected" | "disableGutters" | "ContainerComponent" | "ContainerProps" | "disablePadding" | "secondaryAction"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
46
+ export declare const ShowAllButton: import("@emotion/styled").StyledComponent<{
47
+ children?: import("react").ReactNode;
48
+ classes?: Partial<import("@mui/material").ButtonClasses> | undefined;
49
+ color?: "inherit" | "primary" | "secondary" | "error" | "warning" | "info" | "success" | undefined;
50
+ disabled?: boolean | undefined;
51
+ disableElevation?: boolean | undefined;
52
+ disableFocusRipple?: boolean | undefined;
53
+ endIcon?: import("react").ReactNode;
54
+ fullWidth?: boolean | undefined;
55
+ href?: string | undefined;
56
+ size?: "small" | "medium" | "large" | undefined;
57
+ startIcon?: import("react").ReactNode;
58
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
59
+ variant?: "text" | "outlined" | "contained" | undefined;
60
+ } & Omit<{
61
+ action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
62
+ centerRipple?: boolean | undefined;
63
+ children?: import("react").ReactNode;
64
+ classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
65
+ disabled?: boolean | undefined;
66
+ disableRipple?: boolean | undefined;
67
+ disableTouchRipple?: boolean | undefined;
68
+ focusRipple?: boolean | undefined;
69
+ focusVisibleClassName?: string | undefined;
70
+ LinkComponent?: import("react").ElementType<any> | undefined;
71
+ onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
72
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
73
+ tabIndex?: number | undefined;
74
+ TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
75
+ touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
76
+ }, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "key" | keyof import("react").ButtonHTMLAttributes<HTMLButtonElement>> & {
77
+ ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
78
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "color" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "href" | "disableElevation" | "disableFocusRipple" | "endIcon" | "fullWidth" | "size" | "startIcon" | "variant"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -0,0 +1,37 @@
1
+ import { Button, ListItem as MuiListItem, ListItemButton as MuiListItemButton, } from '@mui/material';
2
+ import { listItemSecondaryActionClasses } from '@mui/material/ListItemSecondaryAction';
3
+ import { alpha, styled } from '@mui/material/styles';
4
+ import { getContrastAlphaColor } from '../../utils';
5
+ import { Card } from '../Card';
6
+ export const ProgressCard = styled(Card)(({ theme }) => ({
7
+ borderColor: alpha(theme.palette.secondary.main, 0.48),
8
+ background: alpha(theme.palette.secondary.main, 0.08),
9
+ '&:hover': {
10
+ background: alpha(theme.palette.secondary.main, 0.08),
11
+ },
12
+ }));
13
+ export const ListItemButton = styled(MuiListItemButton)(({ theme }) => ({
14
+ borderRadius: theme.shape.borderRadiusSecondary,
15
+ paddingLeft: theme.spacing(1.5),
16
+ paddingRight: theme.spacing(1.5),
17
+ height: 64,
18
+ '&:hover': {
19
+ backgroundColor: getContrastAlphaColor(theme, '4%'),
20
+ },
21
+ }));
22
+ export const ListItem = styled(MuiListItem, {
23
+ shouldForwardProp: (prop) => prop !== 'disableRipple',
24
+ })(({ theme }) => ({
25
+ padding: theme.spacing(0, 1.5),
26
+ [`.${listItemSecondaryActionClasses.root}`]: {
27
+ right: theme.spacing(3),
28
+ },
29
+ '&:hover': {
30
+ cursor: 'pointer',
31
+ },
32
+ }));
33
+ export const ShowAllButton = styled(Button)(({ theme }) => ({
34
+ '&:hover': {
35
+ background: 'none',
36
+ },
37
+ }));
@@ -0,0 +1,2 @@
1
+ export * from './ActiveSwapItem';
2
+ export * from './ActiveSwaps';
@@ -0,0 +1,2 @@
1
+ export * from './ActiveSwapItem';
2
+ export * from './ActiveSwaps';
@@ -1,14 +1,17 @@
1
+ import type { Theme } from '@mui/material';
1
2
  import type { MouseEventHandler } from 'react';
2
- export declare const Card: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
3
+ declare type CardVariant = 'default' | 'selected' | 'error';
4
+ export declare const Card: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<Theme> & {
3
5
  children?: import("react").ReactNode;
4
6
  component?: import("react").ElementType<any> | undefined;
5
7
  ref?: import("react").Ref<unknown> | undefined;
6
- sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
8
+ sx?: import("@mui/material").SxProps<Theme> | undefined;
7
9
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
8
10
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
9
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
10
- variant?: "default" | "error" | undefined;
11
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<Theme> & {
12
+ variant?: CardVariant | undefined;
11
13
  dense?: boolean | undefined;
12
14
  indented?: boolean | undefined;
13
15
  onClick?: MouseEventHandler<HTMLDivElement> | undefined;
14
16
  }, {}, {}>;
17
+ export {};
@@ -1,32 +1,42 @@
1
1
  import { Box } from '@mui/material';
2
- import { darken, lighten, styled } from '@mui/material/styles';
2
+ import { alpha, darken, lighten, styled } from '@mui/material/styles';
3
+ const getBackgroundColor = (theme, variant) => variant === 'selected'
4
+ ? theme.palette.mode === 'light'
5
+ ? alpha(theme.palette.primary.main, 0.04)
6
+ : alpha(theme.palette.primary.main, 0.42)
7
+ : theme.palette.background.paper;
3
8
  export const Card = styled(Box, {
4
9
  shouldForwardProp: (prop) => !['dense', 'variant', 'indented'].includes(prop),
5
- })(({ theme, variant, dense, indented, onClick }) => ({
6
- backgroundColor: theme.palette.background.paper,
7
- border: `1px solid`,
8
- borderColor: variant === 'error'
9
- ? theme.palette.error.main
10
- : theme.palette.mode === 'light'
11
- ? theme.palette.grey[300]
12
- : theme.palette.grey[800],
13
- borderRadius: dense
14
- ? theme.shape.borderRadiusSecondary
15
- : theme.shape.borderRadius,
16
- overflow: 'hidden',
17
- position: 'relative',
18
- padding: indented ? theme.spacing(2) : 0,
19
- boxSizing: 'border-box',
20
- '&:hover': {
21
- cursor: onClick ? 'pointer' : 'default',
22
- backgroundColor: onClick
23
- ? theme.palette.mode === 'light'
24
- ? darken(theme.palette.background.paper, 0.02)
25
- : lighten(theme.palette.background.paper, 0.02)
26
- : theme.palette.background.paper,
27
- },
28
- transition: theme.transitions.create(['background-color'], {
29
- duration: theme.transitions.duration.enteringScreen,
30
- easing: theme.transitions.easing.easeOut,
31
- }),
32
- }));
10
+ })(({ theme, variant, dense, indented, onClick }) => {
11
+ const backgroundColor = getBackgroundColor(theme, variant);
12
+ return {
13
+ backgroundColor,
14
+ border: `1px solid`,
15
+ borderColor: variant === 'error'
16
+ ? theme.palette.error.main
17
+ : variant === 'selected'
18
+ ? theme.palette.primary.main
19
+ : theme.palette.mode === 'light'
20
+ ? theme.palette.grey[300]
21
+ : theme.palette.grey[800],
22
+ borderRadius: dense
23
+ ? theme.shape.borderRadiusSecondary
24
+ : theme.shape.borderRadius,
25
+ overflow: 'hidden',
26
+ position: 'relative',
27
+ padding: indented ? theme.spacing(2) : 0,
28
+ boxSizing: 'border-box',
29
+ '&:hover': {
30
+ cursor: onClick ? 'pointer' : 'default',
31
+ backgroundColor: onClick
32
+ ? theme.palette.mode === 'light'
33
+ ? darken(backgroundColor, 0.02)
34
+ : lighten(backgroundColor, 0.02)
35
+ : theme.palette.background.paper,
36
+ },
37
+ transition: theme.transitions.create(['background-color'], {
38
+ duration: theme.transitions.duration.enteringScreen,
39
+ easing: theme.transitions.easing.easeOut,
40
+ }),
41
+ };
42
+ });
@@ -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 ChainSelect: ({ formType }: SwapFormTypeProps) => JSX.Element;
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Avatar, Box, Skeleton, Typography } from '@mui/material';
3
+ import { useWatch } from 'react-hook-form';
4
+ import { useNavigate } from 'react-router-dom';
5
+ import { SwapFormKeyHelper } from '../../providers';
6
+ import { maxChainToOrder } from '../../stores/chains';
7
+ import { navigationRoutes } from '../../utils';
8
+ import { ChainCard, ChainContainer } from './ChainSelect.style';
9
+ import { useChainSelect } from './useChainSelect';
10
+ export const ChainSelect = ({ formType }) => {
11
+ var _a;
12
+ const navigate = useNavigate();
13
+ const { chains, getChains, setCurrentChain, isLoading } = useChainSelect(formType);
14
+ const [chainId] = useWatch({
15
+ name: [SwapFormKeyHelper.getChainKey(formType)],
16
+ });
17
+ const showAllChains = () => {
18
+ navigate(navigationRoutes[`${formType}Chain`], {
19
+ state: { formType },
20
+ });
21
+ };
22
+ const chainsToHide = ((_a = chains === null || chains === void 0 ? void 0 : chains.length) !== null && _a !== void 0 ? _a : 0) - maxChainToOrder;
23
+ return (_jsxs(ChainContainer, { children: [isLoading
24
+ ? Array.from({ length: maxChainToOrder + 1 }).map((_, index) => (_jsx(Skeleton, { variant: "rectangular", width: 56, height: 56, sx: { borderRadius: 1 } }, index)))
25
+ : getChains().map((chain) => (_jsx(ChainCard, Object.assign({ onClick: () => setCurrentChain(chain.id), variant: chainId === chain.id ? 'selected' : 'default' }, { children: _jsx(Avatar, Object.assign({ src: chain.logoURI, alt: chain.key, sx: { width: 40, height: 40 } }, { children: chain.name[0] })) }), chain.id))), chainsToHide > 0 ? (_jsx(ChainCard, Object.assign({ onClick: showAllChains }, { children: _jsx(Box, Object.assign({ sx: {
26
+ width: 40,
27
+ height: 40,
28
+ display: 'grid',
29
+ placeItems: 'center',
30
+ } }, { children: _jsxs(Typography, Object.assign({ fontWeight: 500 }, { children: ["+", chainsToHide] })) })) }))) : null] }));
31
+ };
@@ -1,31 +1,22 @@
1
1
  /// <reference types="react" />
2
- export declare const ProgressCard: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material/styles").Theme> & {
2
+ export declare const ChainCard: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
3
3
  children?: import("react").ReactNode;
4
4
  component?: import("react").ElementType<any> | undefined;
5
5
  ref?: import("react").Ref<unknown> | undefined;
6
- sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
6
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
7
7
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
8
8
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
9
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
10
- variant?: "default" | "error" | undefined;
9
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
10
+ variant?: ("default" | "error" | "selected") | undefined;
11
11
  dense?: boolean | undefined;
12
12
  indented?: boolean | undefined;
13
13
  onClick?: import("react").MouseEventHandler<HTMLDivElement> | undefined;
14
14
  }, {}, {}>;
15
- export declare const RouteCard: import("@emotion/styled").StyledComponent<{
16
- action?: import("react").ReactNode;
17
- avatar?: import("react").ReactNode;
18
- classes?: Partial<import("@mui/material").CardHeaderClasses> | undefined;
19
- disableTypography?: boolean | undefined;
20
- subheader?: import("react").ReactNode;
21
- subheaderTypographyProps?: import("@mui/material").TypographyProps<"span", {
22
- component?: "span" | undefined;
23
- }> | undefined;
24
- sx?: import("@mui/material/styles").SxProps<import("@mui/material/styles").Theme> | undefined;
25
- title?: import("react").ReactNode;
26
- titleTypographyProps?: import("@mui/material").TypographyProps<"span", {
27
- component?: "span" | undefined;
28
- }> | undefined;
15
+ export declare const ChainContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
16
+ children?: import("react").ReactNode;
17
+ component?: import("react").ElementType<any> | undefined;
18
+ ref?: import("react").Ref<unknown> | undefined;
19
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
29
20
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
30
21
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
31
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "title" | "action" | "sx" | "avatar" | "disableTypography" | "subheader" | "subheaderTypographyProps" | "titleTypographyProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, {}, {}>;
22
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -0,0 +1,16 @@
1
+ import { Box } from '@mui/material';
2
+ import { styled } from '@mui/material/styles';
3
+ import { Card } from '../../components/Card';
4
+ export const ChainCard = styled(Card)(({ theme }) => ({
5
+ display: 'grid',
6
+ placeItems: 'center',
7
+ width: 56,
8
+ height: 56,
9
+ }));
10
+ export const ChainContainer = styled(Box)(({ theme }) => ({
11
+ display: 'grid',
12
+ gridTemplateColumns: 'repeat(auto-fit, 56px)',
13
+ gridAutoRows: '56px',
14
+ justifyContent: 'space-between',
15
+ gap: theme.spacing(1.5),
16
+ }));
@@ -0,0 +1,2 @@
1
+ export * from './ChainSelect';
2
+ export * from './useChainSelect';
@@ -0,0 +1,2 @@
1
+ export * from './ChainSelect';
2
+ export * from './useChainSelect';
@@ -0,0 +1,8 @@
1
+ import type { EVMChain } from '@lifi/sdk';
2
+ import type { SwapFormDirection } from '../../providers';
3
+ export declare const useChainSelect: (formType: SwapFormDirection) => {
4
+ chains: EVMChain[] | undefined;
5
+ getChains: () => EVMChain[];
6
+ setCurrentChain: (chainId: number) => void;
7
+ isLoading: boolean;
8
+ };
@@ -0,0 +1,29 @@
1
+ import { useFormContext } from 'react-hook-form';
2
+ import { useChains } from '../../hooks';
3
+ import { SwapFormKey, SwapFormKeyHelper } from '../../providers';
4
+ import { useChainOrder } from '../../stores/chains';
5
+ export const useChainSelect = (formType) => {
6
+ const { setValue } = useFormContext();
7
+ const { chains, isLoading } = useChains();
8
+ const [chainOrder, setChainOrder] = useChainOrder();
9
+ const chainKey = SwapFormKeyHelper.getChainKey(formType);
10
+ const getChains = () => {
11
+ if (!chains) {
12
+ return [];
13
+ }
14
+ const selectedChains = chainOrder
15
+ .map((chainId) => chains.find((chain) => chain.id === chainId))
16
+ .filter((chain) => chain);
17
+ return selectedChains;
18
+ };
19
+ const setCurrentChain = (chainId) => {
20
+ setValue(chainKey, chainId, { shouldDirty: true });
21
+ setValue(SwapFormKeyHelper.getTokenKey(formType), '', {
22
+ shouldDirty: false,
23
+ });
24
+ setValue(SwapFormKeyHelper.getAmountKey(formType), '');
25
+ setValue(SwapFormKey.TokenSearchFilter, '');
26
+ setChainOrder(chainId);
27
+ };
28
+ return { chains, getChains, setCurrentChain, isLoading };
29
+ };
@@ -1,18 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  import { useLocation } from 'react-router-dom';
3
- import { useWidgetConfig } from '../../providers/WidgetProvider';
4
- import { ElementId, navigationRoutes } from '../../utils';
3
+ import { useWidgetConfig } from '../../providers';
4
+ import { ElementId, stickyHeaderRoutes } from '../../utils';
5
5
  import { Container } from './Header.style';
6
6
  import { NavigationHeader } from './NavigationHeader';
7
7
  import { WalletHeader } from './WalletHeader';
8
- const stickyHeaderRoutes = [
9
- navigationRoutes.selectWallet,
10
- navigationRoutes.settings,
11
- navigationRoutes.swapRoutes,
12
- navigationRoutes.swapExecution,
13
- navigationRoutes.swapHistory,
14
- navigationRoutes.swapDetails,
15
- ];
16
8
  const HeaderContainer = ({ children }) => {
17
9
  const { pathname } = useLocation();
18
10
  return (_jsx(Container, Object.assign({ id: ElementId.Header, sticky: stickyHeaderRoutes.some((route) => pathname.includes(route)) }, { children: children })));
@@ -2,32 +2,20 @@ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-run
2
2
  import { ArrowBack as ArrowBackIcon, History as HistoryIcon, SettingsOutlined as SettingsIcon, } from '@mui/icons-material';
3
3
  import { Box, IconButton, Typography } from '@mui/material';
4
4
  import { useTranslation } from 'react-i18next';
5
- import { Route, Routes, useLocation, useNavigate } from 'react-router-dom';
6
- import { useWallet } from '../../providers/WalletProvider';
7
- import { navigationRoutes, navigationRoutesValues } from '../../utils';
5
+ import { Route, Routes, useLocation } from 'react-router-dom';
6
+ import { useNavigateBack } from '../../hooks';
7
+ import { useWallet } from '../../providers';
8
+ import { backButtonRoutes, navigationRoutes, navigationRoutesValues, } from '../../utils';
8
9
  import { HeaderAppBar } from './Header.style';
9
10
  import { useHeaderActionStore } from './useHeaderActionStore';
10
- const backButtonRoutes = [
11
- navigationRoutes.selectWallet,
12
- navigationRoutes.settings,
13
- navigationRoutes.swapHistory,
14
- navigationRoutes.fromToken,
15
- navigationRoutes.toToken,
16
- navigationRoutes.swapRoutes,
17
- navigationRoutes.swapExecution,
18
- navigationRoutes.swapDetails,
19
- ];
20
11
  export const NavigationHeader = () => {
21
12
  const { t } = useTranslation();
22
- const navigate = useNavigate();
13
+ const { navigate, navigateBack } = useNavigateBack();
23
14
  const { account } = useWallet();
24
15
  const { element } = useHeaderActionStore();
25
16
  const { pathname } = useLocation();
26
17
  const path = pathname.substring(pathname.lastIndexOf('/') + 1);
27
18
  const hasPath = navigationRoutesValues.includes(path);
28
- const handleBack = () => {
29
- navigate(-1);
30
- };
31
19
  const handleHeaderTitle = () => {
32
20
  switch (path) {
33
21
  case navigationRoutes.selectWallet:
@@ -40,8 +28,13 @@ export const NavigationHeader = () => {
40
28
  return t(`header.from`);
41
29
  case navigationRoutes.toToken:
42
30
  return t(`header.to`);
31
+ case navigationRoutes.fromChain:
32
+ case navigationRoutes.toChain:
33
+ return t(`header.selectChain`);
43
34
  case navigationRoutes.swapRoutes:
44
35
  return t(`header.routes`);
36
+ case navigationRoutes.activeSwaps:
37
+ return t(`header.activeSwaps`);
45
38
  case navigationRoutes.swapExecution:
46
39
  return t(`header.swap`);
47
40
  case navigationRoutes.swapDetails:
@@ -50,5 +43,5 @@ export const NavigationHeader = () => {
50
43
  return t(`header.swap`);
51
44
  }
52
45
  };
53
- return (_jsxs(HeaderAppBar, Object.assign({ elevation: 0 }, { children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "start", onClick: handleBack }, { children: _jsx(ArrowBackIcon, {}) }))) : null, _jsx(Typography, Object.assign({ 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(IconButton, Object.assign({ size: "medium", "aria-label": "swap-history", edge: "start", onClick: () => navigate(navigationRoutes.swapHistory) }, { children: _jsx(HistoryIcon, {}) }))) : null, _jsx(IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "end", onClick: () => navigate(navigationRoutes.settings) }, { children: _jsx(SettingsIcon, {}) }))] }) }), _jsx(Route, { path: "*", element: element || _jsx(Box, { width: 28, height: 40 }) })] })] })));
46
+ return (_jsxs(HeaderAppBar, Object.assign({ elevation: 0 }, { children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "start", onClick: navigateBack }, { children: _jsx(ArrowBackIcon, {}) }))) : null, _jsx(Typography, Object.assign({ 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(IconButton, Object.assign({ size: "medium", "aria-label": "swap-history", edge: "start", onClick: () => navigate(navigationRoutes.swapHistory) }, { children: _jsx(HistoryIcon, {}) }))) : null, _jsx(IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "end", onClick: () => navigate(navigationRoutes.settings) }, { children: _jsx(SettingsIcon, {}) }))] }) }), _jsx(Route, { path: "*", element: element || _jsx(Box, { width: 28, height: 40 }) })] })] })));
54
47
  };