@lifi/widget 1.28.3 → 1.29.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 (182) hide show
  1. package/AppDrawer.style.d.ts +1 -1
  2. package/AppProvider.js +2 -2
  3. package/cjs/AppDrawer.style.d.ts +1 -1
  4. package/cjs/AppProvider.js +2 -2
  5. package/cjs/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -1
  6. package/cjs/components/AppContainer.d.ts +2 -2
  7. package/cjs/components/BottomSheet/BottomSheet.d.ts +1 -1
  8. package/cjs/components/Card/Card.d.ts +5 -3
  9. package/cjs/components/ChainSelect/ChainSelect.d.ts +0 -1
  10. package/cjs/components/ChainSelect/ChainSelect.style.d.ts +7 -5
  11. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +2 -2
  12. package/cjs/components/Header/Header.style.d.ts +3 -3
  13. package/cjs/components/Header/useHeaderActionStore.js +1 -1
  14. package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
  15. package/cjs/components/Select.d.ts +1 -1
  16. package/cjs/components/SendToWallet/SendToWallet.style.d.ts +1 -1
  17. package/cjs/components/SmallAvatar.d.ts +2 -2
  18. package/cjs/components/Step/CircularProgress.d.ts +0 -1
  19. package/cjs/components/Step/CircularProgress.style.d.ts +2 -2
  20. package/cjs/components/Step/StepList.d.ts +0 -1
  21. package/cjs/components/Step/StepProcess.style.d.ts +1 -1
  22. package/cjs/components/SwapInput/SwapInput.style.d.ts +1 -1
  23. package/cjs/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
  24. package/cjs/components/SwapInput/SwapInputEndAdornment.d.ts +0 -1
  25. package/cjs/components/SwapRouteCard/SwapRouteCard.style.d.ts +1 -1
  26. package/cjs/components/SwapRouteCard/SwapRouteCard.style.js +1 -1
  27. package/cjs/components/SwapRoutes/SwapRoutes.style.d.ts +6 -6
  28. package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
  29. package/cjs/components/Switch.js +1 -1
  30. package/cjs/components/Token/Token.style.d.ts +4 -4
  31. package/cjs/components/Token/Token.style.js +3 -1
  32. package/cjs/components/TokenAvatar/TokenAvatar.style.d.ts +4 -4
  33. package/cjs/config/theme.js +22 -27
  34. package/cjs/config/version.d.ts +1 -1
  35. package/cjs/config/version.js +1 -1
  36. package/cjs/hooks/useChains.js +2 -3
  37. package/cjs/hooks/useRouteExecution.js +5 -4
  38. package/cjs/hooks/useTools.js +2 -1
  39. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
  40. package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
  41. package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
  42. package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +0 -1
  43. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  44. package/cjs/pages/SettingsPage/EnabledBridgesSelect.js +1 -1
  45. package/cjs/pages/SettingsPage/EnabledExchangesSelect.js +1 -1
  46. package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
  47. package/cjs/pages/SettingsPage/SettingsPage.d.ts +0 -1
  48. package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
  49. package/cjs/pages/SettingsPage/SlippageInput.d.ts +0 -1
  50. package/cjs/pages/SwapDetailsPage/SwapDetailsPage.js +1 -1
  51. package/cjs/pages/SwapPage/StatusBottomSheet.style.d.ts +4 -4
  52. package/cjs/providers/WalletProvider/WalletProvider.js +1 -1
  53. package/cjs/providers/WidgetProvider/WidgetProvider.js +3 -2
  54. package/cjs/stores/StoreProvider.d.ts +3 -0
  55. package/cjs/stores/StoreProvider.js +13 -0
  56. package/cjs/stores/chains/ChainOrderStore.d.ts +9 -0
  57. package/cjs/stores/chains/ChainOrderStore.js +44 -0
  58. package/cjs/stores/chains/createChainOrderStore.d.ts +4 -0
  59. package/cjs/stores/chains/{useChainOrderStore.js → createChainOrderStore.js} +4 -4
  60. package/cjs/stores/chains/index.d.ts +2 -1
  61. package/cjs/stores/chains/index.js +2 -1
  62. package/cjs/stores/chains/types.d.ts +2 -2
  63. package/cjs/stores/chains/useChainOrder.js +2 -2
  64. package/cjs/stores/index.d.ts +1 -0
  65. package/cjs/stores/index.js +1 -0
  66. package/cjs/stores/routes/RouteExecutionStore.d.ts +9 -0
  67. package/cjs/stores/routes/RouteExecutionStore.js +44 -0
  68. package/cjs/stores/routes/createRouteExecutionStore.d.ts +3 -0
  69. package/cjs/stores/routes/{useRouteExecutionStore.js → createRouteExecutionStore.js} +6 -4
  70. package/cjs/stores/routes/index.d.ts +1 -1
  71. package/cjs/stores/routes/index.js +1 -1
  72. package/cjs/stores/routes/types.d.ts +5 -5
  73. package/cjs/stores/routes/useExecutingRoutesIds.js +3 -3
  74. package/cjs/stores/routes/useRecommendedRouteStore.js +1 -1
  75. package/cjs/stores/routes/useSetExecutableRoute.js +2 -2
  76. package/cjs/stores/routes/useSwapHistory.js +3 -3
  77. package/cjs/stores/settings/SettingsStore.d.ts +11 -0
  78. package/cjs/stores/settings/SettingsStore.js +58 -0
  79. package/cjs/stores/settings/createSettingsStore.d.ts +5 -0
  80. package/cjs/stores/settings/{useSettingsStore.js → createSettingsStore.js} +4 -19
  81. package/cjs/stores/settings/index.d.ts +1 -1
  82. package/cjs/stores/settings/index.js +1 -1
  83. package/cjs/stores/settings/types.d.ts +4 -4
  84. package/cjs/stores/settings/useAppearance.js +2 -2
  85. package/cjs/stores/settings/useSendToWalletStore.js +1 -1
  86. package/cjs/stores/settings/useSettings.js +3 -3
  87. package/cjs/stores/types.d.ts +5 -0
  88. package/cjs/stores/types.js +2 -0
  89. package/cjs/types/widget.d.ts +1 -0
  90. package/components/ActiveSwaps/ActiveSwaps.style.d.ts +1 -1
  91. package/components/AppContainer.d.ts +2 -2
  92. package/components/BottomSheet/BottomSheet.d.ts +1 -1
  93. package/components/Card/Card.d.ts +5 -3
  94. package/components/ChainSelect/ChainSelect.d.ts +0 -1
  95. package/components/ChainSelect/ChainSelect.style.d.ts +7 -5
  96. package/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +2 -2
  97. package/components/Header/Header.style.d.ts +3 -3
  98. package/components/Header/useHeaderActionStore.js +1 -1
  99. package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
  100. package/components/Select.d.ts +1 -1
  101. package/components/SendToWallet/SendToWallet.style.d.ts +1 -1
  102. package/components/SmallAvatar.d.ts +2 -2
  103. package/components/Step/CircularProgress.d.ts +0 -1
  104. package/components/Step/CircularProgress.style.d.ts +2 -2
  105. package/components/Step/StepList.d.ts +0 -1
  106. package/components/Step/StepProcess.style.d.ts +1 -1
  107. package/components/SwapInput/SwapInput.style.d.ts +1 -1
  108. package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
  109. package/components/SwapInput/SwapInputEndAdornment.d.ts +0 -1
  110. package/components/SwapRouteCard/SwapRouteCard.style.d.ts +1 -1
  111. package/components/SwapRouteCard/SwapRouteCard.style.js +1 -1
  112. package/components/SwapRoutes/SwapRoutes.style.d.ts +6 -6
  113. package/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
  114. package/components/Switch.js +1 -1
  115. package/components/Token/Token.style.d.ts +4 -4
  116. package/components/Token/Token.style.js +4 -2
  117. package/components/TokenAvatar/TokenAvatar.style.d.ts +4 -4
  118. package/config/theme.js +22 -27
  119. package/config/version.d.ts +1 -1
  120. package/config/version.js +1 -1
  121. package/hooks/useChains.js +3 -4
  122. package/hooks/useRouteExecution.js +6 -5
  123. package/hooks/useTools.js +3 -2
  124. package/package.json +13 -13
  125. package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
  126. package/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
  127. package/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
  128. package/pages/SettingsPage/AdvancedPreferences.d.ts +0 -1
  129. package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  130. package/pages/SettingsPage/EnabledBridgesSelect.js +1 -1
  131. package/pages/SettingsPage/EnabledExchangesSelect.js +1 -1
  132. package/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
  133. package/pages/SettingsPage/SettingsPage.d.ts +0 -1
  134. package/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
  135. package/pages/SettingsPage/SlippageInput.d.ts +0 -1
  136. package/pages/SwapDetailsPage/SwapDetailsPage.js +3 -3
  137. package/pages/SwapPage/StatusBottomSheet.style.d.ts +4 -4
  138. package/providers/WalletProvider/WalletProvider.js +1 -1
  139. package/providers/WidgetProvider/WidgetProvider.js +4 -3
  140. package/stores/StoreProvider.d.ts +3 -0
  141. package/stores/StoreProvider.js +9 -0
  142. package/stores/chains/ChainOrderStore.d.ts +9 -0
  143. package/stores/chains/ChainOrderStore.js +38 -0
  144. package/stores/chains/createChainOrderStore.d.ts +4 -0
  145. package/stores/chains/{useChainOrderStore.js → createChainOrderStore.js} +3 -4
  146. package/stores/chains/index.d.ts +2 -1
  147. package/stores/chains/index.js +2 -1
  148. package/stores/chains/types.d.ts +2 -2
  149. package/stores/chains/useChainOrder.js +2 -2
  150. package/stores/index.d.ts +1 -0
  151. package/stores/index.js +1 -0
  152. package/stores/routes/RouteExecutionStore.d.ts +9 -0
  153. package/stores/routes/RouteExecutionStore.js +38 -0
  154. package/stores/routes/createRouteExecutionStore.d.ts +3 -0
  155. package/stores/routes/{useRouteExecutionStore.js → createRouteExecutionStore.js} +5 -4
  156. package/stores/routes/index.d.ts +1 -1
  157. package/stores/routes/index.js +1 -1
  158. package/stores/routes/types.d.ts +5 -5
  159. package/stores/routes/useExecutingRoutesIds.js +2 -2
  160. package/stores/routes/useRecommendedRouteStore.js +1 -1
  161. package/stores/routes/useSetExecutableRoute.js +1 -1
  162. package/stores/routes/useSwapHistory.js +2 -2
  163. package/stores/settings/SettingsStore.d.ts +11 -0
  164. package/stores/settings/SettingsStore.js +51 -0
  165. package/stores/settings/createSettingsStore.d.ts +5 -0
  166. package/stores/settings/{useSettingsStore.js → createSettingsStore.js} +3 -18
  167. package/stores/settings/index.d.ts +1 -1
  168. package/stores/settings/index.js +1 -1
  169. package/stores/settings/types.d.ts +4 -4
  170. package/stores/settings/useAppearance.js +2 -2
  171. package/stores/settings/useSendToWalletStore.js +1 -1
  172. package/stores/settings/useSettings.js +2 -2
  173. package/stores/types.d.ts +5 -0
  174. package/stores/types.js +1 -0
  175. package/tsconfig.cjs.tsbuildinfo +1 -1
  176. package/types/widget.d.ts +1 -0
  177. package/cjs/stores/chains/useChainOrderStore.d.ts +0 -17
  178. package/cjs/stores/routes/useRouteExecutionStore.d.ts +0 -16
  179. package/cjs/stores/settings/useSettingsStore.d.ts +0 -44
  180. package/stores/chains/useChainOrderStore.d.ts +0 -17
  181. package/stores/routes/useRouteExecutionStore.d.ts +0 -16
  182. package/stores/settings/useSettingsStore.d.ts +0 -44
@@ -5,14 +5,14 @@ export declare const AvatarDefault: import("@emotion/styled").StyledComponent<im
5
5
  component?: import("react").ElementType<any> | undefined;
6
6
  ref?: import("react").Ref<unknown> | undefined;
7
7
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
8
- } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
8
+ } & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
9
9
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
10
- }, 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
+ }, "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>, {}, {}>;
11
11
  export declare const AvatarDefaultContainer: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<import("@mui/material").Theme> & {
12
12
  children?: import("react").ReactNode;
13
13
  component?: import("react").ElementType<any> | undefined;
14
14
  ref?: import("react").Ref<unknown> | undefined;
15
15
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
16
- } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
16
+ } & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
17
17
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
18
- }, 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>, {}, {}>;
18
+ }, "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>, {}, {}>;
@@ -52,6 +52,9 @@ const createTheme = (mode, theme = {}) => {
52
52
  const contrastButtonColor = (0, styles_1.getContrastRatio)(colors_1.common.white, primaryMainColor) >= 3
53
53
  ? colors_1.common.white
54
54
  : colors_1.common.black;
55
+ const contrastTextButtonColor = (0, styles_1.getContrastRatio)(colors_1.common.white, (0, styles_1.alpha)(primaryMainColor, 0.08)) >= 3
56
+ ? colors_1.common.white
57
+ : colors_1.common.black;
55
58
  return (0, styles_1.createTheme)({
56
59
  typography: Object.assign({ fontFamily: 'Inter var, Inter, sans-serif' }, theme.typography),
57
60
  palette: Object.assign(Object.assign(Object.assign(Object.assign({ mode }, palette), (mode === 'light' ? paletteLight : paletteDark)), theme.palette), { primary: {
@@ -83,14 +86,15 @@ const createTheme = (mode, theme = {}) => {
83
86
  defaultProps: {
84
87
  disableElevation: true,
85
88
  },
86
- styleOverrides: Object.assign({ root: {
89
+ styleOverrides: {
90
+ root: {
87
91
  borderRadius: (_v = (_u = theme.shape) === null || _u === void 0 ? void 0 : _u.borderRadiusSecondary) !== null && _v !== void 0 ? _v : shape.borderRadiusSecondary,
88
92
  textTransform: 'none',
89
93
  fontSize: '1rem',
90
94
  [`&.Mui-disabled, &.Mui-disabled:hover`]: {
91
95
  color: mode === 'light'
92
- ? 'rgb(0 0 0 / 56%)'
93
- : 'rgb(255 255 255 / 56%)',
96
+ ? (0, styles_1.alpha)(colors_1.common.black, 0.56)
97
+ : (0, styles_1.alpha)(colors_1.common.white, 0.56),
94
98
  cursor: 'not-allowed',
95
99
  pointerEvents: 'auto',
96
100
  },
@@ -106,39 +110,30 @@ const createTheme = (mode, theme = {}) => {
106
110
  [`&.${LoadingButton_1.loadingButtonClasses.root}.${LoadingButton_1.loadingButtonClasses.loading}`]: {
107
111
  color: 'transparent',
108
112
  },
109
- }, text: {
110
- backgroundColor: (0, styles_1.alpha)(primaryMainColor, 0.08),
113
+ },
114
+ text: {
115
+ backgroundColor: mode === 'light'
116
+ ? (0, styles_1.alpha)(primaryMainColor, 0.08)
117
+ : (0, styles_1.alpha)(primaryMainColor, 0.42),
111
118
  '&:hover': {
112
- backgroundColor: (0, styles_1.alpha)(primaryMainColor, 0.12),
119
+ backgroundColor: mode === 'light'
120
+ ? (0, styles_1.alpha)(primaryMainColor, 0.12)
121
+ : (0, styles_1.alpha)(primaryMainColor, 0.56),
113
122
  },
114
- }, contained: {
123
+ color: mode === 'light' ? primaryMainColor : contrastTextButtonColor,
124
+ },
125
+ contained: {
115
126
  '&:hover': {
116
127
  color: contrastButtonColor,
117
128
  },
118
- }, sizeMedium: {
129
+ },
130
+ sizeMedium: {
119
131
  padding: '10px 14px',
120
132
  [`.${DialogActions_1.dialogActionsClasses.root} &`]: {
121
133
  padding: '6px 12px',
122
134
  },
123
- } }, (mode === 'dark'
124
- ? {
125
- outlined: {
126
- color: primaryLightColor,
127
- borderColor: primaryLightColor,
128
- '&:hover': {
129
- backgroundColor: (0, styles_1.alpha)(primaryLightColor, 0.08),
130
- borderColor: primaryLightColor,
131
- },
132
- },
133
- text: {
134
- backgroundColor: (0, styles_1.lighten)(paletteDark.background.paper, 0.08),
135
- color: colors_1.common.white,
136
- '&:hover': {
137
- backgroundColor: (0, styles_1.lighten)(paletteDark.background.paper, 0.12),
138
- },
139
- },
140
- }
141
- : {})),
135
+ },
136
+ },
142
137
  },
143
138
  MuiIconButton: {
144
139
  styleOverrides: {
@@ -1,2 +1,2 @@
1
1
  export declare const name = "@lifi/widget";
2
- export declare const version = "1.28.3";
2
+ export declare const version = "1.29.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.28.3';
5
+ exports.version = '1.29.0';
@@ -19,12 +19,11 @@ const useChains = () => {
19
19
  const { disabledChains, chains } = (0, providers_1.useWidgetConfig)();
20
20
  const lifi = (0, providers_1.useLiFi)();
21
21
  const { getValues, setValue } = (0, react_hook_form_1.useFormContext)();
22
+ const initializeChains = (0, stores_1.useChainOrderStore)((state) => state.initializeChains);
22
23
  const { data, isLoading } = (0, react_query_1.useQuery)(['chains'], () => __awaiter(void 0, void 0, void 0, function* () {
23
24
  const availableChains = yield lifi.getChains();
24
25
  const filteredChains = availableChains.filter((chain) => (0, providers_1.isItemAllowed)(chain.id, chains, disabledChains));
25
- const chainOrder = stores_1.useChainOrderStore
26
- .getState()
27
- .initializeChains(filteredChains.map((chain) => chain.id));
26
+ const chainOrder = initializeChains(filteredChains.map((chain) => chain.id));
28
27
  const [fromChainValue, toChainValue] = getValues([
29
28
  providers_1.SwapFormKey.FromChain,
30
29
  providers_1.SwapFormKey.ToChain,
@@ -24,10 +24,11 @@ const useRouteExecution = ({ routeId, executeInBackground, onAcceptExchangeRateU
24
24
  const { account, switchChain } = (0, providers_1.useWallet)();
25
25
  const resumedAfterMount = (0, react_1.useRef)(false);
26
26
  const emitter = (0, useWidgetEvents_1.useWidgetEvents)();
27
+ const routeExecutionStoreContext = (0, stores_1.useRouteExecutionStoreContext)();
27
28
  const routeExecution = (0, stores_1.useRouteExecutionStore)((state) => state.routes[routeId]);
28
- const [updateRoute, restartRoute, deleteRoute] = (0, stores_1.useRouteExecutionStore)((state) => [state.updateRoute, state.restartRoute, state.deleteRoute], shallow_1.default);
29
+ const [updateRoute, restartRoute, deleteRoute] = (0, stores_1.useRouteExecutionStore)((state) => [state.updateRoute, state.restartRoute, state.deleteRoute], shallow_1.shallow);
29
30
  const updateCallback = (updatedRoute) => {
30
- const routeExecution = stores_1.useRouteExecutionStore.getState().routes[updatedRoute.id];
31
+ const routeExecution = routeExecutionStoreContext.getState().routes[updatedRoute.id];
31
32
  if (!routeExecution) {
32
33
  return;
33
34
  }
@@ -158,7 +159,7 @@ const useRouteExecution = ({ routeId, executeInBackground, onAcceptExchangeRateU
158
159
  (0, react_1.useEffect)(() => {
159
160
  return () => {
160
161
  var _a;
161
- const route = (_a = stores_1.useRouteExecutionStore.getState().routes[routeId]) === null || _a === void 0 ? void 0 : _a.route;
162
+ const route = (_a = routeExecutionStoreContext.getState().routes[routeId]) === null || _a === void 0 ? void 0 : _a.route;
162
163
  if (!route || !(0, stores_1.isRouteActive)(route)) {
163
164
  return;
164
165
  }
@@ -166,7 +167,7 @@ const useRouteExecution = ({ routeId, executeInBackground, onAcceptExchangeRateU
166
167
  console.log('Move route execution to background.', routeId);
167
168
  resumedAfterMount.current = false;
168
169
  };
169
- }, [lifi, routeId]);
170
+ }, [lifi, routeExecutionStoreContext, routeId]);
170
171
  return {
171
172
  executeRoute,
172
173
  restartRoute: restartRouteMutation,
@@ -8,9 +8,10 @@ const stores_1 = require("../stores");
8
8
  const useTools = () => {
9
9
  const lifi = (0, providers_1.useLiFi)();
10
10
  const { bridges, exchanges } = (0, providers_1.useWidgetConfig)();
11
+ const settingsStoreContext = (0, stores_1.useSettingsStoreContext)();
11
12
  const { data } = (0, react_query_1.useQuery)(['tools'], () => lifi.getTools(), {
12
13
  onSuccess(data) {
13
- const { initializeTools } = stores_1.useSettingsStore.getState();
14
+ const { initializeTools } = settingsStoreContext.getState();
14
15
  initializeTools('Bridges', data.bridges
15
16
  .filter((bridge) => (0, providers_1.isItemAllowed)(bridge.key, bridges))
16
17
  .map((bridge) => bridge.key));
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const ActiveSwapsPage: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SearchTokenInput: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SelectWalletPage: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const AdvancedPreferences: () => JSX.Element;
@@ -2,7 +2,7 @@
2
2
  export declare const ToggleButton: import("@emotion/styled").StyledComponent<{
3
3
  children?: import("react").ReactNode;
4
4
  classes?: Partial<import("@mui/material").ToggleButtonClasses> | undefined;
5
- color?: "success" | "warning" | "error" | "primary" | "secondary" | "info" | "standard" | undefined;
5
+ color?: "success" | "warning" | "error" | "info" | "primary" | "secondary" | "standard" | undefined;
6
6
  disabled?: boolean | undefined;
7
7
  disableFocusRipple?: boolean | undefined;
8
8
  fullWidth?: boolean | undefined;
@@ -13,7 +13,7 @@ const stores_1 = require("../../stores");
13
13
  const EnabledBridgesSelect = () => {
14
14
  const { t } = (0, react_i18next_1.useTranslation)();
15
15
  const { tools, formattedTools } = (0, hooks_1.useTools)();
16
- const [enabledBridges, setTools] = (0, stores_1.useSettingsStore)((state) => [state.enabledBridges, state.setTools], shallow_1.default);
16
+ const [enabledBridges, setTools] = (0, stores_1.useSettingsStore)((state) => [state.enabledBridges, state.setTools], shallow_1.shallow);
17
17
  return (tools === null || tools === void 0 ? void 0 : tools.bridges.length) ? ((0, jsx_runtime_1.jsxs)(Card_1.Card, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t(`settings.enabledBridges`) }), (0, jsx_runtime_1.jsx)(material_1.FormControl, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(Select_1.Select, Object.assign({ multiple: true, placeholder: t(`settings.selectEnabledBridges`), MenuProps: { elevation: 2, PaperProps: { sx: { maxHeight: 320 } } }, IconComponent: icons_material_1.KeyboardArrowDown, value: enabledBridges !== null && enabledBridges !== void 0 ? enabledBridges : [], onChange: (event) => {
18
18
  setTools('Bridges', event.target.value, tools.bridges);
19
19
  }, renderValue: (selected) => ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: { display: 'flex', flexWrap: 'wrap', gap: 0.5 } }, { children: selected.map((value) => {
@@ -13,7 +13,7 @@ const stores_1 = require("../../stores");
13
13
  const EnabledExchangesSelect = () => {
14
14
  const { t } = (0, react_i18next_1.useTranslation)();
15
15
  const { tools, formattedTools } = (0, hooks_1.useTools)();
16
- const [enabledExchanges, setTools] = (0, stores_1.useSettingsStore)((state) => [state.enabledExchanges, state.setTools], shallow_1.default);
16
+ const [enabledExchanges, setTools] = (0, stores_1.useSettingsStore)((state) => [state.enabledExchanges, state.setTools], shallow_1.shallow);
17
17
  return (tools === null || tools === void 0 ? void 0 : tools.exchanges.length) ? ((0, jsx_runtime_1.jsxs)(Card_1.Card, { children: [(0, jsx_runtime_1.jsx)(Card_1.CardTitle, { children: t(`settings.enabledExchanges`) }), (0, jsx_runtime_1.jsx)(material_1.FormControl, Object.assign({ fullWidth: true }, { children: (0, jsx_runtime_1.jsx)(Select_1.Select, Object.assign({ multiple: true, placeholder: t(`settings.selectEnabledExchanges`), value: enabledExchanges !== null && enabledExchanges !== void 0 ? enabledExchanges : [], onChange: (event) => {
18
18
  setTools('Exchanges', event.target.value, tools.exchanges);
19
19
  }, MenuProps: { elevation: 2, PaperProps: { sx: { maxHeight: 320 } } }, IconComponent: icons_material_1.KeyboardArrowDown, renderValue: (selected) => ((0, jsx_runtime_1.jsx)(material_1.Box, Object.assign({ sx: { display: 'flex', flexWrap: 'wrap', gap: 0.5 } }, { children: selected.map((value) => {
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const GasPriceSelect: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SettingsPage: () => JSX.Element;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const ShowDestinationWallet: () => JSX.Element | null;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const SlippageInput: () => JSX.Element;
@@ -29,7 +29,7 @@ const SwapDetailsPage = () => {
29
29
  const { t, i18n } = (0, react_i18next_1.useTranslation)();
30
30
  const { navigateBack } = (0, hooks_1.useNavigateBack)();
31
31
  const { state } = (0, react_router_dom_1.useLocation)();
32
- const [routeExecution, deleteRoute] = (0, stores_1.useRouteExecutionStore)((store) => [store.routes[state === null || state === void 0 ? void 0 : state.routeId], store.deleteRoute], shallow_1.default);
32
+ const [routeExecution, deleteRoute] = (0, stores_1.useRouteExecutionStore)((store) => [store.routes[state === null || state === void 0 ? void 0 : state.routeId], store.deleteRoute], shallow_1.shallow);
33
33
  const [open, setOpen] = (0, react_1.useState)(false);
34
34
  const toggleDialog = (0, react_1.useCallback)(() => {
35
35
  setOpen((open) => !open);
@@ -7,17 +7,17 @@ export declare const IconContainer: import("@emotion/styled").StyledComponent<im
7
7
  component?: import("react").ElementType<any> | undefined;
8
8
  ref?: import("react").Ref<unknown> | undefined;
9
9
  sx?: import("@mui/material").SxProps<Theme> | undefined;
10
- } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
10
+ } & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
11
11
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
12
- }, 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<Theme>, {}, {}>;
12
+ }, "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<Theme>, {}, {}>;
13
13
  export declare const IconCircle: import("@emotion/styled").StyledComponent<import("@mui/system").SystemProps<Theme> & {
14
14
  children?: import("react").ReactNode;
15
15
  component?: import("react").ElementType<any> | undefined;
16
16
  ref?: import("react").Ref<unknown> | undefined;
17
17
  sx?: import("@mui/material").SxProps<Theme> | undefined;
18
- } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
18
+ } & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
19
19
  ref?: import("react").RefObject<HTMLDivElement> | ((instance: HTMLDivElement | null) => void) | null | undefined;
20
- }, 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<Theme> & {
20
+ }, "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<Theme> & {
21
21
  status: StatusColor;
22
22
  }, {}, {}>;
23
23
  export {};
@@ -15,7 +15,7 @@ const wallet_management_1 = require("@lifi/wallet-management");
15
15
  const react_1 = require("react");
16
16
  const WidgetProvider_1 = require("../WidgetProvider");
17
17
  const stub = () => {
18
- throw new Error('You forgot to wrap your component in <WalletProvider>.');
18
+ throw new Error(`You forgot to wrap your component in <${exports.WalletProvider.name}>.`);
19
19
  };
20
20
  const initialContext = {
21
21
  connect: stub,
@@ -25,6 +25,7 @@ const useWidgetConfig = () => (0, react_1.useContext)(WidgetContext);
25
25
  exports.useWidgetConfig = useWidgetConfig;
26
26
  const WidgetProvider = (_a) => {
27
27
  var { children } = _a, _b = _a.config, _c = _b === void 0 ? {} : _b, { fromChain, fromToken, toChain, toToken, fromAmount } = _c, config = __rest(_c, ["fromChain", "fromToken", "toChain", "toToken", "fromAmount"]);
28
+ const settingsStoreContext = (0, stores_1.useSettingsStoreContext)();
28
29
  const value = (0, react_1.useMemo)(() => {
29
30
  var _a, _b, _c, _d, _e, _f;
30
31
  try {
@@ -61,8 +62,8 @@ const WidgetProvider = (_a) => {
61
62
  }
62
63
  }, [config, fromAmount, fromChain, fromToken, toChain, toToken]);
63
64
  (0, react_1.useEffect)(() => {
64
- (0, stores_1.setDefaultSettings)(value);
65
- }, [value]);
65
+ (0, stores_1.setDefaultSettings)(settingsStoreContext, value);
66
+ }, [settingsStoreContext, value]);
66
67
  return ((0, jsx_runtime_1.jsx)(WidgetContext.Provider, Object.assign({ value: value }, { children: children })));
67
68
  };
68
69
  exports.WidgetProvider = WidgetProvider;
@@ -0,0 +1,3 @@
1
+ import type { PropsWithChildren } from 'react';
2
+ import type { PersistStoreProviderProps } from './types';
3
+ export declare const StoreProvider: React.FC<PropsWithChildren<PersistStoreProviderProps>>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.StoreProvider = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ const chains_1 = require("./chains");
6
+ const routes_1 = require("./routes");
7
+ const settings_1 = require("./settings");
8
+ const StoreProvider = ({ children, namePrefix }) => {
9
+ return ((0, jsx_runtime_1.jsx)(routes_1.RouteExecutionStoreProvider, Object.assign({ namePrefix: namePrefix }, { children: (0, jsx_runtime_1.jsx)(settings_1.SettingsStoreProvider
10
+ // namePrefix={namePrefix}
11
+ , { children: (0, jsx_runtime_1.jsx)(chains_1.ChainOrderStoreProvider, Object.assign({ namePrefix: namePrefix }, { children: children })) }) })));
12
+ };
13
+ exports.StoreProvider = StoreProvider;
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import type { StoreApi, UseBoundStore } from 'zustand';
3
+ import type { PersistStoreProviderProps } from '../types';
4
+ import type { ChainOrderState } from './types';
5
+ export type ChainOrderStore = UseBoundStore<StoreApi<ChainOrderState>>;
6
+ export declare const ChainOrderStoreContext: import("react").Context<ChainOrderStore | null>;
7
+ export declare function ChainOrderStoreProvider({ children, ...props }: PersistStoreProviderProps): JSX.Element;
8
+ export declare function useChainOrderStore<T>(selector: (state: ChainOrderState) => T, equalityFn?: (left: T, right: T) => boolean): T;
9
+ export declare function useChainOrderStoreContext(): ChainOrderStore;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.useChainOrderStoreContext = exports.useChainOrderStore = exports.ChainOrderStoreProvider = exports.ChainOrderStoreContext = void 0;
15
+ const jsx_runtime_1 = require("react/jsx-runtime");
16
+ /* eslint-disable no-underscore-dangle */
17
+ const react_1 = require("react");
18
+ const createChainOrderStore_1 = require("./createChainOrderStore");
19
+ exports.ChainOrderStoreContext = (0, react_1.createContext)(null);
20
+ function ChainOrderStoreProvider(_a) {
21
+ var { children } = _a, props = __rest(_a, ["children"]);
22
+ const storeRef = (0, react_1.useRef)();
23
+ if (!storeRef.current) {
24
+ storeRef.current = (0, createChainOrderStore_1.createChainOrderStore)(props);
25
+ }
26
+ return ((0, jsx_runtime_1.jsx)(exports.ChainOrderStoreContext.Provider, Object.assign({ value: storeRef.current }, { children: children })));
27
+ }
28
+ exports.ChainOrderStoreProvider = ChainOrderStoreProvider;
29
+ function useChainOrderStore(selector, equalityFn) {
30
+ const useStore = (0, react_1.useContext)(exports.ChainOrderStoreContext);
31
+ if (!useStore) {
32
+ throw new Error(`You forgot to wrap your component in <${ChainOrderStoreProvider.name}>.`);
33
+ }
34
+ return useStore(selector, equalityFn);
35
+ }
36
+ exports.useChainOrderStore = useChainOrderStore;
37
+ function useChainOrderStoreContext() {
38
+ const useStore = (0, react_1.useContext)(exports.ChainOrderStoreContext);
39
+ if (!useStore) {
40
+ throw new Error(`You forgot to wrap your component in <${ChainOrderStoreProvider.name}>.`);
41
+ }
42
+ return useStore;
43
+ }
44
+ exports.useChainOrderStoreContext = useChainOrderStoreContext;
@@ -0,0 +1,4 @@
1
+ import type { PersistStoreProps } from '../types';
2
+ import type { ChainOrderState } from './types';
3
+ export declare const maxChainToOrder = 9;
4
+ export declare const createChainOrderStore: ({ namePrefix }: PersistStoreProps) => import("zustand").UseBoundStore<import("zustand").StoreApi<ChainOrderState>>;
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useChainOrderStore = exports.maxChainToOrder = void 0;
4
- /* eslint-disable no-underscore-dangle */
3
+ exports.createChainOrderStore = exports.maxChainToOrder = void 0;
5
4
  const zustand_1 = require("zustand");
6
5
  const middleware_1 = require("zustand/middleware");
7
6
  exports.maxChainToOrder = 9;
8
- exports.useChainOrderStore = (0, zustand_1.default)()((0, middleware_1.persist)((set, get) => ({
7
+ const createChainOrderStore = ({ namePrefix }) => (0, zustand_1.create)((0, middleware_1.persist)((set, get) => ({
9
8
  chainOrder: [],
10
9
  availableChains: [],
11
10
  initializeChains: (chainIds) => {
@@ -47,7 +46,8 @@ exports.useChainOrderStore = (0, zustand_1.default)()((0, middleware_1.persist)(
47
46
  });
48
47
  },
49
48
  }), {
50
- name: 'li.fi-widget-chains-order',
49
+ name: `${namePrefix || 'li.fi'}-widget-chains-order`,
51
50
  version: 0,
52
51
  partialize: (state) => ({ chainOrder: state.chainOrder }),
53
52
  }));
53
+ exports.createChainOrderStore = createChainOrderStore;
@@ -1,3 +1,4 @@
1
+ export * from './ChainOrderStore';
2
+ export * from './createChainOrderStore';
1
3
  export * from './types';
2
4
  export * from './useChainOrder';
3
- export * from './useChainOrderStore';
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./ChainOrderStore"), exports);
18
+ __exportStar(require("./createChainOrderStore"), exports);
17
19
  __exportStar(require("./types"), exports);
18
20
  __exportStar(require("./useChainOrder"), exports);
19
- __exportStar(require("./useChainOrderStore"), exports);
@@ -1,8 +1,8 @@
1
- export interface ChainOrderState {
1
+ export interface ChainOrderProps {
2
2
  chainOrder: number[];
3
3
  availableChains: number[];
4
4
  }
5
- export interface ChainOrderStore extends ChainOrderState {
5
+ export interface ChainOrderState extends ChainOrderProps {
6
6
  initializeChains(chainIds: number[]): number[];
7
7
  setChain(chainId: number): void;
8
8
  }
@@ -2,8 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.useChainOrder = void 0;
4
4
  const shallow_1 = require("zustand/shallow");
5
- const useChainOrderStore_1 = require("./useChainOrderStore");
5
+ const ChainOrderStore_1 = require("./ChainOrderStore");
6
6
  const useChainOrder = () => {
7
- return (0, useChainOrderStore_1.useChainOrderStore)((state) => [state.chainOrder, state.setChain], shallow_1.default);
7
+ return (0, ChainOrderStore_1.useChainOrderStore)((state) => [state.chainOrder, state.setChain], shallow_1.shallow);
8
8
  };
9
9
  exports.useChainOrder = useChainOrder;
@@ -1,3 +1,4 @@
1
1
  export * from './chains';
2
2
  export * from './routes';
3
3
  export * from './settings';
4
+ export * from './StoreProvider';
@@ -17,3 +17,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./chains"), exports);
18
18
  __exportStar(require("./routes"), exports);
19
19
  __exportStar(require("./settings"), exports);
20
+ __exportStar(require("./StoreProvider"), exports);
@@ -0,0 +1,9 @@
1
+ /// <reference types="react" />
2
+ import type { StoreApi, UseBoundStore } from 'zustand';
3
+ import type { PersistStoreProviderProps } from '../types';
4
+ import type { RouteExecutionState } from './types';
5
+ export type RouteExecutionStore = UseBoundStore<StoreApi<RouteExecutionState>>;
6
+ export declare const RouteExecutionStoreContext: import("react").Context<RouteExecutionStore | null>;
7
+ export declare function RouteExecutionStoreProvider({ children, ...props }: PersistStoreProviderProps): JSX.Element;
8
+ export declare function useRouteExecutionStore<T>(selector: (state: RouteExecutionState) => T, equalityFn?: (left: T, right: T) => boolean): T;
9
+ export declare function useRouteExecutionStoreContext(): RouteExecutionStore;
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ var __rest = (this && this.__rest) || function (s, e) {
3
+ var t = {};
4
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
5
+ t[p] = s[p];
6
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
7
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
8
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
9
+ t[p[i]] = s[p[i]];
10
+ }
11
+ return t;
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.useRouteExecutionStoreContext = exports.useRouteExecutionStore = exports.RouteExecutionStoreProvider = exports.RouteExecutionStoreContext = void 0;
15
+ const jsx_runtime_1 = require("react/jsx-runtime");
16
+ /* eslint-disable no-underscore-dangle */
17
+ const react_1 = require("react");
18
+ const createRouteExecutionStore_1 = require("./createRouteExecutionStore");
19
+ exports.RouteExecutionStoreContext = (0, react_1.createContext)(null);
20
+ function RouteExecutionStoreProvider(_a) {
21
+ var { children } = _a, props = __rest(_a, ["children"]);
22
+ const storeRef = (0, react_1.useRef)();
23
+ if (!storeRef.current) {
24
+ storeRef.current = (0, createRouteExecutionStore_1.createRouteExecutionStore)(props);
25
+ }
26
+ return ((0, jsx_runtime_1.jsx)(exports.RouteExecutionStoreContext.Provider, Object.assign({ value: storeRef.current }, { children: children })));
27
+ }
28
+ exports.RouteExecutionStoreProvider = RouteExecutionStoreProvider;
29
+ function useRouteExecutionStore(selector, equalityFn) {
30
+ const useStore = (0, react_1.useContext)(exports.RouteExecutionStoreContext);
31
+ if (!useStore) {
32
+ throw new Error(`You forgot to wrap your component in <${RouteExecutionStoreProvider.name}>.`);
33
+ }
34
+ return useStore(selector, equalityFn);
35
+ }
36
+ exports.useRouteExecutionStore = useRouteExecutionStore;
37
+ function useRouteExecutionStoreContext() {
38
+ const useStore = (0, react_1.useContext)(exports.RouteExecutionStoreContext);
39
+ if (!useStore) {
40
+ throw new Error(`You forgot to wrap your component in <${RouteExecutionStoreProvider.name}>.`);
41
+ }
42
+ return useStore;
43
+ }
44
+ exports.useRouteExecutionStoreContext = useRouteExecutionStoreContext;
@@ -0,0 +1,3 @@
1
+ import type { PersistStoreProps } from '../types';
2
+ import type { RouteExecutionState } from './types';
3
+ export declare const createRouteExecutionStore: ({ namePrefix }: PersistStoreProps) => import("zustand").UseBoundStore<import("zustand").StoreApi<RouteExecutionState>>;
@@ -1,12 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.useRouteExecutionStore = void 0;
3
+ exports.createRouteExecutionStore = void 0;
4
4
  const zustand_1 = require("zustand");
5
5
  const middleware_1 = require("zustand/middleware");
6
6
  const utils_1 = require("../../utils");
7
7
  const types_1 = require("./types");
8
8
  const utils_2 = require("./utils");
9
- exports.useRouteExecutionStore = (0, zustand_1.default)()((0, middleware_1.persist)((set, get) => ({
9
+ const createRouteExecutionStore = ({ namePrefix }) => (0, zustand_1.create)((0, middleware_1.persist)((set, get) => ({
10
10
  routes: {},
11
11
  setExecutableRoute: (route) => {
12
12
  if (!get().routes[route.id]) {
@@ -40,7 +40,8 @@ exports.useRouteExecutionStore = (0, zustand_1.default)()((0, middleware_1.persi
40
40
  }
41
41
  const isDone = (0, utils_2.isRouteDone)(route);
42
42
  if (isDone) {
43
- updatedState.routes[route.id].status = types_1.RouteExecutionStatus.Done;
43
+ updatedState.routes[route.id].status =
44
+ types_1.RouteExecutionStatus.Done;
44
45
  if ((0, utils_2.isRoutePartiallyDone)(route)) {
45
46
  updatedState.routes[route.id].status |=
46
47
  types_1.RouteExecutionStatus.Partial;
@@ -93,7 +94,7 @@ exports.useRouteExecutionStore = (0, zustand_1.default)()((0, middleware_1.persi
93
94
  };
94
95
  }),
95
96
  }), {
96
- name: 'li.fi-widget-routes',
97
+ name: `${namePrefix || 'li.fi'}-widget-routes`,
97
98
  version: 1,
98
99
  partialize: (state) => ({ routes: state.routes }),
99
100
  merge: (persistedState, currentState) => {
@@ -172,3 +173,4 @@ exports.useRouteExecutionStore = (0, zustand_1.default)()((0, middleware_1.persi
172
173
  return persistedState;
173
174
  },
174
175
  }));
176
+ exports.createRouteExecutionStore = createRouteExecutionStore;