@shopgate/engage 7.32.0-beta.1 → 7.32.0-beta.2
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/README.md +0 -1
- package/admin-preview/constants/index.d.ts +10 -1
- package/admin-preview/constants/index.d.ts.map +1 -1
- package/admin-preview/constants/index.js +14 -5
- package/admin-preview/detection.d.ts +49 -0
- package/admin-preview/detection.d.ts.map +1 -0
- package/admin-preview/detection.js +166 -0
- package/admin-preview/helpers/index.d.ts.map +1 -1
- package/admin-preview/helpers/index.js +4 -4
- package/cart/components/CartItem/CartItemProductProvider.connector.js +0 -2
- package/cart/components/CartItem/CartItemProductProvider.js +3 -30
- package/cart/components/CartItem/CartItemProductProvider.types.js +0 -1
- package/cart/components/PaymentBar/PaymentBarContent.js +1 -1
- package/components/Logo/index.d.ts.map +1 -1
- package/components/Logo/index.js +3 -6
- package/components/PickerUtilize/index.d.ts +2 -1
- package/components/PickerUtilize/index.d.ts.map +1 -1
- package/components/View/components/Above/index.d.ts.map +1 -1
- package/components/View/components/Above/index.js +3 -1
- package/components/View/components/Below/index.d.ts.map +1 -1
- package/components/View/components/Below/index.js +3 -1
- package/components/View/components/Content/index.d.ts +2 -1
- package/components/View/components/Content/index.d.ts.map +1 -1
- package/components/v2/ButtonBase/Ripple.d.ts +2 -1
- package/components/v2/ButtonBase/Ripple.d.ts.map +1 -1
- package/development/components/SimulatedInsets/SimulatedInsetBottom.js +3 -3
- package/development/components/SimulatedInsets/SimulatedInsetTop.js +2 -2
- package/favorites/components/Item/Item.js +5 -2
- package/favorites/components/Lists/Lists.js +13 -1
- package/locations/components/FulfillmentSheet/FulfillmentSheetContent.js +4 -8
- package/locations/components/FulfillmentSlotSwitcher/FulfillmentSlotSwitcherBar.js +1 -5
- package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherBar.js +1 -5
- package/package.json +11 -11
- package/product/components/FilterBar/components/Content/components/FilterButton/index.js +2 -6
- package/product/components/FilterBar/components/Content/components/Sort/index.js +1 -5
- package/product/components/ProductName/ProductName.d.ts +1 -1
- package/product/components/ProductName/ProductName.d.ts.map +1 -1
- package/product/components/ProductName/ProductNameContent.d.ts +2 -1
- package/product/components/ProductName/ProductNameContent.d.ts.map +1 -1
- package/product/components/ProductRatingStars/ProductRatingStars.d.ts +1 -1
- package/product/components/RelationsSlider/RelationsSheet.js +1 -5
- package/product/components/UnitQuantityPicker/UnitQuantityPicker.js +1 -1
- package/styles/index.d.ts +1 -1
- package/styles/index.d.ts.map +1 -1
- package/styles/index.js +1 -1
- package/styles/theme/createTheme/createComponents.d.ts +2 -2
- package/styles/theme/createTheme/createComponents.d.ts.map +1 -1
- package/styles/theme/createTheme/createComponents.js +0 -1
- package/styles/theme/createTheme/createComponents.types.d.ts +20 -0
- package/styles/theme/createTheme/createComponents.types.d.ts.map +1 -1
- package/styles/theme/createTheme/createComponents.types.js +20 -0
- package/styles/theme/createTheme/createSpacing.js +4 -1
- package/styles/theme/createTheme/createThemeFromColorScheme.d.ts +2 -2
- package/styles/theme/createTheme/createThemeFromColorScheme.d.ts.map +1 -1
- package/styles/theme/createTheme/index.d.ts.map +1 -1
- package/styles/theme/createTheme/index.js +2 -1
- package/styles/theme/createTheme/layout.d.ts +23 -0
- package/styles/theme/createTheme/layout.d.ts.map +1 -0
- package/styles/theme/createTheme/layout.js +20 -0
- package/styles/theme/createTheme/transitions.d.ts +4 -0
- package/styles/theme/createTheme/transitions.js +3 -1
- package/styles/theme/createTheme/types.d.ts +25 -4
- package/styles/theme/createTheme/types.d.ts.map +1 -1
- package/styles/theme/createTheme/types.js +8 -1
- package/styles/theme/hocs/index.d.ts +2 -0
- package/styles/theme/hocs/index.d.ts.map +1 -0
- package/styles/theme/hocs/index.js +1 -0
- package/styles/theme/hocs/withTheme.d.ts +21 -0
- package/styles/theme/hocs/withTheme.d.ts.map +1 -0
- package/styles/theme/hocs/withTheme.js +33 -0
- package/styles/theme/index.d.ts +1 -0
- package/styles/theme/index.d.ts.map +1 -1
- package/styles/theme/index.js +2 -1
- package/styles/theme/providers/ActiveBreakpointProvider.d.ts +1 -1
- package/styles/theme/providers/ThemeProvider.d.ts +3 -3
- package/styles/theme/providers/ThemeProvider.d.ts.map +1 -1
- package/styles/theme/providers/ThemeProvider.js +10 -14
package/README.md
CHANGED
|
@@ -8,7 +8,6 @@
|
|
|
8
8
|
|
|
9
9
|
<div align="center">
|
|
10
10
|
|
|
11
|
-
[](https://travis-ci.org/shopgate/pwa)
|
|
12
11
|
[](https://coveralls.io/github/shopgate/pwa?branch=v6.X)
|
|
13
12
|
[](https://github.com/shopgate/pwa/releases)
|
|
14
13
|
[](https://lernajs.io/)
|
|
@@ -1,14 +1,23 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { PAGE_PREVIEW_PATTERN } from '../detection';
|
|
2
2
|
/**
|
|
3
3
|
* Whether the app is currently in page admin preview mode.
|
|
4
|
+
*
|
|
5
|
+
* Snapshot taken when this module is first evaluated. Prefer the isPageAdminPreviewActive()
|
|
6
|
+
* helper, which re-evaluates on every call.
|
|
4
7
|
*/
|
|
5
8
|
export declare const IS_PAGE_ADMIN_PREVIEW_ACTIVE: boolean;
|
|
6
9
|
/**
|
|
7
10
|
* Whether the app is currently in frontend settings admin preview mode.
|
|
11
|
+
*
|
|
12
|
+
* Snapshot taken when this module is first evaluated. Prefer the
|
|
13
|
+
* isFrontendSettingsAdminPreviewActive() helper, which re-evaluates on every call.
|
|
8
14
|
*/
|
|
9
15
|
export declare const IS_FRONTEND_SETTINGS_ADMIN_PREVIEW_ACTIVE: boolean;
|
|
10
16
|
/**
|
|
11
17
|
* Whether the app is currently in admin preview mode (pages or frontend settings).
|
|
18
|
+
*
|
|
19
|
+
* Snapshot taken when this module is first evaluated. Prefer the isAdminPreviewActive() helper,
|
|
20
|
+
* which re-evaluates on every call.
|
|
12
21
|
*/
|
|
13
22
|
export declare const IS_ADMIN_PREVIEW_ACTIVE: boolean;
|
|
14
23
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../admin-preview/constants/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../admin-preview/constants/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAEpD;;;;;GAKG;AACH,eAAO,MAAM,4BAA4B,SAA2B,CAAC;AAErE;;;;;GAKG;AACH,eAAO,MAAM,yCAAyC,SAAuC,CAAC;AAE9F;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,SAAuB,CAAC;AAE5D;;GAEG;AACH,eAAO,MAAM,6BAA6B,UAMzC,CAAC"}
|
|
@@ -1,20 +1,29 @@
|
|
|
1
|
-
import "
|
|
2
|
-
export
|
|
1
|
+
import { detectAdminPreview, detectFrontendSettingsAdminPreview, detectPageAdminPreview } from "../detection";
|
|
2
|
+
export { PAGE_PREVIEW_PATTERN } from "../detection";
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Whether the app is currently in page admin preview mode.
|
|
6
|
+
*
|
|
7
|
+
* Snapshot taken when this module is first evaluated. Prefer the isPageAdminPreviewActive()
|
|
8
|
+
* helper, which re-evaluates on every call.
|
|
6
9
|
*/
|
|
7
|
-
export const IS_PAGE_ADMIN_PREVIEW_ACTIVE =
|
|
10
|
+
export const IS_PAGE_ADMIN_PREVIEW_ACTIVE = detectPageAdminPreview();
|
|
8
11
|
|
|
9
12
|
/**
|
|
10
13
|
* Whether the app is currently in frontend settings admin preview mode.
|
|
14
|
+
*
|
|
15
|
+
* Snapshot taken when this module is first evaluated. Prefer the
|
|
16
|
+
* isFrontendSettingsAdminPreviewActive() helper, which re-evaluates on every call.
|
|
11
17
|
*/
|
|
12
|
-
export const IS_FRONTEND_SETTINGS_ADMIN_PREVIEW_ACTIVE =
|
|
18
|
+
export const IS_FRONTEND_SETTINGS_ADMIN_PREVIEW_ACTIVE = detectFrontendSettingsAdminPreview();
|
|
13
19
|
|
|
14
20
|
/**
|
|
15
21
|
* Whether the app is currently in admin preview mode (pages or frontend settings).
|
|
22
|
+
*
|
|
23
|
+
* Snapshot taken when this module is first evaluated. Prefer the isAdminPreviewActive() helper,
|
|
24
|
+
* which re-evaluates on every call.
|
|
16
25
|
*/
|
|
17
|
-
export const IS_ADMIN_PREVIEW_ACTIVE =
|
|
26
|
+
export const IS_ADMIN_PREVIEW_ACTIVE = detectAdminPreview();
|
|
18
27
|
|
|
19
28
|
/**
|
|
20
29
|
* List of allowed origins for cms page preview iFrame communication.
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export declare const PAGE_PREVIEW_PATTERN = "/shopgate-internal-page-preview";
|
|
2
|
+
export declare const FRONTEND_SETTINGS_PREVIEW_PARAM = "frontendSettingsPreview=true";
|
|
3
|
+
export declare const SESSION_STORAGE_KEY_PAGE_PREVIEW = "sgPageAdminPreview";
|
|
4
|
+
export declare const SESSION_STORAGE_KEY_FRONTEND_SETTINGS_PREVIEW = "sgFrontendSettingsAdminPreview";
|
|
5
|
+
/**
|
|
6
|
+
* Detects whether the app is in page admin preview mode. Once detected, the result is remembered
|
|
7
|
+
* for the rest of the session, because the url is not guaranteed to keep the preview marker.
|
|
8
|
+
* @returns True if the app is in page admin preview mode, false otherwise.
|
|
9
|
+
*/
|
|
10
|
+
export declare const detectPageAdminPreview: () => boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Detects whether the app is in frontend settings admin preview mode. Once detected, the result is
|
|
13
|
+
* remembered for the rest of the session, because the url is not guaranteed to keep the query
|
|
14
|
+
* param.
|
|
15
|
+
* @returns True if the app is in frontend settings admin preview mode, false otherwise.
|
|
16
|
+
*/
|
|
17
|
+
export declare const detectFrontendSettingsAdminPreview: () => boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Detects whether the app is in admin preview mode (pages or frontend settings).
|
|
20
|
+
* @returns True if the app is in admin preview mode, false otherwise.
|
|
21
|
+
*/
|
|
22
|
+
export declare const detectAdminPreview: () => boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Returns the current detection state. Exposed on window as SGAdminPreviewDebug so the values can
|
|
25
|
+
* be inspected on a deployed build, from the console of the preview iframe:
|
|
26
|
+
*
|
|
27
|
+
* window.SGAdminPreviewDebug()
|
|
28
|
+
*
|
|
29
|
+
* @returns A snapshot of everything detection depends on.
|
|
30
|
+
*/
|
|
31
|
+
export declare const getAdminPreviewDebugInfo: () => {
|
|
32
|
+
initialHref: string;
|
|
33
|
+
currentHref: string;
|
|
34
|
+
pathname: string;
|
|
35
|
+
search: string;
|
|
36
|
+
urlChangedSinceBoot: boolean;
|
|
37
|
+
isInIframe: boolean;
|
|
38
|
+
referrer: string;
|
|
39
|
+
stickyFlags: {
|
|
40
|
+
page: boolean;
|
|
41
|
+
frontendSettings: boolean;
|
|
42
|
+
};
|
|
43
|
+
detected: {
|
|
44
|
+
page: boolean;
|
|
45
|
+
frontendSettings: boolean;
|
|
46
|
+
any: boolean;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
//# sourceMappingURL=detection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detection.d.ts","sourceRoot":"","sources":["../../admin-preview/detection.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,oBAAoB,oCAAoC,CAAC;AAEtE,eAAO,MAAM,+BAA+B,iCAAiC,CAAC;AAE9E,eAAO,MAAM,gCAAgC,uBAAuB,CAAC;AAErE,eAAO,MAAM,6CAA6C,mCAAmC,CAAC;AAyF9F;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,QAAO,OAYzC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kCAAkC,QAAO,OAYrD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kBAAkB,QAAO,OAC4B,CAAC;AAEnE;;;;;;;GAOG;AACH,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;CAiBnC,CAAC"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import "core-js/modules/es.array.includes.js";
|
|
2
|
+
// The logger is imported from @shopgate/pwa-core/helpers rather than @shopgate/engage/core/helpers
|
|
3
|
+
// on purpose: that barrel pulls in scrollContainer, which imports this module back. Since detection
|
|
4
|
+
// runs while the constants module is evaluated, the cycle would resolve to undefined at boot.
|
|
5
|
+
import { logger } from '@shopgate/pwa-core/helpers';
|
|
6
|
+
export const PAGE_PREVIEW_PATTERN = '/shopgate-internal-page-preview';
|
|
7
|
+
export const FRONTEND_SETTINGS_PREVIEW_PARAM = 'frontendSettingsPreview=true';
|
|
8
|
+
export const SESSION_STORAGE_KEY_PAGE_PREVIEW = 'sgPageAdminPreview';
|
|
9
|
+
export const SESSION_STORAGE_KEY_FRONTEND_SETTINGS_PREVIEW = 'sgFrontendSettingsAdminPreview';
|
|
10
|
+
const LOG_PREFIX = '[AdminPreview]';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* The url as it was when this module was first evaluated. Captured here because detection can run
|
|
14
|
+
* again later, when the url may already have been rewritten.
|
|
15
|
+
*/
|
|
16
|
+
const INITIAL_HREF = window.location.href;
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Remembers the last logged result per detector, so repeated calls only log on a real change.
|
|
20
|
+
* isAdminPreviewActive() is called from hot paths like breakpoints and scroll handling.
|
|
21
|
+
*/
|
|
22
|
+
const lastLoggedResults = {};
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Reads a sticky preview flag. Storage access throws in a sandboxed iframe without
|
|
26
|
+
* "allow-same-origin", and is blocked by some browsers in cross-origin iframes - the preview
|
|
27
|
+
* runs in exactly that context, so a throw here would break app boot for everyone.
|
|
28
|
+
* @param key The session storage key to read.
|
|
29
|
+
* @returns True when the flag was persisted before, false otherwise.
|
|
30
|
+
*/
|
|
31
|
+
const readStickyFlag = key => {
|
|
32
|
+
try {
|
|
33
|
+
return window.sessionStorage.getItem(key) === '1';
|
|
34
|
+
} catch (error) {
|
|
35
|
+
logger.warn(`${LOG_PREFIX} session storage is not readable`, {
|
|
36
|
+
key,
|
|
37
|
+
error
|
|
38
|
+
});
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Persists a sticky preview flag, so preview mode survives a reload or a url rewrite that drops
|
|
45
|
+
* the query string. See readStickyFlag for why this can throw.
|
|
46
|
+
* @param key The session storage key to write.
|
|
47
|
+
*/
|
|
48
|
+
const writeStickyFlag = key => {
|
|
49
|
+
try {
|
|
50
|
+
window.sessionStorage.setItem(key, '1');
|
|
51
|
+
} catch (error) {
|
|
52
|
+
logger.warn(`${LOG_PREFIX} session storage is not writable`, {
|
|
53
|
+
key,
|
|
54
|
+
error
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Logs how a detection result was reached, but only when it differs from the previous result for
|
|
61
|
+
* that detector. Kept verbose on purpose: it exists to investigate why preview mode is not picked
|
|
62
|
+
* up on deployed builds.
|
|
63
|
+
* @param name The detector that produced the result.
|
|
64
|
+
* @param result The detected result.
|
|
65
|
+
* @param matchedUrl Whether the current url carries the preview marker.
|
|
66
|
+
* @param matchedStickyFlag Whether the persisted sticky flag was set.
|
|
67
|
+
*/
|
|
68
|
+
const logDetection = (name, result, matchedUrl, matchedStickyFlag) => {
|
|
69
|
+
if (lastLoggedResults[name] === result) {
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
lastLoggedResults[name] = result;
|
|
73
|
+
logger.log(`${LOG_PREFIX} ${name} -> ${result}`, {
|
|
74
|
+
result,
|
|
75
|
+
// True when the url still carries the marker.
|
|
76
|
+
matchedUrl,
|
|
77
|
+
// True when the result came from the persisted flag - i.e. the url lost the marker.
|
|
78
|
+
matchedStickyFlag,
|
|
79
|
+
// Compare these two to see whether the url changed since the app booted.
|
|
80
|
+
initialHref: INITIAL_HREF,
|
|
81
|
+
currentHref: window.location.href,
|
|
82
|
+
pathname: window.location.pathname,
|
|
83
|
+
search: window.location.search,
|
|
84
|
+
// A cross-origin parent means the app really is embedded in the admin.
|
|
85
|
+
isInIframe: window.parent !== window,
|
|
86
|
+
referrer: document.referrer
|
|
87
|
+
});
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Detects whether the app is in page admin preview mode. Once detected, the result is remembered
|
|
92
|
+
* for the rest of the session, because the url is not guaranteed to keep the preview marker.
|
|
93
|
+
* @returns True if the app is in page admin preview mode, false otherwise.
|
|
94
|
+
*/
|
|
95
|
+
export const detectPageAdminPreview = () => {
|
|
96
|
+
const matchedUrl = window.location.pathname.startsWith(PAGE_PREVIEW_PATTERN);
|
|
97
|
+
if (matchedUrl) {
|
|
98
|
+
writeStickyFlag(SESSION_STORAGE_KEY_PAGE_PREVIEW);
|
|
99
|
+
logDetection('detectPageAdminPreview', true, true, false);
|
|
100
|
+
return true;
|
|
101
|
+
}
|
|
102
|
+
const matchedStickyFlag = readStickyFlag(SESSION_STORAGE_KEY_PAGE_PREVIEW);
|
|
103
|
+
logDetection('detectPageAdminPreview', matchedStickyFlag, false, matchedStickyFlag);
|
|
104
|
+
return matchedStickyFlag;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Detects whether the app is in frontend settings admin preview mode. Once detected, the result is
|
|
109
|
+
* remembered for the rest of the session, because the url is not guaranteed to keep the query
|
|
110
|
+
* param.
|
|
111
|
+
* @returns True if the app is in frontend settings admin preview mode, false otherwise.
|
|
112
|
+
*/
|
|
113
|
+
export const detectFrontendSettingsAdminPreview = () => {
|
|
114
|
+
const matchedUrl = window.location.search.includes(FRONTEND_SETTINGS_PREVIEW_PARAM);
|
|
115
|
+
if (matchedUrl) {
|
|
116
|
+
writeStickyFlag(SESSION_STORAGE_KEY_FRONTEND_SETTINGS_PREVIEW);
|
|
117
|
+
logDetection('detectFrontendSettingsAdminPreview', true, true, false);
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
const matchedStickyFlag = readStickyFlag(SESSION_STORAGE_KEY_FRONTEND_SETTINGS_PREVIEW);
|
|
121
|
+
logDetection('detectFrontendSettingsAdminPreview', matchedStickyFlag, false, matchedStickyFlag);
|
|
122
|
+
return matchedStickyFlag;
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* Detects whether the app is in admin preview mode (pages or frontend settings).
|
|
127
|
+
* @returns True if the app is in admin preview mode, false otherwise.
|
|
128
|
+
*/
|
|
129
|
+
export const detectAdminPreview = () => detectPageAdminPreview() || detectFrontendSettingsAdminPreview();
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Returns the current detection state. Exposed on window as SGAdminPreviewDebug so the values can
|
|
133
|
+
* be inspected on a deployed build, from the console of the preview iframe:
|
|
134
|
+
*
|
|
135
|
+
* window.SGAdminPreviewDebug()
|
|
136
|
+
*
|
|
137
|
+
* @returns A snapshot of everything detection depends on.
|
|
138
|
+
*/
|
|
139
|
+
export const getAdminPreviewDebugInfo = () => ({
|
|
140
|
+
initialHref: INITIAL_HREF,
|
|
141
|
+
currentHref: window.location.href,
|
|
142
|
+
pathname: window.location.pathname,
|
|
143
|
+
search: window.location.search,
|
|
144
|
+
urlChangedSinceBoot: INITIAL_HREF !== window.location.href,
|
|
145
|
+
isInIframe: window.parent !== window,
|
|
146
|
+
referrer: document.referrer,
|
|
147
|
+
stickyFlags: {
|
|
148
|
+
page: readStickyFlag(SESSION_STORAGE_KEY_PAGE_PREVIEW),
|
|
149
|
+
frontendSettings: readStickyFlag(SESSION_STORAGE_KEY_FRONTEND_SETTINGS_PREVIEW)
|
|
150
|
+
},
|
|
151
|
+
detected: {
|
|
152
|
+
page: detectPageAdminPreview(),
|
|
153
|
+
frontendSettings: detectFrontendSettingsAdminPreview(),
|
|
154
|
+
any: detectAdminPreview()
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
logger.log(`${LOG_PREFIX} module evaluated`, {
|
|
158
|
+
href: INITIAL_HREF,
|
|
159
|
+
search: window.location.search,
|
|
160
|
+
hasParamAtBoot: window.location.search.includes(FRONTEND_SETTINGS_PREVIEW_PARAM),
|
|
161
|
+
isInIframe: window.parent !== window,
|
|
162
|
+
referrer: document.referrer
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
// @ts-expect-error - debug-only global, intentionally not on the Window type.
|
|
166
|
+
window.SGAdminPreviewDebug = getAdminPreviewDebugInfo;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../admin-preview/helpers/index.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,eAAO,MAAM,oBAAoB,QAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../admin-preview/helpers/index.ts"],"names":[],"mappings":"AAMA;;;GAGG;AACH,eAAO,MAAM,oBAAoB,QAAO,OAClB,CAAC;AAEvB;;;GAGG;AACH,eAAO,MAAM,wBAAwB,QAAO,OAClB,CAAC;AAE3B;;;GAGG;AACH,eAAO,MAAM,oCAAoC,QAAO,OAClB,CAAC"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { detectAdminPreview, detectFrontendSettingsAdminPreview, detectPageAdminPreview } from "../detection";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Checks if the app is currently in admin preview mode (pages or frontend settings).
|
|
5
5
|
* @returns True if the app is in admin preview mode, false otherwise.
|
|
6
6
|
*/
|
|
7
|
-
export const isAdminPreviewActive = () =>
|
|
7
|
+
export const isAdminPreviewActive = () => detectAdminPreview();
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
10
|
* Checks if the app is currently in page admin preview mode.
|
|
11
11
|
* @returns True if the app is in page admin preview mode, false otherwise.
|
|
12
12
|
*/
|
|
13
|
-
export const isPageAdminPreviewActive = () =>
|
|
13
|
+
export const isPageAdminPreviewActive = () => detectPageAdminPreview();
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Checks if the app is currently in frontend settings admin preview mode.
|
|
17
17
|
* @returns True if the app is in frontend settings admin preview mode, false otherwise.
|
|
18
18
|
*/
|
|
19
|
-
export const isFrontendSettingsAdminPreviewActive = () =>
|
|
19
|
+
export const isFrontendSettingsAdminPreviewActive = () => detectFrontendSettingsAdminPreview();
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { connect } from 'react-redux';
|
|
2
|
-
import { isAndroid } from '@shopgate/pwa-common/selectors/client';
|
|
3
2
|
import deleteProductsFromCart from '@shopgate/pwa-common-commerce/cart/actions/deleteProductsFromCart';
|
|
4
3
|
import updateProductsInCart from '@shopgate/pwa-common-commerce/cart/actions/updateProductsInCart';
|
|
5
4
|
import { getCurrency } from '@shopgate/pwa-common-commerce/cart/selectors';
|
|
@@ -15,7 +14,6 @@ import { getCurrency } from '@shopgate/pwa-common-commerce/cart/selectors';
|
|
|
15
14
|
* @returns {StateProps} The extended component props.
|
|
16
15
|
*/
|
|
17
16
|
const mapStateToProps = state => ({
|
|
18
|
-
isAndroid: isAndroid(state),
|
|
19
17
|
currency: getCurrency(state)
|
|
20
18
|
});
|
|
21
19
|
|
|
@@ -1,17 +1,10 @@
|
|
|
1
1
|
import "core-js/modules/es.regexp.flags.js";
|
|
2
2
|
import React, { useMemo, useCallback, useState, useRef } from 'react';
|
|
3
|
-
import { getAbsoluteHeight } from '@shopgate/pwa-common/helpers/dom';
|
|
4
|
-
import { themeConfig } from '@shopgate/pwa-common/helpers/config';
|
|
5
3
|
import { CART_ITEM_TYPE_PRODUCT } from '@shopgate/pwa-common-commerce/cart/constants';
|
|
6
4
|
import PropTypes from 'prop-types';
|
|
7
|
-
import { CART_INPUT_AUTO_SCROLL_DELAY } from "../../cart.constants";
|
|
8
5
|
import Context from "./CartItemProductProvider.context";
|
|
9
6
|
import connect from "./CartItemProductProvider.connector";
|
|
10
7
|
import CartItemProductProviderLegacy from "./CartItemProductProviderLegacy";
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
const {
|
|
13
|
-
variables
|
|
14
|
-
} = themeConfig;
|
|
15
8
|
|
|
16
9
|
/**
|
|
17
10
|
* @typedef {import('./CartItemProductProvider.types').OwnProps} OwnProps
|
|
@@ -28,6 +21,7 @@ const {
|
|
|
28
21
|
* @param {Props} props The component props.
|
|
29
22
|
* @returns {JSX.Element}
|
|
30
23
|
*/
|
|
24
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
31
25
|
const CartItemProductProvider = ({
|
|
32
26
|
currency,
|
|
33
27
|
deleteProduct,
|
|
@@ -36,7 +30,6 @@ const CartItemProductProvider = ({
|
|
|
36
30
|
cartItem,
|
|
37
31
|
isEditable,
|
|
38
32
|
children,
|
|
39
|
-
isAndroid,
|
|
40
33
|
currencyOverride
|
|
41
34
|
}) => {
|
|
42
35
|
const {
|
|
@@ -66,25 +59,6 @@ const CartItemProductProvider = ({
|
|
|
66
59
|
updateProduct(id, updatedQuantity);
|
|
67
60
|
}, [id, updateProduct]);
|
|
68
61
|
const toggleEditMode = useCallback(isEnabled => {
|
|
69
|
-
if (isAndroid && isEnabled) {
|
|
70
|
-
/**
|
|
71
|
-
* When the user focuses the quantity input, the keyboard will pop up an overlap the input.
|
|
72
|
-
* Therefor the input has to be scrolled into the viewport again. Since between the focus and
|
|
73
|
-
* the keyboard appearance some time ticks away, the execution of the scroll code is delayed.
|
|
74
|
-
*
|
|
75
|
-
* This should not happen on iOS devices, since their web views behave different.
|
|
76
|
-
*/
|
|
77
|
-
setTimeout(() => {
|
|
78
|
-
const yOffset = -(window.innerHeight / 2) + getAbsoluteHeight(cartItemRef.current) + variables.paymentBar.height;
|
|
79
|
-
if (cartItemRef.current) {
|
|
80
|
-
cartItemRef.current.scrollIntoView({
|
|
81
|
-
behavior: 'smooth',
|
|
82
|
-
yOffset
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}, CART_INPUT_AUTO_SCROLL_DELAY);
|
|
86
|
-
}
|
|
87
|
-
|
|
88
62
|
// Give the keyboard some time to slide out after blur, before further actions are taken.
|
|
89
63
|
setTimeout(() => {
|
|
90
64
|
if (onFocus) {
|
|
@@ -92,7 +66,7 @@ const CartItemProductProvider = ({
|
|
|
92
66
|
}
|
|
93
67
|
}, isEnabled ? 300 : 0);
|
|
94
68
|
setEditMode(isEnabled);
|
|
95
|
-
}, [
|
|
69
|
+
}, [onFocus]);
|
|
96
70
|
const value = useMemo(() => {
|
|
97
71
|
const isLinkable = flags?.disableLink !== true;
|
|
98
72
|
const allowQuantityChange = flags?.disableQuantityField !== true;
|
|
@@ -140,7 +114,6 @@ CartItemProductProvider.defaultProps = {
|
|
|
140
114
|
isEditable: true,
|
|
141
115
|
onFocus: () => {},
|
|
142
116
|
currencyOverride: null,
|
|
143
|
-
currency: null
|
|
144
|
-
isAndroid: false
|
|
117
|
+
currency: null
|
|
145
118
|
};
|
|
146
119
|
export default connect(CartItemProductProvider);
|
|
@@ -20,7 +20,7 @@ const useStyles = makeStyles()(theme => ({
|
|
|
20
20
|
boxShadow: '0 -4px 5px -2px rgba(0, 0, 0, 0.1)',
|
|
21
21
|
position: 'relative',
|
|
22
22
|
zIndex: 2,
|
|
23
|
-
paddingBottom:
|
|
23
|
+
paddingBottom: theme.layout.safeArea.bottom
|
|
24
24
|
},
|
|
25
25
|
container: {
|
|
26
26
|
padding: isIOSTheme() ? theme.spacing(1) : theme.spacing(2),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Logo/index.jsx"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/Logo/index.jsx"],"names":[],"mappings":";;;;;QAyBY,GAAG;;;;;;;;;;;;;;;;;;;sBAxBO,YAAY"}
|
package/components/Logo/index.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { makeStyles } from '@shopgate/engage/styles';
|
|
4
|
-
import appConfig
|
|
4
|
+
import appConfig from '@shopgate/pwa-common/helpers/config';
|
|
5
5
|
import noop from 'lodash/noop';
|
|
6
6
|
import connect from "./connector";
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
const {
|
|
9
|
-
variables
|
|
10
|
-
} = themeConfig;
|
|
11
8
|
const useStyles = makeStyles()(theme => ({
|
|
12
9
|
container: {
|
|
13
10
|
alignItems: 'center',
|
|
@@ -16,8 +13,8 @@ const useStyles = makeStyles()(theme => ({
|
|
|
16
13
|
},
|
|
17
14
|
image: {
|
|
18
15
|
margin: '0 auto',
|
|
19
|
-
maxHeight:
|
|
20
|
-
maxWidth: `calc(var(--page-content-width) - ${
|
|
16
|
+
maxHeight: theme.components.navigator.height,
|
|
17
|
+
maxWidth: `calc(var(--page-content-width) - (${theme.components.navigator.height} * 3) - ${theme.spacing(4)}px)`,
|
|
21
18
|
overflow: 'hidden',
|
|
22
19
|
textOverflow: 'ellipsis',
|
|
23
20
|
whiteSpace: 'nowrap'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/PickerUtilize/index.jsx"],"names":[],"mappings":"AAkHe
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../components/PickerUtilize/index.jsx"],"names":[],"mappings":"AAkHe,yDAMd;;kBAxH0C,OAAO"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../components/View/components/Above/index.jsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../components/View/components/Above/index.jsx"],"names":[],"mappings":";AAIA;;GAEG;AACH,8BAFa,GAAG,CAoBf"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useTheme } from '@shopgate/engage/styles';
|
|
2
3
|
import { ViewContext } from "../../context";
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -6,6 +7,7 @@ import { ViewContext } from "../../context";
|
|
|
6
7
|
*/
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
function ViewAbove() {
|
|
10
|
+
const theme = useTheme();
|
|
9
11
|
return /*#__PURE__*/_jsx(ViewContext.Consumer, {
|
|
10
12
|
children: ({
|
|
11
13
|
top
|
|
@@ -15,7 +17,7 @@ function ViewAbove() {
|
|
|
15
17
|
}
|
|
16
18
|
const styles = {
|
|
17
19
|
flexShrink: 0,
|
|
18
|
-
height: `calc(${top}px +
|
|
20
|
+
height: `calc(${top}px + ${theme.layout.safeArea.top})`
|
|
19
21
|
};
|
|
20
22
|
return /*#__PURE__*/_jsx("div", {
|
|
21
23
|
"aria-hidden": true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../components/View/components/Below/index.jsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../components/View/components/Below/index.jsx"],"names":[],"mappings":";AAIA;;GAEG;AACH,8BAFa,GAAG,CAoBf"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { useTheme } from '@shopgate/engage/styles';
|
|
2
3
|
import { ViewContext } from "../../context";
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -6,6 +7,7 @@ import { ViewContext } from "../../context";
|
|
|
6
7
|
*/
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
9
|
function ViewBelow() {
|
|
10
|
+
const theme = useTheme();
|
|
9
11
|
return /*#__PURE__*/_jsx(ViewContext.Consumer, {
|
|
10
12
|
children: ({
|
|
11
13
|
bottom
|
|
@@ -15,7 +17,7 @@ function ViewBelow() {
|
|
|
15
17
|
}
|
|
16
18
|
const styles = {
|
|
17
19
|
flexShrink: 0,
|
|
18
|
-
height: `calc(${bottom}px +
|
|
20
|
+
height: `calc(${bottom}px + ${theme.layout.safeArea.bottom})`
|
|
19
21
|
};
|
|
20
22
|
return /*#__PURE__*/_jsx("div", {
|
|
21
23
|
"aria-hidden": true,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../components/View/components/Content/index.jsx"],"names":[],"mappings":"AAiQe
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../components/View/components/Content/index.jsx"],"names":[],"mappings":"AAiQe,yDAUd;;kBApQM,OAAO"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
import type { RippleItem as RippleModel } from './hooks';
|
|
2
3
|
interface RippleProps {
|
|
3
4
|
ripples: RippleModel[];
|
|
@@ -5,6 +6,6 @@ interface RippleProps {
|
|
|
5
6
|
/**
|
|
6
7
|
* The Ripple component renders the ripple effect for button interactions.
|
|
7
8
|
*/
|
|
8
|
-
declare function Ripple({ ripples }: RippleProps):
|
|
9
|
+
declare function Ripple({ ripples }: RippleProps): React.JSX.Element;
|
|
9
10
|
export default Ripple;
|
|
10
11
|
//# sourceMappingURL=Ripple.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Ripple.d.ts","sourceRoot":"","sources":["../../../../components/v2/ButtonBase/Ripple.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Ripple.d.ts","sourceRoot":"","sources":["../../../../components/v2/ButtonBase/Ripple.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA+C,MAAM,OAAO,CAAC;AAIpE,OAAO,KAAK,EAAE,UAAU,IAAI,WAAW,EAAE,MAAM,SAAS,CAAC;AAqDzD,UAAU,WAAW;IACnB,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB;AAED;;GAEG;AACH,iBAAS,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,WAAW,qBAiBvC;AAwDD,eAAe,MAAM,CAAC"}
|
|
@@ -2,14 +2,14 @@ import React, { useMemo } from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { makeStyles } from '@shopgate/engage/styles';
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
|
-
const useStyles = makeStyles()({
|
|
5
|
+
const useStyles = makeStyles()(theme => ({
|
|
6
6
|
container: {
|
|
7
7
|
position: 'fixed',
|
|
8
8
|
bottom: 0,
|
|
9
9
|
display: 'flex',
|
|
10
10
|
justifyContent: 'center',
|
|
11
11
|
alignItems: 'center',
|
|
12
|
-
height:
|
|
12
|
+
height: theme.layout.safeArea.bottom,
|
|
13
13
|
width: '100%',
|
|
14
14
|
zIndex: 10000000,
|
|
15
15
|
pointerEvents: 'auto',
|
|
@@ -26,7 +26,7 @@ const useStyles = makeStyles()({
|
|
|
26
26
|
border: '1px solid rgba(255, 255, 255, 0.5)',
|
|
27
27
|
boxSizing: 'content-box'
|
|
28
28
|
}
|
|
29
|
-
});
|
|
29
|
+
}));
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* Renders a simulated iOS bottom inset in development.
|
|
@@ -11,7 +11,7 @@ const useStyles = makeStyles()(theme => ({
|
|
|
11
11
|
display: 'flex',
|
|
12
12
|
justifyContent: 'space-between',
|
|
13
13
|
alignItems: 'center',
|
|
14
|
-
height:
|
|
14
|
+
height: theme.layout.safeArea.top,
|
|
15
15
|
width: '100%',
|
|
16
16
|
zIndex: 10000000,
|
|
17
17
|
pointerEvents: 'auto',
|
|
@@ -38,7 +38,7 @@ const useStyles = makeStyles()(theme => ({
|
|
|
38
38
|
notch: {
|
|
39
39
|
flex: 1,
|
|
40
40
|
background: 'black',
|
|
41
|
-
height:
|
|
41
|
+
height: `calc(${theme.layout.safeArea.top} - 16px)`,
|
|
42
42
|
maxWidth: 150,
|
|
43
43
|
borderRadius: 16,
|
|
44
44
|
border: '1px solid rgba(255, 255, 255, 0.5)'
|
|
@@ -193,8 +193,11 @@ const FavoriteItem = ({
|
|
|
193
193
|
});
|
|
194
194
|
return false;
|
|
195
195
|
}
|
|
196
|
-
if (hasNewServices() &&
|
|
197
|
-
// Product is not orderable for ROPE
|
|
196
|
+
if (hasNewServices() && isRopeProductOrderable === false) {
|
|
197
|
+
// Product is explicitly not orderable for ROPE (a fulfillment method other than direct ship
|
|
198
|
+
// that isn't available for the current product/location). Users need to correct the
|
|
199
|
+
// selection on the PDP, so redirect. `null` means ROPE doesn't apply (direct ship) and must
|
|
200
|
+
// fall through to the regular add-to-cart below.
|
|
198
201
|
historyPush({
|
|
199
202
|
pathname: productLink
|
|
200
203
|
});
|