@rango-dev/widget-embedded 0.12.1-next.9 → 0.14.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 (279) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/dist/Widget.d.ts.map +1 -1
  3. package/dist/components/AppRouter.d.ts +5 -2
  4. package/dist/components/AppRouter.d.ts.map +1 -1
  5. package/dist/components/AppRoutes.d.ts.map +1 -1
  6. package/dist/components/BlockchainList/BlockchainList.d.ts.map +1 -1
  7. package/dist/components/BlockchainList/BlockchainList.helpers.d.ts.map +1 -1
  8. package/dist/components/BlockchainList/BlockchainList.styles.d.ts +14 -4
  9. package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -1
  10. package/dist/components/BlockchainsSection/BlockchainsSection.d.ts.map +1 -1
  11. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +6 -1
  12. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
  13. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +1 -1
  14. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
  15. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +94 -17
  16. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
  17. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  18. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
  19. package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts +18 -3
  20. package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts.map +1 -1
  21. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +25 -284
  22. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
  23. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +1 -0
  24. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -1
  25. package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
  26. package/dist/components/HeaderButtons/UnreadNotificationsBadge.d.ts.map +1 -1
  27. package/dist/components/HeaderButtons/WalletButton.d.ts.map +1 -1
  28. package/dist/components/Layout/Layout.d.ts.map +1 -1
  29. package/dist/components/Layout/Layout.styles.d.ts +18 -3
  30. package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
  31. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +6 -1
  32. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -1
  33. package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts +4 -0
  34. package/dist/components/LoadingSwapDetails/LoadingSwapDetailStep.d.ts.map +1 -0
  35. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts +3 -0
  36. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.d.ts.map +1 -0
  37. package/dist/components/{SelectableCategoryList/SelectableCategoryList.styles.d.ts → LoadingSwapDetails/LoadingSwapDetails.styles.d.ts} +21 -6
  38. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -0
  39. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts +4 -0
  40. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.types.d.ts.map +1 -0
  41. package/dist/components/LoadingSwapDetails/index.d.ts +2 -0
  42. package/dist/components/LoadingSwapDetails/index.d.ts.map +1 -0
  43. package/dist/components/NoRoutes/NoRoutes.helper.d.ts.map +1 -1
  44. package/dist/components/NoRoutes/NoRoutes.styles.d.ts +18 -3
  45. package/dist/components/NoRoutes/NoRoutes.styles.d.ts.map +1 -1
  46. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  47. package/dist/components/NotificationContent/NotificationContent.styles.d.ts +24 -4
  48. package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
  49. package/dist/components/RouteErrors/RouteErrors.d.ts.map +1 -1
  50. package/dist/components/RouteErrors/RouteErrors.styles.d.ts +24 -4
  51. package/dist/components/RouteErrors/RouteErrors.styles.d.ts.map +1 -1
  52. package/dist/components/RouteErrors/RouteErrors.types.d.ts +3 -1
  53. package/dist/components/RouteErrors/RouteErrors.types.d.ts.map +1 -1
  54. package/dist/components/RouteErrors/RouteErrorsModal.d.ts.map +1 -1
  55. package/dist/components/SearchInput/SearchInput.styles.d.ts +6 -1
  56. package/dist/components/SearchInput/SearchInput.styles.d.ts.map +1 -1
  57. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +23 -151
  58. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -1
  59. package/dist/components/SettingsContainer/index.d.ts +1 -1
  60. package/dist/components/SettingsContainer/index.d.ts.map +1 -1
  61. package/dist/components/Slippage/Slippage.d.ts.map +1 -1
  62. package/dist/components/Slippage/Slippage.styles.d.ts +24 -4
  63. package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
  64. package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
  65. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  66. package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +2 -9
  67. package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
  68. package/dist/components/SwapDetails/SwapDetails.styles.d.ts +35 -153
  69. package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
  70. package/dist/components/SwapDetails/SwapDetails.types.d.ts +1 -1
  71. package/dist/components/SwapDetails/SwapDetails.types.d.ts.map +1 -1
  72. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +6 -1
  73. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -1
  74. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts +2 -1
  75. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts.map +1 -1
  76. package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts +1 -1
  77. package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
  78. package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts.map +1 -1
  79. package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +6 -1
  80. package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -1
  81. package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +2 -1
  82. package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -1
  83. package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
  84. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts +24 -4
  85. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
  86. package/dist/components/SwitchFromAndTo.d.ts.map +1 -1
  87. package/dist/components/TokenList/TokenList.d.ts.map +1 -1
  88. package/dist/components/TokenList/TokenList.helpers.d.ts.map +1 -1
  89. package/dist/components/TokenList/TokenList.styles.d.ts +207 -9
  90. package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
  91. package/dist/components/TokenList/TokenList.types.d.ts +1 -1
  92. package/dist/components/TokenList/TokenList.types.d.ts.map +1 -1
  93. package/dist/components/UpdateUrl.d.ts +6 -1
  94. package/dist/components/UpdateUrl.d.ts.map +1 -1
  95. package/dist/components/WalletModal/WalletModalContent.styles.d.ts +24 -4
  96. package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -1
  97. package/dist/components/WidgetEvents.d.ts.map +1 -1
  98. package/dist/constants/errors.d.ts +2 -2
  99. package/dist/constants/routing.d.ts +12 -2
  100. package/dist/constants/routing.d.ts.map +1 -1
  101. package/dist/constants.d.ts +2 -0
  102. package/dist/constants.d.ts.map +1 -0
  103. package/dist/globalStyles.d.ts +1 -1
  104. package/dist/globalStyles.d.ts.map +1 -1
  105. package/dist/hooks/useNavigateBack.d.ts.map +1 -1
  106. package/dist/hooks/usePrepareBlockchainList.d.ts +18 -0
  107. package/dist/hooks/usePrepareBlockchainList.d.ts.map +1 -0
  108. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  109. package/dist/hooks/useSyncStoresWithConfig.d.ts +3 -0
  110. package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -0
  111. package/dist/hooks/useTheme.d.ts +3 -6
  112. package/dist/hooks/useTheme.d.ts.map +1 -1
  113. package/dist/hooks/useWalletProviders.d.ts +3 -3
  114. package/dist/hooks/useWalletProviders.d.ts.map +1 -1
  115. package/dist/index.js +1 -1
  116. package/dist/index.js.map +4 -4
  117. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  118. package/dist/pages/Home.d.ts.map +1 -1
  119. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  120. package/dist/pages/SelectBlockchainPage.d.ts +1 -2
  121. package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
  122. package/dist/pages/SelectSwapItemsPage.d.ts +1 -5
  123. package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
  124. package/dist/pages/SettingsPage.d.ts.map +1 -1
  125. package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
  126. package/dist/pages/WalletsPage.d.ts.map +1 -1
  127. package/dist/services/httpService.d.ts +0 -1
  128. package/dist/services/httpService.d.ts.map +1 -1
  129. package/dist/store/app.d.ts +26 -0
  130. package/dist/store/app.d.ts.map +1 -0
  131. package/dist/store/bestRoute.d.ts +4 -8
  132. package/dist/store/bestRoute.d.ts.map +1 -1
  133. package/dist/store/meta.d.ts +0 -2
  134. package/dist/store/meta.d.ts.map +1 -1
  135. package/dist/store/slices/config.d.ts +8 -0
  136. package/dist/store/slices/config.d.ts.map +1 -0
  137. package/dist/store/slices/data.d.ts +26 -0
  138. package/dist/store/slices/data.d.ts.map +1 -0
  139. package/dist/store/wallets.d.ts.map +1 -1
  140. package/dist/types/config.d.ts +3 -0
  141. package/dist/types/config.d.ts.map +1 -1
  142. package/dist/utils/common.d.ts +1 -0
  143. package/dist/utils/common.d.ts.map +1 -1
  144. package/dist/utils/configs.d.ts +5 -0
  145. package/dist/utils/configs.d.ts.map +1 -1
  146. package/dist/utils/meta.d.ts +1 -0
  147. package/dist/utils/meta.d.ts.map +1 -1
  148. package/dist/utils/numbers.d.ts +3 -1
  149. package/dist/utils/numbers.d.ts.map +1 -1
  150. package/dist/utils/routing.d.ts +6 -3
  151. package/dist/utils/routing.d.ts.map +1 -1
  152. package/dist/utils/settings.d.ts +1 -0
  153. package/dist/utils/settings.d.ts.map +1 -1
  154. package/dist/utils/swap.d.ts +1 -1
  155. package/dist/utils/swap.d.ts.map +1 -1
  156. package/dist/utils/time.d.ts +2 -2
  157. package/dist/utils/time.d.ts.map +1 -1
  158. package/dist/utils/wallets.d.ts +1 -1
  159. package/dist/utils/wallets.d.ts.map +1 -1
  160. package/package.json +8 -8
  161. package/readme.md +3 -1
  162. package/src/Widget.tsx +22 -3
  163. package/src/components/AppRouter.tsx +38 -7
  164. package/src/components/AppRoutes.tsx +4 -28
  165. package/src/components/BlockchainList/BlockchainList.helpers.ts +1 -1
  166. package/src/components/BlockchainList/BlockchainList.styles.ts +6 -5
  167. package/src/components/BlockchainList/BlockchainList.tsx +6 -9
  168. package/src/components/BlockchainsSection/BlockchainsSection.tsx +29 -42
  169. package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +33 -7
  170. package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +48 -7
  171. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +59 -16
  172. package/src/components/ConfirmWalletsModal/WalletList.tsx +66 -22
  173. package/src/components/HeaderButtons/HeaderButtons.styles.ts +2 -2
  174. package/src/components/HeaderButtons/HeaderButtons.types.ts +1 -0
  175. package/src/components/HeaderButtons/HomeButtons.tsx +18 -5
  176. package/src/components/HeaderButtons/UnreadNotificationsBadge.tsx +1 -2
  177. package/src/components/HeaderButtons/WalletButton.tsx +4 -1
  178. package/src/components/Layout/Layout.styles.ts +5 -3
  179. package/src/components/Layout/Layout.tsx +5 -20
  180. package/src/components/LoadingSwapDetails/LoadingSwapDetailStep.tsx +41 -0
  181. package/src/components/LoadingSwapDetails/LoadingSwapDetails.styles.ts +78 -0
  182. package/src/components/LoadingSwapDetails/LoadingSwapDetails.tsx +53 -0
  183. package/src/components/LoadingSwapDetails/LoadingSwapDetails.types.ts +3 -0
  184. package/src/components/LoadingSwapDetails/index.ts +1 -0
  185. package/src/components/NoRoutes/NoRoutes.helper.ts +4 -2
  186. package/src/components/NotificationContent/NotificationContent.tsx +3 -7
  187. package/src/components/RouteErrors/RouteErrors.styles.ts +2 -1
  188. package/src/components/RouteErrors/RouteErrors.tsx +37 -26
  189. package/src/components/RouteErrors/RouteErrors.types.ts +3 -1
  190. package/src/components/RouteErrors/RouteErrorsModal.tsx +42 -14
  191. package/src/components/SettingsContainer/SettingsContainer.style.ts +2 -7
  192. package/src/components/SettingsContainer/index.ts +0 -1
  193. package/src/components/Slippage/Slippage.tsx +6 -2
  194. package/src/components/Slippage/SlippageTooltipContent.tsx +1 -1
  195. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +52 -16
  196. package/src/components/SwapDetails/SwapDetails.helpers.tsx +19 -33
  197. package/src/components/SwapDetails/SwapDetails.styles.ts +10 -14
  198. package/src/components/SwapDetails/SwapDetails.tsx +143 -101
  199. package/src/components/SwapDetails/SwapDetails.types.ts +1 -1
  200. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.types.ts +5 -4
  201. package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +6 -7
  202. package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +3 -0
  203. package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +2 -1
  204. package/src/components/SwapsGroup/SwapsGroup.tsx +3 -2
  205. package/src/components/SwitchFromAndTo.tsx +1 -35
  206. package/src/components/TokenList/TokenList.helpers.ts +6 -8
  207. package/src/components/TokenList/TokenList.styles.ts +7 -1
  208. package/src/components/TokenList/TokenList.tsx +29 -23
  209. package/src/components/TokenList/TokenList.types.ts +1 -1
  210. package/src/components/UpdateUrl.tsx +7 -1
  211. package/src/components/WidgetEvents.tsx +9 -3
  212. package/src/constants/errors.ts +2 -2
  213. package/src/constants/routing.ts +17 -2
  214. package/src/constants.ts +1 -0
  215. package/src/globalStyles.ts +1 -4
  216. package/src/hooks/useFetchBestRoute.ts +2 -2
  217. package/src/hooks/useNavigateBack.ts +10 -0
  218. package/src/hooks/usePrepareBlockchainList.ts +125 -0
  219. package/src/hooks/useSwapInput.ts +17 -3
  220. package/src/hooks/useSyncStoresWithConfig.ts +102 -0
  221. package/src/hooks/useTheme.ts +37 -75
  222. package/src/hooks/useWalletProviders.ts +7 -7
  223. package/src/pages/ConfirmSwapPage.tsx +65 -36
  224. package/src/pages/HistoryPage.tsx +2 -2
  225. package/src/pages/Home.tsx +114 -50
  226. package/src/pages/LanguagePage.tsx +1 -1
  227. package/src/pages/LiquiditySourcePage.tsx +22 -18
  228. package/src/pages/SelectBlockchainPage.tsx +19 -20
  229. package/src/pages/SelectSwapItemsPage.tsx +66 -88
  230. package/src/pages/SettingsPage.tsx +42 -15
  231. package/src/pages/SwapDetailsPage.tsx +9 -2
  232. package/src/pages/ThemePage.tsx +1 -1
  233. package/src/pages/WalletsPage.tsx +11 -5
  234. package/src/services/httpService.ts +4 -5
  235. package/src/store/app.ts +15 -0
  236. package/src/store/bestRoute.ts +45 -71
  237. package/src/store/meta.ts +11 -29
  238. package/src/store/slices/config.ts +26 -0
  239. package/src/store/slices/data.ts +203 -0
  240. package/src/store/wallets.ts +0 -27
  241. package/src/types/config.ts +3 -0
  242. package/src/utils/common.ts +3 -0
  243. package/src/utils/configs.ts +8 -2
  244. package/src/utils/meta.ts +7 -0
  245. package/src/utils/numbers.ts +3 -2
  246. package/src/utils/routing.ts +76 -14
  247. package/src/utils/settings.ts +15 -0
  248. package/src/utils/swap.ts +82 -26
  249. package/src/utils/time.ts +69 -36
  250. package/src/utils/wallets.ts +49 -29
  251. package/dist/components/BlockchainsChip/BlockchainsChip.d.ts +0 -5
  252. package/dist/components/BlockchainsChip/BlockchainsChip.d.ts.map +0 -1
  253. package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts +0 -151
  254. package/dist/components/BlockchainsChip/BlockchainsChip.styles.d.ts.map +0 -1
  255. package/dist/components/BlockchainsChip/BlockchainsChip.types.d.ts +0 -6
  256. package/dist/components/BlockchainsChip/BlockchainsChip.types.d.ts.map +0 -1
  257. package/dist/components/BlockchainsChip/index.d.ts +0 -2
  258. package/dist/components/BlockchainsChip/index.d.ts.map +0 -1
  259. package/dist/components/BlockchainsSection/BlockchainSection.helpers.d.ts +0 -3
  260. package/dist/components/BlockchainsSection/BlockchainSection.helpers.d.ts.map +0 -1
  261. package/dist/components/SelectableCategoryList/SelectableCategoryList.d.ts +0 -4
  262. package/dist/components/SelectableCategoryList/SelectableCategoryList.d.ts.map +0 -1
  263. package/dist/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts +0 -4
  264. package/dist/components/SelectableCategoryList/SelectableCategoryList.helpers.d.ts.map +0 -1
  265. package/dist/components/SelectableCategoryList/SelectableCategoryList.styles.d.ts.map +0 -1
  266. package/dist/components/SelectableCategoryList/SelectableCategoryList.types.d.ts +0 -12
  267. package/dist/components/SelectableCategoryList/SelectableCategoryList.types.d.ts.map +0 -1
  268. package/dist/components/SelectableCategoryList/index.d.ts +0 -2
  269. package/dist/components/SelectableCategoryList/index.d.ts.map +0 -1
  270. package/src/components/BlockchainsChip/BlockchainsChip.styles.ts +0 -30
  271. package/src/components/BlockchainsChip/BlockchainsChip.tsx +0 -15
  272. package/src/components/BlockchainsChip/BlockchainsChip.types.ts +0 -4
  273. package/src/components/BlockchainsChip/index.ts +0 -1
  274. package/src/components/BlockchainsSection/BlockchainSection.helpers.ts +0 -20
  275. package/src/components/SelectableCategoryList/SelectableCategoryList.helpers.ts +0 -20
  276. package/src/components/SelectableCategoryList/SelectableCategoryList.styles.ts +0 -21
  277. package/src/components/SelectableCategoryList/SelectableCategoryList.tsx +0 -79
  278. package/src/components/SelectableCategoryList/SelectableCategoryList.types.ts +0 -12
  279. package/src/components/SelectableCategoryList/index.ts +0 -1
@@ -1,6 +1,6 @@
1
1
  import type { PropTypes } from './RouteErrors.types';
2
2
 
3
- import { Alert, InfoIcon } from '@rango-dev/ui';
3
+ import { Alert, Divider, InfoIcon } from '@rango-dev/ui';
4
4
  import React from 'react';
5
5
 
6
6
  import { errorMessages } from '../../constants/errors';
@@ -23,37 +23,48 @@ export function RouteErrors(props: PropTypes) {
23
23
  totalFeeInUsd,
24
24
  outputUsdValue,
25
25
  inputUsdValue,
26
+ loading,
27
+ extraSpace,
26
28
  } = props;
27
29
  const error = hasLimitError(bestRoute);
28
30
  const { recommendation } = LimitErrorMessage(bestRoute);
29
31
 
32
+ const showWarnings = !error && (highValueLoss || priceImpactCanNotBeComputed);
33
+ const showAlerts = showWarnings || error;
34
+
30
35
  return (
31
36
  <>
32
- <Alerts>
33
- {!error && (highValueLoss || priceImpactCanNotBeComputed) && (
34
- <>
35
- <Alert
36
- title={
37
- highValueLoss
38
- ? errorMessages.highValueLossError.title
39
- : errorMessages.unknownPriceError.title
40
- }
41
- type={
42
- highValueLoss && !!percentageChange?.lt(WARNING_LEVEL_LIMIT)
43
- ? 'error'
44
- : 'warning'
45
- }
46
- variant="alarm"
47
- action={
48
- <Action onClick={() => onToggle(true)}>
49
- <InfoIcon size={12} color="gray" />
50
- </Action>
51
- }
52
- />
53
- </>
54
- )}
55
- {error && <Alert type="error" variant="alarm" title={recommendation} />}
56
- </Alerts>
37
+ {(loading || (extraSpace && !showAlerts)) && <Divider size={20} />}
38
+ {showAlerts && (
39
+ <Alerts>
40
+ {showWarnings && (
41
+ <>
42
+ <Alert
43
+ title={
44
+ highValueLoss
45
+ ? errorMessages.highValueLossError.title
46
+ : errorMessages.unknownPriceError.title
47
+ }
48
+ type={
49
+ highValueLoss && !!percentageChange?.lt(WARNING_LEVEL_LIMIT)
50
+ ? 'error'
51
+ : 'warning'
52
+ }
53
+ variant="alarm"
54
+ action={
55
+ <Action onClick={() => onToggle(true)}>
56
+ <InfoIcon size={12} color="gray" />
57
+ </Action>
58
+ }
59
+ />
60
+ </>
61
+ )}
62
+ {error && (
63
+ <Alert type="error" variant="alarm" title={recommendation} />
64
+ )}
65
+ </Alerts>
66
+ )}
67
+
57
68
  <RouteErrorsModal
58
69
  highValueLoss={highValueLoss}
59
70
  open={openModal}
@@ -9,11 +9,13 @@ export interface PropTypes {
9
9
  percentageChange: BigNumber | null;
10
10
  highValueLoss: boolean;
11
11
  priceImpactCanNotBeComputed: boolean;
12
+ loading: boolean;
13
+ extraSpace: boolean;
12
14
  }
13
15
 
14
16
  type ModalPropTypesKeys = keyof Omit<
15
17
  PropTypes,
16
- 'priceImpactCanNotBeComputed' | 'openModal'
18
+ 'priceImpactCanNotBeComputed' | 'openModal' | 'extraSpace' | 'loading'
17
19
  >;
18
20
 
19
21
  export type ModalPropTypes = Pick<PropTypes, ModalPropTypesKeys> & {
@@ -1,5 +1,6 @@
1
1
  import type { ModalPropTypes } from './RouteErrors.types';
2
2
 
3
+ import { i18n } from '@lingui/core';
3
4
  import {
4
5
  Button,
5
6
  Divider,
@@ -13,15 +14,20 @@ import { useNavigate } from 'react-router-dom';
13
14
 
14
15
  import { errorMessages } from '../../constants/errors';
15
16
  import { navigationRoutes } from '../../constants/navigationRoutes';
17
+ import {
18
+ GAS_FEE_MAX_DECIMALS,
19
+ GAS_FEE_MIN_DECIMALS,
20
+ HIGHT_PRICE_IMPACT,
21
+ PERCENTAGE_CHANGE_MAX_DECIMALS,
22
+ PERCENTAGE_CHANGE_MIN_DECIMALS,
23
+ USD_VALUE_MAX_DECIMALS,
24
+ USD_VALUE_MIN_DECIMALS,
25
+ } from '../../constants/routing';
16
26
  import { numberToString } from '../../utils/numbers';
17
27
 
18
28
  import { Flex } from './RouteErrors.styles';
19
29
  import { RouteErrorsModalItem } from './RouteErrorsModalItem';
20
30
 
21
- const WARNING_LEVEL_LIMIT = -10;
22
- const MAX_DECIMAL = 2;
23
- const MIN_DECIMAL = 0;
24
-
25
31
  export function RouteErrorsModal(props: ModalPropTypes) {
26
32
  const {
27
33
  highValueLoss,
@@ -34,19 +40,41 @@ export function RouteErrorsModal(props: ModalPropTypes) {
34
40
  } = props;
35
41
  const navigate = useNavigate();
36
42
  const type =
37
- highValueLoss && !!percentageChange?.lt(WARNING_LEVEL_LIMIT)
43
+ highValueLoss && !!percentageChange?.lt(HIGHT_PRICE_IMPACT)
38
44
  ? 'error'
39
45
  : 'warning';
40
46
  const highValueLossData = [
41
- { title: 'Swapping', value: numberToString(inputUsdValue) },
42
47
  {
43
- title: 'Gas cost',
44
- value: numberToString(totalFeeInUsd, MIN_DECIMAL, MAX_DECIMAL),
48
+ title: i18n.t('Swapping'),
49
+ value: numberToString(
50
+ inputUsdValue,
51
+ USD_VALUE_MIN_DECIMALS,
52
+ USD_VALUE_MAX_DECIMALS
53
+ ),
54
+ },
55
+ {
56
+ title: i18n.t('Gas cost'),
57
+ value: numberToString(
58
+ totalFeeInUsd,
59
+ GAS_FEE_MIN_DECIMALS,
60
+ GAS_FEE_MAX_DECIMALS
61
+ ),
62
+ },
63
+ {
64
+ title: i18n.t('Receiving'),
65
+ value: numberToString(
66
+ outputUsdValue,
67
+ USD_VALUE_MIN_DECIMALS,
68
+ USD_VALUE_MAX_DECIMALS
69
+ ),
45
70
  },
46
- { title: 'Receiving', value: numberToString(outputUsdValue) },
47
71
  {
48
- title: 'Price impact',
49
- value: numberToString(percentageChange, MIN_DECIMAL, MAX_DECIMAL),
72
+ title: i18n.t('Price impact'),
73
+ value: numberToString(
74
+ percentageChange,
75
+ PERCENTAGE_CHANGE_MIN_DECIMALS,
76
+ PERCENTAGE_CHANGE_MAX_DECIMALS
77
+ ),
50
78
  valueColor: `${type}500`,
51
79
  },
52
80
  ];
@@ -59,13 +87,13 @@ export function RouteErrorsModal(props: ModalPropTypes) {
59
87
  {highValueLoss ? (
60
88
  <MessageBox
61
89
  type={type}
62
- title={errorMessages.highValueLossError.impacTitle}
90
+ title={errorMessages.highValueLossError.impactTitle}
63
91
  description={errorMessages.highValueLossError.description}
64
92
  />
65
93
  ) : (
66
94
  <MessageBox
67
95
  type={type}
68
- title={errorMessages.unknownPriceError.impacTitle}
96
+ title={errorMessages.unknownPriceError.impactTitle}
69
97
  description={errorMessages.unknownPriceError.description}
70
98
  />
71
99
  )}
@@ -73,7 +101,7 @@ export function RouteErrorsModal(props: ModalPropTypes) {
73
101
  <Flex>
74
102
  <Divider size={20} />
75
103
  <Typography size="small" variant="title">
76
- Details
104
+ {i18n.t('Details')}
77
105
  </Typography>
78
106
  <Flex>
79
107
  {highValueLossData.map((item, index) => {
@@ -2,6 +2,7 @@ import { styled } from '@rango-dev/ui';
2
2
 
3
3
  export const SettingsContainer = styled('div', {
4
4
  height: '100%',
5
+ overflow: 'hidden',
5
6
  });
6
7
 
7
8
  export const LiquiditySourceList = styled('ul', {
@@ -9,15 +10,9 @@ export const LiquiditySourceList = styled('ul', {
9
10
  margin: 0,
10
11
  listStyle: 'none',
11
12
  height: '100%',
12
- overflowY: 'visible',
13
+ overflowY: 'auto',
13
14
  });
14
15
 
15
- export const LiquiditySourceDivider = styled('li', {
16
- margin: '0 auto',
17
- width: '100%',
18
- height: '1px',
19
- backgroundColor: '$neutral300',
20
- });
21
16
  export const LiquiditySourceSuffix = styled('div', {
22
17
  width: 80,
23
18
  display: 'flex',
@@ -1,6 +1,5 @@
1
1
  export {
2
2
  SettingsContainer,
3
- LiquiditySourceDivider,
4
3
  LiquiditySourceList,
5
4
  LiquiditySourceSuffix,
6
5
  NotFoundContainer,
@@ -15,6 +15,7 @@ import {
15
15
  SLIPPAGES,
16
16
  } from '../../constants/swapSettings';
17
17
  import { useSettingsStore } from '../../store/settings';
18
+ import { getContainer } from '../../utils/common';
18
19
 
19
20
  import { BaseContainer, Head, SlippageChipsContainer } from './Slippage.styles';
20
21
  import { SlippageTooltipContent } from './SlippageTooltipContent';
@@ -32,7 +33,10 @@ export function Slippage() {
32
33
  {i18n.t('Slippage tolerance per swap')}
33
34
  </Typography>
34
35
  <Divider direction="horizontal" size={4} />
35
- <Tooltip side="top" content={<SlippageTooltipContent />}>
36
+ <Tooltip
37
+ container={getContainer()}
38
+ side="top"
39
+ content={<SlippageTooltipContent />}>
36
40
  <InfoIcon color="gray" />
37
41
  </Tooltip>
38
42
  </Head>
@@ -82,7 +86,7 @@ export function Slippage() {
82
86
  </Typography>
83
87
  )
84
88
  }
85
- placeholder="Custom"
89
+ placeholder={i18n.t('Custom')}
86
90
  />
87
91
  </SlippageChipsContainer>
88
92
  </BaseContainer>
@@ -7,7 +7,7 @@ import { SlippageTooltipContainer } from './Slippage.styles';
7
7
  export function SlippageTooltipContent() {
8
8
  return (
9
9
  <SlippageTooltipContainer>
10
- <Typography variant="label" size="small" color="neutral900">
10
+ <Typography variant="label" size="medium" color="neutral900">
11
11
  {i18n.t(
12
12
  'Your transaction will be reverted if the price changes unfavorably by more than this percentage'
13
13
  )}
@@ -1,43 +1,79 @@
1
1
  import type { SwapDetailsPlaceholderPropTypes } from './SwapDetails.types';
2
2
 
3
3
  import { i18n } from '@lingui/core';
4
- import { NotFound, Spinner } from '@rango-dev/ui';
4
+ import {
5
+ CopyIcon,
6
+ IconButton,
7
+ NotFound,
8
+ Skeleton,
9
+ Typography,
10
+ } from '@rango-dev/ui';
5
11
  import React from 'react';
6
12
 
7
13
  import { navigationRoutes } from '../../constants/navigationRoutes';
8
14
  import { useNavigateBack } from '../../hooks/useNavigateBack';
9
15
  import { SuffixContainer } from '../HeaderButtons/HeaderButtons.styles';
10
16
  import { Layout } from '../Layout';
17
+ import { LoadingSwapDetails } from '../LoadingSwapDetails';
11
18
 
12
- import { LoaderContainer, PlaceholderContainer } from './SwapDetails.styles';
19
+ import {
20
+ Container,
21
+ HeaderDetails,
22
+ PlaceholderContainer,
23
+ } from './SwapDetails.styles';
13
24
 
14
25
  export function SwapDetailsPlaceholder(props: SwapDetailsPlaceholderPropTypes) {
15
- const { requestId, loading } = props;
26
+ const { requestId, showSkeleton } = props;
16
27
  const { navigateBackFrom } = useNavigateBack();
17
28
 
18
29
  return (
19
30
  <Layout
31
+ noPadding
20
32
  header={{
21
33
  title: i18n.t('Swap and Bridge'),
22
34
  onBack: navigateBackFrom.bind(null, navigationRoutes.swapDetails),
23
35
  suffix: <SuffixContainer />,
24
36
  }}>
25
- <PlaceholderContainer>
26
- {loading ? (
27
- <LoaderContainer>
28
- <Spinner size={24} />
29
- </LoaderContainer>
30
- ) : (
37
+ {showSkeleton && (
38
+ <Container>
39
+ <HeaderDetails>
40
+ <div className="row">
41
+ <Typography variant="label" size="large" color="neutral900">
42
+ {`${i18n.t('Request ID')}:`}
43
+ </Typography>
44
+ <div className="request-id">
45
+ <Typography variant="label" size="small" color="neutral900">
46
+ <Skeleton width={60} height={10} variant="rounded" />
47
+ </Typography>
48
+ <IconButton variant="ghost">
49
+ <CopyIcon size={16} color="gray" />
50
+ </IconButton>
51
+ </div>
52
+ </div>
53
+ <div className="row">
54
+ <Typography variant="label" size="large" color="neutral900">
55
+ {`${i18n.t('Created at')}:`}
56
+ </Typography>
57
+ <Typography variant="label" size="small" color="neutral900">
58
+ <Skeleton width={60} height={10} variant="rounded" />
59
+ </Typography>
60
+ </div>
61
+ </HeaderDetails>
62
+ <LoadingSwapDetails />
63
+ </Container>
64
+ )}
65
+ {!showSkeleton && (
66
+ <PlaceholderContainer>
31
67
  <NotFound
32
68
  title={i18n.t('Not found')}
33
- description={i18n.t(
34
- 'swapNotFound',
35
- { requestId },
36
- { message: 'Swap with request ID = ${requestId} not found.' }
37
- )}
69
+ description={i18n.t({
70
+ id: 'swapNotFound',
71
+ values: { requestId },
72
+ message: 'Swap with request ID = {requestId} not found.',
73
+ })}
38
74
  />
39
- )}
40
- </PlaceholderContainer>
75
+ </PlaceholderContainer>
76
+ )}
41
77
  </Layout>
42
78
  );
43
79
  }
@@ -1,61 +1,58 @@
1
1
  import type { GetStep } from '../SwapDetailsAlerts';
2
2
  import type { PendingSwapStep } from '@rango-dev/queue-manager-rango-preset';
3
- import type {
4
- PriceImpactWarningLevel,
5
- Step,
6
- StepDetailsProps,
7
- } from '@rango-dev/ui';
8
- import type BigNumber from 'bignumber.js';
3
+ import type { Step, StepDetailsProps } from '@rango-dev/ui';
9
4
 
10
5
  import React from 'react';
11
6
 
7
+ import {
8
+ TOKEN_AMOUNT_MAX_DECIMALS,
9
+ TOKEN_AMOUNT_MIN_DECIMALS,
10
+ } from '../../constants/routing';
11
+ import { getBlockchainShortNameFor } from '../../utils/meta';
12
12
  import { numberToString } from '../../utils/numbers';
13
13
  import { isNetworkStatusInWarningState } from '../../utils/swap';
14
14
  import { SwapDetailsAlerts } from '../SwapDetailsAlerts';
15
15
 
16
- export const LOW_PRICE_IMPACT = 3;
17
- export const HIGHT_PRICE_IMPACT = 10;
18
16
  export const RESET_INTERVAL = 2_000;
19
- export const MIN_DECIMALS = 0;
20
- export const AMOUNT_DECIMALS = 4;
21
- export const PERCENT_DECIMALS = 2;
22
17
  export const SECONDS = 60;
23
18
 
24
- export const getSteps = ({ swap, ...args }: GetStep): Step[] => {
19
+ export const getSteps = ({ swap, blockchains, ...args }: GetStep): Step[] => {
25
20
  const hasAlreadyProceededToSign = swap.hasAlreadyProceededToSign !== false;
26
21
  return swap.steps.map((step, index) => {
27
22
  const amountToConvert =
28
23
  index === 0 ? swap.inputAmount : swap.steps[index - 1].outputAmount;
29
24
  return {
30
25
  from: {
31
- token: { displayName: step.fromSymbol, image: step.fromLogo },
26
+ token: { displayName: step.fromSymbol, image: step.fromLogo ?? '' },
32
27
  chain: {
33
- displayName: step.fromBlockchain,
34
- image: step.fromBlockchainLogo,
28
+ displayName:
29
+ getBlockchainShortNameFor(step.fromBlockchain, blockchains) ?? '',
30
+ image: step.fromBlockchainLogo ?? '',
35
31
  },
36
32
  price: {
37
33
  value: numberToString(
38
34
  amountToConvert,
39
- AMOUNT_DECIMALS,
40
- AMOUNT_DECIMALS
35
+ TOKEN_AMOUNT_MIN_DECIMALS,
36
+ TOKEN_AMOUNT_MAX_DECIMALS
41
37
  ),
42
38
  },
43
39
  },
44
40
  to: {
45
41
  token: { displayName: step.toSymbol, image: step.toLogo },
46
42
  chain: {
47
- displayName: step.toBlockchain,
48
- image: step.toBlockchainLogo,
43
+ displayName:
44
+ getBlockchainShortNameFor(step.toBlockchain, blockchains) ?? '',
45
+ image: step.toBlockchainLogo ?? '',
49
46
  },
50
47
  price: {
51
48
  value: numberToString(
52
49
  step.outputAmount || step.expectedOutputAmountHumanReadable,
53
- AMOUNT_DECIMALS,
54
- AMOUNT_DECIMALS
50
+ TOKEN_AMOUNT_MIN_DECIMALS,
51
+ TOKEN_AMOUNT_MAX_DECIMALS
55
52
  ),
56
53
  },
57
54
  },
58
- swapper: { displayName: step.swapperId, image: step.swapperLogo },
55
+ swapper: { displayName: step.swapperId, image: step.swapperLogo ?? '' },
59
56
  alerts: (
60
57
  <SwapDetailsAlerts
61
58
  step={step}
@@ -67,17 +64,6 @@ export const getSteps = ({ swap, ...args }: GetStep): Step[] => {
67
64
  });
68
65
  };
69
66
 
70
- export const getPriceImpactWarningLevel = (
71
- priceImpact: BigNumber | null
72
- ): PriceImpactWarningLevel | undefined => {
73
- if (!priceImpact) {
74
- return undefined;
75
- } else if (priceImpact.lt(LOW_PRICE_IMPACT)) {
76
- return 'low';
77
- }
78
- return 'high';
79
- };
80
-
81
67
  export function getStepState(step: PendingSwapStep): StepDetailsProps['state'] {
82
68
  if (
83
69
  isNetworkStatusInWarningState(step) &&
@@ -1,10 +1,9 @@
1
- import { styled } from '@rango-dev/ui';
1
+ import { darkTheme, styled } from '@rango-dev/ui';
2
2
 
3
3
  export const Container = styled('div', {
4
4
  display: 'flex',
5
5
  width: '100%',
6
6
  flexDirection: 'column',
7
- justifyContent: 'center',
8
7
  alignItems: 'center',
9
8
  height: '0',
10
9
  flexGrow: 1,
@@ -13,8 +12,13 @@ export const Container = styled('div', {
13
12
  width: '100%',
14
13
  justifyContent: 'space-between',
15
14
  alignItems: 'center',
16
- padding: '$10 $5',
17
- borderBottom: '1px solid $neutral300',
15
+ padding: '$10 $20',
16
+ borderBottom: '1px solid',
17
+ $$color: '$colors$neutral300',
18
+ [`.${darkTheme} &`]: {
19
+ $$color: '$colors$neutral400',
20
+ },
21
+ borderColor: '$$color',
18
22
  color: '$neutral500',
19
23
  },
20
24
  '& .request-id': {
@@ -37,20 +41,12 @@ export const Container = styled('div', {
37
41
  },
38
42
  });
39
43
 
40
- export const Separator = styled('div', {
41
- height: '$12',
42
- marginRight: '$10',
43
- borderLeft: '1px solid $neutral900',
44
- marginLeft: '$14',
45
- });
46
-
47
44
  export const HeaderDetails = styled('div', {
48
45
  width: '100%',
49
- padding: '0px 15px',
50
46
  });
51
47
 
52
48
  export const StepsList = styled('div', {
53
- padding: '0 $20 $20',
49
+ padding: '$0 $20 $20 $20',
54
50
  width: '100%',
55
51
  overflow: 'auto',
56
52
  });
@@ -64,7 +60,7 @@ export const PlaceholderContainer = styled('div', {
64
60
  height: '450px',
65
61
  display: 'flex',
66
62
  alignItems: 'center',
67
- textAlign: 'center',
63
+ justifyContent: 'center',
68
64
  });
69
65
 
70
66
  export const LoaderContainer = styled('div', {