@rango-dev/widget-embedded 0.21.1-next.1 → 0.21.1-next.10
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.
- package/dist/components/ConfirmWalletsModal/ConfirmWallets.styles.d.ts +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/WalletList.d.ts.map +1 -1
- package/dist/components/CustomCollapsible/CustomCollapsible.d.ts.map +1 -1
- package/dist/components/HeaderButtons/HomeButtons.d.ts.map +1 -1
- package/dist/components/HistoryGroupedList/HistoryGroupedList.d.ts +4 -0
- package/dist/components/HistoryGroupedList/HistoryGroupedList.d.ts.map +1 -0
- package/dist/components/HistoryGroupedList/HistoryGroupedList.helpers.d.ts +2 -0
- package/dist/components/HistoryGroupedList/HistoryGroupedList.helpers.d.ts.map +1 -0
- package/dist/components/{SwapsGroup/SwapsGroup.styles.d.ts → HistoryGroupedList/HistoryGroupedList.styles.d.ts} +162 -1
- package/dist/components/HistoryGroupedList/HistoryGroupedList.styles.d.ts.map +1 -0
- package/dist/components/{SwapsGroup/SwapsGroup.types.d.ts → HistoryGroupedList/HistoryGroupedList.types.d.ts} +5 -4
- package/dist/components/HistoryGroupedList/HistoryGroupedList.types.d.ts.map +1 -0
- package/dist/components/HistoryGroupedList/index.d.ts +2 -0
- package/dist/components/HistoryGroupedList/index.d.ts.map +1 -0
- package/dist/components/Layout/Layout.d.ts.map +1 -1
- package/dist/components/Layout/Layout.styles.d.ts.map +1 -1
- package/dist/components/Layout/Layout.types.d.ts +0 -1
- package/dist/components/Layout/Layout.types.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.d.ts.map +1 -1
- package/dist/components/NotificationContent/NotificationContent.styles.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts.map +1 -1
- package/dist/components/Quote/QuoteCostDetails.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/HighValueLossWarningModal.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/SlippageWariningModal.d.ts.map +1 -1
- package/dist/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.d.ts.map +1 -1
- package/dist/components/TokenList/TokenList.d.ts.map +1 -1
- package/dist/components/WalletModal/WalletModal.d.ts.map +1 -1
- package/dist/components/common/ActivateTabModal/ActivateTabModal.d.ts.map +1 -1
- package/dist/components/common/WatermarkedModal/WatermarkedModal.d.ts +5 -0
- package/dist/components/common/WatermarkedModal/WatermarkedModal.d.ts.map +1 -0
- package/dist/components/common/WatermarkedModal/index.d.ts +2 -0
- package/dist/components/common/WatermarkedModal/index.d.ts.map +1 -0
- package/dist/constants/index.d.ts +7 -1
- package/dist/constants/index.d.ts.map +1 -1
- package/dist/constants/searchParams.d.ts +2 -1
- package/dist/constants/searchParams.d.ts.map +1 -1
- package/dist/containers/App/App.d.ts.map +1 -1
- package/dist/hooks/useFetchApiConfig.d.ts +7 -0
- package/dist/hooks/useFetchApiConfig.d.ts.map +1 -0
- package/dist/hooks/useIframe/index.d.ts +2 -0
- package/dist/hooks/useIframe/index.d.ts.map +1 -0
- package/dist/hooks/useIframe/useIframe.d.ts +9 -0
- package/dist/hooks/useIframe/useIframe.d.ts.map +1 -0
- package/dist/hooks/useIframe/useIframe.helpers.d.ts +2 -0
- package/dist/hooks/useIframe/useIframe.helpers.d.ts.map +1 -0
- package/dist/hooks/useIframe/useIframe.types.d.ts +10 -0
- package/dist/hooks/useIframe/useIframe.types.d.ts.map +1 -0
- package/dist/hooks/useSyncUrlAndStore/useSyncUrlAndStore.d.ts.map +1 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +4 -4
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/store/slices/config.d.ts +8 -0
- package/dist/store/slices/config.d.ts.map +1 -1
- package/dist/store/ui.d.ts +5 -0
- package/dist/store/ui.d.ts.map +1 -1
- package/dist/types/config.d.ts +1 -0
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/notification.d.ts +4 -4
- package/dist/types/notification.d.ts.map +1 -1
- package/dist/utils/common.d.ts.map +1 -1
- package/dist/utils/date.d.ts +1 -1
- package/dist/utils/date.d.ts.map +1 -1
- package/dist/utils/wallets.d.ts +1 -1
- package/package.json +3 -3
- package/readme.md +1 -0
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +9 -7
- package/src/components/ConfirmWalletsModal/WalletList.tsx +11 -9
- package/src/components/CustomCollapsible/CustomCollapsible.tsx +1 -10
- package/src/components/HeaderButtons/HomeButtons.tsx +2 -1
- package/src/components/HistoryGroupedList/HistoryGroupedList.helpers.ts +17 -0
- package/src/components/{SwapsGroup/SwapsGroup.styles.ts → HistoryGroupedList/HistoryGroupedList.styles.ts} +9 -0
- package/src/components/HistoryGroupedList/HistoryGroupedList.tsx +162 -0
- package/src/components/{SwapsGroup/SwapsGroup.types.ts → HistoryGroupedList/HistoryGroupedList.types.ts} +4 -3
- package/src/components/HistoryGroupedList/index.ts +1 -0
- package/src/components/Layout/Layout.styles.ts +12 -6
- package/src/components/Layout/Layout.tsx +47 -22
- package/src/components/Layout/Layout.types.ts +0 -1
- package/src/components/NotificationContent/NotificationContent.styles.ts +1 -0
- package/src/components/NotificationContent/NotificationContent.tsx +13 -22
- package/src/components/NotificationContent/NotificationNotFound.tsx +1 -1
- package/src/components/Quote/Quote.tsx +2 -12
- package/src/components/Quote/QuoteCostDetails.tsx +3 -3
- package/src/components/QuoteWarningsAndErrors/HighValueLossWarningModal.tsx +4 -3
- package/src/components/QuoteWarningsAndErrors/SlippageWariningModal.tsx +5 -3
- package/src/components/QuoteWarningsAndErrors/UnknownPriceWarningModal.tsx +4 -4
- package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +7 -5
- package/src/components/SwapDetailsModal/SwapDetailsModal.tsx +7 -5
- package/src/components/TokenList/TokenList.tsx +4 -24
- package/src/components/WalletModal/WalletModal.tsx +8 -5
- package/src/components/common/ActivateTabModal/ActivateTabModal.tsx +9 -3
- package/src/components/common/WatermarkedModal/WatermarkedModal.tsx +18 -0
- package/src/components/common/WatermarkedModal/index.ts +1 -0
- package/src/constants/index.ts +7 -1
- package/src/constants/searchParams.ts +2 -0
- package/src/containers/App/App.tsx +3 -1
- package/src/hooks/useFetchApiConfig.ts +33 -0
- package/src/hooks/useIframe/index.ts +1 -0
- package/src/hooks/useIframe/useIframe.helpers.ts +3 -0
- package/src/hooks/useIframe/useIframe.ts +55 -0
- package/src/hooks/useIframe/useIframe.types.ts +13 -0
- package/src/hooks/useSwapInput.ts +2 -2
- package/src/hooks/useSyncStoresWithConfig.ts +3 -3
- package/src/hooks/useSyncUrlAndStore/useSyncUrlAndStore.ts +11 -1
- package/src/index.ts +2 -0
- package/src/pages/HistoryPage.tsx +6 -6
- package/src/pages/Home.tsx +2 -3
- package/src/store/notification.ts +4 -4
- package/src/store/slices/config.ts +29 -1
- package/src/store/slices/data.ts +2 -2
- package/src/store/ui.ts +8 -0
- package/src/types/config.ts +1 -0
- package/src/types/notification.ts +4 -4
- package/src/utils/common.ts +2 -2
- package/src/utils/configs.ts +3 -3
- package/src/utils/date.ts +9 -2
- package/src/utils/meta.ts +2 -2
- package/src/utils/wallets.ts +1 -1
- package/dist/components/SwapsGroup/SwapsGroup.d.ts +0 -4
- package/dist/components/SwapsGroup/SwapsGroup.d.ts.map +0 -1
- package/dist/components/SwapsGroup/SwapsGroup.styles.d.ts.map +0 -1
- package/dist/components/SwapsGroup/SwapsGroup.types.d.ts.map +0 -1
- package/dist/components/SwapsGroup/index.d.ts +0 -2
- package/dist/components/SwapsGroup/index.d.ts.map +0 -1
- package/src/components/SwapsGroup/SwapsGroup.tsx +0 -141
- package/src/components/SwapsGroup/index.ts +0 -1
|
@@ -6,7 +6,9 @@ import { useManager } from '@rango-dev/queue-manager-react';
|
|
|
6
6
|
import { BottomLogo, Divider, Header } from '@rango-dev/ui';
|
|
7
7
|
import React, { useEffect, useRef } from 'react';
|
|
8
8
|
|
|
9
|
-
import {
|
|
9
|
+
import { WIDGET_UI_ID } from '../../constants';
|
|
10
|
+
import { useIframe } from '../../hooks/useIframe';
|
|
11
|
+
import { isAppLoadedIntoIframe } from '../../hooks/useIframe/useIframe.helpers';
|
|
10
12
|
import { useNavigateBack } from '../../hooks/useNavigateBack';
|
|
11
13
|
import { useTheme } from '../../hooks/useTheme';
|
|
12
14
|
import { useAppStore } from '../../store/AppStore';
|
|
@@ -23,11 +25,15 @@ import { onScrollContentAttachStatusToContainer } from './Layout.helpers';
|
|
|
23
25
|
import { Container, Content, Footer } from './Layout.styles';
|
|
24
26
|
|
|
25
27
|
function Layout(props: PropsWithChildren<PropTypes>) {
|
|
26
|
-
const {
|
|
28
|
+
const { connectHeightObserver, disconnectHeightObserver } = useIframe();
|
|
29
|
+
const { children, header, footer, height = 'fixed' } = props;
|
|
27
30
|
const connectedWallets = useWalletsStore.use.connectedWallets();
|
|
28
31
|
const {
|
|
29
32
|
config: { features, theme },
|
|
30
33
|
} = useAppStore();
|
|
34
|
+
const { watermark } = useUiStore();
|
|
35
|
+
|
|
36
|
+
const hasWatermark = watermark === 'FULL';
|
|
31
37
|
const { activeTheme } = useTheme(theme || {});
|
|
32
38
|
|
|
33
39
|
const isConnectWalletHidden = isFeatureHidden(
|
|
@@ -60,13 +66,26 @@ function Layout(props: PropsWithChildren<PropTypes>) {
|
|
|
60
66
|
typeof header.hasBackButton === 'undefined' || header.hasBackButton;
|
|
61
67
|
|
|
62
68
|
const scrollViewRef = useRef<HTMLDivElement>(null);
|
|
69
|
+
const containerRef = useRef<HTMLDivElement>(null);
|
|
70
|
+
|
|
71
|
+
useEffect(() => {
|
|
72
|
+
const isIframe = isAppLoadedIntoIframe();
|
|
73
|
+
|
|
74
|
+
// This feature only will be available in an iframe context.
|
|
75
|
+
if (isIframe && containerRef.current) {
|
|
76
|
+
connectHeightObserver(containerRef.current);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
return () => {
|
|
80
|
+
disconnectHeightObserver();
|
|
81
|
+
};
|
|
82
|
+
}, []);
|
|
63
83
|
|
|
64
84
|
useEffect(() => {
|
|
65
85
|
scrollViewRef.current?.addEventListener(
|
|
66
86
|
'scroll',
|
|
67
87
|
onScrollContentAttachStatusToContainer
|
|
68
88
|
);
|
|
69
|
-
|
|
70
89
|
return () => {
|
|
71
90
|
scrollViewRef.current?.removeEventListener(
|
|
72
91
|
'scroll',
|
|
@@ -76,7 +95,11 @@ function Layout(props: PropsWithChildren<PropTypes>) {
|
|
|
76
95
|
}, []);
|
|
77
96
|
|
|
78
97
|
return (
|
|
79
|
-
<Container
|
|
98
|
+
<Container
|
|
99
|
+
height={height}
|
|
100
|
+
id={WIDGET_UI_ID.SWAP_BOX_ID}
|
|
101
|
+
className={activeTheme()}
|
|
102
|
+
ref={containerRef}>
|
|
80
103
|
<Header
|
|
81
104
|
prefix={<>{showBackButton && <BackButton onClick={navigateBack} />}</>}
|
|
82
105
|
title={header.title}
|
|
@@ -100,25 +123,27 @@ function Layout(props: PropsWithChildren<PropTypes>) {
|
|
|
100
123
|
onClose={() => setShowActivateTabModal(false)}
|
|
101
124
|
onConfirm={onActivateTab}
|
|
102
125
|
/>
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
)}
|
|
113
|
-
</div>
|
|
114
|
-
<Divider size={12} />
|
|
115
|
-
{hasLogo && (
|
|
116
|
-
<div className="footer__logo">
|
|
117
|
-
<BottomLogo />
|
|
118
|
-
</div>
|
|
126
|
+
|
|
127
|
+
<Footer>
|
|
128
|
+
<div className="footer__content">
|
|
129
|
+
{footer}
|
|
130
|
+
{tabManagerInitiated && !isActiveTab && (
|
|
131
|
+
<>
|
|
132
|
+
<Divider size={12} />
|
|
133
|
+
<ActivateTabAlert onActivateTab={onActivateTab} />
|
|
134
|
+
</>
|
|
119
135
|
)}
|
|
120
|
-
</
|
|
121
|
-
|
|
136
|
+
</div>
|
|
137
|
+
|
|
138
|
+
<Divider size={12} />
|
|
139
|
+
|
|
140
|
+
<div
|
|
141
|
+
className={`footer__logo ${
|
|
142
|
+
hasWatermark ? 'logo__show' : 'logo__hidden'
|
|
143
|
+
}`}>
|
|
144
|
+
<BottomLogo />
|
|
145
|
+
</div>
|
|
146
|
+
</Footer>
|
|
122
147
|
</Container>
|
|
123
148
|
);
|
|
124
149
|
}
|
|
@@ -14,6 +14,7 @@ import { useNavigate } from 'react-router-dom';
|
|
|
14
14
|
import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
15
15
|
import { useAppStore } from '../../store/AppStore';
|
|
16
16
|
import { useNotificationStore } from '../../store/notification';
|
|
17
|
+
import { areTokensEqual } from '../../utils/wallets';
|
|
17
18
|
|
|
18
19
|
import { Container, Images, List } from './NotificationContent.styles';
|
|
19
20
|
import { NotificationNotFound } from './NotificationNotFound';
|
|
@@ -41,50 +42,40 @@ export function NotificationContent() {
|
|
|
41
42
|
{sortedNotification.length ? (
|
|
42
43
|
<List>
|
|
43
44
|
{sortedNotification.map((notificationItem) => {
|
|
44
|
-
const
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
notificationItem.route.from.tokenAddress &&
|
|
48
|
-
tokenItem.blockchain ===
|
|
49
|
-
notificationItem.route.from.blockchain &&
|
|
50
|
-
tokenItem.symbol === notificationItem.route.from.tokenSymbol
|
|
45
|
+
const { route, requestId, event } = notificationItem;
|
|
46
|
+
const fromToken = tokens.find((tokenItem) =>
|
|
47
|
+
areTokensEqual(tokenItem, route.from)
|
|
51
48
|
);
|
|
52
49
|
|
|
53
50
|
const fromBlockchain = blockchains.find(
|
|
54
|
-
(blockchainItem) =>
|
|
55
|
-
blockchainItem.name === notificationItem.route.from.blockchain
|
|
51
|
+
(blockchainItem) => blockchainItem.name === route.from.blockchain
|
|
56
52
|
);
|
|
57
53
|
|
|
58
|
-
const toToken = tokens.find(
|
|
59
|
-
(tokenItem)
|
|
60
|
-
tokenItem.address === notificationItem.route.to.tokenAddress &&
|
|
61
|
-
tokenItem.blockchain === notificationItem.route.to.blockchain &&
|
|
62
|
-
tokenItem.symbol === notificationItem.route.to.tokenSymbol
|
|
54
|
+
const toToken = tokens.find((tokenItem) =>
|
|
55
|
+
areTokensEqual(tokenItem, route.to)
|
|
63
56
|
);
|
|
64
57
|
|
|
65
58
|
const toBlockchain = blockchains.find(
|
|
66
|
-
(blockchainItem) =>
|
|
67
|
-
blockchainItem.name === notificationItem.route.to.blockchain
|
|
59
|
+
(blockchainItem) => blockchainItem.name === route.to.blockchain
|
|
68
60
|
);
|
|
69
61
|
|
|
70
62
|
return (
|
|
71
63
|
<ListItemButton
|
|
72
|
-
key={
|
|
73
|
-
onClick={() => handleOnClick(
|
|
64
|
+
key={requestId}
|
|
65
|
+
onClick={() => handleOnClick(requestId)}
|
|
74
66
|
title={
|
|
75
67
|
<Typography
|
|
76
68
|
variant="body"
|
|
77
69
|
size="small"
|
|
78
70
|
color={
|
|
79
|
-
|
|
80
|
-
EventSeverity.WARNING
|
|
71
|
+
event.messageSeverity === EventSeverity.WARNING
|
|
81
72
|
? '$foreground'
|
|
82
73
|
: '$neutral700'
|
|
83
74
|
}>
|
|
84
|
-
{i18n.t(
|
|
75
|
+
{i18n.t(event.message)}
|
|
85
76
|
</Typography>
|
|
86
77
|
}
|
|
87
|
-
id={
|
|
78
|
+
id={requestId}
|
|
88
79
|
start={
|
|
89
80
|
<Images>
|
|
90
81
|
<div className="from-chain-token">
|
|
@@ -10,7 +10,7 @@ export function NotificationNotFound() {
|
|
|
10
10
|
<NoNotificationIcon color="secondary" size={26} />
|
|
11
11
|
<Divider size={12} />
|
|
12
12
|
<Typography variant="body" size="medium" color="neutral700">
|
|
13
|
-
{i18n.t('
|
|
13
|
+
{i18n.t('There are no notifications.')}
|
|
14
14
|
</Typography>
|
|
15
15
|
</NotFoundContainer>
|
|
16
16
|
);
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
Typography,
|
|
14
14
|
} from '@rango-dev/ui';
|
|
15
15
|
import BigNumber from 'bignumber.js';
|
|
16
|
-
import React, {
|
|
16
|
+
import React, { useRef, useState } from 'react';
|
|
17
17
|
|
|
18
18
|
import {
|
|
19
19
|
PERCENTAGE_CHANGE_MAX_DECIMALS,
|
|
@@ -42,7 +42,6 @@ import {
|
|
|
42
42
|
basicInfoStyles,
|
|
43
43
|
ContainerInfoOutput,
|
|
44
44
|
Content,
|
|
45
|
-
EXPANDABLE_QUOTE_TRANSITION_DURATION,
|
|
46
45
|
FrameIcon,
|
|
47
46
|
HorizontalSeparator,
|
|
48
47
|
QuoteContainer,
|
|
@@ -69,7 +68,6 @@ export function Quote(props: QuoteProps) {
|
|
|
69
68
|
|
|
70
69
|
const [expanded, setExpanded] = useState(props.expanded);
|
|
71
70
|
const quoteRef = useRef<HTMLButtonElement | null>(null);
|
|
72
|
-
const prevExpanded = useRef(expanded);
|
|
73
71
|
const roundedInput = numberToString(
|
|
74
72
|
input.value,
|
|
75
73
|
TOKEN_AMOUNT_MIN_DECIMALS,
|
|
@@ -190,7 +188,7 @@ export function Quote(props: QuoteProps) {
|
|
|
190
188
|
title={
|
|
191
189
|
error?.type === QuoteErrorType.BRIDGE_LIMIT
|
|
192
190
|
? error?.recommendation
|
|
193
|
-
: i18n.t(
|
|
191
|
+
: i18n.t(`Slippage ${stepHasError ? 'Error' : 'Warning'}:`)
|
|
194
192
|
}
|
|
195
193
|
footer={
|
|
196
194
|
<FooterAlert>
|
|
@@ -263,14 +261,6 @@ export function Quote(props: QuoteProps) {
|
|
|
263
261
|
const steps = getQuoteSteps(quote.result?.swaps ?? []);
|
|
264
262
|
const numberOfSteps = steps.length;
|
|
265
263
|
const tooltipContainer = getContainer();
|
|
266
|
-
useLayoutEffect(() => {
|
|
267
|
-
if (expanded && !prevExpanded.current && quoteRef.current) {
|
|
268
|
-
setTimeout(() => {
|
|
269
|
-
quoteRef?.current?.scrollIntoView({ behavior: 'smooth' });
|
|
270
|
-
}, EXPANDABLE_QUOTE_TRANSITION_DURATION);
|
|
271
|
-
}
|
|
272
|
-
prevExpanded.current = expanded;
|
|
273
|
-
}, [expanded, prevExpanded]);
|
|
274
264
|
|
|
275
265
|
return (
|
|
276
266
|
<>
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
CloseIcon,
|
|
8
8
|
Divider,
|
|
9
9
|
IconButton,
|
|
10
|
-
Modal,
|
|
11
10
|
QuoteCost,
|
|
12
11
|
Tooltip,
|
|
13
12
|
Typography,
|
|
@@ -36,6 +35,7 @@ import {
|
|
|
36
35
|
getTotalFeesInUsd,
|
|
37
36
|
getUsdFee,
|
|
38
37
|
} from '../../utils/swap';
|
|
38
|
+
import { WatermarkedModal } from '../common/WatermarkedModal';
|
|
39
39
|
import { CustomCollapsible } from '../CustomCollapsible/CustomCollapsible';
|
|
40
40
|
import { ExpandedIcon } from '../CustomCollapsible/CustomCollapsible.styles';
|
|
41
41
|
|
|
@@ -96,7 +96,7 @@ export function QuoteCostDetails(props: QuoteCostDetailsProps) {
|
|
|
96
96
|
tooltipContainer={container}
|
|
97
97
|
/>
|
|
98
98
|
|
|
99
|
-
<
|
|
99
|
+
<WatermarkedModal
|
|
100
100
|
container={container}
|
|
101
101
|
open={open}
|
|
102
102
|
header={
|
|
@@ -212,7 +212,7 @@ export function QuoteCostDetails(props: QuoteCostDetailsProps) {
|
|
|
212
212
|
</CustomCollapsible>
|
|
213
213
|
)}
|
|
214
214
|
</ModalContainer>
|
|
215
|
-
</
|
|
215
|
+
</WatermarkedModal>
|
|
216
216
|
</>
|
|
217
217
|
);
|
|
218
218
|
}
|
|
@@ -5,7 +5,6 @@ import {
|
|
|
5
5
|
Button,
|
|
6
6
|
Divider,
|
|
7
7
|
MessageBox,
|
|
8
|
-
Modal,
|
|
9
8
|
Typography,
|
|
10
9
|
WarningIcon,
|
|
11
10
|
} from '@rango-dev/ui';
|
|
@@ -22,6 +21,7 @@ import {
|
|
|
22
21
|
} from '../../constants/routing';
|
|
23
22
|
import { getContainer } from '../../utils/common';
|
|
24
23
|
import { numberToString } from '../../utils/numbers';
|
|
24
|
+
import { WatermarkedModal } from '../common/WatermarkedModal';
|
|
25
25
|
|
|
26
26
|
import { QuoteErrorsModalItem } from './QuoteErrorsModalItem';
|
|
27
27
|
import { Flex } from './QuoteWarningsAndErrors.styles';
|
|
@@ -37,6 +37,7 @@ type Props = {
|
|
|
37
37
|
export function HighValueLossWarningModal(props: Props) {
|
|
38
38
|
const { open, onClose, onConfirm, warning, confirmationDisabled } = props;
|
|
39
39
|
const type = warning.warningLevel === 'high' ? 'error' : 'warning';
|
|
40
|
+
|
|
40
41
|
const highValueLossData = [
|
|
41
42
|
{
|
|
42
43
|
title: i18n.t('Swapping'),
|
|
@@ -74,7 +75,7 @@ export function HighValueLossWarningModal(props: Props) {
|
|
|
74
75
|
];
|
|
75
76
|
|
|
76
77
|
return (
|
|
77
|
-
<
|
|
78
|
+
<WatermarkedModal open={open} onClose={onClose} container={getContainer()}>
|
|
78
79
|
<MessageBox
|
|
79
80
|
type={type}
|
|
80
81
|
title={errorMessages().highValueLossError.impactTitle}
|
|
@@ -104,6 +105,6 @@ export function HighValueLossWarningModal(props: Props) {
|
|
|
104
105
|
onClick={onConfirm}>
|
|
105
106
|
{errorMessages().highValueLossError.confirmMessage}
|
|
106
107
|
</Button>
|
|
107
|
-
</
|
|
108
|
+
</WatermarkedModal>
|
|
108
109
|
);
|
|
109
110
|
}
|
|
@@ -4,7 +4,7 @@ import type {
|
|
|
4
4
|
} from '../../types';
|
|
5
5
|
|
|
6
6
|
import { i18n } from '@lingui/core';
|
|
7
|
-
import { Button, Divider, MessageBox,
|
|
7
|
+
import { Button, Divider, MessageBox, Typography } from '@rango-dev/ui';
|
|
8
8
|
import React from 'react';
|
|
9
9
|
import { useNavigate } from 'react-router-dom';
|
|
10
10
|
|
|
@@ -12,6 +12,7 @@ import { navigationRoutes } from '../../constants/navigationRoutes';
|
|
|
12
12
|
import { useAppStore } from '../../store/AppStore';
|
|
13
13
|
import { QuoteWarningType } from '../../types';
|
|
14
14
|
import { getContainer } from '../../utils/common';
|
|
15
|
+
import { WatermarkedModal } from '../common/WatermarkedModal';
|
|
15
16
|
|
|
16
17
|
type PropsTypes = {
|
|
17
18
|
open: boolean;
|
|
@@ -26,8 +27,9 @@ export function SlippageWarningModal(props: PropsTypes) {
|
|
|
26
27
|
const { open, onClose, onConfirm, warning, confirmationDisabled } = props;
|
|
27
28
|
const navigate = useNavigate();
|
|
28
29
|
const userSlippage = customSlippage ?? slippage;
|
|
30
|
+
|
|
29
31
|
return (
|
|
30
|
-
<
|
|
32
|
+
<WatermarkedModal
|
|
31
33
|
anchor="bottom"
|
|
32
34
|
open={open}
|
|
33
35
|
prefix={
|
|
@@ -74,6 +76,6 @@ export function SlippageWarningModal(props: PropsTypes) {
|
|
|
74
76
|
{i18n.t('Confirm anyway')}
|
|
75
77
|
</Button>
|
|
76
78
|
</MessageBox>
|
|
77
|
-
</
|
|
79
|
+
</WatermarkedModal>
|
|
78
80
|
);
|
|
79
81
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { UnknownPriceWarning } from '../../types';
|
|
2
2
|
|
|
3
|
-
import { Button, Divider, MessageBox,
|
|
3
|
+
import { Button, Divider, MessageBox, WarningIcon } from '@rango-dev/ui';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
|
|
6
6
|
import { errorMessages } from '../../constants/errors';
|
|
7
7
|
import { getContainer } from '../../utils/common';
|
|
8
|
+
import { WatermarkedModal } from '../common/WatermarkedModal';
|
|
8
9
|
|
|
9
10
|
type Props = {
|
|
10
11
|
open: boolean;
|
|
@@ -16,9 +17,8 @@ type Props = {
|
|
|
16
17
|
|
|
17
18
|
export function UnknownPriceWarningModal(props: Props) {
|
|
18
19
|
const { open, onClose, onConfirm, confirmationDisabled } = props;
|
|
19
|
-
|
|
20
20
|
return (
|
|
21
|
-
<
|
|
21
|
+
<WatermarkedModal open={open} onClose={onClose} container={getContainer()}>
|
|
22
22
|
<MessageBox
|
|
23
23
|
type="warning"
|
|
24
24
|
title={errorMessages().unknownPriceError.impactTitle}
|
|
@@ -35,6 +35,6 @@ export function UnknownPriceWarningModal(props: Props) {
|
|
|
35
35
|
onClick={onConfirm}>
|
|
36
36
|
{errorMessages().unknownPriceError.confirmMessage}
|
|
37
37
|
</Button>
|
|
38
|
-
</
|
|
38
|
+
</WatermarkedModal>
|
|
39
39
|
);
|
|
40
40
|
}
|
|
@@ -5,15 +5,15 @@ import {
|
|
|
5
5
|
Button,
|
|
6
6
|
Divider,
|
|
7
7
|
MessageBox,
|
|
8
|
-
Modal,
|
|
9
8
|
TokenAmount,
|
|
10
9
|
Typography,
|
|
11
10
|
} from '@rango-dev/ui';
|
|
12
11
|
import React from 'react';
|
|
13
12
|
import { useNavigate } from 'react-router-dom';
|
|
14
13
|
|
|
15
|
-
import {
|
|
14
|
+
import { WIDGET_UI_ID } from '../../constants';
|
|
16
15
|
import { getContainer } from '../../utils/common';
|
|
16
|
+
import { WatermarkedModal } from '../common/WatermarkedModal';
|
|
17
17
|
|
|
18
18
|
export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
|
|
19
19
|
const {
|
|
@@ -33,10 +33,12 @@ export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
|
|
|
33
33
|
const navigate = useNavigate();
|
|
34
34
|
|
|
35
35
|
return (
|
|
36
|
-
<
|
|
36
|
+
<WatermarkedModal
|
|
37
37
|
open={open}
|
|
38
38
|
onClose={onClose}
|
|
39
|
-
container={
|
|
39
|
+
container={
|
|
40
|
+
document.getElementById(WIDGET_UI_ID.SWAP_BOX_ID) || document.body
|
|
41
|
+
}>
|
|
40
42
|
{status === 'success' ? (
|
|
41
43
|
<MessageBox type="success" title={i18n.t('Swap Successful')}>
|
|
42
44
|
<TokenAmount
|
|
@@ -105,6 +107,6 @@ export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
|
|
|
105
107
|
{i18n.t('See Details')}
|
|
106
108
|
</Typography>
|
|
107
109
|
</Button>
|
|
108
|
-
</
|
|
110
|
+
</WatermarkedModal>
|
|
109
111
|
);
|
|
110
112
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { ModalPropTypes } from './SwapDetailsModal.types';
|
|
2
2
|
|
|
3
|
-
import { Modal } from '@rango-dev/ui';
|
|
4
3
|
import { PendingSwapNetworkStatus } from 'rango-types';
|
|
5
4
|
import React from 'react';
|
|
6
5
|
|
|
7
|
-
import {
|
|
6
|
+
import { WIDGET_UI_ID } from '../../constants';
|
|
7
|
+
import { WatermarkedModal } from '../common/WatermarkedModal';
|
|
8
8
|
|
|
9
9
|
import { CancelContent } from './SwapDetailsModal.Cancel';
|
|
10
10
|
import { DeleteContent } from './SwapDetailsModal.Delete';
|
|
@@ -28,10 +28,12 @@ export function SwapDetailsModal(props: ModalPropTypes) {
|
|
|
28
28
|
state === PendingSwapNetworkStatus.NetworkChanged;
|
|
29
29
|
|
|
30
30
|
return (
|
|
31
|
-
<
|
|
31
|
+
<WatermarkedModal
|
|
32
32
|
open={!!state}
|
|
33
33
|
onClose={onClose}
|
|
34
|
-
container={
|
|
34
|
+
container={
|
|
35
|
+
document.getElementById(WIDGET_UI_ID.SWAP_BOX_ID) || document.body
|
|
36
|
+
}>
|
|
35
37
|
{showWalletStateContent && (
|
|
36
38
|
<WalletStateContent
|
|
37
39
|
type={modalNetworkValues[state].type}
|
|
@@ -50,6 +52,6 @@ export function SwapDetailsModal(props: ModalPropTypes) {
|
|
|
50
52
|
{state === 'cancel' && (
|
|
51
53
|
<CancelContent onClose={onClose} onCancel={onCancel} />
|
|
52
54
|
)}
|
|
53
|
-
</
|
|
55
|
+
</WatermarkedModal>
|
|
54
56
|
);
|
|
55
57
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-magic-numbers */
|
|
2
2
|
import type { PropTypes, RenderDescProps } from './TokenList.types';
|
|
3
3
|
import type { Token } from 'rango-sdk';
|
|
4
|
-
import type { CommonProps } from 'react-window';
|
|
5
4
|
|
|
6
5
|
import { i18n } from '@lingui/core';
|
|
7
6
|
import {
|
|
@@ -16,7 +15,7 @@ import {
|
|
|
16
15
|
Typography,
|
|
17
16
|
VirtualizedList,
|
|
18
17
|
} from '@rango-dev/ui';
|
|
19
|
-
import React, {
|
|
18
|
+
import React, { useEffect, useState } from 'react';
|
|
20
19
|
|
|
21
20
|
import { useAppStore } from '../../store/AppStore';
|
|
22
21
|
import { useWalletsStore } from '../../store/wallets';
|
|
@@ -100,20 +99,6 @@ export function TokenList(props: PropTypes) {
|
|
|
100
99
|
const { getBalanceFor, loading: loadingWallet } = useWalletsStore();
|
|
101
100
|
const { isTokenPinned } = useAppStore();
|
|
102
101
|
|
|
103
|
-
// eslint-disable-next-line react/display-name
|
|
104
|
-
const innerElementType: React.FC<CommonProps> = forwardRef((render, ref) => {
|
|
105
|
-
return (
|
|
106
|
-
<div
|
|
107
|
-
{...render}
|
|
108
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
109
|
-
ref={ref as any}
|
|
110
|
-
style={{
|
|
111
|
-
...render.style,
|
|
112
|
-
height: `${parseFloat(render.style?.height as string) + 8 * 2}px`,
|
|
113
|
-
}}
|
|
114
|
-
/>
|
|
115
|
-
);
|
|
116
|
-
});
|
|
117
102
|
const loadNextPage = () => {
|
|
118
103
|
setTokens(list.slice(0, tokens.length + PAGE_SIZE));
|
|
119
104
|
};
|
|
@@ -140,7 +125,8 @@ export function TokenList(props: PropTypes) {
|
|
|
140
125
|
}
|
|
141
126
|
return (
|
|
142
127
|
<VirtualizedList
|
|
143
|
-
|
|
128
|
+
endReached={hasNextPage ? loadNextPage : undefined}
|
|
129
|
+
itemContent={(index) => {
|
|
144
130
|
const token = tokens[index];
|
|
145
131
|
const tokenBalance = formatBalance(getBalanceFor(token));
|
|
146
132
|
const address = token.address || '';
|
|
@@ -171,12 +157,10 @@ export function TokenList(props: PropTypes) {
|
|
|
171
157
|
return (
|
|
172
158
|
<div
|
|
173
159
|
style={{
|
|
174
|
-
...style,
|
|
175
160
|
paddingRight: 5,
|
|
176
161
|
}}>
|
|
177
162
|
<ListItemButton
|
|
178
163
|
style={{
|
|
179
|
-
height: style?.height,
|
|
180
164
|
width: '100%',
|
|
181
165
|
overflow: 'hidden',
|
|
182
166
|
}}
|
|
@@ -261,11 +245,7 @@ export function TokenList(props: PropTypes) {
|
|
|
261
245
|
</div>
|
|
262
246
|
);
|
|
263
247
|
}}
|
|
264
|
-
|
|
265
|
-
itemCount={tokens.length}
|
|
266
|
-
loadNextPage={loadNextPage}
|
|
267
|
-
innerElementType={innerElementType}
|
|
268
|
-
size={60}
|
|
248
|
+
totalCount={tokens.length}
|
|
269
249
|
key={`${selectedBlockchain}-${searchedFor}`}
|
|
270
250
|
/>
|
|
271
251
|
);
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import type { PropTypes } from './WalletModal.types';
|
|
2
2
|
|
|
3
|
-
import { Divider
|
|
3
|
+
import { Divider } from '@rango-dev/ui';
|
|
4
4
|
import React from 'react';
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import { WIDGET_UI_ID } from '../../constants';
|
|
7
|
+
import { WatermarkedModal } from '../common/WatermarkedModal';
|
|
7
8
|
|
|
8
9
|
import { ModalContent } from './WalletModalContent';
|
|
9
10
|
|
|
@@ -11,12 +12,14 @@ export function WalletModal(props: PropTypes) {
|
|
|
11
12
|
const { open, onClose, ...otherProps } = props;
|
|
12
13
|
|
|
13
14
|
return (
|
|
14
|
-
<
|
|
15
|
+
<WatermarkedModal
|
|
15
16
|
open={open}
|
|
16
17
|
onClose={onClose}
|
|
17
|
-
container={
|
|
18
|
+
container={
|
|
19
|
+
document.getElementById(WIDGET_UI_ID.SWAP_BOX_ID) || document.body
|
|
20
|
+
}>
|
|
18
21
|
<ModalContent {...otherProps} />
|
|
19
22
|
<Divider direction="vertical" size={32} />
|
|
20
|
-
</
|
|
23
|
+
</WatermarkedModal>
|
|
21
24
|
);
|
|
22
25
|
}
|
|
@@ -1,15 +1,21 @@
|
|
|
1
1
|
import type { PropTypes } from './ActivateTabModal.types';
|
|
2
2
|
|
|
3
3
|
import { i18n } from '@lingui/core';
|
|
4
|
-
import { Button, Divider, MessageBox
|
|
4
|
+
import { Button, Divider, MessageBox } from '@rango-dev/ui';
|
|
5
5
|
import React from 'react';
|
|
6
6
|
|
|
7
7
|
import { getContainer } from '../../../utils/common';
|
|
8
|
+
import { WatermarkedModal } from '../WatermarkedModal';
|
|
8
9
|
|
|
9
10
|
export function ActivateTabModal(props: PropTypes) {
|
|
10
11
|
const { open, onClose, onConfirm } = props;
|
|
12
|
+
|
|
11
13
|
return (
|
|
12
|
-
<
|
|
14
|
+
<WatermarkedModal
|
|
15
|
+
open={open}
|
|
16
|
+
dismissible
|
|
17
|
+
onClose={onClose}
|
|
18
|
+
container={getContainer()}>
|
|
13
19
|
<MessageBox
|
|
14
20
|
title={i18n.t('Activate current tab')}
|
|
15
21
|
type="warning"
|
|
@@ -26,6 +32,6 @@ export function ActivateTabModal(props: PropTypes) {
|
|
|
26
32
|
{i18n.t('Confirm')}
|
|
27
33
|
</Button>
|
|
28
34
|
</MessageBox>
|
|
29
|
-
</
|
|
35
|
+
</WatermarkedModal>
|
|
30
36
|
);
|
|
31
37
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ModalPropTypes } from '@rango-dev/ui';
|
|
2
|
+
import type { PropsWithChildren } from 'react';
|
|
3
|
+
|
|
4
|
+
import { Modal } from '@rango-dev/ui';
|
|
5
|
+
import React from 'react';
|
|
6
|
+
|
|
7
|
+
import { useUiStore } from '../../../store/ui';
|
|
8
|
+
|
|
9
|
+
export function WatermarkedModal(props: PropsWithChildren<ModalPropTypes>) {
|
|
10
|
+
const { watermark } = useUiStore();
|
|
11
|
+
|
|
12
|
+
const hasWatermark = watermark === 'FULL';
|
|
13
|
+
return (
|
|
14
|
+
<Modal hasWatermark={hasWatermark} {...props}>
|
|
15
|
+
{props.children}
|
|
16
|
+
</Modal>
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { WatermarkedModal } from './WatermarkedModal';
|
package/src/constants/index.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
|
+
import { UI_ID } from '@rango-dev/ui';
|
|
2
|
+
|
|
1
3
|
export const RANGO_PUBLIC_API_KEY = 'c6381a79-2817-4602-83bf-6a641a409e32';
|
|
2
4
|
export const DEFAULT_BASE_URL = 'https://api.rango.exchange';
|
|
3
|
-
export const RANGO_SWAP_BOX_ID = 'rango-swap-box';
|
|
4
5
|
export const SCANNER_BASE_URL = 'https://scan.rango.exchange';
|
|
6
|
+
|
|
7
|
+
export const WIDGET_UI_ID = {
|
|
8
|
+
SWAP_BOX_ID: 'rango-swap-box',
|
|
9
|
+
...UI_ID,
|
|
10
|
+
};
|