@lifi/widget 1.17.1 → 1.18.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/App.js +6 -86
- package/AppDrawer.js +3 -2
- package/AppRoutes.d.ts +2 -0
- package/AppRoutes.js +85 -0
- package/cjs/App.js +5 -85
- package/cjs/AppDrawer.js +2 -1
- package/cjs/AppRoutes.d.ts +2 -0
- package/cjs/AppRoutes.js +89 -0
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -0
- package/cjs/components/AppContainer.d.ts +4 -5
- package/cjs/components/AppContainer.js +30 -29
- package/cjs/components/Card/Card.d.ts +1 -0
- package/cjs/components/Card/Card.js +13 -9
- package/cjs/components/ChainSelect/ChainSelect.js +3 -3
- package/cjs/components/ChainSelect/ChainSelect.style.d.ts +1 -0
- package/cjs/components/ChainSelect/ChainSelect.style.js +2 -2
- package/cjs/components/ChainSelect/useChainSelect.js +2 -2
- package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +6 -2
- package/cjs/components/Header/Header.d.ts +2 -1
- package/cjs/components/Header/Header.js +3 -2
- package/cjs/components/Header/Header.style.js +3 -2
- package/cjs/components/Header/NavigationHeader.js +4 -1
- package/cjs/components/Header/WalletHeader.js +1 -1
- package/cjs/components/Header/useHeaderActionStore.js +1 -4
- package/cjs/components/PoweredBy/PoweredBy.js +7 -0
- package/cjs/components/SendToWallet/SendToWallet.js +6 -10
- package/cjs/components/SendToWallet/SendToWalletButton.d.ts +2 -0
- package/cjs/components/SendToWallet/SendToWalletButton.js +24 -0
- package/cjs/components/SendToWallet/index.d.ts +1 -0
- package/cjs/components/SendToWallet/index.js +1 -0
- package/cjs/components/SendToWallet/store.d.ts +4 -0
- package/cjs/components/SendToWallet/store.js +13 -0
- package/cjs/components/SendToWallet/types.d.ts +6 -0
- package/cjs/{stores/route → components/SendToWallet}/types.js +0 -0
- package/cjs/components/StepActions/StepActions.style.js +1 -1
- package/cjs/components/SwapButton/SwapButton.d.ts +1 -1
- package/cjs/components/SwapButton/SwapButton.js +4 -4
- package/cjs/components/SwapRouteCard/SwapRouteCard.d.ts +2 -1
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +19 -15
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +30 -0
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.js +16 -3
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -12
- package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +1 -3
- package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.js +1 -13
- package/cjs/components/SwapRouteCard/types.d.ts +6 -2
- package/cjs/{pages/MainPage → components/SwapRoutes}/SwapRoutes.d.ts +0 -0
- package/cjs/components/SwapRoutes/SwapRoutes.js +51 -0
- package/cjs/components/SwapRoutes/SwapRoutes.style.d.ts +43 -0
- package/cjs/components/SwapRoutes/SwapRoutes.style.js +47 -0
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -0
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +38 -0
- package/cjs/components/SwapRoutes/index.d.ts +2 -0
- package/cjs/components/SwapRoutes/index.js +18 -0
- package/cjs/components/Token/Token.d.ts +2 -1
- package/cjs/components/Token/Token.js +10 -6
- package/cjs/components/Token/Token.style.js +2 -0
- package/cjs/components/TokenList/TokenList.js +4 -1
- package/cjs/config/sentry.js +3 -26
- package/cjs/config/theme.js +20 -24
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useChains.js +2 -2
- package/cjs/hooks/useGasSufficiency.js +14 -37
- package/cjs/hooks/useNavigateBack.js +13 -6
- package/cjs/hooks/useRouteExecution.js +5 -8
- package/cjs/hooks/useSwapRoutes.js +1 -4
- package/cjs/hooks/useTelemetry.js +3 -2
- package/cjs/hooks/useTokenBalances.d.ts +1 -1
- package/cjs/hooks/useTokenBalances.js +3 -1
- package/cjs/hooks/useWidgetEvents.js +2 -5
- package/cjs/i18n/index.js +2 -5
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +1 -0
- package/cjs/pages/MainPage/MainPage.js +4 -2
- package/cjs/pages/MainPage/MainSwapButton.js +4 -4
- package/cjs/pages/SelectTokenPage/SelectTokenPage.js +4 -3
- package/cjs/pages/SettingsPage/EnabledBridgesSelect.js +1 -4
- package/cjs/pages/SettingsPage/EnabledExchangesSelect.js +1 -4
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +2 -5
- package/cjs/pages/SwapHistoryPage/SwapHistoryEmpty.js +1 -0
- package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +8 -5
- package/cjs/pages/SwapPage/SwapPage.js +5 -1
- package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +3 -5
- package/cjs/providers/SDKProvider/SDKProvider.js +1 -4
- package/cjs/providers/WalletProvider/WalletProvider.js +2 -2
- package/cjs/stores/chains/useChainOrder.js +1 -4
- package/cjs/stores/chains/useChainOrderStore.js +1 -4
- package/cjs/stores/index.d.ts +2 -1
- package/cjs/stores/index.js +2 -1
- package/cjs/stores/{route → routes}/index.d.ts +2 -1
- package/cjs/stores/{route → routes}/index.js +2 -1
- package/cjs/stores/{route → routes}/types.d.ts +4 -0
- package/cjs/stores/routes/types.js +2 -0
- package/cjs/stores/{route → routes}/useExecutingRoutesIds.d.ts +0 -0
- package/cjs/stores/{route → routes}/useExecutingRoutesIds.js +3 -6
- package/cjs/stores/{route/useRouteStore.d.ts → routes/useRouteExecutionStore.d.ts} +1 -1
- package/cjs/stores/{route/useRouteStore.js → routes/useRouteExecutionStore.js} +3 -6
- package/cjs/stores/routes/useSelectedRouteStore.d.ts +4 -0
- package/cjs/stores/routes/useSelectedRouteStore.js +12 -0
- package/cjs/stores/{route → routes}/useSetExecutableRoute.d.ts +0 -0
- package/cjs/stores/{route → routes}/useSetExecutableRoute.js +2 -2
- package/cjs/stores/{route → routes}/useSwapHistory.d.ts +0 -0
- package/cjs/stores/{route → routes}/useSwapHistory.js +3 -6
- package/cjs/stores/{route → routes}/utils.d.ts +0 -0
- package/cjs/stores/{route → routes}/utils.js +1 -4
- package/cjs/stores/settings/useAppearance.js +1 -4
- package/cjs/stores/settings/useSettings.js +1 -4
- package/cjs/stores/settings/useSettingsStore.js +2 -5
- package/cjs/types/widget.d.ts +2 -0
- package/cjs/utils/colors.d.ts +1 -1
- package/cjs/utils/format.js +1 -4
- package/cjs/utils/navigationRoutes.js +12 -12
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -0
- package/components/AppContainer.d.ts +4 -5
- package/components/AppContainer.js +29 -28
- package/components/Card/Card.d.ts +1 -0
- package/components/Card/Card.js +13 -9
- package/components/ChainSelect/ChainSelect.js +1 -1
- package/components/ChainSelect/ChainSelect.style.d.ts +1 -0
- package/components/ChainSelect/ChainSelect.style.js +2 -2
- package/components/ChainSelect/useChainSelect.js +1 -1
- package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +6 -2
- package/components/Header/Header.d.ts +2 -1
- package/components/Header/Header.js +1 -1
- package/components/Header/Header.style.js +4 -3
- package/components/Header/NavigationHeader.js +4 -1
- package/components/Header/WalletHeader.js +2 -2
- package/components/PoweredBy/PoweredBy.js +7 -0
- package/components/SendToWallet/SendToWallet.js +8 -11
- package/components/SendToWallet/SendToWalletButton.d.ts +2 -0
- package/components/SendToWallet/SendToWalletButton.js +20 -0
- package/components/SendToWallet/index.d.ts +1 -0
- package/components/SendToWallet/index.js +1 -0
- package/components/SendToWallet/store.d.ts +4 -0
- package/components/SendToWallet/store.js +10 -0
- package/components/SendToWallet/types.d.ts +6 -0
- package/{stores/route → components/SendToWallet}/types.js +0 -0
- package/components/StepActions/StepActions.style.js +1 -1
- package/components/SwapButton/SwapButton.d.ts +1 -1
- package/components/SwapButton/SwapButton.js +4 -3
- package/components/SwapRouteCard/SwapRouteCard.d.ts +2 -1
- package/components/SwapRouteCard/SwapRouteCard.js +19 -16
- package/components/SwapRouteCard/SwapRouteCard.style.d.ts +30 -0
- package/components/SwapRouteCard/SwapRouteCard.style.js +17 -4
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -12
- package/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +1 -3
- package/components/SwapRouteCard/SwapRouteNotFoundCard.js +1 -13
- package/components/SwapRouteCard/types.d.ts +6 -2
- package/{pages/MainPage → components/SwapRoutes}/SwapRoutes.d.ts +0 -0
- package/components/SwapRoutes/SwapRoutes.js +47 -0
- package/components/SwapRoutes/SwapRoutes.style.d.ts +43 -0
- package/components/SwapRoutes/SwapRoutes.style.js +44 -0
- package/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -0
- package/components/SwapRoutes/SwapRoutesExpanded.js +34 -0
- package/components/SwapRoutes/index.d.ts +2 -0
- package/components/SwapRoutes/index.js +2 -0
- package/components/Token/Token.d.ts +2 -1
- package/components/Token/Token.js +11 -7
- package/components/Token/Token.style.js +2 -0
- package/components/TokenList/TokenList.js +4 -1
- package/config/theme.js +20 -24
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useChains.js +1 -1
- package/hooks/useGasSufficiency.js +15 -35
- package/hooks/useNavigateBack.js +13 -6
- package/hooks/useRouteExecution.js +5 -5
- package/hooks/useTelemetry.js +3 -2
- package/hooks/useTokenBalances.d.ts +1 -1
- package/hooks/useTokenBalances.js +3 -1
- package/package.json +14 -14
- package/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +1 -0
- package/pages/MainPage/MainPage.js +4 -2
- package/pages/MainPage/MainSwapButton.js +4 -3
- package/pages/SelectTokenPage/SelectTokenPage.js +4 -3
- package/pages/SwapDetailsPage/SwapDetailsPage.js +2 -2
- package/pages/SwapHistoryPage/SwapHistoryEmpty.js +1 -0
- package/pages/SwapHistoryPage/SwapHistoryPage.js +8 -5
- package/pages/SwapPage/SwapPage.js +5 -1
- package/pages/SwapRoutesPage/SwapRoutesPage.js +4 -6
- package/providers/WalletProvider/WalletProvider.js +1 -1
- package/stores/index.d.ts +2 -1
- package/stores/index.js +2 -1
- package/stores/{route → routes}/index.d.ts +2 -1
- package/stores/{route → routes}/index.js +2 -1
- package/stores/{route → routes}/types.d.ts +4 -0
- package/stores/routes/types.js +1 -0
- package/stores/{route → routes}/useExecutingRoutesIds.d.ts +0 -0
- package/stores/{route → routes}/useExecutingRoutesIds.js +2 -2
- package/stores/{route/useRouteStore.d.ts → routes/useRouteExecutionStore.d.ts} +1 -1
- package/stores/{route/useRouteStore.js → routes/useRouteExecutionStore.js} +1 -1
- package/stores/routes/useSelectedRouteStore.d.ts +4 -0
- package/stores/routes/useSelectedRouteStore.js +9 -0
- package/stores/{route → routes}/useSetExecutableRoute.d.ts +0 -0
- package/stores/routes/useSetExecutableRoute.js +4 -0
- package/stores/{route → routes}/useSwapHistory.d.ts +0 -0
- package/stores/{route → routes}/useSwapHistory.js +2 -2
- package/stores/{route → routes}/utils.d.ts +0 -0
- package/stores/{route → routes}/utils.js +0 -0
- package/stores/settings/useSettingsStore.js +1 -1
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/widget.d.ts +2 -0
- package/utils/colors.d.ts +1 -1
- package/utils/navigationRoutes.js +12 -12
- package/cjs/pages/MainPage/SwapRoutes.js +0 -43
- package/cjs/pages/MainPage/SwapRoutes.style.d.ts +0 -11
- package/cjs/pages/MainPage/SwapRoutes.style.js +0 -16
- package/pages/MainPage/SwapRoutes.js +0 -39
- package/pages/MainPage/SwapRoutes.style.d.ts +0 -11
- package/pages/MainPage/SwapRoutes.style.js +0 -13
- package/stores/route/useSetExecutableRoute.js +0 -4
package/types/widget.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import type { PaletteMode, PaletteOptions, Shape } from '@mui/material';
|
|
|
3
3
|
import type { TypographyOptions } from '@mui/material/styles/createTypography';
|
|
4
4
|
import type { Signer } from 'ethers';
|
|
5
5
|
import type { CSSProperties } from 'react';
|
|
6
|
+
export declare type WidgetVariant = 'default' | 'expandable' | 'drawer';
|
|
6
7
|
export declare type Appearance = PaletteMode | 'auto';
|
|
7
8
|
export declare type ThemeConfig = {
|
|
8
9
|
palette?: Pick<PaletteOptions, 'primary' | 'secondary'>;
|
|
@@ -34,6 +35,7 @@ export interface WidgetConfig {
|
|
|
34
35
|
/** @deprecated Use tokens.featured instead */
|
|
35
36
|
featuredTokens?: Token[];
|
|
36
37
|
integrator?: string;
|
|
38
|
+
variant?: WidgetVariant;
|
|
37
39
|
walletManagement?: WidgetWalletManagement;
|
|
38
40
|
sdkConfig?: ConfigUpdate;
|
|
39
41
|
bridges?: {
|
package/utils/colors.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Theme } from '@mui/material';
|
|
2
2
|
export declare const getContrastAlphaColor: (theme: Theme, alpha: string | number) => string;
|
|
3
|
-
export declare const getContrastTextColor: (theme: Theme, background?: string) => "#
|
|
3
|
+
export declare const getContrastTextColor: (theme: Theme, background?: string) => "#fff" | "#000";
|
|
@@ -14,26 +14,26 @@ export const navigationRoutes = {
|
|
|
14
14
|
};
|
|
15
15
|
export const navigationRoutesValues = Object.values(navigationRoutes);
|
|
16
16
|
export const stickyHeaderRoutes = [
|
|
17
|
-
navigationRoutes.
|
|
17
|
+
navigationRoutes.activeSwaps,
|
|
18
18
|
navigationRoutes.fromChain,
|
|
19
|
-
navigationRoutes.
|
|
19
|
+
navigationRoutes.selectWallet,
|
|
20
20
|
navigationRoutes.settings,
|
|
21
|
-
navigationRoutes.
|
|
21
|
+
navigationRoutes.swapDetails,
|
|
22
22
|
navigationRoutes.swapExecution,
|
|
23
23
|
navigationRoutes.swapHistory,
|
|
24
|
-
navigationRoutes.
|
|
25
|
-
navigationRoutes.
|
|
24
|
+
navigationRoutes.swapRoutes,
|
|
25
|
+
navigationRoutes.toChain,
|
|
26
26
|
];
|
|
27
27
|
export const backButtonRoutes = [
|
|
28
|
+
navigationRoutes.activeSwaps,
|
|
29
|
+
navigationRoutes.fromChain,
|
|
30
|
+
navigationRoutes.fromToken,
|
|
28
31
|
navigationRoutes.selectWallet,
|
|
29
32
|
navigationRoutes.settings,
|
|
33
|
+
navigationRoutes.swapDetails,
|
|
34
|
+
navigationRoutes.swapExecution,
|
|
30
35
|
navigationRoutes.swapHistory,
|
|
31
|
-
navigationRoutes.activeSwaps,
|
|
32
|
-
navigationRoutes.fromToken,
|
|
33
|
-
navigationRoutes.toToken,
|
|
34
|
-
navigationRoutes.fromChain,
|
|
35
|
-
navigationRoutes.toChain,
|
|
36
36
|
navigationRoutes.swapRoutes,
|
|
37
|
-
navigationRoutes.
|
|
38
|
-
navigationRoutes.
|
|
37
|
+
navigationRoutes.toChain,
|
|
38
|
+
navigationRoutes.toToken,
|
|
39
39
|
];
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SwapRoutes = void 0;
|
|
4
|
-
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
-
/* eslint-disable react/no-array-index-key */
|
|
6
|
-
const icons_material_1 = require("@mui/icons-material");
|
|
7
|
-
const material_1 = require("@mui/material");
|
|
8
|
-
const react_1 = require("react");
|
|
9
|
-
const react_hook_form_1 = require("react-hook-form");
|
|
10
|
-
const react_i18next_1 = require("react-i18next");
|
|
11
|
-
const react_router_dom_1 = require("react-router-dom");
|
|
12
|
-
const Card_1 = require("../../components/Card");
|
|
13
|
-
const GasSufficiencyMessage_1 = require("../../components/GasSufficiencyMessage");
|
|
14
|
-
const ProgressToNextUpdate_1 = require("../../components/ProgressToNextUpdate");
|
|
15
|
-
const SendToWallet_1 = require("../../components/SendToWallet");
|
|
16
|
-
const SwapRouteCard_1 = require("../../components/SwapRouteCard");
|
|
17
|
-
const hooks_1 = require("../../hooks");
|
|
18
|
-
const utils_1 = require("../../utils");
|
|
19
|
-
const SwapRoutes_style_1 = require("./SwapRoutes.style");
|
|
20
|
-
const SwapRoutes = (props) => {
|
|
21
|
-
const { t } = (0, react_i18next_1.useTranslation)();
|
|
22
|
-
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
23
|
-
const { isValid, isValidating } = (0, react_hook_form_1.useFormState)();
|
|
24
|
-
const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = (0, hooks_1.useSwapRoutes)();
|
|
25
|
-
const handleCardClick = (0, react_1.useCallback)(() => {
|
|
26
|
-
navigate(utils_1.navigationRoutes.swapRoutes);
|
|
27
|
-
}, [navigate]);
|
|
28
|
-
const currentRoute = routes === null || routes === void 0 ? void 0 : routes[0];
|
|
29
|
-
if (!currentRoute && !isLoading && !isFetching && !isFetched) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
const routeNotFound = !currentRoute && !isLoading && !isFetching;
|
|
33
|
-
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({}, props, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('swap.routes') }), (0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: {
|
|
34
|
-
position: 'absolute',
|
|
35
|
-
top: 8,
|
|
36
|
-
right: 8,
|
|
37
|
-
} }), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: { display: 'flex' } }, { children: [(0, jsx_runtime_1.jsx)(SwapRoutes_style_1.Stack, Object.assign({ direction: "row", spacing: 2, my: 2, ml: 2, mr: routeNotFound ? 2 : 1, sx: {
|
|
38
|
-
borderWidth: !routeNotFound && (isFetching || (routes && routes.length > 1))
|
|
39
|
-
? 1
|
|
40
|
-
: 0,
|
|
41
|
-
} }, { children: isLoading || isFetching ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { minWidth: "80%", dense: true }), (0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { minWidth: "80%", dense: true })] })) : !currentRoute ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, { minWidth: "100%", dense: true })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { minWidth: routes.length > 1 ? '80%' : '100%', route: currentRoute, active: true, dense: true }), routes.length > 1 ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { minWidth: "80%", route: routes[1], dense: true })) : null] })) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: !routeNotFound ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ py: 1, pr: 1 }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: handleCardClick, size: "medium", "aria-label": "swap-routes", disabled: isValidating || !isValid }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.KeyboardArrowRight, {}) })) }))) : null }))] }))] })), (0, jsx_runtime_1.jsx)(GasSufficiencyMessage_1.GasSufficiencyMessage, Object.assign({ route: !isFetching ? currentRoute : undefined }, props)), (0, jsx_runtime_1.jsx)(SendToWallet_1.SendToWallet, { mx: 3, mb: 3 })] }));
|
|
42
|
-
};
|
|
43
|
-
exports.SwapRoutes = SwapRoutes;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare const Stack: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
3
|
-
ref?: import("react").Ref<unknown> | undefined;
|
|
4
|
-
children?: import("react").ReactNode;
|
|
5
|
-
direction?: import("@mui/system").ResponsiveStyleValue<"row" | "column" | "column-reverse" | "row-reverse"> | undefined;
|
|
6
|
-
spacing?: import("@mui/system").ResponsiveStyleValue<string | number> | undefined;
|
|
7
|
-
divider?: import("react").ReactNode;
|
|
8
|
-
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
9
|
-
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
10
|
-
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
11
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | "direction" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "divider" | "spacing"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Stack = void 0;
|
|
4
|
-
const material_1 = require("@mui/material");
|
|
5
|
-
const styles_1 = require("@mui/material/styles");
|
|
6
|
-
exports.Stack = (0, styles_1.styled)(material_1.Stack)(({ theme }) => ({
|
|
7
|
-
alignItems: 'stretch',
|
|
8
|
-
display: 'flex',
|
|
9
|
-
flex: 1,
|
|
10
|
-
flexWrap: 'nowrap',
|
|
11
|
-
overflow: 'hidden',
|
|
12
|
-
borderRight: `solid ${theme.palette.mode === 'light'
|
|
13
|
-
? theme.palette.grey[300]
|
|
14
|
-
: theme.palette.grey[800]}`,
|
|
15
|
-
width: 'calc(100% - 48px)',
|
|
16
|
-
}));
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
/* eslint-disable react/no-array-index-key */
|
|
3
|
-
import { KeyboardArrowRight as KeyboardArrowRightIcon } from '@mui/icons-material';
|
|
4
|
-
import { Box, IconButton } from '@mui/material';
|
|
5
|
-
import { useCallback } from 'react';
|
|
6
|
-
import { useFormState } from 'react-hook-form';
|
|
7
|
-
import { useTranslation } from 'react-i18next';
|
|
8
|
-
import { useNavigate } from 'react-router-dom';
|
|
9
|
-
import { Card, CardTitle } from '../../components/Card';
|
|
10
|
-
import { GasSufficiencyMessage } from '../../components/GasSufficiencyMessage';
|
|
11
|
-
import { ProgressToNextUpdate } from '../../components/ProgressToNextUpdate';
|
|
12
|
-
import { SendToWallet } from '../../components/SendToWallet';
|
|
13
|
-
import { SwapRouteCard, SwapRouteCardSkeleton, SwapRouteNotFoundCard, } from '../../components/SwapRouteCard';
|
|
14
|
-
import { useSwapRoutes } from '../../hooks';
|
|
15
|
-
import { navigationRoutes } from '../../utils';
|
|
16
|
-
import { Stack } from './SwapRoutes.style';
|
|
17
|
-
export const SwapRoutes = (props) => {
|
|
18
|
-
const { t } = useTranslation();
|
|
19
|
-
const navigate = useNavigate();
|
|
20
|
-
const { isValid, isValidating } = useFormState();
|
|
21
|
-
const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = useSwapRoutes();
|
|
22
|
-
const handleCardClick = useCallback(() => {
|
|
23
|
-
navigate(navigationRoutes.swapRoutes);
|
|
24
|
-
}, [navigate]);
|
|
25
|
-
const currentRoute = routes === null || routes === void 0 ? void 0 : routes[0];
|
|
26
|
-
if (!currentRoute && !isLoading && !isFetching && !isFetched) {
|
|
27
|
-
return null;
|
|
28
|
-
}
|
|
29
|
-
const routeNotFound = !currentRoute && !isLoading && !isFetching;
|
|
30
|
-
return (_jsxs(_Fragment, { children: [_jsxs(Card, Object.assign({}, props, { children: [_jsx(CardTitle, { children: t('swap.routes') }), _jsx(ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: {
|
|
31
|
-
position: 'absolute',
|
|
32
|
-
top: 8,
|
|
33
|
-
right: 8,
|
|
34
|
-
} }), _jsxs(Box, Object.assign({ sx: { display: 'flex' } }, { children: [_jsx(Stack, Object.assign({ direction: "row", spacing: 2, my: 2, ml: 2, mr: routeNotFound ? 2 : 1, sx: {
|
|
35
|
-
borderWidth: !routeNotFound && (isFetching || (routes && routes.length > 1))
|
|
36
|
-
? 1
|
|
37
|
-
: 0,
|
|
38
|
-
} }, { children: isLoading || isFetching ? (_jsxs(_Fragment, { children: [_jsx(SwapRouteCardSkeleton, { minWidth: "80%", dense: true }), _jsx(SwapRouteCardSkeleton, { minWidth: "80%", dense: true })] })) : !currentRoute ? (_jsx(SwapRouteNotFoundCard, { minWidth: "100%", dense: true })) : (_jsxs(_Fragment, { children: [_jsx(SwapRouteCard, { minWidth: routes.length > 1 ? '80%' : '100%', route: currentRoute, active: true, dense: true }), routes.length > 1 ? (_jsx(SwapRouteCard, { minWidth: "80%", route: routes[1], dense: true })) : null] })) })), _jsx(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: !routeNotFound ? (_jsx(Box, Object.assign({ py: 1, pr: 1 }, { children: _jsx(IconButton, Object.assign({ onClick: handleCardClick, size: "medium", "aria-label": "swap-routes", disabled: isValidating || !isValid }, { children: _jsx(KeyboardArrowRightIcon, {}) })) }))) : null }))] }))] })), _jsx(GasSufficiencyMessage, Object.assign({ route: !isFetching ? currentRoute : undefined }, props)), _jsx(SendToWallet, { mx: 3, mb: 3 })] }));
|
|
39
|
-
};
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
|
-
export declare const Stack: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
3
|
-
ref?: import("react").Ref<unknown> | undefined;
|
|
4
|
-
children?: import("react").ReactNode;
|
|
5
|
-
direction?: import("@mui/system").ResponsiveStyleValue<"row" | "column" | "column-reverse" | "row-reverse"> | undefined;
|
|
6
|
-
spacing?: import("@mui/system").ResponsiveStyleValue<string | number> | undefined;
|
|
7
|
-
divider?: import("react").ReactNode;
|
|
8
|
-
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
9
|
-
} & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
10
|
-
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
11
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | "direction" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "divider" | "spacing"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { Stack as MuiStack } from '@mui/material';
|
|
2
|
-
import { styled } from '@mui/material/styles';
|
|
3
|
-
export const Stack = styled(MuiStack)(({ theme }) => ({
|
|
4
|
-
alignItems: 'stretch',
|
|
5
|
-
display: 'flex',
|
|
6
|
-
flex: 1,
|
|
7
|
-
flexWrap: 'nowrap',
|
|
8
|
-
overflow: 'hidden',
|
|
9
|
-
borderRight: `solid ${theme.palette.mode === 'light'
|
|
10
|
-
? theme.palette.grey[300]
|
|
11
|
-
: theme.palette.grey[800]}`,
|
|
12
|
-
width: 'calc(100% - 48px)',
|
|
13
|
-
}));
|