@lifi/widget 2.0.1 → 2.1.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/cjs/components/Header/NavigationHeader.js +2 -2
- package/cjs/components/Header/index.d.ts +0 -1
- package/cjs/components/Header/index.js +0 -1
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/i18n/en.json +2 -2
- package/cjs/i18n/th.json +61 -60
- package/cjs/i18n/vi.json +64 -63
- package/cjs/pages/ActiveTransactionsPage/ActiveTransactionsPage.js +3 -3
- package/cjs/pages/RoutesPage/RoutesPage.js +3 -3
- package/cjs/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +3 -3
- package/cjs/pages/TransactionDetailsPage/ContactSupportButton.d.ts +5 -0
- package/cjs/pages/TransactionDetailsPage/ContactSupportButton.js +25 -0
- package/cjs/pages/TransactionDetailsPage/TransactionDetailsPage.js +5 -4
- package/cjs/pages/TransactionHistoryPage/TransactionHistoryPage.js +3 -3
- package/cjs/pages/TransactionPage/TransactionPage.js +3 -3
- package/cjs/stores/StoreProvider.js +2 -1
- package/cjs/stores/header/index.d.ts +1 -0
- package/cjs/stores/header/index.js +17 -0
- package/cjs/{components/Header → stores/header}/types.d.ts +4 -2
- package/cjs/stores/header/useHeaderStore.d.ts +8 -0
- package/cjs/stores/header/useHeaderStore.js +56 -0
- package/cjs/stores/index.d.ts +2 -1
- package/cjs/stores/index.js +2 -1
- package/cjs/types/events.d.ts +6 -1
- package/cjs/types/events.js +1 -0
- package/components/Header/NavigationHeader.js +2 -2
- package/components/Header/index.d.ts +0 -1
- package/components/Header/index.js +0 -1
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/i18n/en.json +2 -2
- package/i18n/th.json +61 -60
- package/i18n/vi.json +64 -63
- package/package.json +11 -11
- package/pages/ActiveTransactionsPage/ActiveTransactionsPage.js +4 -4
- package/pages/RoutesPage/RoutesPage.js +4 -4
- package/pages/SelectEnabledToolsPage/SelectEnabledToolsPage.js +4 -4
- package/pages/TransactionDetailsPage/ContactSupportButton.d.ts +5 -0
- package/pages/TransactionDetailsPage/ContactSupportButton.js +21 -0
- package/pages/TransactionDetailsPage/TransactionDetailsPage.js +6 -5
- package/pages/TransactionHistoryPage/TransactionHistoryPage.js +4 -4
- package/pages/TransactionPage/TransactionPage.js +4 -4
- package/stores/StoreProvider.js +2 -1
- package/stores/header/index.d.ts +1 -0
- package/stores/header/index.js +1 -0
- package/{components/Header → stores/header}/types.d.ts +4 -2
- package/stores/header/useHeaderStore.d.ts +8 -0
- package/stores/header/useHeaderStore.js +49 -0
- package/stores/index.d.ts +2 -1
- package/stores/index.js +2 -1
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/events.d.ts +6 -1
- package/types/events.js +1 -0
- package/cjs/components/Header/useHeaderStore.d.ts +0 -2
- package/cjs/components/Header/useHeaderStore.js +0 -28
- package/components/Header/useHeaderStore.d.ts +0 -2
- package/components/Header/useHeaderStore.js +0 -25
- /package/cjs/{components/Header → stores/header}/types.js +0 -0
- /package/{components/Header → stores/header}/types.js +0 -0
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ContactSupportButton = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const material_1 = require("@mui/material");
|
|
6
|
+
const react_i18next_1 = require("react-i18next");
|
|
7
|
+
const hooks_1 = require("../../hooks/");
|
|
8
|
+
const events_1 = require("../../types/events");
|
|
9
|
+
const ContactSupportButton = ({ supportId, }) => {
|
|
10
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
11
|
+
const widgetEvents = (0, hooks_1.useWidgetEvents)();
|
|
12
|
+
const handleClick = () => {
|
|
13
|
+
if (!widgetEvents.all.has(events_1.WidgetEvent.RouteContactSupport)) {
|
|
14
|
+
const url = 'https://discord.gg/lifi';
|
|
15
|
+
const target = '_blank';
|
|
16
|
+
const rel = 'nofollow noreferrer';
|
|
17
|
+
window.open(url, target, rel);
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
widgetEvents.emit(events_1.WidgetEvent.RouteContactSupport, { supportId });
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Button, { onClick: handleClick, fullWidth: true, children: t('button.contactSupport') }));
|
|
24
|
+
};
|
|
25
|
+
exports.ContactSupportButton = ContactSupportButton;
|
|
@@ -12,13 +12,13 @@ const shallow_1 = require("zustand/shallow");
|
|
|
12
12
|
const Card_1 = require("../../components/Card");
|
|
13
13
|
const ContractComponent_1 = require("../../components/ContractComponent");
|
|
14
14
|
const Dialog_1 = require("../../components/Dialog");
|
|
15
|
-
const Header_1 = require("../../components/Header");
|
|
16
15
|
const Insurance_1 = require("../../components/Insurance");
|
|
17
16
|
const Step_1 = require("../../components/Step");
|
|
18
17
|
const hooks_1 = require("../../hooks");
|
|
19
18
|
const providers_1 = require("../../providers");
|
|
20
19
|
const stores_1 = require("../../stores");
|
|
21
20
|
const utils_1 = require("../../utils");
|
|
21
|
+
const ContactSupportButton_1 = require("./ContactSupportButton");
|
|
22
22
|
const TransactionDetailsPage_style_1 = require("./TransactionDetailsPage.style");
|
|
23
23
|
const TransactionDetailsPage = () => {
|
|
24
24
|
const { t, i18n } = (0, react_i18next_1.useTranslation)();
|
|
@@ -26,6 +26,7 @@ const TransactionDetailsPage = () => {
|
|
|
26
26
|
const { subvariant, contractComponent, contractSecondaryComponent } = (0, providers_1.useWidgetConfig)();
|
|
27
27
|
const { state } = (0, react_router_dom_1.useLocation)();
|
|
28
28
|
const [routeExecution, deleteRoute] = (0, stores_1.useRouteExecutionStore)((store) => [store.routes[state?.routeId], store.deleteRoute], shallow_1.shallow);
|
|
29
|
+
const headerStoreContext = (0, stores_1.useHeaderStoreContext)();
|
|
29
30
|
const [open, setOpen] = (0, react_1.useState)(false);
|
|
30
31
|
const toggleDialog = (0, react_1.useCallback)(() => {
|
|
31
32
|
setOpen((open) => !open);
|
|
@@ -48,8 +49,8 @@ const TransactionDetailsPage = () => {
|
|
|
48
49
|
await navigator.clipboard.writeText(supportId);
|
|
49
50
|
};
|
|
50
51
|
(0, react_1.useEffect)(() => {
|
|
51
|
-
return
|
|
52
|
-
}, [toggleDialog]);
|
|
52
|
+
return headerStoreContext.getState().setAction((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "end", onClick: toggleDialog, children: (0, jsx_runtime_1.jsx)(DeleteOutline_1.default, {}) }));
|
|
53
|
+
}, [headerStoreContext, toggleDialog]);
|
|
53
54
|
const startedAt = new Date(routeExecution?.route.steps[0].execution?.process[0].startedAt ?? 0);
|
|
54
55
|
return ((0, jsx_runtime_1.jsxs)(TransactionDetailsPage_style_1.Container, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
55
56
|
display: 'flex',
|
|
@@ -60,6 +61,6 @@ const TransactionDetailsPage = () => {
|
|
|
60
61
|
}).format(startedAt) })] }), (0, Step_1.getStepList)(routeExecution?.route, subvariant), subvariant === 'nft' ? ((0, jsx_runtime_1.jsx)(ContractComponent_1.ContractComponent, { mt: 2, children: contractSecondaryComponent || contractComponent })) : null, routeExecution?.route?.insurance?.state === 'INSURED' ? ((0, jsx_runtime_1.jsx)(Insurance_1.Insurance, { mt: 2, status: routeExecution.status, feeAmountUsd: routeExecution.route.insurance.feeAmountUsd, insuredAmount: (0, utils_1.formatTokenAmount)(routeExecution.route.toAmountMin, routeExecution.route.toToken.decimals), insuredTokenSymbol: routeExecution.route.toToken.symbol, insurableRouteId: routeExecution.route.id, insuranceCoverageId: insuranceCoverageId })) : null, (0, jsx_runtime_1.jsxs)(Card_1.Card, { mt: 2, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: {
|
|
61
62
|
display: 'flex',
|
|
62
63
|
flex: 1,
|
|
63
|
-
}, children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { flex: 1, children: t('main.supportId') }), (0, jsx_runtime_1.jsx)(material_1.Box, { mr: 1, mt: 1, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", onClick: copySupportId, children: (0, jsx_runtime_1.jsx)(ContentCopyRounded_1.default, { fontSize: "small" }) }) })] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", pt: 1, pb: 2, px: 2, sx: { wordBreak: 'break-all' }, children: supportId })] }), (0, jsx_runtime_1.jsx)(material_1.Box, { mt: 2, children: (0, jsx_runtime_1.jsx)(
|
|
64
|
+
}, children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { flex: 1, children: t('main.supportId') }), (0, jsx_runtime_1.jsx)(material_1.Box, { mr: 1, mt: 1, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", onClick: copySupportId, children: (0, jsx_runtime_1.jsx)(ContentCopyRounded_1.default, { fontSize: "small" }) }) })] }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", pt: 1, pb: 2, px: 2, sx: { wordBreak: 'break-all' }, children: supportId })] }), (0, jsx_runtime_1.jsx)(material_1.Box, { mt: 2, children: (0, jsx_runtime_1.jsx)(ContactSupportButton_1.ContactSupportButton, { supportId: supportId }) }), (0, jsx_runtime_1.jsxs)(Dialog_1.Dialog, { open: open, onClose: toggleDialog, children: [(0, jsx_runtime_1.jsx)(material_1.DialogTitle, { children: t('warning.title.deleteTransaction') }), (0, jsx_runtime_1.jsx)(material_1.DialogContent, { children: (0, jsx_runtime_1.jsx)(material_1.DialogContentText, { children: t('warning.message.deleteTransactionHistory') }) }), (0, jsx_runtime_1.jsxs)(material_1.DialogActions, { children: [(0, jsx_runtime_1.jsx)(material_1.Button, { onClick: toggleDialog, children: t('button.cancel') }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", onClick: handleDeleteRoute, autoFocus: true, children: t('button.delete') })] })] })] }));
|
|
64
65
|
};
|
|
65
66
|
exports.TransactionDetailsPage = TransactionDetailsPage;
|
|
@@ -7,7 +7,6 @@ const material_1 = require("@mui/material");
|
|
|
7
7
|
const react_1 = require("react");
|
|
8
8
|
const react_i18next_1 = require("react-i18next");
|
|
9
9
|
const Dialog_1 = require("../../components/Dialog");
|
|
10
|
-
const Header_1 = require("../../components/Header");
|
|
11
10
|
const providers_1 = require("../../providers");
|
|
12
11
|
const stores_1 = require("../../stores");
|
|
13
12
|
const routes_1 = require("../../stores/routes");
|
|
@@ -17,6 +16,7 @@ const TransactionHistoryPage = () => {
|
|
|
17
16
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
18
17
|
const { account } = (0, providers_1.useWallet)();
|
|
19
18
|
const transactions = (0, routes_1.useTransactionHistory)(account.address);
|
|
19
|
+
const headerStoreContext = (0, stores_1.useHeaderStoreContext)();
|
|
20
20
|
const deleteRoutes = (0, stores_1.useRouteExecutionStore)((store) => store.deleteRoutes);
|
|
21
21
|
const [open, setOpen] = (0, react_1.useState)(false);
|
|
22
22
|
const toggleDialog = (0, react_1.useCallback)(() => {
|
|
@@ -24,9 +24,9 @@ const TransactionHistoryPage = () => {
|
|
|
24
24
|
}, []);
|
|
25
25
|
(0, react_1.useEffect)(() => {
|
|
26
26
|
if (transactions.length) {
|
|
27
|
-
return
|
|
27
|
+
return headerStoreContext.getState().setAction((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "end", onClick: toggleDialog, children: (0, jsx_runtime_1.jsx)(DeleteOutline_1.default, {}) }));
|
|
28
28
|
}
|
|
29
|
-
}, [transactions.length, toggleDialog]);
|
|
29
|
+
}, [transactions.length, toggleDialog, headerStoreContext]);
|
|
30
30
|
if (!transactions.length) {
|
|
31
31
|
return (0, jsx_runtime_1.jsx)(TransactionHistoryEmpty_1.TransactionHistoryEmpty, {});
|
|
32
32
|
}
|
|
@@ -10,7 +10,6 @@ const react_i18next_1 = require("react-i18next");
|
|
|
10
10
|
const react_router_dom_1 = require("react-router-dom");
|
|
11
11
|
const ContractComponent_1 = require("../../components/ContractComponent");
|
|
12
12
|
const GasMessage_1 = require("../../components/GasMessage");
|
|
13
|
-
const Header_1 = require("../../components/Header");
|
|
14
13
|
const Insurance_1 = require("../../components/Insurance");
|
|
15
14
|
const Step_1 = require("../../components/Step");
|
|
16
15
|
const hooks_1 = require("../../hooks");
|
|
@@ -31,6 +30,7 @@ const TransactionPage = () => {
|
|
|
31
30
|
const { navigateBack } = (0, hooks_1.useNavigateBack)();
|
|
32
31
|
const { subvariant, insurance, contractComponent, contractSecondaryComponent, } = (0, providers_1.useWidgetConfig)();
|
|
33
32
|
const { state } = (0, react_router_dom_1.useLocation)();
|
|
33
|
+
const headerStoreContext = (0, stores_1.useHeaderStoreContext)();
|
|
34
34
|
const stateRouteId = state?.routeId;
|
|
35
35
|
const [routeId, setRouteId] = (0, react_1.useState)(stateRouteId);
|
|
36
36
|
const tokenValueBottomSheetRef = (0, react_1.useRef)(null);
|
|
@@ -45,13 +45,13 @@ const TransactionPage = () => {
|
|
|
45
45
|
(0, react_1.useEffect)(() => {
|
|
46
46
|
if (route && subvariant !== 'nft') {
|
|
47
47
|
const transactionType = route.fromChainId === route.toChainId ? 'Swap' : 'Bridge';
|
|
48
|
-
return
|
|
48
|
+
return headerStoreContext
|
|
49
49
|
.getState()
|
|
50
50
|
.setTitle(status === stores_1.RouteExecutionStatus.Idle
|
|
51
51
|
? t(`button.review${transactionType}`)
|
|
52
52
|
: t(`header.${transactionType.toLowerCase()}`));
|
|
53
53
|
}
|
|
54
|
-
}, [route, status, subvariant, t]);
|
|
54
|
+
}, [headerStoreContext, route, status, subvariant, t]);
|
|
55
55
|
if (!route) {
|
|
56
56
|
return null;
|
|
57
57
|
}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.StoreProvider = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const header_1 = require("./header");
|
|
5
6
|
const routes_1 = require("./routes");
|
|
6
7
|
const settings_1 = require("./settings");
|
|
7
8
|
const StoreProvider = ({ children, config, }) => {
|
|
8
|
-
return ((0, jsx_runtime_1.jsx)(settings_1.SplitSubvariantStoreProvider, { state: config.subvariant === 'split' ? 'swap' : undefined, children: (0, jsx_runtime_1.jsx)(routes_1.RouteExecutionStoreProvider, { namePrefix: config?.localStorageKeyPrefix, children: children }) }));
|
|
9
|
+
return ((0, jsx_runtime_1.jsx)(settings_1.SplitSubvariantStoreProvider, { state: config.subvariant === 'split' ? 'swap' : undefined, children: (0, jsx_runtime_1.jsx)(header_1.HeaderStoreProvider, { namePrefix: config?.localStorageKeyPrefix, children: (0, jsx_runtime_1.jsx)(routes_1.RouteExecutionStoreProvider, { namePrefix: config?.localStorageKeyPrefix, children: children }) }) }));
|
|
9
10
|
};
|
|
10
11
|
exports.StoreProvider = StoreProvider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './useHeaderStore';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./useHeaderStore"), exports);
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import type { StoreApi, UseBoundStore } from 'zustand';
|
|
3
|
+
export type HeaderStore = UseBoundStore<StoreApi<HeaderState>>;
|
|
4
|
+
export interface HeaderStateBase {
|
|
3
5
|
element?: React.ReactNode | null;
|
|
4
6
|
title?: string;
|
|
5
7
|
}
|
|
6
|
-
export interface
|
|
8
|
+
export interface HeaderState extends HeaderStateBase {
|
|
7
9
|
setAction(element?: React.ReactNode | null): () => void;
|
|
8
10
|
setTitle(title?: string): () => void;
|
|
9
11
|
removeAction(): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { PersistStoreProps, PersistStoreProviderProps } from '../types';
|
|
3
|
+
import type { HeaderState, HeaderStore } from './types';
|
|
4
|
+
export declare const HeaderStoreContext: import("react").Context<HeaderStore | null>;
|
|
5
|
+
export declare function HeaderStoreProvider({ children, ...props }: PersistStoreProviderProps): import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export declare function useHeaderStore<T>(selector: (state: HeaderState) => T, equalityFn?: (left: T, right: T) => boolean): T;
|
|
7
|
+
export declare function useHeaderStoreContext(): HeaderStore;
|
|
8
|
+
export declare const createHeaderStore: ({ namePrefix }: PersistStoreProps) => import("zustand").UseBoundStore<import("zustand").StoreApi<HeaderState>>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createHeaderStore = exports.useHeaderStoreContext = exports.useHeaderStore = exports.HeaderStoreProvider = exports.HeaderStoreContext = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_1 = require("react");
|
|
6
|
+
const zustand_1 = require("zustand");
|
|
7
|
+
exports.HeaderStoreContext = (0, react_1.createContext)(null);
|
|
8
|
+
function HeaderStoreProvider({ children, ...props }) {
|
|
9
|
+
const storeRef = (0, react_1.useRef)();
|
|
10
|
+
if (!storeRef.current) {
|
|
11
|
+
storeRef.current = (0, exports.createHeaderStore)(props);
|
|
12
|
+
}
|
|
13
|
+
return ((0, jsx_runtime_1.jsx)(exports.HeaderStoreContext.Provider, { value: storeRef.current, children: children }));
|
|
14
|
+
}
|
|
15
|
+
exports.HeaderStoreProvider = HeaderStoreProvider;
|
|
16
|
+
function useHeaderStore(selector, equalityFn) {
|
|
17
|
+
const useStore = (0, react_1.useContext)(exports.HeaderStoreContext);
|
|
18
|
+
if (!useStore) {
|
|
19
|
+
throw new Error(`You forgot to wrap your component in <${HeaderStoreProvider.name}>.`);
|
|
20
|
+
}
|
|
21
|
+
return useStore(selector, equalityFn);
|
|
22
|
+
}
|
|
23
|
+
exports.useHeaderStore = useHeaderStore;
|
|
24
|
+
function useHeaderStoreContext() {
|
|
25
|
+
const useStore = (0, react_1.useContext)(exports.HeaderStoreContext);
|
|
26
|
+
if (!useStore) {
|
|
27
|
+
throw new Error(`You forgot to wrap your component in <${HeaderStoreProvider.name}>.`);
|
|
28
|
+
}
|
|
29
|
+
return useStore;
|
|
30
|
+
}
|
|
31
|
+
exports.useHeaderStoreContext = useHeaderStoreContext;
|
|
32
|
+
const createHeaderStore = ({ namePrefix }) => (0, zustand_1.create)((set, get) => ({
|
|
33
|
+
setAction: (element) => {
|
|
34
|
+
set(() => ({
|
|
35
|
+
element,
|
|
36
|
+
}));
|
|
37
|
+
return get().removeAction;
|
|
38
|
+
},
|
|
39
|
+
setTitle: (title) => {
|
|
40
|
+
set(() => ({
|
|
41
|
+
title,
|
|
42
|
+
}));
|
|
43
|
+
return get().removeTitle;
|
|
44
|
+
},
|
|
45
|
+
removeAction: () => {
|
|
46
|
+
set(() => ({
|
|
47
|
+
element: null,
|
|
48
|
+
}));
|
|
49
|
+
},
|
|
50
|
+
removeTitle: () => {
|
|
51
|
+
set(() => ({
|
|
52
|
+
title: undefined,
|
|
53
|
+
}));
|
|
54
|
+
},
|
|
55
|
+
}));
|
|
56
|
+
exports.createHeaderStore = createHeaderStore;
|
package/cjs/stores/index.d.ts
CHANGED
package/cjs/stores/index.js
CHANGED
|
@@ -14,7 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./StoreProvider"), exports);
|
|
17
18
|
__exportStar(require("./chains"), exports);
|
|
19
|
+
__exportStar(require("./header"), exports);
|
|
18
20
|
__exportStar(require("./routes"), exports);
|
|
19
21
|
__exportStar(require("./settings"), exports);
|
|
20
|
-
__exportStar(require("./StoreProvider"), exports);
|
package/cjs/types/events.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ export declare enum WidgetEvent {
|
|
|
4
4
|
RouteExecutionUpdated = "routeExecutionUpdated",
|
|
5
5
|
RouteExecutionCompleted = "routeExecutionCompleted",
|
|
6
6
|
RouteExecutionFailed = "routeExecutionFailed",
|
|
7
|
-
RouteHighValueLoss = "routeHighValueLoss"
|
|
7
|
+
RouteHighValueLoss = "routeHighValueLoss",
|
|
8
|
+
RouteContactSupport = "routeContactSupport"
|
|
8
9
|
}
|
|
9
10
|
export type WidgetEvents = {
|
|
10
11
|
routeExecutionStarted: Route;
|
|
@@ -12,7 +13,11 @@ export type WidgetEvents = {
|
|
|
12
13
|
routeExecutionCompleted: Route;
|
|
13
14
|
routeExecutionFailed: RouteExecutionUpdate;
|
|
14
15
|
routeHighValueLoss: RouteHighValueLossUpdate;
|
|
16
|
+
routeContactSupport: RouteContactSupport;
|
|
15
17
|
};
|
|
18
|
+
export interface RouteContactSupport {
|
|
19
|
+
supportId?: string;
|
|
20
|
+
}
|
|
16
21
|
export interface RouteHighValueLossUpdate {
|
|
17
22
|
fromAmountUsd: string;
|
|
18
23
|
gasCostUSD?: string;
|
package/cjs/types/events.js
CHANGED
|
@@ -8,4 +8,5 @@ var WidgetEvent;
|
|
|
8
8
|
WidgetEvent["RouteExecutionCompleted"] = "routeExecutionCompleted";
|
|
9
9
|
WidgetEvent["RouteExecutionFailed"] = "routeExecutionFailed";
|
|
10
10
|
WidgetEvent["RouteHighValueLoss"] = "routeHighValueLoss";
|
|
11
|
+
WidgetEvent["RouteContactSupport"] = "routeContactSupport";
|
|
11
12
|
})(WidgetEvent || (exports.WidgetEvent = WidgetEvent = {}));
|
|
@@ -7,18 +7,18 @@ import { useTranslation } from 'react-i18next';
|
|
|
7
7
|
import { Route, Routes, useLocation } from 'react-router-dom';
|
|
8
8
|
import { useNavigateBack } from '../../hooks';
|
|
9
9
|
import { useWallet, useWidgetConfig } from '../../providers';
|
|
10
|
+
import { useHeaderStore } from '../../stores';
|
|
10
11
|
import { HiddenUI } from '../../types';
|
|
11
12
|
import { backButtonRoutes, navigationRoutes, navigationRoutesValues, } from '../../utils';
|
|
12
13
|
import { HeaderAppBar } from './Header.style';
|
|
13
14
|
import { NavigationTabs } from './NavigationTabs';
|
|
14
15
|
import { WalletMenuButton } from './WalletHeader';
|
|
15
|
-
import { useHeaderStore } from './useHeaderStore';
|
|
16
16
|
export const NavigationHeader = () => {
|
|
17
17
|
const { t } = useTranslation();
|
|
18
18
|
const { subvariant, hiddenUI } = useWidgetConfig();
|
|
19
19
|
const { navigate, navigateBack } = useNavigateBack();
|
|
20
20
|
const { account } = useWallet();
|
|
21
|
-
const { element, title } = useHeaderStore();
|
|
21
|
+
const { element, title } = useHeaderStore((state) => state);
|
|
22
22
|
const { pathname } = useLocation();
|
|
23
23
|
const cleanedPathname = pathname.endsWith('/')
|
|
24
24
|
? pathname.slice(0, -1)
|
package/config/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/widget";
|
|
2
|
-
export declare const version = "2.0
|
|
2
|
+
export declare const version = "2.1.0";
|
package/config/version.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget';
|
|
2
|
-
export const version = '2.0
|
|
2
|
+
export const version = '2.1.0';
|
package/i18n/en.json
CHANGED
|
@@ -69,9 +69,9 @@
|
|
|
69
69
|
"message": {
|
|
70
70
|
"autoRefuel": "You're low on {{chainName}} gas. By continuing, you'll get enough gas to complete the transaction.",
|
|
71
71
|
"emptyActiveTransactions": "Transactions in progress will appear here. Once completed, find them in transaction history.",
|
|
72
|
-
"emptyTokenList": "We couldn't find tokens on {{chainName}} chain or you don't have any. Please
|
|
72
|
+
"emptyTokenList": "We couldn't find tokens on {{chainName}} chain or you don't have any. Please search by contract address if your token doesn't appear or choose another chain.",
|
|
73
73
|
"emptyTransactionHistory": "Transaction history is only stored locally and will be deleted if you clear your browser data.",
|
|
74
|
-
"routeNotFound": "
|
|
74
|
+
"routeNotFound": "Reasons for that could be: low liquidity, amount selected is too low, gas costs are too high or there are no routes for the selected combination."
|
|
75
75
|
},
|
|
76
76
|
"title": {
|
|
77
77
|
"autoRefuel": "Get gas",
|
package/i18n/th.json
CHANGED
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
+
"language": {
|
|
3
|
+
"name": "ภาษาไทย",
|
|
4
|
+
"title": "ภาษา"
|
|
5
|
+
},
|
|
6
|
+
"format": {
|
|
7
|
+
"currency": "{{value, currency(currency: USD)}}",
|
|
8
|
+
"number": "{{value, number(maximumFractionDigits: 9)}}"
|
|
9
|
+
},
|
|
2
10
|
"button": {
|
|
3
11
|
"auto": "อัตโนมัติ",
|
|
12
|
+
"bridge": "บริดจ์",
|
|
4
13
|
"buy": "ซื้อ",
|
|
5
14
|
"buyNow": "ซื้อตอนนี้",
|
|
6
15
|
"cancel": "ยกเลิก",
|
|
@@ -12,94 +21,74 @@
|
|
|
12
21
|
"delete": "ลบ",
|
|
13
22
|
"disconnect": "ยกเลิกการเชื่อมต่อ",
|
|
14
23
|
"done": "เสร็จสิ้น",
|
|
24
|
+
"exchange": "แลกเปลี่ยน",
|
|
15
25
|
"getGas": "รับแก็ส",
|
|
16
26
|
"hide": "ซ่อน",
|
|
17
27
|
"learnMore": "เรียนรู้เพิ่มเติม",
|
|
18
|
-
"
|
|
28
|
+
"lifiCheckout": "Li.Fi. ตรวจสอบ",
|
|
29
|
+
"lifiExchange": "LI.FI Exchange",
|
|
19
30
|
"light": "สว่าง",
|
|
20
31
|
"max": "สูงสุด",
|
|
21
32
|
"ok": "ตกลง",
|
|
22
|
-
"
|
|
23
|
-
"removeSwap": "ยกเลิกการแลกเปลี่ยน",
|
|
33
|
+
"removeTransaction": "นำรายการออก",
|
|
24
34
|
"reset": "ล้างข้อมูล",
|
|
25
35
|
"resetSettings": "รีเซ็ตการตั้งค่า",
|
|
26
|
-
"
|
|
27
|
-
"reviewGasSwap": "ตรวจสอบแก๊สในการแลกเปลี่ยน",
|
|
36
|
+
"reviewBridge": "ตรวจสอบบริดจ์",
|
|
28
37
|
"reviewPurchase": "ตรวจสอบการสั่งซื้อ",
|
|
29
38
|
"reviewSwap": "ตรวจสอบการแลกเปลี่ยน",
|
|
30
39
|
"seeDetails": "ดูรายละเอียด",
|
|
31
40
|
"showAll": "แสดงทั้งหมด",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
41
|
+
"startBridging": "เริ่มต้นการบริดจ์",
|
|
42
|
+
"startSwapping": "เริ่มต้นการแลกเปลี่ยน",
|
|
34
43
|
"swap": "การแลกเปลี่ยน",
|
|
35
44
|
"tryAgain": "ลองใหม่",
|
|
36
45
|
"viewCoverage": "ดูความคุ้มครอง",
|
|
37
46
|
"viewOnExplorer": "ดูในการสำรวจ"
|
|
38
47
|
},
|
|
39
|
-
"format": {
|
|
40
|
-
"currency": "{{value, currency(currency: USD)}}",
|
|
41
|
-
"number": "{{value, number(maximumFractionDigits: 9)}}"
|
|
42
|
-
},
|
|
43
48
|
"header": {
|
|
44
|
-
"
|
|
49
|
+
"activeTransactions": "ธุรกรรมมีผล",
|
|
45
50
|
"bridge": "บริดจ์",
|
|
46
51
|
"checkout": "เช็คเอาท์",
|
|
52
|
+
"exchange": "แลกเปลี่ยน",
|
|
47
53
|
"from": "แลกเปลี่ยนจาก",
|
|
48
54
|
"gas": "แก็ส",
|
|
49
|
-
"gasSwap": "แก็สในการแลกเปลี่ยน",
|
|
50
55
|
"payWith": "ชำระด้วย",
|
|
51
56
|
"purchase": "ซื้อ",
|
|
52
57
|
"purchaseDetails": "รายละเอียดการซื้อ",
|
|
53
|
-
"routes": "คุณได้รับ",
|
|
54
58
|
"selectChain": "เลือกเชน",
|
|
55
59
|
"selectWallet": "เลือกกระเป๋าของคุณ",
|
|
56
60
|
"settings": "ตั้งค่า",
|
|
57
61
|
"swap": "แลกเปลี่ยน",
|
|
58
|
-
"swapDetails": "รายละเอียดการแลกเปลี่ยน",
|
|
59
|
-
"swapHistory": "ประวัติการแลกเปลี่ยน",
|
|
60
62
|
"to": "แลกเปลี่ยนเป็น",
|
|
61
|
-
"
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"
|
|
65
|
-
"title": "ภาษา"
|
|
66
|
-
},
|
|
67
|
-
"settings": {
|
|
68
|
-
"enabledBridges": "เปิดการใช้งานบริดจ์",
|
|
69
|
-
"enabledExchanges": "เปิดการใช้งาน การแลกเปลี่ยน",
|
|
70
|
-
"gasPrice": {
|
|
71
|
-
"fast": "รวดเร็ว",
|
|
72
|
-
"normal": "ปกติ",
|
|
73
|
-
"slow": "ช้า",
|
|
74
|
-
"title": "ค่าแก็ส"
|
|
75
|
-
},
|
|
76
|
-
"routePriority": "ลำดับสำคัญของเส้นทาง",
|
|
77
|
-
"showDestinationWallet": "แสดงกระเป๋าปลายทาง",
|
|
78
|
-
"slippage": "ความคลาดเคลื่อน"
|
|
63
|
+
"transactionDetails": "รายละเอียดของธุรกรรม",
|
|
64
|
+
"transactionHistory": "ประวัติการซื้อขาย",
|
|
65
|
+
"walletConnected": "กระเป๋าถูกเชื่อมต่อแล้ว",
|
|
66
|
+
"youGet": "คุณได้รับ"
|
|
79
67
|
},
|
|
80
68
|
"info": {
|
|
81
69
|
"message": {
|
|
82
70
|
"autoRefuel": "คุณใช้แก็ส {{chainName}} เหลือน้อย เมื่อดำเนินการต่อ คุณจะได้รับแก็สเพียงพอสำหรับการแลกเปลี่ยนให้เสร็จสมบูรณ์",
|
|
83
|
-
"
|
|
84
|
-
"emptySwapHistory": "ประวัติการแลกเปลี่ยนจะถูกเก็บไว้ในเครื่องเท่านั้นและจะถูกลบหากคุณล้างข้อมูลเบราว์เซอร์ของคุณ.",
|
|
71
|
+
"emptyActiveTransactions": "การแลกเปลี่ยนที่กำลังดำเนินการจะปรากฏที่นี่. เมื่อเสร็จสิ้น, จะพบประวัติการแลกเปลี่ยน.",
|
|
85
72
|
"emptyTokenList": "เราไม่พบโทเค็นใน {{chainName}} เชนหรือคุณไม่มีโทเค็น. โปรดลองอีกครั้งหรือเลือกเชนอื่น.",
|
|
73
|
+
"emptyTransactionHistory": "ประวัติการแลกเปลี่ยนจะถูกเก็บไว้ในเครื่องเท่านั้นและจะถูกลบหากคุณล้างข้อมูลเบราว์เซอร์ของคุณ.",
|
|
86
74
|
"routeNotFound": "ลองจับคู่แลกเปลี่ยนโทเค็นใหม่."
|
|
87
75
|
},
|
|
88
76
|
"title": {
|
|
89
77
|
"autoRefuel": "รับแก็ส",
|
|
90
|
-
"
|
|
91
|
-
"
|
|
78
|
+
"emptyActiveTransactions": "ไม่มีธุรกรรมที่มีผล",
|
|
79
|
+
"emptyTransactionHistory": "ไม่มีธุรกรรมล่าสุด",
|
|
92
80
|
"routeNotFound": "ไม่พบเส้นทาง"
|
|
93
81
|
}
|
|
94
82
|
},
|
|
95
83
|
"success": {
|
|
96
84
|
"message": {
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
85
|
+
"exchangePartiallySuccessful": "เราได้พยายามดำเนินการแลกเปลี่ยนให้เสร็จสมบูรณ์แต่ {{tool}} ขาดสภาพคล่องสำหรับโทเค็น {{tokenSymbol}}",
|
|
86
|
+
"exchangeSuccessful": "ตอนนี้มี {{amount, number(maximumFractionDigits: 9)}}{{tokenSymbol}} ใน {{walletAddress}} กระเป๋าบน {{chainName}} เชน.",
|
|
87
|
+
"purchaseSuccessful": "คุณมี {{assetName}} ใน{{walletAddress}} กระเป๋า บน{{chainName}} เครือข่าย"
|
|
100
88
|
},
|
|
101
89
|
"title": {
|
|
102
|
-
"
|
|
90
|
+
"bridgePartiallySuccessful": "แลกเปลี่ยนสำเร็จบางส่วน",
|
|
91
|
+
"bridgeSuccessful": "บริดจ์สำเร็จ",
|
|
103
92
|
"purchaseSuccessful": "การซื้อเสร็จสมบูรณ์",
|
|
104
93
|
"refundIssued": "คืนเงินแล้ว",
|
|
105
94
|
"swapPartiallySuccessful": "แลกเปลี่ยนสำเร็จบางส่วน",
|
|
@@ -108,8 +97,8 @@
|
|
|
108
97
|
},
|
|
109
98
|
"warning": {
|
|
110
99
|
"message": {
|
|
111
|
-
"
|
|
112
|
-
"
|
|
100
|
+
"deleteActiveTransactions": "การแลกเปลี่ยนที่ใช้งานอยู่จะถูกจัดเก็บไว้ในเครื่องเท่านั้นและไม่สามารถกู้คืนได้หากคุณลบออก.",
|
|
101
|
+
"deleteTransactionHistory": "ประวัติการแลกเปลี่ยนจะถูกจัดเก็บไว้ในเครื่องเท่านั้นและไม่สามารถกู้คืนได้หากคุณลบออก",
|
|
113
102
|
"highValueLoss": "มูลค่าของโทเค็นที่ได้รับนั้นต่ำกว่าโทเค็นที่แลกเปลี่ยนและต้นทุนการทำธุรกรรมอย่างมาก.",
|
|
114
103
|
"insufficientFunds": "คุณมีเงินไม่เพียงพอที่จะดำเนินการแลกเปลี่ยน.",
|
|
115
104
|
"insufficientGas": "คุณมีแก๊สไม่เพียงพอที่จะแลกเปลี่ยนให้เสร็จสมบูรณ์ คุณต้องเพิ่มอย่างน้อย:",
|
|
@@ -117,9 +106,9 @@
|
|
|
117
106
|
"resetSettings": "การดำเนินการนี้จะรีเซ็ตลำดับความสำคัญของเส้นทาง การคลาดเลื่อน ค่าแก็ส บริดจ์ที่เปิดใช้งานและการแลกเปลี่ยน"
|
|
118
107
|
},
|
|
119
108
|
"title": {
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
109
|
+
"deleteActiveTransactions": "ลบรายการธุรกรรมทั้งหมด?",
|
|
110
|
+
"deleteTransaction": "ต้องการลบธุรกรรมนี้?",
|
|
111
|
+
"deleteTransactionHistory": "ต้องการลบประวัติการทำธุรกรรม?",
|
|
123
112
|
"highValueLoss": "สูญเสียมูลค่าสูง",
|
|
124
113
|
"insufficientGas": "ค่าแก็สไม่พอ",
|
|
125
114
|
"rateChanged": "อัตราการแลกเปลี่ยนถูกเปลี่ยน",
|
|
@@ -140,7 +129,6 @@
|
|
|
140
129
|
"allowanceRequired": "การอนุญาตไม่เพียงพอ",
|
|
141
130
|
"balanceIsTooLow": "ยอดคงเหลือต่ำเกินไป",
|
|
142
131
|
"chainSwitch": "จำเป็นต้องเปลี่ยนเชน",
|
|
143
|
-
"failed": "การแลกเปลี่ยนล้มเหลว",
|
|
144
132
|
"gasLimitIsTooLow": "แก๊สคงเหลือต่ำเกินไป",
|
|
145
133
|
"insufficientFunds": "ยอดคงเหลือไม่เพียงพอ",
|
|
146
134
|
"slippageNotMet": "ความคลาดเคลื่อนของราคาไม่เป็นไปตามเงื่อนไข.",
|
|
@@ -155,6 +143,19 @@
|
|
|
155
143
|
"walletEnsAddressInvalid": "ที่อยู่กระเป๋าเงินไม่ถูกต้องหรือเครือข่ายไม่รองรับ ENS."
|
|
156
144
|
}
|
|
157
145
|
},
|
|
146
|
+
"tooltip": {
|
|
147
|
+
"additionalProviderFee": "บริดจ์เพิ่มเติม DEX และค่าบริการ",
|
|
148
|
+
"estimatedNetworkFee": "ค่าธรรรมเนียมโดยประมาณของเครือข่าย",
|
|
149
|
+
"estimatedTime": "เวลาดำเนินการแลกเปลี่ยนโดยประมาณเป็นนาที.",
|
|
150
|
+
"notFound": {
|
|
151
|
+
"text": "เราไม่พบหน้านี้.",
|
|
152
|
+
"title": "404"
|
|
153
|
+
},
|
|
154
|
+
"numberOfSteps": "ขั้นตอนการแลกเปลี่ยนหลายขั้นตอน แต่ละขั้นตอนสามารถมี 1-2 รายการที่ต้องใช้ลายเซ็น.",
|
|
155
|
+
"progressToNextUpdate": "ข้อมูลที่แสดงจะรีเฟรชอัตโนมัติหลังจาก {{value}} วินาที คลิกที่นี่เพื่ออัปเดตด้วยตนเอง",
|
|
156
|
+
"recommended": "เส้นทางที่ถูกมียอดคงเหลือที่เพียงพอและง่ายต่องการใช้งาน",
|
|
157
|
+
"settingsModified": "การตั้งค่า (แก้ไข)"
|
|
158
|
+
},
|
|
158
159
|
"main": {
|
|
159
160
|
"crossStepDetails": "บริดจ์จาก{{from}} to {{to}} โดย {{tool}}",
|
|
160
161
|
"currentAmount": "จำนวนเงินปัจจุบัน",
|
|
@@ -211,6 +212,7 @@
|
|
|
211
212
|
"selectToken": "เลือกโทเคน",
|
|
212
213
|
"sendToAddress": "ส่งไปยัง {{address}}",
|
|
213
214
|
"sendToWallet": "ส่งไปยังกระเป๋าเงินอื่น",
|
|
215
|
+
"sending": "กำลังส่ง",
|
|
214
216
|
"sentToAddress": "ส่งไปยัง {{address}}",
|
|
215
217
|
"stepBridge": "บริดจ์",
|
|
216
218
|
"stepBridgeAndBuy": "บริดจ์และซื้อ",
|
|
@@ -220,7 +222,6 @@
|
|
|
220
222
|
"stepSwapAndBuy": "แลกเปลี่ยน และ ซื้อ",
|
|
221
223
|
"supportId": "หมายเลขที่สนับสนุน",
|
|
222
224
|
"swapStepDetails": "แลกเปลี่ยนบน {{chain}} ผ่าน {{tool}}",
|
|
223
|
-
"swapping": "การแลกเปลี่ยน",
|
|
224
225
|
"tags": {
|
|
225
226
|
"cheapest": "ราคาถูก",
|
|
226
227
|
"fastest": "รวดเร็ว",
|
|
@@ -243,18 +244,18 @@
|
|
|
243
244
|
"insured": "คุณได้ประกัน<0>{{amount, number(maximumFractionDigits: 9)}}{{tokenSymbol}}</0> ในการขนส่ง",
|
|
244
245
|
"slippageError": "เกิดข้อผิดพลาดในการคลาดเคลื่อนของโทเค็นที่ได้รับ"
|
|
245
246
|
},
|
|
246
|
-
"
|
|
247
|
-
"
|
|
248
|
-
"
|
|
249
|
-
"
|
|
250
|
-
|
|
251
|
-
"
|
|
252
|
-
"
|
|
247
|
+
"settings": {
|
|
248
|
+
"enabledBridges": "เปิดการใช้งานบริดจ์",
|
|
249
|
+
"enabledExchanges": "เปิดการใช้งาน การแลกเปลี่ยน",
|
|
250
|
+
"gasPrice": {
|
|
251
|
+
"fast": "รวดเร็ว",
|
|
252
|
+
"normal": "ปกติ",
|
|
253
|
+
"slow": "ช้า",
|
|
254
|
+
"title": "ค่าแก็ส"
|
|
253
255
|
},
|
|
254
|
-
"
|
|
255
|
-
"
|
|
256
|
-
"
|
|
257
|
-
"settingsModified": "การตั้งค่า (แก้ไข)"
|
|
256
|
+
"routePriority": "ลำดับสำคัญของเส้นทาง",
|
|
257
|
+
"showDestinationWallet": "แสดงกระเป๋าปลายทาง",
|
|
258
|
+
"slippage": "ความคลาดเคลื่อน"
|
|
258
259
|
},
|
|
259
260
|
"wallet": {
|
|
260
261
|
"extensionNotFound": "โปรดตรวจสอบว่ามีเพียงส่วนขยายของเบราว์เซอร์ {{name}} เท่านั้นที่ใช้งานได้ก่อนที่จะเลือกกระเป๋าเงินนี้."
|