@rango-dev/widget-embedded 0.17.1-next.10 → 0.17.1-next.12

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 (67) hide show
  1. package/dist/components/AppRoutes.d.ts.map +1 -1
  2. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  3. package/dist/components/Layout/Layout.d.ts.map +1 -1
  4. package/dist/components/Layout/Layout.types.d.ts +2 -2
  5. package/dist/components/Layout/Layout.types.d.ts.map +1 -1
  6. package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
  7. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.d.ts.map +1 -1
  8. package/dist/components/SwapDetails/SwapDetails.Placeholder.d.ts.map +1 -1
  9. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  10. package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
  11. package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +1 -1
  12. package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +1 -1
  13. package/dist/components/TokenList/TokenList.styles.d.ts.map +1 -1
  14. package/dist/components/UpdateUrl.d.ts.map +1 -1
  15. package/dist/constants/navigationRoutes.d.ts +1 -2
  16. package/dist/constants/navigationRoutes.d.ts.map +1 -1
  17. package/dist/hooks/useNavigateBack.d.ts +1 -3
  18. package/dist/hooks/useNavigateBack.d.ts.map +1 -1
  19. package/dist/index.d.ts +2 -1
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.js +1 -1
  22. package/dist/index.js.map +4 -4
  23. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  24. package/dist/pages/HistoryPage.d.ts.map +1 -1
  25. package/dist/pages/Home.d.ts.map +1 -1
  26. package/dist/pages/LanguagePage.d.ts.map +1 -1
  27. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  28. package/dist/pages/SelectBlockchainPage.d.ts.map +1 -1
  29. package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
  30. package/dist/pages/SettingsPage.d.ts.map +1 -1
  31. package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
  32. package/dist/pages/ThemePage.d.ts.map +1 -1
  33. package/dist/pages/WalletsPage.d.ts.map +1 -1
  34. package/dist/utils/colors.d.ts.map +1 -1
  35. package/package.json +2 -2
  36. package/src/components/AppRoutes.tsx +54 -33
  37. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +2 -2
  38. package/src/components/Layout/Layout.tsx +10 -7
  39. package/src/components/Layout/Layout.types.ts +2 -2
  40. package/src/components/NotificationContent/NotificationContent.tsx +1 -1
  41. package/src/components/Quote/Quote.styles.ts +7 -0
  42. package/src/components/QuoteWarningsAndErrors/QuoteErrorsModalItem.tsx +1 -1
  43. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts +8 -1
  44. package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +1 -1
  45. package/src/components/SwapDetails/SwapDetails.Placeholder.tsx +0 -4
  46. package/src/components/SwapDetails/SwapDetails.tsx +2 -5
  47. package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +4 -3
  48. package/src/components/SwapsGroup/SwapsGroup.styles.ts +8 -1
  49. package/src/components/SwapsGroup/SwapsGroup.tsx +0 -2
  50. package/src/components/TokenList/TokenList.styles.ts +14 -2
  51. package/src/components/TokenList/TokenList.tsx +1 -1
  52. package/src/components/UpdateUrl.tsx +0 -3
  53. package/src/constants/navigationRoutes.ts +7 -8
  54. package/src/hooks/useNavigateBack.ts +3 -52
  55. package/src/index.ts +2 -0
  56. package/src/pages/ConfirmSwapPage.tsx +10 -9
  57. package/src/pages/HistoryPage.tsx +1 -5
  58. package/src/pages/Home.tsx +6 -3
  59. package/src/pages/LanguagePage.tsx +0 -5
  60. package/src/pages/LiquiditySourcePage.tsx +0 -4
  61. package/src/pages/SelectBlockchainPage.tsx +2 -8
  62. package/src/pages/SelectSwapItemsPage.tsx +4 -18
  63. package/src/pages/SettingsPage.tsx +0 -3
  64. package/src/pages/SwapDetailsPage.tsx +3 -4
  65. package/src/pages/ThemePage.tsx +0 -4
  66. package/src/pages/WalletsPage.tsx +0 -4
  67. package/src/utils/colors.ts +2 -1
@@ -119,12 +119,11 @@ export function ConfirmSwapPage() {
119
119
  { id: confirmSwapResult.swap.requestId }
120
120
  );
121
121
  setSelectedSwap(confirmSwapResult.swap.requestId);
122
- navigate(
123
- '/' + navigationRoutes.swaps + `/${confirmSwapResult.swap.requestId}`,
124
- {
125
- replace: true,
126
- }
127
- );
122
+
123
+ const swap_url = `../${navigationRoutes.swaps}/${confirmSwapResult.swap.requestId}`;
124
+ navigate(swap_url, {
125
+ replace: true,
126
+ });
128
127
  setTimeout(() => {
129
128
  setInputAmount('');
130
129
  }, 0);
@@ -242,8 +241,10 @@ export function ConfirmSwapPage() {
242
241
  <Layout
243
242
  header={{
244
243
  title: i18n.t('Confirm Swap'),
245
- onBack: () => navigate(-1),
246
- hasConnectWallet: true,
244
+ onWallet: () => {
245
+ const wallets_url = `../${navigationRoutes.wallets}`;
246
+ navigate(wallets_url);
247
+ },
247
248
  suffix: (
248
249
  <Tooltip
249
250
  container={getContainer()}
@@ -252,7 +253,7 @@ export function ConfirmSwapPage() {
252
253
  <HeaderButton
253
254
  size="small"
254
255
  variant="ghost"
255
- onClick={() => navigate('/' + navigationRoutes.settings)}>
256
+ onClick={() => navigate('../' + navigationRoutes.settings)}>
256
257
  <SettingsIcon size={18} color="black" />
257
258
  </HeaderButton>
258
259
  </Tooltip>
@@ -11,8 +11,6 @@ import { Layout } from '../components/Layout';
11
11
  import { SearchInput } from '../components/SearchInput';
12
12
  import { SwapsGroup } from '../components/SwapsGroup';
13
13
  import { NotFoundContainer } from '../components/SwapsGroup/SwapsGroup.styles';
14
- import { navigationRoutes } from '../constants/navigationRoutes';
15
- import { useNavigateBack } from '../hooks/useNavigateBack';
16
14
  import { useUiStore } from '../store/ui';
17
15
  import { groupSwapsByDate } from '../utils/date';
18
16
  import { containsText } from '../utils/numbers';
@@ -51,7 +49,6 @@ const isStepContainsText = (steps: PendingSwapStep[], value: string) => {
51
49
  export function HistoryPage() {
52
50
  const setSelectedSwap = useUiStore.use.setSelectedSwap();
53
51
  const navigate = useNavigate();
54
- const { navigateBackFrom } = useNavigateBack();
55
52
  const { manager, state } = useManager();
56
53
  const list: PendingSwap[] = getPendingSwaps(manager).map(({ swap }) => swap);
57
54
  const [searchedFor, setSearchedFor] = useState<string>('');
@@ -78,7 +75,6 @@ export function HistoryPage() {
78
75
  return (
79
76
  <Layout
80
77
  header={{
81
- onBack: () => navigateBackFrom(navigationRoutes.swaps),
82
78
  title: i18n.t('History'),
83
79
  }}>
84
80
  <Container>
@@ -108,7 +104,7 @@ export function HistoryPage() {
108
104
  list={filteredList}
109
105
  onSwapClick={(requestId) => {
110
106
  setSelectedSwap(requestId);
111
- navigate(`${requestId}`, { replace: true });
107
+ navigate(requestId);
112
108
  }}
113
109
  groupBy={groupSwapsByDate}
114
110
  isLoading={loading}
@@ -184,7 +184,10 @@ export function Home() {
184
184
  </Button>
185
185
  }
186
186
  header={{
187
- hasConnectWallet: true,
187
+ onWallet: () => {
188
+ navigate(navigationRoutes.wallets);
189
+ },
190
+ hasBackButton: false,
188
191
  title: i18n.t('Swap'),
189
192
  suffix: (
190
193
  <HomeButtons
@@ -213,7 +216,7 @@ export function Home() {
213
216
  displayName: fromToken?.symbol || '',
214
217
  image: fromToken?.image || '',
215
218
  }}
216
- onClickToken={() => navigate('from-swap')}
219
+ onClickToken={() => navigate(navigationRoutes.fromSwap)}
217
220
  price={{
218
221
  value: inputAmount,
219
222
  usdValue: priceImpactInputCanNotBeComputed
@@ -272,7 +275,7 @@ export function Home() {
272
275
  ? errorMessages().unknownPriceError.impactTitle
273
276
  : undefined,
274
277
  }}
275
- onClickToken={() => navigate('to-swap')}
278
+ onClickToken={() => navigate(navigationRoutes.toSwap)}
276
279
  disabled={fetchMetaStatus === 'failed'}
277
280
  loading={fetchMetaStatus === 'loading'}
278
281
  />
@@ -10,13 +10,9 @@ import React from 'react';
10
10
 
11
11
  import { Layout } from '../components/Layout';
12
12
  import { SettingsContainer } from '../components/SettingsContainer';
13
- import { navigationRoutes } from '../constants/navigationRoutes';
14
13
  import { useLanguage } from '../hooks/useLanguage';
15
- import { useNavigateBack } from '../hooks/useNavigateBack';
16
14
 
17
15
  export function LanguagePage() {
18
- const { navigateBackFrom } = useNavigateBack();
19
-
20
16
  const { activeLanguage, changeLanguage, languages } = useLanguage();
21
17
 
22
18
  const languageList = languages.map((languageItem) => {
@@ -38,7 +34,6 @@ export function LanguagePage() {
38
34
  return (
39
35
  <Layout
40
36
  header={{
41
- onBack: () => navigateBackFrom(navigationRoutes.settings),
42
37
  title: i18n.t('Language'),
43
38
  }}>
44
39
  <SettingsContainer>
@@ -23,8 +23,6 @@ import {
23
23
  NotFoundContainer,
24
24
  SettingsContainer,
25
25
  } from '../components/SettingsContainer';
26
- import { navigationRoutes } from '../constants/navigationRoutes';
27
- import { useNavigateBack } from '../hooks/useNavigateBack';
28
26
  import { useAppStore } from '../store/AppStore';
29
27
  import { useSettingsStore } from '../store/settings';
30
28
  import { containsText } from '../utils/numbers';
@@ -39,7 +37,6 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
39
37
  const swappers = useAppStore().swappers();
40
38
  const [searchedFor, setSearchedFor] = useState<string>('');
41
39
  const toggleLiquiditySource = useSettingsStore.use.toggleLiquiditySource();
42
- const { navigateBackFrom } = useNavigateBack();
43
40
  const supportedUniqueSwappersGroups: Array<UniqueSwappersGroupType> =
44
41
  getUniqueSwappersGroups(swappers);
45
42
 
@@ -102,7 +99,6 @@ export function LiquiditySourcePage({ sourceType }: PropTypes) {
102
99
  return (
103
100
  <Layout
104
101
  header={{
105
- onBack: () => navigateBackFrom(navigationRoutes.settings),
106
102
  title: i18n.t(sourceType),
107
103
  suffix: (
108
104
  <LiquiditySourceSuffix>
@@ -5,7 +5,6 @@ import React, { useState } from 'react';
5
5
  import { BlockchainList } from '../components/BlockchainList';
6
6
  import { Layout } from '../components/Layout';
7
7
  import { SearchInput } from '../components/SearchInput';
8
- import { navigationRoutes } from '../constants/navigationRoutes';
9
8
  import { useNavigateBack } from '../hooks/useNavigateBack';
10
9
  import { useAppStore } from '../store/AppStore';
11
10
  import { useQuoteStore } from '../store/quote';
@@ -16,7 +15,7 @@ interface PropTypes {
16
15
 
17
16
  export function SelectBlockchainPage(props: PropTypes) {
18
17
  const { type } = props;
19
- const { navigateBackFrom } = useNavigateBack();
18
+ const navigateBack = useNavigateBack();
20
19
  const [searchedFor, setSearchedFor] = useState<string>('');
21
20
  const [blockchainCategory, setBlockchainCategory] = useState<string>('ALL');
22
21
  const setToBlockchain = useQuoteStore.use.setToBlockchain();
@@ -26,14 +25,10 @@ export function SelectBlockchainPage(props: PropTypes) {
26
25
  const blockchains = useAppStore().blockchains({
27
26
  type: type,
28
27
  });
29
- const routeKey = type === 'source' ? 'fromBlockchain' : 'toBlockchain';
30
28
 
31
29
  return (
32
30
  <Layout
33
31
  header={{
34
- onBack: () => {
35
- navigateBackFrom(navigationRoutes[routeKey]);
36
- },
37
32
  title: i18n.t(`Select Blockchain`),
38
33
  }}>
39
34
  <Divider size={12} />
@@ -66,8 +61,7 @@ export function SelectBlockchainPage(props: PropTypes) {
66
61
  } else {
67
62
  setToBlockchain(blockchain);
68
63
  }
69
-
70
- navigateBackFrom(navigationRoutes[routeKey]);
64
+ navigateBack();
71
65
  }}
72
66
  />
73
67
  </Layout>
@@ -23,7 +23,7 @@ interface PropTypes {
23
23
  export function SelectSwapItemsPage(props: PropTypes) {
24
24
  const { type } = props;
25
25
  const navigate = useNavigate();
26
- const { navigateBackFrom } = useNavigateBack();
26
+ const navigateBack = useNavigateBack();
27
27
  const {
28
28
  fromBlockchain,
29
29
  toBlockchain,
@@ -72,27 +72,13 @@ export function SelectSwapItemsPage(props: PropTypes) {
72
72
  return (
73
73
  <Layout
74
74
  header={{
75
- onBack: () =>
76
- navigateBackFrom(
77
- type === 'source'
78
- ? navigationRoutes.fromSwap
79
- : navigationRoutes.toSwap
80
- ),
81
- title: i18n.t('Swap {type}', {
82
- type: type === 'source' ? 'from' : 'to',
83
- }),
75
+ title: i18n.t('Swap {type}', { type }),
84
76
  }}>
85
77
  <BlockchainsSection
86
78
  blockchains={blockchains}
87
79
  type={type == 'source' ? 'from' : 'to'}
88
80
  blockchain={type === 'source' ? fromBlockchain : toBlockchain}
89
- onMoreClick={() =>
90
- navigate(
91
- type === 'source'
92
- ? navigationRoutes.fromBlockchain
93
- : navigationRoutes.toBlockchain
94
- )
95
- }
81
+ onMoreClick={() => navigate(navigationRoutes.blockchains)}
96
82
  onChange={(blockchain) => {
97
83
  updateBlockchain(blockchain);
98
84
  }}
@@ -123,7 +109,7 @@ export function SelectSwapItemsPage(props: PropTypes) {
123
109
  updateBlockchain(tokenBlockchain);
124
110
  }
125
111
 
126
- navigateBackFrom(navigationRoutes.fromSwap);
112
+ navigateBack();
127
113
  }}
128
114
  />
129
115
  </Layout>
@@ -18,7 +18,6 @@ import { SettingsContainer } from '../components/SettingsContainer';
18
18
  import { Slippage } from '../components/Slippage';
19
19
  import { SlippageTooltipContainer as TooltipContainer } from '../components/Slippage/Slippage.styles';
20
20
  import { navigationRoutes } from '../constants/navigationRoutes';
21
- import { useNavigateBack } from '../hooks/useNavigateBack';
22
21
  import { useAppStore } from '../store/AppStore';
23
22
  import { useSettingsStore } from '../store/settings';
24
23
  import { getContainer } from '../utils/common';
@@ -29,7 +28,6 @@ export function SettingsPage() {
29
28
  const { theme } = useAppStore().config;
30
29
  const fetchStatus = useAppStore().fetchStatus;
31
30
  const swappers = useAppStore().swappers();
32
- const { navigateBackFrom } = useNavigateBack();
33
31
 
34
32
  const infiniteApprove = useSettingsStore.use.infiniteApprove();
35
33
  const toggleInfiniteApprove = useSettingsStore.use.toggleInfiniteApprove();
@@ -171,7 +169,6 @@ export function SettingsPage() {
171
169
  return (
172
170
  <Layout
173
171
  header={{
174
- onBack: () => navigateBackFrom(navigationRoutes.settings),
175
172
  title: i18n.t('Setting'),
176
173
  }}>
177
174
  <SettingsContainer>
@@ -4,7 +4,6 @@ import React from 'react';
4
4
 
5
5
  import { SwapDetails } from '../components/SwapDetails';
6
6
  import { SwapDetailsPlaceholder } from '../components/SwapDetails/SwapDetails.Placeholder';
7
- import { navigationRoutes } from '../constants/navigationRoutes';
8
7
  import { useNavigateBack } from '../hooks/useNavigateBack';
9
8
  import { useAppStore } from '../store/AppStore';
10
9
  import { useUiStore } from '../store/ui';
@@ -15,7 +14,7 @@ export function SwapDetailsPage() {
15
14
  const loading = !state.loadedFromPersistor;
16
15
  const pendingSwaps = getPendingSwaps(manager);
17
16
  const requestId = useUiStore.use.selectedSwapRequestId();
18
- const { navigateBackFrom } = useNavigateBack();
17
+ const navigateBack = useNavigateBack();
19
18
  const { fetchStatus: fetchMetaStatus } = useAppStore();
20
19
 
21
20
  const showSkeleton = loading || fetchMetaStatus === 'loading';
@@ -36,8 +35,8 @@ export function SwapDetailsPage() {
36
35
  const onDelete = async () => {
37
36
  if (selectedSwap?.id) {
38
37
  try {
39
- await manager?.deleteQueue(selectedSwap.id);
40
- navigateBackFrom(navigationRoutes.swapDetails);
38
+ manager?.deleteQueue(selectedSwap.id);
39
+ navigateBack();
41
40
  } catch (e) {
42
41
  console.log(e);
43
42
  }
@@ -13,8 +13,6 @@ import React from 'react';
13
13
 
14
14
  import { Layout } from '../components/Layout';
15
15
  import { SettingsContainer } from '../components/SettingsContainer';
16
- import { navigationRoutes } from '../constants/navigationRoutes';
17
- import { useNavigateBack } from '../hooks/useNavigateBack';
18
16
  import { useSettingsStore } from '../store/settings';
19
17
 
20
18
  type Theme = 'dark' | 'light' | 'auto';
@@ -26,7 +24,6 @@ enum Mode {
26
24
  }
27
25
 
28
26
  export function ThemePage() {
29
- const { navigateBackFrom } = useNavigateBack();
30
27
  const theme = useSettingsStore.use.theme();
31
28
  const setTheme = useSettingsStore.use.setTheme();
32
29
 
@@ -72,7 +69,6 @@ export function ThemePage() {
72
69
  return (
73
70
  <Layout
74
71
  header={{
75
- onBack: () => navigateBackFrom(navigationRoutes.settings),
76
72
  title: i18n.t('Theme'),
77
73
  }}>
78
74
  <SettingsContainer>
@@ -6,8 +6,6 @@ import React, { Fragment, useState } from 'react';
6
6
 
7
7
  import { Layout } from '../components/Layout';
8
8
  import { WalletModal } from '../components/WalletModal';
9
- import { navigationRoutes } from '../constants/navigationRoutes';
10
- import { useNavigateBack } from '../hooks/useNavigateBack';
11
9
  import { useWalletList } from '../hooks/useWalletList';
12
10
  import { useAppStore } from '../store/AppStore';
13
11
  import { getContainer } from '../utils/common';
@@ -30,7 +28,6 @@ export const TIME_TO_IGNORE_MODAL = 300;
30
28
 
31
29
  export function WalletsPage() {
32
30
  const { config, fetchStatus: fetchMetaStatus } = useAppStore();
33
- const { navigateBackFrom } = useNavigateBack();
34
31
  const [openModal, setOpenModal] = useState(false);
35
32
  const [selectedWalletType, setSelectedWalletType] = useState<WalletType>('');
36
33
  let modalTimerId: ReturnType<typeof setTimeout> | null = null;
@@ -64,7 +61,6 @@ export function WalletsPage() {
64
61
  <Layout
65
62
  header={{
66
63
  title: i18n.t('Connect Wallets'),
67
- onBack: () => navigateBackFrom(navigationRoutes.wallets),
68
64
  }}>
69
65
  <Container>
70
66
  <Typography variant="title" size="xmedium" align="center">
@@ -31,7 +31,7 @@ export const generateRangeColors = (name: string, color: string) => {
31
31
  const NUMBER_OF_COLORS = 10;
32
32
  const HALF_NUMBER_OF_COLORS = 5;
33
33
  const COLOR_SUFFIX = 100;
34
- const AMT = 32;
34
+ const AMT = 25;
35
35
 
36
36
  let colors = { [name]: color };
37
37
  for (let i = 1; i < NUMBER_OF_COLORS; i++) {
@@ -60,6 +60,7 @@ export const generateRangeColors = (name: string, color: string) => {
60
60
  };
61
61
  }
62
62
  }
63
+
63
64
  return colors;
64
65
  };
65
66
  export const generateColors = (