@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
@@ -7,6 +7,7 @@ import { makeStyles } from '@shopgate/engage/styles';
7
7
  import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
8
8
  const useStyles = makeStyles()(theme => ({
9
9
  root: {
10
+ fontSize: theme.typography.body2.fontSize,
10
11
  fontWeight: theme.typography.fontWeightMedium,
11
12
  marginTop: 1,
12
13
  wordBreak: ['keep-all', 'break-word'],
@@ -17,7 +17,6 @@ const useStyles = makeStyles()((theme, {
17
17
  position: 'relative',
18
18
  display: 'flex',
19
19
  flexDirection: 'column',
20
- background: theme.palette.background.surface,
21
20
  height: '100%'
22
21
  },
23
22
  itemDetails: {
@@ -11,9 +11,23 @@ const useStyles = makeStyles()((theme, {
11
11
  ':not(:empty)': {
12
12
  marginTop: 16
13
13
  },
14
- display: 'grid',
15
- gridGap: '0 16px',
16
- gridTemplateColumns: `repeat(${columns}, 1fr)`
14
+ ...(columns <= 2 ? {
15
+ rowGap: 16,
16
+ '& > *': {
17
+ padding: '0px 8px',
18
+ width: `${100 / columns}%`,
19
+ [`&:nth-of-type(${columns}n)`]: {
20
+ paddingRight: 0
21
+ },
22
+ [`&:nth-of-type(${columns}n+1)`]: {
23
+ paddingLeft: 0
24
+ }
25
+ }
26
+ } : {
27
+ display: 'grid',
28
+ gridGap: 16,
29
+ gridTemplateColumns: `repeat(${columns}, 1fr)`
30
+ })
17
31
  }
18
32
  }));
19
33
 
@@ -0,0 +1,2 @@
1
+ export const WIDGET_ID: "@shopgate/engage/product/ProductGrid";
2
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../product/components/ProductGrid/constants.js"],"names":[],"mappings":"AAAA,wBAAyB,sCAAsC,CAAC"}
@@ -0,0 +1 @@
1
+ export const WIDGET_ID = '@shopgate/engage/product/ProductGrid';
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Resolves the number of product columns for the ProductGrid, keyed by the
3
+ * active breakpoint.
4
+ *
5
+ * Precedence:
6
+ * - Once the app settings are hydrated from a source (admin sync / jsonp), they
7
+ * are authoritative everywhere.
8
+ * - Before hydration, when the grid is rendered outside a page-builder widget
9
+ * (Category / Search / legacy Products widget), the single legacy
10
+ * `useWidgetSettings` scalar is honored flat across all breakpoints. This
11
+ * reproduces the old theme grid and preserves the merchant's configured value.
12
+ * - Otherwise (inside a widget, pre-hydration) the built-in responsive default
13
+ * from the app settings is used ({ xs: 2, md: 4 }), so the inherited legacy
14
+ * `columns: 2` default no longer pins tablet to 2.
15
+ * @returns The resolved number of columns for the active breakpoint.
16
+ */
17
+ export declare const useProductGridColumns: () => number;
18
+ //# sourceMappingURL=hooks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"hooks.d.ts","sourceRoot":"","sources":["../../../../product/components/ProductGrid/hooks.ts"],"names":[],"mappings":"AAYA;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,qBAAqB,QAAO,MAwBxC,CAAC"}
@@ -0,0 +1,49 @@
1
+ import { useContext, useMemo } from 'react';
2
+ import { useSelector } from 'react-redux';
3
+ import { WidgetContext } from '@shopgate/engage/page/components/Widgets/WidgetContext';
4
+ import { useWidgetSettings } from '@shopgate/engage/core/hooks';
5
+ import { useResponsiveValue } from '@shopgate/engage/styles';
6
+ import { getAreAppSettingsHydrated, getProductGridColumns } from '@shopgate/engage/settings/selectors/appSettings';
7
+ import { WIDGET_ID } from "./constants";
8
+
9
+ /**
10
+ * Resolves the number of product columns for the ProductGrid, keyed by the
11
+ * active breakpoint.
12
+ *
13
+ * Precedence:
14
+ * - Once the app settings are hydrated from a source (admin sync / jsonp), they
15
+ * are authoritative everywhere.
16
+ * - Before hydration, when the grid is rendered outside a page-builder widget
17
+ * (Category / Search / legacy Products widget), the single legacy
18
+ * `useWidgetSettings` scalar is honored flat across all breakpoints. This
19
+ * reproduces the old theme grid and preserves the merchant's configured value.
20
+ * - Otherwise (inside a widget, pre-hydration) the built-in responsive default
21
+ * from the app settings is used ({ xs: 2, md: 4 }), so the inherited legacy
22
+ * `columns: 2` default no longer pins tablet to 2.
23
+ * @returns The resolved number of columns for the active breakpoint.
24
+ */
25
+ export const useProductGridColumns = () => {
26
+ // Widget-scope detection: the WidgetContext carries a `code` only when the
27
+ // grid renders inside a page-builder widget (WidgetProvider).
28
+ const {
29
+ code: widgetCode
30
+ } = useContext(WidgetContext);
31
+ const isInsideWidget = Boolean(widgetCode);
32
+ const areAppSettingsHydrated = useSelector(getAreAppSettingsHydrated);
33
+ // The built-in default { xs: 2, md: 4 } until hydrated, the source value after.
34
+ const appSettingsColumns = useSelector(getProductGridColumns);
35
+ const {
36
+ columns: legacyColumns
37
+ } = useWidgetSettings(WIDGET_ID) || {};
38
+ const breakpoints = useMemo(() => {
39
+ // Only special case: pre-hydration, outside a widget, honor the legacy
40
+ // scalar flat across every breakpoint.
41
+ if (!areAppSettingsHydrated && !isInsideWidget && typeof legacyColumns === 'number') {
42
+ return {
43
+ xs: legacyColumns
44
+ };
45
+ }
46
+ return appSettingsColumns;
47
+ }, [areAppSettingsHydrated, isInsideWidget, legacyColumns, appSettingsColumns]);
48
+ return useResponsiveValue(breakpoints);
49
+ };
@@ -4,11 +4,11 @@ import PropTypes from 'prop-types';
4
4
  import { ViewContext, InfiniteContainer, LoadingIndicator } from '@shopgate/engage/components';
5
5
  import { ProductListTypeProvider } from '@shopgate/engage/product';
6
6
  import { ITEMS_PER_LOAD } from '@shopgate/engage/core/constants';
7
- import { useResponsiveValue } from '@shopgate/engage/styles';
8
7
  import Iterator from "./components/Iterator";
9
8
  import Layout from "./components/Layout";
9
+ import { useProductGridColumns } from "./hooks";
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
- export const WIDGET_ID = '@shopgate/engage/product/ProductGrid';
11
+ export { WIDGET_ID } from "./constants";
12
12
 
13
13
  /**
14
14
  * The Product Grid component.
@@ -46,10 +46,7 @@ const ProductGrid = ({
46
46
  const {
47
47
  getContentRef
48
48
  } = useContext(ViewContext);
49
- const columns = useResponsiveValue({
50
- xs: 2,
51
- md: 4
52
- });
49
+ const columns = useProductGridColumns();
53
50
  if (!infiniteLoad) {
54
51
  return /*#__PURE__*/_jsx(Layout, {
55
52
  columns: columns,
@@ -23,6 +23,9 @@ jest.mock('@shopgate/engage/components', () => {
23
23
  jest.mock("./components/Iterator", () => function Iterator() {
24
24
  return null;
25
25
  });
26
+ jest.mock("./hooks", () => ({
27
+ useProductGridColumns: jest.fn(() => 2)
28
+ }));
26
29
  jest.mock('@shopgate/engage/product', () => ({
27
30
  ProductListTypeProvider: ({
28
31
  children
@@ -1,34 +1,22 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import List from '@shopgate/pwa-common/components/List';
4
- import { makeStyles } from '@shopgate/engage/styles';
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- const useStyles = makeStyles()(theme => ({
7
- list: {
8
- background: theme.palette.background.surface
9
- }
10
- }));
11
4
 
12
5
  /**
13
6
  * The Product List Layout component.
14
7
  * @param {Object} props The component props.
15
8
  * @return {JSX}
16
9
  */
10
+ import { jsx as _jsx } from "react/jsx-runtime";
17
11
  const Layout = ({
18
12
  children
19
- }) => {
20
- const {
21
- classes,
22
- cx
23
- } = useStyles();
24
- return /*#__PURE__*/_jsx(List, {
25
- className: cx(classes.list, 'engage__product__product-list'),
26
- itemScope: true,
27
- itemType: "http://schema.org/ItemList",
28
- "data-test-id": "productList",
29
- children: children
30
- });
31
- };
13
+ }) => /*#__PURE__*/_jsx(List, {
14
+ className: "engage__product__product-list",
15
+ itemScope: true,
16
+ itemType: "http://schema.org/ItemList",
17
+ "data-test-id": "productList",
18
+ children: children
19
+ });
32
20
  Layout.defaultProps = {
33
21
  children: null
34
22
  };
@@ -1 +1 @@
1
- {"version":3,"file":"appSettings.d.ts","sourceRoot":"","sources":["../../../settings/reducers/appSettings.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAG/E,KAAK,iBAAiB,GAAG,wBAAwB,GAAG,aAAa,CAAC;AAQlE;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,gBAalC,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,WAAW,EAAE,OAAO,CAAC,gBAAgB,EAAE,iBAAiB,CAW5D,CAAC;AAEH,eAAe,WAAW,CAAC"}
1
+ {"version":3,"file":"appSettings.d.ts","sourceRoot":"","sources":["../../../settings/reducers/appSettings.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAC;AAG/E,KAAK,iBAAiB,GAAG,wBAAwB,GAAG,aAAa,CAAC;AAQlE;;;GAGG;AACH,eAAO,MAAM,oBAAoB,EAAE,gBAqBlC,CAAC;AAEF;;;;;GAKG;AACH,QAAA,MAAM,WAAW,EAAE,OAAO,CAAC,gBAAgB,EAAE,iBAAiB,CAW5D,CAAC;AAEH,eAAe,WAAW,CAAC"}
@@ -19,6 +19,14 @@ export const DEFAULT_APP_SETTINGS = {
19
19
  borderEnabled: true
20
20
  }
21
21
  }
22
+ },
23
+ productList: {
24
+ grid: {
25
+ columns: {
26
+ xs: 2,
27
+ md: 4
28
+ }
29
+ }
22
30
  }
23
31
  };
24
32
 
@@ -41,4 +41,12 @@ export declare const getTabBarSettings: ((state: AppSettingsState) => {
41
41
  }> & {
42
42
  clearCache: () => void;
43
43
  };
44
+ /**
45
+ * Selects the ProductGrid columns setting (keyed by breakpoint).
46
+ */
47
+ export declare const getProductGridColumns: ((state: AppSettingsState) => Partial<Record<import("../../styles/theme").Breakpoint, number>>) & import("reselect").OutputSelectorFields<(args_0: AppSettingsSlice) => Partial<Record<import("../../styles/theme").Breakpoint, number>>, {
48
+ clearCache: () => void;
49
+ }> & {
50
+ clearCache: () => void;
51
+ };
44
52
  //# sourceMappingURL=appSettings.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"appSettings.d.ts","sourceRoot":"","sources":["../../../settings/selectors/appSettings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG/E;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,gBAAgB,KAAG,gBACR,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB;;;;CAGrC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;CAG7B,CAAC"}
1
+ {"version":3,"file":"appSettings.d.ts","sourceRoot":"","sources":["../../../settings/selectors/appSettings.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAG/E;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,OAAO,gBAAgB,KAAG,gBACR,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB;;;;CAGrC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;CAG7B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB;;;;CAGjC,CAAC"}
@@ -20,4 +20,9 @@ export const getAreAppSettingsHydrated = createSelector(getAppSettingsState, app
20
20
  /**
21
21
  * Selects the tab bar settings.
22
22
  */
23
- export const getTabBarSettings = createSelector(getAppSettingsState, appSettings => appSettings.navigation.tabBar);
23
+ export const getTabBarSettings = createSelector(getAppSettingsState, appSettings => appSettings.navigation.tabBar);
24
+
25
+ /**
26
+ * Selects the ProductGrid columns setting (keyed by breakpoint).
27
+ */
28
+ export const getProductGridColumns = createSelector(getAppSettingsState, appSettings => appSettings.productList.grid.columns);
@@ -1,8 +1,28 @@
1
+ import type { Breakpoint } from '@shopgate/engage/styles/theme';
1
2
  export interface AppSettingsState {
2
3
  settings: {
3
4
  appSettings: AppSettingsSlice;
4
5
  };
5
6
  }
7
+ /**
8
+ * Number of product columns to render, keyed by breakpoint. Partial: any unset
9
+ * breakpoint cascades down to the next smaller defined value (see
10
+ * useResponsiveValue).
11
+ */
12
+ export type ProductColumns = Partial<Record<Breakpoint, number>>;
13
+ /**
14
+ * Settings for the ProductGrid list type.
15
+ */
16
+ export interface ProductGridSettings {
17
+ columns: ProductColumns;
18
+ }
19
+ /**
20
+ * Settings for the various product-list types. Add a key and its own settings
21
+ * interface per future type (e.g. slider).
22
+ */
23
+ export interface ProductListSettings {
24
+ grid: ProductGridSettings;
25
+ }
6
26
  export interface AppSettings {
7
27
  navigation: {
8
28
  tabBar: {
@@ -15,6 +35,7 @@ export interface AppSettings {
15
35
  };
16
36
  };
17
37
  };
38
+ productList: ProductListSettings;
18
39
  }
19
40
  /**
20
41
  * The stored app settings slice. Extends the raw {@link AppSettings} values
@@ -1 +1 @@
1
- {"version":3,"file":"appSettings.d.ts","sourceRoot":"","sources":["../../../settings/types/appSettings.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE;QACR,WAAW,EAAE,gBAAgB,CAAC;KAC/B,CAAC;CACH;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE;QACV,MAAM,EAAE;YACN,OAAO,EAAE,OAAO,GAAG,UAAU,CAAA;YAC7B,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;YAC7B,UAAU,EAAE,OAAO,CAAC;YACpB,YAAY,EAAE,OAAO,CAAC;YACtB,KAAK,EAAE;gBACL,aAAa,EAAE,OAAO,CAAC;aACxB,CAAA;SACF,CAAA;KACF,CAAA;CACF;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD;;;;OAIG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB"}
1
+ {"version":3,"file":"appSettings.d.ts","sourceRoot":"","sources":["../../../settings/types/appSettings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAEhE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE;QACR,WAAW,EAAE,gBAAgB,CAAC;KAC/B,CAAC;CACH;AAED;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAEjE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,cAAc,CAAC;CACzB;AAED;;;GAGG;AACH,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,mBAAmB,CAAC;CAC3B;AAED,MAAM,WAAW,WAAW;IAC1B,UAAU,EAAE;QACV,MAAM,EAAE;YACN,OAAO,EAAE,OAAO,GAAG,UAAU,CAAA;YAC7B,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC;YAC7B,UAAU,EAAE,OAAO,CAAC;YACpB,YAAY,EAAE,OAAO,CAAC;YACtB,KAAK,EAAE;gBACL,aAAa,EAAE,OAAO,CAAC;aACxB,CAAA;SACF,CAAA;KACF,CAAA;IACD,WAAW,EAAE,mBAAmB,CAAC;CAClC;AAED;;;;GAIG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD;;;;OAIG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB"}
@@ -4,6 +4,7 @@ export { setPageContentWidth } from "./setPageContentWidth";
4
4
  export { setViewportHeight } from "./setViewportHeight";
5
5
  export { toggleBodyScroll } from "./toggleBodyScroll";
6
6
  export { loadCustomStyles } from "./loadCustomStyles";
7
+ export { loadThemeCss } from "./loadThemeCss";
7
8
  export * from "./color";
8
9
  export { responsiveMediaQuery } from "../../components/ResponsiveContainer/mediaQuery";
9
10
  export { responsiveCondition } from "../../components/ResponsiveContainer/condition";
@@ -6,6 +6,7 @@ export { setViewportHeight } from "./setViewportHeight";
6
6
  export { toggleBodyScroll } from "./toggleBodyScroll";
7
7
  export { initCSSCustomProps, initCSSCustomPropsFallback } from "./initCSSCustomProperties";
8
8
  export { loadCustomStyles } from "./loadCustomStyles";
9
+ export { loadThemeCss } from "./loadThemeCss";
9
10
  export * from "./color";
10
11
  export { responsiveMediaQuery } from "../../components/ResponsiveContainer/mediaQuery";
11
12
  export { responsiveCondition } from "../../components/ResponsiveContainer/condition";
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Loads the theme css file. It overrides the css custom properties that are generated during
3
+ * theme initialization, so it has to win the cascade against them - see `insertLinkTag` for how
4
+ * that order is established.
5
+ *
6
+ * A link applies at its position in the dom rather than at the time it finished loading, so the
7
+ * timeout below only decides how long app start waits - never which styles win.
8
+ *
9
+ * Resolves when the file loaded, when it failed, or when REQUEST_TIMEOUT elapsed - it never
10
+ * rejects, since the file is not guaranteed to exist and must not be able to block app start.
11
+ * @returns A promise that resolves once the file settled.
12
+ */
13
+ export declare const loadThemeCss: () => Promise<void>;
14
+ //# sourceMappingURL=loadThemeCss.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"loadThemeCss.d.ts","sourceRoot":"","sources":["../../../styles/helpers/loadThemeCss.ts"],"names":[],"mappings":"AAgCA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,YAAY,QAAO,OAAO,CAAC,IAAI,CAgF1C,CAAC"}
@@ -0,0 +1,112 @@
1
+ import { withScope, captureMessage, Severity as SentrySeverity } from '@sentry/browser';
2
+ import { appConfig } from '@shopgate/engage';
3
+ const REQUEST_TIMEOUT = 3000;
4
+ const LINK_TAG_ID = 'theme-css';
5
+ const INSERTION_POINT_SELECTOR = 'meta[name="theme-css-insertion-point"]';
6
+
7
+ /**
8
+ * Inserts the link at the theme css insertion point, which the html template declares between the
9
+ * emotion insertion point and the preview one. That position is what makes the cascade order
10
+ * structural rather than incidental: every tss style is pinned above it, and the admin preview
11
+ * pins its style tag to the anchor below it.
12
+ *
13
+ * Falls back to appending when the meta is absent - a head without the anchor still yields the
14
+ * desired order for anything that was already inserted, it just no longer guarantees it.
15
+ * @param linkTag The link tag to insert.
16
+ */
17
+ const insertLinkTag = linkTag => {
18
+ const insertionPoint = document.querySelector(INSERTION_POINT_SELECTOR);
19
+ if (!insertionPoint) {
20
+ document.head.appendChild(linkTag);
21
+ return;
22
+ }
23
+ insertionPoint.parentNode?.insertBefore(linkTag, insertionPoint.nextSibling);
24
+ };
25
+
26
+ /**
27
+ * Loads the theme css file. It overrides the css custom properties that are generated during
28
+ * theme initialization, so it has to win the cascade against them - see `insertLinkTag` for how
29
+ * that order is established.
30
+ *
31
+ * A link applies at its position in the dom rather than at the time it finished loading, so the
32
+ * timeout below only decides how long app start waits - never which styles win.
33
+ *
34
+ * Resolves when the file loaded, when it failed, or when REQUEST_TIMEOUT elapsed - it never
35
+ * rejects, since the file is not guaranteed to exist and must not be able to block app start.
36
+ * @returns A promise that resolves once the file settled.
37
+ */
38
+ export const loadThemeCss = () => new Promise(resolve => {
39
+ const {
40
+ themeCssUrl: href
41
+ } = appConfig;
42
+ if (!href) {
43
+ resolve();
44
+ return;
45
+ }
46
+ let settled = false;
47
+ let timeout;
48
+
49
+ /**
50
+ * Resolves the promise once, whichever of load / error / timeout comes first.
51
+ */
52
+ const settle = () => {
53
+ if (settled) {
54
+ return;
55
+ }
56
+ settled = true;
57
+ clearTimeout(timeout);
58
+ resolve();
59
+ };
60
+
61
+ /**
62
+ * Starts the fallback that keeps app start from waiting on a stalled request. The link is
63
+ * deliberately left in place when the timeout hits: it still applies once it eventually loads,
64
+ * it just no longer holds up app start.
65
+ */
66
+ const startTimeoutFallback = () => {
67
+ timeout = setTimeout(() => {
68
+ withScope(scope => {
69
+ scope.setLevel(SentrySeverity.Warning);
70
+ scope.setExtra('themeCssUrl', href);
71
+ scope.setExtra('timeout', REQUEST_TIMEOUT);
72
+ captureMessage('Fetching theme css took too long');
73
+ });
74
+ settle();
75
+ }, REQUEST_TIMEOUT);
76
+ };
77
+ const existingTag = document.querySelector(`#${LINK_TAG_ID}`);
78
+ if (existingTag) {
79
+ // Already loaded
80
+ if (existingTag.sheet) {
81
+ resolve();
82
+ return;
83
+ }
84
+
85
+ // Still loading - a stalled request must not leave the promise pending, so arm the timeout
86
+ // here too rather than relying on the load / error events alone.
87
+ existingTag.addEventListener('load', settle, {
88
+ once: true
89
+ });
90
+ existingTag.addEventListener('error', settle, {
91
+ once: true
92
+ });
93
+ startTimeoutFallback();
94
+ return;
95
+ }
96
+ const linkTag = document.createElement('link');
97
+ linkTag.rel = 'stylesheet';
98
+ linkTag.type = 'text/css';
99
+ linkTag.href = href;
100
+ linkTag.id = LINK_TAG_ID;
101
+ linkTag.onload = settle;
102
+ linkTag.onerror = () => {
103
+ withScope(scope => {
104
+ scope.setLevel(SentrySeverity.Error);
105
+ scope.setExtra('themeCssUrl', href);
106
+ captureMessage('Fetching theme css failed');
107
+ });
108
+ settle();
109
+ };
110
+ insertLinkTag(linkTag);
111
+ startTimeoutFallback();
112
+ });
package/styles/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export * from './helpers';
2
- export { ThemeProvider, createTheme, useActiveBreakpoint, useMediaQuery, useResponsiveValue, useTheme, useColorScheme, withTheme, type Theme, type PaletteColorsWithMain, type WithThemeProps, } from './theme';
2
+ export { ThemeProvider, createTheme, useActiveBreakpoint, useMediaQuery, useResponsiveValue, useTheme, useColorScheme, withTheme, type Theme, type ColorSchemeName, type PaletteColorsWithMain, type WithThemeProps, } from './theme';
3
3
  export { makeStyles, withStyles, useStyles, css, cx, tss, GlobalStyles, injectGlobal, keyframes, } from './tss';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../styles/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,OAAO,EACL,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,SAAS,EACT,KAAK,KAAK,EACV,KAAK,qBAAqB,EAC1B,KAAK,cAAc,GACpB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,UAAU,EACV,UAAU,EACV,SAAS,EACT,GAAG,EACH,EAAE,EACF,GAAG,EACH,YAAY,EACZ,YAAY,EACZ,SAAS,GACV,MAAM,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../styles/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,OAAO,EACL,aAAa,EACb,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,QAAQ,EACR,cAAc,EACd,SAAS,EACT,KAAK,KAAK,EACV,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAC1B,KAAK,cAAc,GACpB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,UAAU,EACV,UAAU,EACV,SAAS,EACT,GAAG,EACH,EAAE,EACF,GAAG,EACH,YAAY,EACZ,YAAY,EACZ,SAAS,GACV,MAAM,OAAO,CAAC"}
@@ -38,7 +38,7 @@ injectGlobal({
38
38
  WebkitOverflowScrolling: 'touch',
39
39
  WebkitUserSelect: hasWebBridge() ? 'inherit' : 'none',
40
40
  userSelect: hasWebBridge() ? 'inherit' : 'none',
41
- color: 'var(--color-text-high-emphasis)'
41
+ color: 'var(--sg-palette-text-primary, var(--color-text-high-emphasis))'
42
42
  },
43
43
  '[data-pattern]': {
44
44
  height: '100% !important'
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createDefaultThemeOptions/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,QAAO,YA6G3C,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createDefaultThemeOptions/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAInD;;;GAGG;AACH,eAAO,MAAM,yBAAyB,QAAO,YAuH3C,CAAC"}
@@ -1,7 +1,8 @@
1
1
  import { getCSSCustomProp } from '@shopgate/engage/styles';
2
2
  import { themeConfig } from '@shopgate/engage';
3
3
  const {
4
- colors
4
+ colors,
5
+ settings
5
6
  } = themeConfig;
6
7
 
7
8
  /**
@@ -66,6 +67,11 @@ export const createDefaultThemeOptions = () => ({
66
67
  background: getCSSCustomProp('--color-button-cta') || getCSSCustomProp('--color-primary')
67
68
  }
68
69
  },
70
+ badge: {
71
+ vars: {
72
+ background: getCSSCustomProp('--color-secondary')
73
+ }
74
+ },
69
75
  snackbar: {
70
76
  vars: {
71
77
  background: '#323232'
@@ -88,6 +94,11 @@ export const createDefaultThemeOptions = () => ({
88
94
  badgeLeft: 'var(--tab-bar-item-badge-left, calc(50% + 20px))'
89
95
  }
90
96
  },
97
+ appBar: {
98
+ vars: {
99
+ background: settings?.['@shopgate/engage/components/AppBar']?.background || '#FFF'
100
+ }
101
+ },
91
102
  ratingStars: {
92
103
  vars: {
93
104
  filled: `var(--rating-stars-filled, ${getCSSCustomProp('--color-primary')})`,
@@ -131,6 +131,17 @@ export declare const componentsSchema: {
131
131
  readonly color: "";
132
132
  };
133
133
  };
134
+ readonly appBar: {
135
+ readonly vars: {
136
+ readonly background: "";
137
+ readonly color: "";
138
+ };
139
+ };
140
+ readonly badge: {
141
+ readonly vars: {
142
+ readonly background: "";
143
+ };
144
+ };
134
145
  readonly discountBadge: {
135
146
  readonly vars: {
136
147
  readonly background: "";
@@ -231,6 +242,17 @@ export declare const componentsDefaults: {
231
242
  color: (t: Theme) => string;
232
243
  };
233
244
  };
245
+ appBar: {
246
+ vars: {
247
+ background: string;
248
+ color: (t: Theme) => string;
249
+ };
250
+ };
251
+ badge: {
252
+ vars: {
253
+ background: (t: Theme) => string;
254
+ };
255
+ };
234
256
  discountBadge: {
235
257
  vars: {
236
258
  background: string;
@@ -1 +1 @@
1
- {"version":3,"file":"createComponents.types.d.ts","sourceRoot":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GAAG,uBAAuB,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
1
+ {"version":3,"file":"createComponents.types.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/createComponents.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzC,KAAK,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;AAE3C;;;GAGG;AACH,KAAK,IAAI,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,IAAI,GAAG,SAAS,CAAC;AAEzD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,mBAAmB,CAAC,MAAM,IAClC,MAAM,GACN,MAAM,GACN,CAAC,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,MAAM,CAAC,CAAC;AAEzC;;;;;;;;;;GAUG;AACH,MAAM,MAAM,oBAAoB,CAAC,OAAO,IACtC,OAAO,SAAS,IAAI,GAAG,MAAM,GAC3B,OAAO,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,SAAS,oBAAoB,CAAC,CAAC,CAAC,EAAE,GACzE,OAAO,SAAS,MAAM,GAAG;KAAG,CAAC,IAAI,MAAM,OAAO,GAAG,oBAAoB,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;CAAE,GACnF,MAAM,CAAC;AAEX;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,4BAA4B,CAAC,OAAO,EAAE,MAAM,IACtD,OAAO,SAAS,IAAI,GAAG,mBAAmB,CAAC,MAAM,CAAC,GAChD,OAAO,SAAS,SAAS,CAAC,MAAM,CAAC,CAAC,EAAE,GAAG,SAAS,4BAA4B,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,GACzF,OAAO,SAAS,MAAM,GACtB;KAAG,CAAC,IAAI,MAAM,OAAO,GAAG,4BAA4B,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC;CAAE,GAC1E,mBAAmB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KAAK,CAAC,CAAC;AAG/D,MAAM,MAAM,UAAU,GAAG,oBAAoB,CAAC,OAAO,gBAAgB,CAAC,CAAC;AAEvE,MAAM,MAAM,aAAa,GAAG,uBAAuB,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -119,6 +119,17 @@ export const componentsSchema = {
119
119
  color: ''
120
120
  }
121
121
  },
122
+ appBar: {
123
+ vars: {
124
+ background: '',
125
+ color: ''
126
+ }
127
+ },
128
+ badge: {
129
+ vars: {
130
+ background: ''
131
+ }
132
+ },
122
133
  discountBadge: {
123
134
  vars: {
124
135
  background: ''
@@ -217,7 +228,18 @@ export const componentsDefaults = {
217
228
  ctaButton: {
218
229
  vars: {
219
230
  background: t => t.palette.primary.main,
220
- color: t => t.palette.primary.contrastText
231
+ color: t => t.contrastColor('var(--sg-components-ctaButton-background)')
232
+ }
233
+ },
234
+ appBar: {
235
+ vars: {
236
+ background: '#FFFFFF',
237
+ color: t => t.contrastColor('var(--sg-components-appBar-background)')
238
+ }
239
+ },
240
+ badge: {
241
+ vars: {
242
+ background: t => t.palette.secondary.main
221
243
  }
222
244
  },
223
245
  discountBadge: {
@@ -1 +1 @@
1
- {"version":3,"file":"createCssVarsForColorSchemeThemes.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/createCssVarsForColorSchemeThemes.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,KAAK,EACV,iBAAiB,EAAE,SAAS,EAAmB,YAAY,EAC5D,MAAM,SAAS,CAAC;AAEjB,KAAK,wCAAwC,GAAG;IAC9C,sBAAsB,EAAE,sBAAsB,CAAC;CAChD,GAAG,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;AAEvC,MAAM,MAAM,4CAA4C,GAAG;IACzD;;;OAGG;IACH,YAAY,EAAE,SAAS,GAAG;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC;IAC9C;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;CAC7C,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,iCAAiC,CACvD,YAAY,EAAE,iBAAiB,EAC/B,OAAO,EAAE,wCAAwC,GAChD,4CAA4C,CA0G9C"}
1
+ {"version":3,"file":"createCssVarsForColorSchemeThemes.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/createCssVarsForColorSchemeThemes.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAExD,OAAO,KAAK,EACV,iBAAiB,EAAE,SAAS,EAAmB,YAAY,EAC5D,MAAM,SAAS,CAAC;AAEjB,KAAK,wCAAwC,GAAG;IAC9C,sBAAsB,EAAE,sBAAsB,CAAC;CAChD,GAAG,IAAI,CAAC,YAAY,EAAE,cAAc,CAAC,CAAC;AAEvC,MAAM,MAAM,4CAA4C,GAAG;IACzD;;;OAGG;IACH,YAAY,EAAE,SAAS,GAAG;QAAE,IAAI,EAAE,SAAS,CAAA;KAAE,CAAC;IAC9C;;;;OAIG;IACH,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;CAC7C,CAAA;AAED;;;;;;GAMG;AACH,MAAM,CAAC,OAAO,UAAU,iCAAiC,CACvD,YAAY,EAAE,iBAAiB,EAC/B,OAAO,EAAE,wCAAwC,GAChD,4CAA4C,CA6G9C"}
@@ -40,7 +40,10 @@ export default function createCssVarsForColorSchemeThemes(colorSchemes, options)
40
40
  }), rest, cssVarPrefix);
41
41
 
42
42
  // Resolve component token values to actual CSS variable references
43
- const resolvedComponents = flattenComponentVars(resolveComponentsValues(componentsInput, vars));
43
+ const resolvedComponents = flattenComponentVars(resolveComponentsValues(componentsInput, {
44
+ ...rest,
45
+ ...vars
46
+ }));
44
47
  const {
45
48
  css: componentsCss,
46
49
  vars: componentsVars,
@@ -1,5 +1,6 @@
1
1
  import { type ThemeOptions, type ThemeInternal } from './types';
2
2
  export type { Theme, BaseTheme, ThemeInternal, ThemeOptions, Breakpoint, ColorSchemeName, ColorSchemeSelectorType, PaletteColorsWithMain, } from './types';
3
+ export { COLOR_SCHEME_NAMES } from './types';
3
4
  /**
4
5
  * Creates a theme object for the ThemeProvider.
5
6
  * @param options The theme options.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/index.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,YAAY,EAGjB,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,KAAK,EACL,SAAS,EACT,aAAa,EACb,YAAY,EACZ,UAAU,EACV,eAAe,EACf,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAEjB;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,UAAS,YAAiB,KAAG,aAkExD,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../styles/theme/createTheme/index.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,YAAY,EAGjB,KAAK,aAAa,EACnB,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,KAAK,EACL,SAAS,EACT,aAAa,EACb,YAAY,EACZ,UAAU,EACV,eAAe,EACf,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,UAAS,YAAiB,KAAG,aAkExD,CAAC"}