@lifi/widget 1.10.4 → 1.11.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (190) hide show
  1. package/App.js +58 -10
  2. package/AppDrawer.js +1 -1
  3. package/AppDrawer.style.d.ts +1 -1
  4. package/AppDrawer.style.js +0 -1
  5. package/AppProvider.d.ts +1 -0
  6. package/AppProvider.js +5 -2
  7. package/components/AppContainer.d.ts +10 -0
  8. package/components/AppContainer.js +3 -6
  9. package/components/Card/Card.d.ts +11 -5
  10. package/components/Card/Card.js +29 -5
  11. package/components/Card/index.d.ts +0 -1
  12. package/components/Card/index.js +0 -1
  13. package/components/Dialog.d.ts +3 -0
  14. package/components/Dialog.js +23 -0
  15. package/components/GasSufficiencyMessage/GasSufficiencyMessage.d.ts +6 -0
  16. package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +41 -0
  17. package/components/{InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.style.d.ts → GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts} +0 -0
  18. package/components/{InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.style.js → GasSufficiencyMessage/GasSufficiencyMessage.style.js} +1 -0
  19. package/components/GasSufficiencyMessage/index.d.ts +1 -0
  20. package/components/GasSufficiencyMessage/index.js +1 -0
  21. package/components/Header/Header.js +1 -1
  22. package/components/Header/Header.style.js +2 -1
  23. package/components/Header/NavigationHeader.js +16 -10
  24. package/components/Header/WalletHeader.js +1 -1
  25. package/components/Header/index.d.ts +1 -0
  26. package/components/Header/index.js +1 -0
  27. package/components/Header/types.d.ts +8 -0
  28. package/components/Header/types.js +1 -0
  29. package/components/Header/useHeaderActionStore.d.ts +6 -0
  30. package/components/Header/useHeaderActionStore.js +19 -0
  31. package/components/PoweredBy/PoweredBy.js +0 -1
  32. package/components/ProgressToNextUpdate/ProgressToNextUpdate.js +14 -2
  33. package/components/ReverseTokensButton/ReverseTokensButton.js +5 -7
  34. package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
  35. package/components/ReverseTokensButton/ReverseTokensButton.style.js +4 -2
  36. package/components/SelectTokenButton/SelectTokenButton.js +5 -5
  37. package/components/SelectTokenButton/SelectTokenButton.style.d.ts +3 -10
  38. package/components/SelectTokenButton/SelectTokenButton.style.js +0 -7
  39. package/components/SmallAvatar.d.ts +16 -0
  40. package/components/SmallAvatar.js +8 -0
  41. package/{pages/SwapPage → components/Step}/CircularProgress.d.ts +0 -0
  42. package/{pages/SwapPage → components/Step}/CircularProgress.js +0 -0
  43. package/{pages/SwapPage → components/Step}/CircularProgress.style.d.ts +0 -0
  44. package/{pages/SwapPage → components/Step}/CircularProgress.style.js +0 -0
  45. package/components/Step/Step.d.ts +7 -0
  46. package/{pages/SwapPage/StepItem.js → components/Step/Step.js} +6 -6
  47. package/{pages/SwapPage/ExecutionItem.d.ts → components/Step/StepProcess.d.ts} +1 -1
  48. package/{pages/SwapPage/ExecutionItem.js → components/Step/StepProcess.js} +2 -2
  49. package/{pages/SwapPage/ExecutionItem.style.d.ts → components/Step/StepProcess.style.d.ts} +1 -1
  50. package/{pages/SwapPage/ExecutionItem.style.js → components/Step/StepProcess.style.js} +0 -0
  51. package/{pages/SwapPage → components/Step}/StepTimer.d.ts +0 -0
  52. package/{pages/SwapPage → components/Step}/StepTimer.js +0 -0
  53. package/components/Step/index.d.ts +1 -0
  54. package/components/Step/index.js +1 -0
  55. package/components/Step/utils.d.ts +6 -0
  56. package/components/Step/utils.js +89 -0
  57. package/components/StepActions/StepActions.js +14 -5
  58. package/components/StepActions/StepActions.style.js +2 -2
  59. package/{pages/SwapPage → components/StepDivider}/StepDivider.d.ts +0 -0
  60. package/{pages/SwapPage → components/StepDivider}/StepDivider.js +0 -0
  61. package/{pages/SwapPage → components/StepDivider}/StepDivider.style.d.ts +0 -0
  62. package/{pages/SwapPage → components/StepDivider}/StepDivider.style.js +0 -0
  63. package/components/StepDivider/index.d.ts +1 -0
  64. package/components/StepDivider/index.js +1 -0
  65. package/components/SwapButton/SwapButton.js +7 -10
  66. package/components/SwapButton/SwapButton.style.d.ts +1 -1
  67. package/components/SwapButton/SwapButton.style.js +0 -4
  68. package/components/SwapButton/types.d.ts +2 -0
  69. package/components/SwapInProgress/SwapInProgress.js +8 -5
  70. package/components/SwapInProgress/SwapInProgress.style.d.ts +9 -21
  71. package/components/SwapInProgress/SwapInProgress.style.js +5 -6
  72. package/components/SwapInput/SwapInput.js +3 -3
  73. package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
  74. package/components/SwapInput/SwapInputAdornment.style.js +0 -2
  75. package/components/SwapRouteCard/SwapRouteCard.js +15 -15
  76. package/components/SwapRouteCard/SwapRouteCard.style.d.ts +0 -20
  77. package/components/SwapRouteCard/SwapRouteCard.style.js +7 -54
  78. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +6 -10
  79. package/components/SwapRouteCard/SwapRouteNotFoundCard.js +3 -3
  80. package/components/SwapRouteCard/types.d.ts +0 -3
  81. package/components/{StepToken.d.ts → Token/Token.d.ts} +2 -1
  82. package/components/Token/Token.js +31 -0
  83. package/components/Token/Token.style.d.ts +24 -0
  84. package/components/Token/Token.style.js +31 -0
  85. package/components/Token/index.d.ts +2 -0
  86. package/components/Token/index.js +2 -0
  87. package/components/TokenAvatar/TokenAvatar.d.ts +7 -0
  88. package/components/TokenAvatar/TokenAvatar.js +8 -0
  89. package/components/TokenAvatar/TokenAvatar.style.d.ts +1 -0
  90. package/components/TokenAvatar/TokenAvatar.style.js +16 -0
  91. package/components/TokenAvatar/index.d.ts +2 -0
  92. package/components/TokenAvatar/index.js +2 -0
  93. package/components/TokenList/TokenList.js +2 -2
  94. package/components/TokenList/TokenListItem.d.ts +1 -0
  95. package/components/TokenList/TokenListItem.js +12 -6
  96. package/components/TokenList/types.d.ts +1 -0
  97. package/config/queryClient.d.ts +1 -1
  98. package/config/queryClient.js +1 -1
  99. package/config/theme.js +30 -3
  100. package/config/version.d.ts +1 -1
  101. package/config/version.js +1 -1
  102. package/hooks/index.d.ts +1 -1
  103. package/hooks/index.js +1 -1
  104. package/hooks/useChains.d.ts +8 -8
  105. package/hooks/useChains.js +1 -1
  106. package/hooks/useGasSufficiency.d.ts +15 -0
  107. package/hooks/useGasSufficiency.js +91 -0
  108. package/hooks/useRouteExecution.d.ts +3 -3
  109. package/hooks/useRouteExecution.js +22 -18
  110. package/hooks/useSwapRoutes.d.ts +1 -1
  111. package/hooks/useSwapRoutes.js +2 -14
  112. package/hooks/useTokenBalance.js +1 -1
  113. package/hooks/useTokenBalances.d.ts +2 -2
  114. package/hooks/useTokenBalances.js +7 -9
  115. package/hooks/useTokens.js +1 -1
  116. package/hooks/useTools.d.ts +10 -1
  117. package/hooks/useTools.js +13 -3
  118. package/i18n/en/translation.json +18 -9
  119. package/i18n/index.d.ts +12 -3
  120. package/icons/LiFiToolLogo.svg +6 -0
  121. package/package.json +8 -8
  122. package/pages/MainPage/MainPage.js +2 -3
  123. package/pages/MainPage/MainSwapButton.js +5 -6
  124. package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.d.ts +0 -0
  125. package/pages/MainPage/SwapRoutes.js +36 -0
  126. package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.style.d.ts +0 -0
  127. package/{components/SwapRoutes → pages/MainPage}/SwapRoutes.style.js +4 -0
  128. package/pages/SelectTokenPage/ChainSelect.js +2 -2
  129. package/pages/SelectTokenPage/SearchTokenInput.js +2 -2
  130. package/pages/SelectWalletPage/SelectWalletPage.js +4 -23
  131. package/pages/SettingsPage/AdvancedPreferences.js +1 -1
  132. package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  133. package/pages/SettingsPage/EnabledBridgesSelect.js +7 -4
  134. package/pages/SettingsPage/EnabledExchangesSelect.js +7 -4
  135. package/pages/SettingsPage/GasPriceSelect.js +2 -2
  136. package/pages/SettingsPage/RoutePrioritySelect.js +2 -2
  137. package/pages/SettingsPage/SlippageInput.js +2 -2
  138. package/pages/SwapDetailsPage/SwapDetailsPage.d.ts +2 -0
  139. package/pages/SwapDetailsPage/SwapDetailsPage.js +62 -0
  140. package/pages/SwapDetailsPage/SwapDetailsPage.style.d.ts +11 -0
  141. package/pages/SwapDetailsPage/SwapDetailsPage.style.js +5 -0
  142. package/pages/SwapDetailsPage/index.d.ts +1 -0
  143. package/pages/SwapDetailsPage/index.js +1 -0
  144. package/pages/SwapHistoryPage/SwapHistoryEmpty.d.ts +2 -0
  145. package/pages/SwapHistoryPage/SwapHistoryEmpty.js +14 -0
  146. package/pages/SwapHistoryPage/SwapHistoryItem.d.ts +5 -0
  147. package/pages/SwapHistoryPage/SwapHistoryItem.js +23 -0
  148. package/pages/SwapHistoryPage/SwapHistoryPage.d.ts +2 -0
  149. package/pages/SwapHistoryPage/SwapHistoryPage.js +14 -0
  150. package/pages/SwapHistoryPage/index.d.ts +1 -0
  151. package/pages/SwapHistoryPage/index.js +1 -0
  152. package/pages/SwapPage/StatusBottomSheet.js +3 -4
  153. package/pages/SwapPage/SwapPage.js +9 -9
  154. package/pages/SwapPage/SwapPage.style.d.ts +0 -33
  155. package/pages/SwapPage/SwapPage.style.js +2 -9
  156. package/pages/SwapRoutesPage/SwapRoutesPage.js +13 -8
  157. package/pages/SwapRoutesPage/SwapRoutesPage.style.js +1 -1
  158. package/providers/WalletProvider/WalletProvider.js +7 -26
  159. package/providers/WalletProvider/types.d.ts +0 -1
  160. package/providers/WidgetProvider/WidgetProvider.js +1 -1
  161. package/stores/route/index.d.ts +1 -1
  162. package/stores/route/index.js +1 -1
  163. package/stores/route/types.d.ts +2 -4
  164. package/stores/route/useExecutingRoutes.d.ts +2 -1
  165. package/stores/route/useExecutingRoutes.js +4 -2
  166. package/stores/route/useRouteStore.d.ts +4 -1
  167. package/stores/route/useRouteStore.js +23 -24
  168. package/stores/route/useSwapHistory.d.ts +2 -0
  169. package/stores/route/useSwapHistory.js +11 -0
  170. package/stores/settings/useSettingsStore.d.ts +13 -0
  171. package/types/widget.d.ts +3 -4
  172. package/utils/navigationRoutes.d.ts +3 -1
  173. package/utils/navigationRoutes.js +3 -1
  174. package/components/Card/CardContainer.d.ts +0 -11
  175. package/components/Card/CardContainer.js +0 -16
  176. package/components/InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.d.ts +0 -3
  177. package/components/InsufficientGasOrFundsMessage/InsufficientGasOrFundsMessage.js +0 -31
  178. package/components/InsufficientGasOrFundsMessage/index.d.ts +0 -1
  179. package/components/InsufficientGasOrFundsMessage/index.js +0 -1
  180. package/components/StepToken.js +0 -21
  181. package/components/SwapRoutes/SwapRoutes.js +0 -32
  182. package/components/SwapRoutes/SwapRoutesUpdateProgress.d.ts +0 -3
  183. package/components/SwapRoutes/SwapRoutesUpdateProgress.js +0 -24
  184. package/components/SwapRoutes/index.d.ts +0 -1
  185. package/components/SwapRoutes/index.js +0 -1
  186. package/hooks/useHasSufficientBalance.d.ts +0 -5
  187. package/hooks/useHasSufficientBalance.js +0 -72
  188. package/pages/SwapPage/StepItem.d.ts +0 -7
  189. package/stores/route/useCurrentRoute.d.ts +0 -2
  190. package/stores/route/useCurrentRoute.js +0 -5
package/App.js CHANGED
@@ -1,27 +1,75 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { useEffect } from 'react';
3
- import { Route, Routes } from 'react-router-dom';
2
+ import { useRoutes } from 'react-router-dom';
4
3
  import { AppProvider } from './AppProvider';
5
- import { AppContainer } from './components/AppContainer';
4
+ import { AppContainer, FlexContainer } from './components/AppContainer';
6
5
  import { Header } from './components/Header';
7
6
  import { Initializer } from './components/Initializer';
8
7
  import { NotFound } from './components/NotFound';
8
+ import { PoweredBy } from './components/PoweredBy';
9
9
  import { MainPage } from './pages/MainPage';
10
10
  import { SelectTokenPage } from './pages/SelectTokenPage';
11
11
  import { SelectWalletPage } from './pages/SelectWalletPage';
12
12
  import { SettingsPage } from './pages/SettingsPage';
13
+ import { SwapDetailsPage } from './pages/SwapDetailsPage';
14
+ import { SwapHistoryPage } from './pages/SwapHistoryPage';
13
15
  import { SwapPage } from './pages/SwapPage';
14
16
  import { SwapRoutesPage } from './pages/SwapRoutesPage';
15
- import { useWallet } from './providers/WalletProvider';
16
17
  import { navigationRoutes } from './utils';
17
18
  export const App = ({ config }) => {
18
19
  return (_jsx(AppProvider, Object.assign({ config: config }, { children: _jsx(AppDefault, {}) })));
19
20
  };
20
21
  export const AppDefault = () => {
21
- const { attemptEagerConnect } = useWallet();
22
- useEffect(() => {
23
- attemptEagerConnect();
24
- // eslint-disable-next-line react-hooks/exhaustive-deps
25
- }, []);
26
- return (_jsxs(AppContainer, { children: [_jsx(Header, {}), _jsxs(Routes, { children: [_jsx(Route, { path: navigationRoutes.home, element: _jsx(MainPage, {}) }), _jsx(Route, { path: navigationRoutes.selectWallet, element: _jsx(SelectWalletPage, {}) }), _jsx(Route, { path: `${navigationRoutes.swapRoutes}/${navigationRoutes.swap}/${navigationRoutes.selectWallet}`, element: _jsx(SelectWalletPage, {}) }), _jsx(Route, { path: navigationRoutes.settings, element: _jsx(SettingsPage, {}) }), _jsx(Route, { path: navigationRoutes.fromToken, element: _jsx(SelectTokenPage, { formType: "from" }) }), _jsx(Route, { path: navigationRoutes.toToken, element: _jsx(SelectTokenPage, { formType: "to" }) }), _jsx(Route, { path: navigationRoutes.swapRoutes, element: _jsx(SwapRoutesPage, {}) }), _jsx(Route, { path: `${navigationRoutes.swapRoutes}/${navigationRoutes.swap}`, element: _jsx(SwapPage, {}) }), _jsx(Route, { path: navigationRoutes.swap, element: _jsx(SwapPage, {}) }), _jsx(Route, { path: "*", element: _jsx(NotFound, {}) })] }), _jsx(Initializer, {})] }));
22
+ return (_jsxs(AppContainer, { children: [_jsx(Header, {}), _jsx(FlexContainer, Object.assign({ disableGutters: true }, { children: _jsx(AppRoutes, {}) })), _jsx(PoweredBy, {}), _jsx(Initializer, {})] }));
23
+ };
24
+ const AppRoutes = () => {
25
+ const element = useRoutes([
26
+ {
27
+ path: '/',
28
+ element: _jsx(MainPage, {}),
29
+ },
30
+ {
31
+ path: navigationRoutes.settings,
32
+ element: _jsx(SettingsPage, {}),
33
+ },
34
+ {
35
+ path: navigationRoutes.fromToken,
36
+ element: _jsx(SelectTokenPage, { formType: "from" }),
37
+ },
38
+ {
39
+ path: navigationRoutes.toToken,
40
+ element: _jsx(SelectTokenPage, { formType: "to" }),
41
+ },
42
+ {
43
+ path: navigationRoutes.swapRoutes,
44
+ element: _jsx(SwapRoutesPage, {}),
45
+ },
46
+ {
47
+ path: navigationRoutes.swapHistory,
48
+ element: _jsx(SwapHistoryPage, {}),
49
+ },
50
+ {
51
+ path: `${navigationRoutes.swapHistory}/${navigationRoutes.swapDetails}`,
52
+ element: _jsx(SwapDetailsPage, {}),
53
+ },
54
+ ...[
55
+ navigationRoutes.selectWallet,
56
+ `${navigationRoutes.swapExecution}/${navigationRoutes.selectWallet}`,
57
+ `${navigationRoutes.swapRoutes}/${navigationRoutes.swapExecution}/${navigationRoutes.selectWallet}`,
58
+ ].map((path) => ({
59
+ path,
60
+ element: _jsx(SelectWalletPage, {}),
61
+ })),
62
+ ...[
63
+ navigationRoutes.swapExecution,
64
+ `${navigationRoutes.swapRoutes}/${navigationRoutes.swapExecution}`,
65
+ ].map((path) => ({
66
+ path,
67
+ element: _jsx(SwapPage, {}),
68
+ })),
69
+ {
70
+ path: '*',
71
+ element: _jsx(NotFound, {}),
72
+ },
73
+ ]);
74
+ return element;
27
75
  };
package/AppDrawer.js CHANGED
@@ -26,7 +26,7 @@ export const AppDrawer = forwardRef(({ elementRef, open, config }, ref) => {
26
26
  openDrawer,
27
27
  closeDrawer,
28
28
  }), [closeDrawer, openDrawer, toggleDrawer]);
29
- return (_jsxs(AppProvider, Object.assign({ config: config }, { children: [_jsxs(DrawerButton, Object.assign({ variant: "contained", onClick: toggleDrawer, open: drawerOpen, drawerProps: config === null || config === void 0 ? void 0 : config.containerStyle, disableElevation: true }, { children: [drawerOpen ? _jsx(KeyboardArrowRightIcon, {}) : _jsx(KeyboardArrowLeftIcon, {}), _jsx(DrawerButtonTypography, { children: drawerOpen ? t('button.hide') : t('button.lifiSwap') })] })), _jsx(Drawer, Object.assign({ ref: elementRef, anchor: "right", open: drawerOpen, onClose: closeDrawer, BackdropProps: {
29
+ return (_jsxs(AppProvider, Object.assign({ config: config }, { children: [_jsxs(DrawerButton, Object.assign({ variant: "contained", onClick: toggleDrawer, open: drawerOpen, drawerProps: config === null || config === void 0 ? void 0 : config.containerStyle }, { children: [drawerOpen ? _jsx(KeyboardArrowRightIcon, {}) : _jsx(KeyboardArrowLeftIcon, {}), _jsx(DrawerButtonTypography, { children: drawerOpen ? t('button.hide') : t('button.lifiSwap') })] })), _jsx(Drawer, Object.assign({ ref: elementRef, anchor: "right", open: drawerOpen, onClose: closeDrawer, BackdropProps: {
30
30
  sx: {
31
31
  backgroundColor: 'rgb(0 0 0 / 48%)',
32
32
  backdropFilter: 'blur(3px)',
@@ -9,7 +9,7 @@ export declare const DrawerButton: import("@emotion/styled").StyledComponent<{
9
9
  endIcon?: import("react").ReactNode;
10
10
  fullWidth?: boolean | undefined;
11
11
  href?: string | undefined;
12
- size?: "small" | "large" | "medium" | undefined;
12
+ size?: "small" | "medium" | "large" | undefined;
13
13
  startIcon?: import("react").ReactNode;
14
14
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
15
15
  variant?: "text" | "outlined" | "contained" | undefined;
@@ -60,7 +60,6 @@ export const DrawerButtonTypography = styled(Typography)(({ theme }) => ({
60
60
  cursor: 'pointer',
61
61
  display: 'flex',
62
62
  flexDirection: 'row',
63
- fontSize: '18px',
64
63
  padding: theme.spacing(1),
65
64
  position: 'relative',
66
65
  textTransform: 'none',
package/AppProvider.d.ts CHANGED
@@ -4,3 +4,4 @@ export interface AppProps {
4
4
  config?: WidgetConfig;
5
5
  }
6
6
  export declare const AppProvider: React.FC<PropsWithChildren<AppProps>>;
7
+ export declare const AppRouter: React.FC<PropsWithChildren<{}>>;
package/AppProvider.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  /* eslint-disable camelcase */
3
3
  /* eslint-disable react/jsx-pascal-case */
4
+ import { QueryClientProvider, } from '@tanstack/react-query';
4
5
  import { Fragment } from 'react';
5
- import { QueryClientProvider } from 'react-query';
6
6
  import { MemoryRouter, useInRouterContext } from 'react-router-dom';
7
7
  import { queryClient } from './config/queryClient';
8
8
  import { useTelemetry } from './hooks';
@@ -13,7 +13,10 @@ import { WidgetProvider } from './providers/WidgetProvider';
13
13
  const QueryProvider = QueryClientProvider;
14
14
  export const AppProvider = ({ children, config, }) => {
15
15
  useTelemetry(config === null || config === void 0 ? void 0 : config.disableTelemetry);
16
+ return (_jsx(WidgetProvider, Object.assign({ config: config }, { children: _jsx(ThemeProvider, { children: _jsx(QueryProvider, Object.assign({ client: queryClient }, { children: _jsx(WalletProvider, { children: _jsx(SwapFormProvider, { children: _jsx(AppRouter, { children: children }) }) }) })) }) })));
17
+ };
18
+ export const AppRouter = ({ children }) => {
16
19
  const inRouterContext = useInRouterContext();
17
20
  const Router = inRouterContext ? Fragment : MemoryRouter;
18
- return (_jsx(WidgetProvider, Object.assign({ config: config }, { children: _jsx(ThemeProvider, { children: _jsx(QueryProvider, Object.assign({ client: queryClient }, { children: _jsx(Router, { children: _jsx(WalletProvider, { children: _jsx(SwapFormProvider, { children: children }) }) }) })) }) })));
21
+ return _jsx(Router, { children: children });
19
22
  };
@@ -1,4 +1,14 @@
1
1
  import { PropsWithChildren, RefObject } from 'react';
2
+ export declare const FlexContainer: import("@emotion/styled").StyledComponent<{
3
+ children?: import("react").ReactNode;
4
+ classes?: Partial<import("@mui/material").ContainerClasses> | undefined;
5
+ disableGutters?: boolean | undefined;
6
+ fixed?: boolean | undefined;
7
+ maxWidth?: false | import("@mui/material").Breakpoint | undefined;
8
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
9
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
10
+ ref?: RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
11
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "maxWidth" | "fixed" | "disableGutters"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
2
12
  export declare const AppContainer: React.FC<PropsWithChildren<{}>>;
3
13
  export declare const ScrollToLocation: React.FC<{
4
14
  elementRef: RefObject<HTMLElement>;
@@ -5,7 +5,6 @@ import { useLayoutEffect, useRef } from 'react';
5
5
  import { useLocation } from 'react-router-dom';
6
6
  import { useWidgetConfig } from '../providers/WidgetProvider';
7
7
  import { ElementId } from '../utils';
8
- import { PoweredBy } from './PoweredBy';
9
8
  const CssBaselineContainer = styled(ScopedCssBaseline)(({ theme }) => ({
10
9
  // height: '100%',
11
10
  display: 'flex',
@@ -13,9 +12,7 @@ const CssBaselineContainer = styled(ScopedCssBaseline)(({ theme }) => ({
13
12
  flexDirection: 'column',
14
13
  overflowX: 'clip',
15
14
  marginRight: 0,
16
- [theme.breakpoints.up('xs')]: {
17
- maxWidth: 392,
18
- },
15
+ width: '100%',
19
16
  }));
20
17
  const RelativeContainer = styled(Box)(({ theme }) => ({
21
18
  position: 'relative',
@@ -35,7 +32,7 @@ const ScrollableContainer = styled(Box)({
35
32
  flex: 1,
36
33
  display: 'flex',
37
34
  });
38
- const FlexContainer = styled(Container)({
35
+ export const FlexContainer = styled(Container)({
39
36
  display: 'flex',
40
37
  flexBasis: 'auto',
41
38
  flexDirection: 'column',
@@ -45,7 +42,7 @@ const FlexContainer = styled(Container)({
45
42
  export const AppContainer = ({ children }) => {
46
43
  const ref = useRef(null);
47
44
  const { containerStyle } = useWidgetConfig();
48
- return (_jsxs(RelativeContainer, Object.assign({ sx: containerStyle }, { children: [_jsx(ScrollableContainer, Object.assign({ id: ElementId.ScrollableContainer, ref: ref }, { children: _jsx(CssBaselineContainer, Object.assign({ enableColorScheme: true }, { children: _jsxs(FlexContainer, Object.assign({ disableGutters: true }, { children: [children, _jsx(PoweredBy, {})] })) })) })), _jsx(ScrollToLocation, { elementRef: ref })] })));
45
+ return (_jsxs(RelativeContainer, Object.assign({ sx: containerStyle }, { children: [_jsx(ScrollableContainer, Object.assign({ id: ElementId.ScrollableContainer, ref: ref }, { children: _jsx(CssBaselineContainer, Object.assign({ enableColorScheme: true }, { children: _jsx(FlexContainer, Object.assign({ disableGutters: true }, { children: children })) })) })), _jsx(ScrollToLocation, { elementRef: ref })] })));
49
46
  };
50
47
  export const ScrollToLocation = ({ elementRef }) => {
51
48
  const { pathname } = useLocation();
@@ -1,8 +1,14 @@
1
- /// <reference types="react" />
2
- export declare const Card: import("@emotion/styled").StyledComponent<Omit<import("@mui/material").PaperProps<"div", {}>, "classes"> & {
3
- classes?: Partial<import("@mui/material").CardClasses> | undefined;
4
- raised?: boolean | undefined;
1
+ import { MouseEventHandler } from 'react';
2
+ export declare const Card: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
3
+ children?: import("react").ReactNode;
4
+ component?: import("react").ElementType<any> | undefined;
5
+ ref?: import("react").Ref<unknown> | undefined;
5
6
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
6
7
  } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
7
8
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
8
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "slot" | "title" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "hidden" | "id" | "lang" | "placeholder" | "spellCheck" | "tabIndex" | "translate" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "resource" | "typeof" | "vocab" | "autoCapitalize" | "autoCorrect" | "autoSave" | "color" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "inputMode" | "is" | "children" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerEnterCapture" | "onPointerLeave" | "onPointerLeaveCapture" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "sx" | "ref" | "key" | "variant" | "square" | "elevation" | "raised"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
9
+ }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | ("p" | "color" | "border" | "boxShadow" | "fontWeight" | "zIndex" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBottom" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "overflow" | "padding" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "typography" | "displayPrint") | "component"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
10
+ variant?: "default" | "error" | undefined;
11
+ dense?: boolean | undefined;
12
+ indented?: boolean | undefined;
13
+ onClick?: MouseEventHandler<HTMLDivElement> | undefined;
14
+ }, {}, {}>;
@@ -1,8 +1,32 @@
1
- import { Card as MuiCard } from '@mui/material';
2
- import { styled } from '@mui/material/styles';
3
- export const Card = styled(MuiCard)(({ theme }) => ({
4
- borderRadius: 0,
1
+ import { Box } from '@mui/material';
2
+ import { darken, lighten, styled } from '@mui/material/styles';
3
+ export const Card = styled(Box, {
4
+ shouldForwardProp: (prop) => !['dense', 'variant', 'indented'].includes(prop),
5
+ })(({ theme, variant, dense, indented, onClick }) => ({
6
+ backgroundColor: theme.palette.background.paper,
7
+ border: `1px solid`,
8
+ borderColor: variant === 'error'
9
+ ? theme.palette.error.main
10
+ : theme.palette.mode === 'light'
11
+ ? theme.palette.grey[300]
12
+ : theme.palette.grey[800],
13
+ borderRadius: dense
14
+ ? theme.shape.borderRadiusSecondary
15
+ : theme.shape.borderRadius,
16
+ overflow: 'hidden',
17
+ position: 'relative',
18
+ padding: indented ? theme.spacing(2) : 0,
19
+ boxSizing: 'border-box',
5
20
  '&:hover': {
6
- cursor: 'pointer',
21
+ cursor: onClick ? 'pointer' : 'default',
22
+ backgroundColor: onClick
23
+ ? theme.palette.mode === 'light'
24
+ ? darken(theme.palette.background.paper, 0.02)
25
+ : lighten(theme.palette.background.paper, 0.02)
26
+ : theme.palette.background.paper,
7
27
  },
28
+ transition: theme.transitions.create(['background-color'], {
29
+ duration: theme.transitions.duration.enteringScreen,
30
+ easing: theme.transitions.easing.easeOut,
31
+ }),
8
32
  }));
@@ -1,4 +1,3 @@
1
1
  export * from './Card';
2
- export * from './CardContainer';
3
2
  export * from './CardHeader';
4
3
  export * from './CardTitle';
@@ -1,4 +1,3 @@
1
1
  export * from './Card';
2
- export * from './CardContainer';
3
2
  export * from './CardHeader';
4
3
  export * from './CardTitle';
@@ -0,0 +1,3 @@
1
+ import { DialogProps } from '@mui/material';
2
+ import { PropsWithChildren } from 'react';
3
+ export declare const Dialog: React.FC<PropsWithChildren<DialogProps>>;
@@ -0,0 +1,23 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Dialog as MuiDialog } from '@mui/material';
3
+ import { useScrollableContainer } from '../hooks';
4
+ export const Dialog = ({ children, open, onClose, }) => {
5
+ const containerElement = useScrollableContainer();
6
+ return (_jsx(MuiDialog, Object.assign({ open: open, onClose: onClose, container: containerElement, sx: {
7
+ position: 'absolute',
8
+ overflow: 'hidden',
9
+ }, PaperProps: {
10
+ sx: (theme) => ({
11
+ position: 'absolute',
12
+ backgroundImage: 'none',
13
+ borderTopLeftRadius: theme.shape.borderRadius,
14
+ borderTopRightRadius: theme.shape.borderRadius,
15
+ }),
16
+ }, BackdropProps: {
17
+ sx: {
18
+ position: 'absolute',
19
+ backgroundColor: 'rgb(0 0 0 / 32%)',
20
+ backdropFilter: 'blur(3px)',
21
+ },
22
+ } }, { children: children })));
23
+ };
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { Route } from '@lifi/sdk';
3
+ import { BoxProps } from '@mui/material';
4
+ export declare const GasSufficiencyMessage: React.FC<{
5
+ route?: Route;
6
+ } & BoxProps>;
@@ -0,0 +1,41 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { WarningAmber as WarningIcon } from '@mui/icons-material';
14
+ import { Box, Typography } from '@mui/material';
15
+ import { useTranslation } from 'react-i18next';
16
+ import { useGasSufficiency } from '../../hooks';
17
+ import { CardTitle } from '../Card';
18
+ import { MessageCard } from './GasSufficiencyMessage.style';
19
+ export const GasSufficiencyMessage = (_a) => {
20
+ var { route } = _a, props = __rest(_a, ["route"]);
21
+ const { t } = useTranslation();
22
+ const { insufficientFunds, insufficientGas } = useGasSufficiency(route);
23
+ if (!insufficientFunds && !insufficientGas.length) {
24
+ return null;
25
+ }
26
+ return (_jsxs(MessageCard, Object.assign({}, props, { children: [_jsx(WarningIcon, { sx: {
27
+ marginTop: 2,
28
+ marginLeft: 2,
29
+ } }), _jsxs(Box, { children: [insufficientGas.length ? (_jsx(CardTitle, { children: t(`swap.warning.title.insufficientGas`) })) : null, insufficientFunds ? (_jsx(Typography, Object.assign({ variant: "body2", px: 2, pb: insufficientGas.length ? 0 : 2, pt: insufficientGas.length ? 1 : 2 }, { children: insufficientFunds
30
+ ? t(`swap.warning.message.insufficientFunds`)
31
+ : null }))) : null, insufficientGas.length ? (_jsx(Typography, Object.assign({ variant: "body2", px: 2, pt: 1 }, { children: t(`swap.warning.message.insufficientGas`) }))) : null, insufficientGas.length
32
+ ? insufficientGas.map((item, index) => {
33
+ var _a, _b;
34
+ return (_jsx(Typography, Object.assign({ variant: "body2", px: 2, pb: insufficientGas.length - 1 === index ? 2 : 0, pt: 0.5 }, { children: t(`swap.tokenOnChainAmount`, {
35
+ amount: (_a = item.insufficientAmount) === null || _a === void 0 ? void 0 : _a.toString(),
36
+ tokenSymbol: item.token.symbol,
37
+ chainName: (_b = item.chain) === null || _b === void 0 ? void 0 : _b.name,
38
+ }) }), index));
39
+ })
40
+ : null] })] })));
41
+ };
@@ -7,4 +7,5 @@ export const MessageCard = styled(Box)(({ theme }) => ({
7
7
  borderRadius: theme.shape.borderRadius,
8
8
  position: 'relative',
9
9
  display: 'flex',
10
+ whiteSpace: 'pre-line',
10
11
  }));
@@ -0,0 +1 @@
1
+ export * from './GasSufficiencyMessage';
@@ -0,0 +1 @@
1
+ export * from './GasSufficiencyMessage';
@@ -12,7 +12,7 @@ const stickyHeaderRoutes = [
12
12
  ];
13
13
  const HeaderContainer = ({ children }) => {
14
14
  const { pathname } = useLocation();
15
- return (_jsx(Container, Object.assign({ id: ElementId.Header, sticky: stickyHeaderRoutes.some((route) => pathname.includes(route)) }, { children: children })));
15
+ return (_jsx(Container, Object.assign({ id: ElementId.Header, sticky: stickyHeaderRoutes.includes(pathname) }, { children: children })));
16
16
  };
17
17
  export const Header = () => {
18
18
  const { walletManagement } = useWidgetConfig();
@@ -6,10 +6,11 @@ export const HeaderAppBar = styled(AppBar)(({ theme }) => ({
6
6
  flexDirection: 'row',
7
7
  alignItems: 'center',
8
8
  position: 'relative',
9
- minHeight: 48,
9
+ minHeight: 40,
10
10
  padding: theme.spacing(0, 3, 0, 3),
11
11
  ':first-of-type': {
12
12
  paddingTop: theme.spacing(1.5),
13
+ paddingBottom: theme.spacing(0.5),
13
14
  },
14
15
  }));
15
16
  export const Container = styled(Box, {
@@ -1,28 +1,30 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- import { ArrowBack as ArrowBackIcon, Settings as SettingsIcon, } from '@mui/icons-material';
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ArrowBack as ArrowBackIcon, History as HistoryIcon, SettingsOutlined as SettingsIcon, } from '@mui/icons-material';
3
3
  import { Box, IconButton, Typography } from '@mui/material';
4
4
  import { useTranslation } from 'react-i18next';
5
5
  import { Route, Routes, useLocation, useNavigate } from 'react-router-dom';
6
+ import { useWallet } from '../../providers/WalletProvider';
6
7
  import { navigationRoutes, navigationRoutesValues } from '../../utils';
7
- import { SwapRoutesUpdateProgress } from '../SwapRoutes/SwapRoutesUpdateProgress';
8
8
  import { HeaderAppBar } from './Header.style';
9
+ import { useHeaderActionStore } from './useHeaderActionStore';
9
10
  const backButtonRoutes = [
10
11
  navigationRoutes.selectWallet,
11
12
  navigationRoutes.settings,
13
+ navigationRoutes.swapHistory,
12
14
  navigationRoutes.fromToken,
13
15
  navigationRoutes.toToken,
14
16
  navigationRoutes.swapRoutes,
15
- navigationRoutes.swap,
17
+ navigationRoutes.swapExecution,
18
+ navigationRoutes.swapDetails,
16
19
  ];
17
20
  export const NavigationHeader = () => {
18
21
  const { t } = useTranslation();
22
+ const navigate = useNavigate();
23
+ const { account } = useWallet();
24
+ const { element } = useHeaderActionStore();
19
25
  const { pathname } = useLocation();
20
26
  const path = pathname.substring(pathname.lastIndexOf('/') + 1);
21
27
  const hasPath = navigationRoutesValues.includes(path);
22
- const navigate = useNavigate();
23
- const handleSettings = () => {
24
- navigate(navigationRoutes.settings);
25
- };
26
28
  const handleBack = () => {
27
29
  navigate(-1);
28
30
  };
@@ -32,17 +34,21 @@ export const NavigationHeader = () => {
32
34
  return t(`header.selectWallet`);
33
35
  case navigationRoutes.settings:
34
36
  return t(`header.settings`);
37
+ case navigationRoutes.swapHistory:
38
+ return t(`header.swapHistory`);
35
39
  case navigationRoutes.fromToken:
36
40
  return t(`header.from`);
37
41
  case navigationRoutes.toToken:
38
42
  return t(`header.to`);
39
43
  case navigationRoutes.swapRoutes:
40
44
  return t(`header.routes`);
41
- case navigationRoutes.swap:
45
+ case navigationRoutes.swapExecution:
42
46
  return t(`header.swap`);
47
+ case navigationRoutes.swapDetails:
48
+ return t(`header.swapDetails`);
43
49
  default:
44
50
  return t(`header.swap`);
45
51
  }
46
52
  };
47
- return (_jsxs(HeaderAppBar, Object.assign({ elevation: 0 }, { children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "start", onClick: handleBack }, { children: _jsx(ArrowBackIcon, {}) }))) : null, _jsx(Typography, Object.assign({ fontSize: hasPath ? 24 : 32, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true }, { children: handleHeaderTitle() })), _jsxs(Routes, { children: [_jsx(Route, { path: navigationRoutes.swapRoutes, element: _jsx(SwapRoutesUpdateProgress, { size: "medium", edge: "end", sx: { marginRight: -1 } }) }), _jsx(Route, { path: navigationRoutes.home, element: _jsx(IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "end", onClick: handleSettings }, { children: _jsx(SettingsIcon, {}) })) }), _jsx(Route, { path: "*", element: _jsx(Box, { width: 28, height: 48 }) })] })] })));
53
+ return (_jsxs(HeaderAppBar, Object.assign({ elevation: 0 }, { children: [backButtonRoutes.includes(path) ? (_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "start", onClick: handleBack }, { children: _jsx(ArrowBackIcon, {}) }))) : null, _jsx(Typography, Object.assign({ fontSize: hasPath ? 18 : 24, align: hasPath ? 'center' : 'left', fontWeight: "700", flex: 1, noWrap: true }, { children: handleHeaderTitle() })), _jsxs(Routes, { children: [_jsx(Route, { path: navigationRoutes.home, element: _jsxs(_Fragment, { children: [account.isActive ? (_jsx(IconButton, Object.assign({ size: "medium", "aria-label": "swap-history", edge: "start", onClick: () => navigate(navigationRoutes.swapHistory) }, { children: _jsx(HistoryIcon, {}) }))) : null, _jsx(IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "end", onClick: () => navigate(navigationRoutes.settings) }, { children: _jsx(SettingsIcon, {}) }))] }) }), _jsx(Route, { path: "*", element: element || _jsx(Box, { width: 28, height: 40 }) })] })] })));
48
54
  };
@@ -8,7 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
8
8
  });
9
9
  };
10
10
  import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
11
- import { AccountBalanceWallet as AccountBalanceWalletIcon, Logout as LogoutIcon, } from '@mui/icons-material';
11
+ import { AccountBalanceWalletOutlined as AccountBalanceWalletIcon, Logout as LogoutIcon, } from '@mui/icons-material';
12
12
  import { Box, IconButton, Typography } from '@mui/material';
13
13
  import { useTranslation } from 'react-i18next';
14
14
  import { useLocation, useNavigate } from 'react-router-dom';
@@ -1 +1,2 @@
1
1
  export * from './Header';
2
+ export * from './useHeaderActionStore';
@@ -1 +1,2 @@
1
1
  export * from './Header';
2
+ export * from './useHeaderActionStore';
@@ -0,0 +1,8 @@
1
+ /// <reference types="react" />
2
+ export interface HeaderActionState {
3
+ element?: React.ReactNode | null;
4
+ }
5
+ export interface HeaderActionStore extends HeaderActionState {
6
+ setAction(element?: React.ReactNode | null): () => void;
7
+ removeAction(): void;
8
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { HeaderActionStore } from './types';
3
+ export declare const useHeaderActionStore: import("zustand").UseBoundStore<Omit<import("zustand").StoreApi<HeaderActionStore>, "setState"> & {
4
+ setState(nextStateOrUpdater: HeaderActionStore | Partial<HeaderActionStore> | ((state: import("immer/dist/internal").WritableDraft<HeaderActionStore>) => void), shouldReplace?: boolean | undefined): void;
5
+ }>;
6
+ export declare const useSetHeaderAction: () => (element?: import("react").ReactNode) => () => void;
@@ -0,0 +1,19 @@
1
+ /* eslint-disable no-underscore-dangle */
2
+ import create from 'zustand';
3
+ import { immer } from 'zustand/middleware/immer';
4
+ export const useHeaderActionStore = create()(immer((set, get) => ({
5
+ setAction: (element) => {
6
+ set((state) => {
7
+ state.element = element;
8
+ });
9
+ return get().removeAction;
10
+ },
11
+ removeAction: () => {
12
+ set((state) => {
13
+ state.element = null;
14
+ });
15
+ },
16
+ })));
17
+ export const useSetHeaderAction = () => {
18
+ return useHeaderActionStore((state) => state.setAction);
19
+ };
@@ -7,6 +7,5 @@ export const PoweredBy = () => {
7
7
  display: 'flex',
8
8
  alignItems: 'flex-end',
9
9
  justifyContent: 'flex-end',
10
- flex: 1,
11
10
  } }, { children: _jsxs(Link, Object.assign({ href: "https://li.fi", target: "_blank", underline: "none", color: "text.primary" }, { children: [_jsx(Typography, Object.assign({ color: "text.secondary", fontSize: 12, px: 0.5 }, { children: "Powered by" })), _jsx(LiFiLogo, { variant: "full", style: { height: 16, width: 42 } })] })) })));
12
11
  };
@@ -1,3 +1,14 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
13
  import { Box, CircularProgress, IconButton, Tooltip, } from '@mui/material';
3
14
  import { useEffect, useState } from 'react';
@@ -6,7 +17,8 @@ const getProgressValue = (updatedAt, timeToUpdate) => updatedAt
6
17
  ? Math.min(100, ((Date.now() - updatedAt) / timeToUpdate) * 100)
7
18
  : 0;
8
19
  const getSecondsToUpdate = (updatedAt, timeToUpdate) => Math.max(Math.round((timeToUpdate - (Date.now() - updatedAt)) / 1000), 0);
9
- export const ProgressToNextUpdate = ({ updatedAt, timeToUpdate, isLoading, onClick, sx }) => {
20
+ export const ProgressToNextUpdate = (_a) => {
21
+ var { updatedAt, timeToUpdate, isLoading, onClick } = _a, other = __rest(_a, ["updatedAt", "timeToUpdate", "isLoading", "onClick"]);
10
22
  const { t } = useTranslation();
11
23
  const [value, setValue] = useState(() => getProgressValue(updatedAt, timeToUpdate));
12
24
  useEffect(() => {
@@ -25,7 +37,7 @@ export const ProgressToNextUpdate = ({ updatedAt, timeToUpdate, isLoading, onCli
25
37
  setValue(0);
26
38
  }
27
39
  }, [isLoading]);
28
- return (_jsx(IconButton, Object.assign({ onClick: onClick, sx: sx, disabled: isLoading }, { children: _jsx(Tooltip, Object.assign({ title: t('tooltip.progressToNextUpdate', {
40
+ return (_jsx(IconButton, Object.assign({ onClick: onClick, disabled: isLoading }, other, { children: _jsx(Tooltip, Object.assign({ title: t('tooltip.progressToNextUpdate', {
29
41
  value: getSecondsToUpdate(updatedAt, timeToUpdate),
30
42
  }), placement: "top", enterDelay: 250, arrow: true }, { children: _jsxs(Box, Object.assign({ sx: {
31
43
  display: 'grid',
@@ -12,13 +12,11 @@ export const ReverseTokensButton = ({ vertical, }) => {
12
12
  SwapFormKey.ToChain,
13
13
  SwapFormKey.ToToken,
14
14
  ]);
15
- if (fromChain && fromToken && toChain && toToken) {
16
- setValue(SwapFormKey.FromAmount, '');
17
- setValue(SwapFormKey.FromChain, toChain);
18
- setValue(SwapFormKey.FromToken, toToken);
19
- setValue(SwapFormKey.ToChain, fromChain);
20
- setValue(SwapFormKey.ToToken, fromToken);
21
- }
15
+ setValue(SwapFormKey.FromAmount, '');
16
+ setValue(SwapFormKey.FromChain, toChain);
17
+ setValue(SwapFormKey.FromToken, toToken);
18
+ setValue(SwapFormKey.ToChain, fromChain);
19
+ setValue(SwapFormKey.ToToken, fromToken);
22
20
  };
23
21
  return (_jsx(IconButton, Object.assign({ onClick: handleClick, size: "small", "aria-label": "swap-destinations" }, { children: vertical ? _jsx(SwapVertIcon, {}) : _jsx(SwapHorizIcon, {}) })));
24
22
  };
@@ -6,7 +6,7 @@ export declare const IconButton: import("@emotion/styled").StyledComponent<{
6
6
  disabled?: boolean | undefined;
7
7
  disableFocusRipple?: boolean | undefined;
8
8
  edge?: false | "end" | "start" | undefined;
9
- size?: "small" | "large" | "medium" | undefined;
9
+ size?: "small" | "medium" | "large" | undefined;
10
10
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
11
11
  } & Omit<{
12
12
  action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;