@rango-dev/widget-embedded 0.17.1-next.3 → 0.17.1-next.30

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 (312) hide show
  1. package/dist/QueueManager.d.ts +5 -2
  2. package/dist/QueueManager.d.ts.map +1 -1
  3. package/dist/components/AppRouter.d.ts +0 -2
  4. package/dist/components/AppRouter.d.ts.map +1 -1
  5. package/dist/components/AppRoutes.d.ts +1 -6
  6. package/dist/components/AppRoutes.d.ts.map +1 -1
  7. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +56 -56
  8. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  9. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts +0 -2
  10. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.types.d.ts.map +1 -1
  11. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
  12. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts +1 -4
  13. package/dist/components/ConfirmWalletsModal/WalletList.type.d.ts.map +1 -1
  14. package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
  15. package/dist/components/Layout/Layout.d.ts.map +1 -1
  16. package/dist/components/Layout/Layout.types.d.ts +2 -2
  17. package/dist/components/Layout/Layout.types.d.ts.map +1 -1
  18. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  19. package/dist/components/Quote/Quote.d.ts.map +1 -1
  20. package/dist/components/Quote/Quote.styles.d.ts +159 -0
  21. package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
  22. package/dist/components/Quote/Quote.types.d.ts +0 -1
  23. package/dist/components/Quote/Quote.types.d.ts.map +1 -1
  24. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.d.ts.map +1 -1
  25. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.d.ts.map +1 -1
  26. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
  27. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +1 -0
  28. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +1 -1
  29. package/dist/components/Slippage/Slippage.d.ts.map +1 -1
  30. package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
  31. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  32. package/dist/components/SwapDetails/SwapDetails.helpers.d.ts +1 -1
  33. package/dist/components/SwapDetails/SwapDetails.helpers.d.ts.map +1 -1
  34. package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
  35. package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts +1 -1
  36. package/dist/components/SwapDetailsModal/SwapDetailsModal.helpers.d.ts.map +1 -1
  37. package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts +1 -1
  38. package/dist/components/SwapDetailsModal/SwapDetailsModal.types.d.ts.map +1 -1
  39. package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
  40. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
  41. package/dist/components/TokenList/TokenList.d.ts.map +1 -1
  42. package/dist/components/TokenList/TokenList.helpers.d.ts +2 -2
  43. package/dist/components/TokenList/TokenList.helpers.d.ts.map +1 -1
  44. package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
  45. package/dist/components/TokenList/TokenList.types.d.ts +3 -9
  46. package/dist/components/TokenList/TokenList.types.d.ts.map +1 -1
  47. package/dist/components/TokenList/index.d.ts +0 -1
  48. package/dist/components/TokenList/index.d.ts.map +1 -1
  49. package/dist/components/UpdateUrl.d.ts +1 -6
  50. package/dist/components/UpdateUrl.d.ts.map +1 -1
  51. package/dist/components/WidgetEvents.d.ts.map +1 -1
  52. package/dist/constants/errors.d.ts.map +1 -1
  53. package/dist/constants/index.d.ts +1 -0
  54. package/dist/constants/index.d.ts.map +1 -1
  55. package/dist/constants/navigationRoutes.d.ts +1 -2
  56. package/dist/constants/navigationRoutes.d.ts.map +1 -1
  57. package/dist/constants/searchParams.d.ts +2 -1
  58. package/dist/constants/searchParams.d.ts.map +1 -1
  59. package/dist/containers/App/App.d.ts +3 -0
  60. package/dist/containers/App/App.d.ts.map +1 -0
  61. package/dist/containers/App/App.styles.d.ts +158 -0
  62. package/dist/containers/App/App.styles.d.ts.map +1 -0
  63. package/dist/containers/App/index.d.ts +2 -0
  64. package/dist/containers/App/index.d.ts.map +1 -0
  65. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
  66. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +316 -0
  67. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
  68. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +3 -0
  69. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
  70. package/dist/containers/Wallets/Wallets.d.ts +6 -0
  71. package/dist/containers/Wallets/Wallets.d.ts.map +1 -0
  72. package/dist/containers/Wallets/Wallets.types.d.ts +11 -0
  73. package/dist/containers/Wallets/Wallets.types.d.ts.map +1 -0
  74. package/dist/containers/Wallets/index.d.ts +2 -0
  75. package/dist/containers/Wallets/index.d.ts.map +1 -0
  76. package/dist/containers/Widget/Widget.d.ts +5 -0
  77. package/dist/containers/Widget/Widget.d.ts.map +1 -0
  78. package/dist/containers/Widget/Widget.types.d.ts +5 -0
  79. package/dist/containers/Widget/Widget.types.d.ts.map +1 -0
  80. package/dist/containers/Widget/index.d.ts +3 -0
  81. package/dist/containers/Widget/index.d.ts.map +1 -0
  82. package/dist/containers/WidgetInfo/WidgetInfo.d.ts +6 -0
  83. package/dist/containers/WidgetInfo/WidgetInfo.d.ts.map +1 -0
  84. package/dist/containers/WidgetInfo/WidgetInfo.helpers.d.ts +20 -0
  85. package/dist/containers/WidgetInfo/WidgetInfo.helpers.d.ts.map +1 -0
  86. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts +21 -0
  87. package/dist/containers/WidgetInfo/WidgetInfo.types.d.ts.map +1 -0
  88. package/dist/containers/WidgetInfo/index.d.ts +2 -0
  89. package/dist/containers/WidgetInfo/index.d.ts.map +1 -0
  90. package/dist/containers/WidgetProvider/WidgetProvider.d.ts +5 -0
  91. package/dist/containers/WidgetProvider/WidgetProvider.d.ts.map +1 -0
  92. package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts +7 -0
  93. package/dist/containers/WidgetProvider/WidgetProvider.types.d.ts.map +1 -0
  94. package/dist/containers/WidgetProvider/index.d.ts +2 -0
  95. package/dist/containers/WidgetProvider/index.d.ts.map +1 -0
  96. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -1
  97. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +6 -3
  98. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -1
  99. package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts +1 -1
  100. package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +1 -1
  101. package/dist/hooks/useForceAutoConnect.d.ts +2 -0
  102. package/dist/hooks/useForceAutoConnect.d.ts.map +1 -0
  103. package/dist/hooks/useLanguage.d.ts +1 -1
  104. package/dist/hooks/useLanguage.d.ts.map +1 -1
  105. package/dist/hooks/useNavigateBack.d.ts +1 -3
  106. package/dist/hooks/useNavigateBack.d.ts.map +1 -1
  107. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.d.ts +1 -1
  108. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.d.ts +2 -2
  109. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.d.ts.map +1 -1
  110. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts +3 -5
  111. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.d.ts.map +1 -1
  112. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts +1 -0
  113. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.d.ts.map +1 -1
  114. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts +5 -1
  115. package/dist/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.d.ts.map +1 -1
  116. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  117. package/dist/hooks/useSyncStoresWithConfig.d.ts +1 -2
  118. package/dist/hooks/useSyncStoresWithConfig.d.ts.map +1 -1
  119. package/dist/hooks/useTheme.d.ts +1 -1
  120. package/dist/hooks/useTheme.d.ts.map +1 -1
  121. package/dist/hooks/useWalletList.d.ts.map +1 -1
  122. package/dist/index.d.ts +20 -8
  123. package/dist/index.d.ts.map +1 -1
  124. package/dist/index.js +1 -1
  125. package/dist/index.js.map +4 -4
  126. package/dist/pages/ConfirmSwapPage.d.ts +1 -6
  127. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  128. package/dist/pages/HistoryPage.d.ts.map +1 -1
  129. package/dist/pages/Home.d.ts.map +1 -1
  130. package/dist/pages/LanguagePage.d.ts.map +1 -1
  131. package/dist/pages/LiquiditySourcePage.d.ts +1 -2
  132. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  133. package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
  134. package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
  135. package/dist/pages/SettingsPage.d.ts +1 -6
  136. package/dist/pages/SettingsPage.d.ts.map +1 -1
  137. package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
  138. package/dist/pages/ThemePage.d.ts.map +1 -1
  139. package/dist/pages/WalletsPage.d.ts +1 -8
  140. package/dist/pages/WalletsPage.d.ts.map +1 -1
  141. package/dist/store/AppStore.d.ts +47 -0
  142. package/dist/store/AppStore.d.ts.map +1 -0
  143. package/dist/store/app.d.ts +41 -22
  144. package/dist/store/app.d.ts.map +1 -1
  145. package/dist/store/notification.d.ts +4 -3
  146. package/dist/store/notification.d.ts.map +1 -1
  147. package/dist/store/quote.d.ts +23 -16
  148. package/dist/store/quote.d.ts.map +1 -1
  149. package/dist/store/slices/config.d.ts +3 -2
  150. package/dist/store/slices/config.d.ts.map +1 -1
  151. package/dist/store/slices/data.d.ts +3 -0
  152. package/dist/store/slices/data.d.ts.map +1 -1
  153. package/dist/store/slices/settings.d.ts +39 -0
  154. package/dist/store/slices/settings.d.ts.map +1 -0
  155. package/dist/store/ui.d.ts +2 -1
  156. package/dist/store/ui.d.ts.map +1 -1
  157. package/dist/store/wallets.d.ts +14 -9
  158. package/dist/store/wallets.d.ts.map +1 -1
  159. package/dist/types/config.d.ts +38 -5
  160. package/dist/types/config.d.ts.map +1 -1
  161. package/dist/types/swap.d.ts +4 -14
  162. package/dist/types/swap.d.ts.map +1 -1
  163. package/dist/types/wallets.d.ts +15 -1
  164. package/dist/types/wallets.d.ts.map +1 -1
  165. package/dist/utils/colors.d.ts.map +1 -1
  166. package/dist/utils/configs.d.ts +1 -0
  167. package/dist/utils/configs.d.ts.map +1 -1
  168. package/dist/utils/meta.d.ts +2 -1
  169. package/dist/utils/meta.d.ts.map +1 -1
  170. package/dist/utils/providers.d.ts +2 -2
  171. package/dist/utils/providers.d.ts.map +1 -1
  172. package/dist/utils/queue.d.ts +2 -2
  173. package/dist/utils/queue.d.ts.map +1 -1
  174. package/dist/utils/quote.d.ts +1 -1
  175. package/dist/utils/quote.d.ts.map +1 -1
  176. package/dist/utils/settings.d.ts +6 -2
  177. package/dist/utils/settings.d.ts.map +1 -1
  178. package/dist/utils/swap.d.ts +16 -7
  179. package/dist/utils/swap.d.ts.map +1 -1
  180. package/dist/utils/time.d.ts +1 -1
  181. package/dist/utils/time.d.ts.map +1 -1
  182. package/dist/utils/wallets.d.ts +7 -9
  183. package/dist/utils/wallets.d.ts.map +1 -1
  184. package/package.json +12 -10
  185. package/src/QueueManager.tsx +18 -17
  186. package/src/components/AppRouter.tsx +8 -32
  187. package/src/components/AppRoutes.tsx +57 -69
  188. package/src/components/BlockchainList/BlockchainList.tsx +4 -4
  189. package/src/components/BlockchainsSection/BlockchainsSection.tsx +4 -4
  190. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +16 -19
  191. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.types.ts +0 -2
  192. package/src/components/ConfirmWalletsModal/WalletList.tsx +6 -5
  193. package/src/components/ConfirmWalletsModal/WalletList.type.ts +1 -4
  194. package/src/components/HeaderButtons/HomeButtons.tsx +28 -18
  195. package/src/components/Layout/Layout.tsx +20 -7
  196. package/src/components/Layout/Layout.types.ts +2 -2
  197. package/src/components/NoResult/NoResult.helpers.ts +12 -12
  198. package/src/components/NoResult/NoResult.tsx +6 -6
  199. package/src/components/NotificationContent/NotificationContent.tsx +5 -3
  200. package/src/components/Quote/Quote.styles.ts +28 -1
  201. package/src/components/Quote/Quote.tsx +100 -34
  202. package/src/components/Quote/Quote.types.ts +0 -1
  203. package/src/components/Quote/QuoteSkeleton.tsx +1 -1
  204. package/src/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx +1 -1
  205. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +11 -4
  206. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts +8 -1
  207. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.tsx +13 -13
  208. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +1 -0
  209. package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +3 -3
  210. package/src/components/Slippage/Slippage.tsx +3 -5
  211. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +0 -4
  212. package/src/components/SwapDetails/SwapDetails.helpers.tsx +1 -1
  213. package/src/components/SwapDetails/SwapDetails.tsx +19 -39
  214. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.Warning.tsx +1 -1
  215. package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +4 -3
  216. package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +2 -2
  217. package/src/components/SwapDetailsModal/SwapDetailsModal.helpers.tsx +1 -1
  218. package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +1 -1
  219. package/src/components/SwapDetailsModal/SwapDetailsModal.types.ts +1 -1
  220. package/src/components/SwapsGroup/SwapsGroup.styles.ts +8 -1
  221. package/src/components/SwapsGroup/SwapsGroup.tsx +0 -2
  222. package/src/components/TokenList/TokenList.helpers.ts +2 -2
  223. package/src/components/TokenList/TokenList.styles.ts +14 -2
  224. package/src/components/TokenList/TokenList.tsx +16 -19
  225. package/src/components/TokenList/TokenList.types.ts +3 -10
  226. package/src/components/TokenList/index.ts +0 -1
  227. package/src/components/UpdateUrl.tsx +23 -18
  228. package/src/components/WidgetEvents.tsx +4 -2
  229. package/src/constants/errors.ts +9 -5
  230. package/src/constants/index.ts +1 -0
  231. package/src/constants/navigationRoutes.ts +7 -8
  232. package/src/constants/searchParams.ts +1 -0
  233. package/src/containers/App/App.styles.ts +18 -0
  234. package/src/containers/App/App.tsx +52 -0
  235. package/src/containers/App/index.ts +1 -0
  236. package/src/containers/QuoteInfo/QuoteInfo.styles.ts +17 -1
  237. package/src/containers/QuoteInfo/QuoteInfo.tsx +44 -43
  238. package/src/containers/QuoteInfo/QuoteInfo.types.ts +3 -0
  239. package/src/{Wallets.tsx → containers/Wallets/Wallets.tsx} +48 -34
  240. package/src/containers/Wallets/Wallets.types.ts +12 -0
  241. package/src/containers/Wallets/index.ts +1 -0
  242. package/src/containers/Widget/Widget.tsx +19 -0
  243. package/src/containers/Widget/Widget.types.ts +5 -0
  244. package/src/containers/Widget/index.ts +2 -0
  245. package/src/containers/WidgetInfo/WidgetInfo.helpers.ts +64 -0
  246. package/src/containers/WidgetInfo/WidgetInfo.tsx +62 -0
  247. package/src/containers/WidgetInfo/WidgetInfo.types.ts +21 -0
  248. package/src/containers/WidgetInfo/index.ts +1 -0
  249. package/src/containers/WidgetProvider/WidgetProvider.tsx +28 -0
  250. package/src/containers/WidgetProvider/WidgetProvider.types.ts +7 -0
  251. package/src/containers/WidgetProvider/index.ts +1 -0
  252. package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +15 -11
  253. package/src/hooks/useConfirmSwap/useConfirmSwap.ts +25 -24
  254. package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +1 -1
  255. package/src/hooks/useForceAutoConnect.ts +27 -0
  256. package/src/hooks/useLanguage.ts +4 -5
  257. package/src/hooks/useNavigateBack.ts +3 -52
  258. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.constants.ts +1 -1
  259. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.helpers.ts +37 -7
  260. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.mock.ts +60 -0
  261. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.test.ts +78 -3
  262. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.ts +15 -6
  263. package/src/hooks/usePrepareBlockchainList/usePrepareBlockchainList.types.ts +6 -1
  264. package/src/hooks/useSwapInput.ts +89 -30
  265. package/src/hooks/useSyncStoresWithConfig.ts +38 -22
  266. package/src/hooks/useTheme.ts +4 -5
  267. package/src/hooks/useWalletList.ts +3 -5
  268. package/src/index.ts +53 -5
  269. package/src/pages/ConfirmSwapPage.tsx +39 -24
  270. package/src/pages/HistoryPage.tsx +2 -7
  271. package/src/pages/Home.tsx +58 -88
  272. package/src/pages/LanguagePage.tsx +0 -5
  273. package/src/pages/LiquiditySourcePage.tsx +24 -37
  274. package/src/pages/SelectBlockchainPage.tsx +28 -21
  275. package/src/pages/SelectSwapItemsPage.tsx +10 -27
  276. package/src/pages/SettingsPage.tsx +28 -24
  277. package/src/pages/SwapDetailsPage.tsx +6 -7
  278. package/src/pages/ThemePage.tsx +2 -7
  279. package/src/pages/WalletsPage.tsx +4 -15
  280. package/src/services/httpService.ts +1 -1
  281. package/src/store/AppStore.tsx +41 -0
  282. package/src/store/app.ts +44 -6
  283. package/src/store/quote.ts +29 -26
  284. package/src/store/slices/config.ts +25 -15
  285. package/src/store/slices/data.ts +64 -29
  286. package/src/store/slices/settings.ts +168 -0
  287. package/src/store/wallets.ts +68 -37
  288. package/src/types/config.ts +50 -5
  289. package/src/types/swap.ts +4 -13
  290. package/src/types/wallets.ts +18 -1
  291. package/src/utils/colors.ts +2 -1
  292. package/src/utils/configs.ts +2 -1
  293. package/src/utils/date.ts +1 -1
  294. package/src/utils/meta.ts +8 -1
  295. package/src/utils/providers.ts +8 -5
  296. package/src/utils/queue.ts +2 -2
  297. package/src/utils/quote.ts +7 -7
  298. package/src/utils/settings.ts +17 -10
  299. package/src/utils/swap.ts +59 -55
  300. package/src/utils/time.ts +1 -1
  301. package/src/utils/wallets.ts +107 -149
  302. package/dist/Wallets.d.ts +0 -17
  303. package/dist/Wallets.d.ts.map +0 -1
  304. package/dist/Widget.d.ts +0 -9
  305. package/dist/Widget.d.ts.map +0 -1
  306. package/dist/store/meta.d.ts +0 -23
  307. package/dist/store/meta.d.ts.map +0 -1
  308. package/dist/store/settings.d.ts +0 -81
  309. package/dist/store/settings.d.ts.map +0 -1
  310. package/src/Widget.tsx +0 -119
  311. package/src/store/meta.ts +0 -39
  312. package/src/store/settings.ts +0 -158
@@ -1,5 +1,3 @@
1
- import type { WidgetConfig } from '../types';
2
-
3
1
  import React from 'react';
4
2
  import { useRoutes } from 'react-router-dom';
5
3
 
@@ -16,15 +14,7 @@ import { SwapDetailsPage } from '../pages/SwapDetailsPage';
16
14
  import { ThemePage } from '../pages/ThemePage';
17
15
  import { WalletsPage } from '../pages/WalletsPage';
18
16
 
19
- const getAbsolutePath = (path: string) => path.replace('/', '');
20
-
21
- interface PropTypes {
22
- config?: WidgetConfig;
23
- }
24
-
25
- export function AppRoutes(props: PropTypes) {
26
- const { config } = props;
27
-
17
+ export function AppRoutes() {
28
18
  return useRoutes([
29
19
  {
30
20
  path: navigationRoutes.home,
@@ -32,77 +22,75 @@ export function AppRoutes(props: PropTypes) {
32
22
  },
33
23
  {
34
24
  path: navigationRoutes.fromSwap,
35
- element: <SelectSwapItemsPage type="source" />,
25
+ children: [
26
+ {
27
+ index: true,
28
+ element: <SelectSwapItemsPage type="source" />,
29
+ },
30
+ {
31
+ path: navigationRoutes.blockchains,
32
+ element: <SelectBlockchainPage type="source" />,
33
+ },
34
+ ],
36
35
  },
37
36
  {
38
37
  path: navigationRoutes.toSwap,
39
- element: <SelectSwapItemsPage type="destination" />,
40
- },
41
- {
42
- path: navigationRoutes.fromBlockchain,
43
- element: <SelectBlockchainPage type="source" />,
44
- },
45
- {
46
- path: navigationRoutes.toBlockchain,
47
- element: <SelectBlockchainPage type="destination" />,
38
+ children: [
39
+ {
40
+ index: true,
41
+ element: <SelectSwapItemsPage type="destination" />,
42
+ },
43
+ {
44
+ path: navigationRoutes.blockchains,
45
+ element: <SelectBlockchainPage type="destination" />,
46
+ },
47
+ ],
48
48
  },
49
49
  {
50
50
  path: navigationRoutes.settings,
51
- element: (
52
- <SettingsPage
53
- singleTheme={config?.theme?.singleTheme}
54
- supportedSwappers={config?.liquiditySources}
55
- />
56
- ),
57
- },
58
- {
59
- path: navigationRoutes.themes,
60
- element: <ThemePage />,
61
- },
62
- {
63
- path: navigationRoutes.languages,
64
- element: <LanguagePage />,
65
- },
66
- {
67
- path: navigationRoutes.exchanges,
68
- element: (
69
- <LiquiditySourcePage
70
- sourceType="Exchanges"
71
- supportedSwappers={config?.liquiditySources}
72
- />
73
- ),
74
- },
75
- {
76
- path: navigationRoutes.bridges,
77
- element: (
78
- <LiquiditySourcePage
79
- sourceType="Bridges"
80
- supportedSwappers={config?.liquiditySources}
81
- />
82
- ),
51
+ children: [
52
+ {
53
+ index: true,
54
+ element: <SettingsPage />,
55
+ },
56
+ {
57
+ path: navigationRoutes.themes,
58
+ element: <ThemePage />,
59
+ },
60
+ {
61
+ path: navigationRoutes.languages,
62
+ element: <LanguagePage />,
63
+ },
64
+ {
65
+ path: navigationRoutes.exchanges,
66
+ element: <LiquiditySourcePage sourceType="Exchanges" />,
67
+ },
68
+ {
69
+ path: navigationRoutes.bridges,
70
+ element: <LiquiditySourcePage sourceType="Bridges" />,
71
+ },
72
+ ],
83
73
  },
84
- { path: navigationRoutes.swaps, element: <HistoryPage /> },
85
74
  {
86
- path: navigationRoutes.swapDetails,
87
- element: <SwapDetailsPage />,
75
+ path: navigationRoutes.swaps,
76
+ children: [
77
+ {
78
+ index: true,
79
+ element: <HistoryPage />,
80
+ },
81
+ {
82
+ path: navigationRoutes.swapDetails,
83
+ element: <SwapDetailsPage />,
84
+ },
85
+ ],
88
86
  },
89
87
  {
90
88
  path: navigationRoutes.wallets,
91
- element: (
92
- <WalletsPage
93
- supportedWallets={config?.wallets}
94
- multiWallets={
95
- typeof config?.multiWallets === 'undefined'
96
- ? true
97
- : config.multiWallets
98
- }
99
- config={config}
100
- />
101
- ),
89
+ element: <WalletsPage />,
102
90
  },
103
91
  {
104
- path: getAbsolutePath(navigationRoutes.confirmSwap),
105
- element: <ConfirmSwapPage config={config} />,
92
+ path: navigationRoutes.confirmSwap,
93
+ element: <ConfirmSwapPage />,
106
94
  },
107
95
  ]);
108
96
  }
@@ -11,7 +11,7 @@ import {
11
11
  } from '@rango-dev/ui';
12
12
  import React, { useEffect, useState } from 'react';
13
13
 
14
- import { useMetaStore } from '../../store/meta';
14
+ import { useAppStore } from '../../store/AppStore';
15
15
 
16
16
  import { filterBlockchains } from './BlockchainList.helpers';
17
17
  import { Container, List } from './BlockchainList.styles';
@@ -20,7 +20,7 @@ import { LoadingBlockchainList } from './LoadingBlockchainList';
20
20
  export function BlockchainList(props: PropTypes) {
21
21
  const { list, searchedFor, onChange, blockchainCategory } = props;
22
22
  const [blockchains, setBlockchains] = useState<BlockchainMeta[]>(list);
23
- const loadingStatus = useMetaStore.use.loadingStatus();
23
+ const { fetchStatus } = useAppStore();
24
24
 
25
25
  useEffect(() => {
26
26
  setBlockchains([
@@ -66,8 +66,8 @@ export function BlockchainList(props: PropTypes) {
66
66
  {i18n.t('Select Blockchain')}
67
67
  </Typography>
68
68
  <Divider size={4} />
69
- {loadingStatus === 'loading' && <LoadingBlockchainList />}
70
- {loadingStatus === 'success' && renderList()}
69
+ {fetchStatus === 'loading' && <LoadingBlockchainList />}
70
+ {fetchStatus === 'success' && renderList()}
71
71
  </Container>
72
72
  );
73
73
  }
@@ -13,7 +13,7 @@ import React from 'react';
13
13
 
14
14
  import { BLOCKCHAIN_LIST_SIZE } from '../../constants/configs';
15
15
  import { usePrepareBlockchainList } from '../../hooks/usePrepareBlockchainList';
16
- import { useMetaStore } from '../../store/meta';
16
+ import { useAppStore } from '../../store/AppStore';
17
17
  import { useQuoteStore } from '../../store/quote';
18
18
 
19
19
  import { Container } from './BlockchainsSection.styles';
@@ -27,7 +27,7 @@ export function BlockchainsSection(props: PropTypes) {
27
27
  selected: blockchain?.name,
28
28
  });
29
29
 
30
- const loadingStatus = useMetaStore.use.loadingStatus();
30
+ const { fetchStatus } = useAppStore();
31
31
  const resetToBlockchain = useQuoteStore.use.resetToBlockchain();
32
32
  const resetFromBlockchain = useQuoteStore.use.resetFromBlockchain();
33
33
  const hasMoreItemsInList = blockchainsList.more.length > 0;
@@ -45,11 +45,11 @@ export function BlockchainsSection(props: PropTypes) {
45
45
  </Typography>
46
46
  <Divider size={12} />
47
47
  <Container>
48
- {loadingStatus === 'loading' &&
48
+ {fetchStatus === 'loading' &&
49
49
  Array.from(Array(NUMBER_OF_LOADING), (e) => (
50
50
  <Skeleton key={e} variant="rounded" height={50} />
51
51
  ))}
52
- {loadingStatus === 'success' && (
52
+ {fetchStatus === 'success' && (
53
53
  <>
54
54
  <BlockchainsChip
55
55
  selected={!blockchain}
@@ -19,11 +19,11 @@ import React, { useEffect, useLayoutEffect, useRef, useState } from 'react';
19
19
  import { useNavigate } from 'react-router-dom';
20
20
 
21
21
  import { getQuoteErrorMessage } from '../../constants/errors';
22
- import { navigationRoutes } from '../../constants/navigationRoutes';
23
22
  import { getQuoteUpdateWarningMessage } from '../../constants/warnings';
24
- import { useMetaStore } from '../../store/meta';
23
+ import { useAppStore } from '../../store/AppStore';
25
24
  import { useQuoteStore } from '../../store/quote';
26
25
  import { useWalletsStore } from '../../store/wallets';
26
+ import { getBlockchainShortNameFor } from '../../utils/meta';
27
27
  import { confirmSwapDisabled } from '../../utils/swap';
28
28
 
29
29
  import { getRequiredWallets, isValidAddress } from './ConfirmWallets.helpers';
@@ -50,8 +50,9 @@ const NUMBER_OF_WALLETS_TO_DISPLAY = 2;
50
50
 
51
51
  export function ConfirmWalletsModal(props: PropTypes) {
52
52
  //TODO: move component's logics to a custom hook
53
- const { open, onClose, onCancel, onCheckBalance, config, loading } = props;
54
- const { blockchains } = useMetaStore.use.meta();
53
+ const { open, onClose, onCancel, onCheckBalance, loading } = props;
54
+ const config = useAppStore().config;
55
+ const blockchains = useAppStore().blockchains();
55
56
  const {
56
57
  quote,
57
58
  setSelectedWallets: selectQuoteWallets,
@@ -75,10 +76,6 @@ export function ConfirmWalletsModal(props: PropTypes) {
75
76
  const customDestinationRef = useRef<HTMLDivElement | null>(null);
76
77
 
77
78
  const requiredWallets = getRequiredWallets(quote);
78
- const customDestinationEnabled =
79
- typeof config?.customDestination === 'undefined'
80
- ? true
81
- : config.customDestination;
82
79
 
83
80
  const lastStepToBlockchain = blockchains.find(
84
81
  (blockchain) =>
@@ -247,7 +244,8 @@ export function ConfirmWalletsModal(props: PropTypes) {
247
244
  open={open}
248
245
  onClose={() => {
249
246
  if (!quoteWalletsConfirmed) {
250
- navigate(navigationRoutes.home, { replace: true });
247
+ const home = '../';
248
+ navigate(home, { replace: true });
251
249
  }
252
250
  onClose();
253
251
  }}
@@ -288,7 +286,12 @@ export function ConfirmWalletsModal(props: PropTypes) {
288
286
  <Typography variant="headline" size="small">
289
287
  {i18n.t({
290
288
  id: 'Your {blockchainName} wallets',
291
- values: { blockchainName: showMoreWalletFor },
289
+ values: {
290
+ blockchainName: getBlockchainShortNameFor(
291
+ showMoreWalletFor,
292
+ blockchains
293
+ ),
294
+ },
292
295
  })}
293
296
  </Typography>
294
297
  </ShowMoreHeader>
@@ -320,9 +323,6 @@ export function ConfirmWalletsModal(props: PropTypes) {
320
323
  chain={showMoreWalletFor}
321
324
  isSelected={isSelected}
322
325
  selectWallet={onChange}
323
- multiWallets={config?.multiWallets ?? true}
324
- supportedWallets={config?.wallets ?? []}
325
- config={config}
326
326
  onShowMore={setShowMoreWalletFor.bind(null, showMoreWalletFor)}
327
327
  />
328
328
  </div>
@@ -361,7 +361,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
361
361
  <Typography variant="title" size="xmedium">
362
362
  {i18n.t({
363
363
  id: 'Your {blockchainName} wallets',
364
- values: { blockchainName: blockchain?.displayName },
364
+ values: { blockchainName: blockchain?.shortName },
365
365
  })}
366
366
  </Typography>
367
367
  <Typography
@@ -370,7 +370,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
370
370
  size="medium">
371
371
  {i18n.t({
372
372
  id: 'You need to connect a {blockchainName} wallet.',
373
- values: { blockchainName: blockchain?.displayName },
373
+ values: { blockchainName: blockchain?.shortName },
374
374
  })}
375
375
  </Typography>
376
376
  </Title>
@@ -380,9 +380,6 @@ export function ConfirmWalletsModal(props: PropTypes) {
380
380
  chain={requiredWallet}
381
381
  isSelected={isSelected}
382
382
  selectWallet={onChange}
383
- multiWallets={config?.multiWallets ?? true}
384
- supportedWallets={config?.wallets ?? []}
385
- config={config}
386
383
  limit={NUMBER_OF_WALLETS_TO_DISPLAY}
387
384
  onShowMore={() =>
388
385
  setShowMoreWalletFor(blockchain?.name ?? '')
@@ -390,7 +387,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
390
387
  />
391
388
  </ListContainer>
392
389
  {!isLastWallet && <Divider size={32} />}
393
- {isLastWallet && customDestinationEnabled && (
390
+ {isLastWallet && config?.customDestination && (
394
391
  <CustomDestination>
395
392
  <CollapsibleRoot
396
393
  ref={customDestinationRef}
@@ -1,4 +1,3 @@
1
- import type { WidgetConfig } from '../..';
2
1
  import type { ConfirmSwap } from '../../hooks/useConfirmSwap/useConfirmSwap.types';
3
2
 
4
3
  export type PropTypes = {
@@ -6,6 +5,5 @@ export type PropTypes = {
6
5
  onClose: () => void;
7
6
  onCancel: () => void;
8
7
  onCheckBalance: ConfirmSwap['fetch'];
9
- config?: WidgetConfig;
10
8
  loading: boolean;
11
9
  };
@@ -23,7 +23,7 @@ import {
23
23
  TIME_TO_CLOSE_MODAL,
24
24
  TIME_TO_IGNORE_MODAL,
25
25
  } from '../../pages/WalletsPage';
26
- import { useMetaStore } from '../../store/meta';
26
+ import { useAppStore } from '../../store/AppStore';
27
27
  import { useWalletsStore } from '../../store/wallets';
28
28
  import { getBlockchainDisplayNameFor } from '../../utils/meta';
29
29
  import {
@@ -41,10 +41,11 @@ import {
41
41
  } from './WalletList.styles';
42
42
 
43
43
  export function WalletList(props: PropTypes) {
44
- const { config, chain, isSelected, selectWallet, limit, onShowMore } = props;
44
+ const { chain, isSelected, selectWallet, limit, onShowMore } = props;
45
+ const { config } = useAppStore();
45
46
 
46
47
  const connectedWallets = useWalletsStore.use.connectedWallets();
47
- const { blockchains } = useMetaStore.use.meta();
48
+ const { blockchains } = useAppStore();
48
49
  const [openWalletStateModal, setOpenWalletStateModal] =
49
50
  useState<WalletType>('');
50
51
  const [experimentalChainWallet, setExperimentalChainWallet] =
@@ -137,7 +138,7 @@ export function WalletList(props: PropTypes) {
137
138
  });
138
139
  const conciseAddress = address ? getConciseAddress(address) : '';
139
140
 
140
- const experimentalChain = isExperimentalChain(blockchains, chain);
141
+ const experimentalChain = isExperimentalChain(blockchains(), chain);
141
142
 
142
143
  const experimentalChainNotAdded = !connectedWallets.find(
143
144
  (connectedWallet) =>
@@ -180,7 +181,7 @@ export function WalletList(props: PropTypes) {
180
181
  experimentalChainWallet?.chain
181
182
  ? getBlockchainDisplayNameFor(
182
183
  experimentalChainWallet.chain,
183
- blockchains
184
+ blockchains()
184
185
  )
185
186
  : undefined;
186
187
  return (
@@ -1,12 +1,9 @@
1
- import type { Wallet, WidgetConfig } from '../../types';
1
+ import type { Wallet } from '../../types';
2
2
 
3
3
  export type PropTypes = {
4
4
  chain: string;
5
- supportedWallets: WidgetConfig['wallets'];
6
5
  isSelected: (walletType: string, chain: string) => boolean;
7
6
  selectWallet: (wallet: Wallet) => void;
8
- multiWallets: boolean;
9
- config?: WidgetConfig;
10
7
  limit?: number;
11
8
  onShowMore: () => void;
12
9
  };
@@ -11,7 +11,9 @@ import {
11
11
  } from '@rango-dev/ui';
12
12
  import React from 'react';
13
13
 
14
+ import { useAppStore } from '../../store/AppStore';
14
15
  import { getContainer } from '../../utils/common';
16
+ import { isFeatureHidden } from '../../utils/settings';
15
17
  import { NotificationContent } from '../NotificationContent';
16
18
 
17
19
  import { HeaderButton } from './HeaderButtons.styles';
@@ -26,6 +28,12 @@ export function HomeButtons(props: HomeButtonsPropTypes) {
26
28
  onClickNotifications,
27
29
  } = props;
28
30
 
31
+ const {
32
+ config: { features },
33
+ } = useAppStore();
34
+
35
+ const isNotificationsHidden = isFeatureHidden('notification', features);
36
+
29
37
  return (
30
38
  <>
31
39
  <Tooltip
@@ -41,25 +49,27 @@ export function HomeButtons(props: HomeButtonsPropTypes) {
41
49
  </HeaderButton>
42
50
  </Tooltip>
43
51
 
44
- <Tooltip
45
- container={getContainer()}
46
- side="top"
47
- content={i18n.t('Notifications')}>
48
- <Popover
49
- align="center"
50
- collisionBoundary={layoutRef}
51
- collisionPadding={{ right: 20, left: 20 }}
52
+ {!isNotificationsHidden && (
53
+ <Tooltip
52
54
  container={getContainer()}
53
- content={<NotificationContent />}>
54
- <HeaderButton
55
- size="small"
56
- variant="ghost"
57
- onClick={onClickNotifications}>
58
- <NotificationsIcon size={18} color="black" />
59
- <UnreadNotificationsBadge />
60
- </HeaderButton>
61
- </Popover>
62
- </Tooltip>
55
+ side="top"
56
+ content={i18n.t('Notifications')}>
57
+ <Popover
58
+ align="center"
59
+ collisionBoundary={layoutRef}
60
+ collisionPadding={{ right: 20, left: 20 }}
61
+ container={getContainer()}
62
+ content={<NotificationContent />}>
63
+ <HeaderButton
64
+ size="small"
65
+ variant="ghost"
66
+ onClick={onClickNotifications}>
67
+ <NotificationsIcon size={18} color="black" />
68
+ <UnreadNotificationsBadge />
69
+ </HeaderButton>
70
+ </Popover>
71
+ </Tooltip>
72
+ )}
63
73
  <Tooltip
64
74
  container={getContainer()}
65
75
  side="top"
@@ -3,12 +3,13 @@ import type { PropsWithChildren } from 'react';
3
3
 
4
4
  import { BottomLogo, Divider, Header } from '@rango-dev/ui';
5
5
  import React from 'react';
6
- import { useNavigate } from 'react-router-dom';
7
6
 
8
- import { navigationRoutes } from '../../constants/navigationRoutes';
7
+ import { useNavigateBack } from '../../hooks/useNavigateBack';
8
+ import { useAppStore } from '../../store/AppStore';
9
9
  import { useUiStore } from '../../store/ui';
10
10
  import { useWalletsStore } from '../../store/wallets';
11
11
  import { getContainer } from '../../utils/common';
12
+ import { isFeatureHidden } from '../../utils/settings';
12
13
  import { BackButton, CancelButton, WalletButton } from '../HeaderButtons';
13
14
 
14
15
  import { Container, Content, Footer } from './Layout.styles';
@@ -23,25 +24,37 @@ function LayoutComponent(props: PropsWithChildren<PropTypes>, ref: Ref) {
23
24
  fixedHeight = true,
24
25
  } = props;
25
26
  const connectedWallets = useWalletsStore.use.connectedWallets();
27
+ const {
28
+ config: { features },
29
+ } = useAppStore();
30
+
31
+ const isConnectWalletHidden = isFeatureHidden(
32
+ 'connectWalletButton',
33
+ features
34
+ );
26
35
 
27
36
  const connectWalletsButtonDisabled =
28
37
  useUiStore.use.connectWalletsButtonDisabled();
29
- const navigate = useNavigate();
38
+ const navigateBack = useNavigateBack();
30
39
 
31
40
  const onConnectWallet = () => {
32
- if (!connectWalletsButtonDisabled) {
33
- navigate('/' + navigationRoutes.wallets);
41
+ if (!connectWalletsButtonDisabled && header.onWallet) {
42
+ header.onWallet();
34
43
  }
35
44
  };
45
+
46
+ const showBackButton =
47
+ typeof header.hasBackButton === 'undefined' || header.hasBackButton;
48
+
36
49
  return (
37
50
  <Container ref={ref} fixedHeight={fixedHeight} id="swap-box">
38
51
  <Header
39
- prefix={<>{header.onBack && <BackButton onClick={header.onBack} />}</>}
52
+ prefix={<>{showBackButton && <BackButton onClick={navigateBack} />}</>}
40
53
  title={header.title}
41
54
  suffix={
42
55
  <>
43
56
  {header.suffix}
44
- {header.hasConnectWallet && (
57
+ {header.onWallet && !isConnectWalletHidden && (
45
58
  <WalletButton
46
59
  container={getContainer()}
47
60
  onClick={onConnectWallet}
@@ -1,10 +1,10 @@
1
1
  export interface PropTypes {
2
2
  header: {
3
3
  title: string;
4
- hasConnectWallet?: boolean;
4
+ onWallet?: () => void;
5
5
  hasSettings?: boolean;
6
6
  suffix?: React.ReactNode;
7
- onBack?: () => void;
7
+ hasBackButton?: boolean;
8
8
  onCancel?: () => void;
9
9
  };
10
10
  hasLogo?: boolean;
@@ -27,18 +27,6 @@ export function makeInfo(
27
27
  },
28
28
  description: '',
29
29
  };
30
- } else if (
31
- error?.type === QuoteErrorType.NO_RESULT &&
32
- error.diagnosisMessage
33
- ) {
34
- return {
35
- alert: {
36
- type: 'error',
37
- text: error.diagnosisMessage,
38
- action: null,
39
- },
40
- description: '',
41
- };
42
30
  } else if (disabledLiquiditySources.length) {
43
31
  return {
44
32
  alert: {
@@ -51,6 +39,18 @@ export function makeInfo(
51
39
  },
52
40
  description: errorMessages().liquiditySourcesError.description,
53
41
  };
42
+ } else if (
43
+ error?.type === QuoteErrorType.NO_RESULT &&
44
+ error.diagnosisMessage
45
+ ) {
46
+ return {
47
+ alert: {
48
+ type: 'error',
49
+ text: error.diagnosisMessage,
50
+ action: null,
51
+ },
52
+ description: '',
53
+ };
54
54
  }
55
55
  return {
56
56
  alert: null,
@@ -11,22 +11,22 @@ import {
11
11
  import React from 'react';
12
12
 
13
13
  import { errorMessages } from '../../constants/errors';
14
- import { useSettingsStore } from '../../store/settings';
14
+ import { useAppStore } from '../../store/AppStore';
15
15
 
16
16
  import { makeInfo } from './NoResult.helpers';
17
17
  import { Container, Footer, PrefixIcon } from './NoResult.styles';
18
18
 
19
19
  export function NoResult(props: PropTypes) {
20
20
  const { fetch, error } = props;
21
- const disabledLiquiditySources =
22
- useSettingsStore.use.disabledLiquiditySources();
23
- const toggleAllLiquiditySources =
24
- useSettingsStore.use.toggleAllLiquiditySources();
21
+ const disabledLiquiditySources = useAppStore().disabledLiquiditySources;
22
+ const toggleAllLiquiditySources = useAppStore().toggleAllLiquiditySources;
23
+
24
+ const swappers = useAppStore().swappers();
25
25
 
26
26
  const info = makeInfo(
27
27
  error,
28
28
  disabledLiquiditySources,
29
- toggleAllLiquiditySources,
29
+ () => toggleAllLiquiditySources(swappers, true),
30
30
  fetch
31
31
  );
32
32
 
@@ -10,7 +10,8 @@ import {
10
10
  import React from 'react';
11
11
  import { useNavigate } from 'react-router-dom';
12
12
 
13
- import { useMetaStore } from '../../store/meta';
13
+ import { navigationRoutes } from '../../constants/navigationRoutes';
14
+ import { useAppStore } from '../../store/AppStore';
14
15
  import { useNotificationStore } from '../../store/notification';
15
16
  import { useUiStore } from '../../store/ui';
16
17
 
@@ -26,14 +27,15 @@ export function NotificationContent() {
26
27
  const { getUnreadNotifications } = useNotificationStore();
27
28
 
28
29
  const notifications: Notification[] = getUnreadNotifications();
29
- const { tokens, blockchains } = useMetaStore.use.meta();
30
+ const blockchains = useAppStore().blockchains();
31
+ const tokens = useAppStore().tokens();
30
32
  const sortedNotification = notifications
31
33
  .sort((a, b) => b.creationTime - a.creationTime)
32
34
  .slice(0, MAX_NOTIFICATIONS_DISPLAYED);
33
35
 
34
36
  const handleOnClick = (requestId: Notification['requestId']) => {
35
37
  setSelectedSwap(requestId);
36
- navigate(`/swaps/${requestId}`);
38
+ navigate(`${navigationRoutes.swaps}/${requestId}`);
37
39
  };
38
40
 
39
41
  return (