@lifi/widget 1.31.1 → 1.32.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 (405) hide show
  1. package/App.js +4 -16
  2. package/AppDrawer.js +13 -7
  3. package/AppDrawer.style.d.ts +2 -2
  4. package/AppDrawer.style.js +1 -1
  5. package/AppProvider.js +1 -1
  6. package/AppRoutes.js +9 -0
  7. package/cjs/App.js +4 -16
  8. package/cjs/AppDrawer.js +13 -7
  9. package/cjs/AppDrawer.style.d.ts +2 -2
  10. package/cjs/AppDrawer.style.js +1 -1
  11. package/cjs/AppProvider.js +1 -1
  12. package/cjs/AppRoutes.js +9 -0
  13. package/cjs/components/ActiveSwaps/ActiveSwapItem.js +9 -7
  14. package/cjs/components/ActiveSwaps/ActiveSwaps.js +3 -3
  15. package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +3 -3
  16. package/cjs/components/AppContainer.d.ts +2 -2
  17. package/cjs/components/AppContainer.js +1 -1
  18. package/cjs/components/BottomSheet/BottomSheet.d.ts +1 -1
  19. package/cjs/components/BottomSheet/BottomSheet.js +2 -2
  20. package/cjs/components/Card/Card.d.ts +2 -2
  21. package/cjs/components/Card/CardHeader.d.ts +1 -1
  22. package/cjs/components/Card/CardTitle.d.ts +1 -1
  23. package/cjs/components/ChainSelect/ChainSelect.d.ts +0 -1
  24. package/cjs/components/ChainSelect/ChainSelect.js +3 -4
  25. package/cjs/components/ChainSelect/ChainSelect.style.d.ts +3 -3
  26. package/cjs/components/ContractComponent/ContractComponent.js +1 -1
  27. package/cjs/components/Dialog.js +1 -1
  28. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +13 -28
  29. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +1 -1
  30. package/cjs/components/Header/Header.js +1 -1
  31. package/cjs/components/Header/Header.style.d.ts +3 -3
  32. package/cjs/components/Header/NavigationHeader.js +6 -2
  33. package/cjs/components/Header/WalletHeader.js +12 -22
  34. package/cjs/{pages/SelectNativeTokenPage/SelectNativeTokenPage.style.d.ts → components/ListItemButton.d.ts} +1 -2
  35. package/cjs/{pages/SelectWalletPage/SelectWalletPage.style.js → components/ListItemButton.js} +2 -8
  36. package/cjs/components/ListItemText.d.ts +2 -0
  37. package/cjs/{pages/SelectNativeTokenPage/SelectNativeTokenPage.style.js → components/ListItemText.js} +1 -10
  38. package/cjs/components/NFT/NFT.js +2 -14
  39. package/cjs/components/NFT/NFT.style.d.ts +1 -1
  40. package/cjs/components/NotFound.js +2 -2
  41. package/cjs/components/PoweredBy/PoweredBy.js +2 -2
  42. package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
  43. package/cjs/components/ProgressToNextUpdate/ProgressToNextUpdate.js +5 -17
  44. package/cjs/components/ReverseTokensButton/ReverseTokensButton.js +1 -1
  45. package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
  46. package/cjs/components/Select.js +1 -0
  47. package/cjs/components/SelectChainAndToken.js +4 -4
  48. package/cjs/components/SelectTokenButton/SelectTokenButton.js +2 -2
  49. package/cjs/components/SelectTokenButton/SelectTokenButton.style.d.ts +1 -1
  50. package/cjs/components/SendToWallet/SendToWallet.js +9 -19
  51. package/cjs/components/SendToWallet/SendToWallet.style.d.ts +1 -1
  52. package/cjs/components/SendToWallet/SendToWalletButton.js +5 -5
  53. package/cjs/components/SmallAvatar.d.ts +3 -3
  54. package/cjs/components/Step/CircularProgress.d.ts +0 -1
  55. package/cjs/components/Step/CircularProgress.js +2 -2
  56. package/cjs/components/Step/CircularProgress.style.d.ts +1 -1
  57. package/cjs/components/Step/DestinationWalletAddress.js +6 -7
  58. package/cjs/components/Step/GasStepProcess.js +8 -8
  59. package/cjs/components/Step/Step.js +4 -5
  60. package/cjs/components/Step/StepList.d.ts +0 -1
  61. package/cjs/components/Step/StepList.js +8 -4
  62. package/cjs/components/Step/StepProcess.js +3 -3
  63. package/cjs/components/Step/StepProcess.style.d.ts +2 -2
  64. package/cjs/components/Step/StepTimer.js +4 -8
  65. package/cjs/components/StepActions/StepActions.js +20 -37
  66. package/cjs/components/StepActions/StepActions.style.d.ts +1 -1
  67. package/cjs/components/StepDivider/StepDivider.style.d.ts +1 -1
  68. package/cjs/components/SwapButton/SwapButton.js +5 -14
  69. package/cjs/components/SwapInput/FormPriceHelperText.js +6 -6
  70. package/cjs/components/SwapInput/SwapInput.js +4 -16
  71. package/cjs/components/SwapInput/SwapInput.style.d.ts +1 -1
  72. package/cjs/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
  73. package/cjs/components/SwapInput/SwapInputEndAdornment.d.ts +0 -1
  74. package/cjs/components/SwapInput/SwapInputEndAdornment.js +2 -3
  75. package/cjs/components/SwapRouteCard/SwapRouteCard.js +9 -25
  76. package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +2 -2
  77. package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +4 -16
  78. package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.js +2 -2
  79. package/cjs/components/SwapRouteCard/utils.js +1 -1
  80. package/cjs/components/SwapRoutes/SwapRoutes.js +4 -4
  81. package/cjs/components/SwapRoutes/SwapRoutes.style.d.ts +5 -5
  82. package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
  83. package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +3 -3
  84. package/cjs/components/TextFitter/TextFitter.js +3 -3
  85. package/cjs/components/Token/Token.js +19 -33
  86. package/cjs/components/Token/Token.style.d.ts +3 -3
  87. package/cjs/components/TokenAvatar/TokenAvatar.js +6 -7
  88. package/cjs/components/TokenAvatar/TokenAvatar.style.d.ts +2 -2
  89. package/cjs/components/TokenList/TokenList.js +3 -4
  90. package/cjs/components/TokenList/TokenList.style.d.ts +2 -2
  91. package/cjs/components/TokenList/TokenList.style.js +2 -6
  92. package/cjs/components/TokenList/TokenListItem.js +9 -9
  93. package/cjs/components/TokenList/TokenNotFound.js +4 -5
  94. package/cjs/components/TokenList/VirtualizedTokenList.js +10 -11
  95. package/cjs/components/TokenList/useTokenSelect.js +2 -2
  96. package/cjs/config/env.js +1 -1
  97. package/cjs/config/sentry.js +3 -12
  98. package/cjs/config/theme.js +44 -16
  99. package/cjs/config/version.d.ts +1 -1
  100. package/cjs/config/version.js +1 -1
  101. package/cjs/hooks/useChain.js +1 -1
  102. package/cjs/hooks/useChains.js +5 -14
  103. package/cjs/hooks/useContentHeight.js +1 -2
  104. package/cjs/hooks/useFeaturedTokens.js +1 -4
  105. package/cjs/hooks/useGasSufficiency.js +28 -34
  106. package/cjs/hooks/useProcessMessage.js +7 -11
  107. package/cjs/hooks/useRouteExecution.js +16 -26
  108. package/cjs/hooks/useSwapRoutes.js +16 -26
  109. package/cjs/hooks/useToken.js +2 -2
  110. package/cjs/hooks/useTokenAddressBalance.js +1 -2
  111. package/cjs/hooks/useTokenBalance.js +24 -27
  112. package/cjs/hooks/useTokenBalances.d.ts +1 -1
  113. package/cjs/hooks/useTokenBalances.js +8 -20
  114. package/cjs/hooks/useTokenSearch.d.ts +1 -1
  115. package/cjs/hooks/useTokenSearch.js +12 -21
  116. package/cjs/hooks/useTokens.d.ts +1 -1
  117. package/cjs/hooks/useTokens.js +36 -38
  118. package/cjs/hooks/useTools.d.ts +2 -11
  119. package/cjs/hooks/useTools.js +10 -19
  120. package/cjs/i18n/en.json +8 -4
  121. package/cjs/icons/LiFiFullLogo.js +1 -1
  122. package/cjs/icons/LiFiLogo.js +1 -1
  123. package/cjs/icons/LiFiToolLogo.js +1 -1
  124. package/cjs/index.d.ts +1 -0
  125. package/cjs/index.js +2 -0
  126. package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +2 -2
  127. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
  128. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.js +3 -3
  129. package/cjs/pages/MainPage/MainPage.js +1 -1
  130. package/cjs/pages/MainPage/MainPage.style.d.ts +1 -1
  131. package/cjs/pages/MainPage/MainSwapButton.js +3 -12
  132. package/cjs/pages/SelectChainPage/SelectChainPage.js +6 -14
  133. package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.d.ts +4 -0
  134. package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +51 -0
  135. package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.d.ts +20 -0
  136. package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.js +8 -0
  137. package/cjs/pages/SelectEnabledToolsPage/index.d.ts +1 -0
  138. package/cjs/pages/SelectEnabledToolsPage/index.js +17 -0
  139. package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +4 -3
  140. package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
  141. package/cjs/pages/SelectTokenPage/SearchTokenInput.js +4 -1
  142. package/cjs/pages/SelectTokenPage/SelectTokenPage.js +2 -3
  143. package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
  144. package/cjs/pages/SelectWalletPage/SelectWalletPage.js +13 -19
  145. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.js +3 -3
  146. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  147. package/cjs/pages/SettingsPage/EnabledToolsButton.d.ts +4 -0
  148. package/cjs/pages/SettingsPage/EnabledToolsButton.js +25 -0
  149. package/cjs/pages/{SelectChainPage/SelectChainPage.style.d.ts → SettingsPage/EnabledToolsButton.style.d.ts} +1 -1
  150. package/cjs/pages/{SelectChainPage/SelectChainPage.style.js → SettingsPage/EnabledToolsButton.style.js} +7 -10
  151. package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
  152. package/cjs/pages/SettingsPage/GasPriceSelect.js +1 -1
  153. package/cjs/pages/SettingsPage/LanguageSelect.js +5 -6
  154. package/cjs/pages/SettingsPage/ResetSettingsButton.d.ts +2 -0
  155. package/cjs/pages/SettingsPage/ResetSettingsButton.js +27 -0
  156. package/cjs/pages/SettingsPage/RoutePrioritySelect.js +4 -4
  157. package/cjs/pages/SettingsPage/SettingsPage.d.ts +0 -1
  158. package/cjs/pages/SettingsPage/SettingsPage.js +3 -2
  159. package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
  160. package/cjs/pages/SettingsPage/ShowDestinationWallet.js +3 -3
  161. package/cjs/pages/SettingsPage/SlippageInput.d.ts +0 -1
  162. package/cjs/pages/SettingsPage/SlippageInput.js +3 -3
  163. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +14 -22
  164. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.style.d.ts +1 -1
  165. package/cjs/pages/SwapHistoryPage/SwapHistoryEmpty.js +2 -2
  166. package/cjs/pages/SwapHistoryPage/SwapHistoryItem.js +9 -7
  167. package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
  168. package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +21 -26
  169. package/cjs/pages/SwapPage/StartSwapButton.js +1 -1
  170. package/cjs/pages/SwapPage/StatusBottomSheet.js +21 -19
  171. package/cjs/pages/SwapPage/StatusBottomSheet.style.d.ts +2 -2
  172. package/cjs/pages/SwapPage/SwapPage.js +9 -21
  173. package/cjs/pages/SwapPage/SwapPage.style.d.ts +1 -1
  174. package/cjs/pages/SwapPage/TokenValueBottomSheet.js +8 -9
  175. package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +3 -3
  176. package/cjs/pages/SwapRoutesPage/SwapRoutesPage.style.d.ts +1 -1
  177. package/cjs/providers/I18nProvider/I18nProvider.js +7 -8
  178. package/cjs/providers/SDKProvider/SDKProvider.js +15 -4
  179. package/cjs/providers/SwapFormProvider/SwapFormProvider.js +12 -6
  180. package/cjs/providers/SwapFormProvider/URLSearchParamsBuilder.js +3 -12
  181. package/cjs/providers/TelemetryProvider/TelemetryProvider.js +1 -1
  182. package/cjs/providers/ThemeProvider/ThemeProvider.js +2 -2
  183. package/cjs/providers/WalletProvider/WalletProvider.js +30 -39
  184. package/cjs/providers/WidgetProvider/WidgetProvider.js +18 -23
  185. package/cjs/providers/WidgetProvider/utils.js +2 -3
  186. package/cjs/stores/StoreProvider.js +2 -2
  187. package/cjs/stores/chains/ChainOrderStore.js +2 -14
  188. package/cjs/stores/routes/RouteExecutionStore.js +2 -14
  189. package/cjs/stores/routes/createRouteExecutionStore.js +27 -16
  190. package/cjs/stores/routes/useExecutingRoutesIds.js +2 -5
  191. package/cjs/stores/routes/useSwapHistory.js +3 -6
  192. package/cjs/stores/routes/utils.js +4 -4
  193. package/cjs/stores/settings/SettingsStore.js +10 -20
  194. package/cjs/stores/settings/createSettingsStore.js +29 -25
  195. package/cjs/stores/settings/types.d.ts +6 -6
  196. package/cjs/utils/colors.js +1 -1
  197. package/cjs/utils/format.js +3 -3
  198. package/cjs/utils/navigationRoutes.d.ts +2 -0
  199. package/cjs/utils/navigationRoutes.js +6 -0
  200. package/components/ActiveSwaps/ActiveSwapItem.js +9 -7
  201. package/components/ActiveSwaps/ActiveSwaps.js +3 -3
  202. package/components/ActiveSwaps/ActiveSwaps.style.d.ts +3 -3
  203. package/components/AppContainer.d.ts +2 -2
  204. package/components/AppContainer.js +1 -1
  205. package/components/BottomSheet/BottomSheet.d.ts +1 -1
  206. package/components/BottomSheet/BottomSheet.js +2 -2
  207. package/components/Card/Card.d.ts +2 -2
  208. package/components/Card/CardHeader.d.ts +1 -1
  209. package/components/Card/CardTitle.d.ts +1 -1
  210. package/components/ChainSelect/ChainSelect.d.ts +0 -1
  211. package/components/ChainSelect/ChainSelect.js +3 -4
  212. package/components/ChainSelect/ChainSelect.style.d.ts +3 -3
  213. package/components/ContractComponent/ContractComponent.js +1 -1
  214. package/components/Dialog.js +1 -1
  215. package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +13 -28
  216. package/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +1 -1
  217. package/components/Header/Header.js +1 -1
  218. package/components/Header/Header.style.d.ts +3 -3
  219. package/components/Header/NavigationHeader.js +6 -2
  220. package/components/Header/WalletHeader.js +12 -22
  221. package/{pages/SelectChainPage/SelectChainPage.style.d.ts → components/ListItemButton.d.ts} +1 -2
  222. package/components/ListItemButton.js +11 -0
  223. package/components/ListItemText.d.ts +2 -0
  224. package/components/ListItemText.js +8 -0
  225. package/components/NFT/NFT.js +2 -14
  226. package/components/NFT/NFT.style.d.ts +1 -1
  227. package/components/NotFound.js +2 -2
  228. package/components/PoweredBy/PoweredBy.js +2 -2
  229. package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
  230. package/components/ProgressToNextUpdate/ProgressToNextUpdate.js +5 -17
  231. package/components/ReverseTokensButton/ReverseTokensButton.js +1 -1
  232. package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
  233. package/components/Select.js +1 -0
  234. package/components/SelectChainAndToken.js +4 -4
  235. package/components/SelectTokenButton/SelectTokenButton.js +2 -2
  236. package/components/SelectTokenButton/SelectTokenButton.style.d.ts +1 -1
  237. package/components/SendToWallet/SendToWallet.js +9 -19
  238. package/components/SendToWallet/SendToWallet.style.d.ts +1 -1
  239. package/components/SendToWallet/SendToWalletButton.js +5 -5
  240. package/components/SmallAvatar.d.ts +3 -3
  241. package/components/Step/CircularProgress.d.ts +0 -1
  242. package/components/Step/CircularProgress.js +2 -2
  243. package/components/Step/CircularProgress.style.d.ts +1 -1
  244. package/components/Step/DestinationWalletAddress.js +6 -7
  245. package/components/Step/GasStepProcess.js +8 -8
  246. package/components/Step/Step.js +4 -5
  247. package/components/Step/StepList.d.ts +0 -1
  248. package/components/Step/StepList.js +8 -4
  249. package/components/Step/StepProcess.js +3 -3
  250. package/components/Step/StepProcess.style.d.ts +2 -2
  251. package/components/Step/StepTimer.js +4 -8
  252. package/components/StepActions/StepActions.js +20 -37
  253. package/components/StepActions/StepActions.style.d.ts +1 -1
  254. package/components/StepDivider/StepDivider.style.d.ts +1 -1
  255. package/components/SwapButton/SwapButton.js +5 -14
  256. package/components/SwapInput/FormPriceHelperText.js +6 -6
  257. package/components/SwapInput/SwapInput.js +4 -16
  258. package/components/SwapInput/SwapInput.style.d.ts +1 -1
  259. package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
  260. package/components/SwapInput/SwapInputEndAdornment.d.ts +0 -1
  261. package/components/SwapInput/SwapInputEndAdornment.js +2 -3
  262. package/components/SwapRouteCard/SwapRouteCard.js +9 -25
  263. package/components/SwapRouteCard/SwapRouteCard.style.d.ts +2 -2
  264. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +4 -16
  265. package/components/SwapRouteCard/SwapRouteNotFoundCard.js +2 -2
  266. package/components/SwapRouteCard/utils.js +1 -1
  267. package/components/SwapRoutes/SwapRoutes.js +4 -4
  268. package/components/SwapRoutes/SwapRoutes.style.d.ts +5 -5
  269. package/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
  270. package/components/SwapRoutes/SwapRoutesExpanded.js +3 -3
  271. package/components/TextFitter/TextFitter.js +3 -3
  272. package/components/Token/Token.js +19 -33
  273. package/components/Token/Token.style.d.ts +3 -3
  274. package/components/TokenAvatar/TokenAvatar.js +6 -7
  275. package/components/TokenAvatar/TokenAvatar.style.d.ts +2 -2
  276. package/components/TokenList/TokenList.js +3 -4
  277. package/components/TokenList/TokenList.style.d.ts +2 -2
  278. package/components/TokenList/TokenList.style.js +3 -7
  279. package/components/TokenList/TokenListItem.js +9 -9
  280. package/components/TokenList/TokenNotFound.js +4 -5
  281. package/components/TokenList/VirtualizedTokenList.js +10 -11
  282. package/components/TokenList/useTokenSelect.js +2 -2
  283. package/config/env.js +1 -1
  284. package/config/sentry.js +3 -12
  285. package/config/theme.js +44 -16
  286. package/config/version.d.ts +1 -1
  287. package/config/version.js +1 -1
  288. package/hooks/useChain.js +1 -1
  289. package/hooks/useChains.js +5 -14
  290. package/hooks/useContentHeight.js +1 -2
  291. package/hooks/useFeaturedTokens.js +1 -4
  292. package/hooks/useGasSufficiency.js +28 -34
  293. package/hooks/useProcessMessage.js +7 -11
  294. package/hooks/useRouteExecution.js +16 -26
  295. package/hooks/useSwapRoutes.js +16 -26
  296. package/hooks/useToken.js +2 -2
  297. package/hooks/useTokenAddressBalance.js +1 -2
  298. package/hooks/useTokenBalance.js +24 -27
  299. package/hooks/useTokenBalances.d.ts +1 -1
  300. package/hooks/useTokenBalances.js +8 -20
  301. package/hooks/useTokenSearch.d.ts +1 -1
  302. package/hooks/useTokenSearch.js +12 -21
  303. package/hooks/useTokens.d.ts +1 -1
  304. package/hooks/useTokens.js +36 -38
  305. package/hooks/useTools.d.ts +2 -11
  306. package/hooks/useTools.js +10 -19
  307. package/i18n/en.json +8 -4
  308. package/icons/LiFiFullLogo.js +1 -1
  309. package/icons/LiFiLogo.js +1 -1
  310. package/icons/LiFiToolLogo.js +1 -1
  311. package/index.d.ts +1 -0
  312. package/index.js +2 -0
  313. package/package.json +7 -7
  314. package/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +2 -2
  315. package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
  316. package/pages/ActiveSwapsPage/ActiveSwapsPage.js +3 -3
  317. package/pages/MainPage/MainPage.js +1 -1
  318. package/pages/MainPage/MainPage.style.d.ts +1 -1
  319. package/pages/MainPage/MainSwapButton.js +3 -12
  320. package/pages/SelectChainPage/SelectChainPage.js +6 -14
  321. package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.d.ts +4 -0
  322. package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +47 -0
  323. package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.d.ts +20 -0
  324. package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.style.js +5 -0
  325. package/pages/SelectEnabledToolsPage/index.d.ts +1 -0
  326. package/pages/SelectEnabledToolsPage/index.js +1 -0
  327. package/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +4 -3
  328. package/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
  329. package/pages/SelectTokenPage/SearchTokenInput.js +4 -1
  330. package/pages/SelectTokenPage/SelectTokenPage.js +2 -3
  331. package/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
  332. package/pages/SelectWalletPage/SelectWalletPage.js +13 -19
  333. package/pages/SettingsPage/ColorSchemeButtonGroup.js +3 -3
  334. package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  335. package/pages/SettingsPage/EnabledToolsButton.d.ts +4 -0
  336. package/pages/SettingsPage/EnabledToolsButton.js +21 -0
  337. package/{cjs/pages/SelectWalletPage/SelectWalletPage.style.d.ts → pages/SettingsPage/EnabledToolsButton.style.d.ts} +1 -1
  338. package/pages/SettingsPage/EnabledToolsButton.style.js +14 -0
  339. package/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
  340. package/pages/SettingsPage/GasPriceSelect.js +1 -1
  341. package/pages/SettingsPage/LanguageSelect.js +5 -6
  342. package/pages/SettingsPage/ResetSettingsButton.d.ts +2 -0
  343. package/pages/SettingsPage/ResetSettingsButton.js +23 -0
  344. package/pages/SettingsPage/RoutePrioritySelect.js +4 -4
  345. package/pages/SettingsPage/SettingsPage.d.ts +0 -1
  346. package/pages/SettingsPage/SettingsPage.js +3 -2
  347. package/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
  348. package/pages/SettingsPage/ShowDestinationWallet.js +3 -3
  349. package/pages/SettingsPage/SlippageInput.d.ts +0 -1
  350. package/pages/SettingsPage/SlippageInput.js +3 -3
  351. package/pages/SwapDetailsPage/SwapDetailsPage.js +14 -22
  352. package/pages/SwapDetailsPage/SwapDetailsPage.style.d.ts +1 -1
  353. package/pages/SwapHistoryPage/SwapHistoryEmpty.js +2 -2
  354. package/pages/SwapHistoryPage/SwapHistoryItem.js +9 -7
  355. package/pages/SwapHistoryPage/SwapHistoryPage.js +2 -2
  356. package/pages/SwapPage/ExchangeRateBottomSheet.js +21 -26
  357. package/pages/SwapPage/StartSwapButton.js +1 -1
  358. package/pages/SwapPage/StatusBottomSheet.js +21 -19
  359. package/pages/SwapPage/StatusBottomSheet.style.d.ts +2 -2
  360. package/pages/SwapPage/SwapPage.js +9 -21
  361. package/pages/SwapPage/SwapPage.style.d.ts +1 -1
  362. package/pages/SwapPage/TokenValueBottomSheet.js +8 -9
  363. package/pages/SwapRoutesPage/SwapRoutesPage.js +3 -3
  364. package/pages/SwapRoutesPage/SwapRoutesPage.style.d.ts +1 -1
  365. package/providers/I18nProvider/I18nProvider.js +7 -8
  366. package/providers/SDKProvider/SDKProvider.js +15 -4
  367. package/providers/SwapFormProvider/SwapFormProvider.js +12 -6
  368. package/providers/SwapFormProvider/URLSearchParamsBuilder.js +3 -12
  369. package/providers/TelemetryProvider/TelemetryProvider.js +1 -1
  370. package/providers/ThemeProvider/ThemeProvider.js +2 -2
  371. package/providers/WalletProvider/WalletProvider.js +30 -39
  372. package/providers/WidgetProvider/WidgetProvider.js +18 -23
  373. package/providers/WidgetProvider/utils.js +2 -3
  374. package/stores/StoreProvider.js +2 -2
  375. package/stores/chains/ChainOrderStore.js +2 -14
  376. package/stores/routes/RouteExecutionStore.js +2 -14
  377. package/stores/routes/createRouteExecutionStore.js +27 -16
  378. package/stores/routes/useExecutingRoutesIds.js +2 -5
  379. package/stores/routes/useSwapHistory.js +3 -6
  380. package/stores/routes/utils.js +4 -4
  381. package/stores/settings/SettingsStore.js +10 -20
  382. package/stores/settings/createSettingsStore.js +29 -25
  383. package/stores/settings/types.d.ts +6 -6
  384. package/tsconfig.cjs.tsbuildinfo +1 -1
  385. package/utils/colors.js +1 -1
  386. package/utils/format.js +3 -3
  387. package/utils/navigationRoutes.d.ts +2 -0
  388. package/utils/navigationRoutes.js +6 -0
  389. package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +0 -2
  390. package/cjs/pages/SettingsPage/AdvancedPreferences.js +0 -24
  391. package/cjs/pages/SettingsPage/EnabledBridgesSelect.d.ts +0 -2
  392. package/cjs/pages/SettingsPage/EnabledBridgesSelect.js +0 -24
  393. package/cjs/pages/SettingsPage/EnabledExchangesSelect.d.ts +0 -2
  394. package/cjs/pages/SettingsPage/EnabledExchangesSelect.js +0 -24
  395. package/pages/SelectChainPage/SelectChainPage.style.js +0 -17
  396. package/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.d.ts +0 -21
  397. package/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.js +0 -17
  398. package/pages/SelectWalletPage/SelectWalletPage.style.d.ts +0 -21
  399. package/pages/SelectWalletPage/SelectWalletPage.style.js +0 -17
  400. package/pages/SettingsPage/AdvancedPreferences.d.ts +0 -2
  401. package/pages/SettingsPage/AdvancedPreferences.js +0 -20
  402. package/pages/SettingsPage/EnabledBridgesSelect.d.ts +0 -2
  403. package/pages/SettingsPage/EnabledBridgesSelect.js +0 -20
  404. package/pages/SettingsPage/EnabledExchangesSelect.d.ts +0 -2
  405. package/pages/SettingsPage/EnabledExchangesSelect.js +0 -20
@@ -6,7 +6,6 @@ import { Card } from '../../components/Card';
6
6
  import { Token, TokenDivider } from '../../components/Token';
7
7
  import { navigationRoutes } from '../../utils';
8
8
  export const SwapHistoryItem = ({ route }) => {
9
- var _a, _b, _c, _d, _e, _f, _g, _h;
10
9
  const { i18n } = useTranslation();
11
10
  const navigate = useNavigate();
12
11
  const handleClick = () => {
@@ -14,14 +13,17 @@ export const SwapHistoryItem = ({ route }) => {
14
13
  state: { routeId: route.id },
15
14
  });
16
15
  };
17
- const startedAt = new Date((_b = (_a = route.steps[0].execution) === null || _a === void 0 ? void 0 : _a.process[0].startedAt) !== null && _b !== void 0 ? _b : 0);
18
- const fromToken = Object.assign(Object.assign({}, route.fromToken), { amount: route.fromAmount });
19
- const toToken = Object.assign(Object.assign({}, ((_e = (_d = (_c = route.steps.at(-1)) === null || _c === void 0 ? void 0 : _c.execution) === null || _d === void 0 ? void 0 : _d.toToken) !== null && _e !== void 0 ? _e : route.toToken)), { amount: (_h = (_g = (_f = route.steps.at(-1)) === null || _f === void 0 ? void 0 : _f.execution) === null || _g === void 0 ? void 0 : _g.toAmount) !== null && _h !== void 0 ? _h : route.toAmount });
20
- return (_jsxs(Card, Object.assign({ onClick: handleClick }, { children: [_jsxs(Box, Object.assign({ sx: {
16
+ const startedAt = new Date(route.steps[0].execution?.process[0].startedAt ?? 0);
17
+ const fromToken = { ...route.fromToken, amount: route.fromAmount };
18
+ const toToken = {
19
+ ...(route.steps.at(-1)?.execution?.toToken ?? route.toToken),
20
+ amount: route.steps.at(-1)?.execution?.toAmount ?? route.toAmount,
21
+ };
22
+ return (_jsxs(Card, { onClick: handleClick, children: [_jsxs(Box, { sx: {
21
23
  display: 'flex',
22
24
  flex: 1,
23
25
  justifyContent: 'space-between',
24
- }, pt: 1.75, px: 2 }, { children: [_jsx(Typography, Object.assign({ fontSize: 12 }, { children: new Intl.DateTimeFormat(i18n.language, { dateStyle: 'long' }).format(startedAt) })), _jsx(Typography, Object.assign({ fontSize: 12 }, { children: new Intl.DateTimeFormat(i18n.language, {
26
+ }, pt: 1.75, px: 2, children: [_jsx(Typography, { fontSize: 12, children: new Intl.DateTimeFormat(i18n.language, { dateStyle: 'long' }).format(startedAt) }), _jsx(Typography, { fontSize: 12, children: new Intl.DateTimeFormat(i18n.language, {
25
27
  timeStyle: 'short',
26
- }).format(startedAt) }))] })), _jsxs(Box, Object.assign({ py: 1 }, { children: [_jsx(Token, { token: fromToken, px: 2, pt: 1, connected: true }), _jsx(TokenDivider, {}), _jsx(Token, { token: toToken, px: 2, pt: 0.5, pb: 1 })] }))] })));
28
+ }).format(startedAt) })] }), _jsxs(Box, { py: 1, children: [_jsx(Token, { token: fromToken, px: 2, pt: 1, connected: true }), _jsx(TokenDivider, {}), _jsx(Token, { token: toToken, px: 2, pt: 0.5, pb: 1 })] })] }));
27
29
  };
@@ -22,11 +22,11 @@ export const SwapHistoryPage = () => {
22
22
  }, []);
23
23
  useEffect(() => {
24
24
  if (swaps.length) {
25
- return useHeaderActionStore.getState().setAction(_jsx(IconButton, Object.assign({ size: "medium", edge: "end", onClick: toggleDialog }, { children: _jsx(DeleteIcon, {}) })));
25
+ return useHeaderActionStore.getState().setAction(_jsx(IconButton, { size: "medium", edge: "end", onClick: toggleDialog, children: _jsx(DeleteIcon, {}) }));
26
26
  }
27
27
  }, [swaps.length, toggleDialog]);
28
28
  if (!swaps.length) {
29
29
  return _jsx(SwapHistoryEmpty, {});
30
30
  }
31
- return (_jsxs(Container, { children: [_jsx(Stack, Object.assign({ spacing: 2, mt: 1 }, { children: swaps.length ? (swaps.map(({ route }) => (_jsx(SwapHistoryItem, { route: route }, route.id)))) : (_jsx(SwapHistoryEmpty, {})) })), _jsxs(Dialog, Object.assign({ open: open, onClose: toggleDialog }, { children: [_jsx(DialogTitle, { children: t('swap.warning.title.deleteSwapHistory') }), _jsx(DialogContent, { children: _jsx(DialogContentText, { children: t('swap.warning.message.deleteSwapHistory') }) }), _jsxs(DialogActions, { children: [_jsx(Button, Object.assign({ onClick: toggleDialog }, { children: t('button.cancel') })), _jsx(Button, Object.assign({ variant: "contained", onClick: () => deleteRoutes('completed'), autoFocus: true }, { children: t('button.delete') }))] })] }))] }));
31
+ return (_jsxs(Container, { children: [_jsx(Stack, { spacing: 2, mt: 1, children: swaps.length ? (swaps.map(({ route }) => (_jsx(SwapHistoryItem, { route: route }, route.id)))) : (_jsx(SwapHistoryEmpty, {})) }), _jsxs(Dialog, { open: open, onClose: toggleDialog, children: [_jsx(DialogTitle, { children: t('swap.warning.title.deleteSwapHistory') }), _jsx(DialogContent, { children: _jsx(DialogContentText, { children: t('swap.warning.message.deleteSwapHistory') }) }), _jsxs(DialogActions, { children: [_jsx(Button, { onClick: toggleDialog, children: t('button.cancel') }), _jsx(Button, { variant: "contained", onClick: () => deleteRoutes('completed'), autoFocus: true, children: t('button.delete') })] })] })] }));
32
32
  };
@@ -13,60 +13,55 @@ export const ExchangeRateBottomSheet = forwardRef(({ onContinue, onCancel }, ref
13
13
  const bottomSheetRef = useRef(null);
14
14
  const resolverRef = useRef();
15
15
  const handleContinue = () => {
16
- var _a;
17
- (_a = ref.current) === null || _a === void 0 ? void 0 : _a.close(true);
18
- onContinue === null || onContinue === void 0 ? void 0 : onContinue();
16
+ ref.current?.close(true);
17
+ onContinue?.();
19
18
  };
20
19
  const handleCancel = useCallback(() => {
21
- var _a;
22
- (_a = ref.current) === null || _a === void 0 ? void 0 : _a.close(false);
23
- onCancel === null || onCancel === void 0 ? void 0 : onCancel();
20
+ ref.current?.close(false);
21
+ onCancel?.();
24
22
  }, [onCancel, ref]);
25
23
  const handleClose = useCallback(() => {
26
- var _a;
27
- (_a = ref.current) === null || _a === void 0 ? void 0 : _a.close(false, false);
28
- onCancel === null || onCancel === void 0 ? void 0 : onCancel();
24
+ ref.current?.close(false, false);
25
+ onCancel?.();
29
26
  }, [onCancel, ref]);
30
27
  useImperativeHandle(ref, () => ({
31
- isOpen: () => { var _a; return (_a = bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.isOpen(); },
28
+ isOpen: () => bottomSheetRef.current?.isOpen(),
32
29
  open: (resolver, data) => {
33
- var _a;
34
30
  setData(data);
35
31
  resolverRef.current = resolver;
36
- (_a = bottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.open();
32
+ bottomSheetRef.current?.open();
37
33
  },
38
34
  close: (value = false, bottomSheetClose = true) => {
39
- var _a, _b;
40
- (_a = resolverRef.current) === null || _a === void 0 ? void 0 : _a.call(resolverRef, value);
35
+ resolverRef.current?.(value);
41
36
  if (bottomSheetClose) {
42
- (_b = bottomSheetRef.current) === null || _b === void 0 ? void 0 : _b.close();
37
+ bottomSheetRef.current?.close();
43
38
  }
44
39
  },
45
40
  }), []);
46
- return (_jsx(BottomSheet, Object.assign({ ref: bottomSheetRef, onClose: handleClose }, { children: _jsx(ExchangeRateBottomSheetContent, { data: data, onContinue: handleContinue, onCancel: handleCancel }) })));
41
+ return (_jsx(BottomSheet, { ref: bottomSheetRef, onClose: handleClose, children: _jsx(ExchangeRateBottomSheetContent, { data: data, onContinue: handleContinue, onCancel: handleCancel }) }));
47
42
  });
48
43
  const ExchangeRateBottomSheetContent = ({ data, onCancel, onContinue }) => {
49
44
  const { t } = useTranslation();
50
45
  const ref = useRef();
51
46
  useSetContentHeight(ref);
52
- return (_jsxs(Box, Object.assign({ p: 3, ref: ref }, { children: [_jsxs(IconContainer, { children: [_jsx(IconCircle, Object.assign({ status: "warning", mb: 1 }, { children: _jsx(WarningIcon, { color: "warning" }) })), _jsx(Typography, Object.assign({ py: 1, fontSize: 18, fontWeight: 700 }, { children: t('swap.warning.title.rateChanged') }))] }), _jsx(Typography, Object.assign({ py: 1 }, { children: t('swap.warning.message.rateChanged') })), _jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", mt: 1 }, { children: [_jsx(Typography, { children: t('swap.quotedAmount') }), _jsxs(Typography, Object.assign({ fontWeight: 600 }, { children: [t('format.number', {
53
- value: formatTokenAmount(data === null || data === void 0 ? void 0 : data.oldToAmount, data === null || data === void 0 ? void 0 : data.toToken.decimals, 5),
54
- }), ' ', data === null || data === void 0 ? void 0 : data.toToken.symbol] }))] })), _jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", mt: 0.25 }, { children: [_jsx(Typography, { children: t('swap.currentAmount') }), _jsxs(Typography, Object.assign({ fontWeight: 600 }, { children: [t('format.number', {
55
- value: formatTokenAmount(data === null || data === void 0 ? void 0 : data.newToAmount, data === null || data === void 0 ? void 0 : data.toToken.decimals, 5),
56
- }), ' ', data === null || data === void 0 ? void 0 : data.toToken.symbol] }))] })), _jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", mt: 0.25 }, { children: [_jsx(Typography, { children: t('swap.rateChange') }), _jsxs(Typography, Object.assign({ fontWeight: 600 }, { children: [Big((data === null || data === void 0 ? void 0 : data.newToAmount) || 0)
57
- .div(Big((data === null || data === void 0 ? void 0 : data.oldToAmount) || 0))
47
+ return (_jsxs(Box, { p: 3, ref: ref, children: [_jsxs(IconContainer, { children: [_jsx(IconCircle, { status: "warning", mb: 1, children: _jsx(WarningIcon, { color: "warning" }) }), _jsx(Typography, { py: 1, fontSize: 18, fontWeight: 700, children: t('swap.warning.title.rateChanged') })] }), _jsx(Typography, { py: 1, children: t('swap.warning.message.rateChanged') }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 1, children: [_jsx(Typography, { children: t('swap.quotedAmount') }), _jsxs(Typography, { fontWeight: 600, children: [t('format.number', {
48
+ value: formatTokenAmount(data?.oldToAmount, data?.toToken.decimals, 5),
49
+ }), ' ', data?.toToken.symbol] })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('swap.currentAmount') }), _jsxs(Typography, { fontWeight: 600, children: [t('format.number', {
50
+ value: formatTokenAmount(data?.newToAmount, data?.toToken.decimals, 5),
51
+ }), ' ', data?.toToken.symbol] })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('swap.rateChange') }), _jsxs(Typography, { fontWeight: 600, children: [Big(data?.newToAmount || 0)
52
+ .div(Big(data?.oldToAmount || 0))
58
53
  .minus(1)
59
54
  .mul(100)
60
55
  .round(2, Big.roundUp)
61
- .toString(), "%"] }))] })), _jsxs(Box, Object.assign({ display: "flex", mt: 3 }, { children: [_jsx(Button, Object.assign({ variant: "text", onClick: onCancel, fullWidth: true }, { children: t('button.cancel') })), _jsx(Box, { display: "flex", p: 1 }), _jsx(Button, Object.assign({ variant: "contained", onClick: onContinue, fullWidth: true }, { children: t('button.continue') }))] }))] })));
56
+ .toString(), "%"] })] }), _jsxs(Box, { display: "flex", mt: 3, children: [_jsx(Button, { variant: "text", onClick: onCancel, fullWidth: true, children: t('button.cancel') }), _jsx(Box, { display: "flex", p: 1 }), _jsx(Button, { variant: "contained", onClick: onContinue, fullWidth: true, children: t('button.continue') })] })] }));
62
57
  };
63
58
  export const getTokenValueLossThreshold = (route) => {
64
59
  if (!route) {
65
60
  return false;
66
61
  }
67
- const fromAmountUSD = Big((route === null || route === void 0 ? void 0 : route.fromAmountUSD) || 0);
68
- const toAmountUSD = Big((route === null || route === void 0 ? void 0 : route.toAmountUSD) || 0);
69
- const gasCostUSD = Big((route === null || route === void 0 ? void 0 : route.gasCostUSD) || 0);
62
+ const fromAmountUSD = Big(route?.fromAmountUSD || 0);
63
+ const toAmountUSD = Big(route?.toAmountUSD || 0);
64
+ const gasCostUSD = Big(route?.gasCostUSD || 0);
70
65
  if (fromAmountUSD.eq(0) && toAmountUSD.eq(0)) {
71
66
  return false;
72
67
  }
@@ -3,5 +3,5 @@ import { SwapButton } from '../../components/SwapButton';
3
3
  import { useGasSufficiency } from '../../hooks';
4
4
  export const StartSwapButton = ({ onClick, currentRoute, text, }) => {
5
5
  const { insufficientFunds, insufficientGas, isLoading: isGasSufficiencyLoading, } = useGasSufficiency(currentRoute);
6
- return (_jsx(SwapButton, { onClick: onClick, text: text, currentRoute: currentRoute, disabled: insufficientFunds || !!(insufficientGas === null || insufficientGas === void 0 ? void 0 : insufficientGas.length), loading: isGasSufficiencyLoading }));
6
+ return (_jsx(SwapButton, { onClick: onClick, text: text, currentRoute: currentRoute, disabled: insufficientFunds || !!insufficientGas?.length, loading: isGasSufficiencyLoading }));
7
7
  };
@@ -13,13 +13,17 @@ import { RouteExecutionStatus } from '../../stores';
13
13
  import { formatTokenAmount, hasEnumFlag, navigationRoutes, shortenWalletAddress, } from '../../utils';
14
14
  import { IconCircle, IconContainer } from './StatusBottomSheet.style';
15
15
  export const StatusBottomSheet = ({ status, route, }) => {
16
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
17
16
  const { t } = useTranslation();
18
17
  const { navigateBack, navigate } = useNavigateBack();
19
18
  const ref = useRef(null);
20
19
  const { getChainById } = useChains();
21
20
  const { setValue } = useFormContext();
22
- const toToken = Object.assign(Object.assign({}, ((_c = (_b = (_a = route.steps.at(-1)) === null || _a === void 0 ? void 0 : _a.execution) === null || _b === void 0 ? void 0 : _b.toToken) !== null && _c !== void 0 ? _c : route.toToken)), { amount: (_h = (_f = (_e = (_d = route.steps.at(-1)) === null || _d === void 0 ? void 0 : _d.execution) === null || _e === void 0 ? void 0 : _e.toAmount) !== null && _f !== void 0 ? _f : (_g = route.steps.at(-1)) === null || _g === void 0 ? void 0 : _g.estimate.toAmount) !== null && _h !== void 0 ? _h : route.toAmount });
21
+ const toToken = {
22
+ ...(route.steps.at(-1)?.execution?.toToken ?? route.toToken),
23
+ amount: route.steps.at(-1)?.execution?.toAmount ??
24
+ route.steps.at(-1)?.estimate.toAmount ??
25
+ route.toAmount,
26
+ };
23
27
  const { token, refetch, refetchNewBalance, refetchAllBalances } = useTokenBalance(toToken, route.toAddress);
24
28
  const clearFromAmount = () => {
25
29
  refetchAllBalances();
@@ -46,9 +50,8 @@ export const StatusBottomSheet = ({ status, route, }) => {
46
50
  navigateBack();
47
51
  };
48
52
  const handleClose = () => {
49
- var _a;
50
53
  clearFromAmount();
51
- (_a = ref.current) === null || _a === void 0 ? void 0 : _a.close();
54
+ ref.current?.close();
52
55
  };
53
56
  const handleSeeDetails = () => {
54
57
  handleClose();
@@ -68,7 +71,7 @@ export const StatusBottomSheet = ({ status, route, }) => {
68
71
  primaryMessage = t('swap.success.message.swapSuccessful', {
69
72
  amount: token.amount,
70
73
  tokenSymbol: token.symbol,
71
- chainName: (_j = getChainById(token.chainId)) === null || _j === void 0 ? void 0 : _j.name,
74
+ chainName: getChainById(token.chainId)?.name,
72
75
  walletAddress: shortenWalletAddress(route.toAddress),
73
76
  });
74
77
  }
@@ -78,14 +81,14 @@ export const StatusBottomSheet = ({ status, route, }) => {
78
81
  case RouteExecutionStatus.Done | RouteExecutionStatus.Partial: {
79
82
  title = t('swap.success.title.swapPartiallySuccessful');
80
83
  primaryMessage = t('swap.success.message.swapPartiallySuccessful', {
81
- tool: (_k = route.steps.at(-1)) === null || _k === void 0 ? void 0 : _k.toolDetails.name,
82
- tokenSymbol: (_l = route.steps.at(-1)) === null || _l === void 0 ? void 0 : _l.action.toToken.symbol,
84
+ tool: route.steps.at(-1)?.toolDetails.name,
85
+ tokenSymbol: route.steps.at(-1)?.action.toToken.symbol,
83
86
  });
84
87
  if (token) {
85
88
  secondaryMessage = t('swap.success.message.swapSuccessful', {
86
89
  amount: token.amount,
87
90
  tokenSymbol: token.symbol,
88
- chainName: (_m = getChainById(token.chainId)) === null || _m === void 0 ? void 0 : _m.name,
91
+ chainName: getChainById(token.chainId)?.name,
89
92
  walletAddress: shortenWalletAddress(route.toAddress),
90
93
  });
91
94
  }
@@ -95,22 +98,22 @@ export const StatusBottomSheet = ({ status, route, }) => {
95
98
  case RouteExecutionStatus.Done | RouteExecutionStatus.Refunded: {
96
99
  title = t('swap.success.title.refundIssued');
97
100
  primaryMessage = t('swap.success.message.swapPartiallySuccessful', {
98
- tool: (_o = route.steps.at(-1)) === null || _o === void 0 ? void 0 : _o.toolDetails.name,
99
- tokenSymbol: (_p = route.steps.at(-1)) === null || _p === void 0 ? void 0 : _p.action.toToken.symbol,
101
+ tool: route.steps.at(-1)?.toolDetails.name,
102
+ tokenSymbol: route.steps.at(-1)?.action.toToken.symbol,
100
103
  });
101
104
  if (token) {
102
105
  secondaryMessage = t('swap.success.message.swapSuccessful', {
103
106
  amount: token.amount,
104
107
  tokenSymbol: token.symbol,
105
- chainName: (_q = getChainById(token.chainId)) === null || _q === void 0 ? void 0 : _q.name,
108
+ chainName: getChainById(token.chainId)?.name,
106
109
  walletAddress: shortenWalletAddress(route.toAddress),
107
110
  });
108
111
  }
109
112
  break;
110
113
  }
111
114
  case RouteExecutionStatus.Failed: {
112
- const step = route.steps.find((step) => { var _a; return ((_a = step.execution) === null || _a === void 0 ? void 0 : _a.status) === 'FAILED'; });
113
- const process = (_r = step === null || step === void 0 ? void 0 : step.execution) === null || _r === void 0 ? void 0 : _r.process.find((process) => process.status === 'FAILED');
115
+ const step = route.steps.find((step) => step.execution?.status === 'FAILED');
116
+ const process = step?.execution?.process.find((process) => process.status === 'FAILED');
114
117
  if (!step || !process) {
115
118
  break;
116
119
  }
@@ -124,21 +127,20 @@ export const StatusBottomSheet = ({ status, route, }) => {
124
127
  break;
125
128
  }
126
129
  useEffect(() => {
127
- var _a, _b;
128
130
  const hasSuccessFlag = hasEnumFlag(status, RouteExecutionStatus.Done);
129
131
  if ((hasSuccessFlag || hasEnumFlag(status, RouteExecutionStatus.Failed)) &&
130
- !((_a = ref.current) === null || _a === void 0 ? void 0 : _a.isOpen())) {
132
+ !ref.current?.isOpen()) {
131
133
  if (hasSuccessFlag) {
132
134
  refetchNewBalance();
133
135
  refetch();
134
136
  }
135
- (_b = ref.current) === null || _b === void 0 ? void 0 : _b.open();
137
+ ref.current?.open();
136
138
  }
137
139
  }, [refetch, refetchNewBalance, status]);
138
- return (_jsx(BottomSheet, Object.assign({ ref: ref }, { children: _jsxs(Box, Object.assign({ p: 3 }, { children: [_jsxs(IconContainer, { children: [_jsxs(IconCircle, Object.assign({ status: status, mb: 1 }, { children: [status === RouteExecutionStatus.Idle ? (_jsx(InfoIcon, { color: "primary" })) : null, status === RouteExecutionStatus.Done ? (_jsx(DoneIcon, { color: "success" })) : null, hasEnumFlag(status, RouteExecutionStatus.Partial) ||
139
- hasEnumFlag(status, RouteExecutionStatus.Refunded) ? (_jsx(WarningIcon, { color: "warning" })) : null, hasEnumFlag(status, RouteExecutionStatus.Failed) ? (_jsx(ErrorIcon, { color: "error" })) : null] })), _jsx(Typography, Object.assign({ py: 1, fontSize: 18, fontWeight: 700 }, { children: title })), hasEnumFlag(status, RouteExecutionStatus.Done) ? (_jsx(Token, { token: toToken, py: 1, disableDescription: true })) : null] }), _jsx(Typography, Object.assign({ py: 1 }, { children: primaryMessage })), secondaryMessage ? (_jsx(Typography, Object.assign({ py: 1 }, { children: secondaryMessage }))) : null, _jsx(Box, Object.assign({ mt: 2 }, { children: _jsxs(Button, Object.assign({ variant: "contained", fullWidth: true, onClick: handlePrimaryButton }, { children: [status === RouteExecutionStatus.Idle ? t('button.ok') : null, hasEnumFlag(status, RouteExecutionStatus.Done)
140
+ return (_jsx(BottomSheet, { ref: ref, children: _jsxs(Box, { p: 3, children: [_jsxs(IconContainer, { children: [_jsxs(IconCircle, { status: status, mb: 1, children: [status === RouteExecutionStatus.Idle ? (_jsx(InfoIcon, { color: "primary" })) : null, status === RouteExecutionStatus.Done ? (_jsx(DoneIcon, { color: "success" })) : null, hasEnumFlag(status, RouteExecutionStatus.Partial) ||
141
+ hasEnumFlag(status, RouteExecutionStatus.Refunded) ? (_jsx(WarningIcon, { color: "warning" })) : null, hasEnumFlag(status, RouteExecutionStatus.Failed) ? (_jsx(ErrorIcon, { color: "error" })) : null] }), _jsx(Typography, { py: 1, fontSize: 18, fontWeight: 700, children: title }), hasEnumFlag(status, RouteExecutionStatus.Done) ? (_jsx(Token, { token: toToken, py: 1, disableDescription: true })) : null] }), _jsx(Typography, { py: 1, children: primaryMessage }), secondaryMessage ? (_jsx(Typography, { py: 1, children: secondaryMessage })) : null, _jsx(Box, { mt: 2, children: _jsxs(Button, { variant: "contained", fullWidth: true, onClick: handlePrimaryButton, children: [status === RouteExecutionStatus.Idle ? t('button.ok') : null, hasEnumFlag(status, RouteExecutionStatus.Done)
140
142
  ? t('button.done')
141
143
  : null, status === RouteExecutionStatus.Failed
142
144
  ? t('button.seeDetails')
143
- : null] })) })), hasEnumFlag(status, RouteExecutionStatus.Done) ? (_jsx(Box, Object.assign({ mt: 2 }, { children: _jsx(Button, Object.assign({ variant: "text", onClick: handleSeeDetails, fullWidth: true }, { children: t('button.seeDetails') })) }))) : null] })) })));
145
+ : null] }) }), hasEnumFlag(status, RouteExecutionStatus.Done) ? (_jsx(Box, { mt: 2, children: _jsx(Button, { variant: "text", onClick: handleSeeDetails, fullWidth: true, children: t('button.seeDetails') }) })) : null] }) }));
144
146
  };
@@ -7,7 +7,7 @@ export declare const IconContainer: import("@emotion/styled").StyledComponent<im
7
7
  component?: import("react").ElementType<any> | undefined;
8
8
  ref?: import("react").Ref<unknown> | undefined;
9
9
  sx?: import("@mui/material").SxProps<Theme> | undefined;
10
- } & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
10
+ } & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
11
11
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
12
12
  }, "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>, {}, {}>;
13
13
  export declare const IconCircle: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<Theme> & {
@@ -15,7 +15,7 @@ export declare const IconCircle: import("@emotion/styled").StyledComponent<impor
15
15
  component?: import("react").ElementType<any> | undefined;
16
16
  ref?: import("react").Ref<unknown> | undefined;
17
17
  sx?: import("@mui/material").SxProps<Theme> | undefined;
18
- } & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
18
+ } & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
19
19
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
20
20
  }, "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> & {
21
21
  status: StatusColor;
@@ -1,12 +1,3 @@
1
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
2
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
3
- return new (P || (P = Promise))(function (resolve, reject) {
4
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
7
- step((generator = generator.apply(thisArg, _arguments || [])).next());
8
- });
9
- };
10
1
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
2
  import { Delete as DeleteIcon } from '@mui/icons-material';
12
3
  import { Box, Button, Tooltip } from '@mui/material';
@@ -25,7 +16,6 @@ import { StatusBottomSheet } from './StatusBottomSheet';
25
16
  import { Container } from './SwapPage.style';
26
17
  import { getTokenValueLossThreshold, TokenValueBottomSheet, } from './TokenValueBottomSheet';
27
18
  export const SwapPage = () => {
28
- var _a;
29
19
  const { t } = useTranslation();
30
20
  const { variant } = useWidgetConfig();
31
21
  const { state } = useLocation();
@@ -34,23 +24,21 @@ export const SwapPage = () => {
34
24
  const exchangeRateBottomSheetRef = useRef(null);
35
25
  const { setValue } = useFormContext();
36
26
  const { route, status, executeRoute, restartRoute, deleteRoute } = useRouteExecution({
37
- routeId: state === null || state === void 0 ? void 0 : state.routeId,
38
- onAcceptExchangeRateUpdate: (_a = exchangeRateBottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.open,
27
+ routeId: state?.routeId,
28
+ onAcceptExchangeRateUpdate: exchangeRateBottomSheetRef.current?.open,
39
29
  });
40
30
  const handleExecuteRoute = useCallback(() => {
41
- var _a, _b;
42
- if ((_a = tokenValueBottomSheetRef.current) === null || _a === void 0 ? void 0 : _a.isOpen()) {
43
- (_b = tokenValueBottomSheetRef.current) === null || _b === void 0 ? void 0 : _b.close();
31
+ if (tokenValueBottomSheetRef.current?.isOpen()) {
32
+ tokenValueBottomSheetRef.current?.close();
44
33
  }
45
34
  executeRoute();
46
35
  setValue(SwapFormKey.FromAmount, '');
47
36
  }, [executeRoute, setValue]);
48
- const handleSwapClick = () => __awaiter(void 0, void 0, void 0, function* () {
49
- var _b;
37
+ const handleSwapClick = async () => {
50
38
  if (status === RouteExecutionStatus.Idle) {
51
39
  const thresholdExceeded = getTokenValueLossThreshold(route);
52
40
  if (thresholdExceeded) {
53
- (_b = tokenValueBottomSheetRef.current) === null || _b === void 0 ? void 0 : _b.open();
41
+ tokenValueBottomSheetRef.current?.open();
54
42
  }
55
43
  else {
56
44
  handleExecuteRoute();
@@ -59,7 +47,7 @@ export const SwapPage = () => {
59
47
  if (status === RouteExecutionStatus.Failed) {
60
48
  restartRoute();
61
49
  }
62
- });
50
+ };
63
51
  const handleRemoveRoute = () => {
64
52
  navigateBack();
65
53
  deleteRoute();
@@ -77,8 +65,8 @@ export const SwapPage = () => {
77
65
  }
78
66
  };
79
67
  return (_jsxs(Container, { children: [getStepList(route), status === RouteExecutionStatus.Idle ||
80
- status === RouteExecutionStatus.Failed ? (_jsxs(_Fragment, { children: [_jsx(GasSufficiencyMessage, { route: route, mt: 2 }), _jsxs(Box, Object.assign({ mt: 2, display: "flex" }, { children: [_jsx(StartSwapButton, { text: getSwapButtonText(), onClick: handleSwapClick, currentRoute: route }), status === RouteExecutionStatus.Failed ? (_jsx(Tooltip, Object.assign({ title: t('button.removeSwap'), placement: "bottom-end", enterDelay: 400, arrow: true }, { children: _jsx(Button, Object.assign({ onClick: handleRemoveRoute, sx: {
68
+ status === RouteExecutionStatus.Failed ? (_jsxs(_Fragment, { children: [_jsx(GasSufficiencyMessage, { route: route, mt: 2 }), _jsxs(Box, { mt: 2, display: "flex", children: [_jsx(StartSwapButton, { text: getSwapButtonText(), onClick: handleSwapClick, currentRoute: route }), status === RouteExecutionStatus.Failed ? (_jsx(Tooltip, { title: t('button.removeSwap'), placement: "bottom-end", enterDelay: 400, arrow: true, children: _jsx(Button, { onClick: handleRemoveRoute, sx: {
81
69
  minWidth: 48,
82
70
  marginLeft: 1,
83
- } }, { children: _jsx(DeleteIcon, {}) })) }))) : null] }))] })) : null, route && status ? (_jsx(StatusBottomSheet, { status: status, route: route })) : null, route ? (_jsx(TokenValueBottomSheet, { route: route, ref: tokenValueBottomSheetRef, onContinue: handleExecuteRoute })) : null, route ? (_jsx(ExchangeRateBottomSheet, { ref: exchangeRateBottomSheetRef })) : null] }));
71
+ }, children: _jsx(DeleteIcon, {}) }) })) : null] })] })) : null, route && status ? (_jsx(StatusBottomSheet, { status: status, route: route })) : null, route ? (_jsx(TokenValueBottomSheet, { route: route, ref: tokenValueBottomSheetRef, onContinue: handleExecuteRoute })) : null, route ? (_jsx(ExchangeRateBottomSheet, { ref: exchangeRateBottomSheetRef })) : null] }));
84
72
  };
@@ -6,6 +6,6 @@ export declare const Container: import("@emotion/styled").StyledComponent<{
6
6
  fixed?: boolean | undefined;
7
7
  maxWidth?: false | import("@mui/material").Breakpoint | undefined;
8
8
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
9
- } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
9
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
10
10
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
11
11
  }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "maxWidth" | "fixed" | "disableGutters"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -9,30 +9,29 @@ import { useSetContentHeight } from '../../hooks';
9
9
  import { IconCircle, IconContainer } from './StatusBottomSheet.style';
10
10
  export const TokenValueBottomSheet = forwardRef(({ route, onContinue, onCancel }, ref) => {
11
11
  const handleCancel = () => {
12
- var _a;
13
- (_a = ref.current) === null || _a === void 0 ? void 0 : _a.close();
14
- onCancel === null || onCancel === void 0 ? void 0 : onCancel();
12
+ ref.current?.close();
13
+ onCancel?.();
15
14
  };
16
- return (_jsx(BottomSheet, Object.assign({ ref: ref, onClose: onCancel }, { children: _jsx(TokenValueBottomSheetContent, { route: route, onContinue: onContinue, onCancel: handleCancel }) })));
15
+ return (_jsx(BottomSheet, { ref: ref, onClose: onCancel, children: _jsx(TokenValueBottomSheetContent, { route: route, onContinue: onContinue, onCancel: handleCancel }) }));
17
16
  });
18
17
  const TokenValueBottomSheetContent = ({ route, onCancel, onContinue, }) => {
19
18
  const { t } = useTranslation();
20
19
  const ref = useRef();
21
20
  useSetContentHeight(ref);
22
- return (_jsxs(Box, Object.assign({ p: 3, ref: ref }, { children: [_jsxs(IconContainer, { children: [_jsx(IconCircle, Object.assign({ status: "warning", mb: 1 }, { children: _jsx(WarningIcon, { color: "warning" }) })), _jsx(Typography, Object.assign({ py: 1, fontSize: 18, fontWeight: 700 }, { children: t('swap.warning.title.highValueLoss') }))] }), _jsx(Typography, Object.assign({ py: 1 }, { children: t('swap.warning.message.highValueLoss') })), _jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", mt: 1 }, { children: [_jsx(Typography, { children: t('swap.swapping') }), _jsx(Typography, Object.assign({ fontWeight: 600 }, { children: t('format.currency', { value: route.fromAmountUSD }) }))] })), _jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", mt: 0.25 }, { children: [_jsx(Typography, { children: t('swap.gasCost') }), _jsx(Typography, Object.assign({ fontWeight: 600 }, { children: t('format.currency', { value: route.gasCostUSD }) }))] })), _jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", mt: 0.25 }, { children: [_jsx(Typography, { children: t('swap.receiving') }), _jsx(Typography, Object.assign({ fontWeight: 600 }, { children: t('format.currency', { value: route.toAmountUSD }) }))] })), _jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", mt: 0.25 }, { children: [_jsx(Typography, { children: t('swap.valueLoss') }), _jsxs(Typography, Object.assign({ fontWeight: 600 }, { children: [Big(route.toAmountUSD || 0)
21
+ return (_jsxs(Box, { p: 3, ref: ref, children: [_jsxs(IconContainer, { children: [_jsx(IconCircle, { status: "warning", mb: 1, children: _jsx(WarningIcon, { color: "warning" }) }), _jsx(Typography, { py: 1, fontSize: 18, fontWeight: 700, children: t('swap.warning.title.highValueLoss') })] }), _jsx(Typography, { py: 1, children: t('swap.warning.message.highValueLoss') }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 1, children: [_jsx(Typography, { children: t('swap.swapping') }), _jsx(Typography, { fontWeight: 600, children: t('format.currency', { value: route.fromAmountUSD }) })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('swap.gasCost') }), _jsx(Typography, { fontWeight: 600, children: t('format.currency', { value: route.gasCostUSD }) })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('swap.receiving') }), _jsx(Typography, { fontWeight: 600, children: t('format.currency', { value: route.toAmountUSD }) })] }), _jsxs(Box, { display: "flex", justifyContent: "space-between", mt: 0.25, children: [_jsx(Typography, { children: t('swap.valueLoss') }), _jsxs(Typography, { fontWeight: 600, children: [Big(route.toAmountUSD || 0)
23
22
  .div(Big(route.fromAmountUSD || 0).plus(Big(route.gasCostUSD || 0)))
24
23
  .minus(1)
25
24
  .mul(100)
26
25
  .round(2, Big.roundUp)
27
- .toString(), "%"] }))] })), _jsxs(Box, Object.assign({ display: "flex", mt: 3 }, { children: [_jsx(Button, Object.assign({ variant: "text", onClick: onCancel, fullWidth: true }, { children: t('button.cancel') })), _jsx(Box, { display: "flex", p: 1 }), _jsx(Button, Object.assign({ variant: "contained", onClick: onContinue, fullWidth: true }, { children: t('button.continue') }))] }))] })));
26
+ .toString(), "%"] })] }), _jsxs(Box, { display: "flex", mt: 3, children: [_jsx(Button, { variant: "text", onClick: onCancel, fullWidth: true, children: t('button.cancel') }), _jsx(Box, { display: "flex", p: 1 }), _jsx(Button, { variant: "contained", onClick: onContinue, fullWidth: true, children: t('button.continue') })] })] }));
28
27
  };
29
28
  export const getTokenValueLossThreshold = (route) => {
30
29
  if (!route) {
31
30
  return false;
32
31
  }
33
- const fromAmountUSD = Big((route === null || route === void 0 ? void 0 : route.fromAmountUSD) || 0);
34
- const toAmountUSD = Big((route === null || route === void 0 ? void 0 : route.toAmountUSD) || 0);
35
- const gasCostUSD = Big((route === null || route === void 0 ? void 0 : route.gasCostUSD) || 0);
32
+ const fromAmountUSD = Big(route?.fromAmountUSD || 0);
33
+ const toAmountUSD = Big(route?.toAmountUSD || 0);
34
+ const gasCostUSD = Big(route?.gasCostUSD || 0);
36
35
  if (fromAmountUSD.eq(0) && toAmountUSD.eq(0)) {
37
36
  return false;
38
37
  }
@@ -18,7 +18,7 @@ export const SwapRoutesPage = () => {
18
18
  });
19
19
  };
20
20
  useEffect(() => {
21
- if (!(swapRoutes === null || swapRoutes === void 0 ? void 0 : swapRoutes.length) && !isLoading && !isFetching) {
21
+ if (!swapRoutes?.length && !isLoading && !isFetching) {
22
22
  navigateBack();
23
23
  }
24
24
  // redirect to the home page if no routes are found on page reload
@@ -29,6 +29,6 @@ export const SwapRoutesPage = () => {
29
29
  .getState()
30
30
  .setAction(_jsx(ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 }, size: "medium", edge: "end" }));
31
31
  }, [dataUpdatedAt, isFetching, refetch, refetchTime]);
32
- const routeNotFound = !(swapRoutes === null || swapRoutes === void 0 ? void 0 : swapRoutes.length) && !isLoading && !isFetching;
33
- return (_jsx(Stack, Object.assign({ direction: "column", spacing: 2, flex: 1 }, { children: routeNotFound ? (_jsx(SwapRouteNotFoundCard, {})) : isLoading ? (Array.from({ length: 3 }).map((_, index) => (_jsx(SwapRouteCardSkeleton, {}, index)))) : (swapRoutes === null || swapRoutes === void 0 ? void 0 : swapRoutes.map((route, index) => (_jsx(SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0 }, route.id)))) })));
32
+ const routeNotFound = !swapRoutes?.length && !isLoading && !isFetching;
33
+ return (_jsx(Stack, { direction: "column", spacing: 2, flex: 1, children: routeNotFound ? (_jsx(SwapRouteNotFoundCard, {})) : isLoading ? (Array.from({ length: 3 }).map((_, index) => (_jsx(SwapRouteCardSkeleton, {}, index)))) : (swapRoutes?.map((route, index) => (_jsx(SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0 }, route.id)))) }));
34
34
  };
@@ -6,6 +6,6 @@ export declare const Stack: import("@emotion/styled").StyledComponent<import("@m
6
6
  spacing?: import("@mui/system").ResponsiveStyleValue<string | number> | undefined;
7
7
  divider?: import("react").ReactNode;
8
8
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
9
- } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
9
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
10
10
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
11
11
  }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | "direction" | ("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") | "divider" | "spacing"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -11,12 +11,11 @@ export const I18nProvider = ({ children, }) => {
11
11
  const { languageResources, languages, disableI18n } = useWidgetConfig();
12
12
  const { language } = useSettings(['language']);
13
13
  const i18n = useMemo(() => {
14
- var _a, _b;
15
14
  let resources = Object.keys(supportedLanguages)
16
15
  .filter((lng) => isItemAllowed(lng, languages))
17
16
  .reduce((resources, lng) => {
18
17
  resources[lng] = {
19
- translation: (languageResources === null || languageResources === void 0 ? void 0 : languageResources[lng])
18
+ translation: languageResources?.[lng]
20
19
  ? deepMerge(supportedLanguages[lng], languageResources[lng])
21
20
  : supportedLanguages[lng],
22
21
  };
@@ -33,12 +32,12 @@ export const I18nProvider = ({ children, }) => {
33
32
  }, resources);
34
33
  }
35
34
  let i18n = i18next.createInstance({
36
- lng: (languages === null || languages === void 0 ? void 0 : languages.default) || language,
35
+ lng: languages?.default || language,
37
36
  fallbackLng: resources.en
38
37
  ? 'en'
39
- : (languages === null || languages === void 0 ? void 0 : languages.default) ||
40
- ((_a = languages === null || languages === void 0 ? void 0 : languages.allow) === null || _a === void 0 ? void 0 : _a[0]) ||
41
- ((_b = Object.keys(resources)) === null || _b === void 0 ? void 0 : _b[0]),
38
+ : languages?.default ||
39
+ languages?.allow?.[0] ||
40
+ Object.keys(resources)?.[0],
42
41
  lowerCaseLng: true,
43
42
  interpolation: {
44
43
  escapeValue: false,
@@ -48,11 +47,11 @@ export const I18nProvider = ({ children, }) => {
48
47
  caches: [],
49
48
  },
50
49
  });
51
- if (!language && !(languages === null || languages === void 0 ? void 0 : languages.default) && !disableI18n) {
50
+ if (!language && !languages?.default && !disableI18n) {
52
51
  i18n = i18n.use(LanguageDetector);
53
52
  }
54
53
  i18n.use(initReactI18next).init();
55
54
  return i18n;
56
55
  }, [disableI18n, language, languageResources, languages]);
57
- return _jsx(I18nextProvider, Object.assign({ i18n: i18n }, { children: children }));
56
+ return _jsx(I18nextProvider, { i18n: i18n, children: children });
58
57
  };
@@ -8,14 +8,25 @@ export const useLiFi = () => useContext(SDKContext);
8
8
  export const SDKProvider = ({ children, }) => {
9
9
  const { sdkConfig, fee, integrator, referrer, routePriority, slippage } = useWidgetConfig();
10
10
  const value = useMemo(() => {
11
- const config = Object.assign(Object.assign({}, sdkConfig), { defaultRouteOptions: Object.assign({ fee, integrator: integrator !== null && integrator !== void 0 ? integrator : window.location.hostname, referrer,
11
+ const config = {
12
+ ...sdkConfig,
13
+ defaultRouteOptions: {
14
+ fee,
15
+ integrator: integrator ?? window.location.hostname,
16
+ referrer,
12
17
  routePriority,
13
- slippage }, sdkConfig === null || sdkConfig === void 0 ? void 0 : sdkConfig.defaultRouteOptions) });
18
+ slippage,
19
+ ...sdkConfig?.defaultRouteOptions,
20
+ },
21
+ };
14
22
  if (!lifi) {
15
- lifi = new LIFI(Object.assign({ disableVersionCheck: true }, config));
23
+ lifi = new LIFI({
24
+ disableVersionCheck: true,
25
+ ...config,
26
+ });
16
27
  }
17
28
  lifi.setConfig(config);
18
29
  return lifi;
19
30
  }, [fee, integrator, referrer, routePriority, sdkConfig, slippage]);
20
- return _jsx(SDKContext.Provider, Object.assign({ value: value }, { children: children }));
31
+ return _jsx(SDKContext.Provider, { value: value, children: children });
21
32
  };
@@ -17,14 +17,20 @@ export const formDefaultValues = {
17
17
  };
18
18
  export const SwapFormProvider = ({ children, }) => {
19
19
  const { fromChain, fromToken, fromAmount, toChain, toToken, toAddress, buildSwapUrl, } = useWidgetConfig();
20
- const defaultValues = useMemo(() => (Object.assign(Object.assign({}, formDefaultValues), { fromChain,
21
- fromToken, fromAmount: (typeof fromAmount === 'number'
22
- ? fromAmount === null || fromAmount === void 0 ? void 0 : fromAmount.toPrecision()
23
- : fromAmount) || formDefaultValues.fromAmount, toChain,
24
- toToken, toAddress: toAddress || formDefaultValues.toAddress })), [fromAmount, fromChain, fromToken, toAddress, toChain, toToken]);
20
+ const defaultValues = useMemo(() => ({
21
+ ...formDefaultValues,
22
+ fromChain,
23
+ fromToken,
24
+ fromAmount: (typeof fromAmount === 'number'
25
+ ? fromAmount?.toPrecision()
26
+ : fromAmount) || formDefaultValues.fromAmount,
27
+ toChain,
28
+ toToken,
29
+ toAddress: toAddress || formDefaultValues.toAddress,
30
+ }), [fromAmount, fromChain, fromToken, toAddress, toChain, toToken]);
25
31
  const methods = useForm({
26
32
  // values,
27
33
  defaultValues,
28
34
  });
29
- return (_jsxs(FormProvider, Object.assign({}, methods, { children: [_jsx(FormUpdater, { defaultValues: defaultValues }), buildSwapUrl ? _jsx(URLSearchParamsBuilder, {}) : null, children] })));
35
+ return (_jsxs(FormProvider, { ...methods, children: [_jsx(FormUpdater, { defaultValues: defaultValues }), buildSwapUrl ? _jsx(URLSearchParamsBuilder, {}) : null, children] }));
30
36
  };
@@ -1,14 +1,3 @@
1
- var __rest = (this && this.__rest) || function (s, e) {
2
- var t = {};
3
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
- t[p] = s[p];
5
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
- t[p[i]] = s[p[i]];
9
- }
10
- return t;
11
- };
12
1
  import { useEffect } from 'react';
13
2
  import { useFormState, useWatch } from 'react-hook-form';
14
3
  import { useLocation } from 'react-router-dom';
@@ -23,7 +12,9 @@ const formValueKeys = [
23
12
  ];
24
13
  export const URLSearchParamsBuilder = () => {
25
14
  const { pathname } = useLocation();
26
- const touchedFields = __rest(useFormState().touchedFields, []);
15
+ const {
16
+ // Have to use touchedFields, because default values are not considered dirty
17
+ touchedFields: { ...touchedFields }, } = useFormState();
27
18
  const values = useWatch({ name: formValueKeys });
28
19
  useEffect(() => {
29
20
  const url = new URL(window.location);
@@ -2,6 +2,6 @@ import { useWidgetConfig } from '..';
2
2
  import { useTelemetry } from '../../hooks';
3
3
  export const TelemetryProvider = ({ children }) => {
4
4
  const config = useWidgetConfig();
5
- useTelemetry(config === null || config === void 0 ? void 0 : config.disableTelemetry);
5
+ useTelemetry(config?.disableTelemetry);
6
6
  return children;
7
7
  };