@lifi/widget 1.21.0 → 1.22.1
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/AppDrawer.style.d.ts +1 -1
- package/AppProvider.js +2 -4
- package/AppRoutes.js +4 -0
- package/cjs/AppDrawer.style.d.ts +1 -1
- package/cjs/AppProvider.js +1 -3
- package/cjs/AppRoutes.js +4 -0
- package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -1
- package/cjs/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/cjs/components/ChainSelect/ChainSelect.js +1 -3
- package/cjs/components/ChainSelect/useChainSelect.d.ts +1 -1
- package/cjs/components/Header/Header.style.d.ts +34 -1
- package/cjs/components/Header/Header.style.js +19 -1
- package/cjs/components/Header/NavigationHeader.js +6 -2
- package/cjs/components/Header/WalletHeader.js +34 -9
- package/cjs/components/Menu.d.ts +1 -0
- package/cjs/components/Menu.js +24 -0
- package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/cjs/components/SelectChainAndToken.js +6 -1
- package/cjs/components/SelectTokenButton/SelectTokenButton.js +11 -6
- package/cjs/components/SelectTokenButton/SelectTokenButton.style.js +2 -1
- package/cjs/components/SendToWallet/SendToWallet.js +5 -0
- package/cjs/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/cjs/components/SendToWallet/SendToWalletButton.js +5 -1
- package/cjs/components/Step/StepProcess.style.d.ts +2 -2
- package/cjs/components/Step/StepTimer.js +1 -1
- package/cjs/components/StepActions/StepActions.js +6 -1
- package/cjs/components/SwapButton/SwapButton.js +9 -4
- package/cjs/components/SwapInput/FormPriceHelperText.js +4 -4
- package/cjs/components/SwapInput/SwapInput.js +5 -2
- package/cjs/components/SwapInput/SwapInput.style.d.ts +1 -1
- package/cjs/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +5 -3
- package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +1 -1
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +3 -1
- package/cjs/components/SwapRoutes/SwapRoutes.js +8 -3
- package/cjs/components/Token/Token.js +6 -5
- package/cjs/components/TokenAvatar/TokenAvatar.d.ts +11 -1
- package/cjs/components/TokenAvatar/TokenAvatar.js +14 -3
- package/cjs/components/TokenList/TokenList.js +2 -23
- package/cjs/components/TokenList/TokenListItem.d.ts +2 -1
- package/cjs/components/TokenList/TokenListItem.js +12 -6
- package/cjs/components/TokenList/index.d.ts +1 -0
- package/cjs/components/TokenList/index.js +1 -0
- package/cjs/components/TokenList/types.d.ts +6 -0
- package/cjs/components/TokenList/useTokenSelect.d.ts +2 -0
- package/cjs/components/TokenList/useTokenSelect.js +33 -0
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/useChain.d.ts +2 -2
- package/cjs/hooks/useChains.d.ts +2 -2
- package/cjs/hooks/useExpandableVariant.js +3 -5
- package/cjs/hooks/useProcessMessage.d.ts +2 -2
- package/cjs/hooks/useSwapRoutes.js +11 -7
- package/cjs/i18n/de.json +199 -0
- package/cjs/i18n/en.json +162 -151
- package/cjs/i18n/es.json +200 -0
- package/cjs/i18n/fr.json +199 -0
- package/cjs/i18n/index.d.ts +8 -200
- package/cjs/i18n/index.js +15 -19
- package/cjs/i18n/it.json +199 -0
- package/cjs/i18n/uk.json +200 -0
- package/cjs/i18n/zh.json +199 -0
- package/cjs/pages/SelectChainPage/SelectChainPage.d.ts +2 -2
- package/cjs/pages/SelectChainPage/SelectChainPage.js +13 -9
- package/cjs/pages/SelectChainPage/types.d.ts +4 -0
- package/cjs/pages/SelectChainPage/types.js +2 -0
- package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.d.ts +3 -0
- package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +21 -0
- package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.d.ts +21 -0
- package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.js +20 -0
- package/cjs/pages/SelectNativeTokenPage/index.d.ts +1 -0
- package/cjs/pages/SelectNativeTokenPage/index.js +17 -0
- package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/cjs/pages/SettingsPage/LanguageSelect.d.ts +2 -0
- package/cjs/pages/SettingsPage/LanguageSelect.js +38 -0
- package/cjs/pages/SettingsPage/SettingsPage.js +2 -1
- package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -1
- package/cjs/pages/SettingsPage/ShowDestinationWallet.js +6 -0
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +4 -2
- package/cjs/pages/SwapHistoryPage/SwapHistoryItem.js +4 -2
- package/cjs/pages/SwapPage/StatusBottomSheet.js +3 -3
- package/cjs/pages/SwapPage/SwapPage.js +1 -3
- package/cjs/pages/SwapPage/TokenValueBottomSheet.js +1 -1
- package/cjs/providers/I18nProvider/I18nProvider.d.ts +2 -0
- package/cjs/providers/I18nProvider/I18nProvider.js +62 -0
- package/cjs/providers/I18nProvider/index.d.ts +2 -0
- package/cjs/providers/I18nProvider/index.js +18 -0
- package/cjs/providers/I18nProvider/types.d.ts +16 -0
- package/cjs/providers/I18nProvider/types.js +2 -0
- package/cjs/providers/WidgetProvider/utils.d.ts +1 -1
- package/cjs/providers/WidgetProvider/utils.js +4 -4
- package/cjs/providers/index.d.ts +1 -0
- package/cjs/providers/index.js +1 -0
- package/cjs/stores/settings/types.d.ts +1 -0
- package/cjs/stores/settings/useSettingsStore.d.ts +2 -0
- package/cjs/types/widget.d.ts +24 -7
- package/cjs/types/widget.js +8 -0
- package/cjs/utils/deepMerge.d.ts +1 -0
- package/cjs/utils/deepMerge.js +18 -0
- package/cjs/utils/index.d.ts +1 -0
- package/cjs/utils/index.js +1 -0
- package/cjs/utils/input.js +3 -1
- package/cjs/utils/navigationRoutes.d.ts +8 -7
- package/cjs/utils/navigationRoutes.js +10 -7
- package/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -1
- package/components/BottomSheet/BottomSheet.d.ts +1 -1
- package/components/ChainSelect/ChainSelect.js +1 -3
- package/components/ChainSelect/useChainSelect.d.ts +1 -1
- package/components/Header/Header.style.d.ts +34 -1
- package/components/Header/Header.style.js +19 -1
- package/components/Header/NavigationHeader.js +7 -3
- package/components/Header/WalletHeader.js +37 -12
- package/components/Menu.d.ts +1 -0
- package/components/Menu.js +21 -0
- package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
- package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
- package/components/SelectChainAndToken.js +7 -2
- package/components/SelectTokenButton/SelectTokenButton.js +12 -7
- package/components/SelectTokenButton/SelectTokenButton.style.js +2 -1
- package/components/SendToWallet/SendToWallet.js +6 -1
- package/components/SendToWallet/SendToWallet.style.d.ts +1 -1
- package/components/SendToWallet/SendToWalletButton.js +6 -2
- package/components/Step/StepProcess.style.d.ts +2 -2
- package/components/Step/StepTimer.js +1 -1
- package/components/StepActions/StepActions.js +6 -1
- package/components/SwapButton/SwapButton.js +9 -4
- package/components/SwapInput/FormPriceHelperText.js +4 -4
- package/components/SwapInput/SwapInput.js +6 -3
- package/components/SwapInput/SwapInput.style.d.ts +1 -1
- package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
- package/components/SwapRouteCard/SwapRouteCard.js +5 -3
- package/components/SwapRouteCard/SwapRouteCard.style.d.ts +1 -1
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +3 -1
- package/components/SwapRoutes/SwapRoutes.js +8 -3
- package/components/Token/Token.js +7 -6
- package/components/TokenAvatar/TokenAvatar.d.ts +11 -1
- package/components/TokenAvatar/TokenAvatar.js +11 -2
- package/components/TokenList/TokenList.js +4 -25
- package/components/TokenList/TokenListItem.d.ts +2 -1
- package/components/TokenList/TokenListItem.js +10 -5
- package/components/TokenList/index.d.ts +1 -0
- package/components/TokenList/index.js +1 -0
- package/components/TokenList/types.d.ts +6 -0
- package/components/TokenList/useTokenSelect.d.ts +2 -0
- package/components/TokenList/useTokenSelect.js +29 -0
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/useChain.d.ts +2 -2
- package/hooks/useChains.d.ts +2 -2
- package/hooks/useExpandableVariant.js +3 -5
- package/hooks/useProcessMessage.d.ts +2 -2
- package/hooks/useSwapRoutes.js +12 -8
- package/i18n/de.json +199 -0
- package/i18n/en.json +162 -151
- package/i18n/es.json +200 -0
- package/i18n/fr.json +199 -0
- package/i18n/index.d.ts +8 -200
- package/i18n/index.js +8 -18
- package/i18n/it.json +199 -0
- package/i18n/uk.json +200 -0
- package/i18n/zh.json +199 -0
- package/package.json +19 -18
- package/pages/SelectChainPage/SelectChainPage.d.ts +2 -2
- package/pages/SelectChainPage/SelectChainPage.js +13 -9
- package/pages/SelectChainPage/types.d.ts +4 -0
- package/pages/SelectChainPage/types.js +1 -0
- package/pages/SelectNativeTokenPage/SelectNativeTokenPage.d.ts +3 -0
- package/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +17 -0
- package/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.d.ts +21 -0
- package/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.js +17 -0
- package/pages/SelectNativeTokenPage/index.d.ts +1 -0
- package/pages/SelectNativeTokenPage/index.js +1 -0
- package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
- package/pages/SettingsPage/LanguageSelect.d.ts +2 -0
- package/pages/SettingsPage/LanguageSelect.js +34 -0
- package/pages/SettingsPage/SettingsPage.js +2 -1
- package/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -1
- package/pages/SettingsPage/ShowDestinationWallet.js +6 -0
- package/pages/SwapDetailsPage/SwapDetailsPage.js +4 -2
- package/pages/SwapHistoryPage/SwapHistoryItem.js +4 -2
- package/pages/SwapPage/StatusBottomSheet.js +3 -3
- package/pages/SwapPage/SwapPage.js +1 -3
- package/pages/SwapPage/TokenValueBottomSheet.js +1 -1
- package/providers/I18nProvider/I18nProvider.d.ts +2 -0
- package/providers/I18nProvider/I18nProvider.js +58 -0
- package/providers/I18nProvider/index.d.ts +2 -0
- package/providers/I18nProvider/index.js +2 -0
- package/providers/I18nProvider/types.d.ts +16 -0
- package/providers/I18nProvider/types.js +1 -0
- package/providers/WidgetProvider/utils.d.ts +1 -1
- package/providers/WidgetProvider/utils.js +4 -4
- package/providers/index.d.ts +1 -0
- package/providers/index.js +1 -0
- package/stores/settings/types.d.ts +1 -0
- package/stores/settings/useSettingsStore.d.ts +2 -0
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/widget.d.ts +24 -7
- package/types/widget.js +7 -1
- package/utils/deepMerge.d.ts +1 -0
- package/utils/deepMerge.js +14 -0
- package/utils/index.d.ts +1 -0
- package/utils/index.js +1 -0
- package/utils/input.js +3 -1
- package/utils/navigationRoutes.d.ts +8 -7
- package/utils/navigationRoutes.js +10 -7
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SelectNativeTokenPage = 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 TokenAvatar_1 = require("../../components/TokenAvatar");
|
|
8
|
+
const TokenList_1 = require("../../components/TokenList");
|
|
9
|
+
const hooks_1 = require("../../hooks");
|
|
10
|
+
const SelectNativeTokenPage_style_1 = require("./SelectNativeTokenPage.style");
|
|
11
|
+
const SelectNativeTokenPage = ({ formType, }) => {
|
|
12
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
13
|
+
const { navigateBack } = (0, hooks_1.useNavigateBack)();
|
|
14
|
+
const { chains } = (0, hooks_1.useChains)();
|
|
15
|
+
const selectToken = (0, TokenList_1.useTokenSelect)(formType, navigateBack);
|
|
16
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Container, Object.assign({ disableGutters: true }, { children: (0, jsx_runtime_1.jsx)(material_1.List, Object.assign({ sx: {
|
|
17
|
+
paddingLeft: 1.5,
|
|
18
|
+
paddingRight: 1.5,
|
|
19
|
+
} }, { children: chains === null || chains === void 0 ? void 0 : chains.map((chain) => ((0, jsx_runtime_1.jsxs)(SelectNativeTokenPage_style_1.ListItemButton, Object.assign({ onClick: () => selectToken(chain.nativeToken.address, chain.id), disableRipple: true }, { children: [(0, jsx_runtime_1.jsx)(material_1.ListItemAvatar, { children: (0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: chain.nativeToken, chain: chain }) }), (0, jsx_runtime_1.jsx)(SelectNativeTokenPage_style_1.ListItemText, { primary: chain.nativeToken.symbol, secondary: t('swap.onChain', { chainName: chain.name }) })] }), chain.id))) })) })));
|
|
20
|
+
};
|
|
21
|
+
exports.SelectNativeTokenPage = SelectNativeTokenPage;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const ListItemButton: import("@emotion/styled").StyledComponent<import("@mui/material").ListItemButtonBaseProps & Omit<{
|
|
3
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
4
|
+
centerRipple?: boolean | undefined;
|
|
5
|
+
children?: import("react").ReactNode;
|
|
6
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
7
|
+
disabled?: boolean | undefined;
|
|
8
|
+
disableRipple?: boolean | undefined;
|
|
9
|
+
disableTouchRipple?: boolean | undefined;
|
|
10
|
+
focusRipple?: boolean | undefined;
|
|
11
|
+
focusVisibleClassName?: string | undefined;
|
|
12
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
13
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
14
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
15
|
+
tabIndex?: number | undefined;
|
|
16
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
17
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
18
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
|
|
19
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
20
|
+
}, "className" | "style" | "classes" | "tabIndex" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "alignItems" | "autoFocus" | "dense" | "divider" | "selected" | "disableGutters"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
21
|
+
export declare const ListItemText: import("@emotion/styled").StyledComponent<import("@mui/material").ListItemTextProps<import("react").ElementType<any>, import("react").ElementType<any>> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ListItemText = exports.ListItemButton = void 0;
|
|
4
|
+
const material_1 = require("@mui/material");
|
|
5
|
+
const ListItemText_1 = require("@mui/material/ListItemText");
|
|
6
|
+
const styles_1 = require("@mui/material/styles");
|
|
7
|
+
const utils_1 = require("../../utils");
|
|
8
|
+
exports.ListItemButton = (0, styles_1.styled)(material_1.ListItemButton)(({ theme }) => ({
|
|
9
|
+
borderRadius: theme.shape.borderRadiusSecondary,
|
|
10
|
+
paddingLeft: theme.spacing(1.5),
|
|
11
|
+
height: 56,
|
|
12
|
+
'&:hover': {
|
|
13
|
+
backgroundColor: (0, utils_1.getContrastAlphaColor)(theme, '4%'),
|
|
14
|
+
},
|
|
15
|
+
}));
|
|
16
|
+
exports.ListItemText = (0, styles_1.styled)(material_1.ListItemText)(({ theme }) => ({
|
|
17
|
+
[`.${ListItemText_1.listItemTextClasses.primary}`]: {
|
|
18
|
+
fontWeight: 400,
|
|
19
|
+
},
|
|
20
|
+
}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SelectNativeTokenPage';
|
|
@@ -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("./SelectNativeTokenPage"), exports);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export declare const ToggleButton: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
classes?: Partial<import("@mui/material").ToggleButtonClasses> | undefined;
|
|
5
|
-
color?: "
|
|
5
|
+
color?: "error" | "success" | "warning" | "primary" | "secondary" | "info" | "standard" | undefined;
|
|
6
6
|
disabled?: boolean | undefined;
|
|
7
7
|
disableFocusRipple?: boolean | undefined;
|
|
8
8
|
fullWidth?: boolean | undefined;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LanguageSelect = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const icons_material_1 = require("@mui/icons-material");
|
|
6
|
+
const material_1 = require("@mui/material");
|
|
7
|
+
const react_i18next_1 = require("react-i18next");
|
|
8
|
+
const Card_1 = require("../../components/Card");
|
|
9
|
+
const Select_1 = require("../../components/Select");
|
|
10
|
+
const providers_1 = require("../../providers");
|
|
11
|
+
const stores_1 = require("../../stores");
|
|
12
|
+
const LanguageSelect = () => {
|
|
13
|
+
var _a;
|
|
14
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
15
|
+
const { languages, disableI18n } = (0, providers_1.useWidgetConfig)();
|
|
16
|
+
const { i18n } = (0, react_i18next_1.useTranslation)();
|
|
17
|
+
const setValue = (0, stores_1.useSettingsStore)((state) => state.setValue);
|
|
18
|
+
const { language } = (0, stores_1.useSettings)(['language']);
|
|
19
|
+
if (disableI18n) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const handleChangeLanguage = (event) => {
|
|
23
|
+
const language = event.target.value;
|
|
24
|
+
setValue('language', language);
|
|
25
|
+
i18n.changeLanguage(language);
|
|
26
|
+
};
|
|
27
|
+
const filteredLanguages = Object.keys(i18n.store.data).sort();
|
|
28
|
+
if (filteredLanguages.length <= 1) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
const value = filteredLanguages.includes(language || i18n.resolvedLanguage)
|
|
32
|
+
? language || i18n.resolvedLanguage
|
|
33
|
+
: (languages === null || languages === void 0 ? void 0 : languages.default) || ((_a = languages === null || languages === void 0 ? void 0 : languages.allow) === null || _a === void 0 ? void 0 : _a[0]);
|
|
34
|
+
return ((0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({ mb: 2 }, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t(`language.title`) }), (0, jsx_runtime_1.jsx)(material_1.FormControl, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(Select_1.Select, Object.assign({ MenuProps: { elevation: 2 }, value: value, onChange: handleChangeLanguage, IconComponent: icons_material_1.KeyboardArrowDown, dense: true }, { children: filteredLanguages.map((lng) => {
|
|
35
|
+
return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, Object.assign({ value: lng }, { children: t('language.name', { lng }) }), lng));
|
|
36
|
+
}) })) }))] })));
|
|
37
|
+
};
|
|
38
|
+
exports.LanguageSelect = LanguageSelect;
|
|
@@ -6,10 +6,11 @@ const material_1 = require("@mui/material");
|
|
|
6
6
|
const AdvancedPreferences_1 = require("./AdvancedPreferences");
|
|
7
7
|
const ColorSchemeButtonGroup_1 = require("./ColorSchemeButtonGroup");
|
|
8
8
|
const GasPriceSelect_1 = require("./GasPriceSelect");
|
|
9
|
+
const LanguageSelect_1 = require("./LanguageSelect");
|
|
9
10
|
const RoutePrioritySelect_1 = require("./RoutePrioritySelect");
|
|
10
11
|
const ShowDestinationWallet_1 = require("./ShowDestinationWallet");
|
|
11
12
|
const SlippageInput_1 = require("./SlippageInput");
|
|
12
13
|
const SettingsPage = () => {
|
|
13
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Container, Object.assign({ disableGutters: true }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ px: 3, pt: 1 }, { children: [(0, jsx_runtime_1.jsx)(ColorSchemeButtonGroup_1.ColorSchemeButtonGroup, {}), (0, jsx_runtime_1.jsx)(RoutePrioritySelect_1.RoutePrioritySelect, {}), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' }, mt: 2 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ pr: 2, flex: 1 }, { children: (0, jsx_runtime_1.jsx)(SlippageInput_1.SlippageInput, {}) })), (0, jsx_runtime_1.jsx)(GasPriceSelect_1.GasPriceSelect, {})] }))] })), (0, jsx_runtime_1.jsx)(ShowDestinationWallet_1.ShowDestinationWallet, {}), (0, jsx_runtime_1.jsx)(AdvancedPreferences_1.AdvancedPreferences, {})] })));
|
|
14
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Container, Object.assign({ disableGutters: true }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ px: 3, pt: 1 }, { children: [(0, jsx_runtime_1.jsx)(ColorSchemeButtonGroup_1.ColorSchemeButtonGroup, {}), (0, jsx_runtime_1.jsx)(LanguageSelect_1.LanguageSelect, {}), (0, jsx_runtime_1.jsx)(RoutePrioritySelect_1.RoutePrioritySelect, {}), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' }, mt: 2 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ pr: 2, flex: 1 }, { children: (0, jsx_runtime_1.jsx)(SlippageInput_1.SlippageInput, {}) })), (0, jsx_runtime_1.jsx)(GasPriceSelect_1.GasPriceSelect, {})] }))] })), (0, jsx_runtime_1.jsx)(ShowDestinationWallet_1.ShowDestinationWallet, {}), (0, jsx_runtime_1.jsx)(AdvancedPreferences_1.AdvancedPreferences, {})] })));
|
|
14
15
|
};
|
|
15
16
|
exports.SettingsPage = SettingsPage;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const ShowDestinationWallet: () => JSX.Element;
|
|
2
|
+
export declare const ShowDestinationWallet: () => JSX.Element | null;
|
|
@@ -5,11 +5,17 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const react_i18next_1 = require("react-i18next");
|
|
7
7
|
const Switch_1 = require("../../components/Switch");
|
|
8
|
+
const providers_1 = require("../../providers");
|
|
8
9
|
const stores_1 = require("../../stores");
|
|
10
|
+
const types_1 = require("../../types");
|
|
9
11
|
const ShowDestinationWallet = () => {
|
|
10
12
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
13
|
+
const { disabledUI } = (0, providers_1.useWidgetConfig)();
|
|
11
14
|
const setValue = (0, stores_1.useSettingsStore)((state) => state.setValue);
|
|
12
15
|
const { showDestinationWallet } = (0, stores_1.useSettings)(['showDestinationWallet']);
|
|
16
|
+
if (disabledUI === null || disabledUI === void 0 ? void 0 : disabledUI.includes(types_1.DisabledUI.ToAddress)) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
13
19
|
const onChange = (_, checked) => {
|
|
14
20
|
setValue('showDestinationWallet', checked);
|
|
15
21
|
};
|
|
@@ -27,7 +27,7 @@ const stores_1 = require("../../stores");
|
|
|
27
27
|
const SwapDetailsPage_style_1 = require("./SwapDetailsPage.style");
|
|
28
28
|
const SwapDetailsPage = () => {
|
|
29
29
|
var _a, _b;
|
|
30
|
-
const { t } = (0, react_i18next_1.useTranslation)();
|
|
30
|
+
const { t, i18n } = (0, react_i18next_1.useTranslation)();
|
|
31
31
|
const { navigateBack } = (0, hooks_1.useNavigateBack)();
|
|
32
32
|
const { state } = (0, react_router_dom_1.useLocation)();
|
|
33
33
|
const [routeExecution, deleteRoute] = (0, stores_1.useRouteExecutionStore)((store) => [store.routes[state === null || state === void 0 ? void 0 : state.routeId], store.deleteRoute], shallow_1.default);
|
|
@@ -53,7 +53,9 @@ const SwapDetailsPage = () => {
|
|
|
53
53
|
display: 'flex',
|
|
54
54
|
flex: 1,
|
|
55
55
|
justifyContent: 'space-between',
|
|
56
|
-
}, pb: 1 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12 }, { children: new Intl.DateTimeFormat(
|
|
56
|
+
}, pb: 1 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12 }, { children: new Intl.DateTimeFormat(i18n.language, { dateStyle: 'long' }).format(startedAt) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12 }, { children: new Intl.DateTimeFormat(i18n.language, {
|
|
57
|
+
timeStyle: 'short',
|
|
58
|
+
}).format(startedAt) }))] })), routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route.steps.map((step, index, steps) => {
|
|
57
59
|
var _a, _b;
|
|
58
60
|
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Step_1.Step, { step: step, fromToken: index === 0
|
|
59
61
|
? Object.assign(Object.assign({}, step.action.fromToken), { amount: step.action.fromAmount }) : undefined, toToken: index === steps.length - 1
|
|
@@ -10,7 +10,7 @@ const Token_1 = require("../../components/Token");
|
|
|
10
10
|
const utils_1 = require("../../utils");
|
|
11
11
|
const SwapHistoryItem = ({ route }) => {
|
|
12
12
|
var _a, _b, _c, _d, _e;
|
|
13
|
-
const {
|
|
13
|
+
const { i18n } = (0, react_i18next_1.useTranslation)();
|
|
14
14
|
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
15
15
|
const handleClick = () => {
|
|
16
16
|
navigate(utils_1.navigationRoutes.swapDetails, {
|
|
@@ -22,6 +22,8 @@ const SwapHistoryItem = ({ route }) => {
|
|
|
22
22
|
display: 'flex',
|
|
23
23
|
flex: 1,
|
|
24
24
|
justifyContent: 'space-between',
|
|
25
|
-
}, pt: 1.75, px: 2 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12 }, { children: new Intl.DateTimeFormat(
|
|
25
|
+
}, pt: 1.75, px: 2 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12 }, { children: new Intl.DateTimeFormat(i18n.language, { dateStyle: 'long' }).format(startedAt) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12 }, { children: new Intl.DateTimeFormat(i18n.language, {
|
|
26
|
+
timeStyle: 'short',
|
|
27
|
+
}).format(startedAt) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ py: 1 }, { children: [(0, jsx_runtime_1.jsx)(Token_1.Token, { token: Object.assign(Object.assign({}, route.fromToken), { amount: route.fromAmount }), px: 2, pt: 1, connected: true }), (0, jsx_runtime_1.jsx)(Token_1.TokenDivider, {}), (0, jsx_runtime_1.jsx)(Token_1.Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: (_e = (_d = (_c = route.steps.at(-1)) === null || _c === void 0 ? void 0 : _c.execution) === null || _d === void 0 ? void 0 : _d.toAmount) !== null && _e !== void 0 ? _e : route.toAmount }), px: 2, pt: 0.5, pb: 1 })] }))] })));
|
|
26
28
|
};
|
|
27
29
|
exports.SwapHistoryItem = SwapHistoryItem;
|
|
@@ -46,8 +46,8 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
46
46
|
let message;
|
|
47
47
|
switch (status) {
|
|
48
48
|
case 'success':
|
|
49
|
-
title = t('swap.success.title.
|
|
50
|
-
message = t('swap.success.message.
|
|
49
|
+
title = t('swap.success.title.swapSuccessful');
|
|
50
|
+
message = t('swap.success.message.swapSuccessful', {
|
|
51
51
|
amount: token === null || token === void 0 ? void 0 : token.amount,
|
|
52
52
|
tokenSymbol: token === null || token === void 0 ? void 0 : token.symbol,
|
|
53
53
|
chainName: (_a = getChainById(route.toChainId)) === null || _a === void 0 ? void 0 : _a.name,
|
|
@@ -79,6 +79,6 @@ const StatusBottomSheet = ({ status, route, }) => {
|
|
|
79
79
|
(_b = ref.current) === null || _b === void 0 ? void 0 : _b.open();
|
|
80
80
|
}
|
|
81
81
|
}, [refetch, refetchNewBalance, status]);
|
|
82
|
-
return ((0, jsx_runtime_1.jsx)(BottomSheet_1.BottomSheet, Object.assign({ ref: ref }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ p: 3 }, { children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.IconContainer, { children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.IconCircle, Object.assign({ status: status, mb: 1 }, { children: [status === 'idle' ? (0, jsx_runtime_1.jsx)(icons_material_1.Info, { color: "primary" }) : null, status === 'success' ? (0, jsx_runtime_1.jsx)(icons_material_1.Done, { color: "success" }) : null, status === 'error' ? (0, jsx_runtime_1.jsx)(icons_material_1.Warning, { color: "error" }) : null] })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ py: 1, fontSize: 18, fontWeight: 700 }, { children: title })), status === 'success' ? ((0, jsx_runtime_1.jsx)(Token_1.Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: (_g = (_e = (_d = (_c = route.steps.at(-1)) === null || _c === void 0 ? void 0 : _c.execution) === null || _d === void 0 ? void 0 : _d.toAmount) !== null && _e !== void 0 ? _e : (_f = route.steps.at(-1)) === null || _f === void 0 ? void 0 : _f.estimate.toAmount) !== null && _g !== void 0 ? _g : route.toAmount }), py: 1 })) : null] }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ py: 1 }, { children: message })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsxs)(material_1.Button, Object.assign({ variant: "contained", fullWidth: true, onClick: status === 'success' ? handleDone : handleClose }, { children: [status === 'idle' ? t('button.
|
|
82
|
+
return ((0, jsx_runtime_1.jsx)(BottomSheet_1.BottomSheet, Object.assign({ ref: ref }, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ p: 3 }, { children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.IconContainer, { children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.IconCircle, Object.assign({ status: status, mb: 1 }, { children: [status === 'idle' ? (0, jsx_runtime_1.jsx)(icons_material_1.Info, { color: "primary" }) : null, status === 'success' ? (0, jsx_runtime_1.jsx)(icons_material_1.Done, { color: "success" }) : null, status === 'error' ? (0, jsx_runtime_1.jsx)(icons_material_1.Warning, { color: "error" }) : null] })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ py: 1, fontSize: 18, fontWeight: 700 }, { children: title })), status === 'success' ? ((0, jsx_runtime_1.jsx)(Token_1.Token, { token: Object.assign(Object.assign({}, route.toToken), { amount: (_g = (_e = (_d = (_c = route.steps.at(-1)) === null || _c === void 0 ? void 0 : _c.execution) === null || _d === void 0 ? void 0 : _d.toAmount) !== null && _e !== void 0 ? _e : (_f = route.steps.at(-1)) === null || _f === void 0 ? void 0 : _f.estimate.toAmount) !== null && _g !== void 0 ? _g : route.toAmount }), py: 1 })) : null] }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ py: 1 }, { children: message })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsxs)(material_1.Button, Object.assign({ variant: "contained", fullWidth: true, onClick: status === 'success' ? handleDone : handleClose }, { children: [status === 'idle' ? t('button.ok') : null, status === 'success' ? t('button.done') : null, status === 'error' ? t('button.seeDetails') : null] })) })), status === 'success' ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "text", fullWidth: true, onClick: handleSeeDetails }, { children: t('button.seeDetails') })) }))) : null] })) })));
|
|
83
83
|
};
|
|
84
84
|
exports.StatusBottomSheet = StatusBottomSheet;
|
|
@@ -31,9 +31,7 @@ const SwapPage = () => {
|
|
|
31
31
|
const { state } = (0, react_router_dom_1.useLocation)();
|
|
32
32
|
const { navigateBack } = (0, hooks_1.useNavigateBack)();
|
|
33
33
|
const tokenValueBottomSheetRef = (0, react_1.useRef)(null);
|
|
34
|
-
const { setValue,
|
|
35
|
-
// formState: { isValid, isValidating },
|
|
36
|
-
} = (0, react_hook_form_1.useFormContext)();
|
|
34
|
+
const { setValue } = (0, react_hook_form_1.useFormContext)();
|
|
37
35
|
const { route, status, executeRoute, restartRoute, deleteRoute } = (0, hooks_1.useRouteExecution)(state === null || state === void 0 ? void 0 : state.routeId);
|
|
38
36
|
const handleExecuteRoute = (0, react_1.useCallback)(() => {
|
|
39
37
|
var _a, _b;
|
|
@@ -22,7 +22,7 @@ const TokenValueBottomSheetContent = ({ route, onCancel, onContinue, }) => {
|
|
|
22
22
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
23
23
|
const ref = (0, react_1.useRef)();
|
|
24
24
|
(0, hooks_1.useSetContentHeight)(ref);
|
|
25
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ p: 3, ref: ref }, { children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.IconContainer, { children: [(0, jsx_runtime_1.jsx)(StatusBottomSheet_style_1.IconCircle, Object.assign({ status: "warning", mb: 1 }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.Warning, { color: "warning" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ py: 1, fontSize: 18, fontWeight: 700 }, { children: t('swap.warning.title.highValueLoss') }))] }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ py: 1 }, { children: t('swap.warning.message.highValueLoss') })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", mt: 1 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('swap.swapping') }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontWeight: 600 }, { children: t('
|
|
25
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ p: 3, ref: ref }, { children: [(0, jsx_runtime_1.jsxs)(StatusBottomSheet_style_1.IconContainer, { children: [(0, jsx_runtime_1.jsx)(StatusBottomSheet_style_1.IconCircle, Object.assign({ status: "warning", mb: 1 }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.Warning, { color: "warning" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ py: 1, fontSize: 18, fontWeight: 700 }, { children: t('swap.warning.title.highValueLoss') }))] }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ py: 1 }, { children: t('swap.warning.message.highValueLoss') })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", mt: 1 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('swap.swapping') }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontWeight: 600 }, { children: t('format.currency', { value: route.fromAmountUSD }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", mt: 0.25 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('swap.gasCost') }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontWeight: 600 }, { children: t('format.currency', { value: route.gasCostUSD }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", mt: 0.25 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('swap.receiving') }), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontWeight: 600 }, { children: t('format.currency', { value: route.toAmountUSD }) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", justifyContent: "space-between", mt: 0.25 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { children: t('swap.valueLoss') }), (0, jsx_runtime_1.jsxs)(material_1.Typography, Object.assign({ fontWeight: 600 }, { children: [(0, big_js_1.default)(route.toAmountUSD || 0)
|
|
26
26
|
.div((0, big_js_1.default)(route.fromAmountUSD || 0).plus((0, big_js_1.default)(route.gasCostUSD || 0)))
|
|
27
27
|
.minus(1)
|
|
28
28
|
.mul(100)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.I18nProvider = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const i18next_1 = require("i18next");
|
|
6
|
+
const i18next_browser_languagedetector_1 = require("i18next-browser-languagedetector");
|
|
7
|
+
const react_1 = require("react");
|
|
8
|
+
const react_i18next_1 = require("react-i18next");
|
|
9
|
+
const supportedLanguages = require("../../i18n");
|
|
10
|
+
const stores_1 = require("../../stores");
|
|
11
|
+
const utils_1 = require("../../utils");
|
|
12
|
+
const WidgetProvider_1 = require("../WidgetProvider");
|
|
13
|
+
const I18nProvider = ({ children, }) => {
|
|
14
|
+
const { languageResources, languages, disableI18n } = (0, WidgetProvider_1.useWidgetConfig)();
|
|
15
|
+
const { language } = (0, stores_1.useSettings)(['language']);
|
|
16
|
+
const i18n = (0, react_1.useMemo)(() => {
|
|
17
|
+
var _a, _b;
|
|
18
|
+
let resources = Object.keys(supportedLanguages)
|
|
19
|
+
.filter((lng) => (0, WidgetProvider_1.isItemAllowed)(lng, languages))
|
|
20
|
+
.reduce((resources, lng) => {
|
|
21
|
+
resources[lng] = {
|
|
22
|
+
translation: (languageResources === null || languageResources === void 0 ? void 0 : languageResources[lng])
|
|
23
|
+
? (0, utils_1.deepMerge)(supportedLanguages[lng], languageResources[lng])
|
|
24
|
+
: supportedLanguages[lng],
|
|
25
|
+
};
|
|
26
|
+
return resources;
|
|
27
|
+
}, {});
|
|
28
|
+
if (languageResources) {
|
|
29
|
+
resources = Object.keys(languageResources).reduce((resources, lng) => {
|
|
30
|
+
if (!resources[lng]) {
|
|
31
|
+
resources[lng] = {
|
|
32
|
+
translation: languageResources[lng],
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
return resources;
|
|
36
|
+
}, resources);
|
|
37
|
+
}
|
|
38
|
+
let i18n = i18next_1.default.createInstance({
|
|
39
|
+
lng: (languages === null || languages === void 0 ? void 0 : languages.default) || language,
|
|
40
|
+
fallbackLng: resources.en
|
|
41
|
+
? 'en'
|
|
42
|
+
: (languages === null || languages === void 0 ? void 0 : languages.default) ||
|
|
43
|
+
((_a = languages === null || languages === void 0 ? void 0 : languages.allow) === null || _a === void 0 ? void 0 : _a[0]) ||
|
|
44
|
+
((_b = Object.keys(resources)) === null || _b === void 0 ? void 0 : _b[0]),
|
|
45
|
+
lowerCaseLng: true,
|
|
46
|
+
interpolation: {
|
|
47
|
+
escapeValue: false,
|
|
48
|
+
},
|
|
49
|
+
resources,
|
|
50
|
+
detection: {
|
|
51
|
+
caches: [],
|
|
52
|
+
},
|
|
53
|
+
});
|
|
54
|
+
if (!language && !(languages === null || languages === void 0 ? void 0 : languages.default) && !disableI18n) {
|
|
55
|
+
i18n = i18n.use(i18next_browser_languagedetector_1.default);
|
|
56
|
+
}
|
|
57
|
+
i18n.use(react_i18next_1.initReactI18next).init();
|
|
58
|
+
return i18n;
|
|
59
|
+
}, [disableI18n, language, languageResources, languages]);
|
|
60
|
+
return (0, jsx_runtime_1.jsx)(react_i18next_1.I18nextProvider, Object.assign({ i18n: i18n }, { children: children }));
|
|
61
|
+
};
|
|
62
|
+
exports.I18nProvider = I18nProvider;
|
|
@@ -0,0 +1,18 @@
|
|
|
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("./I18nProvider"), exports);
|
|
18
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type * as languages from '../../i18n';
|
|
2
|
+
export declare type PartialResource<T> = T extends object ? {
|
|
3
|
+
[P in keyof T]?: PartialResource<T[P]>;
|
|
4
|
+
} : T;
|
|
5
|
+
export declare type LanguageKey = keyof typeof languages;
|
|
6
|
+
export declare type LanguageResources = {
|
|
7
|
+
[language in LanguageKey]?: PartialResource<typeof languages.en>;
|
|
8
|
+
} | {
|
|
9
|
+
[language: string]: PartialResource<typeof languages.en>;
|
|
10
|
+
};
|
|
11
|
+
export declare type LanguageTranslationResource = {
|
|
12
|
+
[namespace in 'translation']: PartialResource<typeof languages.en>;
|
|
13
|
+
};
|
|
14
|
+
export declare type LanguageTranslationResources = {
|
|
15
|
+
[language: string]: LanguageTranslationResource;
|
|
16
|
+
};
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isItemAllowed = void 0;
|
|
4
|
-
const isItemAllowed = (
|
|
4
|
+
const isItemAllowed = (itemId, items,
|
|
5
5
|
/** @deprecated Remove in the next major release */
|
|
6
6
|
disabledChains) => {
|
|
7
7
|
var _a, _b;
|
|
8
|
-
if ((_a =
|
|
9
|
-
return
|
|
8
|
+
if ((_a = items === null || items === void 0 ? void 0 : items.allow) === null || _a === void 0 ? void 0 : _a.length) {
|
|
9
|
+
return items.allow.includes(itemId);
|
|
10
10
|
}
|
|
11
|
-
return !((disabledChains === null || disabledChains === void 0 ? void 0 : disabledChains.includes(
|
|
11
|
+
return !((disabledChains === null || disabledChains === void 0 ? void 0 : disabledChains.includes(itemId)) || ((_b = items === null || items === void 0 ? void 0 : items.deny) === null || _b === void 0 ? void 0 : _b.includes(itemId)));
|
|
12
12
|
};
|
|
13
13
|
exports.isItemAllowed = isItemAllowed;
|
package/cjs/providers/index.d.ts
CHANGED
package/cjs/providers/index.js
CHANGED
|
@@ -14,6 +14,7 @@ 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("./I18nProvider"), exports);
|
|
17
18
|
__exportStar(require("./SDKProvider"), exports);
|
|
18
19
|
__exportStar(require("./SwapFormProvider"), exports);
|
|
19
20
|
__exportStar(require("./TelemetryProvider"), exports);
|
|
@@ -10,6 +10,7 @@ export declare const useSettingsStore: import("zustand").UseBoundStore<Omit<Omit
|
|
|
10
10
|
advancedPreferences: boolean;
|
|
11
11
|
appearance: import("../..").Appearance;
|
|
12
12
|
gasPrice: string;
|
|
13
|
+
language?: string | undefined;
|
|
13
14
|
routePriority: "RECOMMENDED" | "FASTEST" | "CHEAPEST" | "SAFEST";
|
|
14
15
|
showDestinationWallet: boolean;
|
|
15
16
|
slippage: string;
|
|
@@ -29,6 +30,7 @@ export declare const useSettingsStore: import("zustand").UseBoundStore<Omit<Omit
|
|
|
29
30
|
advancedPreferences: boolean;
|
|
30
31
|
appearance: import("../..").Appearance;
|
|
31
32
|
gasPrice: string;
|
|
33
|
+
language?: string | undefined;
|
|
32
34
|
routePriority: "RECOMMENDED" | "FASTEST" | "CHEAPEST" | "SAFEST";
|
|
33
35
|
showDestinationWallet: boolean;
|
|
34
36
|
slippage: string;
|
package/cjs/types/widget.d.ts
CHANGED
|
@@ -3,7 +3,15 @@ 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, RefObject } from 'react';
|
|
6
|
-
|
|
6
|
+
import type { LanguageKey, LanguageResources } from '../providers';
|
|
7
|
+
export declare type WidgetVariant = 'default' | 'expandable' | 'drawer' | 'refuel';
|
|
8
|
+
export declare enum DisabledUI {
|
|
9
|
+
FromToken = "fromToken",
|
|
10
|
+
ToToken = "toToken",
|
|
11
|
+
FromAmount = "fromAmount",
|
|
12
|
+
ToAddress = "toAddress"
|
|
13
|
+
}
|
|
14
|
+
export declare type DisabledUIType = `${DisabledUI}`;
|
|
7
15
|
export declare type Appearance = PaletteMode | 'auto';
|
|
8
16
|
export declare type ThemeConfig = {
|
|
9
17
|
palette?: Pick<PaletteOptions, 'primary' | 'secondary'>;
|
|
@@ -25,17 +33,15 @@ export interface WidgetConfig {
|
|
|
25
33
|
toToken?: string;
|
|
26
34
|
toAddress?: string;
|
|
27
35
|
fromAmount?: number | string;
|
|
36
|
+
integrator?: string;
|
|
37
|
+
variant?: WidgetVariant;
|
|
28
38
|
appearance?: Appearance;
|
|
29
39
|
theme?: ThemeConfig;
|
|
30
40
|
containerStyle?: CSSProperties;
|
|
31
41
|
disableAppearance?: boolean;
|
|
32
42
|
disableTelemetry?: boolean;
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
/** @deprecated Use tokens.featured instead */
|
|
36
|
-
featuredTokens?: Token[];
|
|
37
|
-
integrator?: string;
|
|
38
|
-
variant?: WidgetVariant;
|
|
43
|
+
disabledUI?: DisabledUIType[];
|
|
44
|
+
useRecommendedRoute?: boolean;
|
|
39
45
|
walletManagement?: WidgetWalletManagement;
|
|
40
46
|
sdkConfig?: ConfigUpdate;
|
|
41
47
|
buildSwapUrl?: boolean;
|
|
@@ -56,6 +62,17 @@ export interface WidgetConfig {
|
|
|
56
62
|
allow?: Token[];
|
|
57
63
|
deny?: (Partial<Token> & Pick<Token, 'address' | 'chainId'>)[];
|
|
58
64
|
};
|
|
65
|
+
languages?: {
|
|
66
|
+
default?: LanguageKey;
|
|
67
|
+
allow?: LanguageKey[];
|
|
68
|
+
deny?: LanguageKey[];
|
|
69
|
+
};
|
|
70
|
+
languageResources?: LanguageResources;
|
|
71
|
+
disableI18n?: boolean;
|
|
72
|
+
/** @deprecated Use chains.deny instead */
|
|
73
|
+
disabledChains?: number[];
|
|
74
|
+
/** @deprecated Use tokens.featured instead */
|
|
75
|
+
featuredTokens?: Token[];
|
|
59
76
|
}
|
|
60
77
|
export declare type WidgetProps = {
|
|
61
78
|
elementRef?: RefObject<HTMLDivElement>;
|
package/cjs/types/widget.js
CHANGED
|
@@ -1,2 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DisabledUI = void 0;
|
|
4
|
+
var DisabledUI;
|
|
5
|
+
(function (DisabledUI) {
|
|
6
|
+
DisabledUI["FromToken"] = "fromToken";
|
|
7
|
+
DisabledUI["ToToken"] = "toToken";
|
|
8
|
+
DisabledUI["FromAmount"] = "fromAmount";
|
|
9
|
+
DisabledUI["ToAddress"] = "toAddress";
|
|
10
|
+
})(DisabledUI = exports.DisabledUI || (exports.DisabledUI = {}));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const deepMerge: (...objects: any[]) => any;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.deepMerge = void 0;
|
|
4
|
+
const isObject = (obj) => obj && typeof obj === 'object';
|
|
5
|
+
const deepMerge = (...objects) => {
|
|
6
|
+
return objects.reduce((prev, obj) => {
|
|
7
|
+
for (const key in obj) {
|
|
8
|
+
if (isObject(prev[key]) && isObject(obj[key])) {
|
|
9
|
+
prev[key] = (0, exports.deepMerge)(prev[key], obj[key]);
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
prev[key] = obj[key];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return prev;
|
|
16
|
+
}, {});
|
|
17
|
+
};
|
|
18
|
+
exports.deepMerge = deepMerge;
|
package/cjs/utils/index.d.ts
CHANGED
package/cjs/utils/index.js
CHANGED
|
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./colors"), exports);
|
|
18
18
|
__exportStar(require("./deepClone"), exports);
|
|
19
|
+
__exportStar(require("./deepMerge"), exports);
|
|
19
20
|
__exportStar(require("./elements"), exports);
|
|
20
21
|
__exportStar(require("./format"), exports);
|
|
21
22
|
__exportStar(require("./input"), exports);
|
package/cjs/utils/input.js
CHANGED
|
@@ -14,7 +14,9 @@ const fitInputText = (maxFontSize, minFontSize, element) => {
|
|
|
14
14
|
mid = (high + low) >> 1;
|
|
15
15
|
const fontSize = `${mid + 1}px`;
|
|
16
16
|
element.style.fontSize = fontSize;
|
|
17
|
-
|
|
17
|
+
// scrollWidth has different rounding than clientWidth, remove 1px for consistency
|
|
18
|
+
const scrollWidth = element.scrollWidth - 1;
|
|
19
|
+
if (scrollWidth <= element.clientWidth) {
|
|
18
20
|
size = mid;
|
|
19
21
|
low = mid + 1;
|
|
20
22
|
}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
export declare const navigationRoutes: {
|
|
2
2
|
home: string;
|
|
3
|
+
activeSwaps: string;
|
|
4
|
+
fromChain: string;
|
|
5
|
+
fromToken: string;
|
|
3
6
|
selectWallet: string;
|
|
4
7
|
settings: string;
|
|
5
|
-
|
|
6
|
-
toToken: string;
|
|
7
|
-
fromChain: string;
|
|
8
|
-
toChain: string;
|
|
9
|
-
swapRoutes: string;
|
|
8
|
+
swapDetails: string;
|
|
10
9
|
swapExecution: string;
|
|
11
10
|
swapHistory: string;
|
|
12
|
-
|
|
13
|
-
|
|
11
|
+
swapRoutes: string;
|
|
12
|
+
toChain: string;
|
|
13
|
+
toToken: string;
|
|
14
|
+
toTokenNative: string;
|
|
14
15
|
};
|
|
15
16
|
export declare const navigationRoutesValues: string[];
|
|
16
17
|
export declare const stickyHeaderRoutes: string[];
|