@lifi/widget 2.0.0-beta.5 → 2.0.0-beta.6
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.js +2 -1
- package/AppProvider.js +1 -1
- package/cjs/AppDrawer.js +2 -1
- package/cjs/AppProvider.js +1 -1
- package/cjs/components/ChainSelect/useChainSelect.js +6 -0
- package/cjs/components/Header/Header.js +2 -2
- package/cjs/components/Header/Header.style.js +3 -0
- package/cjs/components/Header/NavigationHeader.js +7 -4
- package/cjs/components/Header/NavigationTabs.d.ts +1 -0
- package/cjs/components/Header/NavigationTabs.js +26 -0
- package/cjs/components/Header/NavigationTabs.style.d.ts +101 -0
- package/cjs/components/Header/NavigationTabs.style.js +61 -0
- package/cjs/components/Header/WalletHeader.d.ts +1 -0
- package/cjs/components/Header/WalletHeader.js +15 -8
- package/cjs/components/Header/useHeaderActionStore.js +0 -1
- package/cjs/components/SelectTokenButton/SelectTokenButton.js +5 -2
- package/cjs/config/version.d.ts +1 -1
- package/cjs/config/version.js +1 -1
- package/cjs/hooks/index.d.ts +2 -1
- package/cjs/hooks/index.js +2 -1
- package/cjs/hooks/useContentHeight.js +3 -5
- package/cjs/hooks/useInitializer.js +0 -1
- package/cjs/hooks/useSwapOnly.d.ts +1 -0
- package/cjs/hooks/useSwapOnly.js +9 -0
- package/cjs/hooks/useSwapRoutes.js +3 -1
- package/cjs/i18n/en.json +2 -2
- package/cjs/i18n/pt.json +19 -4
- package/cjs/i18n/uk.json +20 -5
- package/cjs/pages/SelectTokenPage/SelectTokenPage.js +3 -1
- package/cjs/providers/SwapFormProvider/FormUpdater.js +3 -0
- package/cjs/stores/StoreProvider.d.ts +2 -2
- package/cjs/stores/StoreProvider.js +3 -2
- package/cjs/stores/routes/RouteExecutionStore.js +0 -1
- package/cjs/stores/settings/index.d.ts +1 -0
- package/cjs/stores/settings/index.js +1 -0
- package/cjs/stores/settings/types.d.ts +11 -0
- package/cjs/stores/settings/useSplitSubvariantStore.d.ts +7 -0
- package/cjs/stores/settings/useSplitSubvariantStore.js +44 -0
- package/cjs/types/widget.d.ts +5 -1
- package/cjs/types/widget.js +3 -3
- package/components/ChainSelect/useChainSelect.js +7 -1
- package/components/Header/Header.js +3 -3
- package/components/Header/Header.style.js +3 -0
- package/components/Header/NavigationHeader.js +7 -4
- package/components/Header/NavigationTabs.d.ts +1 -0
- package/components/Header/NavigationTabs.js +22 -0
- package/components/Header/NavigationTabs.style.d.ts +101 -0
- package/components/Header/NavigationTabs.style.js +58 -0
- package/components/Header/WalletHeader.d.ts +1 -0
- package/components/Header/WalletHeader.js +12 -6
- package/components/Header/useHeaderActionStore.js +0 -1
- package/components/SelectTokenButton/SelectTokenButton.js +6 -3
- package/config/version.d.ts +1 -1
- package/config/version.js +1 -1
- package/hooks/index.d.ts +2 -1
- package/hooks/index.js +2 -1
- package/hooks/useContentHeight.js +4 -6
- package/hooks/useInitializer.js +0 -1
- package/hooks/useSwapOnly.d.ts +1 -0
- package/hooks/useSwapOnly.js +5 -0
- package/hooks/useSwapRoutes.js +3 -1
- package/i18n/en.json +2 -2
- package/i18n/pt.json +19 -4
- package/i18n/uk.json +20 -5
- package/package.json +6 -6
- package/pages/SelectTokenPage/SelectTokenPage.js +4 -2
- package/providers/SwapFormProvider/FormUpdater.js +3 -0
- package/stores/StoreProvider.d.ts +2 -2
- package/stores/StoreProvider.js +3 -2
- package/stores/routes/RouteExecutionStore.js +0 -1
- package/stores/settings/index.d.ts +1 -0
- package/stores/settings/index.js +1 -0
- package/stores/settings/types.d.ts +11 -0
- package/stores/settings/useSplitSubvariantStore.d.ts +7 -0
- package/stores/settings/useSplitSubvariantStore.js +37 -0
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/types/widget.d.ts +5 -1
- package/types/widget.js +3 -3
package/AppDrawer.js
CHANGED
|
@@ -7,6 +7,7 @@ import { useTranslation } from 'react-i18next';
|
|
|
7
7
|
import { AppDefault } from './App';
|
|
8
8
|
import { DrawerButton, DrawerButtonTypography } from './AppDrawer.style';
|
|
9
9
|
import { AppProvider } from './AppProvider';
|
|
10
|
+
import { HiddenUI } from './types';
|
|
10
11
|
export const AppDrawer = forwardRef(({ elementRef, open, integrator, config }, ref) => {
|
|
11
12
|
const openRef = useRef(open);
|
|
12
13
|
const [drawerOpen, setDrawerOpen] = useState(Boolean(open));
|
|
@@ -33,7 +34,7 @@ export const AppDrawer = forwardRef(({ elementRef, open, integrator, config }, r
|
|
|
33
34
|
height: '100%',
|
|
34
35
|
},
|
|
35
36
|
}), [config, integrator]);
|
|
36
|
-
return (_jsxs(AppProvider, { config: widgetConfig, children: [_jsxs(DrawerButton, { variant: "contained", onClick: toggleDrawer, open: drawerOpen, drawerProps: config?.containerStyle, children: [drawerOpen ? _jsx(KeyboardArrowRightIcon, {}) : _jsx(KeyboardArrowLeftIcon, {}), _jsx(DrawerButtonText, { open: drawerOpen })] }), _jsx(Drawer, { ref: elementRef, anchor: "right", open: drawerOpen, onClose: closeDrawer, BackdropProps: {
|
|
37
|
+
return (_jsxs(AppProvider, { config: widgetConfig, children: [!widgetConfig.hiddenUI?.includes(HiddenUI.DrawerButton) ? (_jsxs(DrawerButton, { variant: "contained", onClick: toggleDrawer, open: drawerOpen, drawerProps: config?.containerStyle, children: [drawerOpen ? (_jsx(KeyboardArrowRightIcon, {})) : (_jsx(KeyboardArrowLeftIcon, {})), _jsx(DrawerButtonText, { open: drawerOpen })] })) : null, _jsx(Drawer, { ref: elementRef, anchor: "right", open: drawerOpen, onClose: closeDrawer, BackdropProps: {
|
|
37
38
|
sx: {
|
|
38
39
|
backgroundColor: 'rgb(0 0 0 / 48%)',
|
|
39
40
|
backdropFilter: 'blur(3px)',
|
package/AppProvider.js
CHANGED
|
@@ -6,7 +6,7 @@ import { queryClient } from './config/queryClient';
|
|
|
6
6
|
import { I18nProvider, SDKProvider, SwapFormProvider, ThemeProvider, URLSearchParamsBuilder, WalletProvider, WidgetProvider, useWidgetConfig, } from './providers';
|
|
7
7
|
import { StoreProvider } from './stores';
|
|
8
8
|
export const AppProvider = ({ children, config, }) => {
|
|
9
|
-
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(StoreProvider, {
|
|
9
|
+
return (_jsx(QueryClientProvider, { client: queryClient, children: _jsx(StoreProvider, { config: config, children: _jsx(WidgetProvider, { config: config, children: _jsx(SDKProvider, { children: _jsx(ThemeProvider, { children: _jsx(I18nProvider, { children: _jsx(WalletProvider, { children: _jsx(SwapFormProvider, { children: _jsx(AppRouter, { children: children }) }) }) }) }) }) }) }) }));
|
|
10
10
|
};
|
|
11
11
|
export const AppRouter = ({ children }) => {
|
|
12
12
|
const { buildSwapUrl } = useWidgetConfig();
|
package/cjs/AppDrawer.js
CHANGED
|
@@ -10,6 +10,7 @@ const react_i18next_1 = require("react-i18next");
|
|
|
10
10
|
const App_1 = require("./App");
|
|
11
11
|
const AppDrawer_style_1 = require("./AppDrawer.style");
|
|
12
12
|
const AppProvider_1 = require("./AppProvider");
|
|
13
|
+
const types_1 = require("./types");
|
|
13
14
|
exports.AppDrawer = (0, react_1.forwardRef)(({ elementRef, open, integrator, config }, ref) => {
|
|
14
15
|
const openRef = (0, react_1.useRef)(open);
|
|
15
16
|
const [drawerOpen, setDrawerOpen] = (0, react_1.useState)(Boolean(open));
|
|
@@ -36,7 +37,7 @@ exports.AppDrawer = (0, react_1.forwardRef)(({ elementRef, open, integrator, con
|
|
|
36
37
|
height: '100%',
|
|
37
38
|
},
|
|
38
39
|
}), [config, integrator]);
|
|
39
|
-
return ((0, jsx_runtime_1.jsxs)(AppProvider_1.AppProvider, { config: widgetConfig, children: [(0, jsx_runtime_1.jsxs)(AppDrawer_style_1.DrawerButton, { variant: "contained", onClick: toggleDrawer, open: drawerOpen, drawerProps: config?.containerStyle, children: [drawerOpen ? (0, jsx_runtime_1.jsx)(KeyboardArrowRight_1.default, {}) : (0, jsx_runtime_1.jsx)(KeyboardArrowLeft_1.default, {}), (0, jsx_runtime_1.jsx)(exports.DrawerButtonText, { open: drawerOpen })] }), (0, jsx_runtime_1.jsx)(material_1.Drawer, { ref: elementRef, anchor: "right", open: drawerOpen, onClose: closeDrawer, BackdropProps: {
|
|
40
|
+
return ((0, jsx_runtime_1.jsxs)(AppProvider_1.AppProvider, { config: widgetConfig, children: [!widgetConfig.hiddenUI?.includes(types_1.HiddenUI.DrawerButton) ? ((0, jsx_runtime_1.jsxs)(AppDrawer_style_1.DrawerButton, { variant: "contained", onClick: toggleDrawer, open: drawerOpen, drawerProps: config?.containerStyle, children: [drawerOpen ? ((0, jsx_runtime_1.jsx)(KeyboardArrowRight_1.default, {})) : ((0, jsx_runtime_1.jsx)(KeyboardArrowLeft_1.default, {})), (0, jsx_runtime_1.jsx)(exports.DrawerButtonText, { open: drawerOpen })] })) : null, (0, jsx_runtime_1.jsx)(material_1.Drawer, { ref: elementRef, anchor: "right", open: drawerOpen, onClose: closeDrawer, BackdropProps: {
|
|
40
41
|
sx: {
|
|
41
42
|
backgroundColor: 'rgb(0 0 0 / 48%)',
|
|
42
43
|
backdropFilter: 'blur(3px)',
|
package/cjs/AppProvider.js
CHANGED
|
@@ -9,7 +9,7 @@ const queryClient_1 = require("./config/queryClient");
|
|
|
9
9
|
const providers_1 = require("./providers");
|
|
10
10
|
const stores_1 = require("./stores");
|
|
11
11
|
const AppProvider = ({ children, config, }) => {
|
|
12
|
-
return ((0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient_1.queryClient, children: (0, jsx_runtime_1.jsx)(stores_1.StoreProvider, {
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(react_query_1.QueryClientProvider, { client: queryClient_1.queryClient, children: (0, jsx_runtime_1.jsx)(stores_1.StoreProvider, { config: config, children: (0, jsx_runtime_1.jsx)(providers_1.WidgetProvider, { config: config, children: (0, jsx_runtime_1.jsx)(providers_1.SDKProvider, { children: (0, jsx_runtime_1.jsx)(providers_1.ThemeProvider, { children: (0, jsx_runtime_1.jsx)(providers_1.I18nProvider, { children: (0, jsx_runtime_1.jsx)(providers_1.WalletProvider, { children: (0, jsx_runtime_1.jsx)(providers_1.SwapFormProvider, { children: (0, jsx_runtime_1.jsx)(exports.AppRouter, { children: children }) }) }) }) }) }) }) }) }));
|
|
13
13
|
};
|
|
14
14
|
exports.AppProvider = AppProvider;
|
|
15
15
|
const AppRouter = ({ children }) => {
|
|
@@ -11,6 +11,7 @@ const useChainSelect = (formType) => {
|
|
|
11
11
|
const { setValue } = (0, react_hook_form_1.useFormContext)();
|
|
12
12
|
const { chains, isLoading } = (0, hooks_1.useChains)();
|
|
13
13
|
const [chainOrder, setChainOrder] = (0, stores_1.useChainOrder)();
|
|
14
|
+
const swapOnly = (0, hooks_1.useSwapOnly)();
|
|
14
15
|
const getChains = () => {
|
|
15
16
|
if (!chains) {
|
|
16
17
|
return [];
|
|
@@ -23,6 +24,11 @@ const useChainSelect = (formType) => {
|
|
|
23
24
|
const setCurrentChain = (chainId) => {
|
|
24
25
|
onChange(chainId);
|
|
25
26
|
onBlur();
|
|
27
|
+
if (swapOnly) {
|
|
28
|
+
setValue(providers_1.SwapFormKeyHelper.getChainKey('to'), chainId, {
|
|
29
|
+
shouldTouch: true,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
26
32
|
setValue(providers_1.SwapFormKeyHelper.getTokenKey(formType), '');
|
|
27
33
|
setValue(providers_1.SwapFormKeyHelper.getAmountKey(formType), '');
|
|
28
34
|
setValue(providers_1.SwapFormKey.TokenSearchFilter, '');
|
|
@@ -16,7 +16,7 @@ const HeaderContainer = ({ children }) => {
|
|
|
16
16
|
};
|
|
17
17
|
exports.HeaderContainer = HeaderContainer;
|
|
18
18
|
const Header = () => {
|
|
19
|
-
const { walletManagement } = (0, providers_1.useWidgetConfig)();
|
|
20
|
-
return ((0, jsx_runtime_1.jsxs)(exports.HeaderContainer, { children: [!walletManagement ? (0, jsx_runtime_1.jsx)(WalletHeader_1.WalletHeader, {}) : null, (0, jsx_runtime_1.jsx)(NavigationHeader_1.NavigationHeader, {})] }));
|
|
19
|
+
const { walletManagement, subvariant } = (0, providers_1.useWidgetConfig)();
|
|
20
|
+
return ((0, jsx_runtime_1.jsxs)(exports.HeaderContainer, { children: [!walletManagement && subvariant !== 'split' ? (0, jsx_runtime_1.jsx)(WalletHeader_1.WalletHeader, {}) : null, (0, jsx_runtime_1.jsx)(NavigationHeader_1.NavigationHeader, {})] }));
|
|
21
21
|
};
|
|
22
22
|
exports.Header = Header;
|
|
@@ -42,4 +42,7 @@ exports.WalletButton = (0, styles_1.styled)(material_1.Button)(({ theme }) => ({
|
|
|
42
42
|
[`.${Button_1.buttonClasses.endIcon} > *:nth-of-type(1)`]: {
|
|
43
43
|
fontSize: '24px',
|
|
44
44
|
},
|
|
45
|
+
[`.${Button_1.buttonClasses.startIcon} > *:nth-of-type(1)`]: {
|
|
46
|
+
fontSize: '24px',
|
|
47
|
+
},
|
|
45
48
|
}));
|
|
@@ -13,10 +13,12 @@ const providers_1 = require("../../providers");
|
|
|
13
13
|
const types_1 = require("../../types");
|
|
14
14
|
const utils_1 = require("../../utils");
|
|
15
15
|
const Header_style_1 = require("./Header.style");
|
|
16
|
+
const NavigationTabs_1 = require("./NavigationTabs");
|
|
17
|
+
const WalletHeader_1 = require("./WalletHeader");
|
|
16
18
|
const useHeaderActionStore_1 = require("./useHeaderActionStore");
|
|
17
19
|
const NavigationHeader = () => {
|
|
18
20
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
19
|
-
const { variant, hiddenUI } = (0, providers_1.useWidgetConfig)();
|
|
21
|
+
const { variant, subvariant, hiddenUI, walletManagement } = (0, providers_1.useWidgetConfig)();
|
|
20
22
|
const { navigate, navigateBack } = (0, hooks_1.useNavigateBack)();
|
|
21
23
|
const { account } = (0, providers_1.useWallet)();
|
|
22
24
|
const { element } = (0, useHeaderActionStore_1.useHeaderActionStore)();
|
|
@@ -26,6 +28,7 @@ const NavigationHeader = () => {
|
|
|
26
28
|
: pathname;
|
|
27
29
|
const path = cleanedPathname.substring(cleanedPathname.lastIndexOf('/') + 1);
|
|
28
30
|
const hasPath = utils_1.navigationRoutesValues.includes(path);
|
|
31
|
+
const splitSubvariant = subvariant === 'split' && !hasPath;
|
|
29
32
|
const handleHeaderTitle = () => {
|
|
30
33
|
switch (path) {
|
|
31
34
|
case utils_1.navigationRoutes.selectWallet:
|
|
@@ -78,8 +81,8 @@ const NavigationHeader = () => {
|
|
|
78
81
|
}
|
|
79
82
|
}
|
|
80
83
|
};
|
|
81
|
-
return ((0, jsx_runtime_1.jsxs)(Header_style_1.HeaderAppBar, { elevation: 0, children: [utils_1.backButtonRoutes.includes(path) ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "start", onClick: navigateBack, children: (0, jsx_runtime_1.jsx)(ArrowBack_1.default, {}) })) : null, (0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true, children: handleHeaderTitle() }), (0, jsx_runtime_1.jsxs)(react_router_dom_1.Routes, { children: [(0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: utils_1.navigationRoutes.home, element: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [account.isActive && !hiddenUI?.includes(types_1.HiddenUI.History) ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t(`header.swapHistory`), enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "start", onClick: () => navigate(utils_1.navigationRoutes.swapHistory), children: (0, jsx_runtime_1.jsx)(ReceiptLong_1.default, {}) }) })) : null, (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t(`header.settings`), enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", onClick: () => navigate(utils_1.navigationRoutes.settings), sx: {
|
|
82
|
-
|
|
83
|
-
|
|
84
|
+
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Header_style_1.HeaderAppBar, { elevation: 0, children: [utils_1.backButtonRoutes.includes(path) ? ((0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "start", onClick: navigateBack, children: (0, jsx_runtime_1.jsx)(ArrowBack_1.default, {}) })) : null, splitSubvariant ? ((0, jsx_runtime_1.jsx)(material_1.Box, { flex: 1, children: !hiddenUI?.includes(types_1.HiddenUI.WalletMenu) ? ((0, jsx_runtime_1.jsx)(WalletHeader_1.WalletMenuButton, {})) : null })) : ((0, jsx_runtime_1.jsx)(material_1.Typography, { fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true, children: handleHeaderTitle() })), (0, jsx_runtime_1.jsxs)(react_router_dom_1.Routes, { children: [(0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: utils_1.navigationRoutes.home, element: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [account.isActive && !hiddenUI?.includes(types_1.HiddenUI.History) ? ((0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t(`header.swapHistory`), enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", edge: "start", onClick: () => navigate(utils_1.navigationRoutes.swapHistory), children: (0, jsx_runtime_1.jsx)(ReceiptLong_1.default, {}) }) })) : null, (0, jsx_runtime_1.jsx)(material_1.Tooltip, { title: t(`header.settings`), enterDelay: 400, arrow: true, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { size: "medium", onClick: () => navigate(utils_1.navigationRoutes.settings), sx: {
|
|
85
|
+
marginRight: -1.25,
|
|
86
|
+
}, children: (0, jsx_runtime_1.jsx)(Settings_1.default, {}) }) })] }) }), (0, jsx_runtime_1.jsx)(react_router_dom_1.Route, { path: "*", element: element || (0, jsx_runtime_1.jsx)(material_1.Box, { width: 28, height: 40 }) })] })] }), splitSubvariant ? (0, jsx_runtime_1.jsx)(NavigationTabs_1.NavigationTabs, {}) : null] }));
|
|
84
87
|
};
|
|
85
88
|
exports.NavigationHeader = NavigationHeader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const NavigationTabs: () => JSX.Element;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NavigationTabs = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const react_hook_form_1 = require("react-hook-form");
|
|
6
|
+
const react_i18next_1 = require("react-i18next");
|
|
7
|
+
const providers_1 = require("../../providers");
|
|
8
|
+
const stores_1 = require("../../stores");
|
|
9
|
+
const Header_style_1 = require("./Header.style");
|
|
10
|
+
const NavigationTabs_style_1 = require("./NavigationTabs.style");
|
|
11
|
+
const NavigationTabs = () => {
|
|
12
|
+
const { t } = (0, react_i18next_1.useTranslation)();
|
|
13
|
+
const [state, setState] = (0, stores_1.useSplitSubvariantStore)((state) => [
|
|
14
|
+
state.state,
|
|
15
|
+
state.setState,
|
|
16
|
+
]);
|
|
17
|
+
const { setValue } = (0, react_hook_form_1.useFormContext)();
|
|
18
|
+
const handleChange = (_, value) => {
|
|
19
|
+
setValue(providers_1.SwapFormKey.FromAmount, '');
|
|
20
|
+
setValue(providers_1.SwapFormKey.FromToken, '');
|
|
21
|
+
setValue(providers_1.SwapFormKey.ToToken, '');
|
|
22
|
+
setState(value === 0 ? 'swap' : 'bridge');
|
|
23
|
+
};
|
|
24
|
+
return ((0, jsx_runtime_1.jsx)(Header_style_1.HeaderAppBar, { elevation: 0, sx: { py: 1 }, children: (0, jsx_runtime_1.jsxs)(NavigationTabs_style_1.NavbarTabs, { value: state === 'swap' ? 0 : 1, onChange: handleChange, "aria-label": "tabs", indicatorColor: "primary", children: [(0, jsx_runtime_1.jsx)(NavigationTabs_style_1.NavbarTab, { label: t('header.swap'), disableRipple: true }), (0, jsx_runtime_1.jsx)(NavigationTabs_style_1.NavbarTab, { label: t('header.bridge'), disableRipple: true })] }) }));
|
|
25
|
+
};
|
|
26
|
+
exports.NavigationTabs = NavigationTabs;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export declare const NavbarTabs: import("@emotion/styled").StyledComponent<{
|
|
3
|
+
action?: import("react").Ref<import("@mui/material").TabsActions> | undefined;
|
|
4
|
+
allowScrollButtonsMobile?: boolean | undefined;
|
|
5
|
+
'aria-label'?: string | undefined;
|
|
6
|
+
'aria-labelledby'?: string | undefined;
|
|
7
|
+
centered?: boolean | undefined;
|
|
8
|
+
children?: import("react").ReactNode;
|
|
9
|
+
classes?: Partial<import("@mui/material").TabsClasses> | undefined;
|
|
10
|
+
slots?: {
|
|
11
|
+
StartScrollButtonIcon?: import("react").ElementType<any> | undefined;
|
|
12
|
+
EndScrollButtonIcon?: import("react").ElementType<any> | undefined;
|
|
13
|
+
} | undefined;
|
|
14
|
+
slotProps?: {
|
|
15
|
+
startScrollButtonIcon?: import("@mui/base").SlotComponentProps<import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
|
|
16
|
+
muiName: string;
|
|
17
|
+
}, import("@mui/material").TabsStartScrollButtonIconSlotPropsOverrides, import("@mui/material").TabsOwnerState> | undefined;
|
|
18
|
+
endScrollButtonIcon?: import("@mui/base").SlotComponentProps<import("@mui/material/OverridableComponent").OverridableComponent<import("@mui/material").SvgIconTypeMap<{}, "svg">> & {
|
|
19
|
+
muiName: string;
|
|
20
|
+
}, import("@mui/material").TabsEndScrollButtonIconSlotPropsOverrides, import("@mui/material").TabsOwnerState> | undefined;
|
|
21
|
+
} | undefined;
|
|
22
|
+
indicatorColor?: import("@mui/types").OverridableStringUnion<"primary" | "secondary", import("@mui/material").TabsPropsIndicatorColorOverrides> | undefined;
|
|
23
|
+
onChange?: ((event: import("react").SyntheticEvent<Element, Event>, value: any) => void) | undefined;
|
|
24
|
+
orientation?: "horizontal" | "vertical" | undefined;
|
|
25
|
+
ScrollButtonComponent?: import("react").ElementType<any> | undefined;
|
|
26
|
+
scrollButtons?: boolean | "auto" | undefined;
|
|
27
|
+
selectionFollowsFocus?: boolean | undefined;
|
|
28
|
+
TabIndicatorProps?: (import("react").HTMLAttributes<HTMLDivElement> & {
|
|
29
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
30
|
+
}) | undefined;
|
|
31
|
+
TabScrollButtonProps?: Partial<import("@mui/material").TabScrollButtonProps> | undefined;
|
|
32
|
+
textColor?: "inherit" | "primary" | "secondary" | undefined;
|
|
33
|
+
value?: any;
|
|
34
|
+
variant?: "fullWidth" | "standard" | "scrollable" | undefined;
|
|
35
|
+
visibleScrollbar?: boolean | undefined;
|
|
36
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
37
|
+
} & import("@mui/material/OverridableComponent").CommonProps & Omit<{
|
|
38
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
39
|
+
centerRipple?: boolean | undefined;
|
|
40
|
+
children?: import("react").ReactNode;
|
|
41
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
42
|
+
disabled?: boolean | undefined;
|
|
43
|
+
disableRipple?: boolean | undefined;
|
|
44
|
+
disableTouchRipple?: boolean | undefined;
|
|
45
|
+
focusRipple?: boolean | undefined;
|
|
46
|
+
focusVisibleClassName?: string | undefined;
|
|
47
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
48
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
49
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
50
|
+
tabIndex?: number | undefined;
|
|
51
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
52
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
53
|
+
} & Omit<{
|
|
54
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
55
|
+
centerRipple?: boolean | undefined;
|
|
56
|
+
children?: import("react").ReactNode;
|
|
57
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
58
|
+
disabled?: boolean | undefined;
|
|
59
|
+
disableRipple?: boolean | undefined;
|
|
60
|
+
disableTouchRipple?: boolean | undefined;
|
|
61
|
+
focusRipple?: boolean | undefined;
|
|
62
|
+
focusVisibleClassName?: string | undefined;
|
|
63
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
64
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
65
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
66
|
+
tabIndex?: number | undefined;
|
|
67
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
68
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
69
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
70
|
+
ref?: ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
|
|
71
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "tabIndex" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef">, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "aria-label" | "aria-labelledby" | "onChange" | "action" | "sx" | "variant" | "value" | "slotProps" | "slots" | "orientation" | "allowScrollButtonsMobile" | "centered" | "indicatorColor" | "ScrollButtonComponent" | "scrollButtons" | "selectionFollowsFocus" | "TabIndicatorProps" | "TabScrollButtonProps" | "textColor" | "visibleScrollbar"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
72
|
+
export declare const NavbarTab: import("@emotion/styled").StyledComponent<{
|
|
73
|
+
children?: null | undefined;
|
|
74
|
+
classes?: Partial<import("@mui/material").TabClasses> | undefined;
|
|
75
|
+
disabled?: boolean | undefined;
|
|
76
|
+
disableFocusRipple?: boolean | undefined;
|
|
77
|
+
icon?: string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
78
|
+
iconPosition?: "bottom" | "top" | "end" | "start" | undefined;
|
|
79
|
+
label?: import("react").ReactNode;
|
|
80
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
81
|
+
value?: any;
|
|
82
|
+
wrapped?: boolean | undefined;
|
|
83
|
+
} & Omit<{
|
|
84
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
85
|
+
centerRipple?: boolean | undefined;
|
|
86
|
+
children?: import("react").ReactNode;
|
|
87
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
88
|
+
disabled?: boolean | undefined;
|
|
89
|
+
disableRipple?: boolean | undefined;
|
|
90
|
+
disableTouchRipple?: boolean | undefined;
|
|
91
|
+
focusRipple?: boolean | undefined;
|
|
92
|
+
focusVisibleClassName?: string | undefined;
|
|
93
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
94
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
95
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
96
|
+
tabIndex?: number | undefined;
|
|
97
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
98
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
99
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
100
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
101
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "label" | "tabIndex" | "children" | "action" | "centerRipple" | "disabled" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "sx" | "TouchRippleProps" | "touchRippleRef" | "disableFocusRipple" | "value" | "icon" | "iconPosition" | "wrapped"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NavbarTab = exports.NavbarTabs = void 0;
|
|
4
|
+
const material_1 = require("@mui/material");
|
|
5
|
+
const styles_1 = require("@mui/material/styles");
|
|
6
|
+
exports.NavbarTabs = (0, styles_1.styled)(material_1.Tabs)(({ theme }) => ({
|
|
7
|
+
backgroundColor: theme.palette.mode === 'dark'
|
|
8
|
+
? theme.palette.common.white
|
|
9
|
+
: (0, styles_1.alpha)(theme.palette.common.black, 0.04),
|
|
10
|
+
borderRadius: theme.shape.borderRadius,
|
|
11
|
+
padding: theme.spacing(0.5),
|
|
12
|
+
flex: 1,
|
|
13
|
+
display: 'flex',
|
|
14
|
+
alignItems: 'center',
|
|
15
|
+
height: 56,
|
|
16
|
+
[`.${material_1.tabsClasses.flexContainer}`]: {
|
|
17
|
+
alignItems: 'center',
|
|
18
|
+
},
|
|
19
|
+
[`.${material_1.tabsClasses.scroller}`]: {
|
|
20
|
+
overflow: 'initial !important',
|
|
21
|
+
},
|
|
22
|
+
[`.${material_1.tabsClasses.indicator}`]: {
|
|
23
|
+
position: 'absolute',
|
|
24
|
+
top: '50%',
|
|
25
|
+
transform: 'translateY(-50%)',
|
|
26
|
+
height: 48,
|
|
27
|
+
backgroundColor: theme.palette.mode === 'dark'
|
|
28
|
+
? theme.palette.common.black
|
|
29
|
+
: theme.palette.common.white,
|
|
30
|
+
borderRadius: theme.shape.borderRadiusSecondary,
|
|
31
|
+
boxShadow: `0px 2px 4px ${(0, styles_1.alpha)(theme.palette.common.black, 0.04)}`,
|
|
32
|
+
},
|
|
33
|
+
}));
|
|
34
|
+
exports.NavbarTab = (0, styles_1.styled)(material_1.Tab, {
|
|
35
|
+
shouldForwardProp: (prop) => prop !== 'isDarkMode',
|
|
36
|
+
})(({ theme }) => ({
|
|
37
|
+
zIndex: 1,
|
|
38
|
+
display: 'flex',
|
|
39
|
+
flex: 1,
|
|
40
|
+
justifyContent: 'center',
|
|
41
|
+
alignItems: 'center',
|
|
42
|
+
flexDirection: 'row',
|
|
43
|
+
textTransform: 'none',
|
|
44
|
+
height: 48,
|
|
45
|
+
minHeight: 48,
|
|
46
|
+
fontSize: '1rem',
|
|
47
|
+
fontWeight: 700,
|
|
48
|
+
color: theme.palette.mode === 'dark'
|
|
49
|
+
? theme.palette.common.white
|
|
50
|
+
: theme.palette.common.black,
|
|
51
|
+
textDecoration: 'none',
|
|
52
|
+
[`&.${material_1.tabClasses.selected}`]: {
|
|
53
|
+
color: theme.palette.mode === 'dark'
|
|
54
|
+
? theme.palette.common.white
|
|
55
|
+
: theme.palette.common.black,
|
|
56
|
+
backgroundColor: 'transparent',
|
|
57
|
+
},
|
|
58
|
+
[`.${material_1.tabClasses.iconWrapper}`]: {
|
|
59
|
+
margin: theme.spacing(0, 1, 0, 0),
|
|
60
|
+
},
|
|
61
|
+
}));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.WalletHeader = void 0;
|
|
3
|
+
exports.WalletMenuButton = exports.WalletHeader = void 0;
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const ContentCopyRounded_1 = require("@mui/icons-material/ContentCopyRounded");
|
|
6
6
|
const ExpandMore_1 = require("@mui/icons-material/ExpandMore");
|
|
@@ -17,29 +17,35 @@ const utils_1 = require("../../utils");
|
|
|
17
17
|
const Header_style_1 = require("./Header.style");
|
|
18
18
|
const WalletMenu_1 = require("./WalletMenu");
|
|
19
19
|
const WalletHeader = () => {
|
|
20
|
-
|
|
21
|
-
return ((0, jsx_runtime_1.jsx)(Header_style_1.HeaderAppBar, { elevation: 0, sx: { justifyContent: 'flex-end' }, children: account.isActive ? (0, jsx_runtime_1.jsx)(ConnectedButton, {}) : (0, jsx_runtime_1.jsx)(ConnectButton, {}) }));
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(Header_style_1.HeaderAppBar, { elevation: 0, sx: { justifyContent: 'flex-end' }, children: (0, jsx_runtime_1.jsx)(exports.WalletMenuButton, {}) }));
|
|
22
21
|
};
|
|
23
22
|
exports.WalletHeader = WalletHeader;
|
|
23
|
+
const WalletMenuButton = () => {
|
|
24
|
+
const { account } = (0, providers_1.useWallet)();
|
|
25
|
+
return account.isActive ? (0, jsx_runtime_1.jsx)(ConnectedButton, {}) : (0, jsx_runtime_1.jsx)(ConnectButton, {});
|
|
26
|
+
};
|
|
27
|
+
exports.WalletMenuButton = WalletMenuButton;
|
|
24
28
|
const ConnectButton = () => {
|
|
25
29
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
26
30
|
const { pathname } = (0, react_router_dom_1.useLocation)();
|
|
27
|
-
const
|
|
31
|
+
const { walletManagement, subvariant } = (0, providers_1.useWidgetConfig)();
|
|
28
32
|
const { connect: connectWallet } = (0, providers_1.useWallet)();
|
|
29
33
|
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
30
34
|
const connect = async () => {
|
|
31
|
-
if (
|
|
35
|
+
if (walletManagement) {
|
|
32
36
|
await connectWallet();
|
|
33
37
|
return;
|
|
34
38
|
}
|
|
35
39
|
navigate(utils_1.navigationRoutes.selectWallet);
|
|
36
40
|
};
|
|
37
|
-
return ((0, jsx_runtime_1.jsx)(Header_style_1.WalletButton, { endIcon: (0, jsx_runtime_1.jsx)(Wallet_1.default, {}), onClick: !pathname.includes(utils_1.navigationRoutes.selectWallet) ? connect : undefined, sx: {
|
|
38
|
-
marginRight: -1.25,
|
|
41
|
+
return ((0, jsx_runtime_1.jsx)(Header_style_1.WalletButton, { endIcon: subvariant !== 'split' ? (0, jsx_runtime_1.jsx)(Wallet_1.default, {}) : undefined, startIcon: subvariant === 'split' ? (0, jsx_runtime_1.jsx)(Wallet_1.default, {}) : undefined, onClick: !pathname.includes(utils_1.navigationRoutes.selectWallet) ? connect : undefined, sx: {
|
|
42
|
+
marginRight: subvariant === 'split' ? 0 : -1.25,
|
|
43
|
+
marginLeft: subvariant === 'split' ? -1.25 : 0,
|
|
39
44
|
}, children: t(`button.connectWallet`) }));
|
|
40
45
|
};
|
|
41
46
|
const ConnectedButton = () => {
|
|
42
47
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
48
|
+
const { subvariant } = (0, providers_1.useWidgetConfig)();
|
|
43
49
|
const { account, disconnect } = (0, providers_1.useWallet)();
|
|
44
50
|
const walletAddress = (0, utils_1.shortenWalletAddress)(account.address);
|
|
45
51
|
const { chain } = (0, hooks_1.useChain)(account.chainId);
|
|
@@ -59,7 +65,8 @@ const ConnectedButton = () => {
|
|
|
59
65
|
handleClose();
|
|
60
66
|
};
|
|
61
67
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Header_style_1.WalletButton, { endIcon: (0, jsx_runtime_1.jsx)(ExpandMore_1.default, {}), startIcon: (0, jsx_runtime_1.jsx)(material_1.Avatar, { src: chain?.logoURI, alt: chain?.key, sx: { width: 24, height: 24 }, children: chain?.name[0] }), sx: {
|
|
62
|
-
marginRight: -1.25,
|
|
68
|
+
marginRight: subvariant === 'split' ? 0 : -1.25,
|
|
69
|
+
marginLeft: subvariant === 'split' ? -1 : 0,
|
|
63
70
|
}, onClick: handleClick, children: walletAddress }), (0, jsx_runtime_1.jsxs)(WalletMenu_1.WalletMenu, { anchorEl: anchorEl, open: Boolean(anchorEl), onClose: handleClose, children: [(0, jsx_runtime_1.jsxs)(material_1.MenuItem, { onClick: handleCopyAddress, children: [(0, jsx_runtime_1.jsx)(ContentCopyRounded_1.default, {}), t(`button.copyAddress`)] }), (0, jsx_runtime_1.jsxs)(material_1.MenuItem, { component: "a", onClick: handleClose, href: `${chain?.metamask.blockExplorerUrls[0]}address/${account.address}`, target: "_blank", children: [(0, jsx_runtime_1.jsx)(OpenInNewRounded_1.default, {}), t(`button.viewOnExplorer`)] }), (0, jsx_runtime_1.jsx)(material_1.Button, { onClick: handleDisconnect, fullWidth: true, startIcon: (0, jsx_runtime_1.jsx)(PowerSettingsNewRounded_1.default, {}), sx: {
|
|
64
71
|
marginTop: 1,
|
|
65
72
|
}, children: t(`button.disconnect`) })] })] }));
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useHeaderActionStore = void 0;
|
|
4
|
-
/* eslint-disable no-underscore-dangle */
|
|
5
4
|
const zustand_1 = require("zustand");
|
|
6
5
|
exports.useHeaderActionStore = (0, zustand_1.create)((set, get) => ({
|
|
7
6
|
setAction: (element) => {
|
|
@@ -16,6 +16,7 @@ const SelectTokenButton = ({ formType, compact }) => {
|
|
|
16
16
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
17
17
|
const navigate = (0, react_router_dom_1.useNavigate)();
|
|
18
18
|
const { disabledUI, variant } = (0, providers_1.useWidgetConfig)();
|
|
19
|
+
const swapOnly = (0, hooks_1.useSwapOnly)();
|
|
19
20
|
const tokenKey = providers_1.SwapFormKeyHelper.getTokenKey(formType);
|
|
20
21
|
const [chainId, tokenAddress] = (0, react_hook_form_1.useWatch)({
|
|
21
22
|
name: [providers_1.SwapFormKeyHelper.getChainKey(formType), tokenKey],
|
|
@@ -32,8 +33,10 @@ const SelectTokenButton = ({ formType, compact }) => {
|
|
|
32
33
|
const isSelected = !!(chain && token);
|
|
33
34
|
const onClick = !disabledUI?.includes(tokenKey) ? handleClick : undefined;
|
|
34
35
|
const defaultPlaceholder = formType === 'to' && variant === 'refuel'
|
|
35
|
-
? t(
|
|
36
|
-
:
|
|
36
|
+
? t('swap.selectChain')
|
|
37
|
+
: formType === 'to' && swapOnly
|
|
38
|
+
? t('swap.selectToken')
|
|
39
|
+
: t('swap.selectChainAndToken');
|
|
37
40
|
const cardTitle = formType === 'from' && variant === 'nft'
|
|
38
41
|
? t(`header.payWith`)
|
|
39
42
|
: t(`swap.${formType}`);
|
package/cjs/config/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export declare const name = "@lifi/widget";
|
|
2
|
-
export declare const version = "2.0.0-beta.
|
|
2
|
+
export declare const version = "2.0.0-beta.6";
|
package/cjs/config/version.js
CHANGED
package/cjs/hooks/index.d.ts
CHANGED
|
@@ -15,12 +15,13 @@ export * from './useNavigateBack';
|
|
|
15
15
|
export * from './useProcessMessage';
|
|
16
16
|
export * from './useRouteExecution';
|
|
17
17
|
export * from './useScrollableContainer';
|
|
18
|
+
export * from './useSwapOnly';
|
|
18
19
|
export * from './useSwapRoutes';
|
|
19
20
|
export * from './useToken';
|
|
20
21
|
export * from './useTokenAddressBalance';
|
|
21
22
|
export * from './useTokenBalance';
|
|
22
23
|
export * from './useTokenBalances';
|
|
23
|
-
export * from './useTokens';
|
|
24
24
|
export * from './useTokenSearch';
|
|
25
|
+
export * from './useTokens';
|
|
25
26
|
export * from './useTools';
|
|
26
27
|
export * from './useWidgetEvents';
|
package/cjs/hooks/index.js
CHANGED
|
@@ -31,12 +31,13 @@ __exportStar(require("./useNavigateBack"), exports);
|
|
|
31
31
|
__exportStar(require("./useProcessMessage"), exports);
|
|
32
32
|
__exportStar(require("./useRouteExecution"), exports);
|
|
33
33
|
__exportStar(require("./useScrollableContainer"), exports);
|
|
34
|
+
__exportStar(require("./useSwapOnly"), exports);
|
|
34
35
|
__exportStar(require("./useSwapRoutes"), exports);
|
|
35
36
|
__exportStar(require("./useToken"), exports);
|
|
36
37
|
__exportStar(require("./useTokenAddressBalance"), exports);
|
|
37
38
|
__exportStar(require("./useTokenBalance"), exports);
|
|
38
39
|
__exportStar(require("./useTokenBalances"), exports);
|
|
39
|
-
__exportStar(require("./useTokens"), exports);
|
|
40
40
|
__exportStar(require("./useTokenSearch"), exports);
|
|
41
|
+
__exportStar(require("./useTokens"), exports);
|
|
41
42
|
__exportStar(require("./useTools"), exports);
|
|
42
43
|
__exportStar(require("./useWidgetEvents"), exports);
|
|
@@ -6,8 +6,8 @@ const utils_1 = require("../utils");
|
|
|
6
6
|
const useDefaultElementId_1 = require("./useDefaultElementId");
|
|
7
7
|
const useScrollableContainer_1 = require("./useScrollableContainer");
|
|
8
8
|
const getContentHeight = (elementId) => {
|
|
9
|
-
const headerElement = document.getElementById((0, utils_1.createElementId)(utils_1.ElementId.Header, elementId));
|
|
10
9
|
const containerElement = document.getElementById((0, utils_1.createElementId)(utils_1.ElementId.ScrollableContainer, elementId));
|
|
10
|
+
const headerElement = document.getElementById((0, utils_1.createElementId)(utils_1.ElementId.Header, elementId));
|
|
11
11
|
if (!containerElement || !headerElement) {
|
|
12
12
|
console.warn(`Can't find ${utils_1.ElementId.ScrollableContainer} or ${utils_1.ElementId.Header} id.`);
|
|
13
13
|
return 0;
|
|
@@ -18,11 +18,9 @@ const getContentHeight = (elementId) => {
|
|
|
18
18
|
};
|
|
19
19
|
const useContentHeight = () => {
|
|
20
20
|
const elementId = (0, useDefaultElementId_1.useDefaultElementId)();
|
|
21
|
-
const [contentHeight, setContentHeight] = (0, react_1.useState)(
|
|
21
|
+
const [contentHeight, setContentHeight] = (0, react_1.useState)(0);
|
|
22
22
|
(0, react_1.useLayoutEffect)(() => {
|
|
23
|
-
|
|
24
|
-
setContentHeight(getContentHeight(elementId));
|
|
25
|
-
}
|
|
23
|
+
setContentHeight(getContentHeight(elementId));
|
|
26
24
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
27
25
|
}, []);
|
|
28
26
|
return contentHeight;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useInitializer = void 0;
|
|
4
|
-
/* eslint-disable no-underscore-dangle */
|
|
5
4
|
const sdk_1 = require("@lifi/sdk");
|
|
6
5
|
const react_1 = require("react");
|
|
7
6
|
const version_1 = require("../config/version");
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useSwapOnly: () => boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.useSwapOnly = void 0;
|
|
4
|
+
const stores_1 = require("../stores");
|
|
5
|
+
const useSwapOnly = () => {
|
|
6
|
+
const state = (0, stores_1.useSplitSubvariantStore)((state) => state.state);
|
|
7
|
+
return state === 'swap';
|
|
8
|
+
};
|
|
9
|
+
exports.useSwapOnly = useSwapOnly;
|
|
@@ -10,12 +10,14 @@ const uuid_1 = require("uuid");
|
|
|
10
10
|
const _1 = require(".");
|
|
11
11
|
const providers_1 = require("../providers");
|
|
12
12
|
const stores_1 = require("../stores");
|
|
13
|
+
const useSwapOnly_1 = require("./useSwapOnly");
|
|
13
14
|
const refetchTime = 60000;
|
|
14
15
|
const useSwapRoutes = ({ onSettled, insurableRoute, } = {}) => {
|
|
15
16
|
const lifi = (0, providers_1.useLiFi)();
|
|
16
17
|
const { variant, sdkConfig, insurance, contractTool } = (0, providers_1.useWidgetConfig)();
|
|
17
18
|
const { account, provider } = (0, providers_1.useWallet)();
|
|
18
19
|
const queryClient = (0, react_query_1.useQueryClient)();
|
|
20
|
+
const swapOnly = (0, useSwapOnly_1.useSwapOnly)();
|
|
19
21
|
const { slippage, enabledBridges, enabledAutoRefuel, enabledExchanges, routePriority, } = (0, stores_1.useSettings)([
|
|
20
22
|
'slippage',
|
|
21
23
|
'routePriority',
|
|
@@ -66,7 +68,7 @@ const useSwapRoutes = ({ onSettled, insurableRoute, } = {}) => {
|
|
|
66
68
|
toContractCallData,
|
|
67
69
|
toContractGasLimit,
|
|
68
70
|
slippage,
|
|
69
|
-
enabledBridges,
|
|
71
|
+
swapOnly ? [] : enabledBridges,
|
|
70
72
|
enabledExchanges,
|
|
71
73
|
routePriority,
|
|
72
74
|
variant,
|
package/cjs/i18n/en.json
CHANGED
|
@@ -176,9 +176,9 @@
|
|
|
176
176
|
"rateChange": "Rate change",
|
|
177
177
|
"receiving": "Receiving",
|
|
178
178
|
"refuelStepDetails": "Get gas via {{tool}}",
|
|
179
|
-
"selectChain": "
|
|
179
|
+
"selectChain": "Select chain",
|
|
180
180
|
"selectChainAndToken": "Select chain and token",
|
|
181
|
-
"selectToken": "
|
|
181
|
+
"selectToken": "Select token",
|
|
182
182
|
"sendToAddress": "Send to {{address}}",
|
|
183
183
|
"sendToWallet": "Send to a different wallet",
|
|
184
184
|
"sentToAddress": "Sent to {{address}}",
|