@lifi/widget 1.17.2 → 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 (211) 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.d.ts +1 -0
  15. package/cjs/components/ChainSelect/ChainSelect.js +3 -3
  16. package/cjs/components/ChainSelect/ChainSelect.style.d.ts +1 -0
  17. package/cjs/components/ChainSelect/ChainSelect.style.js +2 -2
  18. package/cjs/components/ChainSelect/useChainSelect.js +2 -2
  19. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.js +6 -2
  20. package/cjs/components/Header/Header.d.ts +2 -1
  21. package/cjs/components/Header/Header.js +3 -2
  22. package/cjs/components/Header/Header.style.js +3 -2
  23. package/cjs/components/Header/NavigationHeader.js +4 -1
  24. package/cjs/components/Header/WalletHeader.js +1 -1
  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/Step/CircularProgress.d.ts +1 -0
  36. package/cjs/components/StepActions/StepActions.style.js +1 -1
  37. package/cjs/components/SwapButton/ButtonTooltip.d.ts +1 -0
  38. package/cjs/components/SwapButton/SwapButton.d.ts +1 -1
  39. package/cjs/components/SwapButton/SwapButton.js +4 -4
  40. package/cjs/components/SwapInput/SwapInputAdornment.d.ts +1 -0
  41. package/cjs/components/SwapRouteCard/SwapRouteCard.d.ts +2 -1
  42. package/cjs/components/SwapRouteCard/SwapRouteCard.js +19 -15
  43. package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +30 -0
  44. package/cjs/components/SwapRouteCard/SwapRouteCard.style.js +16 -3
  45. package/cjs/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -12
  46. package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +1 -3
  47. package/cjs/components/SwapRouteCard/SwapRouteNotFoundCard.js +1 -13
  48. package/cjs/components/SwapRouteCard/types.d.ts +6 -2
  49. package/cjs/{pages/MainPage → components/SwapRoutes}/SwapRoutes.d.ts +0 -0
  50. package/cjs/components/SwapRoutes/SwapRoutes.js +51 -0
  51. package/cjs/components/SwapRoutes/SwapRoutes.style.d.ts +43 -0
  52. package/cjs/components/SwapRoutes/SwapRoutes.style.js +47 -0
  53. package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -0
  54. package/cjs/components/SwapRoutes/SwapRoutesExpanded.js +38 -0
  55. package/cjs/components/SwapRoutes/index.d.ts +2 -0
  56. package/cjs/components/SwapRoutes/index.js +18 -0
  57. package/cjs/components/Token/Token.d.ts +2 -1
  58. package/cjs/components/Token/Token.js +10 -6
  59. package/cjs/components/Token/Token.style.js +2 -0
  60. package/cjs/config/theme.js +20 -24
  61. package/cjs/config/version.d.ts +1 -1
  62. package/cjs/config/version.js +1 -1
  63. package/cjs/hooks/useChains.js +2 -2
  64. package/cjs/hooks/useNavigateBack.js +13 -6
  65. package/cjs/hooks/useRouteExecution.js +4 -4
  66. package/cjs/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +1 -0
  67. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
  68. package/cjs/pages/MainPage/MainPage.js +4 -2
  69. package/cjs/pages/MainPage/MainSwapButton.js +4 -4
  70. package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
  71. package/cjs/pages/SelectTokenPage/SelectTokenPage.js +4 -3
  72. package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
  73. package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +1 -0
  74. package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +1 -0
  75. package/cjs/pages/SettingsPage/SettingsPage.d.ts +1 -0
  76. package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -0
  77. package/cjs/pages/SettingsPage/SlippageInput.d.ts +1 -0
  78. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +1 -1
  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 +1 -1
  83. package/cjs/providers/WalletProvider/WalletProvider.js +2 -2
  84. package/cjs/stores/index.d.ts +2 -1
  85. package/cjs/stores/index.js +2 -1
  86. package/cjs/stores/{route → routes}/index.d.ts +2 -1
  87. package/cjs/stores/{route → routes}/index.js +2 -1
  88. package/cjs/stores/{route → routes}/types.d.ts +4 -0
  89. package/cjs/stores/routes/types.js +2 -0
  90. package/cjs/stores/{route → routes}/useExecutingRoutesIds.d.ts +0 -0
  91. package/cjs/stores/{route → routes}/useExecutingRoutesIds.js +2 -2
  92. package/cjs/stores/{route/useRouteStore.d.ts → routes/useRouteExecutionStore.d.ts} +1 -1
  93. package/cjs/stores/{route/useRouteStore.js → routes/useRouteExecutionStore.js} +2 -2
  94. package/cjs/stores/routes/useSelectedRouteStore.d.ts +4 -0
  95. package/cjs/stores/routes/useSelectedRouteStore.js +12 -0
  96. package/cjs/stores/{route → routes}/useSetExecutableRoute.d.ts +0 -0
  97. package/cjs/stores/{route → routes}/useSetExecutableRoute.js +2 -2
  98. package/cjs/stores/{route → routes}/useSwapHistory.d.ts +0 -0
  99. package/cjs/stores/{route → routes}/useSwapHistory.js +2 -2
  100. package/cjs/stores/{route → routes}/utils.d.ts +0 -0
  101. package/cjs/stores/{route → routes}/utils.js +0 -0
  102. package/cjs/stores/settings/useSettingsStore.js +1 -1
  103. package/cjs/types/widget.d.ts +2 -0
  104. package/cjs/utils/colors.d.ts +1 -1
  105. package/cjs/utils/navigationRoutes.js +12 -12
  106. package/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -0
  107. package/components/AppContainer.d.ts +4 -5
  108. package/components/AppContainer.js +29 -28
  109. package/components/Card/Card.d.ts +1 -0
  110. package/components/Card/Card.js +13 -9
  111. package/components/ChainSelect/ChainSelect.d.ts +1 -0
  112. package/components/ChainSelect/ChainSelect.js +1 -1
  113. package/components/ChainSelect/ChainSelect.style.d.ts +1 -0
  114. package/components/ChainSelect/ChainSelect.style.js +2 -2
  115. package/components/ChainSelect/useChainSelect.js +1 -1
  116. package/components/GasSufficiencyMessage/GasSufficiencyMessage.js +6 -2
  117. package/components/Header/Header.d.ts +2 -1
  118. package/components/Header/Header.js +1 -1
  119. package/components/Header/Header.style.js +4 -3
  120. package/components/Header/NavigationHeader.js +4 -1
  121. package/components/Header/WalletHeader.js +2 -2
  122. package/components/PoweredBy/PoweredBy.js +7 -0
  123. package/components/SendToWallet/SendToWallet.js +8 -11
  124. package/components/SendToWallet/SendToWalletButton.d.ts +2 -0
  125. package/components/SendToWallet/SendToWalletButton.js +20 -0
  126. package/components/SendToWallet/index.d.ts +1 -0
  127. package/components/SendToWallet/index.js +1 -0
  128. package/components/SendToWallet/store.d.ts +4 -0
  129. package/components/SendToWallet/store.js +10 -0
  130. package/components/SendToWallet/types.d.ts +6 -0
  131. package/{stores/route → components/SendToWallet}/types.js +0 -0
  132. package/components/Step/CircularProgress.d.ts +1 -0
  133. package/components/StepActions/StepActions.style.js +1 -1
  134. package/components/SwapButton/ButtonTooltip.d.ts +1 -0
  135. package/components/SwapButton/SwapButton.d.ts +1 -1
  136. package/components/SwapButton/SwapButton.js +4 -3
  137. package/components/SwapInput/SwapInputAdornment.d.ts +1 -0
  138. package/components/SwapRouteCard/SwapRouteCard.d.ts +2 -1
  139. package/components/SwapRouteCard/SwapRouteCard.js +19 -16
  140. package/components/SwapRouteCard/SwapRouteCard.style.d.ts +30 -0
  141. package/components/SwapRouteCard/SwapRouteCard.style.js +17 -4
  142. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +2 -12
  143. package/components/SwapRouteCard/SwapRouteNotFoundCard.d.ts +1 -3
  144. package/components/SwapRouteCard/SwapRouteNotFoundCard.js +1 -13
  145. package/components/SwapRouteCard/types.d.ts +6 -2
  146. package/{pages/MainPage → components/SwapRoutes}/SwapRoutes.d.ts +0 -0
  147. package/components/SwapRoutes/SwapRoutes.js +47 -0
  148. package/components/SwapRoutes/SwapRoutes.style.d.ts +43 -0
  149. package/components/SwapRoutes/SwapRoutes.style.js +44 -0
  150. package/components/SwapRoutes/SwapRoutesExpanded.d.ts +2 -0
  151. package/components/SwapRoutes/SwapRoutesExpanded.js +34 -0
  152. package/components/SwapRoutes/index.d.ts +2 -0
  153. package/components/SwapRoutes/index.js +2 -0
  154. package/components/Token/Token.d.ts +2 -1
  155. package/components/Token/Token.js +11 -7
  156. package/components/Token/Token.style.js +2 -0
  157. package/config/theme.js +20 -24
  158. package/config/version.d.ts +1 -1
  159. package/config/version.js +1 -1
  160. package/hooks/useChains.js +1 -1
  161. package/hooks/useNavigateBack.js +13 -6
  162. package/hooks/useRouteExecution.js +5 -5
  163. package/package.json +11 -11
  164. package/pages/ActiveSwapsPage/ActiveSwapsEmpty.js +1 -0
  165. package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +1 -0
  166. package/pages/MainPage/MainPage.js +4 -2
  167. package/pages/MainPage/MainSwapButton.js +4 -3
  168. package/pages/SelectTokenPage/SearchTokenInput.d.ts +1 -0
  169. package/pages/SelectTokenPage/SelectTokenPage.js +4 -3
  170. package/pages/SelectWalletPage/SelectWalletPage.d.ts +1 -0
  171. package/pages/SettingsPage/AdvancedPreferences.d.ts +1 -0
  172. package/pages/SettingsPage/GasPriceSelect.d.ts +1 -0
  173. package/pages/SettingsPage/SettingsPage.d.ts +1 -0
  174. package/pages/SettingsPage/ShowDestinationWallet.d.ts +1 -0
  175. package/pages/SettingsPage/SlippageInput.d.ts +1 -0
  176. package/pages/SwapDetailsPage/SwapDetailsPage.js +2 -2
  177. package/pages/SwapHistoryPage/SwapHistoryEmpty.js +1 -0
  178. package/pages/SwapHistoryPage/SwapHistoryPage.js +8 -5
  179. package/pages/SwapPage/SwapPage.js +5 -1
  180. package/pages/SwapRoutesPage/SwapRoutesPage.js +1 -1
  181. package/providers/WalletProvider/WalletProvider.js +1 -1
  182. package/stores/index.d.ts +2 -1
  183. package/stores/index.js +2 -1
  184. package/stores/{route → routes}/index.d.ts +2 -1
  185. package/stores/{route → routes}/index.js +2 -1
  186. package/stores/{route → routes}/types.d.ts +4 -0
  187. package/stores/routes/types.js +1 -0
  188. package/stores/{route → routes}/useExecutingRoutesIds.d.ts +0 -0
  189. package/stores/{route → routes}/useExecutingRoutesIds.js +2 -2
  190. package/stores/{route/useRouteStore.d.ts → routes/useRouteExecutionStore.d.ts} +1 -1
  191. package/stores/{route/useRouteStore.js → routes/useRouteExecutionStore.js} +1 -1
  192. package/stores/routes/useSelectedRouteStore.d.ts +4 -0
  193. package/stores/routes/useSelectedRouteStore.js +9 -0
  194. package/stores/{route → routes}/useSetExecutableRoute.d.ts +0 -0
  195. package/stores/routes/useSetExecutableRoute.js +4 -0
  196. package/stores/{route → routes}/useSwapHistory.d.ts +0 -0
  197. package/stores/{route → routes}/useSwapHistory.js +2 -2
  198. package/stores/{route → routes}/utils.d.ts +0 -0
  199. package/stores/{route → routes}/utils.js +0 -0
  200. package/stores/settings/useSettingsStore.js +1 -1
  201. package/tsconfig.cjs.tsbuildinfo +1 -1
  202. package/types/widget.d.ts +2 -0
  203. package/utils/colors.d.ts +1 -1
  204. package/utils/navigationRoutes.js +12 -12
  205. package/cjs/pages/MainPage/SwapRoutes.js +0 -43
  206. package/cjs/pages/MainPage/SwapRoutes.style.d.ts +0 -11
  207. package/cjs/pages/MainPage/SwapRoutes.style.js +0 -16
  208. package/pages/MainPage/SwapRoutes.js +0 -39
  209. package/pages/MainPage/SwapRoutes.style.d.ts +0 -11
  210. package/pages/MainPage/SwapRoutes.style.js +0 -13
  211. package/stores/route/useSetExecutableRoute.js +0 -4
@@ -0,0 +1,43 @@
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>, {}, {}>;
12
+ export declare const CollapseContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
13
+ children?: import("react").ReactNode;
14
+ component?: import("react").ElementType<any> | undefined;
15
+ ref?: import("react").Ref<unknown> | undefined;
16
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
17
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
18
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
19
+ }, 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>, {}, {}>;
20
+ export declare const ScrollableContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
21
+ children?: import("react").ReactNode;
22
+ component?: import("react").ElementType<any> | undefined;
23
+ ref?: import("react").Ref<unknown> | undefined;
24
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
25
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
26
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
27
+ }, 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>, {}, {}>;
28
+ export declare const Container: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
29
+ children?: import("react").ReactNode;
30
+ component?: import("react").ElementType<any> | undefined;
31
+ ref?: import("react").Ref<unknown> | undefined;
32
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
33
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
34
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
35
+ }, 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>, {}, {}>;
36
+ export declare const Header: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
37
+ children?: import("react").ReactNode;
38
+ component?: import("react").ElementType<any> | undefined;
39
+ ref?: import("react").Ref<unknown> | undefined;
40
+ sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
41
+ } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
42
+ ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
43
+ }, 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>, {}, {}>;
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Header = exports.Container = exports.ScrollableContainer = exports.CollapseContainer = exports.Stack = void 0;
4
+ const material_1 = require("@mui/material");
5
+ const styles_1 = require("@mui/material/styles");
6
+ const AppContainer_1 = require("../AppContainer");
7
+ exports.Stack = (0, styles_1.styled)(material_1.Stack)(({ theme }) => ({
8
+ alignItems: 'stretch',
9
+ display: 'flex',
10
+ flex: 1,
11
+ flexWrap: 'nowrap',
12
+ overflow: 'hidden',
13
+ borderRight: `solid ${theme.palette.mode === 'light'
14
+ ? theme.palette.grey[300]
15
+ : theme.palette.grey[800]}`,
16
+ width: 'calc(100% - 48px)',
17
+ }));
18
+ exports.CollapseContainer = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
19
+ height: AppContainer_1.maxHeight,
20
+ }));
21
+ exports.ScrollableContainer = (0, styles_1.styled)(material_1.Box)({
22
+ overflowY: 'auto',
23
+ height: '100%',
24
+ flex: 1,
25
+ display: 'flex',
26
+ flexDirection: 'column',
27
+ });
28
+ exports.Container = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
29
+ backgroundColor: theme.palette.background.default,
30
+ overflow: 'auto',
31
+ width: 436,
32
+ maxHeight: AppContainer_1.maxHeight,
33
+ marginLeft: theme.spacing(3),
34
+ display: 'flex',
35
+ flexDirection: 'column',
36
+ }));
37
+ exports.Header = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
38
+ backgroundColor: (0, styles_1.alpha)(theme.palette.background.default, 0.84),
39
+ backdropFilter: 'blur(12px)',
40
+ display: 'flex',
41
+ justifyContent: 'space-between',
42
+ alignItems: 'center',
43
+ padding: theme.spacing(1.5, 3),
44
+ position: 'sticky',
45
+ top: 0,
46
+ zIndex: 1200,
47
+ }));
@@ -0,0 +1,2 @@
1
+ /// <reference types="react" />
2
+ export declare const SwapRoutesExpanded: () => JSX.Element;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SwapRoutesExpanded = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const material_1 = require("@mui/material");
6
+ const react_i18next_1 = require("react-i18next");
7
+ const react_router_dom_1 = require("react-router-dom");
8
+ const hooks_1 = require("../../hooks");
9
+ const providers_1 = require("../../providers");
10
+ const stores_1 = require("../../stores");
11
+ const utils_1 = require("../../utils");
12
+ const ProgressToNextUpdate_1 = require("../ProgressToNextUpdate");
13
+ const SwapRouteCard_1 = require("../SwapRouteCard");
14
+ const SwapRoutes_style_1 = require("./SwapRoutes.style");
15
+ const SwapRoutesExpanded = () => {
16
+ const { t } = (0, react_i18next_1.useTranslation)();
17
+ const { containerStyle } = (0, providers_1.useWidgetConfig)();
18
+ const navigate = (0, react_router_dom_1.useNavigate)();
19
+ const { routes, isLoading, isFetching, isFetched, dataUpdatedAt, refetchTime, refetch, } = (0, hooks_1.useSwapRoutes)();
20
+ const setExecutableRoute = (0, stores_1.useSetExecutableRoute)();
21
+ const { pathname } = (0, react_router_dom_1.useLocation)();
22
+ const cleanedPathname = pathname.endsWith('/')
23
+ ? pathname.slice(0, -1)
24
+ : pathname;
25
+ const path = cleanedPathname.substring(cleanedPathname.lastIndexOf('/') + 1);
26
+ const hasPath = utils_1.navigationRoutesValues.includes(path);
27
+ const handleRouteClick = (route) => {
28
+ setExecutableRoute(route);
29
+ navigate(utils_1.navigationRoutes.swapExecution, {
30
+ state: { routeId: route.id },
31
+ });
32
+ };
33
+ const currentRoute = routes === null || routes === void 0 ? void 0 : routes[0];
34
+ const expanded = Boolean(currentRoute || isLoading || isFetching || isFetched) && !hasPath;
35
+ const routeNotFound = !currentRoute && !isLoading && !isFetching && expanded;
36
+ return ((0, jsx_runtime_1.jsx)(SwapRoutes_style_1.CollapseContainer, { children: (0, jsx_runtime_1.jsx)(material_1.Collapse, Object.assign({ appear: true, timeout: 225, in: expanded, orientation: "horizontal" }, { children: (0, jsx_runtime_1.jsx)(material_1.Grow, Object.assign({ appear: true, timeout: 225, in: expanded }, { children: (0, jsx_runtime_1.jsx)(SwapRoutes_style_1.Container, Object.assign({ sx: containerStyle }, { children: (0, jsx_runtime_1.jsxs)(SwapRoutes_style_1.ScrollableContainer, { children: [(0, jsx_runtime_1.jsxs)(SwapRoutes_style_1.Header, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 18, fontWeight: "700", flex: 1, noWrap: true }, { children: t('swap.routes') })), (0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 } })] }), (0, jsx_runtime_1.jsx)(material_1.Stack, Object.assign({ direction: "column", spacing: 2, flex: 1, paddingX: 3, paddingBottom: 3 }, { children: routeNotFound ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : isLoading || isFetching ? (Array.from({ length: 3 }).map((_, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, { variant: "extended" }, index)))) : (routes === null || routes === void 0 ? void 0 : routes.map((route, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0, variant: "extended" }, route.id)))) }))] }) })) })) })) }));
37
+ };
38
+ exports.SwapRoutesExpanded = SwapRoutesExpanded;
@@ -0,0 +1,2 @@
1
+ export * from './SwapRoutes';
2
+ export * from './SwapRoutesExpanded';
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./SwapRoutes"), exports);
18
+ __exportStar(require("./SwapRoutesExpanded"), exports);
@@ -1,7 +1,8 @@
1
1
  /// <reference types="react" />
2
- import type { TokenAmount } from '@lifi/sdk';
2
+ import type { Step, TokenAmount } from '@lifi/sdk';
3
3
  import type { BoxProps } from '@mui/material';
4
4
  export declare const Token: React.FC<{
5
5
  token: TokenAmount;
6
6
  connected?: boolean;
7
+ step?: Step;
7
8
  } & BoxProps>;
@@ -17,19 +17,23 @@ const material_1 = require("@mui/material");
17
17
  const react_i18next_1 = require("react-i18next");
18
18
  const hooks_1 = require("../../hooks");
19
19
  const utils_1 = require("../../utils");
20
+ const SmallAvatar_1 = require("../SmallAvatar");
20
21
  const TextFitter_1 = require("../TextFitter");
21
22
  const TokenAvatar_1 = require("../TokenAvatar");
22
23
  const Token_style_1 = require("./Token.style");
23
24
  const Token = (_a) => {
24
25
  var _b;
25
- var { token, connected } = _a, other = __rest(_a, ["token", "connected"]);
26
+ var { token, connected, step } = _a, other = __rest(_a, ["token", "connected", "step"]);
26
27
  const { t } = (0, react_i18next_1.useTranslation)();
27
28
  const { getChainById } = (0, hooks_1.useChains)();
28
- return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ flex: 1 }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", flex: 1 }, { children: [(0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: token, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(TextFitter_1.TextFitter, Object.assign({ height: 32, textStyle: {
29
+ return ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ flex: 1 }, other, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", flex: 1, alignItems: "center" }, { children: [(0, jsx_runtime_1.jsx)(TokenAvatar_1.TokenAvatar, { token: token, sx: { marginRight: 2 } }), (0, jsx_runtime_1.jsx)(TextFitter_1.TextFitter, Object.assign({ height: 30, textStyle: {
29
30
  fontWeight: 700,
30
- } }, { children: (0, utils_1.formatTokenAmount)(token.amount, token.decimals) }))] })), (0, jsx_runtime_1.jsx)(Token_style_1.TextSecondary, Object.assign({ connected: connected }, { children: t(`swap.tokenOnChain`, {
31
- tokenSymbol: token.symbol,
32
- chainName: (_b = getChainById(token.chainId)) === null || _b === void 0 ? void 0 : _b.name,
33
- }) }))] })));
31
+ } }, { children: (0, utils_1.formatTokenAmount)(token.amount, token.decimals) }))] })), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex" }, { children: [(0, jsx_runtime_1.jsx)(Token_style_1.TextSecondary, Object.assign({ connected: connected }, { children: t(`swap.tokenOnChain`, {
32
+ tokenSymbol: token.symbol,
33
+ chainName: (_b = getChainById(token.chainId)) === null || _b === void 0 ? void 0 : _b.name,
34
+ }) })), step ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ display: "flex", alignItems: "flex-end", height: 12, mt: 0.5 }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12, lineHeight: 1, fontWeight: 500, color: "text.secondary", px: 1 }, { children: "\u2022" })), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ pr: 0.75 }, { children: (0, jsx_runtime_1.jsx)(SmallAvatar_1.SmallAvatar, Object.assign({ src: step.toolDetails.logoURI, alt: step.toolDetails.name, sx: {
35
+ border: 0,
36
+ marginBottom: -0.25,
37
+ } }, { children: step.toolDetails.name[0] })) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 12, lineHeight: 1, fontWeight: 500, color: "text.secondary" }, { children: step.toolDetails.name }))] }))) : null] }))] })));
34
38
  };
35
39
  exports.Token = Token;
@@ -21,6 +21,8 @@ exports.TextSecondary = (0, styles_1.styled)(material_1.Typography, {
21
21
  padding: connected
22
22
  ? theme.spacing(0, 0, 0, 3.875)
23
23
  : theme.spacing(0, 0, 0, 0),
24
+ display: 'flex',
25
+ alignItems: 'flex-start',
24
26
  }));
25
27
  exports.TokenDivider = (0, styles_1.styled)(material_1.Box)(({ theme }) => ({
26
28
  height: 12,
@@ -28,6 +28,17 @@ const palette = {
28
28
  main: '#297EFF',
29
29
  },
30
30
  };
31
+ const paletteLight = {
32
+ text: {
33
+ primary: '#000000',
34
+ secondary: '#747474',
35
+ },
36
+ };
37
+ const paletteDark = {
38
+ background: {
39
+ paper: '#212121',
40
+ },
41
+ };
31
42
  const shape = {
32
43
  borderRadius: 12,
33
44
  borderRadiusSecondary: 6,
@@ -47,27 +58,7 @@ const createTheme = (mode, theme = {}) => {
47
58
  main: (_m = (_l = (_k = theme.palette) === null || _k === void 0 ? void 0 : _k.secondary) === null || _l === void 0 ? void 0 : _l.main) !== null && _m !== void 0 ? _m : palette.secondary.main,
48
59
  light: (0, styles_1.lighten)((_q = (_p = (_o = theme.palette) === null || _o === void 0 ? void 0 : _o.secondary) === null || _p === void 0 ? void 0 : _p.main) !== null && _q !== void 0 ? _q : palette.secondary.main, 0.5),
49
60
  dark: (0, styles_1.darken)((_t = (_s = (_r = theme.palette) === null || _r === void 0 ? void 0 : _r.secondary) === null || _s === void 0 ? void 0 : _s.main) !== null && _t !== void 0 ? _t : palette.secondary.main, 0.2),
50
- } }), (mode === 'light'
51
- ? {
52
- text: {
53
- primary: '#000',
54
- secondary: '#52575b',
55
- },
56
- grey: {
57
- 100: '#F4F5F6',
58
- 200: '#EFF1F2',
59
- 300: '#E3E7E9',
60
- 400: '#C6C9CD',
61
- 500: '#AEB3B7',
62
- 600: '#798086',
63
- 700: '#57595C',
64
- },
65
- }
66
- : {
67
- background: {
68
- paper: '#212121',
69
- },
70
- })),
61
+ } }), (mode === 'light' ? paletteLight : paletteDark)),
71
62
  shape: Object.assign(Object.assign({}, shape), theme.shape),
72
63
  breakpoints: {
73
64
  values: {
@@ -99,6 +90,11 @@ const createTheme = (mode, theme = {}) => {
99
90
  cursor: 'not-allowed',
100
91
  pointerEvents: 'auto',
101
92
  },
93
+ }, text: {
94
+ backgroundColor: (0, styles_1.alpha)(primaryMainColor, 0.08),
95
+ '&:hover': {
96
+ backgroundColor: (0, styles_1.alpha)(primaryMainColor, 0.12),
97
+ },
102
98
  }, contained: {
103
99
  '&:hover': {
104
100
  color: (0, styles_1.getContrastRatio)(colors_1.common.white, primaryMainColor) >= 3
@@ -121,10 +117,10 @@ const createTheme = (mode, theme = {}) => {
121
117
  },
122
118
  },
123
119
  text: {
124
- color: primaryLightColor,
120
+ backgroundColor: paletteDark.background.paper,
121
+ color: colors_1.common.white,
125
122
  '&:hover': {
126
- backgroundColor: (0, styles_1.alpha)(primaryLightColor, 0.08),
127
- borderColor: primaryLightColor,
123
+ backgroundColor: (0, styles_1.lighten)(paletteDark.background.paper, 0.02),
128
124
  },
129
125
  },
130
126
  }
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/widget";
2
- export declare const version = "1.17.2";
2
+ export declare const version = "1.18.0";
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.version = exports.name = void 0;
4
4
  exports.name = '@lifi/widget';
5
- exports.version = '1.17.2';
5
+ exports.version = '1.18.0';
@@ -14,7 +14,7 @@ const react_query_1 = require("@tanstack/react-query");
14
14
  const react_1 = require("react");
15
15
  const react_hook_form_1 = require("react-hook-form");
16
16
  const providers_1 = require("../providers");
17
- const chains_1 = require("../stores/chains");
17
+ const stores_1 = require("../stores");
18
18
  const useChains = () => {
19
19
  const { disabledChains, chains } = (0, providers_1.useWidgetConfig)();
20
20
  const lifi = (0, providers_1.useLiFi)();
@@ -22,7 +22,7 @@ const useChains = () => {
22
22
  const { data, isLoading } = (0, react_query_1.useQuery)(['chains'], () => __awaiter(void 0, void 0, void 0, function* () {
23
23
  const availableChains = yield lifi.getChains();
24
24
  const filteredChains = availableChains.filter((chain) => (0, providers_1.isItemAllowed)(chain.id, chains, disabledChains));
25
- const chainOrder = chains_1.useChainOrderStore
25
+ const chainOrder = stores_1.useChainOrderStore
26
26
  .getState()
27
27
  .initializeChains(filteredChains.map((chain) => chain.id));
28
28
  const [fromChainValue, toChainValue] = getValues([
@@ -6,12 +6,19 @@ const react_router_dom_1 = require("react-router-dom");
6
6
  const useNavigateBack = () => {
7
7
  const navigate = (0, react_router_dom_1.useNavigate)();
8
8
  const navigateBack = (0, react_1.useCallback)(() => {
9
- if (window.history.state && window.history.state.idx > 0) {
10
- navigate(-1);
11
- }
12
- else {
13
- navigate(window.location.pathname.substring(0, window.location.pathname.lastIndexOf('/')) || '/', { replace: true });
14
- }
9
+ // https://github.com/remix-run/react-router/pull/9112
10
+ //
11
+ // if (window.history.length > 2) {
12
+ navigate(-1);
13
+ // } else {
14
+ // navigate(
15
+ // window.location.pathname.substring(
16
+ // 0,
17
+ // window.location.pathname.lastIndexOf('/'),
18
+ // ) || '/',
19
+ // { replace: true },
20
+ // );
21
+ // }
15
22
  }, [navigate]);
16
23
  return { navigateBack, navigate };
17
24
  };
@@ -23,10 +23,10 @@ const useRouteExecution = (routeId, executeInBackground) => {
23
23
  const { account, switchChain } = (0, providers_1.useWallet)();
24
24
  const resumedAfterMount = (0, react_1.useRef)(false);
25
25
  const emitter = (0, useWidgetEvents_1.useWidgetEvents)();
26
- const routeExecution = (0, stores_1.useRouteStore)((state) => state.routes[routeId]);
27
- const [updateRoute, restartRoute, deleteRoute] = (0, stores_1.useRouteStore)((state) => [state.updateRoute, state.restartRoute, state.deleteRoute], shallow_1.default);
26
+ const routeExecution = (0, stores_1.useRouteExecutionStore)((state) => state.routes[routeId]);
27
+ const [updateRoute, restartRoute, deleteRoute] = (0, stores_1.useRouteExecutionStore)((state) => [state.updateRoute, state.restartRoute, state.deleteRoute], shallow_1.default);
28
28
  const updateCallback = (updatedRoute) => {
29
- const routeExecution = stores_1.useRouteStore.getState().routes[updatedRoute.id];
29
+ const routeExecution = stores_1.useRouteExecutionStore.getState().routes[updatedRoute.id];
30
30
  if (!routeExecution) {
31
31
  return;
32
32
  }
@@ -147,7 +147,7 @@ const useRouteExecution = (routeId, executeInBackground) => {
147
147
  (0, react_1.useEffect)(() => {
148
148
  return () => {
149
149
  var _a;
150
- const route = (_a = stores_1.useRouteStore.getState().routes[routeId]) === null || _a === void 0 ? void 0 : _a.route;
150
+ const route = (_a = stores_1.useRouteExecutionStore.getState().routes[routeId]) === null || _a === void 0 ? void 0 : _a.route;
151
151
  if (!route || !(0, stores_1.isRouteActive)(route)) {
152
152
  return;
153
153
  }
@@ -13,6 +13,7 @@ const ActiveSwapsEmpty = () => {
13
13
  flexDirection: 'column',
14
14
  alignItems: 'center',
15
15
  justifyContent: 'center',
16
+ paddingY: 12,
16
17
  } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 48 }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.SwapHoriz, { fontSize: "inherit" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 18, fontWeight: 700 }, { children: t('swap.info.title.emptyActiveSwaps') })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.secondary", textAlign: "center", mt: 2 }, { children: t('swap.info.message.emptyActiveSwaps') }))] })));
17
18
  };
18
19
  exports.ActiveSwapsEmpty = ActiveSwapsEmpty;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const ActiveSwapsPage: () => JSX.Element;
@@ -4,12 +4,14 @@ exports.MainPage = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
5
  const material_1 = require("@mui/material");
6
6
  const ActiveSwaps_1 = require("../../components/ActiveSwaps");
7
+ const GasSufficiencyMessage_1 = require("../../components/GasSufficiencyMessage");
7
8
  const SelectChainAndToken_1 = require("../../components/SelectChainAndToken");
9
+ const SendToWallet_1 = require("../../components/SendToWallet");
8
10
  const SwapInput_1 = require("../../components/SwapInput");
11
+ const SwapRoutes_1 = require("../../components/SwapRoutes");
9
12
  const MainPage_style_1 = require("./MainPage.style");
10
13
  const MainSwapButton_1 = require("./MainSwapButton");
11
- const SwapRoutes_1 = require("./SwapRoutes");
12
14
  const MainPage = () => {
13
- return ((0, jsx_runtime_1.jsxs)(MainPage_style_1.FormContainer, Object.assign({ disableGutters: true }, { children: [(0, jsx_runtime_1.jsx)(ActiveSwaps_1.ActiveSwaps, { mx: 3, mt: 1, mb: 2 }), (0, jsx_runtime_1.jsx)(SelectChainAndToken_1.SelectChainAndToken, { mt: 1, mx: 3, mb: 3 }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mx: 3, mb: 3 }, { children: (0, jsx_runtime_1.jsx)(SwapInput_1.SwapInput, { formType: "from" }) })), (0, jsx_runtime_1.jsx)(SwapRoutes_1.SwapRoutes, { mx: 3, mb: 3 }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mx: 3, mb: 1 }, { children: (0, jsx_runtime_1.jsx)(MainSwapButton_1.MainSwapButton, {}) }))] })));
15
+ return ((0, jsx_runtime_1.jsxs)(MainPage_style_1.FormContainer, Object.assign({ disableGutters: true }, { children: [(0, jsx_runtime_1.jsx)(ActiveSwaps_1.ActiveSwaps, { mx: 3, mt: 1, mb: 2 }), (0, jsx_runtime_1.jsx)(SelectChainAndToken_1.SelectChainAndToken, { mt: 1, mx: 3, mb: 3 }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mx: 3, mb: 3 }, { children: (0, jsx_runtime_1.jsx)(SwapInput_1.SwapInput, { formType: "from" }) })), (0, jsx_runtime_1.jsx)(SwapRoutes_1.SwapRoutes, { mx: 3, mb: 3 }), (0, jsx_runtime_1.jsx)(GasSufficiencyMessage_1.GasSufficiencyMessage, { mx: 3, mb: 3 }), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ mx: 3, mb: 1 }, { children: [(0, jsx_runtime_1.jsx)(SendToWallet_1.SendToWallet, { mb: 3 }), (0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ sx: { display: 'flex' } }, { children: [(0, jsx_runtime_1.jsx)(MainSwapButton_1.MainSwapButton, {}), (0, jsx_runtime_1.jsx)(SendToWallet_1.SendToWalletButton, {})] }))] }))] })));
14
16
  };
15
17
  exports.MainPage = MainPage;
@@ -11,13 +11,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.MainSwapButton = void 0;
13
13
  const jsx_runtime_1 = require("react/jsx-runtime");
14
+ const react_1 = require("react");
14
15
  const react_hook_form_1 = require("react-hook-form");
15
16
  const react_router_dom_1 = require("react-router-dom");
16
17
  const SwapButton_1 = require("../../components/SwapButton");
17
18
  const hooks_1 = require("../../hooks");
18
19
  const stores_1 = require("../../stores");
19
20
  const utils_1 = require("../../utils");
20
- const MainSwapButton = () => {
21
+ exports.MainSwapButton = (0, react_1.forwardRef)((_, ref) => {
21
22
  const navigate = (0, react_router_dom_1.useNavigate)();
22
23
  const { isValid, isValidating } = (0, react_hook_form_1.useFormState)();
23
24
  const setExecutableRoute = (0, stores_1.useSetExecutableRoute)();
@@ -31,6 +32,5 @@ const MainSwapButton = () => {
31
32
  });
32
33
  }
33
34
  });
34
- return ((0, jsx_runtime_1.jsx)(SwapButton_1.SwapButton, { onClick: handleClick, currentRoute: currentRoute, disable: isLoading || isFetching || isValidating || !isValid }));
35
- };
36
- exports.MainSwapButton = MainSwapButton;
35
+ return ((0, jsx_runtime_1.jsx)(SwapButton_1.SwapButton, { onClick: handleClick, currentRoute: currentRoute, disable: isLoading || isFetching || isValidating || !isValid, ref: ref }));
36
+ });
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const SearchTokenInput: () => JSX.Element;
@@ -8,16 +8,17 @@ const ChainSelect_1 = require("../../components/ChainSelect");
8
8
  const TokenList_1 = require("../../components/TokenList");
9
9
  const hooks_1 = require("../../hooks");
10
10
  const SearchTokenInput_1 = require("./SearchTokenInput");
11
+ const minTokenListHeight = 330;
11
12
  const SelectTokenPage = ({ formType }) => {
12
13
  (0, hooks_1.useScrollableOverflowHidden)();
13
14
  const { navigateBack } = (0, hooks_1.useNavigateBack)();
14
15
  const headerRef = (0, react_1.useRef)(null);
15
16
  const contentHeight = (0, hooks_1.useContentHeight)();
16
- const [headerHeight, setHeaderHeight] = (0, react_1.useState)(0);
17
+ const [tokenListHeight, setTokenListHeight] = (0, react_1.useState)(0);
17
18
  (0, react_1.useLayoutEffect)(() => {
18
19
  var _a, _b;
19
- setHeaderHeight(contentHeight - ((_b = (_a = headerRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0));
20
+ setTokenListHeight(Math.max(contentHeight - ((_b = (_a = headerRef.current) === null || _a === void 0 ? void 0 : _a.offsetHeight) !== null && _b !== void 0 ? _b : 0), minTokenListHeight));
20
21
  }, [contentHeight]);
21
- return ((0, jsx_runtime_1.jsxs)(material_1.Container, Object.assign({ disableGutters: true }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ pt: 1, pb: 2, px: 3, ref: headerRef }, { children: [(0, jsx_runtime_1.jsx)(ChainSelect_1.ChainSelect, { formType: formType }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsx)(SearchTokenInput_1.SearchTokenInput, {}) }))] })), (0, jsx_runtime_1.jsx)(TokenList_1.TokenList, { height: headerHeight, onClick: navigateBack, formType: formType })] })));
22
+ return ((0, jsx_runtime_1.jsxs)(material_1.Container, Object.assign({ disableGutters: true }, { children: [(0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ pt: 1, pb: 2, px: 3, ref: headerRef }, { children: [(0, jsx_runtime_1.jsx)(ChainSelect_1.ChainSelect, { formType: formType }), (0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsx)(SearchTokenInput_1.SearchTokenInput, {}) }))] })), (0, jsx_runtime_1.jsx)(TokenList_1.TokenList, { height: tokenListHeight, onClick: navigateBack, formType: formType })] })));
22
23
  };
23
24
  exports.SelectTokenPage = SelectTokenPage;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const SelectWalletPage: () => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const AdvancedPreferences: () => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const GasPriceSelect: () => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const SettingsPage: () => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const ShowDestinationWallet: () => JSX.Element;
@@ -1 +1,2 @@
1
+ /// <reference types="react" />
1
2
  export declare const SlippageInput: () => JSX.Element;
@@ -30,7 +30,7 @@ const SwapDetailsPage = () => {
30
30
  const { t } = (0, react_i18next_1.useTranslation)();
31
31
  const { navigateBack } = (0, hooks_1.useNavigateBack)();
32
32
  const { state } = (0, react_router_dom_1.useLocation)();
33
- const [routeExecution, deleteRoute] = (0, stores_1.useRouteStore)((store) => [store.routes[state === null || state === void 0 ? void 0 : state.routeId], store.deleteRoute], shallow_1.default);
33
+ const [routeExecution, deleteRoute] = (0, stores_1.useRouteExecutionStore)((store) => [store.routes[state === null || state === void 0 ? void 0 : state.routeId], store.deleteRoute], shallow_1.default);
34
34
  const [open, setOpen] = (0, react_1.useState)(false);
35
35
  const toggleDialog = (0, react_1.useCallback)(() => {
36
36
  setOpen((open) => !open);
@@ -13,6 +13,7 @@ const SwapHistoryEmpty = () => {
13
13
  flexDirection: 'column',
14
14
  alignItems: 'center',
15
15
  justifyContent: 'center',
16
+ paddingY: 12,
16
17
  } }, { children: [(0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 48 }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.History, { fontSize: "inherit" }) })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 18, fontWeight: 700 }, { children: t('swap.info.title.emptySwapHistory') })), (0, jsx_runtime_1.jsx)(material_1.Typography, Object.assign({ fontSize: 14, color: "text.secondary", textAlign: "center", mt: 2 }, { children: t('swap.info.message.emptySwapHistory') }))] })));
17
18
  };
18
19
  exports.SwapHistoryEmpty = SwapHistoryEmpty;
@@ -2,6 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SwapHistoryPage = void 0;
4
4
  const jsx_runtime_1 = require("react/jsx-runtime");
5
+ /* eslint-disable consistent-return */
5
6
  const icons_material_1 = require("@mui/icons-material");
6
7
  const material_1 = require("@mui/material");
7
8
  const react_1 = require("react");
@@ -10,21 +11,23 @@ const Dialog_1 = require("../../components/Dialog");
10
11
  const Header_1 = require("../../components/Header");
11
12
  const providers_1 = require("../../providers");
12
13
  const stores_1 = require("../../stores");
13
- const route_1 = require("../../stores/route");
14
+ const routes_1 = require("../../stores/routes");
14
15
  const SwapHistoryEmpty_1 = require("./SwapHistoryEmpty");
15
16
  const SwapHistoryItem_1 = require("./SwapHistoryItem");
16
17
  const SwapHistoryPage = () => {
17
18
  const { t } = (0, react_i18next_1.useTranslation)();
18
19
  const { account } = (0, providers_1.useWallet)();
19
- const swaps = (0, route_1.useSwapHistory)(account.address);
20
- const deleteRoutes = (0, stores_1.useRouteStore)((store) => store.deleteRoutes);
20
+ const swaps = (0, routes_1.useSwapHistory)(account.address);
21
+ const deleteRoutes = (0, stores_1.useRouteExecutionStore)((store) => store.deleteRoutes);
21
22
  const [open, setOpen] = (0, react_1.useState)(false);
22
23
  const toggleDialog = (0, react_1.useCallback)(() => {
23
24
  setOpen((open) => !open);
24
25
  }, []);
25
26
  (0, react_1.useEffect)(() => {
26
- return Header_1.useHeaderActionStore.getState().setAction((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "end", onClick: toggleDialog }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.DeleteOutline, {}) })));
27
- }, [toggleDialog]);
27
+ if (swaps.length) {
28
+ return Header_1.useHeaderActionStore.getState().setAction((0, jsx_runtime_1.jsx)(material_1.IconButton, Object.assign({ size: "medium", "aria-label": "settings", edge: "end", onClick: toggleDialog }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.DeleteOutline, {}) })));
29
+ }
30
+ }, [swaps.length, toggleDialog]);
28
31
  if (!swaps.length) {
29
32
  return (0, jsx_runtime_1.jsx)(SwapHistoryEmpty_1.SwapHistoryEmpty, {});
30
33
  }
@@ -11,6 +11,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.SwapPage = void 0;
13
13
  const jsx_runtime_1 = require("react/jsx-runtime");
14
+ const icons_material_1 = require("@mui/icons-material");
14
15
  const material_1 = require("@mui/material");
15
16
  const react_1 = require("react");
16
17
  const react_hook_form_1 = require("react-hook-form");
@@ -57,6 +58,9 @@ const SwapPage = () => {
57
58
  return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Step_1.Step, { step: step, fromToken: index === 0
58
59
  ? Object.assign(Object.assign({}, step.action.fromToken), { amount: step.action.fromAmount }) : undefined, toToken: index === steps.length - 1
59
60
  ? Object.assign(Object.assign({}, step.action.toToken), { amount: (_b = (_a = step.execution) === null || _a === void 0 ? void 0 : _a.toAmount) !== null && _b !== void 0 ? _b : step.estimate.toAmount }) : undefined }), steps.length > 1 && index !== steps.length - 1 ? ((0, jsx_runtime_1.jsx)(StepDivider_1.StepDivider, {})) : null] }, step.id));
60
- }), status === 'idle' ? ((0, jsx_runtime_1.jsx)(GasSufficiencyMessage_1.GasSufficiencyMessage, { route: route, mt: 2 })) : null, status === 'idle' || status === 'error' ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsx)(SwapButton_1.SwapButton, { text: getSwapButtonText(), onClick: handleSwapClick, currentRoute: route, disable: status === 'idle' && (isValidating || !isValid) }) }))) : null, status === 'error' ? ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ mt: 2 }, { children: (0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ variant: "outlined", onClick: handleRemoveRoute, fullWidth: true }, { children: t('button.removeSwap') })) }))) : null, route && status ? ((0, jsx_runtime_1.jsx)(StatusBottomSheet_1.StatusBottomSheet, { status: status, route: route })) : null] }));
61
+ }), status === 'idle' ? ((0, jsx_runtime_1.jsx)(GasSufficiencyMessage_1.GasSufficiencyMessage, { route: route, mt: 2 })) : null, status === 'idle' || status === 'error' ? ((0, jsx_runtime_1.jsxs)(material_1.Box, Object.assign({ mt: 2, display: "flex" }, { children: [(0, jsx_runtime_1.jsx)(SwapButton_1.SwapButton, { text: getSwapButtonText(), onClick: handleSwapClick, currentRoute: route, disable: status === 'idle' && (isValidating || !isValid) }), status === 'error' ? ((0, jsx_runtime_1.jsx)(material_1.Button, Object.assign({ onClick: handleRemoveRoute, sx: {
62
+ minWidth: 48,
63
+ marginLeft: 1,
64
+ } }, { children: (0, jsx_runtime_1.jsx)(icons_material_1.Delete, {}) }))) : null] }))) : null, route && status ? ((0, jsx_runtime_1.jsx)(StatusBottomSheet_1.StatusBottomSheet, { status: status, route: route })) : null] }));
61
65
  };
62
66
  exports.SwapPage = SwapPage;
@@ -33,6 +33,6 @@ const SwapRoutesPage = () => {
33
33
  .setAction((0, jsx_runtime_1.jsx)(ProgressToNextUpdate_1.ProgressToNextUpdate, { updatedAt: dataUpdatedAt || new Date().getTime(), timeToUpdate: refetchTime, isLoading: isFetching, onClick: () => refetch(), sx: { marginRight: -1 }, size: "medium", edge: "end" }));
34
34
  }, [dataUpdatedAt, isFetching, refetch, refetchTime]);
35
35
  const routeNotFound = !(swapRoutes === null || swapRoutes === void 0 ? void 0 : swapRoutes.length) && !isLoading && !isFetching;
36
- return ((0, jsx_runtime_1.jsx)(SwapRoutesPage_style_1.Stack, Object.assign({ direction: "column", spacing: 2, flex: 1 }, { children: routeNotFound ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : isLoading || isFetching ? (Array.from({ length: 3 }).map((_, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, {}, index)))) : (swapRoutes === null || swapRoutes === void 0 ? void 0 : swapRoutes.map((route) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { route: route, onClick: () => handleRouteClick(route) }, route.id)))) })));
36
+ return ((0, jsx_runtime_1.jsx)(SwapRoutesPage_style_1.Stack, Object.assign({ direction: "column", spacing: 2, flex: 1 }, { children: routeNotFound ? ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteNotFoundCard, {})) : isLoading || isFetching ? (Array.from({ length: 3 }).map((_, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCardSkeleton, {}, index)))) : (swapRoutes === null || swapRoutes === void 0 ? void 0 : swapRoutes.map((route, index) => ((0, jsx_runtime_1.jsx)(SwapRouteCard_1.SwapRouteCard, { route: route, onClick: () => handleRouteClick(route), active: index === 0 }, route.id)))) })));
37
37
  };
38
38
  exports.SwapRoutesPage = SwapRoutesPage;