@shopgate/engage 7.32.0-beta.10 → 7.32.0-beta.12

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 (133) hide show
  1. package/core/hooks/events/appEvents.d.ts +31 -46
  2. package/core/hooks/events/appEvents.d.ts.map +1 -0
  3. package/core/hooks/events/appEvents.js +26 -29
  4. package/core/hooks/events/index.d.ts +4 -4
  5. package/core/hooks/events/index.d.ts.map +1 -1
  6. package/core/hooks/events/useLongPress.d.ts +55 -58
  7. package/core/hooks/events/useLongPress.d.ts.map +1 -0
  8. package/core/hooks/events/useLongPress.js +23 -16
  9. package/core/hooks/events/usePressHandler.d.ts +32 -21
  10. package/core/hooks/events/usePressHandler.d.ts.map +1 -1
  11. package/core/hooks/events/usePressHandler.js +12 -10
  12. package/core/hooks/events/useScrollDirectionChange.d.ts +72 -61
  13. package/core/hooks/events/useScrollDirectionChange.d.ts.map +1 -0
  14. package/core/hooks/events/useScrollDirectionChange.js +36 -43
  15. package/development/action-creators/index.d.ts +3 -0
  16. package/development/action-creators/index.d.ts.map +1 -0
  17. package/development/action-creators/settings.d.ts +45 -0
  18. package/development/action-creators/settings.d.ts.map +1 -0
  19. package/development/action-creators/settings.js +21 -10
  20. package/development/action-creators/storage.d.ts +17 -0
  21. package/development/action-creators/storage.d.ts.map +1 -0
  22. package/development/action-creators/storage.js +7 -4
  23. package/development/components/ClientInformation/ClientInformation.d.ts +6 -0
  24. package/development/components/ClientInformation/ClientInformation.d.ts.map +1 -0
  25. package/development/components/ClientInformation/ClientInformation.js +7 -4
  26. package/development/components/ClientInformation/actions.d.ts +6 -0
  27. package/development/components/ClientInformation/actions.d.ts.map +1 -0
  28. package/development/components/ClientInformation/actions.js +1 -1
  29. package/development/components/ClientInformation/index.d.ts +2 -0
  30. package/development/components/ClientInformation/index.d.ts.map +1 -0
  31. package/development/components/DevelopmentSettings/DevelopmentSettings.d.ts +16 -0
  32. package/development/components/DevelopmentSettings/DevelopmentSettings.d.ts.map +1 -0
  33. package/development/components/DevelopmentSettings/DevelopmentSettings.js +41 -28
  34. package/development/components/DevelopmentSettings/index.d.ts +2 -0
  35. package/development/components/DevelopmentSettings/index.d.ts.map +1 -0
  36. package/development/components/DevelopmentTools/DevelopmentTools.d.ts +10 -0
  37. package/development/components/DevelopmentTools/DevelopmentTools.d.ts.map +1 -0
  38. package/development/components/DevelopmentTools/DevelopmentTools.js +8 -8
  39. package/development/components/DevelopmentTools/Shortcuts.d.ts +6 -0
  40. package/development/components/DevelopmentTools/Shortcuts.d.ts.map +1 -0
  41. package/development/components/DevelopmentTools/Shortcuts.js +0 -1
  42. package/development/components/DevelopmentTools/hooks.d.ts +8 -0
  43. package/development/components/DevelopmentTools/hooks.d.ts.map +1 -0
  44. package/development/components/DevelopmentTools/hooks.js +2 -3
  45. package/development/components/DevelopmentTools/index.d.ts +2 -0
  46. package/development/components/DevelopmentTools/index.d.ts.map +1 -0
  47. package/development/components/SimulatedInsets/SimulatedInsetBottom.d.ts +7 -0
  48. package/development/components/SimulatedInsets/SimulatedInsetBottom.d.ts.map +1 -0
  49. package/development/components/SimulatedInsets/SimulatedInsetBottom.js +1 -6
  50. package/development/components/SimulatedInsets/SimulatedInsetTop.d.ts +7 -0
  51. package/development/components/SimulatedInsets/SimulatedInsetTop.d.ts.map +1 -0
  52. package/development/components/SimulatedInsets/SimulatedInsetTop.js +2 -7
  53. package/development/components/SimulatedInsets/SimulatedInsets.d.ts +13 -0
  54. package/development/components/SimulatedInsets/SimulatedInsets.d.ts.map +1 -0
  55. package/development/components/SimulatedInsets/SimulatedInsets.js +2 -7
  56. package/development/components/SimulatedInsets/index.d.ts +2 -0
  57. package/development/components/SimulatedInsets/index.d.ts.map +1 -0
  58. package/development/components/SimulatedInsets/types.d.ts +15 -0
  59. package/development/components/SimulatedInsets/types.d.ts.map +1 -0
  60. package/development/components/SimulatedInsets/types.js +1 -0
  61. package/development/components/index.d.ts +3 -0
  62. package/development/components/index.d.ts.map +1 -0
  63. package/development/constants/actionTypes.d.ts +6 -0
  64. package/development/constants/actionTypes.d.ts.map +1 -0
  65. package/development/constants/actionTypes.js +2 -1
  66. package/development/constants/index.d.ts +2 -0
  67. package/development/constants/index.d.ts.map +1 -0
  68. package/development/reducers/index.d.ts +24 -0
  69. package/development/reducers/index.d.ts.map +1 -0
  70. package/development/reducers/settings.d.ts +17 -0
  71. package/development/reducers/settings.d.ts.map +1 -0
  72. package/development/reducers/settings.js +48 -35
  73. package/development/reducers/storage.d.ts +17 -0
  74. package/development/reducers/storage.d.ts.map +1 -0
  75. package/development/reducers/storage.js +24 -24
  76. package/development/selectors/index.d.ts +3 -0
  77. package/development/selectors/index.d.ts.map +1 -0
  78. package/development/selectors/settings.d.ts +52 -0
  79. package/development/selectors/settings.d.ts.map +1 -0
  80. package/development/selectors/settings.js +21 -11
  81. package/development/selectors/storage.d.ts +10 -0
  82. package/development/selectors/storage.d.ts.map +1 -0
  83. package/development/selectors/storage.js +6 -18
  84. package/development/streams/index.d.ts +2 -0
  85. package/development/streams/index.d.ts.map +1 -0
  86. package/development/streams/insets.d.ts +8 -0
  87. package/development/streams/insets.d.ts.map +1 -0
  88. package/development/streams/insets.js +1 -3
  89. package/development/subscriptions/index.d.ts +15 -0
  90. package/development/subscriptions/index.d.ts.map +1 -0
  91. package/development/subscriptions/index.js +6 -2
  92. package/development/types/development.d.ts +68 -0
  93. package/development/types/development.d.ts.map +1 -0
  94. package/development/types/development.js +1 -0
  95. package/development/types/index.d.ts +2 -0
  96. package/development/types/index.d.ts.map +1 -0
  97. package/development/types/index.js +1 -0
  98. package/package.json +7 -7
  99. package/page/components/Widgets/Widget.d.ts.map +1 -1
  100. package/page/components/Widgets/Widget.js +12 -15
  101. package/page/components/Widgets/WidgetContext.d.ts +3 -3
  102. package/page/components/Widgets/WidgetContext.d.ts.map +1 -1
  103. package/page/components/Widgets/WidgetProvider.d.ts +6 -2
  104. package/page/components/Widgets/WidgetProvider.d.ts.map +1 -1
  105. package/page/components/Widgets/WidgetProvider.js +3 -3
  106. package/page/components/Widgets/constants.d.ts +13 -0
  107. package/page/components/Widgets/constants.d.ts.map +1 -1
  108. package/page/components/Widgets/constants.js +21 -1
  109. package/page/components/Widgets/helpers.d.ts +19 -0
  110. package/page/components/Widgets/helpers.d.ts.map +1 -1
  111. package/page/components/Widgets/helpers.js +50 -0
  112. package/page/components/Widgets/types.d.ts +31 -5
  113. package/page/components/Widgets/types.d.ts.map +1 -1
  114. package/page/widget.config.schema.json +54 -0
  115. package/page/widgets/HeroBanner/config.json +6 -0
  116. package/page/widgets/Image/config.json +6 -0
  117. package/page/widgets/ImageRow/config.json +6 -0
  118. package/page/widgets/ImageSlider/config.json +6 -0
  119. package/page/widgets/ImageSlider/hooks.js +4 -2
  120. package/page/widgets/README.md +92 -0
  121. package/page/widgets/Video/config.json +6 -0
  122. package/settings/reducers/appSettings.d.ts.map +1 -1
  123. package/settings/reducers/appSettings.js +24 -1
  124. package/settings/selectors/appSettings.d.ts +8 -0
  125. package/settings/selectors/appSettings.d.ts.map +1 -1
  126. package/settings/selectors/appSettings.js +5 -0
  127. package/settings/types/appSettings.d.ts +35 -0
  128. package/settings/types/appSettings.d.ts.map +1 -1
  129. package/settings/types/appSettings.js +9 -0
  130. package/styles/theme/createDefaultThemeOptions/index.d.ts.map +1 -1
  131. package/styles/theme/createDefaultThemeOptions/index.js +5 -0
  132. package/styles/theme/providers/ThemeProvider.d.ts.map +1 -1
  133. package/styles/theme/providers/ThemeProvider.js +11 -4
@@ -1,24 +1,25 @@
1
1
  import { createSelector } from 'reselect';
2
2
  import MobileDetect from 'mobile-detect';
3
3
  import { isDev as isDevelopment, hasSGJavaScriptBridge } from '@shopgate/engage/core/helpers';
4
+ import { DEFAULT_DEVELOPMENT_SETTINGS } from "../reducers/settings";
4
5
  const md = new MobileDetect(navigator.userAgent);
5
6
 
6
7
  /**
7
- * Retrieves the development settings state from the store.
8
- * @param {Object} state The current application state.
9
- * @return {Object} The development settings state.
8
+ * Retrieves the development settings state from the store. Falls back to the defaults when the
9
+ * slice is not present - the theme provider reads these on every render, including in tests and
10
+ * hosts that do not register the development reducers.
11
+ * @param state The current application state.
12
+ * @returns The development settings state.
10
13
  */
11
- const getState = state => state.development.settings;
14
+ const getState = state => state?.development?.settings ?? DEFAULT_DEVELOPMENT_SETTINGS;
12
15
 
13
16
  /**
14
17
  * Creates a selector to determine if development mode is enabled.
15
- * @type {(state: any) => boolean}
16
18
  */
17
- export const getIsDev = createSelector(() => isDevelopment);
19
+ export const getIsDev = createSelector(_state => isDevelopment, isDev => isDev);
18
20
 
19
21
  /**
20
22
  * Creates a selector to determine if the simulated iOS insets are supposed to be shown.
21
- * @type {(state: any) => boolean}
22
23
  */
23
24
  export const getAreInsetsVisible = createSelector(getIsDev, getState, (isDev, settings) => {
24
25
  if (!isDev) {
@@ -29,7 +30,6 @@ export const getAreInsetsVisible = createSelector(getIsDev, getState, (isDev, se
29
30
 
30
31
  /**
31
32
  * Creates a selector to determine if the inset highlight is visible.
32
- * @type {(state: any) => boolean}
33
33
  */
34
34
  export const getIsInsetHighlightVisible = createSelector(getIsDev, getState, (isDev, settings) => {
35
35
  if (!isDev) {
@@ -40,7 +40,6 @@ export const getIsInsetHighlightVisible = createSelector(getIsDev, getState, (is
40
40
 
41
41
  /**
42
42
  * Creates a selector to check if simulated safe area insets are supposed to be injected.
43
- * @type {(state: any) => boolean}
44
43
  */
45
44
  export const getAreSimulatedInsetsInjected = createSelector(getIsDev, getAreInsetsVisible, (isDev, insetsVisible) => {
46
45
  // No insets injected if the app is not in development mode.
@@ -64,6 +63,17 @@ export const getAreSimulatedInsetsInjected = createSelector(getIsDev, getAreInse
64
63
 
65
64
  /**
66
65
  * Creates a selector to determine if the CMS2 preview is enabled.
67
- * @type {(state: any) => boolean}
68
66
  */
69
- export const getIsCMS2PreviewEnabled = createSelector(getState, settings => !!settings.cms2PreviewEnabled);
67
+ export const getIsCMS2PreviewEnabled = createSelector(getState, settings => !!settings.cms2PreviewEnabled);
68
+
69
+ /**
70
+ * Creates a selector to determine if a color scheme may be selected without the app settings
71
+ * allowing it. Development only - in production the merchant's appearance setting is the only
72
+ * thing that may enable it.
73
+ */
74
+ export const getIsColorSchemeSelectionEnabled = createSelector(getIsDev, getState, (isDev, settings) => {
75
+ if (!isDev) {
76
+ return false;
77
+ }
78
+ return !!settings.colorSchemeSelectionEnabled;
79
+ });
@@ -0,0 +1,10 @@
1
+ import type { DevelopmentState, DevelopmentStorageState } from '../types';
2
+ /**
3
+ * Creates a selector that returns the current status bar style object from the storage.
4
+ */
5
+ export declare const getStatusBarStyleStorage: ((state: DevelopmentState) => import("../types").StatusBarStyle) & import("reselect").OutputSelectorFields<(args_0: DevelopmentStorageState) => import("../types").StatusBarStyle, {
6
+ clearCache: () => void;
7
+ }> & {
8
+ clearCache: () => void;
9
+ };
10
+ //# sourceMappingURL=storage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../development/selectors/storage.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,uBAAuB,EAAE,MAAM,UAAU,CAAC;AAW1E;;GAEG;AACH,eAAO,MAAM,wBAAwB;;;;CAGpC,CAAC"}
@@ -1,26 +1,14 @@
1
1
  import { createSelector } from 'reselect';
2
-
3
- /**
4
- * Retrieves the development storage state from the store.
5
- * @param {Object} state The current application state.
6
- * @return {Object} The development storage state.
7
- */
8
- const getState = state => state.development.storage;
9
-
10
- /**
11
- * @typedef {Object} StatusBarStyleStyles
12
- * @property {string} statusBarBackground Current background color of the app bar
13
- */
14
-
2
+ import { DEFAULT_DEVELOPMENT_STORAGE } from "../reducers/storage";
15
3
  /**
16
- * @typedef {Object} StatusBarStyle
17
- * @property {boolean} isDefault Whether the style is the default one which was initially applied
18
- * @property {"light"|"dark"} statusBarStyle The status style for the iOS status bar
19
- * @property {StatusBarStyleStyles} styles Additional styles for the status bar
4
+ * Retrieves the development storage state from the store. Falls back to the defaults when the
5
+ * slice is not present, for the same reason the settings selectors do.
6
+ * @param state The current application state.
7
+ * @returns The development storage state.
20
8
  */
9
+ const getState = state => state?.development?.storage ?? DEFAULT_DEVELOPMENT_STORAGE;
21
10
 
22
11
  /**
23
12
  * Creates a selector that returns the current status bar style object from the storage.
24
- * @type {(state: any) => StatusBarStyle}
25
13
  */
26
14
  export const getStatusBarStyleStorage = createSelector(getState, state => state.statusBarStyle);
@@ -0,0 +1,2 @@
1
+ export * from './insets';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../development/streams/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
@@ -0,0 +1,8 @@
1
+ import type { DevelopmentSettingsAction } from '../action-creators/settings';
2
+ /**
3
+ * Gets triggered after the simulated page insets were updated.
4
+ */
5
+ export declare const simulatedPageInsetsDidUpdate$: import("rxjs/Observable").Observable<{
6
+ action: DevelopmentSettingsAction;
7
+ }>;
8
+ //# sourceMappingURL=insets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"insets.d.ts","sourceRoot":"","sources":["../../../development/streams/insets.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAE7E;;GAEG;AACH,eAAO,MAAM,6BAA6B;YACT,yBAAyB;EACN,CAAC"}
@@ -1,9 +1,7 @@
1
1
  import { main$ } from '@shopgate/engage/core/streams';
2
2
  import { DEVELOPMENT_TOOLS_TOGGLE_INSETS } from "../constants";
3
-
4
3
  /**
5
- * Gets triggered after the simulated page insets were updated
6
- * @type {Observable}
4
+ * Gets triggered after the simulated page insets were updated.
7
5
  */
8
6
  export const simulatedPageInsetsDidUpdate$ = main$.filter(({
9
7
  action
@@ -0,0 +1,15 @@
1
+ import { appWillStart$ } from '@shopgate/engage/core/streams';
2
+ /**
3
+ * The subset of the subscription helpers this module uses.
4
+ */
5
+ interface SubscriptionContext {
6
+ dispatch: (action: unknown) => void;
7
+ }
8
+ type Subscribe = (stream: typeof appWillStart$, callback: (context: SubscriptionContext) => void) => void;
9
+ /**
10
+ * Development subscriptions.
11
+ * @param subscribe The subscribe function.
12
+ */
13
+ export default function development(subscribe: Subscribe): void;
14
+ export {};
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../development/subscriptions/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AAK9D;;GAEG;AACH,UAAU,mBAAmB;IAC3B,QAAQ,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACrC;AAED,KAAK,SAAS,GAAG,CACf,MAAM,EAAE,OAAO,aAAa,EAC5B,QAAQ,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,KAC7C,IAAI,CAAC;AAEV;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,SAAS,EAAE,SAAS,QAQvD"}
@@ -3,8 +3,12 @@ import { UIEvents } from '@shopgate/engage/core/events';
3
3
  import { updateStatusBarStyleStorage } from '@shopgate/engage/development/action-creators';
4
4
 
5
5
  /**
6
- * Development subscriptions
7
- * @param {Function} subscribe The subscribe function
6
+ * The subset of the subscription helpers this module uses.
7
+ */
8
+
9
+ /**
10
+ * Development subscriptions.
11
+ * @param subscribe The subscribe function.
8
12
  */
9
13
  export default function development(subscribe) {
10
14
  subscribe(appWillStart$, ({
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Additional styles the app sends along with a status bar style update.
3
+ */
4
+ export interface StatusBarStyleStyles {
5
+ /**
6
+ * Current background color of the app bar.
7
+ */
8
+ statusBarBackground?: string;
9
+ }
10
+ /**
11
+ * The status bar style the app last reported through the `devInternalUpdateStatusBarStyle` event.
12
+ */
13
+ export interface StatusBarStyle {
14
+ /**
15
+ * Whether the style is the default one which was initially applied.
16
+ */
17
+ isDefault?: boolean;
18
+ /**
19
+ * The status style for the iOS status bar.
20
+ */
21
+ statusBarStyle?: 'light' | 'dark' | 'none';
22
+ /**
23
+ * Additional styles for the status bar.
24
+ */
25
+ styles?: StatusBarStyleStyles;
26
+ }
27
+ /**
28
+ * Settings the development tools maintain. Everything but the CMS 2.0 preview is development only -
29
+ * the reducer refuses to write those outside a development build.
30
+ */
31
+ export interface DevelopmentSettingsState {
32
+ /**
33
+ * Whether simulated iOS safe area insets are shown. `null` while nobody decided, which lets
34
+ * simulated iOS devices default to showing them.
35
+ */
36
+ showInsets: boolean | null;
37
+ /**
38
+ * Whether the simulated safe area insets are highlighted.
39
+ */
40
+ showInsetHighlight: boolean;
41
+ /**
42
+ * Whether the CMS 2.0 preview is enabled.
43
+ */
44
+ cms2PreviewEnabled: boolean;
45
+ /**
46
+ * Whether a color scheme may be selected without the app settings allowing it.
47
+ */
48
+ colorSchemeSelectionEnabled: boolean;
49
+ }
50
+ /**
51
+ * Values the development tools store for inspection rather than to drive behaviour.
52
+ */
53
+ export interface DevelopmentStorageState {
54
+ /**
55
+ * The status bar style the app last reported.
56
+ */
57
+ statusBarStyle: StatusBarStyle;
58
+ }
59
+ /**
60
+ * The slice of the application state the development selectors read from.
61
+ */
62
+ export interface DevelopmentState {
63
+ development: {
64
+ settings: DevelopmentSettingsState;
65
+ storage: DevelopmentStorageState;
66
+ };
67
+ }
68
+ //# sourceMappingURL=development.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"development.d.ts","sourceRoot":"","sources":["../../../development/types/development.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;OAEG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB;;OAEG;IACH,cAAc,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,MAAM,CAAC;IAC3C;;OAEG;IACH,MAAM,CAAC,EAAE,oBAAoB,CAAC;CAC/B;AAED;;;GAGG;AACH,MAAM,WAAW,wBAAwB;IACvC;;;OAGG;IACH,UAAU,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B;;OAEG;IACH,kBAAkB,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,kBAAkB,EAAE,OAAO,CAAC;IAC5B;;OAEG;IACH,2BAA2B,EAAE,OAAO,CAAC;CACtC;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC;;OAEG;IACH,cAAc,EAAE,cAAc,CAAC;CAChC;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE;QACX,QAAQ,EAAE,wBAAwB,CAAC;QACnC,OAAO,EAAE,uBAAuB,CAAC;KAClC,CAAC;CACH"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,2 @@
1
+ export type { DevelopmentSettingsState, DevelopmentState, DevelopmentStorageState, StatusBarStyle, StatusBarStyleStyles, } from './development';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../development/types/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,wBAAwB,EACxB,gBAAgB,EAChB,uBAAuB,EACvB,cAAc,EACd,oBAAoB,GACrB,MAAM,eAAe,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shopgate/engage",
3
- "version": "7.32.0-beta.10",
3
+ "version": "7.32.0-beta.12",
4
4
  "description": "Shopgate's ENGAGE library.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Shopgate <support@shopgate.com>",
@@ -18,12 +18,12 @@
18
18
  "dependencies": {
19
19
  "@emotion/react": "^11.14.0",
20
20
  "@shopgate/native-modules": "1.0.0-beta.34",
21
- "@shopgate/pwa-common": "7.32.0-beta.10",
22
- "@shopgate/pwa-common-commerce": "7.32.0-beta.10",
23
- "@shopgate/pwa-core": "7.32.0-beta.10",
24
- "@shopgate/pwa-ui-ios": "7.32.0-beta.10",
25
- "@shopgate/pwa-ui-material": "7.32.0-beta.10",
26
- "@shopgate/pwa-ui-shared": "7.32.0-beta.10",
21
+ "@shopgate/pwa-common": "7.32.0-beta.12",
22
+ "@shopgate/pwa-common-commerce": "7.32.0-beta.12",
23
+ "@shopgate/pwa-core": "7.32.0-beta.12",
24
+ "@shopgate/pwa-ui-ios": "7.32.0-beta.12",
25
+ "@shopgate/pwa-ui-material": "7.32.0-beta.12",
26
+ "@shopgate/pwa-ui-shared": "7.32.0-beta.12",
27
27
  "@stripe/react-stripe-js": "^1.16.5",
28
28
  "@stripe/stripe-js": "^1.44.1",
29
29
  "@virtuous/conductor": "~2.5.0",
@@ -1 +1 @@
1
- {"version":3,"file":"Widget.d.ts","sourceRoot":"","sources":["../../../../page/components/Widgets/Widget.tsx"],"names":[],"mappings":"AAAA,OAAO,EACkB,KAAK,aAAa,EAC1C,MAAM,OAAO,CAAC;AAQf,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAiDhD;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,SAAS,EAAE,aAAa,CAAC;QAAE,QAAQ,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAA;KAAE,CAAC,CAAC;IAC1E;;OAEG;IACH,UAAU,EAAE,gBAAgB,CAAC;IAC7B;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;GAEG;AACH,QAAA,MAAM,MAAM,GAAI,wEAKb,WAAW,uCAqEb,CAAC;AAEF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"Widget.d.ts","sourceRoot":"","sources":["../../../../page/components/Widgets/Widget.tsx"],"names":[],"mappings":"AAAA,OAAO,EAC2B,KAAK,aAAa,EACnD,MAAM,OAAO,CAAC;AAWf,OAAO,EAAE,KAAK,gBAAgB,EAAqB,MAAM,SAAS,CAAC;AAuCnE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,SAAS,EAAE,aAAa,CAAC;QAAE,QAAQ,CAAC,EAAE,gBAAgB,CAAC,cAAc,CAAC,CAAA;KAAE,CAAC,CAAC;IAC1E;;OAEG;IACH,UAAU,EAAE,gBAAgB,CAAC;IAC7B;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED;;GAEG;AACH,QAAA,MAAM,MAAM,GAAI,wEAKb,WAAW,uCAwEb,CAAC;AAEF,eAAe,MAAM,CAAC"}
@@ -1,15 +1,14 @@
1
- import { Suspense, useCallback } from 'react';
1
+ import { Suspense, useCallback, useMemo } from 'react';
2
+ import { useSelector } from 'react-redux';
2
3
  import { makeStyles } from '@shopgate/engage/styles';
3
4
  import { VisibilityOffIcon, TimeIcon, Loading } from '@shopgate/engage/components';
4
5
  import { usePressHandler } from '@shopgate/engage/core/hooks';
6
+ import { getWidgetMediaMargins } from '@shopgate/engage/settings/selectors/appSettings';
5
7
  import WidgetProvider from "./WidgetProvider";
6
8
  import { dispatchWidgetPreviewEvent } from "./events";
7
9
  import { useWidgetsPreview } from "./hooks";
10
+ import { getAppliedMediaMargins, resolveWidgetLayout } from "./helpers";
8
11
  import Tooltip from "./Tooltip";
9
-
10
- /**
11
- * Style parameters for the widget, derived from its layout margins.
12
- */
13
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
14
13
  const useStyles = makeStyles()((theme, {
15
14
  marginTop,
@@ -61,15 +60,12 @@ const Widget = ({
61
60
  isPreview,
62
61
  isCustomLegacyWidget = false
63
62
  }) => {
63
+ const mediaMargins = useSelector(getWidgetMediaMargins);
64
+ const layout = useMemo(() => resolveWidgetLayout(definition?.layout, getAppliedMediaMargins(definition?.widgetConfigDefinitionCode), mediaMargins), [definition, mediaMargins]);
64
65
  const {
65
66
  classes,
66
67
  cx
67
- } = useStyles({
68
- marginTop: definition?.layout?.marginTop ?? 0,
69
- marginBottom: definition?.layout?.marginBottom ?? 0,
70
- marginLeft: definition?.layout?.marginLeft ?? 0,
71
- marginRight: definition?.layout?.marginRight ?? 0
72
- });
68
+ } = useStyles(layout);
73
69
  const {
74
70
  setActiveWidget,
75
71
  activeWidget
@@ -92,10 +88,10 @@ const Widget = ({
92
88
  [classes.preview]: isPreview
93
89
  }),
94
90
  style: {
95
- marginTop: definition?.layout?.marginTop,
96
- marginBottom: definition?.layout?.marginBottom,
97
- marginLeft: definition?.layout?.marginLeft,
98
- marginRight: definition?.layout?.marginRight
91
+ marginTop: layout.marginTop || undefined,
92
+ marginBottom: layout.marginBottom || undefined,
93
+ marginLeft: layout.marginLeft || undefined,
94
+ marginRight: layout.marginRight || undefined
99
95
  },
100
96
  "data-widget-name": definition.widgetConfigDefinitionCode,
101
97
  ...(isPreview && {
@@ -119,6 +115,7 @@ const Widget = ({
119
115
  }), /*#__PURE__*/_jsx(WidgetProvider, {
120
116
  definition: definition,
121
117
  isPreview: isPreview,
118
+ layout: layout,
122
119
  children: /*#__PURE__*/_jsx(Suspense, {
123
120
  fallback: /*#__PURE__*/_jsx(Loading, {}),
124
121
  children: /*#__PURE__*/_jsx(Component, {
@@ -1,4 +1,4 @@
1
- import { type WidgetDefinitionLayout, type WidgetDefinitionVisibility } from './types';
1
+ import { type WidgetDefinitionVisibility, type WidgetLayout } from './types';
2
2
  export { type WidgetDefinition } from './types';
3
3
  /**
4
4
  * Context value provided by the {@link WidgetContext} for a single widget instance.
@@ -17,9 +17,9 @@ export interface WidgetContextType<C = Record<string, unknown>> {
17
17
  */
18
18
  config: C;
19
19
  /**
20
- * The widget layout settings.
20
+ * The resolved margins of the widget container.
21
21
  */
22
- layout: WidgetDefinitionLayout;
22
+ layout: WidgetLayout;
23
23
  /**
24
24
  * The widget visibility settings.
25
25
  */
@@ -1 +1 @@
1
- {"version":3,"file":"WidgetContext.d.ts","sourceRoot":"","sources":["../../../../page/components/Widgets/WidgetContext.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,sBAAsB,EAC3B,KAAK,0BAA0B,EAChC,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC5D;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,EAAE,CAAC,CAAC;IACV;;OAEG;IACH,MAAM,EAAE,sBAAsB,CAAC;IAC/B;;OAEG;IACH,UAAU,EAAE,0BAA0B,CAAC;IACvC;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,qEAA4D,CAAC"}
1
+ {"version":3,"file":"WidgetContext.d.ts","sourceRoot":"","sources":["../../../../page/components/Widgets/WidgetContext.ts"],"names":[],"mappings":"AACA,OAAO,EACL,KAAK,0BAA0B,EAC/B,KAAK,YAAY,EAClB,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,iBAAiB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAC5D;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,EAAE,CAAC,CAAC;IACV;;OAEG;IACH,MAAM,EAAE,YAAY,CAAC;IACrB;;OAEG;IACH,UAAU,EAAE,0BAA0B,CAAC;IACvC;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,qEAA4D,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { type ReactNode } from 'react';
2
- import { type WidgetDefinition } from './types';
2
+ import { type WidgetDefinition, type WidgetLayout } from './types';
3
3
  /**
4
4
  * Props of the {@link WidgetProvider} component.
5
5
  */
@@ -16,10 +16,14 @@ export interface WidgetProviderProps {
16
16
  * Whether the widget is in preview mode.
17
17
  */
18
18
  isPreview: boolean;
19
+ /**
20
+ * The resolved margins of the widget container.
21
+ */
22
+ layout: WidgetLayout;
19
23
  }
20
24
  /**
21
25
  * The WidgetProvider component provides the context for a single widget.
22
26
  */
23
- declare const WidgetProvider: ({ children, definition, isPreview }: WidgetProviderProps) => import("react").JSX.Element;
27
+ declare const WidgetProvider: ({ children, definition, isPreview, layout, }: WidgetProviderProps) => import("react").JSX.Element;
24
28
  export default WidgetProvider;
25
29
  //# sourceMappingURL=WidgetProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"WidgetProvider.d.ts","sourceRoot":"","sources":["../../../../page/components/Widgets/WidgetProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAE,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,UAAU,EAAE,gBAAgB,CAAC;IAC7B;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,QAAA,MAAM,cAAc,GAAI,qCAAqC,mBAAmB,gCAoB/E,CAAC;AAEF,eAAe,cAAc,CAAC"}
1
+ {"version":3,"file":"WidgetProvider.d.ts","sourceRoot":"","sources":["../../../../page/components/Widgets/WidgetProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAW,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAC;AAEnE;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,UAAU,EAAE,gBAAgB,CAAC;IAC7B;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,MAAM,EAAE,YAAY,CAAC;CACtB;AAED;;GAEG;AACH,QAAA,MAAM,cAAc,GAAI,8CAErB,mBAAmB,gCAoBrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
@@ -11,12 +11,12 @@ import { jsx as _jsx } from "react/jsx-runtime";
11
11
  const WidgetProvider = ({
12
12
  children,
13
13
  definition,
14
- isPreview
14
+ isPreview,
15
+ layout
15
16
  }) => {
16
17
  const value = useMemo(() => {
17
18
  const {
18
19
  widgetConfig,
19
- layout,
20
20
  visibility,
21
21
  code,
22
22
  widgetConfigDefinitionCode
@@ -29,7 +29,7 @@ const WidgetProvider = ({
29
29
  visibility,
30
30
  isPreview
31
31
  };
32
- }, [definition, isPreview]);
32
+ }, [definition, isPreview, layout]);
33
33
  return /*#__PURE__*/_jsx(WidgetContext.Provider, {
34
34
  value: value,
35
35
  children: children
@@ -1,5 +1,18 @@
1
+ import { type MediaMarginSettings } from '@shopgate/engage/settings/types/appSettings';
1
2
  /**
2
3
  * Whether to consider vertical margins when calculating the overlay position.
3
4
  */
4
5
  export declare const CONSIDER_CONTAINER_MARGINS_ON_SCROLL_DEFAULT = false;
6
+ /**
7
+ * The margin sides of a widget container.
8
+ */
9
+ export declare const MARGIN_SIDES: readonly ["marginTop", "marginBottom", "marginLeft", "marginRight"];
10
+ /**
11
+ * The media widget margin side that belongs to each margin of a widget container.
12
+ */
13
+ export declare const MARGIN_SIDE_SETTINGS: Record<typeof MARGIN_SIDES[number], keyof MediaMarginSettings>;
14
+ /**
15
+ * The sides of the media widget margins.
16
+ */
17
+ export declare const MEDIA_MARGIN_SIDES: (keyof MediaMarginSettings)[];
5
18
  //# sourceMappingURL=constants.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../page/components/Widgets/constants.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,4CAA4C,QAAQ,CAAC"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../page/components/Widgets/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAEvF;;GAEG;AACH,eAAO,MAAM,4CAA4C,QAAQ,CAAC;AAElE;;GAEG;AACH,eAAO,MAAM,YAAY,qEAAsE,CAAC;AAEhG;;GAEG;AACH,eAAO,MAAM,oBAAoB,EAAE,MAAM,CACvC,OAAO,YAAY,CAAC,MAAM,CAAC,EAC3B,MAAM,mBAAmB,CAM1B,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,kBAAkB,+BAAsC,CAAC"}
@@ -1,4 +1,24 @@
1
1
  /**
2
2
  * Whether to consider vertical margins when calculating the overlay position.
3
3
  */
4
- export const CONSIDER_CONTAINER_MARGINS_ON_SCROLL_DEFAULT = false;
4
+ export const CONSIDER_CONTAINER_MARGINS_ON_SCROLL_DEFAULT = false;
5
+
6
+ /**
7
+ * The margin sides of a widget container.
8
+ */
9
+ export const MARGIN_SIDES = ['marginTop', 'marginBottom', 'marginLeft', 'marginRight'];
10
+
11
+ /**
12
+ * The media widget margin side that belongs to each margin of a widget container.
13
+ */
14
+ export const MARGIN_SIDE_SETTINGS = {
15
+ marginTop: 'top',
16
+ marginBottom: 'bottom',
17
+ marginLeft: 'left',
18
+ marginRight: 'right'
19
+ };
20
+
21
+ /**
22
+ * The sides of the media widget margins.
23
+ */
24
+ export const MEDIA_MARGIN_SIDES = Object.values(MARGIN_SIDE_SETTINGS);
@@ -1,3 +1,5 @@
1
+ import { type MediaMarginSettings } from '@shopgate/engage/settings/types/appSettings';
2
+ import { type AppliedMediaMargins, type WidgetDefinitionLayout, type WidgetLayout } from './types';
1
3
  /**
2
4
  * Retrieves the scroll container for the current page. Depending on the PWA mode this can be
3
5
  * a scrollable article element or the window.
@@ -47,4 +49,21 @@ export interface ScheduledStatus {
47
49
  * @returns An object containing the scheduling status.
48
50
  */
49
51
  export declare function checkScheduled({ from, to, timezoneOffset }?: ScheduledParams): ScheduledStatus;
52
+ /**
53
+ * Retrieves the sides on which a widget gets the media widget margins. Widgets declare them in a
54
+ * "config.json" inside their folder, which the build adds to the widget mapping. A widget that
55
+ * declares nothing keeps the margins of its own configuration.
56
+ * @param name The name of the widget.
57
+ * @returns The sides that get the media widget margins.
58
+ */
59
+ export declare function getAppliedMediaMargins(name: string): AppliedMediaMargins;
60
+ /**
61
+ * Resolves the margins of a widget container. The configuration of the widget instance wins over
62
+ * the media widget margin, which only applies to the sides the widget asked for.
63
+ * @param definitionLayout The layout settings of the widget instance.
64
+ * @param appliedMediaMargins The sides on which the widget gets the media widget margins.
65
+ * @param settings The media widget margins.
66
+ * @returns The resolved margins.
67
+ */
68
+ export declare function resolveWidgetLayout(definitionLayout: Partial<WidgetDefinitionLayout> | undefined, appliedMediaMargins: AppliedMediaMargins, settings: MediaMarginSettings): WidgetLayout;
50
69
  //# sourceMappingURL=helpers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../page/components/Widgets/helpers.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,QAAO,WAAW,GAAG,IACwC,CAAC;AAE7F;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,EAAE,IAAI,EAAE,EAAE,EAAE,cAAc,EAAE,GAAE,eAAoB,GACjD,eAAe,CAqBjB"}
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../../page/components/Widgets/helpers.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AACvF,OAAO,EACL,KAAK,mBAAmB,EAExB,KAAK,sBAAsB,EAC3B,KAAK,YAAY,EAClB,MAAM,SAAS,CAAC;AAGjB;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,QAAO,WAAW,GAAG,IACwC,CAAC;AAE7F;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,WAAW,EAAE,OAAO,CAAC;IACrB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,EAAE,IAAI,EAAE,EAAE,EAAE,cAAc,EAAE,GAAE,eAAoB,GACjD,eAAe,CAqBjB;AAkBD;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,CAgBxE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,OAAO,CAAC,sBAAsB,CAAC,GAAG,SAAS,EAC7D,mBAAmB,EAAE,mBAAmB,EACxC,QAAQ,EAAE,mBAAmB,GAC5B,YAAY,CAUd"}
@@ -1,5 +1,8 @@
1
+ import "core-js/modules/es.array.reduce.js";
1
2
  import "core-js/modules/es.string.replace.js";
3
+ import { componentsConfig } from '@shopgate/pwa-common/helpers/config';
2
4
  import { PAGE_PREVIEW_PATTERN } from '@shopgate/engage/page/constants';
5
+ import { MARGIN_SIDES, MARGIN_SIDE_SETTINGS, MEDIA_MARGIN_SIDES } from "./constants";
3
6
 
4
7
  /**
5
8
  * Retrieves the scroll container for the current page. Depending on the PWA mode this can be
@@ -45,4 +48,51 @@ export function checkScheduled({
45
48
  isActive,
46
49
  isExpired
47
50
  };
51
+ }
52
+
53
+ /**
54
+ * The widget mapping of the components config, reduced to what the layout resolution reads. The
55
+ * config itself comes from untyped JS, so the shape is described here at the consumption boundary.
56
+ */
57
+
58
+ /**
59
+ * Retrieves the sides on which a widget gets the media widget margins. Widgets declare them in a
60
+ * "config.json" inside their folder, which the build adds to the widget mapping. A widget that
61
+ * declares nothing keeps the margins of its own configuration.
62
+ * @param name The name of the widget.
63
+ * @returns The sides that get the media widget margins.
64
+ */
65
+ export function getAppliedMediaMargins(name) {
66
+ const {
67
+ widgetsV2
68
+ } = componentsConfig;
69
+ const declared = widgetsV2?.[name]?.config?.layout?.applyMediaMargins;
70
+ if (declared === true) {
71
+ return MEDIA_MARGIN_SIDES.reduce((sides, side) => ({
72
+ ...sides,
73
+ [side]: true
74
+ }), {});
75
+ }
76
+ if (declared && typeof declared === 'object') {
77
+ return declared;
78
+ }
79
+ return {};
80
+ }
81
+
82
+ /**
83
+ * Resolves the margins of a widget container. The configuration of the widget instance wins over
84
+ * the media widget margin, which only applies to the sides the widget asked for.
85
+ * @param definitionLayout The layout settings of the widget instance.
86
+ * @param appliedMediaMargins The sides on which the widget gets the media widget margins.
87
+ * @param settings The media widget margins.
88
+ * @returns The resolved margins.
89
+ */
90
+ export function resolveWidgetLayout(definitionLayout, appliedMediaMargins, settings) {
91
+ return MARGIN_SIDES.reduce((layout, side) => {
92
+ const mediaSide = MARGIN_SIDE_SETTINGS[side];
93
+ return {
94
+ ...layout,
95
+ [side]: definitionLayout?.[side] ?? (appliedMediaMargins?.[mediaSide] ? settings?.[mediaSide] ?? 0 : 0)
96
+ };
97
+ }, {});
48
98
  }