@lifi/widget 2.0.0-beta.1 → 2.0.0-beta.11
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/App.d.ts +4 -3
- package/AppDrawer.d.ts +1 -1
- package/AppDrawer.js +2 -1
- package/AppProvider.js +1 -1
- package/README.md +11 -12
- package/cjs/App.d.ts +4 -3
- package/cjs/AppDrawer.d.ts +1 -1
- package/cjs/AppDrawer.js +2 -1
- package/cjs/AppProvider.js +1 -1
- package/cjs/components/ChainSelect/ChainSelect.d.ts +1 -2
- package/cjs/components/ChainSelect/ChainSelect.style.js +1 -1
- package/cjs/components/ChainSelect/useChainSelect.js +6 -0
- package/cjs/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -2
- package/cjs/components/GasMessage/GasMessage.js +1 -6
- package/cjs/components/Header/Header.js +2 -2
- package/cjs/components/Header/Header.style.d.ts +10 -3
- package/cjs/components/Header/Header.style.js +3 -0
- package/cjs/components/Header/NavigationHeader.js +23 -7
- 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 +34 -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 +16 -9
- package/cjs/components/Header/useHeaderActionStore.js +0 -1
- package/cjs/components/Insurance/Insurance.js +2 -2
- package/cjs/components/Insurance/InsuranceCard.js +34 -12
- package/cjs/components/Insurance/InsuranceCollapsed.js +9 -11
- package/cjs/components/Insurance/index.d.ts +1 -0
- package/cjs/components/Insurance/index.js +1 -0
- package/cjs/components/Insurance/types.d.ts +12 -9
- package/cjs/components/NFT/NFT.js +2 -2
- package/cjs/components/NFT/types.d.ts +1 -1
- package/cjs/components/PoweredBy/PoweredBy.js +2 -3
- package/cjs/components/SelectChainAndToken.js +8 -7
- package/cjs/components/SelectTokenButton/SelectTokenButton.js +6 -3
- package/cjs/components/SendToWallet/SendToWallet.js +2 -2
- package/cjs/components/SmallAvatar.d.ts +1 -1
- package/cjs/components/Step/CircularProgress.d.ts +1 -2
- package/cjs/components/Step/Step.js +15 -5
- package/cjs/components/Step/StepList.d.ts +1 -2
- package/cjs/components/StepActions/StepActions.js +4 -20
- package/cjs/components/SwapButton/SwapButton.js +16 -4
- package/cjs/components/SwapInput/FormPriceHelperText.js +1 -1
- package/cjs/components/SwapInput/SwapInput.js +2 -2
- package/cjs/components/SwapInput/SwapInputEndAdornment.d.ts +1 -2
- package/cjs/components/SwapInput/SwapInputEndAdornment.js +2 -2
- package/cjs/components/SwapRouteCard/SwapRouteCard.js +19 -3
- package/cjs/components/SwapRouteCard/SwapRouteCardEssentials.js +1 -1
- package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +1 -1
- package/cjs/components/SwapRoutes/SwapRoutes.js +1 -1
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -3
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +2 -2
- package/cjs/components/SwapRoutes/SwapRoutesExpanded.style.js +1 -0
- package/cjs/components/Token/Token.js +1 -1
- package/cjs/components/TokenAvatar/TokenAvatar.d.ts +4 -4
- package/cjs/components/TokenList/TokenList.js +9 -4
- package/cjs/components/TokenList/TokenList.style.d.ts +5 -2
- package/cjs/components/TokenList/TokenList.style.js +20 -1
- package/cjs/components/TokenList/TokenListItem.d.ts +1 -1
- package/cjs/components/TokenList/TokenListItem.js +28 -5
- package/cjs/components/TokenList/VirtualizedTokenList.js +3 -3
- package/cjs/components/TokenList/types.d.ts +6 -3
- package/cjs/config/theme.js +15 -3
- 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/useFeaturedTokens.d.ts +1 -1
- package/cjs/hooks/useFundsSufficiency.js +2 -2
- package/cjs/hooks/useGasRefuel.d.ts +1 -1
- package/cjs/hooks/useGasRefuel.js +5 -15
- package/cjs/hooks/useGasSufficiency.js +12 -3
- package/cjs/hooks/useInitializer.js +0 -1
- package/cjs/hooks/useProcessMessage.d.ts +2 -1
- package/cjs/hooks/useProcessMessage.js +27 -9
- package/cjs/hooks/useRouteExecution.js +6 -5
- package/cjs/hooks/useSwapOnly.d.ts +1 -0
- package/cjs/hooks/useSwapOnly.js +9 -0
- package/cjs/hooks/useSwapRoutes.d.ts +1 -2
- package/cjs/hooks/useSwapRoutes.js +32 -18
- package/cjs/hooks/useToken.d.ts +1 -1
- package/cjs/hooks/useTokenAddressBalance.d.ts +2 -2
- package/cjs/hooks/useTokenBalance.js +6 -7
- package/cjs/hooks/useTokenBalances.d.ts +5 -5
- package/cjs/hooks/useTokenBalances.js +4 -19
- package/cjs/hooks/useTokenSearch.d.ts +2 -2
- package/cjs/hooks/useTokens.d.ts +2 -2
- package/cjs/i18n/bn.json +8 -0
- package/cjs/i18n/en.json +30 -5
- package/cjs/i18n/fr.json +8 -0
- package/cjs/i18n/id.json +22 -7
- package/cjs/i18n/ko.json +22 -7
- package/cjs/i18n/pt.json +32 -7
- package/cjs/i18n/th.json +21 -6
- package/cjs/i18n/uk.json +43 -18
- package/cjs/i18n/zh.json +23 -8
- package/cjs/icons/InsuraceLogo.d.ts +1 -1
- package/cjs/icons/LiFiFullLogo.d.ts +1 -1
- package/cjs/icons/LiFiLogo.d.ts +1 -1
- package/cjs/icons/LiFiToolLogo.d.ts +1 -1
- package/cjs/index.d.ts +1 -1
- package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -2
- package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -2
- package/cjs/pages/SelectTokenPage/SelectTokenPage.js +3 -1
- package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -2
- package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +1 -2
- package/cjs/pages/SettingsPage/LanguageSelect.js +1 -1
- package/cjs/pages/SettingsPage/SettingsPage.d.ts +1 -2
- package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -2
- package/cjs/pages/SettingsPage/SlippageInput.d.ts +1 -2
- package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +6 -2
- package/cjs/pages/SwapPage/ExchangeRateBottomSheet.js +1 -1
- package/cjs/pages/SwapPage/StatusBottomSheet.js +15 -9
- package/cjs/pages/SwapPage/StatusBottomSheet.style.d.ts +1 -1
- package/cjs/pages/SwapPage/StatusBottomSheet.style.js +2 -2
- package/cjs/pages/SwapPage/SwapPage.js +31 -10
- package/cjs/pages/SwapPage/TokenValueBottomSheet.js +7 -12
- package/cjs/pages/SwapPage/utils.d.ts +2 -0
- package/cjs/pages/SwapPage/utils.js +10 -0
- package/cjs/providers/I18nProvider/I18nProvider.js +3 -3
- package/cjs/providers/SDKProvider/SDKProvider.js +2 -0
- package/cjs/providers/SwapFormProvider/FormUpdater.js +3 -0
- package/cjs/providers/WalletProvider/WalletProvider.js +77 -49
- package/cjs/providers/WalletProvider/types.d.ts +3 -5
- package/cjs/providers/WidgetProvider/WidgetProvider.js +1 -1
- package/cjs/stores/StoreProvider.d.ts +2 -2
- package/cjs/stores/StoreProvider.js +3 -2
- package/cjs/stores/routes/RouteExecutionStore.d.ts +1 -1
- 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/events.d.ts +9 -1
- package/cjs/types/events.js +1 -0
- package/cjs/types/token.d.ts +2 -2
- package/cjs/types/widget.d.ts +13 -8
- package/cjs/types/widget.js +4 -2
- package/cjs/utils/format.d.ts +1 -1
- package/cjs/utils/format.js +7 -12
- package/cjs/utils/wallet.d.ts +1 -1
- package/cjs/utils/wallet.js +3 -3
- package/components/ChainSelect/ChainSelect.d.ts +1 -2
- package/components/ChainSelect/ChainSelect.style.js +1 -1
- package/components/ChainSelect/useChainSelect.js +7 -1
- package/components/GasMessage/FundsSufficiencyMessage.d.ts +1 -2
- package/components/GasMessage/GasMessage.js +2 -7
- package/components/Header/Header.js +3 -3
- package/components/Header/Header.style.d.ts +10 -3
- package/components/Header/Header.style.js +3 -0
- package/components/Header/NavigationHeader.js +23 -7
- package/components/Header/NavigationTabs.d.ts +1 -0
- package/components/Header/NavigationTabs.js +22 -0
- package/components/Header/NavigationTabs.style.d.ts +34 -0
- package/components/Header/NavigationTabs.style.js +58 -0
- package/components/Header/WalletHeader.d.ts +1 -0
- package/components/Header/WalletHeader.js +14 -8
- package/components/Header/useHeaderActionStore.js +0 -1
- package/components/Insurance/Insurance.js +2 -2
- package/components/Insurance/InsuranceCard.js +37 -15
- package/components/Insurance/InsuranceCollapsed.js +9 -11
- package/components/Insurance/index.d.ts +1 -0
- package/components/Insurance/index.js +1 -0
- package/components/Insurance/types.d.ts +12 -9
- package/components/NFT/NFT.js +2 -2
- package/components/NFT/types.d.ts +1 -1
- package/components/PoweredBy/PoweredBy.js +2 -3
- package/components/SelectChainAndToken.js +9 -8
- package/components/SelectTokenButton/SelectTokenButton.js +7 -4
- package/components/SendToWallet/SendToWallet.js +2 -2
- package/components/SmallAvatar.d.ts +1 -1
- package/components/Step/CircularProgress.d.ts +1 -2
- package/components/Step/Step.js +16 -6
- package/components/Step/StepList.d.ts +1 -2
- package/components/StepActions/StepActions.js +4 -20
- package/components/SwapButton/SwapButton.js +16 -4
- package/components/SwapInput/FormPriceHelperText.js +2 -2
- package/components/SwapInput/SwapInput.js +3 -3
- package/components/SwapInput/SwapInputEndAdornment.d.ts +1 -2
- package/components/SwapInput/SwapInputEndAdornment.js +2 -2
- package/components/SwapRouteCard/SwapRouteCard.js +21 -5
- package/components/SwapRouteCard/SwapRouteCardEssentials.js +1 -1
- package/components/SwapRouteCard/SwapRouteCardSkeleton.js +1 -1
- package/components/SwapRoutes/SwapRoutes.js +1 -1
- package/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -3
- package/components/SwapRoutes/SwapRoutesExpanded.js +2 -2
- package/components/SwapRoutes/SwapRoutesExpanded.style.js +1 -0
- package/components/Token/Token.js +1 -1
- package/components/TokenAvatar/TokenAvatar.d.ts +4 -4
- package/components/TokenList/TokenList.js +10 -5
- package/components/TokenList/TokenList.style.d.ts +5 -2
- package/components/TokenList/TokenList.style.js +21 -2
- package/components/TokenList/TokenListItem.d.ts +1 -1
- package/components/TokenList/TokenListItem.js +32 -9
- package/components/TokenList/VirtualizedTokenList.js +3 -3
- package/components/TokenList/types.d.ts +6 -3
- package/config/theme.js +15 -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/useFeaturedTokens.d.ts +1 -1
- package/hooks/useFundsSufficiency.js +2 -2
- package/hooks/useGasRefuel.d.ts +1 -1
- package/hooks/useGasRefuel.js +5 -15
- package/hooks/useGasSufficiency.js +13 -4
- package/hooks/useInitializer.js +0 -1
- package/hooks/useProcessMessage.d.ts +2 -1
- package/hooks/useProcessMessage.js +27 -9
- package/hooks/useRouteExecution.js +6 -5
- package/hooks/useSwapOnly.d.ts +1 -0
- package/hooks/useSwapOnly.js +5 -0
- package/hooks/useSwapRoutes.d.ts +1 -2
- package/hooks/useSwapRoutes.js +32 -18
- package/hooks/useToken.d.ts +1 -1
- package/hooks/useTokenAddressBalance.d.ts +2 -2
- package/hooks/useTokenBalance.js +6 -7
- package/hooks/useTokenBalances.d.ts +5 -5
- package/hooks/useTokenBalances.js +4 -19
- package/hooks/useTokenSearch.d.ts +2 -2
- package/hooks/useTokens.d.ts +2 -2
- package/i18n/bn.json +8 -0
- package/i18n/en.json +30 -5
- package/i18n/fr.json +8 -0
- package/i18n/id.json +22 -7
- package/i18n/ko.json +22 -7
- package/i18n/pt.json +32 -7
- package/i18n/th.json +21 -6
- package/i18n/uk.json +43 -18
- package/i18n/zh.json +23 -8
- package/icons/InsuraceLogo.d.ts +1 -1
- package/icons/LiFiFullLogo.d.ts +1 -1
- package/icons/LiFiLogo.d.ts +1 -1
- package/icons/LiFiToolLogo.d.ts +1 -1
- package/index.d.ts +1 -1
- package/package.json +13 -13
- package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -2
- package/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -2
- package/pages/SelectTokenPage/SelectTokenPage.js +4 -2
- package/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -2
- package/pages/SettingsPage/GasPriceSelect.d.ts +1 -2
- package/pages/SettingsPage/LanguageSelect.js +1 -1
- package/pages/SettingsPage/SettingsPage.d.ts +1 -2
- package/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -2
- package/pages/SettingsPage/SlippageInput.d.ts +1 -2
- package/pages/SwapDetailsPage/SwapDetailsPage.js +6 -2
- package/pages/SwapPage/ExchangeRateBottomSheet.js +2 -2
- package/pages/SwapPage/StatusBottomSheet.js +18 -12
- package/pages/SwapPage/StatusBottomSheet.style.d.ts +1 -1
- package/pages/SwapPage/StatusBottomSheet.style.js +1 -1
- package/pages/SwapPage/SwapPage.js +33 -12
- package/pages/SwapPage/TokenValueBottomSheet.js +8 -13
- package/pages/SwapPage/utils.d.ts +2 -0
- package/pages/SwapPage/utils.js +6 -0
- package/providers/I18nProvider/I18nProvider.js +3 -3
- package/providers/SDKProvider/SDKProvider.js +2 -0
- package/providers/SwapFormProvider/FormUpdater.js +3 -0
- package/providers/WalletProvider/WalletProvider.js +78 -50
- package/providers/WalletProvider/types.d.ts +3 -5
- package/providers/WidgetProvider/WidgetProvider.js +2 -2
- package/stores/StoreProvider.d.ts +2 -2
- package/stores/StoreProvider.js +3 -2
- package/stores/routes/RouteExecutionStore.d.ts +1 -1
- 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/events.d.ts +9 -1
- package/types/events.js +1 -0
- package/types/token.d.ts +2 -2
- package/types/widget.d.ts +13 -8
- package/types/widget.js +4 -2
- package/utils/format.d.ts +1 -1
- package/utils/format.js +5 -10
- package/utils/wallet.d.ts +1 -1
- package/utils/wallet.js +1 -1
package/App.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export declare const
|
|
2
|
+
import type { WidgetDrawer } from './AppDrawer';
|
|
3
|
+
import type { WidgetConfig } from './types';
|
|
4
|
+
export declare const App: import("react").ForwardRefExoticComponent<import("./types").WidgetDrawerProps & WidgetConfig & import("./types").WidgetConfigPartialProps & import("react").RefAttributes<WidgetDrawer>>;
|
|
5
|
+
export declare const AppDefault: () => import("react/jsx-runtime").JSX.Element;
|
package/AppDrawer.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export interface WidgetDrawer {
|
|
|
9
9
|
export declare const AppDrawer: import("react").ForwardRefExoticComponent<import("./types").WidgetDrawerProps & WidgetConfig & import("./types").WidgetConfigPartialProps & import("react").RefAttributes<WidgetDrawer>>;
|
|
10
10
|
export declare const DrawerButtonText: ({ open }: {
|
|
11
11
|
open: boolean;
|
|
12
|
-
}) => JSX.Element;
|
|
12
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
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/README.md
CHANGED
|
@@ -54,21 +54,20 @@ yarn add @lifi/wallet-management
|
|
|
54
54
|
|
|
55
55
|
Here is an example of a basic app using LI.FI Widget:
|
|
56
56
|
|
|
57
|
-
```
|
|
57
|
+
```tsx
|
|
58
58
|
import { LiFiWidget, WidgetConfig } from '@lifi/widget';
|
|
59
|
-
|
|
59
|
+
|
|
60
|
+
const widgetConfig: WidgetConfig = {
|
|
61
|
+
containerStyle: {
|
|
62
|
+
border: '1px solid rgb(234, 234, 234)',
|
|
63
|
+
borderRadius: '16px',
|
|
64
|
+
},
|
|
65
|
+
};
|
|
60
66
|
|
|
61
67
|
export const WidgetPage = () => {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
border: '1px solid rgb(234, 234, 234)',
|
|
66
|
-
borderRadius: '16px',
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
}, []);
|
|
70
|
-
|
|
71
|
-
return <LiFiWidget config={widgetConfig} />;
|
|
68
|
+
return (
|
|
69
|
+
<LiFiWidget integrator="Your dApp/company name" config={widgetConfig} />
|
|
70
|
+
);
|
|
72
71
|
};
|
|
73
72
|
```
|
|
74
73
|
|
package/cjs/App.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
export declare const
|
|
2
|
+
import type { WidgetDrawer } from './AppDrawer';
|
|
3
|
+
import type { WidgetConfig } from './types';
|
|
4
|
+
export declare const App: import("react").ForwardRefExoticComponent<import("./types").WidgetDrawerProps & WidgetConfig & import("./types").WidgetConfigPartialProps & import("react").RefAttributes<WidgetDrawer>>;
|
|
5
|
+
export declare const AppDefault: () => import("react/jsx-runtime").JSX.Element;
|
package/cjs/AppDrawer.d.ts
CHANGED
|
@@ -9,4 +9,4 @@ export interface WidgetDrawer {
|
|
|
9
9
|
export declare const AppDrawer: import("react").ForwardRefExoticComponent<import("./types").WidgetDrawerProps & WidgetConfig & import("./types").WidgetConfigPartialProps & import("react").RefAttributes<WidgetDrawer>>;
|
|
10
10
|
export declare const DrawerButtonText: ({ open }: {
|
|
11
11
|
open: boolean;
|
|
12
|
-
}) => JSX.Element;
|
|
12
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
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 }) => {
|
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { SwapFormTypeProps } from '../../providers';
|
|
3
|
-
export declare const ChainSelect: ({ formType }: SwapFormTypeProps) => JSX.Element;
|
|
2
|
+
export declare const ChainSelect: ({ formType }: SwapFormTypeProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -12,7 +12,7 @@ exports.ChainCard = (0, styles_1.styled)(Card_1.Card)({
|
|
|
12
12
|
});
|
|
13
13
|
exports.ChainContainer = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
|
|
14
14
|
display: 'grid',
|
|
15
|
-
gridTemplateColumns: 'repeat(
|
|
15
|
+
gridTemplateColumns: 'repeat(auto-fit, minmax(52px, 1fr))',
|
|
16
16
|
gridAutoRows: '56px',
|
|
17
17
|
justifyContent: 'space-between',
|
|
18
18
|
gap: theme.spacing(1.5),
|
|
@@ -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, '');
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const FundsSufficiencyMessage: () => JSX.Element;
|
|
1
|
+
export declare const FundsSufficiencyMessage: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -4,16 +4,11 @@ exports.GasMessage = void 0;
|
|
|
4
4
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
5
|
const material_1 = require("@mui/material");
|
|
6
6
|
const hooks_1 = require("../../hooks");
|
|
7
|
-
const stores_1 = require("../../stores");
|
|
8
7
|
const FundsSufficiencyMessage_1 = require("./FundsSufficiencyMessage");
|
|
9
8
|
const GasSufficiencyMessage_1 = require("./GasSufficiencyMessage");
|
|
10
9
|
const GasMessage = ({ route, ...props }) => {
|
|
11
10
|
const { insufficientGas } = (0, hooks_1.useGasSufficiency)(route);
|
|
12
11
|
const { insufficientFunds } = (0, hooks_1.useFundsSufficiency)(route);
|
|
13
|
-
|
|
14
|
-
const { enabled, isLoading: isRefuelLoading } = (0, hooks_1.useGasRefuel)();
|
|
15
|
-
const enabledRefuel = enabled && enabledAutoRefuel;
|
|
16
|
-
const showGasSufficiencyMessage = insufficientGas?.length && !isRefuelLoading && !enabledRefuel;
|
|
17
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: 225, in: Boolean(insufficientFunds || showGasSufficiencyMessage), unmountOnExit: true, mountOnEnter: true, children: (0, jsx_runtime_1.jsx)(material_1.Box, { ...props, children: insufficientFunds ? ((0, jsx_runtime_1.jsx)(FundsSufficiencyMessage_1.FundsSufficiencyMessage, {})) : showGasSufficiencyMessage ? ((0, jsx_runtime_1.jsx)(GasSufficiencyMessage_1.GasSufficiencyMessage, { insufficientGas: insufficientGas })) : null }) }));
|
|
12
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Collapse, { timeout: 225, in: Boolean(insufficientFunds || insufficientGas?.length), unmountOnExit: true, mountOnEnter: true, children: (0, jsx_runtime_1.jsx)(material_1.Box, { ...props, children: insufficientFunds ? ((0, jsx_runtime_1.jsx)(FundsSufficiencyMessage_1.FundsSufficiencyMessage, {})) : insufficientGas?.length ? ((0, jsx_runtime_1.jsx)(GasSufficiencyMessage_1.GasSufficiencyMessage, { insufficientGas: insufficientGas })) : null }) }));
|
|
18
13
|
};
|
|
19
14
|
exports.GasMessage = GasMessage;
|
|
@@ -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;
|
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export declare const HeaderAppBar: import("@emotion/styled").StyledComponent<
|
|
2
|
+
export declare const HeaderAppBar: import("@emotion/styled").StyledComponent<{
|
|
3
3
|
classes?: Partial<import("@mui/material").AppBarClasses> | undefined;
|
|
4
4
|
color?: import("@mui/types").OverridableStringUnion<"transparent" | import("@mui/material").PropTypes.Color, import("@mui/material").AppBarPropsColorOverrides> | undefined;
|
|
5
5
|
enableColorOnDark?: boolean | undefined;
|
|
6
6
|
position?: "fixed" | "absolute" | "relative" | "static" | "sticky" | undefined;
|
|
7
7
|
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
8
|
-
} &
|
|
8
|
+
} & Omit<{
|
|
9
|
+
children?: import("react").ReactNode;
|
|
10
|
+
classes?: Partial<import("@mui/material").PaperClasses> | undefined;
|
|
11
|
+
elevation?: number | undefined;
|
|
12
|
+
square?: boolean | undefined;
|
|
13
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
14
|
+
variant?: import("@mui/types").OverridableStringUnion<"outlined" | "elevation", import("@mui/material").PaperPropsVariantOverrides> | undefined;
|
|
15
|
+
}, "classes" | "color" | "position"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLElement>, HTMLElement>, "ref"> & {
|
|
9
16
|
ref?: ((instance: HTMLElement | null) => void) | import("react").RefObject<HTMLElement> | null | undefined;
|
|
10
|
-
}, keyof import("@mui/material/OverridableComponent").CommonProps | "
|
|
17
|
+
}, keyof import("@mui/material/OverridableComponent").CommonProps | "color" | "children" | "sx" | "position" | "variant" | "square" | "elevation" | "enableColorOnDark"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
|
|
11
18
|
export declare const Container: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
|
|
12
19
|
children?: import("react").ReactNode;
|
|
13
20
|
component?: import("react").ElementType<any> | undefined;
|
|
@@ -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
|
}));
|
|
@@ -10,12 +10,15 @@ const react_i18next_1 = require("react-i18next");
|
|
|
10
10
|
const react_router_dom_1 = require("react-router-dom");
|
|
11
11
|
const hooks_1 = require("../../hooks");
|
|
12
12
|
const providers_1 = require("../../providers");
|
|
13
|
+
const types_1 = require("../../types");
|
|
13
14
|
const utils_1 = require("../../utils");
|
|
14
15
|
const Header_style_1 = require("./Header.style");
|
|
16
|
+
const NavigationTabs_1 = require("./NavigationTabs");
|
|
17
|
+
const WalletHeader_1 = require("./WalletHeader");
|
|
15
18
|
const useHeaderActionStore_1 = require("./useHeaderActionStore");
|
|
16
19
|
const NavigationHeader = () => {
|
|
17
20
|
const { t } = (0, react_i18next_1.useTranslation)();
|
|
18
|
-
const { variant } = (0, providers_1.useWidgetConfig)();
|
|
21
|
+
const { variant, subvariant, hiddenUI } = (0, providers_1.useWidgetConfig)();
|
|
19
22
|
const { navigate, navigateBack } = (0, hooks_1.useNavigateBack)();
|
|
20
23
|
const { account } = (0, providers_1.useWallet)();
|
|
21
24
|
const { element } = (0, useHeaderActionStore_1.useHeaderActionStore)();
|
|
@@ -25,6 +28,7 @@ const NavigationHeader = () => {
|
|
|
25
28
|
: pathname;
|
|
26
29
|
const path = cleanedPathname.substring(cleanedPathname.lastIndexOf('/') + 1);
|
|
27
30
|
const hasPath = utils_1.navigationRoutesValues.includes(path);
|
|
31
|
+
const splitSubvariant = subvariant === 'split' && !hasPath;
|
|
28
32
|
const handleHeaderTitle = () => {
|
|
29
33
|
switch (path) {
|
|
30
34
|
case utils_1.navigationRoutes.selectWallet:
|
|
@@ -37,8 +41,12 @@ const NavigationHeader = () => {
|
|
|
37
41
|
return t(`settings.enabledExchanges`);
|
|
38
42
|
case utils_1.navigationRoutes.swapHistory:
|
|
39
43
|
return t(`header.swapHistory`);
|
|
40
|
-
case utils_1.navigationRoutes.fromToken:
|
|
44
|
+
case utils_1.navigationRoutes.fromToken: {
|
|
45
|
+
if (variant === 'nft') {
|
|
46
|
+
return t(`header.payWith`);
|
|
47
|
+
}
|
|
41
48
|
return t(`header.from`);
|
|
49
|
+
}
|
|
42
50
|
case utils_1.navigationRoutes.toToken:
|
|
43
51
|
return t(`header.to`);
|
|
44
52
|
case utils_1.navigationRoutes.fromChain:
|
|
@@ -49,10 +57,18 @@ const NavigationHeader = () => {
|
|
|
49
57
|
return t(`header.routes`);
|
|
50
58
|
case utils_1.navigationRoutes.activeSwaps:
|
|
51
59
|
return t(`header.activeSwaps`);
|
|
52
|
-
case utils_1.navigationRoutes.swapExecution:
|
|
60
|
+
case utils_1.navigationRoutes.swapExecution: {
|
|
61
|
+
if (variant === 'nft') {
|
|
62
|
+
return t(`header.purchase`);
|
|
63
|
+
}
|
|
53
64
|
return t(`header.swap`);
|
|
54
|
-
|
|
65
|
+
}
|
|
66
|
+
case utils_1.navigationRoutes.swapDetails: {
|
|
67
|
+
if (variant === 'nft') {
|
|
68
|
+
return t(`header.purchaseDetails`);
|
|
69
|
+
}
|
|
55
70
|
return t(`header.swapDetails`);
|
|
71
|
+
}
|
|
56
72
|
default: {
|
|
57
73
|
switch (variant) {
|
|
58
74
|
case 'nft':
|
|
@@ -65,8 +81,8 @@ const NavigationHeader = () => {
|
|
|
65
81
|
}
|
|
66
82
|
}
|
|
67
83
|
};
|
|
68
|
-
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 ? ((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: {
|
|
69
|
-
|
|
70
|
-
|
|
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] }));
|
|
71
87
|
};
|
|
72
88
|
exports.NavigationHeader = NavigationHeader;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const NavigationTabs: () => import("react/jsx-runtime").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,34 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import type { StyledComponent } from '@emotion/styled';
|
|
3
|
+
import type { TabsProps } from '@mui/material';
|
|
4
|
+
export declare const NavbarTabs: StyledComponent<TabsProps>;
|
|
5
|
+
export declare const NavbarTab: StyledComponent<{
|
|
6
|
+
children?: null | undefined;
|
|
7
|
+
classes?: Partial<import("@mui/material").TabClasses> | undefined;
|
|
8
|
+
disabled?: boolean | undefined;
|
|
9
|
+
disableFocusRipple?: boolean | undefined;
|
|
10
|
+
icon?: string | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | undefined;
|
|
11
|
+
iconPosition?: "bottom" | "top" | "end" | "start" | undefined;
|
|
12
|
+
label?: import("react").ReactNode;
|
|
13
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
14
|
+
value?: any;
|
|
15
|
+
wrapped?: boolean | undefined;
|
|
16
|
+
} & Omit<{
|
|
17
|
+
action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
|
|
18
|
+
centerRipple?: boolean | undefined;
|
|
19
|
+
children?: import("react").ReactNode;
|
|
20
|
+
classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
|
|
21
|
+
disabled?: boolean | undefined;
|
|
22
|
+
disableRipple?: boolean | undefined;
|
|
23
|
+
disableTouchRipple?: boolean | undefined;
|
|
24
|
+
focusRipple?: boolean | undefined;
|
|
25
|
+
focusVisibleClassName?: string | undefined;
|
|
26
|
+
LinkComponent?: import("react").ElementType<any> | undefined;
|
|
27
|
+
onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
|
|
28
|
+
sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
|
|
29
|
+
tabIndex?: number | undefined;
|
|
30
|
+
TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
|
|
31
|
+
touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
|
|
32
|
+
}, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & {
|
|
33
|
+
ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
|
|
34
|
+
}, 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: Math.max(theme.shape.borderRadius, theme.shape.borderRadiusSecondary),
|
|
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,31 +17,37 @@ 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
|
-
const walletAddress = (0, utils_1.
|
|
50
|
+
const walletAddress = (0, utils_1.shortenAddress)(account.address);
|
|
45
51
|
const { chain } = (0, hooks_1.useChain)(account.chainId);
|
|
46
52
|
const [anchorEl, setAnchorEl] = (0, react_1.useState)(null);
|
|
47
53
|
const handleClick = (event) => {
|
|
@@ -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) => {
|
|
@@ -5,7 +5,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
5
5
|
const stores_1 = require("../../stores");
|
|
6
6
|
const InsuranceCard_1 = require("./InsuranceCard");
|
|
7
7
|
const InsuranceCollapsed_1 = require("./InsuranceCollapsed");
|
|
8
|
-
const Insurance = ({ status, insurableRouteId,
|
|
9
|
-
return status === stores_1.RouteExecutionStatus.Idle ? ((0, jsx_runtime_1.jsx)(InsuranceCollapsed_1.InsuranceCollapsed, {
|
|
8
|
+
const Insurance = ({ status, insurableRouteId, onChange, ...props }) => {
|
|
9
|
+
return status === stores_1.RouteExecutionStatus.Idle ? ((0, jsx_runtime_1.jsx)(InsuranceCollapsed_1.InsuranceCollapsed, { status: status, insurableRouteId: insurableRouteId, onChange: onChange, ...props })) : ((0, jsx_runtime_1.jsx)(InsuranceCard_1.InsuranceCard, { status: status, ...props }));
|
|
10
10
|
};
|
|
11
11
|
exports.Insurance = Insurance;
|