@lifi/widget 1.21.0 → 1.22.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.
Files changed (218) hide show
  1. package/AppDrawer.style.d.ts +1 -1
  2. package/AppProvider.js +2 -4
  3. package/AppRoutes.js +5 -0
  4. package/cjs/AppDrawer.style.d.ts +1 -1
  5. package/cjs/AppProvider.js +1 -3
  6. package/cjs/AppRoutes.js +5 -0
  7. package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -1
  8. package/cjs/components/BottomSheet/BottomSheet.d.ts +1 -1
  9. package/cjs/components/ChainSelect/ChainSelect.d.ts +0 -1
  10. package/cjs/components/ChainSelect/ChainSelect.js +1 -3
  11. package/cjs/components/ChainSelect/useChainSelect.d.ts +1 -1
  12. package/cjs/components/Header/Header.style.d.ts +34 -1
  13. package/cjs/components/Header/Header.style.js +19 -1
  14. package/cjs/components/Header/NavigationHeader.js +4 -1
  15. package/cjs/components/Header/WalletHeader.js +34 -9
  16. package/cjs/components/Menu.d.ts +1 -0
  17. package/cjs/components/Menu.js +24 -0
  18. package/cjs/components/PoweredBy/PoweredBy.style.d.ts +1 -1
  19. package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
  20. package/cjs/components/SelectChainAndToken.js +6 -1
  21. package/cjs/components/SelectTokenButton/SelectTokenButton.js +8 -6
  22. package/cjs/components/SelectTokenButton/SelectTokenButton.style.js +2 -1
  23. package/cjs/components/SendToWallet/SendToWallet.js +5 -0
  24. package/cjs/components/SendToWallet/SendToWallet.style.d.ts +1 -1
  25. package/cjs/components/SendToWallet/SendToWalletButton.js +5 -1
  26. package/cjs/components/Step/CircularProgress.d.ts +0 -1
  27. package/cjs/components/Step/StepProcess.style.d.ts +2 -2
  28. package/cjs/components/Step/StepTimer.js +1 -1
  29. package/cjs/components/StepActions/StepActions.js +6 -1
  30. package/cjs/components/SwapInput/FormPriceHelperText.js +4 -4
  31. package/cjs/components/SwapInput/SwapInput.js +5 -2
  32. package/cjs/components/SwapInput/SwapInput.style.d.ts +1 -1
  33. package/cjs/components/SwapInput/SwapInputAdornment.d.ts +0 -1
  34. package/cjs/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
  35. package/cjs/components/SwapRouteCard/SwapRouteCard.js +5 -3
  36. package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +1 -1
  37. package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +3 -1
  38. package/cjs/components/SwapRoutes/SwapRoutes.js +8 -3
  39. package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
  40. package/cjs/components/Token/Token.js +6 -5
  41. package/cjs/components/TokenAvatar/TokenAvatar.d.ts +6 -1
  42. package/cjs/components/TokenAvatar/TokenAvatar.js +10 -3
  43. package/cjs/components/TokenList/TokenList.js +2 -23
  44. package/cjs/components/TokenList/TokenListItem.d.ts +2 -1
  45. package/cjs/components/TokenList/TokenListItem.js +12 -6
  46. package/cjs/components/TokenList/index.d.ts +1 -0
  47. package/cjs/components/TokenList/index.js +1 -0
  48. package/cjs/components/TokenList/types.d.ts +6 -0
  49. package/cjs/components/TokenList/useTokenSelect.d.ts +2 -0
  50. package/cjs/components/TokenList/useTokenSelect.js +33 -0
  51. package/cjs/config/version.d.ts +1 -1
  52. package/cjs/config/version.js +1 -1
  53. package/cjs/hooks/useChain.d.ts +2 -2
  54. package/cjs/hooks/useChains.d.ts +2 -2
  55. package/cjs/hooks/useExpandableVariant.js +3 -5
  56. package/cjs/hooks/useProcessMessage.d.ts +2 -2
  57. package/cjs/hooks/useSwapRoutes.js +11 -7
  58. package/cjs/i18n/de.json +199 -0
  59. package/cjs/i18n/en.json +157 -151
  60. package/cjs/i18n/es.json +199 -0
  61. package/cjs/i18n/fr.json +199 -0
  62. package/cjs/i18n/index.d.ts +8 -200
  63. package/cjs/i18n/index.js +15 -19
  64. package/cjs/i18n/it.json +199 -0
  65. package/cjs/i18n/uk.json +200 -0
  66. package/cjs/i18n/zh.json +199 -0
  67. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
  68. package/cjs/pages/SelectChainPage/SelectChainPage.d.ts +1 -1
  69. package/cjs/pages/SelectChainPage/SelectChainPage.js +2 -5
  70. package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.d.ts +3 -0
  71. package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +21 -0
  72. package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.d.ts +21 -0
  73. package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.js +20 -0
  74. package/cjs/pages/SelectNativeTokenPage/index.d.ts +1 -0
  75. package/cjs/pages/SelectNativeTokenPage/index.js +17 -0
  76. package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
  77. package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
  78. package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +0 -1
  79. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  80. package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
  81. package/cjs/pages/SettingsPage/LanguageSelect.d.ts +2 -0
  82. package/cjs/pages/SettingsPage/LanguageSelect.js +38 -0
  83. package/cjs/pages/SettingsPage/SettingsPage.d.ts +0 -1
  84. package/cjs/pages/SettingsPage/SettingsPage.js +2 -1
  85. package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -2
  86. package/cjs/pages/SettingsPage/ShowDestinationWallet.js +6 -0
  87. package/cjs/pages/SettingsPage/SlippageInput.d.ts +0 -1
  88. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +4 -2
  89. package/cjs/pages/SwapHistoryPage/SwapHistoryItem.js +4 -2
  90. package/cjs/pages/SwapPage/StatusBottomSheet.js +3 -3
  91. package/cjs/pages/SwapPage/TokenValueBottomSheet.js +1 -1
  92. package/cjs/providers/I18nProvider/I18nProvider.d.ts +2 -0
  93. package/cjs/providers/I18nProvider/I18nProvider.js +62 -0
  94. package/cjs/providers/I18nProvider/index.d.ts +2 -0
  95. package/cjs/providers/I18nProvider/index.js +18 -0
  96. package/cjs/providers/I18nProvider/types.d.ts +16 -0
  97. package/cjs/providers/I18nProvider/types.js +2 -0
  98. package/cjs/providers/WidgetProvider/utils.d.ts +1 -1
  99. package/cjs/providers/WidgetProvider/utils.js +4 -4
  100. package/cjs/providers/index.d.ts +1 -0
  101. package/cjs/providers/index.js +1 -0
  102. package/cjs/stores/settings/types.d.ts +1 -0
  103. package/cjs/stores/settings/useSettingsStore.d.ts +2 -0
  104. package/cjs/types/widget.d.ts +24 -7
  105. package/cjs/types/widget.js +8 -0
  106. package/cjs/utils/deepMerge.d.ts +1 -0
  107. package/cjs/utils/deepMerge.js +18 -0
  108. package/cjs/utils/index.d.ts +1 -0
  109. package/cjs/utils/index.js +1 -0
  110. package/cjs/utils/navigationRoutes.d.ts +8 -7
  111. package/cjs/utils/navigationRoutes.js +10 -7
  112. package/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -1
  113. package/components/BottomSheet/BottomSheet.d.ts +1 -1
  114. package/components/ChainSelect/ChainSelect.d.ts +0 -1
  115. package/components/ChainSelect/ChainSelect.js +1 -3
  116. package/components/ChainSelect/useChainSelect.d.ts +1 -1
  117. package/components/Header/Header.style.d.ts +34 -1
  118. package/components/Header/Header.style.js +19 -1
  119. package/components/Header/NavigationHeader.js +4 -1
  120. package/components/Header/WalletHeader.js +37 -12
  121. package/components/Menu.d.ts +1 -0
  122. package/components/Menu.js +21 -0
  123. package/components/PoweredBy/PoweredBy.style.d.ts +1 -1
  124. package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
  125. package/components/SelectChainAndToken.js +7 -2
  126. package/components/SelectTokenButton/SelectTokenButton.js +9 -7
  127. package/components/SelectTokenButton/SelectTokenButton.style.js +2 -1
  128. package/components/SendToWallet/SendToWallet.js +6 -1
  129. package/components/SendToWallet/SendToWallet.style.d.ts +1 -1
  130. package/components/SendToWallet/SendToWalletButton.js +6 -2
  131. package/components/Step/CircularProgress.d.ts +0 -1
  132. package/components/Step/StepProcess.style.d.ts +2 -2
  133. package/components/Step/StepTimer.js +1 -1
  134. package/components/StepActions/StepActions.js +6 -1
  135. package/components/SwapInput/FormPriceHelperText.js +4 -4
  136. package/components/SwapInput/SwapInput.js +6 -3
  137. package/components/SwapInput/SwapInput.style.d.ts +1 -1
  138. package/components/SwapInput/SwapInputAdornment.d.ts +0 -1
  139. package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
  140. package/components/SwapRouteCard/SwapRouteCard.js +5 -3
  141. package/components/SwapRouteCard/SwapRouteCard.style.d.ts +1 -1
  142. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +3 -1
  143. package/components/SwapRoutes/SwapRoutes.js +8 -3
  144. package/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
  145. package/components/Token/Token.js +7 -6
  146. package/components/TokenAvatar/TokenAvatar.d.ts +6 -1
  147. package/components/TokenAvatar/TokenAvatar.js +8 -2
  148. package/components/TokenList/TokenList.js +4 -25
  149. package/components/TokenList/TokenListItem.d.ts +2 -1
  150. package/components/TokenList/TokenListItem.js +10 -5
  151. package/components/TokenList/index.d.ts +1 -0
  152. package/components/TokenList/index.js +1 -0
  153. package/components/TokenList/types.d.ts +6 -0
  154. package/components/TokenList/useTokenSelect.d.ts +2 -0
  155. package/components/TokenList/useTokenSelect.js +29 -0
  156. package/config/version.d.ts +1 -1
  157. package/config/version.js +1 -1
  158. package/hooks/useChain.d.ts +2 -2
  159. package/hooks/useChains.d.ts +2 -2
  160. package/hooks/useExpandableVariant.js +3 -5
  161. package/hooks/useProcessMessage.d.ts +2 -2
  162. package/hooks/useSwapRoutes.js +12 -8
  163. package/i18n/de.json +199 -0
  164. package/i18n/en.json +157 -151
  165. package/i18n/es.json +199 -0
  166. package/i18n/fr.json +199 -0
  167. package/i18n/index.d.ts +8 -200
  168. package/i18n/index.js +8 -18
  169. package/i18n/it.json +199 -0
  170. package/i18n/uk.json +200 -0
  171. package/i18n/zh.json +199 -0
  172. package/package.json +18 -17
  173. package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
  174. package/pages/SelectChainPage/SelectChainPage.d.ts +1 -1
  175. package/pages/SelectChainPage/SelectChainPage.js +2 -5
  176. package/pages/SelectNativeTokenPage/SelectNativeTokenPage.d.ts +3 -0
  177. package/pages/SelectNativeTokenPage/SelectNativeTokenPage.js +17 -0
  178. package/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.d.ts +21 -0
  179. package/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.js +17 -0
  180. package/pages/SelectNativeTokenPage/index.d.ts +1 -0
  181. package/pages/SelectNativeTokenPage/index.js +1 -0
  182. package/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
  183. package/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
  184. package/pages/SettingsPage/AdvancedPreferences.d.ts +0 -1
  185. package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  186. package/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
  187. package/pages/SettingsPage/LanguageSelect.d.ts +2 -0
  188. package/pages/SettingsPage/LanguageSelect.js +34 -0
  189. package/pages/SettingsPage/SettingsPage.d.ts +0 -1
  190. package/pages/SettingsPage/SettingsPage.js +2 -1
  191. package/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -2
  192. package/pages/SettingsPage/ShowDestinationWallet.js +6 -0
  193. package/pages/SettingsPage/SlippageInput.d.ts +0 -1
  194. package/pages/SwapDetailsPage/SwapDetailsPage.js +4 -2
  195. package/pages/SwapHistoryPage/SwapHistoryItem.js +4 -2
  196. package/pages/SwapPage/StatusBottomSheet.js +3 -3
  197. package/pages/SwapPage/TokenValueBottomSheet.js +1 -1
  198. package/providers/I18nProvider/I18nProvider.d.ts +2 -0
  199. package/providers/I18nProvider/I18nProvider.js +58 -0
  200. package/providers/I18nProvider/index.d.ts +2 -0
  201. package/providers/I18nProvider/index.js +2 -0
  202. package/providers/I18nProvider/types.d.ts +16 -0
  203. package/providers/I18nProvider/types.js +1 -0
  204. package/providers/WidgetProvider/utils.d.ts +1 -1
  205. package/providers/WidgetProvider/utils.js +4 -4
  206. package/providers/index.d.ts +1 -0
  207. package/providers/index.js +1 -0
  208. package/stores/settings/types.d.ts +1 -0
  209. package/stores/settings/useSettingsStore.d.ts +2 -0
  210. package/tsconfig.cjs.tsbuildinfo +1 -1
  211. package/types/widget.d.ts +24 -7
  212. package/types/widget.js +7 -1
  213. package/utils/deepMerge.d.ts +1 -0
  214. package/utils/deepMerge.js +14 -0
  215. package/utils/index.d.ts +1 -0
  216. package/utils/index.js +1 -0
  217. package/utils/navigationRoutes.d.ts +8 -7
  218. package/utils/navigationRoutes.js +10 -7
@@ -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);
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SearchTokenInput: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SelectWalletPage: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const AdvancedPreferences: () => JSX.Element;
@@ -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?: "primary" | "secondary" | "error" | "warning" | "info" | "success" | "standard" | undefined;
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;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const GasPriceSelect: () => JSX.Element;
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const LanguageSelect: React.FC;
@@ -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;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SettingsPage: () => JSX.Element;
@@ -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 @@
1
- /// <reference types="react" />
2
- export declare const ShowDestinationWallet: () => JSX.Element;
1
+ 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
  };
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SlippageInput: () => JSX.Element;
@@ -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(undefined, { dateStyle: 'long' }).format(startedAt) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12 }, { children: new Intl.DateTimeFormat(undefined, { timeStyle: 'short' }).format(startedAt) }))] })), routeExecution === null || routeExecution === void 0 ? void 0 : routeExecution.route.steps.map((step, index, steps) => {
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 { t } = (0, react_i18next_1.useTranslation)();
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(undefined, { dateStyle: 'long' }).format(startedAt) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12 }, { children: new Intl.DateTimeFormat(undefined, { timeStyle: 'short' }).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 })] }))] })));
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.fundsReceived');
50
- message = t('swap.success.message.fundsReceived', {
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.okay') : 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] })) })));
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;
@@ -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('swap.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('swap.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('swap.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)
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,2 @@
1
+ /// <reference types="react" />
2
+ export declare const I18nProvider: React.FC<React.PropsWithChildren>;
@@ -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,2 @@
1
+ export * from './I18nProvider';
2
+ export * from './types';
@@ -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
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,4 +1,4 @@
1
- export declare const isItemAllowed: <T>(chainId: T, chains?: {
1
+ export declare const isItemAllowed: <T>(itemId: T, items?: {
2
2
  allow?: T[] | undefined;
3
3
  deny?: T[] | undefined;
4
4
  } | undefined, disabledChains?: T[] | undefined) => boolean;
@@ -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 = (chainId, chains,
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 = chains === null || chains === void 0 ? void 0 : chains.allow) === null || _a === void 0 ? void 0 : _a.length) {
9
- return chains.allow.includes(chainId);
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(chainId)) || ((_b = chains === null || chains === void 0 ? void 0 : chains.deny) === null || _b === void 0 ? void 0 : _b.includes(chainId)));
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;
@@ -1,3 +1,4 @@
1
+ export * from './I18nProvider';
1
2
  export * from './SDKProvider';
2
3
  export * from './SwapFormProvider';
3
4
  export * from './TelemetryProvider';
@@ -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);
@@ -8,6 +8,7 @@ export interface SettingsState {
8
8
  advancedPreferences: boolean;
9
9
  appearance: Appearance;
10
10
  gasPrice: string;
11
+ language?: string;
11
12
  routePriority: Order;
12
13
  showDestinationWallet: boolean;
13
14
  slippage: string;
@@ -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;
@@ -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
- export declare type WidgetVariant = 'default' | 'expandable' | 'drawer';
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
- /** @deprecated Use chains.deny instead */
34
- disabledChains?: number[];
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>;
@@ -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;
@@ -1,5 +1,6 @@
1
1
  export * from './colors';
2
2
  export * from './deepClone';
3
+ export * from './deepMerge';
3
4
  export * from './elements';
4
5
  export * from './format';
5
6
  export * from './input';
@@ -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);
@@ -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
- fromToken: string;
6
- toToken: string;
7
- fromChain: string;
8
- toChain: string;
9
- swapRoutes: string;
8
+ swapDetails: string;
10
9
  swapExecution: string;
11
10
  swapHistory: string;
12
- activeSwaps: string;
13
- swapDetails: string;
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[];