@lifi/widget 1.18.0 → 1.18.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.
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.js +1 -0
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +4 -4
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +1 -1
- package/cjs/components/SwapRouteCard/types.d.ts +3 -2
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +9 -5
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/components/ActiveSwaps/ActiveSwaps.style.js +1 -0
- package/components/SwapRouteCard/SwapRouteCard.js +4 -4
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +1 -1
- package/components/SwapRouteCard/types.d.ts +3 -2
- package/components/SwapRoutes/SwapRoutesExpanded.js +9 -5
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/package.json +1 -1
- package/tsconfig.cjs.tsbuildinfo +1 -1
|
@@ -23,18 +23,18 @@ const Token_1 = require("../Token");
|
|
|
23
23
|
const SwapRouteCard_style_1 = require("./SwapRouteCard.style");
|
|
24
24
|
const SwapRouteCard = (_a) => {
|
|
25
25
|
var _b;
|
|
26
|
-
var { route, active, variant = 'default' } = _a, other = __rest(_a, ["route", "active", "variant"]);
|
|
26
|
+
var { route, active, variant = 'default', expanded } = _a, other = __rest(_a, ["route", "active", "variant", "expanded"]);
|
|
27
27
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
28
|
-
const [
|
|
28
|
+
const [cardExpanded, setCardExpanded] = (0, react_1.useState)(variant === 'default' || expanded);
|
|
29
29
|
const alternativeTag = t(`swap.tags.ALTERNATIVE`);
|
|
30
30
|
const label = ((_b = route.tags) === null || _b === void 0 ? void 0 : _b.length)
|
|
31
31
|
? t(`swap.tags.${route.tags[0]}`)
|
|
32
32
|
: alternativeTag;
|
|
33
33
|
const handleExpand = (e) => {
|
|
34
34
|
e.stopPropagation();
|
|
35
|
-
|
|
35
|
+
setCardExpanded((expanded) => !expanded);
|
|
36
36
|
};
|
|
37
|
-
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ dense: variant === 'dense', variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.Label, Object.assign({ active: active !== null && active !== void 0 ? active : label !== alternativeTag }, { children: label })), variant === '
|
|
37
|
+
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ dense: variant === 'dense', variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.Label, Object.assign({ active: active !== null && active !== void 0 ? active : label !== alternativeTag }, { children: label })), variant === 'stretched' ? ((0, jsx_runtime_1.jsx)(exports.SwapRouteCardEssentials, { route: route })) : null] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(Token_1.Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: route.toAmount }), step: variant === 'stretched' ? route.steps[0] : undefined }), variant === 'stretched' && !expanded ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_style_1.IconButton, Object.assign({ onClick: handleExpand, size: "small" }, { children: cardExpanded ? (0, jsx_runtime_1.jsx)(icons_material_1.ExpandLess, {}) : (0, jsx_runtime_1.jsx)(icons_material_1.ExpandMore, {}) }))) : null] })), (0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ mountOnEnter: true, unmountOnExit: true, in: cardExpanded }, { children: route.steps.map((step) => ((0, jsx_runtime_1.jsx)(StepActions_1.StepActions, { step: step, mt: 2 }, step.id))) })), variant !== 'stretched' ? ((0, jsx_runtime_1.jsx)(exports.SwapRouteCardEssentials, { route: route, dense: true })) : null] })));
|
|
38
38
|
};
|
|
39
39
|
exports.SwapRouteCard = SwapRouteCard;
|
|
40
40
|
const SwapRouteCardEssentials = ({ route, dense }) => {
|
|
@@ -17,6 +17,6 @@ const material_1 = require("@mui/material");
|
|
|
17
17
|
const Card_1 = require("../Card");
|
|
18
18
|
const SwapRouteCardSkeleton = (_a) => {
|
|
19
19
|
var { variant } = _a, other = __rest(_a, ["variant"]);
|
|
20
|
-
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ dense: variant === 'dense', indented: true }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", width: 118, height: 24, sx: { borderRadius: 0.5 } }), variant === '
|
|
20
|
+
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ dense: variant === 'dense', indented: true }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "rectangular", width: 118, height: 24, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 52, height: 24, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 44, height: 24, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 32, height: 24 })] }))) : null] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ mt: 2 }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mr: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "circular", width: 32, height: 32 }) })), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 96, height: 32 })] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ ml: 6, display: "flex", alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 102, height: 16, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? ((0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 72, height: 16, sx: { marginLeft: 1 } })) : null] }))] })), variant !== 'stretched' ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ mt: 2, display: "flex", justifyContent: "space-between" }, { children: [(0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 24 }), (0, jsx_runtime_1.jsx)(material_1.Skeleton, { variant: "text", width: 48, height: 24 })] }))) : null] })));
|
|
21
21
|
};
|
|
22
22
|
exports.SwapRouteCardSkeleton = SwapRouteCardSkeleton;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { Route } from '@lifi/sdk';
|
|
2
2
|
export interface SwapRouteCardProps {
|
|
3
3
|
route: Route;
|
|
4
|
-
variant?: 'default' | '
|
|
4
|
+
variant?: 'default' | 'stretched' | 'dense';
|
|
5
5
|
active?: boolean;
|
|
6
|
+
expanded?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export interface SwapRouteCardEssentialsProps {
|
|
8
9
|
route: Route;
|
|
9
10
|
dense?: boolean;
|
|
10
11
|
}
|
|
11
12
|
export interface SwapRouteCardSkeletonProps {
|
|
12
|
-
variant?: 'default' | '
|
|
13
|
+
variant?: 'default' | 'stretched' | 'dense';
|
|
13
14
|
}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SwapRoutesExpanded = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
6
7
|
const react_i18next_1 = require("react-i18next");
|
|
7
8
|
const react_router_dom_1 = require("react-router-dom");
|
|
8
9
|
const hooks_1 = require("../../hooks");
|
|
@@ -17,6 +18,7 @@ const SwapRoutesExpanded = () => {
|
|
|
17
18
|
const { containerStyle } = (0, providers_1.useWidgetConfig)();
|
|
18
19
|
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
19
20
|
const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = (0, hooks_1.useSwapRoutes)();
|
|
21
|
+
const { isValid, isValidating } = (0, react_hook_form_1.useFormState)();
|
|
20
22
|
const setExecutableRoute = (0, stores_1.useSetExecutableRoute)();
|
|
21
23
|
const { pathname } = (0, react_router_dom_1.useLocation)();
|
|
22
24
|
const cleanedPathname = pathname.endsWith('/')
|
|
@@ -25,14 +27,16 @@ const SwapRoutesExpanded = () => {
|
|
|
25
27
|
const path = cleanedPathname.substring(cleanedPathname.lastIndexOf('/') + 1);
|
|
26
28
|
const hasPath = utils_1.navigationRoutesValues.includes(path);
|
|
27
29
|
const handleRouteClick = (route) => {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
if (isValid && !isValidating) {
|
|
31
|
+
setExecutableRoute(route);
|
|
32
|
+
navigate(utils_1.navigationRoutes.swapExecution, {
|
|
33
|
+
state: { routeId: route.id },
|
|
34
|
+
});
|
|
35
|
+
}
|
|
32
36
|
};
|
|
33
37
|
const currentRoute = routes === null || routes === void 0 ? void 0 : routes[0];
|
|
34
38
|
const expanded = Boolean(currentRoute || isLoading || isFetching || isFetched) && !hasPath;
|
|
35
39
|
const routeNotFound = !currentRoute && !isLoading && !isFetching && expanded;
|
|
36
|
-
return ((0, jsx_runtime_1.jsx)(SwapRoutes_style_1.CollapseContainer, { children: (0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ appear: true, timeout: 225, in: expanded, orientation: "horizontal" }, { children: (0, jsx_runtime_1.jsx)(material_1.Grow, Object.assign({ appear: true, timeout: 225, in: expanded }, { children: (0, jsx_runtime_1.jsx)(SwapRoutes_style_1.Container, Object.assign({ sx: containerStyle }, { children: (0, jsx_runtime_1.jsxs)(SwapRoutes_style_1.ScrollableContainer, { children: [(0, jsx_runtime_1.jsxs)(SwapRoutes_style_1.Header, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 18, fontWeight: "700", flex: 1, noWrap: true }, { children: t('swap.routes') })), (0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 } })] }), (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ direction: "column", spacing: 2, flex: 1, paddingX: 3, paddingBottom: 3 }, { children: routeNotFound ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : isLoading || isFetching ? (Array.from({ length: 3 }).map((_, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { variant: "
|
|
40
|
+
return ((0, jsx_runtime_1.jsx)(SwapRoutes_style_1.CollapseContainer, { children: (0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ appear: true, timeout: 225, in: expanded, orientation: "horizontal" }, { children: (0, jsx_runtime_1.jsx)(material_1.Grow, Object.assign({ appear: true, timeout: 225, in: expanded }, { children: (0, jsx_runtime_1.jsx)(SwapRoutes_style_1.Container, Object.assign({ sx: containerStyle }, { children: (0, jsx_runtime_1.jsxs)(SwapRoutes_style_1.ScrollableContainer, { children: [(0, jsx_runtime_1.jsxs)(SwapRoutes_style_1.Header, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 18, fontWeight: "700", flex: 1, noWrap: true }, { children: t('swap.routes') })), (0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 } })] }), (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ direction: "column", spacing: 2, flex: 1, paddingX: 3, paddingBottom: 3 }, { children: routeNotFound ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : isLoading || isFetching ? (Array.from({ length: 3 }).map((_, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { variant: "stretched" }, index)))) : (routes === null || routes === void 0 ? void 0 : routes.map((route, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0, variant: "stretched", expanded: (routes === null || routes === void 0 ? void 0 : routes.length) <= 2 }, route.id)))) }))] }) })) })) })) }));
|
|
37
41
|
};
|
|
38
42
|
exports.SwapRoutesExpanded = SwapRoutesExpanded;
|
package/cjs/config/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/widget";
|
|
2
|
-
export declare const version = "1.18.
|
|
2
|
+
export declare const version = "1.18.2";
|
package/cjs/config/version.js
CHANGED
|
@@ -20,18 +20,18 @@ import { Token } from '../Token';
|
|
|
20
20
|
import { IconButton, Label } from './SwapRouteCard.style';
|
|
21
21
|
export const SwapRouteCard = (_a) => {
|
|
22
22
|
var _b;
|
|
23
|
-
var { route, active, variant = 'default' } = _a, other = __rest(_a, ["route", "active", "variant"]);
|
|
23
|
+
var { route, active, variant = 'default', expanded } = _a, other = __rest(_a, ["route", "active", "variant", "expanded"]);
|
|
24
24
|
const { t } = useTranslation();
|
|
25
|
-
const [
|
|
25
|
+
const [cardExpanded, setCardExpanded] = useState(variant === 'default' || expanded);
|
|
26
26
|
const alternativeTag = t(`swap.tags.ALTERNATIVE`);
|
|
27
27
|
const label = ((_b = route.tags) === null || _b === void 0 ? void 0 : _b.length)
|
|
28
28
|
? t(`swap.tags.${route.tags[0]}`)
|
|
29
29
|
: alternativeTag;
|
|
30
30
|
const handleExpand = (e) => {
|
|
31
31
|
e.stopPropagation();
|
|
32
|
-
|
|
32
|
+
setCardExpanded((expanded) => !expanded);
|
|
33
33
|
};
|
|
34
|
-
return (_jsxs(Card, Object.assign({ dense: variant === 'dense', variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true }, other, { children: [_jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [_jsx(Label, Object.assign({ active: active !== null && active !== void 0 ? active : label !== alternativeTag }, { children: label })), variant === '
|
|
34
|
+
return (_jsxs(Card, Object.assign({ dense: variant === 'dense', variant: active ? 'selected' : 'default', selectionColor: "secondary", indented: true }, other, { children: [_jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center", mb: 2 }, { children: [_jsx(Label, Object.assign({ active: active !== null && active !== void 0 ? active : label !== alternativeTag }, { children: label })), variant === 'stretched' ? (_jsx(SwapRouteCardEssentials, { route: route })) : null] })), _jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center" }, { children: [_jsx(Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: route.toAmount }), step: variant === 'stretched' ? route.steps[0] : undefined }), variant === 'stretched' && !expanded ? (_jsx(IconButton, Object.assign({ onClick: handleExpand, size: "small" }, { children: cardExpanded ? _jsx(ExpandLessIcon, {}) : _jsx(ExpandMoreIcon, {}) }))) : null] })), _jsx(Collapse, Object.assign({ mountOnEnter: true, unmountOnExit: true, in: cardExpanded }, { children: route.steps.map((step) => (_jsx(StepActions, { step: step, mt: 2 }, step.id))) })), variant !== 'stretched' ? (_jsx(SwapRouteCardEssentials, { route: route, dense: true })) : null] })));
|
|
35
35
|
};
|
|
36
36
|
export const SwapRouteCardEssentials = ({ route, dense }) => {
|
|
37
37
|
var _a;
|
|
@@ -14,5 +14,5 @@ import { Box, Skeleton } from '@mui/material';
|
|
|
14
14
|
import { Card } from '../Card';
|
|
15
15
|
export const SwapRouteCardSkeleton = (_a) => {
|
|
16
16
|
var { variant } = _a, other = __rest(_a, ["variant"]);
|
|
17
|
-
return (_jsxs(Card, Object.assign({ dense: variant === 'dense', indented: true }, other, { children: [_jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center" }, { children: [_jsx(Skeleton, { variant: "rectangular", width: 118, height: 24, sx: { borderRadius: 0.5 } }), variant === '
|
|
17
|
+
return (_jsxs(Card, Object.assign({ dense: variant === 'dense', indented: true }, other, { children: [_jsxs(Box, Object.assign({ display: "flex", justifyContent: "space-between", alignItems: "center" }, { children: [_jsx(Skeleton, { variant: "rectangular", width: 118, height: 24, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? (_jsxs(Box, Object.assign({ display: "flex" }, { children: [_jsx(Skeleton, { variant: "text", width: 52, height: 24, sx: { marginRight: 2 } }), _jsx(Skeleton, { variant: "text", width: 44, height: 24, sx: { marginRight: 2 } }), _jsx(Skeleton, { variant: "text", width: 32, height: 24 })] }))) : null] })), _jsxs(Box, Object.assign({ mt: 2 }, { children: [_jsxs(Box, Object.assign({ display: "flex", alignItems: "center" }, { children: [_jsx(Box, Object.assign({ mr: 2 }, { children: _jsx(Skeleton, { variant: "circular", width: 32, height: 32 }) })), _jsx(Skeleton, { variant: "text", width: 96, height: 32 })] })), _jsxs(Box, Object.assign({ ml: 6, display: "flex", alignItems: "center" }, { children: [_jsx(Skeleton, { variant: "text", width: 102, height: 16, sx: { borderRadius: 0.5 } }), variant === 'stretched' ? (_jsx(Skeleton, { variant: "text", width: 72, height: 16, sx: { marginLeft: 1 } })) : null] }))] })), variant !== 'stretched' ? (_jsxs(Box, Object.assign({ mt: 2, display: "flex", justifyContent: "space-between" }, { children: [_jsx(Skeleton, { variant: "text", width: 48, height: 24 }), _jsx(Skeleton, { variant: "text", width: 48, height: 24 })] }))) : null] })));
|
|
18
18
|
};
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { Route } from '@lifi/sdk';
|
|
2
2
|
export interface SwapRouteCardProps {
|
|
3
3
|
route: Route;
|
|
4
|
-
variant?: 'default' | '
|
|
4
|
+
variant?: 'default' | 'stretched' | 'dense';
|
|
5
5
|
active?: boolean;
|
|
6
|
+
expanded?: boolean;
|
|
6
7
|
}
|
|
7
8
|
export interface SwapRouteCardEssentialsProps {
|
|
8
9
|
route: Route;
|
|
9
10
|
dense?: boolean;
|
|
10
11
|
}
|
|
11
12
|
export interface SwapRouteCardSkeletonProps {
|
|
12
|
-
variant?: 'default' | '
|
|
13
|
+
variant?: 'default' | 'stretched' | 'dense';
|
|
13
14
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Collapse, Grow, Stack, Typography } from '@mui/material';
|
|
3
|
+
import { useFormState } from 'react-hook-form';
|
|
3
4
|
import { useTranslation } from 'react-i18next';
|
|
4
5
|
import { useLocation, useNavigate } from 'react-router-dom';
|
|
5
6
|
import { useSwapRoutes } from '../../hooks';
|
|
@@ -14,6 +15,7 @@ export const SwapRoutesExpanded = () => {
|
|
|
14
15
|
const { containerStyle } = useWidgetConfig();
|
|
15
16
|
const navigate = useNavigate();
|
|
16
17
|
const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = useSwapRoutes();
|
|
18
|
+
const { isValid, isValidating } = useFormState();
|
|
17
19
|
const setExecutableRoute = useSetExecutableRoute();
|
|
18
20
|
const { pathname } = useLocation();
|
|
19
21
|
const cleanedPathname = pathname.endsWith('/')
|
|
@@ -22,13 +24,15 @@ export const SwapRoutesExpanded = () => {
|
|
|
22
24
|
const path = cleanedPathname.substring(cleanedPathname.lastIndexOf('/') + 1);
|
|
23
25
|
const hasPath = navigationRoutesValues.includes(path);
|
|
24
26
|
const handleRouteClick = (route) => {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
if (isValid && !isValidating) {
|
|
28
|
+
setExecutableRoute(route);
|
|
29
|
+
navigate(navigationRoutes.swapExecution, {
|
|
30
|
+
state: { routeId: route.id },
|
|
31
|
+
});
|
|
32
|
+
}
|
|
29
33
|
};
|
|
30
34
|
const currentRoute = routes === null || routes === void 0 ? void 0 : routes[0];
|
|
31
35
|
const expanded = Boolean(currentRoute || isLoading || isFetching || isFetched) && !hasPath;
|
|
32
36
|
const routeNotFound = !currentRoute && !isLoading && !isFetching && expanded;
|
|
33
|
-
return (_jsx(CollapseContainer, { children: _jsx(Collapse, Object.assign({ appear: true, timeout: 225, in: expanded, orientation: "horizontal" }, { children: _jsx(Grow, Object.assign({ appear: true, timeout: 225, in: expanded }, { children: _jsx(Container, Object.assign({ sx: containerStyle }, { children: _jsxs(ScrollableContainer, { children: [_jsxs(Header, { children: [_jsx(Typography, Object.assign({ fontSize: 18, fontWeight: "700", flex: 1, noWrap: true }, { children: t('swap.routes') })), _jsx(ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 } })] }), _jsx(Stack, Object.assign({ direction: "column", spacing: 2, flex: 1, paddingX: 3, paddingBottom: 3 }, { children: routeNotFound ? (_jsx(SwapRouteNotFoundCard, {})) : isLoading || isFetching ? (Array.from({ length: 3 }).map((_, index) => (_jsx(SwapRouteCardSkeleton, { variant: "
|
|
37
|
+
return (_jsx(CollapseContainer, { children: _jsx(Collapse, Object.assign({ appear: true, timeout: 225, in: expanded, orientation: "horizontal" }, { children: _jsx(Grow, Object.assign({ appear: true, timeout: 225, in: expanded }, { children: _jsx(Container, Object.assign({ sx: containerStyle }, { children: _jsxs(ScrollableContainer, { children: [_jsxs(Header, { children: [_jsx(Typography, Object.assign({ fontSize: 18, fontWeight: "700", flex: 1, noWrap: true }, { children: t('swap.routes') })), _jsx(ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 } })] }), _jsx(Stack, Object.assign({ direction: "column", spacing: 2, flex: 1, paddingX: 3, paddingBottom: 3 }, { children: routeNotFound ? (_jsx(SwapRouteNotFoundCard, {})) : isLoading || isFetching ? (Array.from({ length: 3 }).map((_, index) => (_jsx(SwapRouteCardSkeleton, { variant: "stretched" }, index)))) : (routes === null || routes === void 0 ? void 0 : routes.map((route, index) => (_jsx(SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0, variant: "stretched", expanded: (routes === null || routes === void 0 ? void 0 : routes.length) <= 2 }, route.id)))) }))] }) })) })) })) }));
|
|
34
38
|
};
|
package/config/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/widget";
|
|
2
|
-
export declare const version = "1.18.
|
|
2
|
+
export declare const version = "1.18.2";
|
package/config/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget';
|
|
2
|
-
export const version = '1.18.
|
|
2
|
+
export const version = '1.18.2';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lifi/widget",
|
|
3
|
-
"version": "1.18.
|
|
3
|
+
"version": "1.18.2",
|
|
4
4
|
"description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
|
|
5
5
|
"main": "./cjs/index.js",
|
|
6
6
|
"module": "./index.js",
|