@rango-dev/widget-embedded 0.1.11-next.17 → 0.1.11-next.20
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/SwapDetailsPlaceholder.d.ts +1 -0
- package/dist/components/SwapDetailsPlaceholder.d.ts.map +1 -1
- package/dist/components/TokenInfo.d.ts.map +1 -1
- package/dist/lib.d.ts.map +1 -1
- package/dist/pages/HistoryPage.d.ts.map +1 -1
- package/dist/pages/Home.d.ts.map +1 -1
- package/dist/pages/SwapDetailsPage.d.ts.map +1 -1
- package/dist/pages/WalletsPage.d.ts +0 -1
- package/dist/pages/WalletsPage.d.ts.map +1 -1
- package/dist/utils/configs.d.ts.map +1 -1
- package/dist/widget-embedded.cjs.development.js +30 -8
- package/dist/widget-embedded.cjs.development.js.map +1 -1
- package/dist/widget-embedded.cjs.production.min.js +30 -8
- package/dist/widget-embedded.cjs.production.min.js.map +1 -1
- package/dist/widget-embedded.esm.js +30 -8
- package/dist/widget-embedded.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/app.css +0 -9
- package/src/components/SwapDetailsPlaceholder.tsx +8 -1
- package/src/components/TokenInfo.tsx +1 -0
- package/src/lib.tsx +10 -1
- package/src/pages/HistoryPage.tsx +4 -1
- package/src/pages/Home.tsx +3 -2
- package/src/pages/SwapDetailsPage.tsx +2 -9
- package/src/pages/WalletsPage.tsx +2 -2
- package/src/utils/configs.ts +7 -1
|
@@ -222,6 +222,16 @@ let configs = {
|
|
|
222
222
|
function getConfig(name) {
|
|
223
223
|
return configs[name];
|
|
224
224
|
}
|
|
225
|
+
function initConfig(nextConfigs) {
|
|
226
|
+
let clonedConfigs;
|
|
227
|
+
if (typeof structuredClone === 'function') {
|
|
228
|
+
clonedConfigs = structuredClone(nextConfigs);
|
|
229
|
+
} else {
|
|
230
|
+
clonedConfigs = JSON.parse(JSON.stringify(nextConfigs));
|
|
231
|
+
}
|
|
232
|
+
configs = clonedConfigs;
|
|
233
|
+
return configs;
|
|
234
|
+
}
|
|
225
235
|
|
|
226
236
|
let rango = undefined;
|
|
227
237
|
const httpService = () => {
|
|
@@ -1535,6 +1545,7 @@ function TokenInfo(props) {
|
|
|
1535
1545
|
color: "neutrals800"
|
|
1536
1546
|
}, `$${numberToString(inputUsdValue)}`)),
|
|
1537
1547
|
value: props.inputAmount || '',
|
|
1548
|
+
min: 0,
|
|
1538
1549
|
onChange: props.type === 'From' ? event => {
|
|
1539
1550
|
props.onAmountChange(event.target.value);
|
|
1540
1551
|
} : undefined
|
|
@@ -1772,7 +1783,7 @@ function Home() {
|
|
|
1772
1783
|
title: `${swap?.swapperId} Limit`
|
|
1773
1784
|
}, React.createElement(React.Fragment, null, React.createElement(Typography, {
|
|
1774
1785
|
variant: "body3"
|
|
1775
|
-
}, fromAmountRangeError,
|
|
1786
|
+
}, `${fromAmountRangeError}, Yours: ${numberToString(swap?.fromAmount || null)} ${swap?.from.symbol}`), React.createElement(Typography, {
|
|
1776
1787
|
variant: "body3"
|
|
1777
1788
|
}, recommendation)))), React.createElement(Footer, null, React.createElement(Button, {
|
|
1778
1789
|
type: "primary",
|
|
@@ -2477,9 +2488,11 @@ function HistoryPage() {
|
|
|
2477
2488
|
} = _ref;
|
|
2478
2489
|
return swap;
|
|
2479
2490
|
});
|
|
2491
|
+
const loading = !manager?.isLoaded();
|
|
2480
2492
|
return React.createElement(History, {
|
|
2481
2493
|
list: pendingSwaps,
|
|
2482
2494
|
groupBy: groupSwapsByDate,
|
|
2495
|
+
loading: loading,
|
|
2483
2496
|
onSwapClick: requestId => {
|
|
2484
2497
|
setSelectedSwap(requestId);
|
|
2485
2498
|
navigate(navigationRoutes.swaps + `/${requestId}`, {
|
|
@@ -2790,6 +2803,13 @@ function getSwapDate(pendingSwap) {
|
|
|
2790
2803
|
const PlaceholderContainer = /*#__PURE__*/styled('div', {
|
|
2791
2804
|
height: '450px'
|
|
2792
2805
|
});
|
|
2806
|
+
const LoaderContainer$1 = /*#__PURE__*/styled('div', {
|
|
2807
|
+
display: 'flex',
|
|
2808
|
+
justifyContent: 'center',
|
|
2809
|
+
width: '100%',
|
|
2810
|
+
paddingTop: '33%',
|
|
2811
|
+
flex: 1
|
|
2812
|
+
});
|
|
2793
2813
|
function SwapDetailsPlaceholder(props) {
|
|
2794
2814
|
const {
|
|
2795
2815
|
requestId,
|
|
@@ -2800,7 +2820,7 @@ function SwapDetailsPlaceholder(props) {
|
|
|
2800
2820
|
title: "Swap Details",
|
|
2801
2821
|
textField: false,
|
|
2802
2822
|
onBack: onBack
|
|
2803
|
-
}, React.createElement(PlaceholderContainer, null, loading ? React.createElement(LoaderContainer, null, React.createElement(Spinner, {
|
|
2823
|
+
}, React.createElement(PlaceholderContainer, null, loading ? React.createElement(LoaderContainer$1, null, React.createElement(Spinner, {
|
|
2804
2824
|
size: 24
|
|
2805
2825
|
})) : React.createElement(Alert, {
|
|
2806
2826
|
type: "secondary",
|
|
@@ -2823,12 +2843,6 @@ function SwapDetailsPage() {
|
|
|
2823
2843
|
const {
|
|
2824
2844
|
manager
|
|
2825
2845
|
} = useManager();
|
|
2826
|
-
const [loading, setLoading] = useState(true);
|
|
2827
|
-
useEffect(() => {
|
|
2828
|
-
setTimeout(() => {
|
|
2829
|
-
setLoading(false);
|
|
2830
|
-
}, 5000);
|
|
2831
|
-
}, []);
|
|
2832
2846
|
const pendingSwaps = getPendingSwaps(manager);
|
|
2833
2847
|
const selectedSwap = pendingSwaps.find(_ref => {
|
|
2834
2848
|
let {
|
|
@@ -2841,6 +2855,7 @@ function SwapDetailsPage() {
|
|
|
2841
2855
|
if (swap) cancelSwap(swap);
|
|
2842
2856
|
};
|
|
2843
2857
|
const swap = selectedSwap?.swap;
|
|
2858
|
+
const loading = !manager?.isLoaded();
|
|
2844
2859
|
if (!swap) return React.createElement(SwapDetailsPlaceholder, {
|
|
2845
2860
|
requestId: selectedSwapRequestId || '',
|
|
2846
2861
|
loading: loading,
|
|
@@ -3396,6 +3411,13 @@ const SwapBox = _ref => {
|
|
|
3396
3411
|
const [disconnectedWallet, setDisconnectedWallet] = useState();
|
|
3397
3412
|
const currentPage = useUiStore.use.currentPage();
|
|
3398
3413
|
const evmBasedChainNames = blockchains.filter(isEvmBlockchain$1).map(chain => chain.name);
|
|
3414
|
+
useMemo(() => {
|
|
3415
|
+
if (config?.apiKey) {
|
|
3416
|
+
initConfig({
|
|
3417
|
+
API_KEY: config?.apiKey
|
|
3418
|
+
});
|
|
3419
|
+
}
|
|
3420
|
+
}, [config]);
|
|
3399
3421
|
const onUpdateState = (type, event, value, state, supportedChains) => {
|
|
3400
3422
|
if (event === Events.ACCOUNTS) {
|
|
3401
3423
|
if (value) {
|