@rango-dev/widget-embedded 0.22.4-next.1 → 0.22.4-next.11

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 (203) hide show
  1. package/dist/QueueManager.d.ts.map +1 -1
  2. package/dist/components/AppRoutes.d.ts.map +1 -1
  3. package/dist/components/BlockchainList/BlockchainList.styles.d.ts +3 -0
  4. package/dist/components/BlockchainList/BlockchainList.styles.d.ts.map +1 -1
  5. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts +1 -0
  6. package/dist/components/BlockchainsSection/BlockchainsSection.styles.d.ts.map +1 -1
  7. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts +2 -2
  8. package/dist/components/ConfirmWalletsModal/ConfirmWallets.helpers.d.ts.map +1 -1
  9. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +15 -0
  10. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
  11. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  12. package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
  13. package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts +3 -0
  14. package/dist/components/ConfirmWalletsModal/WalletList.styles.d.ts.map +1 -1
  15. package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts +4 -0
  16. package/dist/components/CustomCollapsible/CustomCollapsible.styles.d.ts.map +1 -1
  17. package/dist/components/HeaderButtons/HeaderButtons.d.ts +4 -0
  18. package/dist/components/HeaderButtons/HeaderButtons.d.ts.map +1 -0
  19. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +5 -0
  20. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
  21. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts +3 -2
  22. package/dist/components/HeaderButtons/HeaderButtons.types.d.ts.map +1 -1
  23. package/dist/components/HeaderButtons/index.d.ts +1 -1
  24. package/dist/components/HeaderButtons/index.d.ts.map +1 -1
  25. package/dist/components/HistoryGroupedList/HistoryGroupedList.styles.d.ts +6 -0
  26. package/dist/components/HistoryGroupedList/HistoryGroupedList.styles.d.ts.map +1 -1
  27. package/dist/components/Layout/Layout.d.ts.map +1 -1
  28. package/dist/components/Layout/Layout.styles.d.ts +3 -0
  29. package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
  30. package/dist/components/Layout/Layout.types.d.ts +1 -0
  31. package/dist/components/Layout/Layout.types.d.ts.map +1 -1
  32. package/dist/components/Layout/PageContainer.d.ts +1 -0
  33. package/dist/components/Layout/PageContainer.d.ts.map +1 -1
  34. package/dist/components/Layout/ScrollableArea.d.ts +1 -0
  35. package/dist/components/Layout/ScrollableArea.d.ts.map +1 -1
  36. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +1 -0
  37. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -1
  38. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts +14 -0
  39. package/dist/components/LoadingSwapDetails/LoadingSwapDetails.styles.d.ts.map +1 -1
  40. package/dist/components/NoResult/NoResult.styles.d.ts +3 -0
  41. package/dist/components/NoResult/NoResult.styles.d.ts.map +1 -1
  42. package/dist/components/NotificationContent/NotificationContent.styles.d.ts +4 -0
  43. package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
  44. package/dist/components/Quote/Quote.d.ts.map +1 -1
  45. package/dist/components/Quote/Quote.styles.d.ts +1136 -25
  46. package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
  47. package/dist/components/Quote/Quote.types.d.ts +12 -7
  48. package/dist/components/Quote/Quote.types.d.ts.map +1 -1
  49. package/dist/components/Quote/QuoteCostDetails.d.ts.map +1 -1
  50. package/dist/components/Quote/QuoteCostDetails.styles.d.ts +5 -0
  51. package/dist/components/Quote/QuoteCostDetails.styles.d.ts.map +1 -1
  52. package/dist/components/Quote/QuoteSummary.styles.d.ts +2 -0
  53. package/dist/components/Quote/QuoteSummary.styles.d.ts.map +1 -1
  54. package/dist/components/Quote/QuoteTrigger .d.ts.map +1 -1
  55. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts +4 -0
  56. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -1
  57. package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts +1 -1
  58. package/dist/components/QuoteSkeleton/QuoteSkeleton.types.d.ts.map +1 -1
  59. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts.map +1 -1
  60. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts +20 -10
  61. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.styles.d.ts.map +1 -1
  62. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts +1 -1
  63. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.types.d.ts.map +1 -1
  64. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +5 -0
  65. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +1 -1
  66. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts +4 -0
  67. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
  68. package/dist/components/SearchInput/SearchInput.styles.d.ts +1 -0
  69. package/dist/components/SearchInput/SearchInput.styles.d.ts.map +1 -1
  70. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts +3 -0
  71. package/dist/components/SettingsContainer/SettingsContainer.style.d.ts.map +1 -1
  72. package/dist/components/Slippage/Slippage.styles.d.ts +5 -0
  73. package/dist/components/Slippage/Slippage.styles.d.ts.map +1 -1
  74. package/dist/components/SwapDetails/SwapDetails.styles.d.ts +13 -0
  75. package/dist/components/SwapDetails/SwapDetails.styles.d.ts.map +1 -1
  76. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts +1 -0
  77. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.styles.d.ts.map +1 -1
  78. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts +2 -1
  79. package/dist/components/SwapDetailsAlerts/SwapDetailsAlerts.types.d.ts.map +1 -1
  80. package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
  81. package/dist/components/SwapDetailsModal/SwapDetailsModal.Cancel.d.ts.map +1 -1
  82. package/dist/components/SwapDetailsModal/SwapDetailsModal.Delete.d.ts.map +1 -1
  83. package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts +1 -0
  84. package/dist/components/SwapDetailsModal/SwapDetailsModal.styles.d.ts.map +1 -1
  85. package/dist/components/SwapDetailsModal/index.d.ts +1 -1
  86. package/dist/components/SwapDetailsModal/index.d.ts.map +1 -1
  87. package/dist/components/TokenList/TokenList.styles.d.ts +17 -0
  88. package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
  89. package/dist/components/WalletModal/WalletModalContent.styles.d.ts +4 -0
  90. package/dist/components/WalletModal/WalletModalContent.styles.d.ts.map +1 -1
  91. package/dist/constants/languages.d.ts.map +1 -1
  92. package/dist/constants/navigationRoutes.d.ts +1 -0
  93. package/dist/constants/navigationRoutes.d.ts.map +1 -1
  94. package/dist/constants/quote.d.ts +5 -1
  95. package/dist/constants/quote.d.ts.map +1 -1
  96. package/dist/containers/App/App.styles.d.ts +1 -0
  97. package/dist/containers/App/App.styles.d.ts.map +1 -1
  98. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
  99. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts +3 -0
  100. package/dist/containers/QuoteInfo/QuoteInfo.styles.d.ts.map +1 -1
  101. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +6 -3
  102. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
  103. package/dist/containers/Wallets/Wallets.d.ts.map +1 -1
  104. package/dist/hooks/useConfirmSwap/useConfirmSwap.d.ts.map +1 -1
  105. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts +5 -4
  106. package/dist/hooks/useConfirmSwap/useConfirmSwap.helpers.d.ts.map +1 -1
  107. package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts +1 -1
  108. package/dist/hooks/useConfirmSwap/useConfirmSwap.types.d.ts.map +1 -1
  109. package/dist/hooks/useFetch.d.ts +12 -0
  110. package/dist/hooks/useFetch.d.ts.map +1 -0
  111. package/dist/hooks/useFetchAllQuotes.d.ts +4 -0
  112. package/dist/hooks/useFetchAllQuotes.d.ts.map +1 -0
  113. package/dist/hooks/useFetchConfirmQuote.d.ts +4 -0
  114. package/dist/hooks/useFetchConfirmQuote.d.ts.map +1 -0
  115. package/dist/hooks/useSwapInput.d.ts +5 -5
  116. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  117. package/dist/hooks/useWalletList.d.ts +1 -0
  118. package/dist/hooks/useWalletList.d.ts.map +1 -1
  119. package/dist/index.js +2 -2
  120. package/dist/index.js.map +4 -4
  121. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  122. package/dist/pages/Home.d.ts.map +1 -1
  123. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  124. package/dist/pages/Routes.d.ts +3 -0
  125. package/dist/pages/Routes.d.ts.map +1 -0
  126. package/dist/pages/SettingsPage.d.ts.map +1 -1
  127. package/dist/pages/WalletsPage.d.ts.map +1 -1
  128. package/dist/store/AppStore.d.ts +2 -2
  129. package/dist/store/app.d.ts +2 -2
  130. package/dist/store/quote.d.ts +32 -10
  131. package/dist/store/quote.d.ts.map +1 -1
  132. package/dist/store/wallets.d.ts +0 -2
  133. package/dist/store/wallets.d.ts.map +1 -1
  134. package/dist/types/quote.d.ts +19 -1
  135. package/dist/types/quote.d.ts.map +1 -1
  136. package/dist/utils/quote.d.ts +12 -9
  137. package/dist/utils/quote.d.ts.map +1 -1
  138. package/dist/utils/settings.d.ts +2 -3
  139. package/dist/utils/settings.d.ts.map +1 -1
  140. package/dist/utils/swap.d.ts +18 -18
  141. package/dist/utils/swap.d.ts.map +1 -1
  142. package/dist/utils/wallets.d.ts +4 -3
  143. package/dist/utils/wallets.d.ts.map +1 -1
  144. package/package.json +10 -10
  145. package/src/QueueManager.tsx +0 -3
  146. package/src/components/AppRoutes.tsx +5 -0
  147. package/src/components/ConfirmWalletsModal/ConfirmWallets.helpers.ts +3 -3
  148. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +29 -21
  149. package/src/components/ConfirmWalletsModal/WalletList.tsx +24 -18
  150. package/src/components/HeaderButtons/{HomeButtons.tsx → HeaderButtons.tsx} +39 -26
  151. package/src/components/HeaderButtons/HeaderButtons.types.ts +3 -2
  152. package/src/components/HeaderButtons/index.ts +1 -1
  153. package/src/components/Layout/Layout.tsx +13 -1
  154. package/src/components/Layout/Layout.types.ts +1 -0
  155. package/src/components/Quote/Quote.styles.ts +133 -38
  156. package/src/components/Quote/Quote.tsx +77 -18
  157. package/src/components/Quote/Quote.types.ts +13 -7
  158. package/src/components/Quote/QuoteCostDetails.tsx +9 -4
  159. package/src/components/Quote/QuoteTrigger .tsx +7 -3
  160. package/src/components/QuoteSkeleton/QuoteSkeleton.tsx +2 -2
  161. package/src/components/QuoteSkeleton/QuoteSkeleton.types.ts +1 -1
  162. package/src/components/QuoteSkeleton/QuoteSummarySkeleton.styles.ts +10 -12
  163. package/src/components/QuoteSkeleton/QuoteSummarySkeleton.tsx +28 -9
  164. package/src/components/QuoteSkeleton/QuoteSummarySkeleton.types.ts +1 -1
  165. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +19 -19
  166. package/src/components/SwapDetails/SwapDetails.tsx +1 -1
  167. package/src/components/SwapDetailsAlerts/SwapDetailsAlerts.types.ts +1 -1
  168. package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +1 -3
  169. package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +3 -7
  170. package/src/components/SwapDetailsModal/SwapDetailsModal.Delete.tsx +1 -3
  171. package/src/components/SwapDetailsModal/index.ts +1 -1
  172. package/src/constants/languages.ts +2 -1
  173. package/src/constants/navigationRoutes.ts +1 -0
  174. package/src/constants/quote.ts +17 -1
  175. package/src/containers/QuoteInfo/QuoteInfo.tsx +32 -7
  176. package/src/containers/QuoteInfo/QuoteInfo.types.ts +6 -3
  177. package/src/containers/Wallets/Wallets.tsx +5 -11
  178. package/src/hooks/useConfirmSwap/useConfirmSwap.helpers.ts +36 -20
  179. package/src/hooks/useConfirmSwap/useConfirmSwap.ts +76 -78
  180. package/src/hooks/useConfirmSwap/useConfirmSwap.types.ts +1 -1
  181. package/src/hooks/useFetch.ts +48 -0
  182. package/src/hooks/useFetchAllQuotes.ts +21 -0
  183. package/src/hooks/useFetchConfirmQuote.ts +21 -0
  184. package/src/hooks/useSwapInput.ts +59 -31
  185. package/src/hooks/useWalletList.ts +5 -3
  186. package/src/pages/ConfirmSwapPage.tsx +12 -9
  187. package/src/pages/Home.tsx +27 -19
  188. package/src/pages/LiquiditySourcePage.tsx +3 -5
  189. package/src/pages/Routes.tsx +131 -0
  190. package/src/pages/SettingsPage.tsx +11 -13
  191. package/src/pages/WalletsPage.tsx +24 -18
  192. package/src/store/quote.ts +60 -22
  193. package/src/store/wallets.ts +0 -2
  194. package/src/types/quote.ts +27 -1
  195. package/src/utils/quote.ts +129 -67
  196. package/src/utils/settings.ts +2 -4
  197. package/src/utils/swap.ts +37 -77
  198. package/src/utils/wallets.ts +14 -9
  199. package/dist/components/HeaderButtons/HomeButtons.d.ts +0 -4
  200. package/dist/components/HeaderButtons/HomeButtons.d.ts.map +0 -1
  201. package/dist/hooks/useFetchQuote.d.ts +0 -9
  202. package/dist/hooks/useFetchQuote.d.ts.map +0 -1
  203. package/src/hooks/useFetchQuote.ts +0 -38
@@ -55,7 +55,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
55
55
 
56
56
  const blockchains = useAppStore().blockchains();
57
57
  const {
58
- quote,
58
+ selectedQuote,
59
59
  setSelectedWallets: selectQuoteWallets,
60
60
  quoteWalletsConfirmed: quoteWalletsConfirmed,
61
61
  setQuoteWalletConfirmed: setQuoteWalletConfirmed,
@@ -70,33 +70,37 @@ export function ConfirmWalletsModal(props: PropTypes) {
70
70
  const [quoteWarning, setQuoteWarning] = useState<
71
71
  ConfirmSwapWarnings['quoteUpdate'] | null
72
72
  >(null);
73
- const [destination, setDestination] = useState(customDestination);
74
73
  const [showCustomDestination, setShowCustomDestination] = useState(
75
74
  !!customDestination
76
75
  );
77
76
 
78
- const requiredWallets = getRequiredWallets(quote);
77
+ const requiredWallets = getRequiredWallets(selectedQuote?.swaps || null);
79
78
 
80
79
  const lastStepToBlockchain = blockchains.find(
81
80
  (blockchain) =>
82
81
  blockchain.name ===
83
- quote?.result?.swaps[quote?.result?.swaps.length - 1].to.blockchain
82
+ selectedQuote?.swaps[selectedQuote?.swaps.length - 1].to.blockchain
84
83
  );
85
84
  const isWalletRequiredFor = (blockchain: string) =>
86
- !!quote?.result?.swaps.find((swap) => swap.from.blockchain === blockchain);
85
+ !!selectedQuote?.swaps.find((swap) => swap.from.blockchain === blockchain);
87
86
 
88
- const [selectableWallets, setSelectableWallets] = useState<ConnectedWallet[]>(
87
+ const getInitialSelectableWallets = () =>
89
88
  connectedWallets.filter((connectedWallet) => {
90
89
  return (
91
90
  connectedWallet.selected &&
92
91
  requiredWallets.includes(connectedWallet.chain)
93
92
  );
94
- })
93
+ });
94
+
95
+ const [selectableWallets, setSelectableWallets] = useState<ConnectedWallet[]>(
96
+ getInitialSelectableWallets()
95
97
  );
96
98
  const lastStepToBlockchainMeta = blockchains.find(
97
99
  (chain) => chain.name === lastStepToBlockchain?.name
98
100
  );
99
101
 
102
+ const isInsufficientBalanceModalOpen = balanceWarnings.length > 0;
103
+
100
104
  const isSelected = (walletType: string, chain: string) =>
101
105
  !!selectableWallets.find(
102
106
  (selectableWallet) =>
@@ -104,18 +108,18 @@ export function ConfirmWalletsModal(props: PropTypes) {
104
108
  selectableWallet.chain === chain &&
105
109
  selectableWallet.selected &&
106
110
  (isWalletRequiredFor(chain) ||
107
- (!isWalletRequiredFor(chain) && !destination))
111
+ (!isWalletRequiredFor(chain) && !customDestination))
108
112
  );
109
113
 
110
114
  const isAddressMatched =
111
- !!destination &&
115
+ !!customDestination &&
112
116
  showCustomDestination &&
113
117
  lastStepToBlockchainMeta &&
114
- !isValidAddress(lastStepToBlockchainMeta, destination);
118
+ !isValidAddress(lastStepToBlockchainMeta, customDestination);
115
119
 
116
120
  const resetCustomDestination = () => {
117
121
  setShowCustomDestination(false);
118
- setDestination('');
122
+ setCustomDestination(null);
119
123
  setSelectableWallets((selectableWallets) => {
120
124
  let anyWalletSelected = false;
121
125
  return selectableWallets.map((selectableWallet) => {
@@ -155,7 +159,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
155
159
  onCancel();
156
160
  if (wallet.chain === lastStepToBlockchain?.name && showCustomDestination) {
157
161
  setShowCustomDestination(false);
158
- setDestination('');
162
+ setCustomDestination(null);
159
163
  }
160
164
  setSelectableWallets((selectableWallets) =>
161
165
  selectableWallets
@@ -170,7 +174,6 @@ export function ConfirmWalletsModal(props: PropTypes) {
170
174
  );
171
175
  selectWallets(lastSelectedWallets);
172
176
  selectQuoteWallets(lastSelectedWallets);
173
- setCustomDestination(destination);
174
177
  setQuoteWalletConfirmed(true);
175
178
  onClose();
176
179
  };
@@ -188,9 +191,8 @@ export function ConfirmWalletsModal(props: PropTypes) {
188
191
  );
189
192
  const result = await onCheckBalance?.({
190
193
  selectedWallets,
191
- customDestination: destination,
194
+ customDestination,
192
195
  });
193
-
194
196
  const warnings = result.warnings;
195
197
  if (warnings?.balance?.messages) {
196
198
  setBalanceWarnings(warnings.balance.messages);
@@ -254,8 +256,8 @@ export function ConfirmWalletsModal(props: PropTypes) {
254
256
  disabled={confirmSwapDisabled(
255
257
  loading,
256
258
  showCustomDestination,
257
- destination,
258
- quote,
259
+ customDestination,
260
+ selectedQuote,
259
261
  selectableWallets,
260
262
  lastStepToBlockchain
261
263
  )}
@@ -294,7 +296,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
294
296
  })}
295
297
  anchor="center">
296
298
  <WatermarkedModal
297
- open={balanceWarnings.length > 0}
299
+ open={isInsufficientBalanceModalOpen}
298
300
  onClose={setBalanceWarnings.bind(null, [])}
299
301
  container={modalContainer}>
300
302
  <MessageBox
@@ -442,9 +444,15 @@ export function ConfirmWalletsModal(props: PropTypes) {
442
444
  <StyledTextField
443
445
  autoFocus
444
446
  placeholder={i18n.t('Your destination address')}
445
- value={destination}
447
+ value={customDestination || ''}
446
448
  onChange={(e) => {
447
- setDestination(e.target.value);
449
+ const value = e.target.value;
450
+ if (!value.length) {
451
+ setShowCustomDestination(false);
452
+ setCustomDestination(null);
453
+ } else {
454
+ setCustomDestination(value.length ? value : null);
455
+ }
448
456
  }}
449
457
  />
450
458
  </CustomCollapsible>
@@ -455,7 +463,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
455
463
  variant="alarm"
456
464
  type="error"
457
465
  title={i18n.t({
458
- values: { destination },
466
+ values: { destination: customDestination },
459
467
  id: "Address {destination} doesn't match the blockchain address pattern.",
460
468
  })}
461
469
  />
@@ -59,23 +59,24 @@ export function WalletList(props: PropTypes) {
59
59
  useState<'in-progress' | 'completed' | 'rejected' | null>(null);
60
60
  const { suggestAndConnect } = useWallets();
61
61
  let modalTimerId: ReturnType<typeof setTimeout> | null = null;
62
- const { list, error, handleClick } = useWalletList({
63
- config,
64
- chain,
65
- onBeforeConnect: (type) => {
66
- modalTimerId = setTimeout(() => {
67
- setOpenWalletStateModal(type);
68
- }, TIME_TO_IGNORE_MODAL);
69
- },
70
- onConnect: () => {
71
- if (modalTimerId) {
72
- clearTimeout(modalTimerId);
73
- }
74
- setTimeout(() => {
75
- setOpenWalletStateModal('');
76
- }, TIME_TO_CLOSE_MODAL);
77
- },
78
- });
62
+ const { list, error, handleClick, disconnectConnectingWallets } =
63
+ useWalletList({
64
+ config,
65
+ chain,
66
+ onBeforeConnect: (type) => {
67
+ modalTimerId = setTimeout(() => {
68
+ setOpenWalletStateModal(type);
69
+ }, TIME_TO_IGNORE_MODAL);
70
+ },
71
+ onConnect: () => {
72
+ if (modalTimerId) {
73
+ clearTimeout(modalTimerId);
74
+ }
75
+ setTimeout(() => {
76
+ setOpenWalletStateModal('');
77
+ }, TIME_TO_CLOSE_MODAL);
78
+ },
79
+ });
79
80
  const [sortedList, setSortedList] = useState<WalletInfo[]>(list);
80
81
  const numberOfSupportedWallets = list.length;
81
82
  const shouldShowMoreWallets = limit && numberOfSupportedWallets - limit > 0;
@@ -133,6 +134,11 @@ export function WalletList(props: PropTypes) {
133
134
  };
134
135
  }, [addingExperimentalChainStatus]);
135
136
 
137
+ const handleCloseWalletModal = () => {
138
+ disconnectConnectingWallets();
139
+ setOpenWalletStateModal('');
140
+ };
141
+
136
142
  return (
137
143
  <>
138
144
  {sortedList.slice(0, limit).map((wallet) => {
@@ -195,7 +201,7 @@ export function WalletList(props: PropTypes) {
195
201
  <>
196
202
  <WalletModal
197
203
  open={openWalletStateModal === wallet.type}
198
- onClose={() => setOpenWalletStateModal('')}
204
+ onClose={handleCloseWalletModal}
199
205
  image={wallet.image}
200
206
  state={wallet.state}
201
207
  error={error}
@@ -1,4 +1,4 @@
1
- import type { HomeButtonsPropTypes } from './HeaderButtons.types';
1
+ import type { HeaderButtonsPropTypes } from './HeaderButtons.types';
2
2
 
3
3
  import { i18n } from '@lingui/core';
4
4
  import {
@@ -19,23 +19,32 @@ import { HeaderButton } from './HeaderButtons.styles';
19
19
  import { RefreshButton } from './RefreshButton';
20
20
  import { UnreadNotificationsBadge } from './UnreadNotificationsBadge';
21
21
 
22
- export function HomeButtons(props: HomeButtonsPropTypes) {
23
- const { onClickRefresh, onClickHistory, onClickSettings } = props;
22
+ export function HeaderButtons(props: HeaderButtonsPropTypes) {
23
+ const {
24
+ onClickRefresh,
25
+ onClickHistory,
26
+ onClickSettings,
27
+ hidden = [],
28
+ } = props;
24
29
 
25
30
  const {
26
31
  config: { features },
27
32
  } = useAppStore();
28
33
 
29
- const isNotificationsHidden = isFeatureHidden('notification', features);
34
+ const isNotificationsHidden =
35
+ isFeatureHidden('notification', features) ||
36
+ hidden.includes('notifications');
30
37
 
31
38
  return (
32
39
  <>
33
- <Tooltip
34
- container={getContainer()}
35
- side="top"
36
- content={i18n.t('Refresh')}>
37
- <RefreshButton onClick={onClickRefresh} />
38
- </Tooltip>
40
+ {!hidden.includes('refresh') && (
41
+ <Tooltip
42
+ container={getContainer()}
43
+ side="top"
44
+ content={i18n.t('Refresh')}>
45
+ <RefreshButton onClick={onClickRefresh} />
46
+ </Tooltip>
47
+ )}
39
48
 
40
49
  {!isNotificationsHidden && (
41
50
  <Popover
@@ -57,22 +66,26 @@ export function HomeButtons(props: HomeButtonsPropTypes) {
57
66
  </div>
58
67
  </Popover>
59
68
  )}
60
- <Tooltip
61
- container={getContainer()}
62
- side="top"
63
- content={i18n.t('Settings')}>
64
- <HeaderButton size="small" variant="ghost" onClick={onClickSettings}>
65
- <SettingsIcon size={18} color="black" />
66
- </HeaderButton>
67
- </Tooltip>
68
- <Tooltip
69
- container={getContainer()}
70
- side="top"
71
- content={i18n.t('Transactions History')}>
72
- <HeaderButton size="small" variant="ghost" onClick={onClickHistory}>
73
- <TransactionIcon size={18} color="black" />
74
- </HeaderButton>
75
- </Tooltip>
69
+ {!hidden.includes('settings') && (
70
+ <Tooltip
71
+ container={getContainer()}
72
+ side="top"
73
+ content={i18n.t('Settings')}>
74
+ <HeaderButton size="small" variant="ghost" onClick={onClickSettings}>
75
+ <SettingsIcon size={18} color="black" />
76
+ </HeaderButton>
77
+ </Tooltip>
78
+ )}
79
+ {!hidden.includes('history') && (
80
+ <Tooltip
81
+ container={getContainer()}
82
+ side="top"
83
+ content={i18n.t('Transactions History')}>
84
+ <HeaderButton size="small" variant="ghost" onClick={onClickHistory}>
85
+ <TransactionIcon size={18} color="black" />
86
+ </HeaderButton>
87
+ </Tooltip>
88
+ )}
76
89
  </>
77
90
  );
78
91
  }
@@ -3,8 +3,9 @@ export interface PropTypes {
3
3
  isConnected?: boolean;
4
4
  container?: HTMLElement;
5
5
  }
6
- export interface HomeButtonsPropTypes {
6
+ export interface HeaderButtonsPropTypes {
7
+ onClickSettings?: () => void;
7
8
  onClickRefresh?: () => void;
8
9
  onClickHistory?: () => void;
9
- onClickSettings?: () => void;
10
+ hidden?: ('settings' | 'refresh' | 'history' | 'notifications')[];
10
11
  }
@@ -1,4 +1,4 @@
1
1
  export { BackButton } from './BackButton';
2
2
  export { CancelButton } from './CancelButton';
3
3
  export { WalletButton } from './WalletButton';
4
- export { HomeButtons } from './HomeButtons';
4
+ export { HeaderButtons } from './HeaderButtons';
@@ -101,7 +101,19 @@ function Layout(props: PropsWithChildren<PropTypes>) {
101
101
  className={activeTheme()}
102
102
  ref={containerRef}>
103
103
  <Header
104
- prefix={<>{showBackButton && <BackButton onClick={navigateBack} />}</>}
104
+ prefix={
105
+ <>
106
+ {showBackButton && (
107
+ <BackButton
108
+ onClick={() => {
109
+ navigateBack();
110
+ // As an example, used in routes page to add a custom logic when navigating back to the home page.
111
+ header.onBack && header.onBack();
112
+ }}
113
+ />
114
+ )}
115
+ </>
116
+ }
105
117
  title={header.title}
106
118
  suffix={
107
119
  <>
@@ -14,6 +14,7 @@ export interface PropTypes {
14
14
  suffix?: React.ReactNode;
15
15
  hasBackButton?: boolean;
16
16
  onCancel?: () => void;
17
+ onBack?: () => void;
17
18
  };
18
19
  footer?: React.ReactNode;
19
20
  height?: ContainerHeightProp;
@@ -1,5 +1,12 @@
1
1
  import * as Collapsible from '@radix-ui/react-collapsible';
2
- import { css, darkTheme, Image, styled, Typography } from '@rango-dev/ui';
2
+ import {
3
+ Button,
4
+ css,
5
+ darkTheme,
6
+ Image,
7
+ styled,
8
+ Typography,
9
+ } from '@rango-dev/ui';
3
10
 
4
11
  import { CollapsibleContent } from '../CustomCollapsible/CustomCollapsible.styles';
5
12
 
@@ -13,31 +20,64 @@ export const QuoteContainer = styled(Collapsible.Root, {
13
20
  overflowY: 'hidden',
14
21
  width: '100%',
15
22
  borderRadius: '$xm',
16
- cursor: 'default',
17
23
  variants: {
18
- recommended: {
19
- true: {
20
- $$color: '$colors$info300',
24
+ selected: {
25
+ true: {},
26
+ false: {
27
+ $$color: '$colors$neutral400',
21
28
  [`.${darkTheme} &`]: {
22
- $$color: '$colors$secondary800',
29
+ $$color: '$colors$neutral200',
23
30
  },
24
31
  backgroundColor: '$$color',
25
32
  },
26
- false: {
33
+ },
34
+ listItem: {
35
+ true: {
27
36
  $$color: '$colors$neutral400',
28
37
  [`.${darkTheme} &`]: {
29
38
  $$color: '$colors$neutral200',
30
39
  },
31
40
  backgroundColor: '$$color',
32
41
  },
42
+ false: {},
33
43
  },
34
44
  },
45
+
46
+ compoundVariants: [
47
+ {
48
+ listItem: false,
49
+ selected: true,
50
+ css: {
51
+ $$color: '$colors$info300',
52
+ [`.${darkTheme} &`]: {
53
+ $$color: '$colors$secondary800',
54
+ },
55
+ backgroundColor: '$$color',
56
+ },
57
+ },
58
+ {
59
+ listItem: true,
60
+ selected: false,
61
+ css: {
62
+ cursor: 'pointer',
63
+ '&:hover': {
64
+ backgroundColor: '$neutral300',
65
+ [`.${darkTheme} &`]: {
66
+ backgroundColor: '$neutral400',
67
+ },
68
+ },
69
+ },
70
+ },
71
+ ],
35
72
  });
36
73
 
37
74
  export const stepsDetailsStyles = css({
38
75
  padding: '$10 $15',
39
76
  });
40
-
77
+ export const AllRoutesButton = styled(Button, {
78
+ backgroundColor: 'transparent',
79
+ border: '1px solid $secondary',
80
+ });
41
81
  export const SummaryContainer = styled('div', {
42
82
  borderRadius: '$xm',
43
83
  display: 'flex',
@@ -45,35 +85,35 @@ export const SummaryContainer = styled('div', {
45
85
  alignItems: 'start',
46
86
  justifyContent: 'space-between',
47
87
  color: '$foreground',
48
- cursor: 'pointer',
49
88
  boxSizing: 'border-box',
50
89
  position: 'relative',
51
90
  variants: {
52
- recommended: {
53
- true: {
54
- $$color: '$colors$info100',
91
+ selected: {
92
+ true: {},
93
+ false: {
94
+ $$color: '$colors$neutral200',
55
95
  [`.${darkTheme} &`]: {
56
- $$color: '$colors$secondary600',
96
+ $$color: '$colors$neutral500',
57
97
  },
58
98
  backgroundColor: '$$color',
59
- '&:hover': {
60
- backgroundColor: '$$color',
61
- },
62
99
  },
63
- false: {
100
+ },
101
+ basic: { true: { borderTopRightRadius: '0', borderTopLeftRadius: '0' } },
102
+ listItem: {
103
+ true: {
64
104
  $$color: '$colors$neutral200',
65
105
  [`.${darkTheme} &`]: {
66
106
  $$color: '$colors$neutral500',
67
107
  },
68
108
  backgroundColor: '$$color',
69
109
  '&:hover': {
70
- backgroundColor: '$$color',
110
+ backgroundColor: '$neutral300',
111
+ [`.${darkTheme} &`]: {
112
+ backgroundColor: '$neutral400',
113
+ },
71
114
  },
115
+ cursor: 'pointer',
72
116
  },
73
- },
74
- basic: { true: { borderTopRightRadius: '0', borderTopLeftRadius: '0' } },
75
- listItem: {
76
- true: {},
77
117
  false: {},
78
118
  },
79
119
  },
@@ -81,27 +121,35 @@ export const SummaryContainer = styled('div', {
81
121
  compoundVariants: [
82
122
  {
83
123
  listItem: true,
84
- recommended: true,
124
+ selected: true,
125
+ css: {
126
+ border: '1px solid $secondary',
127
+ },
128
+ },
129
+ {
130
+ listItem: false,
131
+ selected: true,
85
132
  css: {
133
+ $$color: '$colors$info100',
134
+ [`.${darkTheme} &`]: {
135
+ $$color: '$colors$secondary600',
136
+ },
137
+ backgroundColor: '$$color',
86
138
  '&:hover': {
87
- $$color: '$colors$secondary200',
88
- [`.${darkTheme} &`]: {
89
- $$color: '$colors$secondary700',
90
- },
91
139
  backgroundColor: '$$color',
92
140
  },
93
141
  },
94
142
  },
95
143
  {
96
144
  listItem: true,
97
- recommended: false,
145
+ selected: false,
98
146
  css: {
147
+ cursor: 'pointer',
99
148
  '&:hover': {
100
- $$color: '$colors$neutral300',
149
+ backgroundColor: '$neutral300',
101
150
  [`.${darkTheme} &`]: {
102
- $$color: '$colors$neutral400',
151
+ backgroundColor: '$neutral400',
103
152
  },
104
- backgroundColor: '$$color',
105
153
  },
106
154
  },
107
155
  },
@@ -111,7 +159,15 @@ export const SummaryContainer = styled('div', {
111
159
  export const summaryStyles = css({
112
160
  width: '100%',
113
161
  padding: '$15 $15 $10 $15',
114
- cursor: 'default',
162
+ });
163
+
164
+ export const summaryHeaderStyles = css({
165
+ display: 'flex',
166
+ flexDirection: 'row',
167
+ justifyContent: 'space-between',
168
+ alignItems: 'center',
169
+ paddingBottom: '$10',
170
+ position: 'relative',
115
171
  });
116
172
 
117
173
  export const rowStyles = css({
@@ -124,7 +180,6 @@ export const rowStyles = css({
124
180
  },
125
181
  });
126
182
  export const basicInfoStyles = css({
127
- paddingTop: '$10',
128
183
  display: 'flex',
129
184
  alignItems: 'center',
130
185
  '.usd-value': {
@@ -163,23 +218,41 @@ export const Trigger = styled(Collapsible.Trigger, {
163
218
  },
164
219
  },
165
220
  },
166
- recommended: {
167
- true: {
168
- $$color: '$colors$info300',
221
+ selected: {
222
+ true: {},
223
+ false: {
224
+ $$color: '$colors$neutral400',
169
225
  [`.${darkTheme} &`]: {
170
- $$color: '$colors$secondary800',
226
+ $$color: '$colors$neutral200',
171
227
  },
172
228
  backgroundColor: '$$color',
173
229
  },
174
- false: {
230
+ },
231
+ listItem: {
232
+ true: {
175
233
  $$color: '$colors$neutral400',
176
234
  [`.${darkTheme} &`]: {
177
235
  $$color: '$colors$neutral200',
178
236
  },
179
237
  backgroundColor: '$$color',
180
238
  },
239
+ false: {},
181
240
  },
182
241
  },
242
+
243
+ compoundVariants: [
244
+ {
245
+ listItem: false,
246
+ selected: true,
247
+ css: {
248
+ $$color: '$colors$info300',
249
+ [`.${darkTheme} &`]: {
250
+ $$color: '$colors$secondary800',
251
+ },
252
+ backgroundColor: '$$color',
253
+ },
254
+ },
255
+ ],
183
256
  '.blockchains_section': {
184
257
  display: 'none',
185
258
  },
@@ -291,3 +364,25 @@ export const MoreStep = styled('div', {
291
364
  },
292
365
  },
293
366
  });
367
+
368
+ export const Tag = styled('div', {
369
+ backgroundColor: '$neutral400',
370
+ borderRadius: '$xs',
371
+ padding: '$2 $5',
372
+ fontSize: '$10',
373
+ fontWeight: 400,
374
+ });
375
+ export const TagContainer = styled('div', {
376
+ display: 'flex',
377
+ });
378
+
379
+ export const Line = styled('div', {
380
+ width: '100%',
381
+ borderTopWidth: '1px',
382
+ borderTopStyle: 'solid',
383
+ borderTopColor: '$neutral',
384
+ margin: '$5 0',
385
+ [`.${darkTheme} &`]: {
386
+ borderTopColor: '$neutral400',
387
+ },
388
+ });