@lifi/widget 1.28.4 → 1.29.1

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 (184) 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 +2 -2
  6. package/cjs/components/ActiveSwaps/ActiveSwaps.style.js +1 -1
  7. package/cjs/components/AppContainer.d.ts +2 -2
  8. package/cjs/components/BottomSheet/BottomSheet.d.ts +1 -1
  9. package/cjs/components/Card/Card.d.ts +5 -3
  10. package/cjs/components/Card/Card.js +1 -3
  11. package/cjs/components/ChainSelect/ChainSelect.d.ts +0 -1
  12. package/cjs/components/ChainSelect/ChainSelect.style.d.ts +7 -5
  13. package/cjs/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +2 -2
  14. package/cjs/components/Header/Header.style.d.ts +3 -3
  15. package/cjs/components/ReverseTokensButton/ReverseTokensButton.style.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/SwapRouteCard/SwapRouteCardSkeleton.js +3 -1
  28. package/cjs/components/SwapRoutes/SwapRoutes.style.d.ts +6 -6
  29. package/cjs/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
  30. package/cjs/components/Switch.js +1 -1
  31. package/cjs/components/Token/Token.style.d.ts +4 -4
  32. package/cjs/components/Token/Token.style.js +3 -1
  33. package/cjs/components/TokenAvatar/TokenAvatar.style.d.ts +4 -4
  34. package/cjs/components/TokenList/TokenList.style.d.ts +1 -1
  35. package/cjs/components/TokenList/TokenList.style.js +1 -1
  36. package/cjs/config/theme.js +22 -27
  37. package/cjs/config/version.d.ts +1 -1
  38. package/cjs/config/version.js +1 -1
  39. package/cjs/hooks/useChains.js +2 -3
  40. package/cjs/hooks/useRouteExecution.js +4 -3
  41. package/cjs/hooks/useTools.js +2 -1
  42. package/cjs/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
  43. package/cjs/pages/SelectChainPage/SelectChainPage.style.js +1 -1
  44. package/cjs/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.js +1 -1
  45. package/cjs/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
  46. package/cjs/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
  47. package/cjs/pages/SelectWalletPage/SelectWalletPage.style.js +1 -1
  48. package/cjs/pages/SettingsPage/AdvancedPreferences.d.ts +0 -1
  49. package/cjs/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  50. package/cjs/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
  51. package/cjs/pages/SettingsPage/SettingsPage.d.ts +0 -1
  52. package/cjs/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
  53. package/cjs/pages/SettingsPage/SlippageInput.d.ts +0 -1
  54. package/cjs/pages/SwapPage/StatusBottomSheet.style.d.ts +4 -4
  55. package/cjs/providers/WalletProvider/WalletProvider.js +1 -1
  56. package/cjs/providers/WidgetProvider/WidgetProvider.js +3 -2
  57. package/cjs/stores/StoreProvider.d.ts +3 -0
  58. package/cjs/stores/StoreProvider.js +13 -0
  59. package/cjs/stores/chains/ChainOrderStore.d.ts +9 -0
  60. package/cjs/stores/chains/ChainOrderStore.js +44 -0
  61. package/cjs/stores/chains/createChainOrderStore.d.ts +4 -0
  62. package/cjs/stores/chains/{useChainOrderStore.js → createChainOrderStore.js} +4 -4
  63. package/cjs/stores/chains/index.d.ts +2 -1
  64. package/cjs/stores/chains/index.js +2 -1
  65. package/cjs/stores/chains/types.d.ts +2 -2
  66. package/cjs/stores/chains/useChainOrder.js +2 -2
  67. package/cjs/stores/index.d.ts +1 -0
  68. package/cjs/stores/index.js +1 -0
  69. package/cjs/stores/routes/RouteExecutionStore.d.ts +9 -0
  70. package/cjs/stores/routes/RouteExecutionStore.js +44 -0
  71. package/cjs/stores/routes/createRouteExecutionStore.d.ts +3 -0
  72. package/cjs/stores/routes/{useRouteExecutionStore.js → createRouteExecutionStore.js} +6 -4
  73. package/cjs/stores/routes/index.d.ts +1 -1
  74. package/cjs/stores/routes/index.js +1 -1
  75. package/cjs/stores/routes/types.d.ts +5 -5
  76. package/cjs/stores/routes/useExecutingRoutesIds.js +2 -2
  77. package/cjs/stores/routes/useSetExecutableRoute.js +2 -2
  78. package/cjs/stores/routes/useSwapHistory.js +2 -2
  79. package/cjs/stores/settings/SettingsStore.d.ts +11 -0
  80. package/cjs/stores/settings/SettingsStore.js +58 -0
  81. package/cjs/stores/settings/createSettingsStore.d.ts +5 -0
  82. package/cjs/stores/settings/{useSettingsStore.js → createSettingsStore.js} +4 -19
  83. package/cjs/stores/settings/index.d.ts +1 -1
  84. package/cjs/stores/settings/index.js +1 -1
  85. package/cjs/stores/settings/types.d.ts +4 -4
  86. package/cjs/stores/settings/useAppearance.js +2 -2
  87. package/cjs/stores/settings/useSettings.js +2 -2
  88. package/cjs/stores/types.d.ts +5 -0
  89. package/cjs/stores/types.js +2 -0
  90. package/cjs/types/widget.d.ts +1 -0
  91. package/components/ActiveSwaps/ActiveSwaps.style.d.ts +2 -2
  92. package/components/ActiveSwaps/ActiveSwaps.style.js +1 -1
  93. package/components/AppContainer.d.ts +2 -2
  94. package/components/BottomSheet/BottomSheet.d.ts +1 -1
  95. package/components/Card/Card.d.ts +5 -3
  96. package/components/Card/Card.js +1 -3
  97. package/components/ChainSelect/ChainSelect.d.ts +0 -1
  98. package/components/ChainSelect/ChainSelect.style.d.ts +7 -5
  99. package/components/GasSufficiencyMessage/GasSufficiencyMessage.style.d.ts +2 -2
  100. package/components/Header/Header.style.d.ts +3 -3
  101. package/components/ReverseTokensButton/ReverseTokensButton.style.d.ts +1 -1
  102. package/components/SendToWallet/SendToWallet.style.d.ts +1 -1
  103. package/components/SmallAvatar.d.ts +2 -2
  104. package/components/Step/CircularProgress.d.ts +0 -1
  105. package/components/Step/CircularProgress.style.d.ts +2 -2
  106. package/components/Step/StepList.d.ts +0 -1
  107. package/components/Step/StepProcess.style.d.ts +1 -1
  108. package/components/SwapInput/SwapInput.style.d.ts +1 -1
  109. package/components/SwapInput/SwapInputAdornment.style.d.ts +1 -1
  110. package/components/SwapInput/SwapInputEndAdornment.d.ts +0 -1
  111. package/components/SwapRouteCard/SwapRouteCard.style.d.ts +1 -1
  112. package/components/SwapRouteCard/SwapRouteCard.style.js +1 -1
  113. package/components/SwapRouteCard/SwapRouteCardSkeleton.js +3 -1
  114. package/components/SwapRoutes/SwapRoutes.style.d.ts +6 -6
  115. package/components/SwapRoutes/SwapRoutesExpanded.d.ts +0 -1
  116. package/components/Switch.js +1 -1
  117. package/components/Token/Token.style.d.ts +4 -4
  118. package/components/Token/Token.style.js +4 -2
  119. package/components/TokenAvatar/TokenAvatar.style.d.ts +4 -4
  120. package/components/TokenList/TokenList.style.d.ts +1 -1
  121. package/components/TokenList/TokenList.style.js +1 -1
  122. package/config/theme.js +22 -27
  123. package/config/version.d.ts +1 -1
  124. package/config/version.js +1 -1
  125. package/hooks/useChains.js +3 -4
  126. package/hooks/useRouteExecution.js +5 -4
  127. package/hooks/useTools.js +3 -2
  128. package/package.json +11 -11
  129. package/pages/ActiveSwapsPage/ActiveSwapsPage.d.ts +0 -1
  130. package/pages/SelectChainPage/SelectChainPage.style.js +1 -1
  131. package/pages/SelectNativeTokenPage/SelectNativeTokenPage.style.js +1 -1
  132. package/pages/SelectTokenPage/SearchTokenInput.d.ts +0 -1
  133. package/pages/SelectWalletPage/SelectWalletPage.d.ts +0 -1
  134. package/pages/SelectWalletPage/SelectWalletPage.style.js +1 -1
  135. package/pages/SettingsPage/AdvancedPreferences.d.ts +0 -1
  136. package/pages/SettingsPage/ColorSchemeButtonGroup.style.d.ts +1 -1
  137. package/pages/SettingsPage/GasPriceSelect.d.ts +0 -1
  138. package/pages/SettingsPage/SettingsPage.d.ts +0 -1
  139. package/pages/SettingsPage/ShowDestinationWallet.d.ts +0 -1
  140. package/pages/SettingsPage/SlippageInput.d.ts +0 -1
  141. package/pages/SwapPage/StatusBottomSheet.style.d.ts +4 -4
  142. package/providers/WalletProvider/WalletProvider.js +1 -1
  143. package/providers/WidgetProvider/WidgetProvider.js +4 -3
  144. package/stores/StoreProvider.d.ts +3 -0
  145. package/stores/StoreProvider.js +9 -0
  146. package/stores/chains/ChainOrderStore.d.ts +9 -0
  147. package/stores/chains/ChainOrderStore.js +38 -0
  148. package/stores/chains/createChainOrderStore.d.ts +4 -0
  149. package/stores/chains/{useChainOrderStore.js → createChainOrderStore.js} +2 -3
  150. package/stores/chains/index.d.ts +2 -1
  151. package/stores/chains/index.js +2 -1
  152. package/stores/chains/types.d.ts +2 -2
  153. package/stores/chains/useChainOrder.js +1 -1
  154. package/stores/index.d.ts +1 -0
  155. package/stores/index.js +1 -0
  156. package/stores/routes/RouteExecutionStore.d.ts +9 -0
  157. package/stores/routes/RouteExecutionStore.js +38 -0
  158. package/stores/routes/createRouteExecutionStore.d.ts +3 -0
  159. package/stores/routes/{useRouteExecutionStore.js → createRouteExecutionStore.js} +4 -3
  160. package/stores/routes/index.d.ts +1 -1
  161. package/stores/routes/index.js +1 -1
  162. package/stores/routes/types.d.ts +5 -5
  163. package/stores/routes/useExecutingRoutesIds.js +1 -1
  164. package/stores/routes/useSetExecutableRoute.js +1 -1
  165. package/stores/routes/useSwapHistory.js +1 -1
  166. package/stores/settings/SettingsStore.d.ts +11 -0
  167. package/stores/settings/SettingsStore.js +51 -0
  168. package/stores/settings/createSettingsStore.d.ts +5 -0
  169. package/stores/settings/{useSettingsStore.js → createSettingsStore.js} +2 -17
  170. package/stores/settings/index.d.ts +1 -1
  171. package/stores/settings/index.js +1 -1
  172. package/stores/settings/types.d.ts +4 -4
  173. package/stores/settings/useAppearance.js +1 -1
  174. package/stores/settings/useSettings.js +1 -1
  175. package/stores/types.d.ts +5 -0
  176. package/stores/types.js +1 -0
  177. package/tsconfig.cjs.tsbuildinfo +1 -1
  178. package/types/widget.d.ts +1 -0
  179. package/cjs/stores/chains/useChainOrderStore.d.ts +0 -17
  180. package/cjs/stores/routes/useRouteExecutionStore.d.ts +0 -16
  181. package/cjs/stores/settings/useSettingsStore.d.ts +0 -44
  182. package/stores/chains/useChainOrderStore.d.ts +0 -17
  183. package/stores/routes/useRouteExecutionStore.d.ts +0 -16
  184. package/stores/settings/useSettingsStore.d.ts +0 -44
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lifi/widget",
3
- "version": "1.28.4",
3
+ "version": "1.29.1",
4
4
  "description": "LI.FI Widget for cross-chain bridging and swapping. It will drive your multi-chain strategy and attract new users from everywhere.",
5
5
  "main": "./cjs/index.js",
6
6
  "module": "./index.js",
@@ -46,13 +46,13 @@
46
46
  "@lifi/sdk": "^1.7.2",
47
47
  "@lifi/wallet-management": "^1.2.4",
48
48
  "@mui/icons-material": "^5.11.0",
49
- "@mui/lab": "^5.0.0-alpha.115",
50
- "@mui/material": "^5.11.4",
51
- "@sentry/integrations": "^7.30.0",
52
- "@sentry/react": "^7.30.0",
53
- "@sentry/tracing": "^7.30.0",
54
- "@tanstack/react-query": "^4.22.0",
55
- "@tanstack/react-virtual": "^3.0.0-beta.36",
49
+ "@mui/lab": "^5.0.0-alpha.116",
50
+ "@mui/material": "^5.11.5",
51
+ "@sentry/integrations": "^7.31.1",
52
+ "@sentry/react": "^7.31.1",
53
+ "@sentry/tracing": "^7.31.1",
54
+ "@tanstack/react-query": "^4.22.4",
55
+ "@tanstack/react-virtual": "^3.0.0-beta.39",
56
56
  "big.js": "^6.2.1",
57
57
  "i18next": "^22.4.9",
58
58
  "i18next-browser-languagedetector": "^7.0.1",
@@ -60,12 +60,12 @@
60
60
  "mitt": "^3.0.0",
61
61
  "react": "^18.2.0",
62
62
  "react-dom": "^18.2.0",
63
- "react-hook-form": "^7.41.5",
63
+ "react-hook-form": "^7.42.1",
64
64
  "react-i18next": "^12.1.4",
65
- "react-router-dom": "^6.6.2",
65
+ "react-router-dom": "^6.7.0",
66
66
  "react-timer-hook": "^3.0.5",
67
67
  "uuid": "^9.0.0",
68
- "zustand": "^4.3.1"
68
+ "zustand": "^4.3.2"
69
69
  },
70
70
  "peerDependencies": {
71
71
  "@types/react": "^18.0.0",
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const ActiveSwapsPage: () => JSX.Element;
@@ -3,7 +3,7 @@ import { listItemTextClasses } from '@mui/material/ListItemText';
3
3
  import { styled } from '@mui/material/styles';
4
4
  import { getContrastAlphaColor } from '../../utils';
5
5
  export const ListItemButton = styled(MuiListItemButton)(({ theme }) => ({
6
- borderRadius: theme.shape.borderRadiusSecondary,
6
+ borderRadius: theme.shape.borderRadius,
7
7
  paddingLeft: theme.spacing(1.5),
8
8
  height: 56,
9
9
  '&:hover': {
@@ -3,7 +3,7 @@ import { listItemTextClasses } from '@mui/material/ListItemText';
3
3
  import { styled } from '@mui/material/styles';
4
4
  import { getContrastAlphaColor } from '../../utils';
5
5
  export const ListItemButton = styled(MuiListItemButton)(({ theme }) => ({
6
- borderRadius: theme.shape.borderRadiusSecondary,
6
+ borderRadius: theme.shape.borderRadius,
7
7
  paddingLeft: theme.spacing(1.5),
8
8
  height: 56,
9
9
  '&:hover': {
@@ -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;
@@ -3,7 +3,7 @@ import { listItemTextClasses } from '@mui/material/ListItemText';
3
3
  import { styled } from '@mui/material/styles';
4
4
  import { getContrastAlphaColor } from '../../utils';
5
5
  export const ListItemButton = styled(MuiListItemButton)(({ theme }) => ({
6
- borderRadius: theme.shape.borderRadiusSecondary,
6
+ borderRadius: theme.shape.borderRadius,
7
7
  paddingLeft: theme.spacing(1.5),
8
8
  height: 56,
9
9
  '&:hover': {
@@ -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;
@@ -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;
@@ -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 {};
@@ -12,7 +12,7 @@ import { addChain as walletAddChain, switchChain as walletSwitchChain, switchCha
12
12
  import { createContext, useCallback, useContext, useEffect, useMemo, useState, } from 'react';
13
13
  import { useWidgetConfig } from '../WidgetProvider';
14
14
  const stub = () => {
15
- throw new Error('You forgot to wrap your component in <WalletProvider>.');
15
+ throw new Error(`You forgot to wrap your component in <${WalletProvider.name}>.`);
16
16
  };
17
17
  const initialContext = {
18
18
  connect: stub,
@@ -12,7 +12,7 @@ var __rest = (this && this.__rest) || function (s, e) {
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
13
  import { getChainByKey } from '@lifi/sdk';
14
14
  import { createContext, useContext, useEffect, useMemo } from 'react';
15
- import { setDefaultSettings } from '../../stores';
15
+ import { setDefaultSettings, useSettingsStoreContext } from '../../stores';
16
16
  import { formatAmount } from '../../utils';
17
17
  const initialContext = {
18
18
  disabledChains: [],
@@ -21,6 +21,7 @@ const WidgetContext = createContext(initialContext);
21
21
  export const useWidgetConfig = () => useContext(WidgetContext);
22
22
  export const WidgetProvider = (_a) => {
23
23
  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"]);
24
+ const settingsStoreContext = useSettingsStoreContext();
24
25
  const value = useMemo(() => {
25
26
  var _a, _b, _c, _d, _e, _f;
26
27
  try {
@@ -57,7 +58,7 @@ export const WidgetProvider = (_a) => {
57
58
  }
58
59
  }, [config, fromAmount, fromChain, fromToken, toChain, toToken]);
59
60
  useEffect(() => {
60
- setDefaultSettings(value);
61
- }, [value]);
61
+ setDefaultSettings(settingsStoreContext, value);
62
+ }, [settingsStoreContext, value]);
62
63
  return (_jsx(WidgetContext.Provider, Object.assign({ value: value }, { children: children })));
63
64
  };
@@ -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,9 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ChainOrderStoreProvider } from './chains';
3
+ import { RouteExecutionStoreProvider } from './routes';
4
+ import { SettingsStoreProvider } from './settings';
5
+ export const StoreProvider = ({ children, namePrefix }) => {
6
+ return (_jsx(RouteExecutionStoreProvider, Object.assign({ namePrefix: namePrefix }, { children: _jsx(SettingsStoreProvider
7
+ // namePrefix={namePrefix}
8
+ , { children: _jsx(ChainOrderStoreProvider, Object.assign({ namePrefix: namePrefix }, { children: children })) }) })));
9
+ };
@@ -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,38 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ /* eslint-disable no-underscore-dangle */
14
+ import { createContext, useContext, useRef } from 'react';
15
+ import { createChainOrderStore } from './createChainOrderStore';
16
+ export const ChainOrderStoreContext = createContext(null);
17
+ export function ChainOrderStoreProvider(_a) {
18
+ var { children } = _a, props = __rest(_a, ["children"]);
19
+ const storeRef = useRef();
20
+ if (!storeRef.current) {
21
+ storeRef.current = createChainOrderStore(props);
22
+ }
23
+ return (_jsx(ChainOrderStoreContext.Provider, Object.assign({ value: storeRef.current }, { children: children })));
24
+ }
25
+ export function useChainOrderStore(selector, equalityFn) {
26
+ const useStore = useContext(ChainOrderStoreContext);
27
+ if (!useStore) {
28
+ throw new Error(`You forgot to wrap your component in <${ChainOrderStoreProvider.name}>.`);
29
+ }
30
+ return useStore(selector, equalityFn);
31
+ }
32
+ export function useChainOrderStoreContext() {
33
+ const useStore = useContext(ChainOrderStoreContext);
34
+ if (!useStore) {
35
+ throw new Error(`You forgot to wrap your component in <${ChainOrderStoreProvider.name}>.`);
36
+ }
37
+ return useStore;
38
+ }
@@ -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,8 +1,7 @@
1
- /* eslint-disable no-underscore-dangle */
2
1
  import { create } from 'zustand';
3
2
  import { persist } from 'zustand/middleware';
4
3
  export const maxChainToOrder = 9;
5
- export const useChainOrderStore = create()(persist((set, get) => ({
4
+ export const createChainOrderStore = ({ namePrefix }) => create(persist((set, get) => ({
6
5
  chainOrder: [],
7
6
  availableChains: [],
8
7
  initializeChains: (chainIds) => {
@@ -44,7 +43,7 @@ export const useChainOrderStore = create()(persist((set, get) => ({
44
43
  });
45
44
  },
46
45
  }), {
47
- name: 'li.fi-widget-chains-order',
46
+ name: `${namePrefix || 'li.fi'}-widget-chains-order`,
48
47
  version: 0,
49
48
  partialize: (state) => ({ chainOrder: state.chainOrder }),
50
49
  }));
@@ -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';
@@ -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';
@@ -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
  }
@@ -1,5 +1,5 @@
1
1
  import { shallow } from 'zustand/shallow';
2
- import { useChainOrderStore } from './useChainOrderStore';
2
+ import { useChainOrderStore } from './ChainOrderStore';
3
3
  export const useChainOrder = () => {
4
4
  return useChainOrderStore((state) => [state.chainOrder, state.setChain], shallow);
5
5
  };
package/stores/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './chains';
2
2
  export * from './routes';
3
3
  export * from './settings';
4
+ export * from './StoreProvider';
package/stores/index.js CHANGED
@@ -1,3 +1,4 @@
1
1
  export * from './chains';
2
2
  export * from './routes';
3
3
  export * from './settings';
4
+ export * from './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 { 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,38 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ /* eslint-disable no-underscore-dangle */
14
+ import { createContext, useContext, useRef } from 'react';
15
+ import { createRouteExecutionStore } from './createRouteExecutionStore';
16
+ export const RouteExecutionStoreContext = createContext(null);
17
+ export function RouteExecutionStoreProvider(_a) {
18
+ var { children } = _a, props = __rest(_a, ["children"]);
19
+ const storeRef = useRef();
20
+ if (!storeRef.current) {
21
+ storeRef.current = createRouteExecutionStore(props);
22
+ }
23
+ return (_jsx(RouteExecutionStoreContext.Provider, Object.assign({ value: storeRef.current }, { children: children })));
24
+ }
25
+ export function useRouteExecutionStore(selector, equalityFn) {
26
+ const useStore = useContext(RouteExecutionStoreContext);
27
+ if (!useStore) {
28
+ throw new Error(`You forgot to wrap your component in <${RouteExecutionStoreProvider.name}>.`);
29
+ }
30
+ return useStore(selector, equalityFn);
31
+ }
32
+ export function useRouteExecutionStoreContext() {
33
+ const useStore = useContext(RouteExecutionStoreContext);
34
+ if (!useStore) {
35
+ throw new Error(`You forgot to wrap your component in <${RouteExecutionStoreProvider.name}>.`);
36
+ }
37
+ return useStore;
38
+ }
@@ -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>>;
@@ -3,7 +3,7 @@ import { persist } from 'zustand/middleware';
3
3
  import { hasEnumFlag } from '../../utils';
4
4
  import { RouteExecutionStatus } from './types';
5
5
  import { isRouteDone, isRouteFailed, isRoutePartiallyDone, isRouteRefunded, } from './utils';
6
- export const useRouteExecutionStore = create()(persist((set, get) => ({
6
+ export const createRouteExecutionStore = ({ namePrefix }) => create(persist((set, get) => ({
7
7
  routes: {},
8
8
  setExecutableRoute: (route) => {
9
9
  if (!get().routes[route.id]) {
@@ -37,7 +37,8 @@ export const useRouteExecutionStore = create()(persist((set, get) => ({
37
37
  }
38
38
  const isDone = isRouteDone(route);
39
39
  if (isDone) {
40
- updatedState.routes[route.id].status = RouteExecutionStatus.Done;
40
+ updatedState.routes[route.id].status =
41
+ RouteExecutionStatus.Done;
41
42
  if (isRoutePartiallyDone(route)) {
42
43
  updatedState.routes[route.id].status |=
43
44
  RouteExecutionStatus.Partial;
@@ -90,7 +91,7 @@ export const useRouteExecutionStore = create()(persist((set, get) => ({
90
91
  };
91
92
  }),
92
93
  }), {
93
- name: 'li.fi-widget-routes',
94
+ name: `${namePrefix || 'li.fi'}-widget-routes`,
94
95
  version: 1,
95
96
  partialize: (state) => ({ routes: state.routes }),
96
97
  merge: (persistedState, currentState) => {
@@ -1,7 +1,7 @@
1
+ export * from './RouteExecutionStore';
1
2
  export * from './types';
2
3
  export * from './useExecutingRoutesIds';
3
4
  export * from './useRecommendedRouteStore';
4
- export * from './useRouteExecutionStore';
5
5
  export * from './useSetExecutableRoute';
6
6
  export * from './useSwapHistory';
7
7
  export * from './utils';
@@ -1,7 +1,7 @@
1
+ export * from './RouteExecutionStore';
1
2
  export * from './types';
2
3
  export * from './useExecutingRoutesIds';
3
4
  export * from './useRecommendedRouteStore';
4
- export * from './useRouteExecutionStore';
5
5
  export * from './useSetExecutableRoute';
6
6
  export * from './useSwapHistory';
7
7
  export * from './utils';
@@ -1,5 +1,9 @@
1
1
  import type { Route } from '@lifi/sdk';
2
- export interface RouteExecutionStore {
2
+ export interface RouteExecution {
3
+ route: Route;
4
+ status: RouteExecutionStatus;
5
+ }
6
+ export interface RouteExecutionState {
3
7
  routes: Partial<Record<string, RouteExecution>>;
4
8
  setExecutableRoute: (route: Route) => void;
5
9
  updateRoute: (route: Route) => void;
@@ -15,10 +19,6 @@ export declare enum RouteExecutionStatus {
15
19
  Partial = 8,
16
20
  Refunded = 16
17
21
  }
18
- export interface RouteExecution {
19
- route: Route;
20
- status: RouteExecutionStatus;
21
- }
22
22
  export interface RecommendedRouteStore {
23
23
  recommendedRoute?: Route;
24
24
  setRecommendedRoute: (route?: Route) => void;
@@ -1,6 +1,6 @@
1
1
  import { shallow } from 'zustand/shallow';
2
+ import { useRouteExecutionStore } from './RouteExecutionStore';
2
3
  import { RouteExecutionStatus } from './types';
3
- import { useRouteExecutionStore } from './useRouteExecutionStore';
4
4
  export const useExecutingRoutesIds = (address) => {
5
5
  return useRouteExecutionStore((state) => Object.values(state.routes)
6
6
  .filter((item) => item.route.fromAddress === address &&
@@ -1,4 +1,4 @@
1
- import { useRouteExecutionStore } from './useRouteExecutionStore';
1
+ import { useRouteExecutionStore } from './RouteExecutionStore';
2
2
  export const useSetExecutableRoute = () => {
3
3
  return useRouteExecutionStore((state) => state.setExecutableRoute);
4
4
  };
@@ -1,7 +1,7 @@
1
1
  import { shallow } from 'zustand/shallow';
2
2
  import { hasEnumFlag } from '../../utils';
3
+ import { useRouteExecutionStore } from './RouteExecutionStore';
3
4
  import { RouteExecutionStatus } from './types';
4
- import { useRouteExecutionStore } from './useRouteExecutionStore';
5
5
  export const useSwapHistory = (address) => {
6
6
  return useRouteExecutionStore((state) => Object.values(state.routes)
7
7
  .filter((item) => (item === null || item === void 0 ? void 0 : item.route.fromAddress) === address &&
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import type { WidgetConfig } from '@lifi/widget';
3
+ import type { StoreApi, UseBoundStore } from 'zustand';
4
+ import type { PersistStoreProviderProps } from '../types';
5
+ import type { SettingsState } from './types';
6
+ export type SettingsStore = UseBoundStore<StoreApi<SettingsState>>;
7
+ export declare const SettingsStoreContext: import("react").Context<SettingsStore | null>;
8
+ export declare function SettingsStoreProvider({ children, ...props }: PersistStoreProviderProps): JSX.Element;
9
+ export declare function useSettingsStore<T>(selector: (state: SettingsState) => T, equalityFn?: (left: T, right: T) => boolean): T;
10
+ export declare function useSettingsStoreContext(): SettingsStore;
11
+ export declare const setDefaultSettings: (useSettingsStore: SettingsStore, config?: WidgetConfig) => void;
@@ -0,0 +1,51 @@
1
+ var __rest = (this && this.__rest) || function (s, e) {
2
+ var t = {};
3
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
4
+ t[p] = s[p];
5
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
6
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
7
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
8
+ t[p[i]] = s[p[i]];
9
+ }
10
+ return t;
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ import { createContext, useContext, useRef } from 'react';
14
+ import { createSettingsStore, defaultConfigurableSettings, } from './createSettingsStore';
15
+ export const SettingsStoreContext = createContext(null);
16
+ export function SettingsStoreProvider(_a) {
17
+ var { children } = _a, props = __rest(_a, ["children"]);
18
+ const storeRef = useRef();
19
+ if (!storeRef.current) {
20
+ storeRef.current = createSettingsStore(props);
21
+ }
22
+ return (_jsx(SettingsStoreContext.Provider, Object.assign({ value: storeRef.current }, { children: children })));
23
+ }
24
+ export function useSettingsStore(selector, equalityFn) {
25
+ const useStore = useContext(SettingsStoreContext);
26
+ if (!useStore) {
27
+ throw new Error(`You forgot to wrap your component in <${SettingsStoreProvider.name}>.`);
28
+ }
29
+ return useStore(selector, equalityFn);
30
+ }
31
+ export function useSettingsStoreContext() {
32
+ const useStore = useContext(SettingsStoreContext);
33
+ if (!useStore) {
34
+ throw new Error(`You forgot to wrap your component in <${SettingsStoreProvider.name}>.`);
35
+ }
36
+ return useStore;
37
+ }
38
+ export const setDefaultSettings = (useSettingsStore, config) => {
39
+ var _a, _b, _c, _d, _e;
40
+ const { slippage, routePriority, setValue } = useSettingsStore.getState();
41
+ const defaultSlippage = ((config === null || config === void 0 ? void 0 : config.slippage) ||
42
+ ((_b = (_a = config === null || config === void 0 ? void 0 : config.sdkConfig) === null || _a === void 0 ? void 0 : _a.defaultRouteOptions) === null || _b === void 0 ? void 0 : _b.slippage) ||
43
+ 0) * 100;
44
+ const defaultRoutePriority = (config === null || config === void 0 ? void 0 : config.routePriority) || ((_d = (_c = config === null || config === void 0 ? void 0 : config.sdkConfig) === null || _c === void 0 ? void 0 : _c.defaultRouteOptions) === null || _d === void 0 ? void 0 : _d.order);
45
+ if (!slippage) {
46
+ setValue('slippage', (_e = (defaultSlippage || defaultConfigurableSettings.slippage)) === null || _e === void 0 ? void 0 : _e.toString());
47
+ }
48
+ if (!routePriority) {
49
+ setValue('routePriority', defaultRoutePriority || defaultConfigurableSettings.routePriority);
50
+ }
51
+ };
@@ -0,0 +1,5 @@
1
+ import type { PersistStoreProps } from '../types';
2
+ import type { SettingsProps, SettingsState } from './types';
3
+ export declare const defaultConfigurableSettings: Pick<SettingsState, 'routePriority' | 'slippage'>;
4
+ export declare const defaultSettings: SettingsProps;
5
+ export declare const createSettingsStore: ({ namePrefix }: PersistStoreProps) => import("zustand").UseBoundStore<import("zustand").StoreApi<SettingsState>>;
@@ -9,7 +9,6 @@ var __rest = (this && this.__rest) || function (s, e) {
9
9
  }
10
10
  return t;
11
11
  };
12
- /* eslint-disable no-underscore-dangle */
13
12
  import { create } from 'zustand';
14
13
  import { persist } from 'zustand/middleware';
15
14
  import { SettingsToolTypes } from './types';
@@ -23,7 +22,7 @@ export const defaultSettings = {
23
22
  advancedPreferences: false,
24
23
  showDestinationWallet: true,
25
24
  };
26
- export const useSettingsStore = create()(persist((set) => (Object.assign(Object.assign({}, defaultSettings), { setValue: (key, value) => set(() => ({
25
+ export const createSettingsStore = ({ namePrefix }) => create(persist((set) => (Object.assign(Object.assign({}, defaultSettings), { setValue: (key, value) => set(() => ({
27
26
  [key]: value,
28
27
  })), setValues: (values) => set((state) => {
29
28
  const updatedState = Object.assign({}, state);
@@ -68,7 +67,7 @@ export const useSettingsStore = create()(persist((set) => (Object.assign(Object.
68
67
  return values;
69
68
  }, {}),
70
69
  })) })), {
71
- name: 'li.fi-widget-settings',
70
+ name: `${namePrefix || 'li.fi'}-widget-settings`,
72
71
  version: 2,
73
72
  partialize: (state) => {
74
73
  const { enabledBridges, enabledExchanges } = state, partializedState = __rest(state, ["enabledBridges", "enabledExchanges"]);
@@ -93,17 +92,3 @@ export const useSettingsStore = create()(persist((set) => (Object.assign(Object.
93
92
  return persistedState;
94
93
  },
95
94
  }));
96
- export const setDefaultSettings = (config) => {
97
- var _a, _b, _c, _d, _e;
98
- const { slippage, routePriority, setValue } = useSettingsStore.getState();
99
- const defaultSlippage = ((config === null || config === void 0 ? void 0 : config.slippage) ||
100
- ((_b = (_a = config === null || config === void 0 ? void 0 : config.sdkConfig) === null || _a === void 0 ? void 0 : _a.defaultRouteOptions) === null || _b === void 0 ? void 0 : _b.slippage) ||
101
- 0) * 100;
102
- const defaultRoutePriority = (config === null || config === void 0 ? void 0 : config.routePriority) || ((_d = (_c = config === null || config === void 0 ? void 0 : config.sdkConfig) === null || _c === void 0 ? void 0 : _c.defaultRouteOptions) === null || _d === void 0 ? void 0 : _d.order);
103
- if (!slippage) {
104
- setValue('slippage', (_e = (defaultSlippage || defaultConfigurableSettings.slippage)) === null || _e === void 0 ? void 0 : _e.toString());
105
- }
106
- if (!routePriority) {
107
- setValue('routePriority', defaultRoutePriority || defaultConfigurableSettings.routePriority);
108
- }
109
- };
@@ -1,5 +1,5 @@
1
+ export * from './SettingsStore';
1
2
  export * from './types';
2
3
  export * from './useAppearance';
3
4
  export * from './useSendToWalletStore';
4
5
  export * from './useSettings';
5
- export * from './useSettingsStore';