@shopgate/engage 7.32.0-beta.3 → 7.32.0-beta.5

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 (166) hide show
  1. package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.d.ts +2 -1
  2. package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.d.ts.map +1 -1
  3. package/admin-preview/components/FrontendSettingsPreviewBridge/FrontendSettingsPreviewBridge.js +23 -1
  4. package/admin-preview/components/FrontendSettingsPreviewBridge/helpers.d.ts +7 -1
  5. package/admin-preview/components/FrontendSettingsPreviewBridge/helpers.d.ts.map +1 -1
  6. package/admin-preview/components/FrontendSettingsPreviewBridge/helpers.js +14 -2
  7. package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts +6 -0
  8. package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts.map +1 -1
  9. package/components/Badge/Badge.d.ts +30 -0
  10. package/components/Badge/Badge.d.ts.map +1 -0
  11. package/components/Badge/Badge.js +48 -0
  12. package/components/Badge/index.d.ts +3 -0
  13. package/components/Badge/index.d.ts.map +1 -0
  14. package/components/Badge/index.js +1 -0
  15. package/components/Badge/spec.d.ts +2 -0
  16. package/components/Badge/spec.d.ts.map +1 -0
  17. package/components/Badge/spec.js +75 -0
  18. package/components/View/components/Content/index.d.ts.map +1 -1
  19. package/components/View/components/Content/index.js +4 -1
  20. package/components/index.d.ts +1 -0
  21. package/components/index.d.ts.map +1 -1
  22. package/components/index.js +2 -1
  23. package/core/hooks/useLocalStorage.d.ts +8 -0
  24. package/core/hooks/useLocalStorage.d.ts.map +1 -1
  25. package/core/hooks/useLocalStorage.js +22 -15
  26. package/core/initialization/fetchSettings.d.ts +12 -0
  27. package/core/initialization/fetchSettings.d.ts.map +1 -0
  28. package/core/initialization/fetchSettings.js +134 -0
  29. package/core/initialization/index.d.ts +33 -2
  30. package/core/initialization/index.d.ts.map +1 -1
  31. package/core/initialization/index.js +25 -103
  32. package/package.json +9 -9
  33. package/page/components/NotFound.d.ts +7 -0
  34. package/page/components/NotFound.d.ts.map +1 -0
  35. package/page/components/NotFound.js +1 -2
  36. package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.d.ts +52 -0
  37. package/page/components/ResponsiveWidgetImage/ResponsiveWidgetImage.d.ts.map +1 -0
  38. package/page/components/ResponsiveWidgetImage/index.d.ts +2 -0
  39. package/page/components/ResponsiveWidgetImage/index.d.ts.map +1 -0
  40. package/page/components/WidgetRichText/WidgetRichText.d.ts +25 -0
  41. package/page/components/WidgetRichText/WidgetRichText.d.ts.map +1 -0
  42. package/page/components/WidgetRichText/index.d.ts +2 -0
  43. package/page/components/WidgetRichText/index.d.ts.map +1 -0
  44. package/page/components/WidgetVideo/WidgetVideo.d.ts +43 -0
  45. package/page/components/WidgetVideo/WidgetVideo.d.ts.map +1 -0
  46. package/page/components/WidgetVideo/WidgetVideo.js +33 -39
  47. package/page/components/WidgetVideo/index.d.ts +2 -0
  48. package/page/components/WidgetVideo/index.d.ts.map +1 -0
  49. package/page/components/Widgets/Overlay.d.ts +17 -0
  50. package/page/components/Widgets/Overlay.d.ts.map +1 -0
  51. package/page/components/Widgets/Overlay.js +24 -38
  52. package/page/components/Widgets/Tooltip.d.ts +20 -0
  53. package/page/components/Widgets/Tooltip.d.ts.map +1 -0
  54. package/page/components/Widgets/Tooltip.js +6 -10
  55. package/page/components/Widgets/Widget.d.ts +32 -0
  56. package/page/components/Widgets/Widget.d.ts.map +1 -0
  57. package/page/components/Widgets/Widget.js +7 -18
  58. package/page/components/Widgets/WidgetContext.d.ts +32 -38
  59. package/page/components/Widgets/WidgetContext.d.ts.map +1 -0
  60. package/page/components/Widgets/WidgetContext.js +2 -8
  61. package/page/components/Widgets/WidgetProvider.d.ts +25 -0
  62. package/page/components/Widgets/WidgetProvider.d.ts.map +1 -0
  63. package/page/components/Widgets/WidgetProvider.js +5 -12
  64. package/page/components/Widgets/Widgets.d.ts +16 -0
  65. package/page/components/Widgets/Widgets.d.ts.map +1 -0
  66. package/page/components/Widgets/Widgets.js +5 -12
  67. package/page/components/Widgets/WidgetsPreviewContext.d.ts +21 -0
  68. package/page/components/Widgets/WidgetsPreviewContext.d.ts.map +1 -0
  69. package/page/components/Widgets/WidgetsPreviewContext.js +5 -7
  70. package/page/components/Widgets/WidgetsPreviewProvider.d.ts +18 -0
  71. package/page/components/Widgets/WidgetsPreviewProvider.d.ts.map +1 -0
  72. package/page/components/Widgets/WidgetsPreviewProvider.js +5 -6
  73. package/page/components/Widgets/constants.d.ts +5 -0
  74. package/page/components/Widgets/constants.d.ts.map +1 -0
  75. package/page/components/Widgets/constants.js +3 -1
  76. package/page/components/Widgets/events.d.ts +38 -0
  77. package/page/components/Widgets/events.d.ts.map +1 -0
  78. package/page/components/Widgets/events.js +8 -12
  79. package/page/components/Widgets/helpers.d.ts +50 -0
  80. package/page/components/Widgets/helpers.d.ts.map +1 -0
  81. package/page/components/Widgets/helpers.js +8 -13
  82. package/page/components/Widgets/hooks.d.ts +13 -0
  83. package/page/components/Widgets/hooks.d.ts.map +1 -0
  84. package/page/components/Widgets/hooks.js +13 -11
  85. package/page/components/Widgets/index.d.ts +3 -0
  86. package/page/components/Widgets/index.d.ts.map +1 -0
  87. package/page/components/Widgets/types.d.ts +111 -113
  88. package/page/components/Widgets/types.d.ts.map +1 -0
  89. package/page/components/Widgets/types.js +1 -0
  90. package/page/components/index.d.ts +5 -0
  91. package/page/components/index.d.ts.map +1 -0
  92. package/page/constants/actionTypes.d.ts +4 -0
  93. package/page/constants/actionTypes.d.ts.map +1 -0
  94. package/page/constants/index.d.ts +25 -0
  95. package/page/constants/index.d.ts.map +1 -0
  96. package/page/helpers/index.d.ts +67 -62
  97. package/page/helpers/index.d.ts.map +1 -0
  98. package/page/helpers/index.js +24 -25
  99. package/page/hooks/index.d.ts +54 -53
  100. package/page/hooks/index.d.ts.map +1 -0
  101. package/page/hooks/index.js +20 -15
  102. package/page/selectors/index.d.ts +32 -0
  103. package/page/selectors/index.d.ts.map +1 -0
  104. package/page/widgets/Video/Video.d.ts +6 -0
  105. package/page/widgets/Video/Video.d.ts.map +1 -0
  106. package/page/widgets/Video/Video.js +0 -2
  107. package/page/widgets/Video/hooks.d.ts +53 -0
  108. package/page/widgets/Video/hooks.d.ts.map +1 -0
  109. package/page/widgets/Video/hooks.js +4 -12
  110. package/page/widgets/Video/index.d.ts +2 -0
  111. package/page/widgets/Video/index.d.ts.map +1 -0
  112. package/product/components/Description/index.js +0 -2
  113. package/product/components/ProductCard/index.js +1 -0
  114. package/product/components/ProductGrid/components/Item/components/ItemDetails/index.js +1 -1
  115. package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +10 -0
  116. package/product/components/ProductGrid/components/Item/components/ItemName/index.js +1 -0
  117. package/product/components/ProductGrid/components/Item/index.js +0 -1
  118. package/product/components/ProductGrid/components/Layout/index.js +17 -3
  119. package/product/components/ProductGrid/constants.d.ts +2 -0
  120. package/product/components/ProductGrid/constants.d.ts.map +1 -0
  121. package/product/components/ProductGrid/constants.js +1 -0
  122. package/product/components/ProductGrid/hooks.d.ts +18 -0
  123. package/product/components/ProductGrid/hooks.d.ts.map +1 -0
  124. package/product/components/ProductGrid/hooks.js +49 -0
  125. package/product/components/ProductGrid/index.js +3 -6
  126. package/product/components/ProductGrid/spec.js +3 -0
  127. package/product/components/ProductList/components/Layout/index.js +8 -20
  128. package/settings/reducers/appSettings.d.ts.map +1 -1
  129. package/settings/reducers/appSettings.js +8 -0
  130. package/settings/selectors/appSettings.d.ts +8 -0
  131. package/settings/selectors/appSettings.d.ts.map +1 -1
  132. package/settings/selectors/appSettings.js +6 -1
  133. package/settings/types/appSettings.d.ts +21 -0
  134. package/settings/types/appSettings.d.ts.map +1 -1
  135. package/styles/helpers/index.d.ts +1 -0
  136. package/styles/helpers/index.js +1 -0
  137. package/styles/helpers/loadThemeCss.d.ts +14 -0
  138. package/styles/helpers/loadThemeCss.d.ts.map +1 -0
  139. package/styles/helpers/loadThemeCss.js +112 -0
  140. package/styles/index.d.ts +1 -1
  141. package/styles/index.d.ts.map +1 -1
  142. package/styles/reset/root.js +1 -1
  143. package/styles/theme/createDefaultThemeOptions/index.d.ts.map +1 -1
  144. package/styles/theme/createDefaultThemeOptions/index.js +12 -1
  145. package/styles/theme/createTheme/createComponents.types.d.ts +22 -0
  146. package/styles/theme/createTheme/createComponents.types.d.ts.map +1 -1
  147. package/styles/theme/createTheme/createComponents.types.js +23 -1
  148. package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.d.ts.map +1 -1
  149. package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.js +4 -1
  150. package/styles/theme/createTheme/index.d.ts +1 -0
  151. package/styles/theme/createTheme/index.d.ts.map +1 -1
  152. package/styles/theme/createTheme/index.js +2 -0
  153. package/styles/theme/createTheme/types.d.ts +2 -2
  154. package/styles/theme/createTheme/types.d.ts.map +1 -1
  155. package/styles/theme/createTheme/types.js +2 -3
  156. package/styles/theme/hooks/useColorScheme.d.ts +4 -3
  157. package/styles/theme/hooks/useColorScheme.d.ts.map +1 -1
  158. package/styles/theme/hooks/useColorScheme.js +4 -3
  159. package/styles/theme/index.d.ts +1 -1
  160. package/styles/theme/index.d.ts.map +1 -1
  161. package/styles/theme/providers/ColorSchemeContext.d.ts +19 -0
  162. package/styles/theme/providers/ColorSchemeContext.d.ts.map +1 -0
  163. package/styles/theme/providers/ColorSchemeContext.js +6 -0
  164. package/styles/theme/providers/ThemeProvider.d.ts +2 -12
  165. package/styles/theme/providers/ThemeProvider.d.ts.map +1 -1
  166. package/styles/theme/providers/ThemeProvider.js +32 -8
@@ -9,6 +9,8 @@ import createThemeFromColorScheme from "./createThemeFromColorScheme";
9
9
  import createCssVarsForColorSchemeThemes from "./createCssVarsForColorSchemeThemes";
10
10
  import applyStyles from "./applyStyles";
11
11
  import { createGetColorSchemeSelector, createSetActiveColorScheme } from "./helpers";
12
+ export { COLOR_SCHEME_NAMES } from "./types";
13
+
12
14
  /**
13
15
  * Creates a theme object for the ThemeProvider.
14
16
  * @param options The theme options.
@@ -13,8 +13,8 @@ import type { Shape, ShapeOptions } from './createShape';
13
13
  import type { Shadows } from './shadows';
14
14
  export type { Breakpoint } from './createBreakpoints';
15
15
  export type { PaletteColorsWithMain } from './createPalette';
16
- declare const colorSchemes: readonly ["light", "dark"];
17
- export type ColorSchemeName = (typeof colorSchemes)[number];
16
+ export declare const COLOR_SCHEME_NAMES: readonly ["light", "dark"];
17
+ export type ColorSchemeName = (typeof COLOR_SCHEME_NAMES)[number];
18
18
  declare const selectorTypes: readonly ["data", "class"];
19
19
  export type ColorSchemeSelectorType = (typeof selectorTypes)[number];
20
20
  type DeepPartial<T> = T extends object ? {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACxE,OAAO,KAAK,EAAE,iBAAiB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AACvF,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,KAAK,EAAE,sBAAsB,EAAE,yBAAyB,EAAE,MAAM,WAAW,CAAC;AACnF,OAAO,KAAK,EAAE,4CAA4C,EAAE,MAAM,qCAAq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AC,GAAG;QAAE,UAAU,EAAE,aAAa,CAAA;KAAC,CAAC;IACnE;;;OAGG;IACH,YAAY,EAAE,MAAM,CAAC,eAAe,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC;IACvE;;;;;;;;;;;;OAYG;IACH,WAAW,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC;CAC3C;AAED;;;;;GAKG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,GAAG;IAAE,UAAU,EAAE,UAAU,CAAA;CAAE,CAAC;AAE1F;;;GAGG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,eAAe,EAAE,gBAAgB,CAAC,CAAA;AAEzE,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,KAAK,EAAE,cAAc,CAAC,GAAG;IACxD;;OAEG;IACH,YAAY,EAAE,iBAAiB,CAAC;CACjC,GAAG,IAAI,CAAC,4CAA4C,EAAE,qBAAqB,CAAC,GAAG;IAC9E;;OAEG;IACH,sBAAsB,EAAE,sBAAsB,CAAC;IAC/C;;OAEG;IACH,oBAAoB,EAAE,yBAAyB,CAAC;CACjD,CAAC"}
@@ -1,4 +1,4 @@
1
- const colorSchemes = ['light', 'dark'];
1
+ export const COLOR_SCHEME_NAMES = ['light', 'dark'];
2
2
  const selectorTypes = ['data', 'class'];
3
3
 
4
4
  /**
@@ -17,5 +17,4 @@ const selectorTypes = ['data', 'class'];
17
17
  /**
18
18
  * A record of themes for each color scheme. Each key is a color scheme name (e.g., 'light', 'dark'),
19
19
  * and the value is a fully-resolved color-scheme theme ({@link ColorSchemeTheme}).
20
- */
21
- export {};
20
+ */
@@ -1,7 +1,8 @@
1
1
  /**
2
- * Returns the currently selected color scheme and a function to update it.
3
- * @returns An object containing the current color scheme and a function to update it.
2
+ * Provides access to the color scheme context.
3
+ * @returns The color scheme context value, containing the current `mode`, a `setMode` function to
4
+ * update it, and the list of `modes` the active theme actually provides.
4
5
  */
5
- declare const useColorScheme: () => import("../providers/ThemeProvider").ColorSchemeContextValue;
6
+ declare const useColorScheme: () => import("../providers/ColorSchemeContext").ColorSchemeContextValue;
6
7
  export default useColorScheme;
7
8
  //# sourceMappingURL=useColorScheme.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useColorScheme.d.ts","sourceRoot":"","sources":["../../../../styles/theme/hooks/useColorScheme.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,QAAA,MAAM,cAAc,oEAAuC,CAAC;AAE5D,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"useColorScheme.d.ts","sourceRoot":"","sources":["../../../../styles/theme/hooks/useColorScheme.ts"],"names":[],"mappings":"AAGA;;;;GAIG;AACH,QAAA,MAAM,cAAc,yEAAuC,CAAC;AAE5D,eAAe,cAAc,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import { useContext } from 'react';
2
- import { ColorSchemeContext } from "../providers/ThemeProvider";
2
+ import { ColorSchemeContext } from "../providers/ColorSchemeContext";
3
3
 
4
4
  /**
5
- * Returns the currently selected color scheme and a function to update it.
6
- * @returns An object containing the current color scheme and a function to update it.
5
+ * Provides access to the color scheme context.
6
+ * @returns The color scheme context value, containing the current `mode`, a `setMode` function to
7
+ * update it, and the list of `modes` the active theme actually provides.
7
8
  */
8
9
  const useColorScheme = () => useContext(ColorSchemeContext);
9
10
  export default useColorScheme;
@@ -1,6 +1,6 @@
1
1
  export { default as ThemeProvider } from './providers/ThemeProvider';
2
2
  export { createTheme } from './createTheme';
3
- export type { Theme, Breakpoint, PaletteColorsWithMain } from './createTheme';
3
+ export type { Theme, Breakpoint, PaletteColorsWithMain, ColorSchemeName, } from './createTheme';
4
4
  export { useActiveBreakpoint, useMediaQuery, useResponsiveValue, useTheme, useColorScheme, } from './hooks';
5
5
  export { withTheme, type WithThemeProps } from './hocs';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../styles/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAC9E,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../styles/theme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EACV,KAAK,EAAE,UAAU,EAAE,qBAAqB,EAAE,eAAe,GAC1D,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,cAAc,GACf,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,QAAQ,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { type Dispatch, type SetStateAction } from 'react';
2
+ import { type ColorSchemeName } from '../createTheme';
3
+ export interface ColorSchemeContextValue {
4
+ /**
5
+ * The current color scheme (e.g., 'light' or 'dark')
6
+ */
7
+ mode: ColorSchemeName | null;
8
+ /**
9
+ * Function to update the color scheme
10
+ */
11
+ setMode: Dispatch<SetStateAction<ColorSchemeName | null>>;
12
+ /**
13
+ * The modes the active theme actually provides. Only these can be set - passing anything else
14
+ * to setMode has no effect.
15
+ */
16
+ modes: ColorSchemeName[];
17
+ }
18
+ export declare const ColorSchemeContext: import("react").Context<ColorSchemeContextValue>;
19
+ //# sourceMappingURL=ColorSchemeContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ColorSchemeContext.d.ts","sourceRoot":"","sources":["../../../../styles/theme/providers/ColorSchemeContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,QAAQ,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAC1E,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtD,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,IAAI,EAAE,eAAe,GAAG,IAAI,CAAC;IAC7B;;OAEG;IACH,OAAO,EAAE,QAAQ,CAAC,cAAc,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC,CAAC;IAC1D;;;OAGG;IACH,KAAK,EAAE,eAAe,EAAE,CAAC;CAC1B;AAED,eAAO,MAAM,kBAAkB,kDAI7B,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { createContext } from 'react';
2
+ export const ColorSchemeContext = /*#__PURE__*/createContext({
3
+ mode: 'light',
4
+ setMode: () => undefined,
5
+ modes: ['light']
6
+ });
@@ -1,16 +1,6 @@
1
- import { type Theme, type ThemeInternal, type ColorSchemeName } from '../createTheme';
2
- export interface ColorSchemeContextValue {
3
- /**
4
- * The current color scheme (e.g., 'light' or 'dark')
5
- */
6
- mode: ColorSchemeName | null;
7
- /**
8
- * Function to update the color scheme
9
- */
10
- setMode: React.Dispatch<React.SetStateAction<ColorSchemeName | null>>;
11
- }
1
+ import { type Theme, type ThemeInternal } from '../createTheme';
2
+ export { ColorSchemeContext, type ColorSchemeContextValue } from './ColorSchemeContext';
12
3
  export declare const ThemeContext: import("react").Context<Theme>;
13
- export declare const ColorSchemeContext: import("react").Context<ColorSchemeContextValue>;
14
4
  type ThemeProviderProps = {
15
5
  /**
16
6
  * The theme object to provide to the context.
@@ -1 +1 @@
1
- {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../../styles/theme/providers/ThemeProvider.tsx"],"names":[],"mappings":"AAQA,OAAO,EAAE,KAAK,KAAK,EAAE,KAAK,aAAa,EAAE,KAAK,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAEtF,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,IAAI,EAAE,eAAe,GAAG,IAAI,CAAC;IAC7B;;OAEG;IACH,OAAO,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC,CAAC;CACvE;AAED,eAAO,MAAM,YAAY,gCAAqC,CAAC;AAE/D,eAAO,MAAM,kBAAkB,kDAG7B,CAAC;AAwCH,KAAK,kBAAkB,GAAG;IACxB;;OAEG;IACH,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAA;mFAtCE,kBAAkB;AAwCrB,wBAAmC"}
1
+ {"version":3,"file":"ThemeProvider.d.ts","sourceRoot":"","sources":["../../../../styles/theme/providers/ThemeProvider.tsx"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,KAAK,EAAE,KAAK,aAAa,EAC/B,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,kBAAkB,EAAE,KAAK,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AAExF,eAAO,MAAM,YAAY,gCAAqC,CAAC;AAwE/D,KAAK,kBAAkB,GAAG;IACxB;;OAEG;IACH,KAAK,EAAE,aAAa,CAAC;IACrB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B,CAAA;mFAtEE,kBAAkB;AAwErB,wBAAmC"}
@@ -1,15 +1,15 @@
1
- import { createContext, memo, useMemo, useLayoutEffect } from 'react';
1
+ import "core-js/modules/es.array.includes.js";
2
+ import { createContext, memo, useCallback, useMemo, useLayoutEffect } from 'react';
2
3
  import useLocalStorage from '@shopgate/engage/core/hooks/useLocalStorage';
4
+ import { logger } from '@shopgate/engage/core/helpers';
3
5
  import { GlobalStyles } from '@shopgate/engage/styles';
4
6
  import { isFrontendSettingsAdminPreviewActive } from '@shopgate/engage/admin-preview/helpers';
5
7
  import { FrontendSettingsPreviewBridge } from '@shopgate/engage/admin-preview/components';
6
8
  import ActiveBreakpointProvider from "./ActiveBreakpointProvider";
9
+ import { ColorSchemeContext } from "./ColorSchemeContext";
7
10
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
11
+ export { ColorSchemeContext } from "./ColorSchemeContext";
8
12
  export const ThemeContext = /*#__PURE__*/createContext({});
9
- export const ColorSchemeContext = /*#__PURE__*/createContext({
10
- mode: 'light',
11
- setMode: () => ''
12
- });
13
13
 
14
14
  /**
15
15
  * The ThemeProvider component provides the theme context to its children.
@@ -18,13 +18,37 @@ const ThemeProvider = ({
18
18
  children,
19
19
  theme
20
20
  }) => {
21
+ // The color schemes the active theme actually provides. createTheme() can be configured with only
22
+ // a subset of the possible schemes (it defaults to just `light`), so `modes` and the validation
23
+ // below are derived from the resolved theme rather than the full COLOR_SCHEME_NAMES tuple.
24
+ // Otherwise the provider could expose and accept a scheme (e.g. `dark`) the theme doesn't style,
25
+ // and setActiveColorScheme would flip the root selector to an unstyled scheme.
26
+ const modes = useMemo(() => Object.keys(theme.colorSchemes), [theme]);
21
27
  const [activeColorScheme, setActiveColorScheme] = useLocalStorage('persistedColorScheme', {
22
- initialValue: theme.defaultColorScheme
28
+ initialValue: theme.defaultColorScheme,
29
+ // The frontend settings preview runs the app in an iframe on the shop origin. Persisting the
30
+ // color scheme there would write the admin's preview choice into the visitor's own storage and
31
+ // outlive the preview, so the scheme is kept in memory only while previewing.
32
+ persist: !isFrontendSettingsAdminPreviewActive()
23
33
  });
34
+
35
+ // Wraps the raw storage setter, so an unsupported mode is rejected before it is persisted.
36
+ // Setting null is allowed and clears the stored preference.
37
+ const setMode = useCallback(value => {
38
+ setActiveColorScheme(currentColorScheme => {
39
+ const nextColorScheme = typeof value === 'function' ? value(currentColorScheme) : value;
40
+ if (nextColorScheme !== null && !modes.includes(nextColorScheme)) {
41
+ logger.warn(`ThemeProvider: "${nextColorScheme}" is not a supported color scheme.`);
42
+ return currentColorScheme;
43
+ }
44
+ return nextColorScheme;
45
+ });
46
+ }, [modes, setActiveColorScheme]);
24
47
  const colorSchemeContextValue = useMemo(() => ({
25
48
  mode: activeColorScheme,
26
- setMode: setActiveColorScheme
27
- }), [activeColorScheme, setActiveColorScheme]);
49
+ setMode,
50
+ modes
51
+ }), [activeColorScheme, modes, setMode]);
28
52
  useLayoutEffect(() => {
29
53
  if (!activeColorScheme) return;
30
54
  theme.setActiveColorScheme(activeColorScheme);