@rango-dev/widget-embedded 0.23.1-next.8 → 0.24.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (187) hide show
  1. package/dist/components/AppRouter.d.ts +1 -6
  2. package/dist/components/AppRouter.d.ts.map +1 -1
  3. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +1 -283
  4. package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts.map +1 -1
  5. package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
  6. package/dist/components/HeaderButtons/HeaderButtons.d.ts.map +1 -1
  7. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts +489 -1
  8. package/dist/components/HeaderButtons/HeaderButtons.styles.d.ts.map +1 -1
  9. package/dist/components/HeaderButtons/InProgressTransactionBadge.d.ts +4 -0
  10. package/dist/components/HeaderButtons/InProgressTransactionBadge.d.ts.map +1 -0
  11. package/dist/components/HeaderButtons/RefreshButton.d.ts.map +1 -1
  12. package/dist/components/HeaderButtons/UnreadNotificationsBadge.d.ts.map +1 -1
  13. package/dist/components/HeaderButtons/WalletButton.d.ts.map +1 -1
  14. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts +1 -1
  15. package/dist/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.d.ts.map +1 -1
  16. package/dist/components/NoResult/NoResult.d.ts.map +1 -1
  17. package/dist/components/NoResult/NoResult.helpers.d.ts +8 -0
  18. package/dist/components/NoResult/NoResult.helpers.d.ts.map +1 -1
  19. package/dist/components/NoResult/NoResult.styles.d.ts +167 -1
  20. package/dist/components/NoResult/NoResult.styles.d.ts.map +1 -1
  21. package/dist/components/NoResult/NoResult.types.d.ts +1 -0
  22. package/dist/components/NoResult/NoResult.types.d.ts.map +1 -1
  23. package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
  24. package/dist/components/NotificationContent/NotificationContent.styles.d.ts +165 -0
  25. package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
  26. package/dist/components/Quote/Quote.d.ts.map +1 -1
  27. package/dist/components/Quote/Quote.styles.d.ts.map +1 -1
  28. package/dist/components/Quote/Quote.types.d.ts +1 -0
  29. package/dist/components/Quote/Quote.types.d.ts.map +1 -1
  30. package/dist/components/Quote/QuoteTrigger.d.ts.map +1 -1
  31. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts +1 -0
  32. package/dist/components/QuoteSkeleton/QuoteSkeleton.styles.d.ts.map +1 -1
  33. package/dist/components/QuoteSkeleton/QuoteSummarySkeleton.d.ts.map +1 -1
  34. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts +3 -1
  35. package/dist/components/QuoteSkeleton/StepSkeleton.styles.d.ts.map +1 -1
  36. package/dist/components/Quotes/Quotes.d.ts.map +1 -1
  37. package/dist/components/Quotes/Quotes.types.d.ts +1 -0
  38. package/dist/components/Quotes/Quotes.types.d.ts.map +1 -1
  39. package/dist/components/Quotes/SelectStrategy.d.ts.map +1 -1
  40. package/dist/components/Slippage/Slippage.d.ts.map +1 -1
  41. package/dist/components/SwapDetails/SwapDetails.d.ts.map +1 -1
  42. package/dist/components/SwapDetailsModal/SwapDetailsModal.WalletState.d.ts.map +1 -1
  43. package/dist/components/TokenList/TokenList.d.ts.map +1 -1
  44. package/dist/constants/index.d.ts +1 -1
  45. package/dist/constants/index.d.ts.map +1 -1
  46. package/dist/constants/languages.d.ts.map +1 -1
  47. package/dist/constants/quote.d.ts +1 -5
  48. package/dist/constants/quote.d.ts.map +1 -1
  49. package/dist/constants/searchFor.d.ts +7 -0
  50. package/dist/constants/searchFor.d.ts.map +1 -0
  51. package/dist/containers/App/App.d.ts.map +1 -1
  52. package/dist/containers/App/App.styles.d.ts.map +1 -1
  53. package/dist/containers/ExpandedQuotes/ExpandedQuotes.d.ts.map +1 -1
  54. package/dist/containers/ExpandedQuotes/ExpandedQuotes.styles.d.ts +3 -1
  55. package/dist/containers/ExpandedQuotes/ExpandedQuotes.styles.d.ts.map +1 -1
  56. package/dist/containers/Inputs/Inputs.d.ts.map +1 -1
  57. package/dist/containers/Inputs/Inputs.types.d.ts +1 -0
  58. package/dist/containers/Inputs/Inputs.types.d.ts.map +1 -1
  59. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
  60. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +1 -0
  61. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
  62. package/dist/containers/Settings/Lists.d.ts.map +1 -1
  63. package/dist/containers/Wallets/Wallets.d.ts.map +1 -1
  64. package/dist/containers/Wallets/Wallets.types.d.ts +13 -2
  65. package/dist/containers/Wallets/Wallets.types.d.ts.map +1 -1
  66. package/dist/containers/Widget/Widget.d.ts.map +1 -1
  67. package/dist/hooks/useBootstrap/index.d.ts +2 -0
  68. package/dist/hooks/useBootstrap/index.d.ts.map +1 -0
  69. package/dist/hooks/useBootstrap/useBootstrap.d.ts +2 -0
  70. package/dist/hooks/useBootstrap/useBootstrap.d.ts.map +1 -0
  71. package/dist/hooks/useScreenDetect.d.ts +9 -0
  72. package/dist/hooks/useScreenDetect.d.ts.map +1 -0
  73. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  74. package/dist/hooks/useTheme.d.ts.map +1 -1
  75. package/dist/hooks/useWalletList.d.ts.map +1 -1
  76. package/dist/index.js +2 -2
  77. package/dist/index.js.map +4 -4
  78. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  79. package/dist/pages/Home.d.ts.map +1 -1
  80. package/dist/pages/LanguagePage.d.ts.map +1 -1
  81. package/dist/pages/LiquiditySourcePage.d.ts.map +1 -1
  82. package/dist/pages/SelectSwapItemsPage.d.ts.map +1 -1
  83. package/dist/pages/SettingsPage.d.ts.map +1 -1
  84. package/dist/store/AppStore.d.ts +2 -2
  85. package/dist/store/app.d.ts +2 -2
  86. package/dist/store/slices/config.d.ts.map +1 -1
  87. package/dist/store/slices/data.d.ts +3 -1
  88. package/dist/store/slices/data.d.ts.map +1 -1
  89. package/dist/store/slices/settings.d.ts.map +1 -1
  90. package/dist/types/config.d.ts +9 -5
  91. package/dist/types/config.d.ts.map +1 -1
  92. package/dist/utils/colors.d.ts +5 -3
  93. package/dist/utils/colors.d.ts.map +1 -1
  94. package/dist/utils/common.d.ts +4 -0
  95. package/dist/utils/common.d.ts.map +1 -1
  96. package/dist/utils/configs.d.ts +2 -1
  97. package/dist/utils/configs.d.ts.map +1 -1
  98. package/dist/utils/meta.d.ts +1 -0
  99. package/dist/utils/meta.d.ts.map +1 -1
  100. package/dist/utils/swap.d.ts +2 -0
  101. package/dist/utils/swap.d.ts.map +1 -1
  102. package/dist/utils/ui.d.ts +5 -2
  103. package/dist/utils/ui.d.ts.map +1 -1
  104. package/dist/utils/wallets.d.ts +1 -1
  105. package/dist/utils/wallets.d.ts.map +1 -1
  106. package/package.json +8 -7
  107. package/src/components/AppRouter.tsx +1 -29
  108. package/src/components/ConfirmWalletsModal/ConfirmWallets.styles.ts +6 -12
  109. package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +7 -11
  110. package/src/components/ConfirmWalletsModal/WalletList.tsx +2 -2
  111. package/src/components/HeaderButtons/HeaderButtons.styles.ts +43 -2
  112. package/src/components/HeaderButtons/HeaderButtons.tsx +2 -0
  113. package/src/components/HeaderButtons/InProgressTransactionBadge.tsx +26 -0
  114. package/src/components/HeaderButtons/RefreshButton.tsx +2 -1
  115. package/src/components/HeaderButtons/UnreadNotificationsBadge.tsx +10 -2
  116. package/src/components/HeaderButtons/WalletButton.tsx +26 -6
  117. package/src/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.styles.ts +1 -1
  118. package/src/components/LoadingLiquiditySourceList/LoadingLiquiditySourceList.tsx +4 -4
  119. package/src/components/NoResult/NoResult.helpers.ts +13 -0
  120. package/src/components/NoResult/NoResult.styles.ts +19 -1
  121. package/src/components/NoResult/NoResult.tsx +27 -16
  122. package/src/components/NoResult/NoResult.types.ts +1 -0
  123. package/src/components/NotificationContent/NotificationContent.styles.ts +14 -1
  124. package/src/components/NotificationContent/NotificationContent.tsx +49 -39
  125. package/src/components/Quote/Quote.styles.ts +13 -14
  126. package/src/components/Quote/Quote.tsx +166 -145
  127. package/src/components/Quote/Quote.types.ts +1 -0
  128. package/src/components/Quote/QuoteTrigger.tsx +19 -14
  129. package/src/components/QuoteSkeleton/QuoteSkeleton.styles.ts +10 -2
  130. package/src/components/QuoteSkeleton/QuoteSkeleton.tsx +2 -2
  131. package/src/components/QuoteSkeleton/QuoteSummarySkeleton.styles.ts +2 -2
  132. package/src/components/QuoteSkeleton/QuoteSummarySkeleton.tsx +5 -4
  133. package/src/components/QuoteSkeleton/StepSkeleton.styles.ts +7 -0
  134. package/src/components/QuoteSkeleton/StepSkeleton.tsx +1 -1
  135. package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +1 -1
  136. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.helpers.ts +3 -3
  137. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.styles.ts +1 -1
  138. package/src/components/Quotes/Quotes.tsx +33 -21
  139. package/src/components/Quotes/Quotes.types.ts +1 -0
  140. package/src/components/Quotes/SelectStrategy.tsx +27 -10
  141. package/src/components/Slippage/Slippage.tsx +11 -13
  142. package/src/components/SwapDetails/SwapDetails.tsx +3 -1
  143. package/src/components/SwapDetailsModal/SwapDetailsModal.WalletState.tsx +5 -1
  144. package/src/components/TokenList/TokenList.tsx +9 -8
  145. package/src/constants/errors.ts +1 -1
  146. package/src/constants/index.ts +1 -1
  147. package/src/constants/languages.ts +27 -1
  148. package/src/constants/quote.ts +1 -24
  149. package/src/constants/searchFor.ts +6 -0
  150. package/src/containers/App/App.styles.ts +0 -4
  151. package/src/containers/App/App.tsx +4 -28
  152. package/src/containers/ExpandedQuotes/ExpandedQuotes.styles.ts +13 -0
  153. package/src/containers/ExpandedQuotes/ExpandedQuotes.tsx +5 -0
  154. package/src/containers/Inputs/Inputs.tsx +2 -3
  155. package/src/containers/Inputs/Inputs.types.ts +1 -0
  156. package/src/containers/QuoteInfo/QuoteInfo.tsx +2 -0
  157. package/src/containers/QuoteInfo/QuoteInfo.types.ts +1 -0
  158. package/src/containers/Settings/Lists.tsx +28 -13
  159. package/src/containers/Wallets/Wallets.tsx +27 -10
  160. package/src/containers/Wallets/Wallets.types.ts +13 -2
  161. package/src/containers/Widget/Widget.tsx +13 -13
  162. package/src/hooks/useBootstrap/index.ts +1 -0
  163. package/src/hooks/useBootstrap/useBootstrap.ts +72 -0
  164. package/src/hooks/useScreenDetect.ts +49 -0
  165. package/src/hooks/useSwapInput.ts +7 -2
  166. package/src/hooks/useTheme.ts +1 -8
  167. package/src/hooks/useWalletList.ts +12 -0
  168. package/src/pages/ConfirmSwapPage.tsx +14 -5
  169. package/src/pages/Home.tsx +29 -7
  170. package/src/pages/LanguagePage.tsx +14 -1
  171. package/src/pages/LiquiditySourcePage.tsx +4 -3
  172. package/src/pages/SelectSwapItemsPage.tsx +2 -7
  173. package/src/pages/SettingsPage.tsx +0 -1
  174. package/src/store/slices/config.ts +3 -2
  175. package/src/store/slices/data.ts +82 -34
  176. package/src/store/slices/settings.ts +10 -4
  177. package/src/types/config.ts +9 -5
  178. package/src/utils/colors.ts +106 -75
  179. package/src/utils/common.ts +181 -0
  180. package/src/utils/configs.ts +12 -1
  181. package/src/utils/meta.ts +21 -0
  182. package/src/utils/swap.ts +12 -5
  183. package/src/utils/ui.ts +7 -5
  184. package/src/utils/wallets.ts +5 -47
  185. package/dist/hooks/useMobileDetect.d.ts +0 -3
  186. package/dist/hooks/useMobileDetect.d.ts.map +0 -1
  187. package/src/hooks/useMobileDetect.ts +0 -21
@@ -2,7 +2,7 @@ import type { PropTypes } from './Quotes.types';
2
2
  import type { MultiRouteSimulationResult } from 'rango-sdk';
3
3
 
4
4
  import { i18n } from '@lingui/core';
5
- import { Divider, Typography } from '@rango-dev/ui';
5
+ import { Divider, FullExpandedQuote, Typography } from '@rango-dev/ui';
6
6
  import React from 'react';
7
7
 
8
8
  import { QuoteInfo } from '../../containers/QuoteInfo';
@@ -26,6 +26,7 @@ export function Quotes(props: PropTypes) {
26
26
  fetch,
27
27
  showModalFee,
28
28
  hasSort = true,
29
+ fullExpandedMode = false,
29
30
  } = props;
30
31
  const {
31
32
  selectedQuote,
@@ -66,35 +67,41 @@ export function Quotes(props: PropTypes) {
66
67
 
67
68
  return (
68
69
  <>
70
+ {hasSort && (
71
+ <>
72
+ <StrategyContent>
73
+ <Typography size="xmedium" variant="title">
74
+ {i18n.t('Sort by')}
75
+ </Typography>
76
+ <SelectStrategy container={getContainer()} />
77
+ </StrategyContent>
78
+ <Divider size="10" />
79
+ </>
80
+ )}
81
+
69
82
  {loading &&
70
83
  Array.from({ length: ITEM_SKELETON_COUNT }, (_, index) => (
71
84
  <React.Fragment key={index}>
72
- <QuoteSkeleton
73
- tagHidden={false}
74
- type="list-item"
75
- expanded={false}
76
- />
77
- <Divider size={16} />
85
+ {fullExpandedMode ? (
86
+ <FullExpandedQuote loading />
87
+ ) : (
88
+ <QuoteSkeleton
89
+ tagHidden={false}
90
+ type="list-item"
91
+ expanded={false}
92
+ />
93
+ )}
94
+ {index !== ITEM_SKELETON_COUNT - 1 && <Divider size={16} />}
78
95
  </React.Fragment>
79
96
  ))}
80
97
 
81
98
  {!loading && (
82
99
  <>
83
- {hasSort && (
84
- <>
85
- <StrategyContent>
86
- <Typography size="xmedium" variant="title">
87
- {i18n.t('Sort by')}
88
- </Typography>
89
- <SelectStrategy container={getContainer()} />
90
- </StrategyContent>
91
- <Divider size="10" />
92
- </>
93
- )}
94
100
  {hasQuotes
95
- ? sortQuotes.map((quote) => {
101
+ ? sortQuotes.map((quote, index) => {
96
102
  const quoteWarning = getQuoteWarning(quote);
97
103
  const quoteError = getQuoteError(quote.swaps);
104
+ const lastIndex = sortQuotes.length - 1 === index;
98
105
 
99
106
  return (
100
107
  <React.Fragment key={quote.requestId}>
@@ -106,6 +113,7 @@ export function Quotes(props: PropTypes) {
106
113
  loading={loading}
107
114
  error={quoteError?.options || null}
108
115
  warning={quoteWarning}
116
+ fullExpandedMode={fullExpandedMode}
109
117
  onClick={(quote) => {
110
118
  if (!quoteError) {
111
119
  updateQuotePartialState('warning', quoteWarning);
@@ -118,13 +126,17 @@ export function Quotes(props: PropTypes) {
118
126
  }}
119
127
  type="list-item"
120
128
  />
121
- <Divider size={16} />
129
+ {!lastIndex && <Divider size={16} />}
122
130
  </React.Fragment>
123
131
  );
124
132
  })
125
133
  : showNoResultMessage && (
126
134
  <ErrorsContainer>
127
- <NoResult error={error} fetch={fetch} />
135
+ <NoResult
136
+ size={fullExpandedMode ? 'large' : 'small'}
137
+ error={error}
138
+ fetch={fetch}
139
+ />
128
140
  </ErrorsContainer>
129
141
  )}
130
142
  </>
@@ -6,4 +6,5 @@ export type PropTypes = {
6
6
  fetch: (shouldChangeSelectedQuote?: boolean) => void;
7
7
  showModalFee?: boolean;
8
8
  hasSort?: boolean;
9
+ fullExpandedMode?: boolean;
9
10
  };
@@ -1,9 +1,9 @@
1
1
  import type { PreferenceType } from 'rango-sdk';
2
2
 
3
+ import { i18n } from '@lingui/core';
3
4
  import { Select } from '@rango-dev/ui';
4
5
  import React from 'react';
5
6
 
6
- import { ROUTE_STRATEGY } from '../../constants/quote';
7
7
  import { useQuoteStore } from '../../store/quote';
8
8
 
9
9
  import { SelectContainer } from './Quotes.styles';
@@ -11,22 +11,39 @@ import { SelectContainer } from './Quotes.styles';
11
11
  export function SelectStrategy(props: { container: HTMLElement }) {
12
12
  const { updateQuotePartialState, sortStrategy } = useQuoteStore();
13
13
 
14
+ const ROUTE_STRATEGY: { value: PreferenceType; label: string }[] = [
15
+ {
16
+ value: 'SMART',
17
+ label: i18n.t('Smart Routing'),
18
+ },
19
+ {
20
+ value: 'FEE',
21
+ label: i18n.t('Lowest Fee'),
22
+ },
23
+ {
24
+ value: 'SPEED',
25
+ label: i18n.t('Fastest Transfer'),
26
+ },
27
+ {
28
+ value: 'NET_OUTPUT',
29
+ label: i18n.t('Maximum Return'),
30
+ },
31
+ {
32
+ value: 'PRICE',
33
+ label: i18n.t('Maximum Output'),
34
+ },
35
+ ];
36
+
14
37
  return (
15
38
  <SelectContainer>
16
39
  <Select
17
40
  container={props.container}
18
41
  options={ROUTE_STRATEGY}
19
- value={
20
- ROUTE_STRATEGY.find(
21
- (strategy) => strategy.value === sortStrategy
22
- ) as {
23
- value: PreferenceType;
24
- label: string;
25
- }
26
- }
42
+ value={sortStrategy}
27
43
  handleItemClick={(item) => {
28
- updateQuotePartialState('sortStrategy', item.value as PreferenceType);
44
+ updateQuotePartialState('sortStrategy', item.value);
29
45
  }}
46
+ variant="filled"
30
47
  />
31
48
  </SelectContainer>
32
49
  );
@@ -47,19 +47,17 @@ export function Slippage() {
47
47
  {SLIPPAGES.map((slippageItem, index) => {
48
48
  const key = `slippage-${index}`;
49
49
  return (
50
- <>
51
- <SlippageChip
52
- key={key}
53
- onClick={() => {
54
- if (customSlippage) {
55
- setCustomSlippage(null);
56
- }
57
- setSlippage(slippageItem);
58
- }}
59
- selected={!customSlippage && slippageItem === slippage}
60
- label={`${slippageItem.toString()}%`}
61
- />
62
- </>
50
+ <SlippageChip
51
+ key={key}
52
+ onClick={() => {
53
+ if (customSlippage) {
54
+ setCustomSlippage(null);
55
+ }
56
+ setSlippage(slippageItem);
57
+ }}
58
+ selected={!customSlippage && slippageItem === slippage}
59
+ label={`${slippageItem.toString()}%`}
60
+ />
63
61
  );
64
62
  })}
65
63
  <TextField
@@ -109,9 +109,11 @@ export function SwapDetails(props: SwapDetailsProps) {
109
109
  if (swap.status === 'success' || swap.status === 'failed') {
110
110
  setShowCompletedModal(swap.status);
111
111
  setAsRead(swap.requestId);
112
+ } else if (showCompletedModal) {
113
+ setShowCompletedModal(null);
112
114
  }
113
115
  }
114
- }, [swap.status]);
116
+ }, [swap.status, swap.requestId]);
115
117
 
116
118
  useEffect(() => {
117
119
  if (showSwitchNetwork) {
@@ -1,5 +1,6 @@
1
1
  import type { WalletStateContentProps } from './SwapDetailsModal.types';
2
2
 
3
+ import { debug } from '@rango-dev/logging-core';
3
4
  import { MessageBox, Wallet } from '@rango-dev/ui';
4
5
  import { useWallets } from '@rango-dev/wallets-react';
5
6
  import React from 'react';
@@ -39,7 +40,10 @@ export const WalletStateContent = (props: WalletStateContentProps) => {
39
40
  state={walletState}
40
41
  link={walletInfo.installLink}
41
42
  disabled={walletButtonDisabled}
42
- onClick={async () => connect(walletType)}
43
+ // TODO we need to show an error modal when user reject the connection
44
+ onClick={async () =>
45
+ connect(walletType).catch((error) => debug(error))
46
+ }
43
47
  />
44
48
  </WalletContainer>
45
49
  )}
@@ -19,7 +19,7 @@ import React, { useEffect, useState } from 'react';
19
19
 
20
20
  import { useAppStore } from '../../store/AppStore';
21
21
  import { useWalletsStore } from '../../store/wallets';
22
- import { generateRangeColors } from '../../utils/colors';
22
+ import { generateShade, isBright } from '../../utils/colors';
23
23
  import { formatBalance } from '../../utils/wallets';
24
24
 
25
25
  import { LoadingTokenList } from './LoadingTokenList';
@@ -133,23 +133,24 @@ export function TokenList(props: PropTypes) {
133
133
  const blockchain = blockchains.find(
134
134
  (blockchain) => blockchain.name === token.blockchain
135
135
  );
136
- const color = generateRangeColors(
137
- token.symbol,
138
- blockchain?.color || ''
136
+ const lightShade = generateShade(
137
+ blockchain?.color || '',
138
+ isBright(blockchain?.color || '') ? 5 : 125
139
139
  );
140
+ const darkShade = generateShade(blockchain?.color || '', -100);
140
141
 
141
142
  const customCssForTag = {
142
- $$color: color[`${token.symbol}100`],
143
+ $$color: lightShade,
143
144
  [`.${darkTheme} &`]: {
144
- $$color: color[`${token.symbol}900`],
145
+ $$color: darkShade,
145
146
  },
146
147
  backgroundColor: '$$color',
147
148
  };
148
149
 
149
150
  const customCssForTagTitle = {
150
- $$color: color[`${token.symbol}700`],
151
+ $$color: darkShade,
151
152
  [`.${darkTheme} &`]: {
152
- $$color: color[`${token.symbol}100`],
153
+ $$color: lightShade,
153
154
  },
154
155
  color: '$$color',
155
156
  };
@@ -31,7 +31,7 @@ export const errorMessages = () => {
31
31
  impactTitle: i18n.t('High Price Impact'),
32
32
  title: i18n.t('Price impact is too high!'),
33
33
  description: i18n.t(
34
- 'The price impact is significantly higher than the allowed amount. If you are sure, continue, otherwise, change the swap.'
34
+ 'The price impact is significantly higher than the allowed amount.'
35
35
  ),
36
36
  confirmMessage: i18n.t('Confirm high price impact'),
37
37
  },
@@ -2,7 +2,7 @@ import { UI_ID } from '@rango-dev/ui';
2
2
 
3
3
  export const RANGO_PUBLIC_API_KEY = 'c6381a79-2817-4602-83bf-6a641a409e32';
4
4
  export const DEFAULT_BASE_URL = 'https://api.rango.exchange';
5
- export const SCANNER_BASE_URL = 'https://scan.rango.exchange';
5
+ export const SCANNER_BASE_URL = 'https://explorer.rango.exchange';
6
6
 
7
7
  export const WIDGET_UI_ID = {
8
8
  SWAP_BOX_ID: 'rango-swap-box',
@@ -1,6 +1,22 @@
1
1
  import type { FlagPropTypes, Language } from '@rango-dev/ui';
2
2
 
3
- import { English, French, Japanese, Portuguese, Spanish } from '@rango-dev/ui';
3
+ import {
4
+ Chinese,
5
+ English,
6
+ Finland,
7
+ French,
8
+ German,
9
+ Greece,
10
+ Italian,
11
+ Japanese,
12
+ Netherlands,
13
+ Poland,
14
+ Portuguese,
15
+ Russian,
16
+ Spanish,
17
+ Swedish,
18
+ Ukrainian,
19
+ } from '@rango-dev/ui';
4
20
 
5
21
  export type LanguageItem = {
6
22
  title: string;
@@ -15,6 +31,16 @@ export const LANGUAGES: LanguageItem[] = [
15
31
  { title: 'French', label: 'Français', local: 'fr', SVGFlag: French },
16
32
  { title: 'Japanese', label: '日本語', local: 'ja', SVGFlag: Japanese },
17
33
  { title: 'Portuguese', label: 'Português', local: 'pt', SVGFlag: Portuguese },
34
+ { title: 'Chinese', label: '中国人', local: 'zh', SVGFlag: Chinese },
35
+ { title: 'Russian', label: 'Русский', local: 'ru', SVGFlag: Russian },
36
+ { title: 'German', label: 'Deutsch', local: 'de', SVGFlag: German },
37
+ { title: 'Ukrainian', label: 'Україні', local: 'uk', SVGFlag: Ukrainian },
38
+ { title: 'Swedish', label: 'svenska', local: 'sv', SVGFlag: Swedish },
39
+ { title: 'Finnish', label: 'Suomalainen', local: 'fi', SVGFlag: Finland },
40
+ { title: 'Dutch', label: 'Nederlands', local: 'nl', SVGFlag: Netherlands },
41
+ { title: 'Greek', label: 'Grieks', local: 'el', SVGFlag: Greece },
42
+ { title: 'Italian', label: 'Italiana', local: 'it', SVGFlag: Italian },
43
+ { title: 'Polish', label: 'Polski', local: 'pl', SVGFlag: Poland },
18
44
  ];
19
45
 
20
46
  export const DEFAULT_LANGUAGE = 'en';
@@ -1,4 +1,4 @@
1
- import type { PreferenceType, SwapFee, TagValue } from 'rango-sdk';
1
+ import type { SwapFee, TagValue } from 'rango-sdk';
2
2
 
3
3
  import { i18n } from '@lingui/core';
4
4
 
@@ -22,29 +22,6 @@ export type FeesGroup = {
22
22
  nonePayable: { [key in NameOfFees]?: SwapFee[] };
23
23
  };
24
24
 
25
- export const ROUTE_STRATEGY: { value: PreferenceType; label: string }[] = [
26
- {
27
- value: 'SMART',
28
- label: i18n.t('Smart Routing'),
29
- },
30
- {
31
- value: 'FEE',
32
- label: i18n.t('Lowest Fee'),
33
- },
34
- {
35
- value: 'SPEED',
36
- label: i18n.t('Fastest Transfer'),
37
- },
38
- {
39
- value: 'NET_OUTPUT',
40
- label: i18n.t('Maximum Return'),
41
- },
42
- {
43
- value: 'PRICE',
44
- label: i18n.t('Maximum Output'),
45
- },
46
- ];
47
-
48
25
  export const HIGH_PRIORITY_TAGS: TagValue[] = [
49
26
  'RECOMMENDED',
50
27
  'CENTRALIZED',
@@ -0,0 +1,6 @@
1
+ export const MIN_LENGTH_SYMBOL_EXACT_MATCH = 1;
2
+ export const MIN_LENGTH_SYMBOL_START_WITH = 2;
3
+ export const MIN_LENGTH_SYMBOL_CONTAINS = 3;
4
+ export const MIN_LENGTH_TOKEN_NAME_EXACT_MATCH = 3;
5
+ export const MIN_LENGTH_TOKEN_NAME_CONTAINS = 3;
6
+ export const MIN_LENGTH_TOKEN_ADDRESS_CONTAINS = 4;
@@ -1,13 +1,9 @@
1
1
  import { styled } from '@rango-dev/ui';
2
2
 
3
3
  export const MainContainer = styled('div', {
4
- display: 'flex',
5
- justifyContent: 'center',
6
- alignItems: 'center',
7
4
  fontFamily: '$widget',
8
5
  boxSizing: 'border-box',
9
6
  textAlign: 'left',
10
-
11
7
  '& *, *::before, *::after': {
12
8
  boxSizing: 'inherit',
13
9
  },
@@ -1,50 +1,26 @@
1
- import type { WalletType } from '@rango-dev/wallets-shared';
2
-
3
1
  import { I18nManager } from '@rango-dev/ui';
4
- import React, { useContext, useEffect, useState } from 'react';
2
+ import React from 'react';
5
3
 
6
- import { AppRouter } from '../../components/AppRouter';
7
4
  import { AppRoutes } from '../../components/AppRoutes';
8
5
  import { WidgetEvents } from '../../components/WidgetEvents';
9
- import { globalFont } from '../../globalStyles';
10
- import { useFetchApiConfig } from '../../hooks/useFetchApiConfig';
6
+ import { useBootstrap } from '../../hooks/useBootstrap';
11
7
  import { useLanguage } from '../../hooks/useLanguage';
12
8
  import { useTheme } from '../../hooks/useTheme';
13
9
  import { useAppStore } from '../../store/AppStore';
14
- import { useNotificationStore } from '../../store/notification';
15
- import { WidgetContext } from '../Wallets';
16
10
 
17
11
  import { MainContainer } from './App.styles';
18
12
 
19
13
  export function Main() {
20
- globalFont();
21
-
14
+ useBootstrap();
22
15
  const { config } = useAppStore();
23
16
  const { activeTheme } = useTheme(config?.theme || {});
24
17
  const { activeLanguage } = useLanguage();
25
- const [lastConnectedWalletWithNetwork, setLastConnectedWalletWithNetwork] =
26
- useState<string>('');
27
- const [disconnectedWallet, setDisconnectedWallet] = useState<WalletType>();
28
- const widgetContext = useContext(WidgetContext);
29
- const { fetchApiConfig } = useFetchApiConfig();
30
- useEffect(() => {
31
- void useNotificationStore.persist.rehydrate();
32
- widgetContext.onConnectWallet(setLastConnectedWalletWithNetwork);
33
- void fetchApiConfig().catch(console.log);
34
- }, []);
35
18
 
36
19
  return (
37
20
  <I18nManager language={activeLanguage}>
38
21
  <MainContainer id="swap-container" className={activeTheme()}>
39
22
  <WidgetEvents />
40
- <AppRouter
41
- lastConnectedWallet={lastConnectedWalletWithNetwork}
42
- disconnectedWallet={disconnectedWallet}
43
- clearDisconnectedWallet={() => {
44
- setDisconnectedWallet(undefined);
45
- }}>
46
- <AppRoutes />
47
- </AppRouter>
23
+ <AppRoutes />
48
24
  </MainContainer>
49
25
  </I18nManager>
50
26
  );
@@ -10,8 +10,21 @@ export const Container = styled('div', {
10
10
  [`.${darkTheme} &`]: {
11
11
  backgroundColor: '$neutral300',
12
12
  },
13
+
14
+ variants: {
15
+ expandMode: {
16
+ default: {
17
+ width: '390px',
18
+ },
19
+ full: {
20
+ width: '719px',
21
+ },
22
+ },
23
+ },
24
+
13
25
  '&.is-hidden': {
14
26
  width: 0,
27
+ height: 0,
15
28
  opacity: 0,
16
29
  marginLeft: 0,
17
30
  },
@@ -9,6 +9,7 @@ import { LayoutContainer } from '../../components/Layout/Layout.styles';
9
9
  import { Quotes } from '../../components/Quotes';
10
10
  import { SelectStrategy } from '../../components/Quotes/SelectStrategy';
11
11
  import { WIDGET_UI_ID } from '../../constants';
12
+ import { useAppStore } from '../../store/AppStore';
12
13
  import { getExpanded } from '../../utils/common';
13
14
 
14
15
  import { Container, Content } from './ExpandedQuotes.styles';
@@ -19,6 +20,8 @@ export function ExpandedQuotes(props: PropTypes) {
19
20
  const { fetch, loading, onClickOnQuote, onClickRefresh, isVisible } = props;
20
21
  const [isDelayedVisible, setIsDelayedVisible] = useState(false);
21
22
  const containerClass = isDelayedVisible ? '' : 'is-hidden';
23
+ const { config } = useAppStore();
24
+ const fullExpandedMode = config?.variant === 'full-expanded';
22
25
 
23
26
  useEffect(() => {
24
27
  let timeout: ReturnType<typeof setTimeout> | null = null;
@@ -43,6 +46,7 @@ export function ExpandedQuotes(props: PropTypes) {
43
46
 
44
47
  return (
45
48
  <Container
49
+ expandMode={config?.variant === 'full-expanded' ? 'full' : 'default'}
46
50
  className={`${containerClass} ${LayoutContainer()}`}
47
51
  id={WIDGET_UI_ID.EXPANDED_BOX_ID}>
48
52
  <Header
@@ -64,6 +68,7 @@ export function ExpandedQuotes(props: PropTypes) {
64
68
  hasSort={false}
65
69
  loading={loading}
66
70
  onClickOnQuote={onClickOnQuote}
71
+ fullExpandedMode={fullExpandedMode}
67
72
  />
68
73
  </Content>
69
74
  </Container>
@@ -25,7 +25,7 @@ import { formatBalance, isFetchingBalance } from '../../utils/wallets';
25
25
  import { Container, FromContainer } from './Inputs.styles';
26
26
 
27
27
  export function Inputs(props: PropTypes) {
28
- const { fetchingQuote, fetchMetaStatus, onClickToken } = props;
28
+ const { fetchingQuote, fetchMetaStatus, onClickToken, isExpandable } = props;
29
29
  const {
30
30
  fromToken,
31
31
  fromBlockchain,
@@ -39,7 +39,6 @@ export function Inputs(props: PropTypes) {
39
39
  selectedQuote,
40
40
  } = useQuoteStore();
41
41
  const { connectedWallets, getBalanceFor } = useWalletsStore();
42
-
43
42
  const fromTokenBalance = fromToken ? getBalanceFor(fromToken) : null;
44
43
 
45
44
  const fromTokenFormattedBalance =
@@ -116,7 +115,7 @@ export function Inputs(props: PropTypes) {
116
115
  <SwitchFromAndToButton />
117
116
  </FromContainer>
118
117
  <SwapInput
119
- sharpBottomStyle={!!selectedQuote || fetchingQuote}
118
+ sharpBottomStyle={!isExpandable && (!!selectedQuote || fetchingQuote)}
120
119
  label={i18n.t('To')}
121
120
  mode="To"
122
121
  fetchingQuote={fetchingQuote}
@@ -4,4 +4,5 @@ export type PropTypes = {
4
4
  fetchingQuote: boolean;
5
5
  fetchMetaStatus: FetchStatus;
6
6
  onClickToken: (mode: 'from' | 'to') => void;
7
+ isExpandable?: boolean;
7
8
  };
@@ -25,6 +25,7 @@ export function QuoteInfo(props: PropTypes) {
25
25
  showModalFee,
26
26
  selected,
27
27
  onClickAllRoutes,
28
+ fullExpandedMode = false,
28
29
  } = props;
29
30
  const { inputAmount, inputUsdValue, toToken } = useQuoteStore();
30
31
 
@@ -65,6 +66,7 @@ export function QuoteInfo(props: PropTypes) {
65
66
  type={type}
66
67
  expanded={expanded}
67
68
  onClickAllRoutes={onClickAllRoutes}
69
+ fullExpandedMode={fullExpandedMode}
68
70
  input={{
69
71
  value: inputAmount,
70
72
  usdValue: inputUsdValue?.toString() ?? '',
@@ -14,4 +14,5 @@ export type PropTypes = {
14
14
  onClickAllRoutes?: () => void;
15
15
  selected?: boolean;
16
16
  showModalFee?: boolean;
17
+ fullExpandedMode?: boolean;
17
18
  };