@rango-dev/widget-embedded 0.22.4-next.8 → 0.23.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.
- package/dist/QueueManager.d.ts.map +1 -1
- package/dist/components/ConfirmWalletsModal/ConfirmWalletsModal.d.ts.map +1 -1
- package/dist/components/Quote/Quote.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsCompleteModal.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Cancel.d.ts.map +1 -1
- package/dist/components/SwapDetailsModal/SwapDetailsModal.Delete.d.ts.map +1 -1
- package/dist/constants/languages.d.ts.map +1 -1
- package/dist/containers/Wallets/Wallets.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +3 -3
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/SettingsPage.d.ts.map +1 -1
- package/dist/store/AppStore.d.ts +2 -2
- package/dist/store/app.d.ts +2 -2
- package/package.json +8 -8
- package/src/QueueManager.tsx +0 -3
- package/src/components/ConfirmWalletsModal/ConfirmWalletsModal.tsx +8 -3
- package/src/components/Quote/Quote.tsx +9 -5
- package/src/components/SwapDetailsModal/SwapDetailsCompleteModal.tsx +1 -3
- package/src/components/SwapDetailsModal/SwapDetailsModal.Cancel.tsx +3 -7
- package/src/components/SwapDetailsModal/SwapDetailsModal.Delete.tsx +1 -3
- package/src/constants/languages.ts +2 -1
- package/src/containers/Wallets/Wallets.tsx +5 -11
- package/src/pages/Home.tsx +2 -4
- package/src/pages/SettingsPage.tsx +11 -13
package/dist/pages/Home.d.ts.map
CHANGED
|
@@ -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,
|
|
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 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SettingsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SettingsPage.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,MAAM,OAAO,CAAC;AAoB1B,wBAAgB,YAAY,
|
|
1
|
+
{"version":3,"file":"SettingsPage.d.ts","sourceRoot":"","sources":["../../src/pages/SettingsPage.tsx"],"names":[],"mappings":"AAeA,OAAO,KAAK,MAAM,OAAO,CAAC;AAoB1B,wBAAgB,YAAY,sBA6M3B"}
|
package/dist/store/AppStore.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare const AppStoreContext: React.Context<import("zustand").UseBoundSt
|
|
|
8
8
|
persist: {
|
|
9
9
|
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<import("./app").AppStoreState, {
|
|
10
10
|
theme: import("./slices/settings").ThemeMode;
|
|
11
|
-
language: "en" | "es" | "ja" | "fr" | null;
|
|
11
|
+
language: "en" | "es" | "ja" | "fr" | "pt" | null;
|
|
12
12
|
affiliatePercent: number | null;
|
|
13
13
|
affiliateRef: string | null;
|
|
14
14
|
affiliateWallets: {
|
|
@@ -27,7 +27,7 @@ export declare const AppStoreContext: React.Context<import("zustand").UseBoundSt
|
|
|
27
27
|
onFinishHydration: (fn: (state: import("./app").AppStoreState) => void) => () => void;
|
|
28
28
|
getOptions: () => Partial<import("zustand/middleware").PersistOptions<import("./app").AppStoreState, {
|
|
29
29
|
theme: import("./slices/settings").ThemeMode;
|
|
30
|
-
language: "en" | "es" | "ja" | "fr" | null;
|
|
30
|
+
language: "en" | "es" | "ja" | "fr" | "pt" | null;
|
|
31
31
|
affiliatePercent: number | null;
|
|
32
32
|
affiliateRef: string | null;
|
|
33
33
|
affiliateWallets: {
|
package/dist/store/app.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare function createAppStore(initialData?: WidgetConfig): import("zust
|
|
|
9
9
|
persist: {
|
|
10
10
|
setOptions: (options: Partial<import("zustand/middleware").PersistOptions<AppStoreState, {
|
|
11
11
|
theme: import("./slices/settings").ThemeMode;
|
|
12
|
-
language: "en" | "es" | "ja" | "fr" | null;
|
|
12
|
+
language: "en" | "es" | "ja" | "fr" | "pt" | null;
|
|
13
13
|
affiliatePercent: number | null;
|
|
14
14
|
affiliateRef: string | null;
|
|
15
15
|
affiliateWallets: {
|
|
@@ -28,7 +28,7 @@ export declare function createAppStore(initialData?: WidgetConfig): import("zust
|
|
|
28
28
|
onFinishHydration: (fn: (state: AppStoreState) => void) => () => void;
|
|
29
29
|
getOptions: () => Partial<import("zustand/middleware").PersistOptions<AppStoreState, {
|
|
30
30
|
theme: import("./slices/settings").ThemeMode;
|
|
31
|
-
language: "en" | "es" | "ja" | "fr" | null;
|
|
31
|
+
language: "en" | "es" | "ja" | "fr" | "pt" | null;
|
|
32
32
|
affiliatePercent: number | null;
|
|
33
33
|
affiliateRef: string | null;
|
|
34
34
|
affiliateWallets: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rango-dev/widget-embedded",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.23.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"source": "./src/index.ts",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"@lingui/core": "4.2.1",
|
|
23
23
|
"@lingui/react": "4.2.1",
|
|
24
|
-
"@rango-dev/provider-all": "^0.
|
|
25
|
-
"@rango-dev/queue-manager-core": "^0.
|
|
26
|
-
"@rango-dev/queue-manager-rango-preset": "^0.
|
|
27
|
-
"@rango-dev/queue-manager-react": "^0.
|
|
28
|
-
"@rango-dev/ui": "^0.
|
|
29
|
-
"@rango-dev/wallets-react": "^0.
|
|
30
|
-
"@rango-dev/wallets-shared": "^0.
|
|
24
|
+
"@rango-dev/provider-all": "^0.28.0",
|
|
25
|
+
"@rango-dev/queue-manager-core": "^0.26.0",
|
|
26
|
+
"@rango-dev/queue-manager-rango-preset": "^0.28.0",
|
|
27
|
+
"@rango-dev/queue-manager-react": "^0.26.0",
|
|
28
|
+
"@rango-dev/ui": "^0.29.0",
|
|
29
|
+
"@rango-dev/wallets-react": "^0.14.0",
|
|
30
|
+
"@rango-dev/wallets-shared": "^0.28.0",
|
|
31
31
|
"bignumber.js": "^9.1.1",
|
|
32
32
|
"copy-to-clipboard": "^3.3.3",
|
|
33
33
|
"dayjs": "^1.11.7",
|
package/src/QueueManager.tsx
CHANGED
|
@@ -80,9 +80,6 @@ function QueueManager(props: PropsWithChildren<{ apiKey?: string }>) {
|
|
|
80
80
|
getSupportedChainNames,
|
|
81
81
|
},
|
|
82
82
|
getSigners,
|
|
83
|
-
//todo: remove Network type
|
|
84
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
85
|
-
//@ts-ignore
|
|
86
83
|
wallets,
|
|
87
84
|
providers: allProviders,
|
|
88
85
|
switchNetwork,
|
|
@@ -84,18 +84,23 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
84
84
|
const isWalletRequiredFor = (blockchain: string) =>
|
|
85
85
|
!!selectedQuote?.swaps.find((swap) => swap.from.blockchain === blockchain);
|
|
86
86
|
|
|
87
|
-
const
|
|
87
|
+
const getInitialSelectableWallets = () =>
|
|
88
88
|
connectedWallets.filter((connectedWallet) => {
|
|
89
89
|
return (
|
|
90
90
|
connectedWallet.selected &&
|
|
91
91
|
requiredWallets.includes(connectedWallet.chain)
|
|
92
92
|
);
|
|
93
|
-
})
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const [selectableWallets, setSelectableWallets] = useState<ConnectedWallet[]>(
|
|
96
|
+
getInitialSelectableWallets()
|
|
94
97
|
);
|
|
95
98
|
const lastStepToBlockchainMeta = blockchains.find(
|
|
96
99
|
(chain) => chain.name === lastStepToBlockchain?.name
|
|
97
100
|
);
|
|
98
101
|
|
|
102
|
+
const isInsufficientBalanceModalOpen = balanceWarnings.length > 0;
|
|
103
|
+
|
|
99
104
|
const isSelected = (walletType: string, chain: string) =>
|
|
100
105
|
!!selectableWallets.find(
|
|
101
106
|
(selectableWallet) =>
|
|
@@ -291,7 +296,7 @@ export function ConfirmWalletsModal(props: PropTypes) {
|
|
|
291
296
|
})}
|
|
292
297
|
anchor="center">
|
|
293
298
|
<WatermarkedModal
|
|
294
|
-
open={
|
|
299
|
+
open={isInsufficientBalanceModalOpen}
|
|
295
300
|
onClose={setBalanceWarnings.bind(null, [])}
|
|
296
301
|
container={modalContainer}>
|
|
297
302
|
<MessageBox
|
|
@@ -122,6 +122,14 @@ export function Quote(props: QuoteProps) {
|
|
|
122
122
|
stepState = 'warning';
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
+
let alertTitle = stepHasError
|
|
126
|
+
? i18n.t('Slippage Error')
|
|
127
|
+
: i18n.t('Slippage Warning');
|
|
128
|
+
|
|
129
|
+
if (error?.type === QuoteErrorType.BRIDGE_LIMIT) {
|
|
130
|
+
alertTitle = error?.recommendation;
|
|
131
|
+
}
|
|
132
|
+
|
|
125
133
|
return {
|
|
126
134
|
swapper: {
|
|
127
135
|
displayName: getSwapperDisplayName(swap.swapperId, swappers),
|
|
@@ -197,11 +205,7 @@ export function Quote(props: QuoteProps) {
|
|
|
197
205
|
<Alert
|
|
198
206
|
variant="alarm"
|
|
199
207
|
type={stepHasError ? 'error' : 'warning'}
|
|
200
|
-
title={
|
|
201
|
-
error?.type === QuoteErrorType.BRIDGE_LIMIT
|
|
202
|
-
? error?.recommendation
|
|
203
|
-
: i18n.t(`Slippage ${stepHasError ? 'Error' : 'Warning'}:`)
|
|
204
|
-
}
|
|
208
|
+
title={alertTitle}
|
|
205
209
|
footer={
|
|
206
210
|
<FooterAlert>
|
|
207
211
|
{error?.type === QuoteErrorType.BRIDGE_LIMIT && (
|
|
@@ -95,9 +95,7 @@ export function SwapDetailsCompleteModal(props: CompleteModalPropTypes) {
|
|
|
95
95
|
type="primary"
|
|
96
96
|
size="large"
|
|
97
97
|
onClick={() => window.open(diagnosisUrl, '_blank')}>
|
|
98
|
-
|
|
99
|
-
{i18n.t('Diagnosis')}
|
|
100
|
-
</Typography>
|
|
98
|
+
{i18n.t('Diagnosis')}
|
|
101
99
|
</Button>
|
|
102
100
|
<Divider size={12} />
|
|
103
101
|
</>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CancelContentProps } from './SwapDetailsModal.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
|
export const CancelContent = ({ onCancel, onClose }: CancelContentProps) => {
|
|
@@ -19,15 +19,11 @@ export const CancelContent = ({ onCancel, onClose }: CancelContentProps) => {
|
|
|
19
19
|
type="primary"
|
|
20
20
|
size="large"
|
|
21
21
|
onClick={onCancel}>
|
|
22
|
-
|
|
23
|
-
{i18n.t('Yes, Cancel it')}
|
|
24
|
-
</Typography>
|
|
22
|
+
{i18n.t('Yes, Cancel it')}
|
|
25
23
|
</Button>
|
|
26
24
|
<Divider size={12} />
|
|
27
25
|
<Button variant="outlined" type="primary" size="large" onClick={onClose}>
|
|
28
|
-
|
|
29
|
-
{i18n.t('No, Continue')}
|
|
30
|
-
</Typography>
|
|
26
|
+
{i18n.t('No, Continue')}
|
|
31
27
|
</Button>
|
|
32
28
|
</>
|
|
33
29
|
);
|
|
@@ -19,9 +19,7 @@ export const DeleteContent = ({ onDelete, onClose }: DeleteContentProps) => {
|
|
|
19
19
|
type="primary"
|
|
20
20
|
size="large"
|
|
21
21
|
onClick={onDelete}>
|
|
22
|
-
|
|
23
|
-
{i18n.t('Yes, Delete it')}
|
|
24
|
-
</Typography>
|
|
22
|
+
{i18n.t('Yes, Delete it')}
|
|
25
23
|
</Button>
|
|
26
24
|
<Divider size={12} />
|
|
27
25
|
<Button variant="outlined" type="primary" size="large" onClick={onClose}>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { FlagPropTypes, Language } from '@rango-dev/ui';
|
|
2
2
|
|
|
3
|
-
import { English, French, Japanese, Spanish } from '@rango-dev/ui';
|
|
3
|
+
import { English, French, Japanese, Portuguese, Spanish } from '@rango-dev/ui';
|
|
4
4
|
|
|
5
5
|
export type LanguageItem = {
|
|
6
6
|
title: string;
|
|
@@ -14,6 +14,7 @@ export const LANGUAGES: LanguageItem[] = [
|
|
|
14
14
|
{ title: 'Spanish', label: 'Español', local: 'es', SVGFlag: Spanish },
|
|
15
15
|
{ title: 'French', label: 'Français', local: 'fr', SVGFlag: French },
|
|
16
16
|
{ title: 'Japanese', label: '日本語', local: 'ja', SVGFlag: Japanese },
|
|
17
|
+
{ title: 'Portuguese', label: 'Português', local: 'pt', SVGFlag: Portuguese },
|
|
17
18
|
];
|
|
18
19
|
|
|
19
20
|
export const DEFAULT_LANGUAGE = 'en';
|
|
@@ -3,15 +3,14 @@ import type {
|
|
|
3
3
|
PropTypes,
|
|
4
4
|
WidgetContextInterface,
|
|
5
5
|
} from './Wallets.types';
|
|
6
|
-
import type { Wallet } from '../../types/wallets';
|
|
7
6
|
import type { ProvidersOptions } from '../../utils/providers';
|
|
8
7
|
import type { EventHandler } from '@rango-dev/wallets-react';
|
|
9
|
-
import type { Network } from '@rango-dev/wallets-shared';
|
|
10
8
|
import type { PropsWithChildren } from 'react';
|
|
11
9
|
|
|
12
10
|
import { Events, Provider } from '@rango-dev/wallets-react';
|
|
11
|
+
import { type Network } from '@rango-dev/wallets-shared';
|
|
13
12
|
import { isEvmBlockchain } from 'rango-sdk';
|
|
14
|
-
import React, { createContext, useEffect, useRef
|
|
13
|
+
import React, { createContext, useEffect, useRef } from 'react';
|
|
15
14
|
|
|
16
15
|
import { useWalletProviders } from '../../hooks/useWalletProviders';
|
|
17
16
|
import { AppStoreProvider, useAppStore } from '../../store/AppStore';
|
|
@@ -35,7 +34,6 @@ function Main(props: PropsWithChildren<PropTypes>) {
|
|
|
35
34
|
const walletOptions: ProvidersOptions = {
|
|
36
35
|
walletConnectProjectId: props.config?.walletConnectProjectId,
|
|
37
36
|
};
|
|
38
|
-
const [accounts, setAccounts] = useState<Wallet[]>([]);
|
|
39
37
|
const { providers } = useWalletProviders(props.config.wallets, walletOptions);
|
|
40
38
|
const { connectWallet, disconnectWallet } = useWalletsStore();
|
|
41
39
|
const onConnectWalletHandler = useRef<OnConnectHandler>();
|
|
@@ -67,7 +65,9 @@ function Main(props: PropsWithChildren<PropTypes>) {
|
|
|
67
65
|
supportedChainNames,
|
|
68
66
|
meta.isContractWallet
|
|
69
67
|
);
|
|
70
|
-
|
|
68
|
+
if (data.length) {
|
|
69
|
+
connectWallet(data, tokens);
|
|
70
|
+
}
|
|
71
71
|
} else {
|
|
72
72
|
disconnectWallet(type);
|
|
73
73
|
}
|
|
@@ -102,12 +102,6 @@ function Main(props: PropsWithChildren<PropTypes>) {
|
|
|
102
102
|
};
|
|
103
103
|
const isActiveTab = useUiStore.use.isActiveTab();
|
|
104
104
|
|
|
105
|
-
useEffect(() => {
|
|
106
|
-
if (accounts.length) {
|
|
107
|
-
connectWallet(accounts, tokens);
|
|
108
|
-
}
|
|
109
|
-
}, [accounts, tokens]);
|
|
110
|
-
|
|
111
105
|
return (
|
|
112
106
|
<WidgetContext.Provider
|
|
113
107
|
// eslint-disable-next-line react/jsx-no-constructed-context-values
|
package/src/pages/Home.tsx
CHANGED
|
@@ -102,7 +102,7 @@ export function Home() {
|
|
|
102
102
|
formatBalance(fromTokenBalance)?.amount ?? '0';
|
|
103
103
|
|
|
104
104
|
const tokenBalanceReal =
|
|
105
|
-
!!fromBlockchain && !!fromToken
|
|
105
|
+
!!fromBlockchain && !!fromToken && fromTokenBalance?.amount
|
|
106
106
|
? numberToString(fromTokenBalance?.amount, fromTokenBalance?.decimals)
|
|
107
107
|
: '0';
|
|
108
108
|
|
|
@@ -203,9 +203,7 @@ export function Home() {
|
|
|
203
203
|
loadingBalance={fetchingBalance}
|
|
204
204
|
tooltipContainer={getContainer()}
|
|
205
205
|
onSelectMaxBalance={() => {
|
|
206
|
-
|
|
207
|
-
setInputAmount(tokenBalanceReal.split(',').join(''));
|
|
208
|
-
}
|
|
206
|
+
setInputAmount(tokenBalanceReal.split(',').join(''));
|
|
209
207
|
}}
|
|
210
208
|
/>
|
|
211
209
|
<SwitchFromAndToButton />
|
|
@@ -129,18 +129,16 @@ export function SettingsPage() {
|
|
|
129
129
|
onClick: () => navigate(navigationRoutes.exchanges),
|
|
130
130
|
};
|
|
131
131
|
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
* };
|
|
143
|
-
*/
|
|
132
|
+
const languageItem = {
|
|
133
|
+
id: 'language-item',
|
|
134
|
+
title: (
|
|
135
|
+
<Typography variant="title" size="xmedium">
|
|
136
|
+
{i18n.t('Language')}
|
|
137
|
+
</Typography>
|
|
138
|
+
),
|
|
139
|
+
end: <ChevronRightIcon color="gray" />,
|
|
140
|
+
onClick: () => navigate(navigationRoutes.languages),
|
|
141
|
+
};
|
|
144
142
|
|
|
145
143
|
const themeItem = {
|
|
146
144
|
id: 'theme-item',
|
|
@@ -185,7 +183,7 @@ export function SettingsPage() {
|
|
|
185
183
|
const settingItems = isLiquidityHidden ? [] : [bridgeItem, exchangeItem];
|
|
186
184
|
|
|
187
185
|
if (!isLanguageHidden) {
|
|
188
|
-
|
|
186
|
+
settingItems.push(languageItem);
|
|
189
187
|
}
|
|
190
188
|
if (!theme?.singleTheme && !isThemeHidden) {
|
|
191
189
|
settingItems.push(themeItem);
|