@shopgate/engage 7.32.0-beta.5 → 7.32.0-beta.7
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.
- package/account/components/Profile/ProfileAddressCard.d.ts.map +1 -1
- package/account/components/Profile/ProfileAddressCard.js +1 -0
- package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts +2 -2
- package/admin-preview/components/FrontendSettingsPreviewBridge/types.d.ts.map +1 -1
- package/back-in-stock/components/Subscriptions/components/Subscription/index.js +2 -5
- package/cart/components/CartItem/CartItemProductLayout.js +1 -1
- package/cart/components/CartItem/CartItemProductLayoutWide.js +2 -2
- package/cart/components/CartItems/CartItems.js +8 -10
- package/cart/components/CartItems/CartItemsSubstitution.js +3 -2
- package/category/components/CategoryImage/index.js +11 -15
- package/components/Card/Card.d.ts +27 -0
- package/components/Card/Card.d.ts.map +1 -0
- package/components/Card/Card.js +57 -0
- package/components/Card/index.d.ts +4 -0
- package/components/Card/index.d.ts.map +1 -0
- package/components/Card/index.js +2 -0
- package/components/Card/spec.d.ts +2 -0
- package/components/Card/spec.d.ts.map +1 -0
- package/components/Card/spec.js +128 -0
- package/components/Card/useCardAppearance.d.ts +11 -0
- package/components/Card/useCardAppearance.d.ts.map +1 -0
- package/components/Card/useCardAppearance.js +22 -0
- package/components/Paper/Paper.d.ts +49 -0
- package/components/Paper/Paper.d.ts.map +1 -0
- package/components/Paper/Paper.js +64 -0
- package/components/Paper/index.d.ts +3 -0
- package/components/Paper/index.d.ts.map +1 -0
- package/components/Paper/index.js +1 -0
- package/components/Paper/spec.d.ts +2 -0
- package/components/Paper/spec.d.ts.map +1 -0
- package/components/Paper/spec.js +131 -0
- package/components/RadioCard/RadioCard.d.ts.map +1 -1
- package/components/RadioCard/RadioCard.js +2 -1
- package/components/constants.d.ts +6 -0
- package/components/constants.d.ts.map +1 -0
- package/components/index.d.ts +4 -1
- package/components/index.d.ts.map +1 -1
- package/components/index.js +3 -2
- package/core/helpers/getFullImageSource.d.ts +5 -1
- package/core/helpers/getFullImageSource.d.ts.map +1 -1
- package/core/helpers/getFullImageSource.js +30 -14
- package/core/helpers/i18n.d.ts +4 -0
- package/core/helpers/i18n.d.ts.map +1 -1
- package/core/helpers/i18n.js +3 -0
- package/core/hooks/html/useLoadImage.d.ts +3 -3
- package/core/hooks/html/useLoadImage.d.ts.map +1 -1
- package/core/hooks/html/useLoadImage.js +2 -2
- package/favorites/components/Item/Item.d.ts +1 -1
- package/favorites/components/Item/Item.d.ts.map +1 -1
- package/favorites/components/Item/Item.js +2 -5
- package/favorites/components/List/List.d.ts +1 -1
- package/locations/components/StoreList/StoreListProduct.js +2 -3
- package/orders/components/OrderHistory/OrderHistoryList.d.ts.map +1 -1
- package/orders/components/OrderHistory/OrderHistoryList.js +8 -9
- package/orders/components/OrderHistory/OrderHistoryTable.d.ts.map +1 -1
- package/orders/components/OrderHistory/OrderHistoryTable.js +4 -0
- package/package.json +8 -8
- package/page/widgets/ProductSlider/ProductSlider.js +1 -15
- package/product/components/Media/FeaturedMedia.js +7 -1
- package/product/components/Media/MediaImage.js +24 -23
- package/product/components/Media/MediaPlaceholder.js +4 -7
- package/product/components/MediaSlider/components/MediaImage/index.js +6 -2
- package/product/components/MediaSlider/constants.js +1 -12
- package/product/components/ProductCard/index.js +29 -23
- package/product/components/ProductGrid/components/Item/components/ItemDetails/index.js +6 -3
- package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +2 -5
- package/product/components/ProductGrid/components/Item/components/ItemName/index.js +5 -1
- package/product/components/ProductGrid/components/Item/components/ItemName/spec.js +19 -1
- package/product/components/ProductGrid/components/Item/index.js +9 -1
- package/product/components/ProductGrid/hooks.d.ts +0 -7
- package/product/components/ProductGrid/hooks.d.ts.map +1 -1
- package/product/components/ProductGrid/hooks.js +9 -10
- package/product/components/ProductImage/ProductImage.d.ts +42 -0
- package/product/components/ProductImage/ProductImage.d.ts.map +1 -0
- package/product/components/ProductImage/ProductImage.js +153 -0
- package/product/components/ProductImage/ProductImagePlaceholder.d.ts +23 -0
- package/product/components/ProductImage/ProductImagePlaceholder.d.ts.map +1 -0
- package/product/components/ProductImage/ProductImagePlaceholder.js +9 -14
- package/product/components/ProductImage/constants.d.ts +7 -0
- package/product/components/ProductImage/constants.d.ts.map +1 -0
- package/product/components/ProductImage/constants.js +6 -0
- package/product/components/ProductImage/hooks.d.ts +8 -0
- package/product/components/ProductImage/hooks.d.ts.map +1 -0
- package/product/components/ProductImage/hooks.js +32 -0
- package/product/components/ProductImage/index.d.ts +3 -0
- package/product/components/ProductImage/index.d.ts.map +1 -0
- package/product/components/ProductImage/index.js +1 -201
- package/product/components/ProductImage/spec.js +115 -60
- package/product/components/ProductList/components/Item/index.js +5 -3
- package/product/components/ProductRatingStars/ProductRatingStars.js +2 -4
- package/product/components/ProductSlider/constants.d.ts +3 -0
- package/product/components/ProductSlider/constants.d.ts.map +1 -0
- package/product/components/ProductSlider/constants.js +2 -0
- package/product/components/ProductSlider/hooks.d.ts +7 -0
- package/product/components/ProductSlider/hooks.d.ts.map +1 -0
- package/product/components/ProductSlider/hooks.js +40 -0
- package/product/components/ProductSlider/index.js +8 -8
- package/product/components/ProductSlider/spec.js +2 -2
- package/product/components/Rating/index.js +2 -4
- package/product/components/RelationsSlider/RelationsSliderContent.js +3 -2
- package/product/components/RelationsSlider/constants.d.ts +3 -0
- package/product/components/RelationsSlider/constants.d.ts.map +1 -0
- package/product/components/RelationsSlider/constants.js +2 -1
- package/product/components/RelationsSlider/hooks.d.ts +6 -0
- package/product/components/RelationsSlider/hooks.d.ts.map +1 -0
- package/product/components/RelationsSlider/hooks.js +34 -0
- package/product/helpers/index.js +29 -11
- package/product/hooks/index.js +3 -1
- package/product/hooks/useLoadProductImage.js +4 -2
- package/product/hooks/useShowEmptyRatingStars.d.ts +7 -0
- package/product/hooks/useShowEmptyRatingStars.d.ts.map +1 -0
- package/product/hooks/useShowEmptyRatingStars.js +21 -0
- package/product/index.js +0 -1
- package/settings/action-creators/appSettings.d.ts +3 -3
- package/settings/action-creators/appSettings.d.ts.map +1 -1
- package/settings/constants/appSettings.d.ts +3 -0
- package/settings/constants/appSettings.d.ts.map +1 -1
- package/settings/constants/appSettings.js +6 -1
- package/settings/constants/imageSettings.d.ts +52 -0
- package/settings/constants/imageSettings.d.ts.map +1 -0
- package/settings/constants/imageSettings.js +69 -0
- package/settings/helpers/index.d.ts +3 -0
- package/settings/helpers/index.d.ts.map +1 -0
- package/settings/helpers/index.js +1 -0
- package/settings/helpers/resolveImageSettings.d.ts +70 -0
- package/settings/helpers/resolveImageSettings.d.ts.map +1 -0
- package/settings/helpers/resolveImageSettings.js +171 -0
- package/settings/helpers/toImageQuality.d.ts +7 -0
- package/settings/helpers/toImageQuality.d.ts.map +1 -0
- package/settings/helpers/toImageQuality.js +44 -0
- package/settings/helpers/toThumborColor.d.ts +15 -0
- package/settings/helpers/toThumborColor.d.ts.map +1 -0
- package/settings/helpers/toThumborColor.js +51 -0
- package/settings/hooks/index.d.ts +2 -0
- package/settings/hooks/index.d.ts.map +1 -0
- package/settings/hooks/index.js +1 -0
- package/settings/hooks/useImageSettings.d.ts +28 -0
- package/settings/hooks/useImageSettings.d.ts.map +1 -0
- package/settings/hooks/useImageSettings.js +39 -0
- package/settings/reducers/appSettings.d.ts.map +1 -1
- package/settings/reducers/appSettings.js +79 -11
- package/settings/reducers/index.d.ts +3 -3
- package/settings/selectors/appSettings.d.ts +71 -1
- package/settings/selectors/appSettings.d.ts.map +1 -1
- package/settings/selectors/appSettings.js +41 -1
- package/settings/types/appSettings.d.ts +192 -9
- package/settings/types/appSettings.d.ts.map +1 -1
- package/styles/index.d.ts +1 -1
- package/styles/index.d.ts.map +1 -1
- package/styles/reset/root.js +23 -4
- package/styles/reset/typographyCustomProps.d.ts +12 -0
- package/styles/reset/typographyCustomProps.d.ts.map +1 -0
- package/styles/reset/typographyCustomProps.js +11 -0
- package/styles/theme/createTheme/createComponents.types.d.ts +50 -0
- package/styles/theme/createTheme/createComponents.types.d.ts.map +1 -1
- package/styles/theme/createTheme/createComponents.types.js +50 -0
- package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.d.ts.map +1 -1
- package/styles/theme/createTheme/createCssVarsForColorSchemeThemes.js +5 -1
- package/styles/theme/createTheme/createPalette.types.d.ts +4 -0
- package/styles/theme/createTheme/createPalette.types.d.ts.map +1 -1
- package/styles/theme/createTheme/createPalette.types.js +5 -1
- package/styles/theme/createTheme/createShape.d.ts +4 -0
- package/styles/theme/createTheme/createShape.d.ts.map +1 -1
- package/styles/theme/createTheme/createShape.js +2 -1
- package/styles/theme/createTheme/createThemeFromColorScheme.d.ts.map +1 -1
- package/styles/theme/createTheme/createThemeFromColorScheme.js +2 -1
- package/styles/theme/createTheme/createTypography.js +1 -0
- package/styles/theme/createTheme/helpers/cssVarsParser.d.ts.map +1 -1
- package/styles/theme/createTheme/helpers/cssVarsParser.js +10 -3
- package/styles/theme/createTheme/shadows.d.ts +11 -1
- package/styles/theme/createTheme/shadows.d.ts.map +1 -1
- package/styles/theme/createTheme/shadows.js +41 -7
- package/styles/theme/createTheme/types.d.ts +5 -1
- package/styles/theme/createTheme/types.d.ts.map +1 -1
- package/styles/theme/index.d.ts +1 -0
- package/styles/theme/index.d.ts.map +1 -1
- package/product/collections/index.js +0 -1
- package/product/components/EffectivityDates/constants.d.ts +0 -3
- package/product/components/EffectivityDates/constants.d.ts.map +0 -1
- package/product/components/EffectivityDates/helpers.d.ts +0 -6
- package/product/components/EffectivityDates/helpers.d.ts.map +0 -1
- package/product/components/Media/helpers.d.ts +0 -2
- package/product/components/Media/helpers.d.ts.map +0 -1
- package/product/components/ProductImage/connector.js +0 -12
- package/product/helpers/index.d.ts +0 -13
- package/product/helpers/index.d.ts.map +0 -1
- package/product/helpers/redirects.d.ts +0 -2
- package/product/helpers/redirects.d.ts.map +0 -1
- package/product/selectors/helpers/filterProperties.d.ts +0 -8
- package/product/selectors/helpers/filterProperties.d.ts.map +0 -1
- package/product/selectors/helpers/index.d.ts +0 -3
- package/product/selectors/helpers/index.d.ts.map +0 -1
- package/product/selectors/helpers/wrapMemoizedSelector.d.ts +0 -2
- package/product/selectors/helpers/wrapMemoizedSelector.d.ts.map +0 -1
- package/product/selectors/product.d.ts +0 -112
- package/product/selectors/product.d.ts.map +0 -1
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import _merge from "lodash/merge";
|
|
2
|
-
import { produce } from 'immer';
|
|
3
2
|
import { RECEIVE_APP_SETTINGS } from "../constants/appSettings";
|
|
3
|
+
import { DEFAULT_IMAGE_FILL_COLOR, DEFAULT_IMAGE_FILL_TRANSPARENT, DEFAULT_IMAGE_QUALITY, DEFAULT_SHOW_INNER_SHADOW } from "../constants/imageSettings";
|
|
4
|
+
// Deliberately not exported from the "helpers" barrel - they normalize values on their way into
|
|
5
|
+
// the slice, which is nothing a consumer of the settings needs.
|
|
6
|
+
import { toImageQuality } from "../helpers/toImageQuality";
|
|
7
|
+
import { toThumborColor } from "../helpers/toThumborColor";
|
|
4
8
|
const isReceiveAppSettingsAction = action => action.type === RECEIVE_APP_SETTINGS && 'settings' in action;
|
|
5
9
|
|
|
6
10
|
/**
|
|
@@ -17,16 +21,58 @@ export const DEFAULT_APP_SETTINGS = {
|
|
|
17
21
|
transition: 'fade',
|
|
18
22
|
fixed: {
|
|
19
23
|
borderEnabled: true
|
|
24
|
+
},
|
|
25
|
+
favorites: {
|
|
26
|
+
showCounter: true
|
|
20
27
|
}
|
|
21
28
|
}
|
|
22
29
|
},
|
|
23
|
-
|
|
30
|
+
product: {
|
|
24
31
|
grid: {
|
|
25
32
|
columns: {
|
|
26
|
-
|
|
27
|
-
|
|
33
|
+
small: 2,
|
|
34
|
+
large: 4
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
slider: {
|
|
38
|
+
slidesPerView: {
|
|
39
|
+
small: 2.3,
|
|
40
|
+
medium: 3.3,
|
|
41
|
+
large: 4.3
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
rating: {
|
|
45
|
+
showEmptyStars: false
|
|
46
|
+
},
|
|
47
|
+
card: {
|
|
48
|
+
productName: {
|
|
49
|
+
maxLines: 3
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
tile: {
|
|
53
|
+
productName: {
|
|
54
|
+
maxLines: 3
|
|
28
55
|
}
|
|
29
56
|
}
|
|
57
|
+
},
|
|
58
|
+
cards: {
|
|
59
|
+
style: 'shadow',
|
|
60
|
+
shadow: {
|
|
61
|
+
size: 'medium'
|
|
62
|
+
}
|
|
63
|
+
},
|
|
64
|
+
images: {
|
|
65
|
+
quality: DEFAULT_IMAGE_QUALITY,
|
|
66
|
+
// Already in the image service's format, so the unhydrated path needs no conversion.
|
|
67
|
+
fillColor: DEFAULT_IMAGE_FILL_COLOR,
|
|
68
|
+
fillTransparent: DEFAULT_IMAGE_FILL_TRANSPARENT,
|
|
69
|
+
product: {
|
|
70
|
+
ratio: {
|
|
71
|
+
width: 1,
|
|
72
|
+
height: 1
|
|
73
|
+
},
|
|
74
|
+
showInnerShadow: DEFAULT_SHOW_INNER_SHADOW
|
|
75
|
+
}
|
|
30
76
|
}
|
|
31
77
|
};
|
|
32
78
|
|
|
@@ -38,13 +84,35 @@ export const DEFAULT_APP_SETTINGS = {
|
|
|
38
84
|
*/
|
|
39
85
|
const appSettings = (state, action = {
|
|
40
86
|
type: ''
|
|
41
|
-
}) =>
|
|
87
|
+
}) => {
|
|
42
88
|
if (isReceiveAppSettingsAction(action)) {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
89
|
+
const {
|
|
90
|
+
images
|
|
91
|
+
} = action.settings ?? {};
|
|
92
|
+
|
|
93
|
+
// Merged over the defaults rather than over the current state, so a field an incoming payload
|
|
94
|
+
// omits falls back to its default instead of keeping the value of an earlier one. The admin
|
|
95
|
+
// preview needs that: it stops sending a shadow size once the card style isn't `shadow`, and it
|
|
96
|
+
// clears a whole branch by sending a null.
|
|
97
|
+
const nextState = _merge({}, DEFAULT_APP_SETTINGS, {
|
|
98
|
+
...action.settings,
|
|
99
|
+
// A cleared branch is mapped to undefined, which merge skips, so the defaults it started from
|
|
100
|
+
// stay in place. A null would be written into the slice like any other value.
|
|
101
|
+
images: images === null ? undefined : {
|
|
102
|
+
...images,
|
|
103
|
+
product: images?.product ?? undefined
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
isHydrated: true
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
// Converted on the way in, so the slice holds wire ready values and every image url does not
|
|
110
|
+
// pay for it. Unconditional, because an empty string or a null reaches here like any other
|
|
111
|
+
// value - both converters are idempotent.
|
|
112
|
+
nextState.images.fillColor = toThumborColor(nextState.images.fillColor);
|
|
113
|
+
nextState.images.quality = toImageQuality(nextState.images.quality);
|
|
114
|
+
return nextState;
|
|
48
115
|
}
|
|
49
|
-
|
|
116
|
+
return state ?? DEFAULT_APP_SETTINGS;
|
|
117
|
+
};
|
|
50
118
|
export default appSettings;
|
|
@@ -3,10 +3,10 @@ export declare const settings: import("redux").Reducer<{
|
|
|
3
3
|
shopSettings: Object;
|
|
4
4
|
merchantSettings: Object;
|
|
5
5
|
appSettings: import("../types/appSettings").AppSettingsSlice;
|
|
6
|
-
}, (
|
|
6
|
+
}, ({
|
|
7
7
|
type: string;
|
|
8
|
-
settings: import("../types/appSettings").AppSettings
|
|
9
|
-
}) | import("redux").Action<string>, Partial<{
|
|
8
|
+
settings: import("../types/appSettings").DeepPartial<import("../types/appSettings").AppSettings>;
|
|
9
|
+
} | import("redux").UnknownAction) | import("redux").Action<string>, Partial<{
|
|
10
10
|
config: Object | undefined;
|
|
11
11
|
shopSettings: Object | undefined;
|
|
12
12
|
merchantSettings: Object | undefined;
|
|
@@ -28,6 +28,9 @@ export declare const getTabBarSettings: ((state: AppSettingsState) => {
|
|
|
28
28
|
fixed: {
|
|
29
29
|
borderEnabled: boolean;
|
|
30
30
|
};
|
|
31
|
+
favorites: {
|
|
32
|
+
showCounter: boolean;
|
|
33
|
+
};
|
|
31
34
|
}) & import("reselect").OutputSelectorFields<(args_0: AppSettingsSlice) => {
|
|
32
35
|
variant: "fixed" | "floating";
|
|
33
36
|
transition: "fade" | "slide";
|
|
@@ -36,6 +39,9 @@ export declare const getTabBarSettings: ((state: AppSettingsState) => {
|
|
|
36
39
|
fixed: {
|
|
37
40
|
borderEnabled: boolean;
|
|
38
41
|
};
|
|
42
|
+
favorites: {
|
|
43
|
+
showCounter: boolean;
|
|
44
|
+
};
|
|
39
45
|
}, {
|
|
40
46
|
clearCache: () => void;
|
|
41
47
|
}> & {
|
|
@@ -44,7 +50,71 @@ export declare const getTabBarSettings: ((state: AppSettingsState) => {
|
|
|
44
50
|
/**
|
|
45
51
|
* Selects the ProductGrid columns setting (keyed by breakpoint).
|
|
46
52
|
*/
|
|
47
|
-
export declare const getProductGridColumns: ((state: AppSettingsState) => Partial<Record<import("
|
|
53
|
+
export declare const getProductGridColumns: ((state: AppSettingsState) => Partial<Record<import("../types/appSettings").ScreenSize, number>>) & import("reselect").OutputSelectorFields<(args_0: AppSettingsSlice) => Partial<Record<import("../types/appSettings").ScreenSize, number>>, {
|
|
54
|
+
clearCache: () => void;
|
|
55
|
+
}> & {
|
|
56
|
+
clearCache: () => void;
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Selects the ProductSlider slidesPerView setting (keyed by breakpoint).
|
|
60
|
+
*/
|
|
61
|
+
export declare const getProductSliderSlidesPerView: ((state: AppSettingsState) => Partial<Record<import("../types/appSettings").ScreenSize, number>>) & import("reselect").OutputSelectorFields<(args_0: AppSettingsSlice) => Partial<Record<import("../types/appSettings").ScreenSize, number>>, {
|
|
62
|
+
clearCache: () => void;
|
|
63
|
+
}> & {
|
|
64
|
+
clearCache: () => void;
|
|
65
|
+
};
|
|
66
|
+
/**
|
|
67
|
+
* Selects whether the favorites tab bar icon shows the number of favorites within its badge.
|
|
68
|
+
*/
|
|
69
|
+
export declare const getShowFavoritesCounter: ((state: AppSettingsState) => boolean) & import("reselect").OutputSelectorFields<(args_0: AppSettingsSlice) => boolean, {
|
|
70
|
+
clearCache: () => void;
|
|
71
|
+
}> & {
|
|
72
|
+
clearCache: () => void;
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Selects whether rating stars are also shown for products without a rating.
|
|
76
|
+
*/
|
|
77
|
+
export declare const getShowEmptyRatingStars: ((state: AppSettingsState) => boolean) & import("reselect").OutputSelectorFields<(args_0: AppSettingsSlice) => boolean, {
|
|
78
|
+
clearCache: () => void;
|
|
79
|
+
}> & {
|
|
80
|
+
clearCache: () => void;
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Selects the image settings.
|
|
84
|
+
*/
|
|
85
|
+
export declare const getImageSettings: ((state: AppSettingsState) => import("../types/appSettings").ImageSettings) & import("reselect").OutputSelectorFields<(args_0: AppSettingsSlice) => import("../types/appSettings").ImageSettings, {
|
|
86
|
+
clearCache: () => void;
|
|
87
|
+
}> & {
|
|
88
|
+
clearCache: () => void;
|
|
89
|
+
};
|
|
90
|
+
/**
|
|
91
|
+
* Selects the max number of lines a product card name is clamped to.
|
|
92
|
+
*/
|
|
93
|
+
export declare const getProductCardNameMaxLines: ((state: AppSettingsState) => number) & import("reselect").OutputSelectorFields<(args_0: AppSettingsSlice) => number, {
|
|
94
|
+
clearCache: () => void;
|
|
95
|
+
}> & {
|
|
96
|
+
clearCache: () => void;
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Selects the max number of lines a product tile name is clamped to.
|
|
100
|
+
*/
|
|
101
|
+
export declare const getProductTileNameMaxLines: ((state: AppSettingsState) => number) & import("reselect").OutputSelectorFields<(args_0: AppSettingsSlice) => number, {
|
|
102
|
+
clearCache: () => void;
|
|
103
|
+
}> & {
|
|
104
|
+
clearCache: () => void;
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* Selects the themed card settings (style and shadow size).
|
|
108
|
+
*/
|
|
109
|
+
export declare const getCardSettings: ((state: AppSettingsState) => import("../types/appSettings").CardSettings) & import("reselect").OutputSelectorFields<(args_0: AppSettingsSlice) => import("../types/appSettings").CardSettings, {
|
|
110
|
+
clearCache: () => void;
|
|
111
|
+
}> & {
|
|
112
|
+
clearCache: () => void;
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Selects the effective card shadow size. `none` unless the shadow style is selected.
|
|
116
|
+
*/
|
|
117
|
+
export declare const getCardShadowSize: ((state: AppSettingsState) => import("../../styles").ShadowSize) & import("reselect").OutputSelectorFields<(args_0: import("../types/appSettings").CardSettings) => import("../../styles").ShadowSize, {
|
|
48
118
|
clearCache: () => void;
|
|
49
119
|
}> & {
|
|
50
120
|
clearCache: () => void;
|
|
@@ -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
|
|
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;AAEF;;GAEG;AACH,eAAO,MAAM,6BAA6B;;;;CAGzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;CAGnC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;CAGnC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB;;;;CAG5B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;CAGtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,0BAA0B;;;;CAGtC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,eAAe;;;;CAG3B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,iBAAiB;;;;CAG7B,CAAC"}
|
|
@@ -25,4 +25,44 @@ export const getTabBarSettings = createSelector(getAppSettingsState, appSettings
|
|
|
25
25
|
/**
|
|
26
26
|
* Selects the ProductGrid columns setting (keyed by breakpoint).
|
|
27
27
|
*/
|
|
28
|
-
export const getProductGridColumns = createSelector(getAppSettingsState, appSettings => appSettings.
|
|
28
|
+
export const getProductGridColumns = createSelector(getAppSettingsState, appSettings => appSettings.product.grid.columns);
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Selects the ProductSlider slidesPerView setting (keyed by breakpoint).
|
|
32
|
+
*/
|
|
33
|
+
export const getProductSliderSlidesPerView = createSelector(getAppSettingsState, appSettings => appSettings.product.slider.slidesPerView);
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Selects whether the favorites tab bar icon shows the number of favorites within its badge.
|
|
37
|
+
*/
|
|
38
|
+
export const getShowFavoritesCounter = createSelector(getAppSettingsState, appSettings => appSettings.navigation.tabBar.favorites.showCounter);
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Selects whether rating stars are also shown for products without a rating.
|
|
42
|
+
*/
|
|
43
|
+
export const getShowEmptyRatingStars = createSelector(getAppSettingsState, appSettings => appSettings.product.rating.showEmptyStars);
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Selects the image settings.
|
|
47
|
+
*/
|
|
48
|
+
export const getImageSettings = createSelector(getAppSettingsState, appSettings => appSettings.images);
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Selects the max number of lines a product card name is clamped to.
|
|
52
|
+
*/
|
|
53
|
+
export const getProductCardNameMaxLines = createSelector(getAppSettingsState, appSettings => appSettings.product.card.productName.maxLines);
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Selects the max number of lines a product tile name is clamped to.
|
|
57
|
+
*/
|
|
58
|
+
export const getProductTileNameMaxLines = createSelector(getAppSettingsState, appSettings => appSettings.product.tile.productName.maxLines);
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Selects the themed card settings (style and shadow size).
|
|
62
|
+
*/
|
|
63
|
+
export const getCardSettings = createSelector(getAppSettingsState, appSettings => appSettings.cards);
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Selects the effective card shadow size. `none` unless the shadow style is selected.
|
|
67
|
+
*/
|
|
68
|
+
export const getCardShadowSize = createSelector(getCardSettings, cards => cards.style === 'shadow' ? cards.shadow.size : 'none');
|
|
@@ -1,15 +1,31 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ShadowSize } from '@shopgate/engage/styles/theme';
|
|
2
|
+
export type { ShadowSize };
|
|
3
|
+
/**
|
|
4
|
+
* Recursively optional variant of `T`. The settings sources send only what a merchant configured,
|
|
5
|
+
* and the admin preview additionally prunes the fields its visibility conditions hide.
|
|
6
|
+
*/
|
|
7
|
+
export type DeepPartial<T> = {
|
|
8
|
+
[K in keyof T]?: T[K] extends object ? DeepPartial<T[K]> : T[K];
|
|
9
|
+
};
|
|
2
10
|
export interface AppSettingsState {
|
|
3
11
|
settings: {
|
|
4
12
|
appSettings: AppSettingsSlice;
|
|
5
13
|
};
|
|
6
14
|
}
|
|
7
15
|
/**
|
|
8
|
-
*
|
|
9
|
-
* breakpoint
|
|
10
|
-
|
|
16
|
+
* The merchant-facing screen sizes for the product list types. Each maps to a theme
|
|
17
|
+
* breakpoint inside the consuming hook (small → xs, medium → sm, large → md).
|
|
18
|
+
*/
|
|
19
|
+
export type ScreenSize = 'small' | 'medium' | 'large';
|
|
20
|
+
/**
|
|
21
|
+
* A value keyed by screen size. Partial: any unset size cascades down to the next smaller
|
|
22
|
+
* defined value (see useResponsiveValue).
|
|
23
|
+
*/
|
|
24
|
+
export type PerScreenSize = Partial<Record<ScreenSize, number>>;
|
|
25
|
+
/**
|
|
26
|
+
* Number of product columns to render, keyed by screen size.
|
|
11
27
|
*/
|
|
12
|
-
export type ProductColumns =
|
|
28
|
+
export type ProductColumns = PerScreenSize;
|
|
13
29
|
/**
|
|
14
30
|
* Settings for the ProductGrid list type.
|
|
15
31
|
*/
|
|
@@ -17,11 +33,162 @@ export interface ProductGridSettings {
|
|
|
17
33
|
columns: ProductColumns;
|
|
18
34
|
}
|
|
19
35
|
/**
|
|
20
|
-
*
|
|
21
|
-
|
|
36
|
+
* Name-clamping shared by the card and tile product surfaces.
|
|
37
|
+
*/
|
|
38
|
+
export interface ProductNameSettings {
|
|
39
|
+
/** Max number of lines the product name is clamped to before an ellipsis. */
|
|
40
|
+
maxLines: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Drop shadow of the card surface.
|
|
44
|
+
*/
|
|
45
|
+
export interface ShadowSettings {
|
|
46
|
+
/** Which preset elevation to draw. `none` renders no shadow at all. */
|
|
47
|
+
size: ShadowSize;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Number of slides to render side by side, keyed by screen size. Fractional values are allowed.
|
|
51
|
+
*/
|
|
52
|
+
export type SlidesPerView = PerScreenSize;
|
|
53
|
+
/**
|
|
54
|
+
* Settings for the ProductSlider list type.
|
|
55
|
+
*/
|
|
56
|
+
export interface ProductSliderSettings {
|
|
57
|
+
slidesPerView: SlidesPerView;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Settings for the product rating stars.
|
|
61
|
+
*/
|
|
62
|
+
export interface ProductRatingSettings {
|
|
63
|
+
/**
|
|
64
|
+
* Whether rating stars are also rendered for products that have no rating yet.
|
|
65
|
+
*/
|
|
66
|
+
showEmptyStars: boolean;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Settings for product presentation across the app.
|
|
22
70
|
*/
|
|
23
|
-
export interface
|
|
71
|
+
export interface ProductSettings {
|
|
24
72
|
grid: ProductGridSettings;
|
|
73
|
+
slider: ProductSliderSettings;
|
|
74
|
+
rating: ProductRatingSettings;
|
|
75
|
+
/** Product cards (sliders, relations, live shopping). */
|
|
76
|
+
card: {
|
|
77
|
+
productName: ProductNameSettings;
|
|
78
|
+
};
|
|
79
|
+
/** Product grid tiles. */
|
|
80
|
+
tile: {
|
|
81
|
+
productName: ProductNameSettings;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* The visual style of the card surface.
|
|
86
|
+
*/
|
|
87
|
+
export type CardStyle = 'shadow' | 'border' | 'flat';
|
|
88
|
+
/**
|
|
89
|
+
* Settings for the themed card surface (checkout sections, address cards, sliders).
|
|
90
|
+
*/
|
|
91
|
+
export interface CardSettings {
|
|
92
|
+
style: CardStyle;
|
|
93
|
+
shadow: ShadowSettings;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* An aspect ratio expressed as width and height parts. Only the proportion matters -
|
|
97
|
+
* { width: 4, height: 5 } and { width: 8, height: 10 } are equivalent.
|
|
98
|
+
*/
|
|
99
|
+
export interface AspectRatio {
|
|
100
|
+
/**
|
|
101
|
+
* The width part of the proportion.
|
|
102
|
+
*/
|
|
103
|
+
width: number;
|
|
104
|
+
/**
|
|
105
|
+
* The height part of the proportion.
|
|
106
|
+
*/
|
|
107
|
+
height: number;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* A single image resolution requested from the image service.
|
|
111
|
+
*/
|
|
112
|
+
export interface ImageResolution {
|
|
113
|
+
/**
|
|
114
|
+
* Width in pixels.
|
|
115
|
+
*/
|
|
116
|
+
width: number;
|
|
117
|
+
/**
|
|
118
|
+
* Height in pixels, derived from the configured aspect ratio.
|
|
119
|
+
*/
|
|
120
|
+
height: number;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* The product image contexts. pdp drives the product detail page, gallery the fullscreen gallery,
|
|
124
|
+
* and list every grid, slider, list and row tile.
|
|
125
|
+
*/
|
|
126
|
+
export type ProductImageContext = 'pdp' | 'gallery' | 'list';
|
|
127
|
+
/**
|
|
128
|
+
* Settings for a single product image context. The pixel dimensions are not configurable - they
|
|
129
|
+
* are derived from the built-in base widths for the context (see PRODUCT_IMAGE_BASE_WIDTHS) so
|
|
130
|
+
* that image weight stays under the theme's control.
|
|
131
|
+
*/
|
|
132
|
+
export interface ProductImageContextSettings {
|
|
133
|
+
/**
|
|
134
|
+
* The aspect ratio images in this context are rendered at.
|
|
135
|
+
*/
|
|
136
|
+
ratio: AspectRatio;
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Settings for the product image contexts.
|
|
140
|
+
*/
|
|
141
|
+
export interface ProductImageSettings {
|
|
142
|
+
/**
|
|
143
|
+
* The aspect ratio applied to every context that does not override it.
|
|
144
|
+
*/
|
|
145
|
+
ratio: AspectRatio;
|
|
146
|
+
/**
|
|
147
|
+
* Whether product images get an inset shadow. Applies to the image and to the placeholder that
|
|
148
|
+
* stands in for it, so both keep the same silhouette.
|
|
149
|
+
*/
|
|
150
|
+
showInnerShadow: boolean;
|
|
151
|
+
/**
|
|
152
|
+
* Overrides for the product detail page.
|
|
153
|
+
*/
|
|
154
|
+
pdp?: ProductImageContextSettings;
|
|
155
|
+
/**
|
|
156
|
+
* Overrides for the fullscreen gallery.
|
|
157
|
+
*/
|
|
158
|
+
gallery?: ProductImageContextSettings;
|
|
159
|
+
/**
|
|
160
|
+
* Overrides for grid, slider, list and row tiles.
|
|
161
|
+
*/
|
|
162
|
+
list?: ProductImageContextSettings;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Settings for images that are served through the image service.
|
|
166
|
+
*
|
|
167
|
+
* quality, fillColor and fillTransparent sit here rather than under product because they are not
|
|
168
|
+
* product specific - getFullImageSource applies them to every image that goes through the image
|
|
169
|
+
* service, including category images, carrier logos and page builder widget images.
|
|
170
|
+
*/
|
|
171
|
+
export interface ImageSettings {
|
|
172
|
+
/**
|
|
173
|
+
* Compression quality passed to the image service, 1 to 100.
|
|
174
|
+
*/
|
|
175
|
+
quality: number;
|
|
176
|
+
/**
|
|
177
|
+
* The color the image service fills letterboxed areas with. A source may send any CSS color -
|
|
178
|
+
* named, hex 3/6/8, rgb(), rgba(), hsl() - or one of Thumbor's own keywords: 'auto', 'blur',
|
|
179
|
+
* 'transparent'. The value reaches the store untouched and the reducer converts it into a
|
|
180
|
+
* Thumbor color token, so everything reading this field gets a wire-ready value.
|
|
181
|
+
*/
|
|
182
|
+
fillColor: string;
|
|
183
|
+
/**
|
|
184
|
+
* Thumbor's fill_transparent argument - whether transparent areas of the source image are
|
|
185
|
+
* filled too. True is what the legacy 'FFFFFF,1' config expressed.
|
|
186
|
+
*/
|
|
187
|
+
fillTransparent: boolean;
|
|
188
|
+
/**
|
|
189
|
+
* Aspect ratios for the product image contexts.
|
|
190
|
+
*/
|
|
191
|
+
product: ProductImageSettings;
|
|
25
192
|
}
|
|
26
193
|
export interface AppSettings {
|
|
27
194
|
navigation: {
|
|
@@ -33,10 +200,26 @@ export interface AppSettings {
|
|
|
33
200
|
fixed: {
|
|
34
201
|
borderEnabled: boolean;
|
|
35
202
|
};
|
|
203
|
+
favorites: {
|
|
204
|
+
/**
|
|
205
|
+
* Whether the favorites tab bar icon renders the number of favorites within its badge.
|
|
206
|
+
*/
|
|
207
|
+
showCounter: boolean;
|
|
208
|
+
};
|
|
36
209
|
};
|
|
37
210
|
};
|
|
38
|
-
|
|
211
|
+
product: ProductSettings;
|
|
212
|
+
/**
|
|
213
|
+
* Settings for images that are served through the image service.
|
|
214
|
+
*/
|
|
215
|
+
images: ImageSettings;
|
|
216
|
+
cards: CardSettings;
|
|
39
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* What a settings source actually sends. Every field is optional, so the reducer fills the gaps
|
|
220
|
+
* from its defaults instead of leaving consumers with undefined.
|
|
221
|
+
*/
|
|
222
|
+
export type AppSettingsPayload = DeepPartial<AppSettings>;
|
|
40
223
|
/**
|
|
41
224
|
* The stored app settings slice. Extends the raw {@link AppSettings} values
|
|
42
225
|
* with metadata that is derived by the reducer rather than supplied by a
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
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;AAIhE,YAAY,EAAE,UAAU,EAAE,CAAC;AAE3B;;;GAGG;AACH,MAAM,MAAM,WAAW,CAAC,CAAC,IAAI;KAC1B,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,GAAG,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAChE,CAAC;AAEF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE;QACR,WAAW,EAAE,gBAAgB,CAAC;KAC/B,CAAC;CACH;AAED;;;GAGG;AACH,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAEtD;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC;AAEhE;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,aAAa,CAAC;AAE3C;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,cAAc,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,6EAA6E;IAC7E,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,uEAAuE;IACvE,IAAI,EAAE,UAAU,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG,aAAa,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,cAAc,EAAE,OAAO,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,mBAAmB,CAAC;IAC1B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,yDAAyD;IACzD,IAAI,EAAE;QAAE,WAAW,EAAE,mBAAmB,CAAA;KAAE,CAAC;IAC3C,0BAA0B;IAC1B,IAAI,EAAE;QAAE,WAAW,EAAE,mBAAmB,CAAA;KAAE,CAAC;CAC5C;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,QAAQ,GAAG,MAAM,CAAC;AAErD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,cAAc,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;GAGG;AACH,MAAM,MAAM,mBAAmB,GAAG,KAAK,GAAG,SAAS,GAAG,MAAM,CAAC;AAE7D;;;;GAIG;AACH,MAAM,WAAW,2BAA2B;IAC1C;;OAEG;IACH,KAAK,EAAE,WAAW,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,KAAK,EAAE,WAAW,CAAC;IACnB;;;OAGG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,GAAG,CAAC,EAAE,2BAA2B,CAAC;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE,2BAA2B,CAAC;IACtC;;OAEG;IACH,IAAI,CAAC,EAAE,2BAA2B,CAAC;CACpC;AAED;;;;;;GAMG;AACH,MAAM,WAAW,aAAa;IAC5B;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;;;;OAKG;IACH,SAAS,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,eAAe,EAAE,OAAO,CAAC;IACzB;;OAEG;IACH,OAAO,EAAE,oBAAoB,CAAC;CAC/B;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;YACD,SAAS,EAAE;gBACT;;mBAEG;gBACH,WAAW,EAAE,OAAO,CAAC;aACtB,CAAA;SACF,CAAA;KACF,CAAA;IACD,OAAO,EAAE,eAAe,CAAC;IACzB;;OAEG;IACH,MAAM,EAAE,aAAa,CAAC;IACtB,KAAK,EAAE,YAAY,CAAC;CACrB;AAED;;;GAGG;AACH,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,WAAW,CAAC,CAAC;AAE1D;;;;GAIG;AACH,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD;;;;OAIG;IACH,UAAU,EAAE,OAAO,CAAC;CACrB"}
|
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 ColorSchemeName, type PaletteColorsWithMain, type WithThemeProps, } from './theme';
|
|
2
|
+
export { ThemeProvider, createTheme, useActiveBreakpoint, useMediaQuery, useResponsiveValue, useTheme, useColorScheme, withTheme, type Theme, type ShadowSize, 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
|
package/styles/index.d.ts.map
CHANGED
|
@@ -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,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"}
|
|
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,UAAU,EACf,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"}
|
package/styles/reset/root.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import "core-js/modules/es.array.includes.js";
|
|
2
2
|
import { applyScrollContainer, hasWebBridge, isIOSTheme } from '@shopgate/engage/core/helpers';
|
|
3
|
+
import { configuration } from '@shopgate/engage/core/collections';
|
|
4
|
+
import { CONFIGURATION_COLLECTION_KEY_HAS_ROOT_TYPOGRAPHY } from '@shopgate/engage/core/constants';
|
|
3
5
|
import { themeConfig } from '@shopgate/engage';
|
|
4
6
|
import { injectGlobal } from '..';
|
|
7
|
+
import { CSS_ROOT_FONT_FAMILY, CSS_ROOT_FONT_SIZE } from "./typographyCustomProps";
|
|
5
8
|
const {
|
|
6
9
|
typography
|
|
7
10
|
} = themeConfig;
|
|
8
11
|
const iosThemeActive = isIOSTheme();
|
|
12
|
+
|
|
13
|
+
// Flag (for feature-detecting extensions) that base typography uses the `--sg-root-*` custom
|
|
14
|
+
// properties and the `body1` variant.
|
|
15
|
+
configuration.set(CONFIGURATION_COLLECTION_KEY_HAS_ROOT_TYPOGRAPHY, true);
|
|
9
16
|
injectGlobal({
|
|
10
17
|
'*, *:before, *:after': {
|
|
11
18
|
boxSizing: 'border-box'
|
|
@@ -23,6 +30,14 @@ injectGlobal({
|
|
|
23
30
|
backgroundColor: 'var(--page-background-color)'
|
|
24
31
|
},
|
|
25
32
|
html: {
|
|
33
|
+
// Publish the shared font family (used by every variant) and the rem anchor here. The base body
|
|
34
|
+
// text itself is the `body1` variant, applied to `<body>` below. A higher-specificity `:root`
|
|
35
|
+
// override (admin css / live preview / extension) wins. The family default is the property
|
|
36
|
+
// value, not a `var()` fallback (a comma list can't be a fallback). Roboto is an iOS fallback.
|
|
37
|
+
[CSS_ROOT_FONT_FAMILY]: `${typography.family}${iosThemeActive && !(typography.family || '').includes('Roboto') ? ', Roboto' : ''}`,
|
|
38
|
+
[CSS_ROOT_FONT_SIZE]: `${typography.rootSize}px`,
|
|
39
|
+
fontSize: `var(${CSS_ROOT_FONT_SIZE})`,
|
|
40
|
+
color: 'var(--sg-palette-text-primary, var(--color-text-high-emphasis))',
|
|
26
41
|
overflow: applyScrollContainer() ? 'hidden' : 'inherit',
|
|
27
42
|
MozOsxFontSmoothing: 'grayscale',
|
|
28
43
|
WebkitFontSmoothing: 'antialiased',
|
|
@@ -31,14 +46,18 @@ injectGlobal({
|
|
|
31
46
|
minHeight: '100%'
|
|
32
47
|
},
|
|
33
48
|
body: {
|
|
34
|
-
//
|
|
35
|
-
|
|
49
|
+
// Base body text = the `body1` variant. Family is the shared root var; weight/size/line-height
|
|
50
|
+
// come from the theme's `body1` css vars, with fallbacks so there is no flash before the theme
|
|
51
|
+
// injects them. Configuring `body1` drives both this base text and the variant.
|
|
52
|
+
fontFamily: `var(${CSS_ROOT_FONT_FAMILY})`,
|
|
53
|
+
fontWeight: 'var(--sg-typography-body1-fontWeight, 400)',
|
|
54
|
+
fontSize: 'var(--sg-typography-body1-fontSize, 1rem)',
|
|
55
|
+
lineHeight: 'var(--sg-typography-body1-lineHeight, 1.5)',
|
|
36
56
|
overflow: 'auto',
|
|
37
57
|
margin: 0,
|
|
38
58
|
WebkitOverflowScrolling: 'touch',
|
|
39
59
|
WebkitUserSelect: hasWebBridge() ? 'inherit' : 'none',
|
|
40
|
-
userSelect: hasWebBridge() ? 'inherit' : 'none'
|
|
41
|
-
color: 'var(--sg-palette-text-primary, var(--color-text-high-emphasis))'
|
|
60
|
+
userSelect: hasWebBridge() ? 'inherit' : 'none'
|
|
42
61
|
},
|
|
43
62
|
'[data-pattern]': {
|
|
44
63
|
height: '100% !important'
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS custom property names for the shared base typography. Internal to the styles layer: the css
|
|
3
|
+
* reset publishes them on `<html>` — `--sg-root-font-family` is the shared family used by every
|
|
4
|
+
* typography variant, `--sg-root-font-size` is the rem anchor. They're an optional override layer: a
|
|
5
|
+
* higher-specificity `:root` rule (admin css file / live preview / an extension) overrides the
|
|
6
|
+
* shipped default. The base body text itself is the `body1` variant, applied to `<body>` by the reset.
|
|
7
|
+
*
|
|
8
|
+
* Not re-exported from the styles barrel - import from this module directly where needed.
|
|
9
|
+
*/
|
|
10
|
+
export declare const CSS_ROOT_FONT_FAMILY = "--sg-root-font-family";
|
|
11
|
+
export declare const CSS_ROOT_FONT_SIZE = "--sg-root-font-size";
|
|
12
|
+
//# sourceMappingURL=typographyCustomProps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typographyCustomProps.d.ts","sourceRoot":"","sources":["../../../styles/reset/typographyCustomProps.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,0BAA0B,CAAC;AAC5D,eAAO,MAAM,kBAAkB,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CSS custom property names for the shared base typography. Internal to the styles layer: the css
|
|
3
|
+
* reset publishes them on `<html>` — `--sg-root-font-family` is the shared family used by every
|
|
4
|
+
* typography variant, `--sg-root-font-size` is the rem anchor. They're an optional override layer: a
|
|
5
|
+
* higher-specificity `:root` rule (admin css file / live preview / an extension) overrides the
|
|
6
|
+
* shipped default. The base body text itself is the `body1` variant, applied to `<body>` by the reset.
|
|
7
|
+
*
|
|
8
|
+
* Not re-exported from the styles barrel - import from this module directly where needed.
|
|
9
|
+
*/
|
|
10
|
+
export const CSS_ROOT_FONT_FAMILY = '--sg-root-font-family';
|
|
11
|
+
export const CSS_ROOT_FONT_SIZE = '--sg-root-font-size';
|