@lifi/widget 1.17.1 → 1.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (210) hide show
  1. package/App.js +6 -86
  2. package/AppDrawer.js +3 -2
  3. package/AppRoutes.d.ts +2 -0
  4. package/AppRoutes.js +85 -0
  5. package/cjs/App.js +5 -85
  6. package/cjs/AppDrawer.js +2 -1
  7. package/cjs/AppRoutes.d.ts +2 -0
  8. package/cjs/AppRoutes.js +89 -0
  9. package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -0
  10. package/cjs/components/AppContainer.d.ts +4 -5
  11. package/cjs/components/AppContainer.js +30 -29
  12. package/cjs/components/Card/Card.d.ts +1 -0
  13. package/cjs/components/Card/Card.js +13 -9
  14. package/cjs/components/ChainSelect/ChainSelect.js +3 -3
  15. package/cjs/components/ChainSelect/ChainSelect.style.d.ts +1 -0
  16. package/cjs/components/ChainSelect/ChainSelect.style.js +2 -2
  17. package/cjs/components/ChainSelect/useChainSelect.js +2 -2
  18. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +6 -2
  19. package/cjs/components/Header/Header.d.ts +2 -1
  20. package/cjs/components/Header/Header.js +3 -2
  21. package/cjs/components/Header/Header.style.js +3 -2
  22. package/cjs/components/Header/NavigationHeader.js +4 -1
  23. package/cjs/components/Header/WalletHeader.js +1 -1
  24. package/cjs/components/Header/useHeaderActionStore.js +1 -4
  25. package/cjs/components/PoweredBy/PoweredBy.js +7 -0
  26. package/cjs/components/SendToWallet/SendToWallet.js +6 -10
  27. package/cjs/components/SendToWallet/SendToWalletButton.d.ts +2 -0
  28. package/cjs/components/SendToWallet/SendToWalletButton.js +24 -0
  29. package/cjs/components/SendToWallet/index.d.ts +1 -0
  30. package/cjs/components/SendToWallet/index.js +1 -0
  31. package/cjs/components/SendToWallet/store.d.ts +4 -0
  32. package/cjs/components/SendToWallet/store.js +13 -0
  33. package/cjs/components/SendToWallet/types.d.ts +6 -0
  34. package/cjs/{stores/route → components/SendToWallet}/types.js +0 -0
  35. package/cjs/components/StepActions/StepActions.style.js +1 -1
  36. package/cjs/components/SwapButton/SwapButton.d.ts +1 -1
  37. package/cjs/components/SwapButton/SwapButton.js +4 -4
  38. package/cjs/components/SwapRouteCard/SwapRouteCard.d.ts +2 -1
  39. package/cjs/components/SwapRouteCard/SwapRouteCard.js +19 -15
  40. package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +30 -0
  41. package/cjs/components/SwapRouteCard/SwapRouteCard.style.js +16 -3
  42. package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -12
  43. package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +1 -3
  44. package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.js +1 -13
  45. package/cjs/components/SwapRouteCard/types.d.ts +6 -2
  46. package/cjs/{pages/MainPage → components/SwapRoutes}/SwapRoutes.d.ts +0 -0
  47. package/cjs/components/SwapRoutes/SwapRoutes.js +51 -0
  48. package/cjs/components/SwapRoutes/SwapRoutes.style.d.ts +43 -0
  49. package/cjs/components/SwapRoutes/SwapRoutes.style.js +47 -0
  50. package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -0
  51. package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +38 -0
  52. package/cjs/components/SwapRoutes/index.d.ts +2 -0
  53. package/cjs/components/SwapRoutes/index.js +18 -0
  54. package/cjs/components/Token/Token.d.ts +2 -1
  55. package/cjs/components/Token/Token.js +10 -6
  56. package/cjs/components/Token/Token.style.js +2 -0
  57. package/cjs/components/TokenList/TokenList.js +4 -1
  58. package/cjs/config/sentry.js +3 -26
  59. package/cjs/config/theme.js +20 -24
  60. package/cjs/config/version.d.ts +1 -1
  61. package/cjs/config/version.js +1 -1
  62. package/cjs/hooks/useChains.js +2 -2
  63. package/cjs/hooks/useGasSufficiency.js +14 -37
  64. package/cjs/hooks/useNavigateBack.js +13 -6
  65. package/cjs/hooks/useRouteExecution.js +5 -8
  66. package/cjs/hooks/useSwapRoutes.js +1 -4
  67. package/cjs/hooks/useTelemetry.js +3 -2
  68. package/cjs/hooks/useTokenBalances.d.ts +1 -1
  69. package/cjs/hooks/useTokenBalances.js +3 -1
  70. package/cjs/hooks/useWidgetEvents.js +2 -5
  71. package/cjs/i18n/index.js +2 -5
  72. package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +1 -0
  73. package/cjs/pages/MainPage/MainPage.js +4 -2
  74. package/cjs/pages/MainPage/MainSwapButton.js +4 -4
  75. package/cjs/pages/SelectTokenPage/SelectTokenPage.js +4 -3
  76. package/cjs/pages/SettingsPage/EnabledBridgesSelect.js +1 -4
  77. package/cjs/pages/SettingsPage/EnabledExchangesSelect.js +1 -4
  78. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +2 -5
  79. package/cjs/pages/SwapHistoryPage/SwapHistoryEmpty.js +1 -0
  80. package/cjs/pages/SwapHistoryPage/SwapHistoryPage.js +8 -5
  81. package/cjs/pages/SwapPage/SwapPage.js +5 -1
  82. package/cjs/pages/SwapRoutesPage/SwapRoutesPage.js +3 -5
  83. package/cjs/providers/SDKProvider/SDKProvider.js +1 -4
  84. package/cjs/providers/WalletProvider/WalletProvider.js +2 -2
  85. package/cjs/stores/chains/useChainOrder.js +1 -4
  86. package/cjs/stores/chains/useChainOrderStore.js +1 -4
  87. package/cjs/stores/index.d.ts +2 -1
  88. package/cjs/stores/index.js +2 -1
  89. package/cjs/stores/{route → routes}/index.d.ts +2 -1
  90. package/cjs/stores/{route → routes}/index.js +2 -1
  91. package/cjs/stores/{route → routes}/types.d.ts +4 -0
  92. package/cjs/stores/routes/types.js +2 -0
  93. package/cjs/stores/{route → routes}/useExecutingRoutesIds.d.ts +0 -0
  94. package/cjs/stores/{route → routes}/useExecutingRoutesIds.js +3 -6
  95. package/cjs/stores/{route/useRouteStore.d.ts → routes/useRouteExecutionStore.d.ts} +1 -1
  96. package/cjs/stores/{route/useRouteStore.js → routes/useRouteExecutionStore.js} +3 -6
  97. package/cjs/stores/routes/useSelectedRouteStore.d.ts +4 -0
  98. package/cjs/stores/routes/useSelectedRouteStore.js +12 -0
  99. package/cjs/stores/{route → routes}/useSetExecutableRoute.d.ts +0 -0
  100. package/cjs/stores/{route → routes}/useSetExecutableRoute.js +2 -2
  101. package/cjs/stores/{route → routes}/useSwapHistory.d.ts +0 -0
  102. package/cjs/stores/{route → routes}/useSwapHistory.js +3 -6
  103. package/cjs/stores/{route → routes}/utils.d.ts +0 -0
  104. package/cjs/stores/{route → routes}/utils.js +1 -4
  105. package/cjs/stores/settings/useAppearance.js +1 -4
  106. package/cjs/stores/settings/useSettings.js +1 -4
  107. package/cjs/stores/settings/useSettingsStore.js +2 -5
  108. package/cjs/types/widget.d.ts +2 -0
  109. package/cjs/utils/colors.d.ts +1 -1
  110. package/cjs/utils/format.js +1 -4
  111. package/cjs/utils/navigationRoutes.js +12 -12
  112. package/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -0
  113. package/components/AppContainer.d.ts +4 -5
  114. package/components/AppContainer.js +29 -28
  115. package/components/Card/Card.d.ts +1 -0
  116. package/components/Card/Card.js +13 -9
  117. package/components/ChainSelect/ChainSelect.js +1 -1
  118. package/components/ChainSelect/ChainSelect.style.d.ts +1 -0
  119. package/components/ChainSelect/ChainSelect.style.js +2 -2
  120. package/components/ChainSelect/useChainSelect.js +1 -1
  121. package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +6 -2
  122. package/components/Header/Header.d.ts +2 -1
  123. package/components/Header/Header.js +1 -1
  124. package/components/Header/Header.style.js +4 -3
  125. package/components/Header/NavigationHeader.js +4 -1
  126. package/components/Header/WalletHeader.js +2 -2
  127. package/components/PoweredBy/PoweredBy.js +7 -0
  128. package/components/SendToWallet/SendToWallet.js +8 -11
  129. package/components/SendToWallet/SendToWalletButton.d.ts +2 -0
  130. package/components/SendToWallet/SendToWalletButton.js +20 -0
  131. package/components/SendToWallet/index.d.ts +1 -0
  132. package/components/SendToWallet/index.js +1 -0
  133. package/components/SendToWallet/store.d.ts +4 -0
  134. package/components/SendToWallet/store.js +10 -0
  135. package/components/SendToWallet/types.d.ts +6 -0
  136. package/{stores/route → components/SendToWallet}/types.js +0 -0
  137. package/components/StepActions/StepActions.style.js +1 -1
  138. package/components/SwapButton/SwapButton.d.ts +1 -1
  139. package/components/SwapButton/SwapButton.js +4 -3
  140. package/components/SwapRouteCard/SwapRouteCard.d.ts +2 -1
  141. package/components/SwapRouteCard/SwapRouteCard.js +19 -16
  142. package/components/SwapRouteCard/SwapRouteCard.style.d.ts +30 -0
  143. package/components/SwapRouteCard/SwapRouteCard.style.js +17 -4
  144. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -12
  145. package/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +1 -3
  146. package/components/SwapRouteCard/SwapRouteNotFoundCard.js +1 -13
  147. package/components/SwapRouteCard/types.d.ts +6 -2
  148. package/{pages/MainPage → components/SwapRoutes}/SwapRoutes.d.ts +0 -0
  149. package/components/SwapRoutes/SwapRoutes.js +47 -0
  150. package/components/SwapRoutes/SwapRoutes.style.d.ts +43 -0
  151. package/components/SwapRoutes/SwapRoutes.style.js +44 -0
  152. package/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -0
  153. package/components/SwapRoutes/SwapRoutesExpanded.js +34 -0
  154. package/components/SwapRoutes/index.d.ts +2 -0
  155. package/components/SwapRoutes/index.js +2 -0
  156. package/components/Token/Token.d.ts +2 -1
  157. package/components/Token/Token.js +11 -7
  158. package/components/Token/Token.style.js +2 -0
  159. package/components/TokenList/TokenList.js +4 -1
  160. package/config/theme.js +20 -24
  161. package/config/version.d.ts +1 -1
  162. package/config/version.js +1 -1
  163. package/hooks/useChains.js +1 -1
  164. package/hooks/useGasSufficiency.js +15 -35
  165. package/hooks/useNavigateBack.js +13 -6
  166. package/hooks/useRouteExecution.js +5 -5
  167. package/hooks/useTelemetry.js +3 -2
  168. package/hooks/useTokenBalances.d.ts +1 -1
  169. package/hooks/useTokenBalances.js +3 -1
  170. package/package.json +14 -14
  171. package/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +1 -0
  172. package/pages/MainPage/MainPage.js +4 -2
  173. package/pages/MainPage/MainSwapButton.js +4 -3
  174. package/pages/SelectTokenPage/SelectTokenPage.js +4 -3
  175. package/pages/SwapDetailsPage/SwapDetailsPage.js +2 -2
  176. package/pages/SwapHistoryPage/SwapHistoryEmpty.js +1 -0
  177. package/pages/SwapHistoryPage/SwapHistoryPage.js +8 -5
  178. package/pages/SwapPage/SwapPage.js +5 -1
  179. package/pages/SwapRoutesPage/SwapRoutesPage.js +4 -6
  180. package/providers/WalletProvider/WalletProvider.js +1 -1
  181. package/stores/index.d.ts +2 -1
  182. package/stores/index.js +2 -1
  183. package/stores/{route → routes}/index.d.ts +2 -1
  184. package/stores/{route → routes}/index.js +2 -1
  185. package/stores/{route → routes}/types.d.ts +4 -0
  186. package/stores/routes/types.js +1 -0
  187. package/stores/{route → routes}/useExecutingRoutesIds.d.ts +0 -0
  188. package/stores/{route → routes}/useExecutingRoutesIds.js +2 -2
  189. package/stores/{route/useRouteStore.d.ts → routes/useRouteExecutionStore.d.ts} +1 -1
  190. package/stores/{route/useRouteStore.js → routes/useRouteExecutionStore.js} +1 -1
  191. package/stores/routes/useSelectedRouteStore.d.ts +4 -0
  192. package/stores/routes/useSelectedRouteStore.js +9 -0
  193. package/stores/{route → routes}/useSetExecutableRoute.d.ts +0 -0
  194. package/stores/routes/useSetExecutableRoute.js +4 -0
  195. package/stores/{route → routes}/useSwapHistory.d.ts +0 -0
  196. package/stores/{route → routes}/useSwapHistory.js +2 -2
  197. package/stores/{route → routes}/utils.d.ts +0 -0
  198. package/stores/{route → routes}/utils.js +0 -0
  199. package/stores/settings/useSettingsStore.js +1 -1
  200. package/tsconfig.cjs.tsbuildinfo +1 -1
  201. package/types/widget.d.ts +2 -0
  202. package/utils/colors.d.ts +1 -1
  203. package/utils/navigationRoutes.js +12 -12
  204. package/cjs/pages/MainPage/SwapRoutes.js +0 -43
  205. package/cjs/pages/MainPage/SwapRoutes.style.d.ts +0 -11
  206. package/cjs/pages/MainPage/SwapRoutes.style.js +0 -16
  207. package/pages/MainPage/SwapRoutes.js +0 -39
  208. package/pages/MainPage/SwapRoutes.style.d.ts +0 -11
  209. package/pages/MainPage/SwapRoutes.style.js +0 -13
  210. package/stores/route/useSetExecutableRoute.js +0 -4
package/types/widget.d.ts CHANGED
@@ -3,6 +3,7 @@ import type { PaletteMode, PaletteOptions, Shape } from '@mui/material';
3
3
  import type { TypographyOptions } from '@mui/material/styles/createTypography';
4
4
  import type { Signer } from 'ethers';
5
5
  import type { CSSProperties } from 'react';
6
+ export declare type WidgetVariant = 'default' | 'expandable' | 'drawer';
6
7
  export declare type Appearance = PaletteMode | 'auto';
7
8
  export declare type ThemeConfig = {
8
9
  palette?: Pick<PaletteOptions, 'primary' | 'secondary'>;
@@ -34,6 +35,7 @@ export interface WidgetConfig {
34
35
  /** @deprecated Use tokens.featured instead */
35
36
  featuredTokens?: Token[];
36
37
  integrator?: string;
38
+ variant?: WidgetVariant;
37
39
  walletManagement?: WidgetWalletManagement;
38
40
  sdkConfig?: ConfigUpdate;
39
41
  bridges?: {
package/utils/colors.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  import type { Theme } from '@mui/material';
2
2
  export declare const getContrastAlphaColor: (theme: Theme, alpha: string | number) => string;
3
- export declare const getContrastTextColor: (theme: Theme, background?: string) => "#000" | "#fff";
3
+ export declare const getContrastTextColor: (theme: Theme, background?: string) => "#fff" | "#000";
@@ -14,26 +14,26 @@ export const navigationRoutes = {
14
14
  };
15
15
  export const navigationRoutesValues = Object.values(navigationRoutes);
16
16
  export const stickyHeaderRoutes = [
17
- navigationRoutes.selectWallet,
17
+ navigationRoutes.activeSwaps,
18
18
  navigationRoutes.fromChain,
19
- navigationRoutes.toChain,
19
+ navigationRoutes.selectWallet,
20
20
  navigationRoutes.settings,
21
- navigationRoutes.swapRoutes,
21
+ navigationRoutes.swapDetails,
22
22
  navigationRoutes.swapExecution,
23
23
  navigationRoutes.swapHistory,
24
- navigationRoutes.activeSwaps,
25
- navigationRoutes.swapDetails,
24
+ navigationRoutes.swapRoutes,
25
+ navigationRoutes.toChain,
26
26
  ];
27
27
  export const backButtonRoutes = [
28
+ navigationRoutes.activeSwaps,
29
+ navigationRoutes.fromChain,
30
+ navigationRoutes.fromToken,
28
31
  navigationRoutes.selectWallet,
29
32
  navigationRoutes.settings,
33
+ navigationRoutes.swapDetails,
34
+ navigationRoutes.swapExecution,
30
35
  navigationRoutes.swapHistory,
31
- navigationRoutes.activeSwaps,
32
- navigationRoutes.fromToken,
33
- navigationRoutes.toToken,
34
- navigationRoutes.fromChain,
35
- navigationRoutes.toChain,
36
36
  navigationRoutes.swapRoutes,
37
- navigationRoutes.swapExecution,
38
- navigationRoutes.swapDetails,
37
+ navigationRoutes.toChain,
38
+ navigationRoutes.toToken,
39
39
  ];
@@ -1,43 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.SwapRoutes = void 0;
4
- const jsx_runtime_1 = require("react/jsx-runtime");
5
- /* eslint-disable react/no-array-index-key */
6
- const icons_material_1 = require("@mui/icons-material");
7
- const material_1 = require("@mui/material");
8
- const react_1 = require("react");
9
- const react_hook_form_1 = require("react-hook-form");
10
- const react_i18next_1 = require("react-i18next");
11
- const react_router_dom_1 = require("react-router-dom");
12
- const Card_1 = require("../../components/Card");
13
- const GasSufficiencyMessage_1 = require("../../components/GasSufficiencyMessage");
14
- const ProgressToNextUpdate_1 = require("../../components/ProgressToNextUpdate");
15
- const SendToWallet_1 = require("../../components/SendToWallet");
16
- const SwapRouteCard_1 = require("../../components/SwapRouteCard");
17
- const hooks_1 = require("../../hooks");
18
- const utils_1 = require("../../utils");
19
- const SwapRoutes_style_1 = require("./SwapRoutes.style");
20
- const SwapRoutes = (props) => {
21
- const { t } = (0, react_i18next_1.useTranslation)();
22
- const navigate = (0, react_router_dom_1.useNavigate)();
23
- const { isValid, isValidating } = (0, react_hook_form_1.useFormState)();
24
- const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = (0, hooks_1.useSwapRoutes)();
25
- const handleCardClick = (0, react_1.useCallback)(() => {
26
- navigate(utils_1.navigationRoutes.swapRoutes);
27
- }, [navigate]);
28
- const currentRoute = routes === null || routes === void 0 ? void 0 : routes[0];
29
- if (!currentRoute && !isLoading && !isFetching && !isFetched) {
30
- return null;
31
- }
32
- const routeNotFound = !currentRoute && !isLoading && !isFetching;
33
- return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(Card_1.Card, Object.assign({}, props, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t('swap.routes') }), (0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: {
34
- position: 'absolute',
35
- top: 8,
36
- right: 8,
37
- } }), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: { display: 'flex' } }, { children: [(0, jsx_runtime_1.jsx)(SwapRoutes_style_1.Stack, Object.assign({ direction: "row", spacing: 2, my: 2, ml: 2, mr: routeNotFound ? 2 : 1, sx: {
38
- borderWidth: !routeNotFound && (isFetching || (routes && routes.length > 1))
39
- ? 1
40
- : 0,
41
- } }, { children: isLoading || isFetching ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { minWidth: "80%", dense: true }), (0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { minWidth: "80%", dense: true })] })) : !currentRoute ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, { minWidth: "100%", dense: true })) : ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { minWidth: routes.length > 1 ? '80%' : '100%', route: currentRoute, active: true, dense: true }), routes.length > 1 ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { minWidth: "80%", route: routes[1], dense: true })) : null] })) })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: !routeNotFound ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ py: 1, pr: 1 }, { children: (0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ onClick: handleCardClick, size: "medium", "aria-label": "swap-routes", disabled: isValidating || !isValid }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.KeyboardArrowRight, {}) })) }))) : null }))] }))] })), (0, jsx_runtime_1.jsx)(GasSufficiencyMessage_1.GasSufficiencyMessage, Object.assign({ route: !isFetching ? currentRoute : undefined }, props)), (0, jsx_runtime_1.jsx)(SendToWallet_1.SendToWallet, { mx: 3, mb: 3 })] }));
42
- };
43
- exports.SwapRoutes = SwapRoutes;
@@ -1,11 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const Stack: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
3
- ref?: import("react").Ref<unknown> | undefined;
4
- children?: import("react").ReactNode;
5
- direction?: import("@mui/system").ResponsiveStyleValue<"row" | "column" | "column-reverse" | "row-reverse"> | undefined;
6
- spacing?: import("@mui/system").ResponsiveStyleValue<string | number> | undefined;
7
- divider?: import("react").ReactNode;
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?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
11
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | "direction" | ("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") | "divider" | "spacing"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -1,16 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Stack = void 0;
4
- const material_1 = require("@mui/material");
5
- const styles_1 = require("@mui/material/styles");
6
- exports.Stack = (0, styles_1.styled)(material_1.Stack)(({ theme }) => ({
7
- alignItems: 'stretch',
8
- display: 'flex',
9
- flex: 1,
10
- flexWrap: 'nowrap',
11
- overflow: 'hidden',
12
- borderRight: `solid ${theme.palette.mode === 'light'
13
- ? theme.palette.grey[300]
14
- : theme.palette.grey[800]}`,
15
- width: 'calc(100% - 48px)',
16
- }));
@@ -1,39 +0,0 @@
1
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
- /* eslint-disable react/no-array-index-key */
3
- import { KeyboardArrowRight as KeyboardArrowRightIcon } from '@mui/icons-material';
4
- import { Box, IconButton } from '@mui/material';
5
- import { useCallback } from 'react';
6
- import { useFormState } from 'react-hook-form';
7
- import { useTranslation } from 'react-i18next';
8
- import { useNavigate } from 'react-router-dom';
9
- import { Card, CardTitle } from '../../components/Card';
10
- import { GasSufficiencyMessage } from '../../components/GasSufficiencyMessage';
11
- import { ProgressToNextUpdate } from '../../components/ProgressToNextUpdate';
12
- import { SendToWallet } from '../../components/SendToWallet';
13
- import { SwapRouteCard, SwapRouteCardSkeleton, SwapRouteNotFoundCard, } from '../../components/SwapRouteCard';
14
- import { useSwapRoutes } from '../../hooks';
15
- import { navigationRoutes } from '../../utils';
16
- import { Stack } from './SwapRoutes.style';
17
- export const SwapRoutes = (props) => {
18
- const { t } = useTranslation();
19
- const navigate = useNavigate();
20
- const { isValid, isValidating } = useFormState();
21
- const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = useSwapRoutes();
22
- const handleCardClick = useCallback(() => {
23
- navigate(navigationRoutes.swapRoutes);
24
- }, [navigate]);
25
- const currentRoute = routes === null || routes === void 0 ? void 0 : routes[0];
26
- if (!currentRoute && !isLoading && !isFetching && !isFetched) {
27
- return null;
28
- }
29
- const routeNotFound = !currentRoute && !isLoading && !isFetching;
30
- return (_jsxs(_Fragment, { children: [_jsxs(Card, Object.assign({}, props, { children: [_jsx(CardTitle, { children: t('swap.routes') }), _jsx(ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: {
31
- position: 'absolute',
32
- top: 8,
33
- right: 8,
34
- } }), _jsxs(Box, Object.assign({ sx: { display: 'flex' } }, { children: [_jsx(Stack, Object.assign({ direction: "row", spacing: 2, my: 2, ml: 2, mr: routeNotFound ? 2 : 1, sx: {
35
- borderWidth: !routeNotFound && (isFetching || (routes && routes.length > 1))
36
- ? 1
37
- : 0,
38
- } }, { children: isLoading || isFetching ? (_jsxs(_Fragment, { children: [_jsx(SwapRouteCardSkeleton, { minWidth: "80%", dense: true }), _jsx(SwapRouteCardSkeleton, { minWidth: "80%", dense: true })] })) : !currentRoute ? (_jsx(SwapRouteNotFoundCard, { minWidth: "100%", dense: true })) : (_jsxs(_Fragment, { children: [_jsx(SwapRouteCard, { minWidth: routes.length > 1 ? '80%' : '100%', route: currentRoute, active: true, dense: true }), routes.length > 1 ? (_jsx(SwapRouteCard, { minWidth: "80%", route: routes[1], dense: true })) : null] })) })), _jsx(Box, Object.assign({ sx: { display: 'flex', alignItems: 'center' } }, { children: !routeNotFound ? (_jsx(Box, Object.assign({ py: 1, pr: 1 }, { children: _jsx(IconButton, Object.assign({ onClick: handleCardClick, size: "medium", "aria-label": "swap-routes", disabled: isValidating || !isValid }, { children: _jsx(KeyboardArrowRightIcon, {}) })) }))) : null }))] }))] })), _jsx(GasSufficiencyMessage, Object.assign({ route: !isFetching ? currentRoute : undefined }, props)), _jsx(SendToWallet, { mx: 3, mb: 3 })] }));
39
- };
@@ -1,11 +0,0 @@
1
- /// <reference types="react" />
2
- export declare const Stack: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
3
- ref?: import("react").Ref<unknown> | undefined;
4
- children?: import("react").ReactNode;
5
- direction?: import("@mui/system").ResponsiveStyleValue<"row" | "column" | "column-reverse" | "row-reverse"> | undefined;
6
- spacing?: import("@mui/system").ResponsiveStyleValue<string | number> | undefined;
7
- divider?: import("react").ReactNode;
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?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
11
- }, keyof import("@mui/material/OverridableComponent").CommonProps | "children" | "sx" | "ref" | "direction" | ("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") | "divider" | "spacing"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -1,13 +0,0 @@
1
- import { Stack as MuiStack } from '@mui/material';
2
- import { styled } from '@mui/material/styles';
3
- export const Stack = styled(MuiStack)(({ theme }) => ({
4
- alignItems: 'stretch',
5
- display: 'flex',
6
- flex: 1,
7
- flexWrap: 'nowrap',
8
- overflow: 'hidden',
9
- borderRight: `solid ${theme.palette.mode === 'light'
10
- ? theme.palette.grey[300]
11
- : theme.palette.grey[800]}`,
12
- width: 'calc(100% - 48px)',
13
- }));
@@ -1,4 +0,0 @@
1
- import { useRouteStore } from './useRouteStore';
2
- export const useSetExecutableRoute = () => {
3
- return useRouteStore((state) => state.setExecutableRoute);
4
- };