@rango-dev/widget-embedded 0.23.1-next.0 → 0.23.1-next.2

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 (101) hide show
  1. package/dist/components/Layout/Layout.styles.d.ts +162 -0
  2. package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
  3. package/dist/components/NoResult/NoResult.d.ts.map +1 -1
  4. package/dist/components/NoResult/NoResult.styles.d.ts.map +1 -1
  5. package/dist/components/Quote/Quote.d.ts.map +1 -1
  6. package/dist/components/Quote/Quote.types.d.ts +2 -0
  7. package/dist/components/Quote/Quote.types.d.ts.map +1 -1
  8. package/dist/components/Quote/QuoteCostDetails.d.ts.map +1 -1
  9. package/dist/components/Quote/{QuoteTrigger .d.ts → QuoteTrigger.d.ts} +1 -1
  10. package/dist/components/Quote/QuoteTrigger.d.ts.map +1 -0
  11. package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +1 -1
  12. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts +0 -1
  13. package/dist/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.d.ts.map +1 -1
  14. package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +1 -1
  15. package/dist/components/Quotes/Quotes.d.ts +4 -0
  16. package/dist/components/Quotes/Quotes.d.ts.map +1 -0
  17. package/dist/components/Quotes/Quotes.styles.d.ts +487 -0
  18. package/dist/components/Quotes/Quotes.styles.d.ts.map +1 -0
  19. package/dist/components/Quotes/Quotes.types.d.ts +9 -0
  20. package/dist/components/Quotes/Quotes.types.d.ts.map +1 -0
  21. package/dist/components/Quotes/SelectStrategy.d.ts +5 -0
  22. package/dist/components/Quotes/SelectStrategy.d.ts.map +1 -0
  23. package/dist/components/Quotes/index.d.ts +2 -0
  24. package/dist/components/Quotes/index.d.ts.map +1 -0
  25. package/dist/constants/index.d.ts +1 -0
  26. package/dist/constants/index.d.ts.map +1 -1
  27. package/dist/constants/quote.d.ts +4 -3
  28. package/dist/constants/quote.d.ts.map +1 -1
  29. package/dist/containers/ExpandedQuotes/ExpandedQuotes.d.ts +5 -0
  30. package/dist/containers/ExpandedQuotes/ExpandedQuotes.d.ts.map +1 -0
  31. package/dist/containers/ExpandedQuotes/ExpandedQuotes.styles.d.ts +325 -0
  32. package/dist/containers/ExpandedQuotes/ExpandedQuotes.styles.d.ts.map +1 -0
  33. package/dist/containers/ExpandedQuotes/ExpandedQuotes.types.d.ts +9 -0
  34. package/dist/containers/ExpandedQuotes/ExpandedQuotes.types.d.ts.map +1 -0
  35. package/dist/containers/ExpandedQuotes/index.d.ts +2 -0
  36. package/dist/containers/ExpandedQuotes/index.d.ts.map +1 -0
  37. package/dist/containers/Inputs/Inputs.d.ts +4 -0
  38. package/dist/containers/Inputs/Inputs.d.ts.map +1 -0
  39. package/dist/containers/Inputs/Inputs.styles.d.ts +325 -0
  40. package/dist/containers/Inputs/Inputs.styles.d.ts.map +1 -0
  41. package/dist/containers/Inputs/Inputs.types.d.ts +7 -0
  42. package/dist/containers/Inputs/Inputs.types.d.ts.map +1 -0
  43. package/dist/containers/Inputs/index.d.ts +2 -0
  44. package/dist/containers/Inputs/index.d.ts.map +1 -0
  45. package/dist/containers/QuoteInfo/QuoteInfo.d.ts.map +1 -1
  46. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts +1 -0
  47. package/dist/containers/QuoteInfo/QuoteInfo.types.d.ts.map +1 -1
  48. package/dist/hooks/useMobileDetect.d.ts +3 -0
  49. package/dist/hooks/useMobileDetect.d.ts.map +1 -0
  50. package/dist/hooks/useSwapInput.d.ts.map +1 -1
  51. package/dist/index.d.ts +2 -2
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +2 -2
  54. package/dist/index.js.map +4 -4
  55. package/dist/pages/ConfirmSwapPage.d.ts.map +1 -1
  56. package/dist/pages/Home.d.ts +1 -0
  57. package/dist/pages/Home.d.ts.map +1 -1
  58. package/dist/pages/Routes.d.ts.map +1 -1
  59. package/dist/types/config.d.ts +5 -0
  60. package/dist/types/config.d.ts.map +1 -1
  61. package/dist/utils/common.d.ts +1 -0
  62. package/dist/utils/common.d.ts.map +1 -1
  63. package/package.json +3 -3
  64. package/src/components/Layout/Layout.styles.ts +9 -7
  65. package/src/components/Layout/Layout.tsx +2 -2
  66. package/src/components/NoResult/NoResult.styles.ts +0 -2
  67. package/src/components/NoResult/NoResult.tsx +1 -0
  68. package/src/components/Quote/Quote.styles.ts +1 -1
  69. package/src/components/Quote/Quote.tsx +4 -2
  70. package/src/components/Quote/Quote.types.ts +2 -0
  71. package/src/components/Quote/QuoteCostDetails.tsx +10 -6
  72. package/src/components/Quote/{QuoteTrigger .tsx → QuoteTrigger.tsx} +3 -16
  73. package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +15 -12
  74. package/src/components/QuoteWarningsAndErrors/QuoteWarningsAndErrors.types.ts +0 -1
  75. package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +16 -13
  76. package/src/components/Quotes/Quotes.styles.ts +18 -0
  77. package/src/components/Quotes/Quotes.tsx +134 -0
  78. package/src/components/Quotes/Quotes.types.ts +9 -0
  79. package/src/components/Quotes/SelectStrategy.tsx +33 -0
  80. package/src/components/Quotes/index.ts +1 -0
  81. package/src/constants/index.ts +1 -0
  82. package/src/constants/quote.ts +22 -7
  83. package/src/containers/ExpandedQuotes/ExpandedQuotes.styles.ts +30 -0
  84. package/src/containers/ExpandedQuotes/ExpandedQuotes.tsx +71 -0
  85. package/src/containers/ExpandedQuotes/ExpandedQuotes.types.ts +9 -0
  86. package/src/containers/ExpandedQuotes/index.ts +1 -0
  87. package/src/containers/Inputs/Inputs.styles.ts +12 -0
  88. package/src/containers/Inputs/Inputs.tsx +165 -0
  89. package/src/containers/Inputs/Inputs.types.ts +7 -0
  90. package/src/containers/Inputs/index.ts +1 -0
  91. package/src/containers/QuoteInfo/QuoteInfo.tsx +2 -0
  92. package/src/containers/QuoteInfo/QuoteInfo.types.ts +1 -0
  93. package/src/hooks/useMobileDetect.ts +21 -0
  94. package/src/hooks/useSwapInput.ts +3 -1
  95. package/src/index.ts +2 -0
  96. package/src/pages/ConfirmSwapPage.tsx +0 -1
  97. package/src/pages/Home.tsx +142 -229
  98. package/src/pages/Routes.tsx +6 -69
  99. package/src/types/config.ts +6 -0
  100. package/src/utils/common.ts +3 -0
  101. package/dist/components/Quote/QuoteTrigger .d.ts.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"ConfirmSwapPage.d.ts","sourceRoot":"","sources":["../../src/pages/ConfirmSwapPage.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAmD5E,wBAAgB,eAAe,sBA+T9B"}
1
+ {"version":3,"file":"ConfirmSwapPage.d.ts","sourceRoot":"","sources":["../../src/pages/ConfirmSwapPage.tsx"],"names":[],"mappings":"AAoBA,OAAO,KAAuD,MAAM,OAAO,CAAC;AAmD5E,wBAAgB,eAAe,sBA8T9B"}
@@ -1,3 +1,4 @@
1
1
  import React from 'react';
2
+ export declare const TIME_TO_NAVIGATE_ANOTHER_PAGE = 300;
2
3
  export declare function Home(): React.JSX.Element;
3
4
  //# sourceMappingURL=Home.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAuCnD,wBAAgB,IAAI,sBAgQnB"}
1
+ {"version":3,"file":"Home.d.ts","sourceRoot":"","sources":["../../src/pages/Home.tsx"],"names":[],"mappings":"AAEA,OAAO,KAA8B,MAAM,OAAO,CAAC;AAwBnD,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAEjD,wBAAgB,IAAI,sBAsLnB"}
@@ -1 +1 @@
1
- {"version":3,"file":"Routes.d.ts","sourceRoot":"","sources":["../../src/pages/Routes.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,MAAM,OAAO,CAAC;AAgB1B,wBAAgB,UAAU,sBA6GzB"}
1
+ {"version":3,"file":"Routes.d.ts","sourceRoot":"","sources":["../../src/pages/Routes.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,MAAM,OAAO,CAAC;AAW1B,wBAAgB,UAAU,sBAqDzB"}
@@ -2,6 +2,7 @@ import type { Language } from '@rango-dev/ui';
2
2
  import type { ProviderInterface } from '@rango-dev/wallets-react';
3
3
  import type { WalletType } from '@rango-dev/wallets-shared';
4
4
  import type { Asset } from 'rango-sdk';
5
+ export type WidgetVariant = 'default' | 'expandable';
5
6
  /**
6
7
  * The above type defines a set of optional color properties for a widget.
7
8
  * @property {string} background
@@ -168,6 +169,9 @@ export type Features = Partial<Record<'theme' | 'language' | 'connectWalletButto
168
169
  * - 'connectWalletButton': Visibility state for the wallet connect icon.
169
170
  * - 'language': Visibility state for the language.
170
171
  * - 'experimentalRoute': Enablement state for the experimental route.
172
+ * @property {WidgetVariant} variant
173
+ * If it is expandable, multiple routes will show up on the home page;
174
+ * if not, you will need to go to a different page to see the suggested routes.
171
175
  */
172
176
  export type WidgetConfig = {
173
177
  apiKey: string;
@@ -187,5 +191,6 @@ export type WidgetConfig = {
187
191
  externalWallets?: boolean;
188
192
  enableNewLiquiditySources?: boolean;
189
193
  features?: Features;
194
+ variant?: WidgetVariant;
190
195
  };
191
196
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/types/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC5D,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,WAAW,CAAC;AAEvC;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB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gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,OAAO,CAAC,EAAE,CAAC,UAAU,GAAG,iBAAiB,CAAC,EAAE,CAAC;IAC7C,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,KAAK,CAAC,EAAE,WAAW,CAAC;IACpB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,OAAO,CAAC,EAAE,aAAa,CAAC;CACzB,CAAC"}
@@ -3,4 +3,5 @@ export declare function areEqual(array1: (number | string)[], array2: (number |
3
3
  export declare function debounce(fn: Function, time: number): (...args: any) => void;
4
4
  export declare function containsText(text: string, searchText: string): boolean;
5
5
  export declare const getContainer: () => HTMLElement;
6
+ export declare const getExpanded: () => HTMLElement;
6
7
  //# sourceMappingURL=common.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAEA,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAEtD;AAED,wBAAgB,QAAQ,CACtB,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAC3B,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,WAK5B;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,aAGvB,GAAG,UAS9B;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAGtE;AAED,eAAO,MAAM,YAAY,mBACyC,CAAC"}
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../src/utils/common.ts"],"names":[],"mappings":"AAEA,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,CAAC,EAAE,CAEtD;AAED,wBAAgB,QAAQ,CACtB,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAC3B,MAAM,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,WAK5B;AAED,wBAAgB,QAAQ,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,aAGvB,GAAG,UAS9B;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAGtE;AAED,eAAO,MAAM,YAAY,mBACyC,CAAC;AAEnE,eAAO,MAAM,WAAW,mBAC8C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rango-dev/widget-embedded",
3
- "version": "0.23.1-next.0",
3
+ "version": "0.23.1-next.2",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "source": "./src/index.ts",
@@ -23,9 +23,9 @@
23
23
  "@lingui/react": "4.2.1",
24
24
  "@rango-dev/provider-all": "^0.28.0",
25
25
  "@rango-dev/queue-manager-core": "^0.26.0",
26
- "@rango-dev/queue-manager-rango-preset": "^0.28.0",
26
+ "@rango-dev/queue-manager-rango-preset": "^0.28.1-next.0",
27
27
  "@rango-dev/queue-manager-react": "^0.26.0",
28
- "@rango-dev/ui": "^0.29.1-next.0",
28
+ "@rango-dev/ui": "^0.29.1-next.1",
29
29
  "@rango-dev/wallets-react": "^0.14.0",
30
30
  "@rango-dev/wallets-shared": "^0.28.0",
31
31
  "bignumber.js": "^9.1.1",
@@ -1,19 +1,21 @@
1
- import { styled } from '@rango-dev/ui';
1
+ import { css, styled } from '@rango-dev/ui';
2
2
 
3
3
  const WIDGET_HEIGHT = '700px';
4
4
 
5
- export const Container = styled('div', {
6
- position: 'relative',
5
+ export const LayoutContainer = css({
6
+ borderRadius: '$primary',
7
7
  display: 'flex',
8
8
  flexDirection: 'column',
9
- borderRadius: '$primary',
9
+ overflow: 'hidden',
10
+ boxShadow: '15px 15px 15px 0px rgba(0, 0, 0, 0.05)',
11
+ });
12
+
13
+ export const Container = styled('div', {
14
+ position: 'relative',
10
15
  width: '100vw',
11
16
  minWidth: '300px',
12
17
  maxWidth: '390px',
13
- boxShadow: '15px 15px 15px 0px rgba(0, 0, 0, 0.05)',
14
- overflow: 'hidden',
15
18
  backgroundColor: '$background',
16
-
17
19
  variants: {
18
20
  height: {
19
21
  auto: {
@@ -22,7 +22,7 @@ import { ActivateTabModal } from '../common/ActivateTabModal';
22
22
  import { BackButton, CancelButton, WalletButton } from '../HeaderButtons';
23
23
 
24
24
  import { onScrollContentAttachStatusToContainer } from './Layout.helpers';
25
- import { Container, Content, Footer } from './Layout.styles';
25
+ import { Container, Content, Footer, LayoutContainer } from './Layout.styles';
26
26
 
27
27
  function Layout(props: PropsWithChildren<PropTypes>) {
28
28
  const { connectHeightObserver, disconnectHeightObserver } = useIframe();
@@ -98,7 +98,7 @@ function Layout(props: PropsWithChildren<PropTypes>) {
98
98
  <Container
99
99
  height={height}
100
100
  id={WIDGET_UI_ID.SWAP_BOX_ID}
101
- className={activeTheme()}
101
+ className={`${activeTheme()} ${LayoutContainer()}`}
102
102
  ref={containerRef}>
103
103
  <Header
104
104
  prefix={
@@ -1,11 +1,9 @@
1
1
  import { styled } from '@rango-dev/ui';
2
2
 
3
3
  export const Container = styled('div', {
4
- minHeight: '162px',
5
4
  display: 'flex',
6
5
  flexDirection: 'column',
7
6
  alignItems: 'center',
8
- justifyContent: 'center',
9
7
  });
10
8
 
11
9
  export const Footer = styled('div', {
@@ -52,6 +52,7 @@ export function NoResult(props: PropTypes) {
52
52
  <Alert
53
53
  type={info.alert.type}
54
54
  title={info.alert.text}
55
+ titleAlign={'center'}
55
56
  action={
56
57
  info.alert.action && (
57
58
  <Button
@@ -123,7 +123,7 @@ export const SummaryContainer = styled('div', {
123
123
  listItem: true,
124
124
  selected: true,
125
125
  css: {
126
- border: '1px solid $secondary',
126
+ outline: '1px solid $secondary',
127
127
  },
128
128
  },
129
129
  {
@@ -69,7 +69,7 @@ import {
69
69
  } from './Quote.styles';
70
70
  import { QuoteCostDetails } from './QuoteCostDetails';
71
71
  import { QuoteSummary } from './QuoteSummary';
72
- import { QuoteTrigger } from './QuoteTrigger ';
72
+ import { QuoteTrigger } from './QuoteTrigger';
73
73
 
74
74
  export function Quote(props: QuoteProps) {
75
75
  const {
@@ -81,6 +81,7 @@ export function Quote(props: QuoteProps) {
81
81
  type,
82
82
  selected = false,
83
83
  tagHidden = true,
84
+ showModalFee = true,
84
85
  onClickAllRoutes,
85
86
  } = props;
86
87
  const blockchains = useAppStore().blockchains();
@@ -323,11 +324,12 @@ export function Quote(props: QuoteProps) {
323
324
  ) : null}
324
325
  <div id="portal-root" className={summaryHeaderStyles()}>
325
326
  <QuoteCostDetails
326
- steps={numberOfSteps}
327
327
  quote={quote}
328
328
  time={totalTime}
329
329
  fee={fee}
330
330
  feeWarning={totalFee.gte(new BigNumber(GAS_FEE_MAX))}
331
+ showModalFee={showModalFee}
332
+ steps={numberOfSteps}
331
333
  />
332
334
 
333
335
  {showAllRoutesButton && (
@@ -12,6 +12,7 @@ export type QuoteProps = {
12
12
  expanded?: boolean;
13
13
  tagHidden?: boolean;
14
14
  selected?: boolean;
15
+ showModalFee?: boolean;
15
16
  onClickAllRoutes?: () => void;
16
17
  };
17
18
 
@@ -43,4 +44,5 @@ export type QuoteCostDetailsProps = {
43
44
  fee: string;
44
45
  time: string;
45
46
  feeWarning?: boolean;
47
+ showModalFee: boolean;
46
48
  };
@@ -57,7 +57,7 @@ const NonPayableFee = (props: { fee: BigNumber; label: string }) => {
57
57
  export function QuoteCostDetails(props: QuoteCostDetailsProps) {
58
58
  const [open, setOpen] = useState<boolean>(false);
59
59
  const [openCollapse, setOpenCollapse] = useState<boolean>(false);
60
- const { steps, quote, fee, time, feeWarning } = props;
60
+ const { steps, quote, fee, time, feeWarning, showModalFee } = props;
61
61
  const swaps = quote?.swaps ?? [];
62
62
  const container = getContainer();
63
63
 
@@ -66,15 +66,19 @@ export function QuoteCostDetails(props: QuoteCostDetailsProps) {
66
66
  return (
67
67
  <>
68
68
  <QuoteCost
69
- onClickFee={(e) => {
70
- e.stopPropagation();
71
- setOpen(!open);
72
- }}
69
+ onClickFee={
70
+ showModalFee
71
+ ? (e) => {
72
+ e.stopPropagation();
73
+ setOpen(!open);
74
+ }
75
+ : undefined
76
+ }
73
77
  fee={fee}
74
78
  feeWarning={feeWarning}
75
79
  time={time}
76
80
  steps={steps}
77
- tooltipGas={i18n.t('View more info')}
81
+ tooltipGas={showModalFee ? i18n.t('View more info') : undefined}
78
82
  tooltipContainer={container}
79
83
  />
80
84
 
@@ -9,8 +9,9 @@ import {
9
9
  Tooltip,
10
10
  Typography,
11
11
  } from '@rango-dev/ui';
12
- import React, { useEffect, useState } from 'react';
12
+ import React from 'react';
13
13
 
14
+ import useMobileDetect from '../../hooks/useMobileDetect';
14
15
  import { getContainer } from '../../utils/common';
15
16
  import { getUniqueBlockchains } from '../../utils/quote';
16
17
 
@@ -24,7 +25,6 @@ import {
24
25
 
25
26
  const MAX_STEPS = 4;
26
27
  const MAX_BLOCKCHAINS = 6;
27
- const MIN_WIDTH_WINDOW = 375;
28
28
 
29
29
  const ImageComponent = (props: QuoteTriggerImagesProps) => {
30
30
  const tooltipContainer = getContainer();
@@ -48,20 +48,7 @@ export function QuoteTrigger(props: QuoteTriggerProps) {
48
48
  const tooltipContainer = getContainer();
49
49
  const numberOfSteps = steps.length;
50
50
  const blockchains = getUniqueBlockchains(steps);
51
- const [isMobile, setIsMobile] = useState(false);
52
-
53
- //choose the screen size
54
- const handleResize = () => {
55
- if (window.innerWidth < MIN_WIDTH_WINDOW) {
56
- setIsMobile(true);
57
- } else {
58
- setIsMobile(false);
59
- }
60
- };
61
-
62
- useEffect(() => {
63
- window.addEventListener('resize', handleResize);
64
- });
51
+ const isMobile = useMobileDetect();
65
52
 
66
53
  return (
67
54
  <Trigger
@@ -75,7 +75,21 @@ export function HighValueLossWarningModal(props: Props) {
75
75
  ];
76
76
 
77
77
  return (
78
- <WatermarkedModal open={open} onClose={onClose} container={getContainer()}>
78
+ <WatermarkedModal
79
+ footer={
80
+ <Button
81
+ type="primary"
82
+ size="large"
83
+ prefix={<WarningIcon />}
84
+ fullWidth
85
+ disabled={confirmationDisabled}
86
+ onClick={onConfirm}>
87
+ {errorMessages().highValueLossError.confirmMessage}
88
+ </Button>
89
+ }
90
+ open={open}
91
+ onClose={onClose}
92
+ container={getContainer()}>
79
93
  <MessageBox
80
94
  type={type}
81
95
  title={errorMessages().highValueLossError.impactTitle}
@@ -94,17 +108,6 @@ export function HighValueLossWarningModal(props: Props) {
94
108
  })}
95
109
  </Flex>
96
110
  </Flex>
97
-
98
- <Divider size={32} />
99
- <Button
100
- type="primary"
101
- size="large"
102
- prefix={<WarningIcon />}
103
- fullWidth
104
- disabled={confirmationDisabled}
105
- onClick={onConfirm}>
106
- {errorMessages().highValueLossError.confirmMessage}
107
- </Button>
108
111
  </WatermarkedModal>
109
112
  );
110
113
  }
@@ -1,7 +1,6 @@
1
1
  import type { QuoteError, QuoteWarning } from '../../types';
2
2
 
3
3
  export interface PropTypes {
4
- loading: boolean;
5
4
  error: QuoteError | null;
6
5
  warning: QuoteWarning | null;
7
6
  showWarningModal: boolean;
@@ -1,6 +1,6 @@
1
1
  import type { UnknownPriceWarning } from '../../types';
2
2
 
3
- import { Button, Divider, MessageBox, WarningIcon } from '@rango-dev/ui';
3
+ import { Button, MessageBox, WarningIcon } from '@rango-dev/ui';
4
4
  import React from 'react';
5
5
 
6
6
  import { errorMessages } from '../../constants/errors';
@@ -18,23 +18,26 @@ type Props = {
18
18
  export function UnknownPriceWarningModal(props: Props) {
19
19
  const { open, onClose, onConfirm, confirmationDisabled } = props;
20
20
  return (
21
- <WatermarkedModal open={open} onClose={onClose} container={getContainer()}>
21
+ <WatermarkedModal
22
+ footer={
23
+ <Button
24
+ type="primary"
25
+ size="large"
26
+ prefix={<WarningIcon />}
27
+ fullWidth
28
+ disabled={confirmationDisabled}
29
+ onClick={onConfirm}>
30
+ {errorMessages().unknownPriceError.confirmMessage}
31
+ </Button>
32
+ }
33
+ open={open}
34
+ onClose={onClose}
35
+ container={getContainer()}>
22
36
  <MessageBox
23
37
  type="warning"
24
38
  title={errorMessages().unknownPriceError.impactTitle}
25
39
  description={errorMessages().unknownPriceError.description}
26
40
  />
27
-
28
- <Divider size={32} />
29
- <Button
30
- type="primary"
31
- size="large"
32
- prefix={<WarningIcon />}
33
- fullWidth
34
- disabled={confirmationDisabled}
35
- onClick={onConfirm}>
36
- {errorMessages().unknownPriceError.confirmMessage}
37
- </Button>
38
41
  </WatermarkedModal>
39
42
  );
40
43
  }
@@ -0,0 +1,18 @@
1
+ import { styled } from '@rango-dev/ui';
2
+
3
+ export const ErrorsContainer = styled('div', {
4
+ display: 'flex',
5
+ justifyContent: 'center',
6
+ flexDirection: 'column',
7
+ height: '100%',
8
+ });
9
+
10
+ export const StrategyContent = styled('div', {
11
+ display: 'flex',
12
+ justifyContent: 'space-between',
13
+ alignItems: 'center',
14
+ });
15
+
16
+ export const SelectContainer = styled('div', {
17
+ width: '146px',
18
+ });
@@ -0,0 +1,134 @@
1
+ import type { PropTypes } from './Quotes.types';
2
+ import type { MultiRouteSimulationResult } from 'rango-sdk';
3
+
4
+ import { i18n } from '@lingui/core';
5
+ import { Divider, Typography } from '@rango-dev/ui';
6
+ import React from 'react';
7
+
8
+ import { QuoteInfo } from '../../containers/QuoteInfo';
9
+ import { getQuoteError } from '../../hooks/useConfirmSwap/useConfirmSwap.helpers';
10
+ import { useAppStore } from '../../store/AppStore';
11
+ import { useQuoteStore } from '../../store/quote';
12
+ import { QuoteErrorType, type SelectedQuote } from '../../types';
13
+ import { getContainer } from '../../utils/common';
14
+ import { generateQuoteWarnings, sortQuotesBy } from '../../utils/quote';
15
+ import { NoResult } from '../NoResult';
16
+ import { QuoteSkeleton } from '../QuoteSkeleton';
17
+
18
+ import { ErrorsContainer, StrategyContent } from './Quotes.styles';
19
+ import { SelectStrategy } from './SelectStrategy';
20
+
21
+ const ITEM_SKELETON_COUNT = 3;
22
+ export function Quotes(props: PropTypes) {
23
+ const {
24
+ loading,
25
+ onClickOnQuote,
26
+ fetch,
27
+ showModalFee,
28
+ hasSort = true,
29
+ } = props;
30
+ const {
31
+ selectedQuote,
32
+ quotes,
33
+ updateQuotePartialState,
34
+ fromToken,
35
+ toToken,
36
+ sortStrategy,
37
+ error,
38
+ } = useQuoteStore();
39
+ const { slippage, customSlippage } = useAppStore();
40
+ const tokens = useAppStore().tokens();
41
+ const hasQuotes = !!quotes && quotes.results.length;
42
+ const userSlippage = customSlippage ?? slippage;
43
+ const getQuoteWarning = (quote: MultiRouteSimulationResult) => {
44
+ if (!fromToken || !toToken || !quotes) {
45
+ return null;
46
+ }
47
+ const mergedQuote: SelectedQuote = {
48
+ requestAmount: quotes.requestAmount, // Assuming quotes is an array
49
+ ...quote,
50
+ };
51
+
52
+ return generateQuoteWarnings(mergedQuote, {
53
+ fromToken,
54
+ toToken,
55
+ userSlippage,
56
+ tokens,
57
+ });
58
+ };
59
+ const showNoResultMessage =
60
+ error?.type === QuoteErrorType.NO_RESULT ||
61
+ error?.type === QuoteErrorType.REQUEST_FAILED;
62
+
63
+ const sortQuotes = quotes?.results
64
+ ? sortQuotesBy(sortStrategy, quotes?.results)
65
+ : [];
66
+
67
+ return (
68
+ <>
69
+ {loading &&
70
+ Array.from({ length: ITEM_SKELETON_COUNT }, (_, index) => (
71
+ <React.Fragment key={index}>
72
+ <QuoteSkeleton
73
+ tagHidden={false}
74
+ type="list-item"
75
+ expanded={false}
76
+ />
77
+ <Divider size={16} />
78
+ </React.Fragment>
79
+ ))}
80
+
81
+ {!loading && (
82
+ <>
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
+ {hasQuotes
95
+ ? sortQuotes.map((quote) => {
96
+ const quoteWarning = getQuoteWarning(quote);
97
+ const quoteError = getQuoteError(quote.swaps);
98
+
99
+ return (
100
+ <React.Fragment key={quote.requestId}>
101
+ <QuoteInfo
102
+ showModalFee={showModalFee}
103
+ selected={selectedQuote?.requestId === quote.requestId}
104
+ tagHidden={false}
105
+ quote={{ ...quote, requestAmount: quotes.requestAmount }}
106
+ loading={loading}
107
+ error={quoteError?.options || null}
108
+ warning={quoteWarning}
109
+ onClick={(quote) => {
110
+ if (!quoteError) {
111
+ updateQuotePartialState('warning', quoteWarning);
112
+ }
113
+ updateQuotePartialState(
114
+ 'error',
115
+ quoteError?.options || null
116
+ );
117
+ onClickOnQuote(quote);
118
+ }}
119
+ type="list-item"
120
+ />
121
+ <Divider size={16} />
122
+ </React.Fragment>
123
+ );
124
+ })
125
+ : showNoResultMessage && (
126
+ <ErrorsContainer>
127
+ <NoResult error={error} fetch={fetch} />
128
+ </ErrorsContainer>
129
+ )}
130
+ </>
131
+ )}
132
+ </>
133
+ );
134
+ }
@@ -0,0 +1,9 @@
1
+ import type { SelectedQuote } from '../../types';
2
+
3
+ export type PropTypes = {
4
+ loading: boolean;
5
+ onClickOnQuote: (quote: SelectedQuote) => void;
6
+ fetch: (shouldChangeSelectedQuote?: boolean) => void;
7
+ showModalFee?: boolean;
8
+ hasSort?: boolean;
9
+ };
@@ -0,0 +1,33 @@
1
+ import type { PreferenceType } from 'rango-sdk';
2
+
3
+ import { Select } from '@rango-dev/ui';
4
+ import React from 'react';
5
+
6
+ import { ROUTE_STRATEGY } from '../../constants/quote';
7
+ import { useQuoteStore } from '../../store/quote';
8
+
9
+ import { SelectContainer } from './Quotes.styles';
10
+
11
+ export function SelectStrategy(props: { container: HTMLElement }) {
12
+ const { updateQuotePartialState, sortStrategy } = useQuoteStore();
13
+
14
+ return (
15
+ <SelectContainer>
16
+ <Select
17
+ container={props.container}
18
+ options={ROUTE_STRATEGY}
19
+ value={
20
+ ROUTE_STRATEGY.find(
21
+ (strategy) => strategy.value === sortStrategy
22
+ ) as {
23
+ value: PreferenceType;
24
+ label: string;
25
+ }
26
+ }
27
+ handleItemClick={(item) => {
28
+ updateQuotePartialState('sortStrategy', item.value as PreferenceType);
29
+ }}
30
+ />
31
+ </SelectContainer>
32
+ );
33
+ }
@@ -0,0 +1 @@
1
+ export { Quotes } from './Quotes';
@@ -6,5 +6,6 @@ export const SCANNER_BASE_URL = 'https://scan.rango.exchange';
6
6
 
7
7
  export const WIDGET_UI_ID = {
8
8
  SWAP_BOX_ID: 'rango-swap-box',
9
+ EXPANDED_BOX_ID: 'rango-expanded-box',
9
10
  ...UI_ID,
10
11
  };
@@ -22,13 +22,28 @@ export type FeesGroup = {
22
22
  nonePayable: { [key in NameOfFees]?: SwapFee[] };
23
23
  };
24
24
 
25
- export const ROUTE_SORTING_STRATEGY: { [key in PreferenceType]: string } = {
26
- SPEED: i18n.t('Fastest Transfer'),
27
- NET_OUTPUT: i18n.t('Maximum Return'),
28
- FEE: i18n.t('Lowest Fee'),
29
- PRICE: i18n.t('Maximum Output'),
30
- SMART: i18n.t('Smart Routing'),
31
- };
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
+ ];
32
47
 
33
48
  export const HIGH_PRIORITY_TAGS: TagValue[] = [
34
49
  'RECOMMENDED',