@shopgate/engage 7.32.0-beta.10 → 7.32.0-beta.11
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/core/hooks/events/appEvents.d.ts +31 -46
- package/core/hooks/events/appEvents.d.ts.map +1 -0
- package/core/hooks/events/appEvents.js +26 -29
- package/core/hooks/events/index.d.ts +4 -4
- package/core/hooks/events/index.d.ts.map +1 -1
- package/core/hooks/events/useLongPress.d.ts +55 -58
- package/core/hooks/events/useLongPress.d.ts.map +1 -0
- package/core/hooks/events/useLongPress.js +23 -16
- package/core/hooks/events/usePressHandler.d.ts +32 -21
- package/core/hooks/events/usePressHandler.d.ts.map +1 -1
- package/core/hooks/events/usePressHandler.js +12 -10
- package/core/hooks/events/useScrollDirectionChange.d.ts +72 -61
- package/core/hooks/events/useScrollDirectionChange.d.ts.map +1 -0
- package/core/hooks/events/useScrollDirectionChange.js +36 -43
- package/development/action-creators/index.d.ts +3 -0
- package/development/action-creators/index.d.ts.map +1 -0
- package/development/action-creators/settings.d.ts +45 -0
- package/development/action-creators/settings.d.ts.map +1 -0
- package/development/action-creators/settings.js +21 -10
- package/development/action-creators/storage.d.ts +17 -0
- package/development/action-creators/storage.d.ts.map +1 -0
- package/development/action-creators/storage.js +7 -4
- package/development/components/ClientInformation/ClientInformation.d.ts +6 -0
- package/development/components/ClientInformation/ClientInformation.d.ts.map +1 -0
- package/development/components/ClientInformation/ClientInformation.js +7 -4
- package/development/components/ClientInformation/actions.d.ts +6 -0
- package/development/components/ClientInformation/actions.d.ts.map +1 -0
- package/development/components/ClientInformation/actions.js +1 -1
- package/development/components/ClientInformation/index.d.ts +2 -0
- package/development/components/ClientInformation/index.d.ts.map +1 -0
- package/development/components/DevelopmentSettings/DevelopmentSettings.d.ts +16 -0
- package/development/components/DevelopmentSettings/DevelopmentSettings.d.ts.map +1 -0
- package/development/components/DevelopmentSettings/DevelopmentSettings.js +41 -28
- package/development/components/DevelopmentSettings/index.d.ts +2 -0
- package/development/components/DevelopmentSettings/index.d.ts.map +1 -0
- package/development/components/DevelopmentTools/DevelopmentTools.d.ts +10 -0
- package/development/components/DevelopmentTools/DevelopmentTools.d.ts.map +1 -0
- package/development/components/DevelopmentTools/DevelopmentTools.js +8 -8
- package/development/components/DevelopmentTools/Shortcuts.d.ts +6 -0
- package/development/components/DevelopmentTools/Shortcuts.d.ts.map +1 -0
- package/development/components/DevelopmentTools/Shortcuts.js +0 -1
- package/development/components/DevelopmentTools/hooks.d.ts +8 -0
- package/development/components/DevelopmentTools/hooks.d.ts.map +1 -0
- package/development/components/DevelopmentTools/hooks.js +2 -3
- package/development/components/DevelopmentTools/index.d.ts +2 -0
- package/development/components/DevelopmentTools/index.d.ts.map +1 -0
- package/development/components/SimulatedInsets/SimulatedInsetBottom.d.ts +7 -0
- package/development/components/SimulatedInsets/SimulatedInsetBottom.d.ts.map +1 -0
- package/development/components/SimulatedInsets/SimulatedInsetBottom.js +1 -6
- package/development/components/SimulatedInsets/SimulatedInsetTop.d.ts +7 -0
- package/development/components/SimulatedInsets/SimulatedInsetTop.d.ts.map +1 -0
- package/development/components/SimulatedInsets/SimulatedInsetTop.js +2 -7
- package/development/components/SimulatedInsets/SimulatedInsets.d.ts +13 -0
- package/development/components/SimulatedInsets/SimulatedInsets.d.ts.map +1 -0
- package/development/components/SimulatedInsets/SimulatedInsets.js +2 -7
- package/development/components/SimulatedInsets/index.d.ts +2 -0
- package/development/components/SimulatedInsets/index.d.ts.map +1 -0
- package/development/components/SimulatedInsets/types.d.ts +15 -0
- package/development/components/SimulatedInsets/types.d.ts.map +1 -0
- package/development/components/SimulatedInsets/types.js +1 -0
- package/development/components/index.d.ts +3 -0
- package/development/components/index.d.ts.map +1 -0
- package/development/constants/actionTypes.d.ts +6 -0
- package/development/constants/actionTypes.d.ts.map +1 -0
- package/development/constants/actionTypes.js +2 -1
- package/development/constants/index.d.ts +2 -0
- package/development/constants/index.d.ts.map +1 -0
- package/development/reducers/index.d.ts +24 -0
- package/development/reducers/index.d.ts.map +1 -0
- package/development/reducers/settings.d.ts +17 -0
- package/development/reducers/settings.d.ts.map +1 -0
- package/development/reducers/settings.js +48 -35
- package/development/reducers/storage.d.ts +17 -0
- package/development/reducers/storage.d.ts.map +1 -0
- package/development/reducers/storage.js +24 -24
- package/development/selectors/index.d.ts +3 -0
- package/development/selectors/index.d.ts.map +1 -0
- package/development/selectors/settings.d.ts +52 -0
- package/development/selectors/settings.d.ts.map +1 -0
- package/development/selectors/settings.js +21 -11
- package/development/selectors/storage.d.ts +10 -0
- package/development/selectors/storage.d.ts.map +1 -0
- package/development/selectors/storage.js +6 -18
- package/development/streams/index.d.ts +2 -0
- package/development/streams/index.d.ts.map +1 -0
- package/development/streams/insets.d.ts +8 -0
- package/development/streams/insets.d.ts.map +1 -0
- package/development/streams/insets.js +1 -3
- package/development/subscriptions/index.d.ts +15 -0
- package/development/subscriptions/index.d.ts.map +1 -0
- package/development/subscriptions/index.js +6 -2
- package/development/types/development.d.ts +68 -0
- package/development/types/development.d.ts.map +1 -0
- package/development/types/development.js +1 -0
- package/development/types/index.d.ts +2 -0
- package/development/types/index.d.ts.map +1 -0
- package/development/types/index.js +1 -0
- package/package.json +7 -7
- package/page/components/Widgets/Widget.d.ts.map +1 -1
- package/styles/theme/createDefaultThemeOptions/index.d.ts.map +1 -1
- package/styles/theme/createDefaultThemeOptions/index.js +5 -0
- package/styles/theme/providers/ThemeProvider.d.ts.map +1 -1
- package/styles/theme/providers/ThemeProvider.js +11 -4
|
@@ -1,74 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A scroll event as the view scroll stream emits it.
|
|
3
|
+
*/
|
|
1
4
|
export interface ViewScrollEvent {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
5
|
+
/**
|
|
6
|
+
* The original scroll event object.
|
|
7
|
+
*/
|
|
8
|
+
event: UIEvent;
|
|
9
|
+
/**
|
|
10
|
+
* Current vertical scroll position.
|
|
11
|
+
*/
|
|
12
|
+
scrollTop: number;
|
|
13
|
+
/**
|
|
14
|
+
* Previous scrollTop value.
|
|
15
|
+
*/
|
|
16
|
+
previousScrollTop: number;
|
|
17
|
+
/**
|
|
18
|
+
* True if scrolling down.
|
|
19
|
+
*/
|
|
20
|
+
scrollDown: boolean;
|
|
21
|
+
/**
|
|
22
|
+
* True if scrolling up.
|
|
23
|
+
*/
|
|
24
|
+
scrollUp: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Scroll direction: 'up', 'down', or null.
|
|
27
|
+
*/
|
|
28
|
+
direction: 'up' | 'down' | null;
|
|
29
|
+
/**
|
|
30
|
+
* Optional internal/legacy props (not passed to callbacks).
|
|
31
|
+
*/
|
|
32
|
+
[key: string]: unknown;
|
|
22
33
|
}
|
|
23
|
-
|
|
24
34
|
/**
|
|
25
|
-
*
|
|
35
|
+
* A callback that receives a scroll event.
|
|
26
36
|
*/
|
|
27
37
|
export type ScrollCallback = (event: ViewScrollEvent) => void;
|
|
28
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Parameters for the scroll direction change hook.
|
|
40
|
+
*/
|
|
29
41
|
export interface UseScrollDirectionChangeParams {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Whether the hook is active.
|
|
44
|
+
*/
|
|
45
|
+
enabled: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* ScrollTop threshold for down scroll triggers. When set,
|
|
48
|
+
* `onScrollDown` fires only when the scroll position is greater than this.
|
|
49
|
+
* @default 100
|
|
50
|
+
*/
|
|
51
|
+
offset?: number;
|
|
52
|
+
/**
|
|
53
|
+
* If true, callbacks fire only once per direction change.
|
|
54
|
+
* @default true
|
|
55
|
+
*/
|
|
56
|
+
onlyFireOnDirectionChange?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* If true, onScrollUp fires only when scrollTop is below or equal to
|
|
59
|
+
* `onlyFireOnScrollUpAtTopOffset`.
|
|
60
|
+
* @default false
|
|
61
|
+
*/
|
|
62
|
+
onlyFireOnScrollUpAtTop?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* Maximum scrollTop at which `onScrollUp` may fire when
|
|
65
|
+
* `onlyFireOnScrollUpAtTop` is true.
|
|
66
|
+
* @default 0
|
|
67
|
+
*/
|
|
68
|
+
onlyFireOnScrollUpAtTopOffset?: number;
|
|
69
|
+
/**
|
|
70
|
+
* Callback triggered on scroll up.
|
|
71
|
+
*/
|
|
72
|
+
onScrollUp?: ScrollCallback;
|
|
73
|
+
/**
|
|
74
|
+
* Callback triggered on scroll down past offset.
|
|
75
|
+
*/
|
|
76
|
+
onScrollDown?: ScrollCallback;
|
|
65
77
|
}
|
|
66
|
-
|
|
67
78
|
/**
|
|
68
79
|
* A scroll hook that detects scroll direction changes (up/down) and
|
|
69
80
|
* triggers the appropriate callbacks. Commonly used to show/hide
|
|
70
81
|
* UI elements based on scroll behavior.
|
|
71
|
-
*
|
|
72
|
-
* @param {UseScrollDirectionChangeParams} params The hook parameters
|
|
82
|
+
* @param params The hook parameters.
|
|
73
83
|
*/
|
|
74
84
|
export default function useScrollDirectionChange(params: UseScrollDirectionChangeParams): void;
|
|
85
|
+
//# sourceMappingURL=useScrollDirectionChange.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useScrollDirectionChange.d.ts","sourceRoot":"","sources":["../../../../core/hooks/events/useScrollDirectionChange.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,EAAE,OAAO,CAAC;IAEf;;OAEG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAE1B;;OAEG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAElB;;OAEG;IACH,SAAS,EAAE,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;IAEhC;;OAEG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;AAE9D;;GAEG;AACH,MAAM,WAAW,8BAA8B;IAC7C;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IAEjB;;;;OAIG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;OAGG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAEpC;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAElC;;;;OAIG;IACH,6BAA6B,CAAC,EAAE,MAAM,CAAC;IAEvC;;OAEG;IACH,UAAU,CAAC,EAAE,cAAc,CAAC;IAE5B;;OAEG;IACH,YAAY,CAAC,EAAE,cAAc,CAAC;CAC/B;AAOD;;;;;GAKG;AACH,MAAM,CAAC,OAAO,UAAU,wBAAwB,CAAC,MAAM,EAAE,8BAA8B,QA4EtF"}
|
|
@@ -1,38 +1,46 @@
|
|
|
1
|
-
// @ts-check
|
|
2
1
|
import { useEffect, useRef, useCallback } from 'react';
|
|
3
2
|
import { viewScroll$ } from '@shopgate/engage/core/streams';
|
|
4
3
|
|
|
5
|
-
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
/**
|
|
5
|
+
* A scroll event as the view scroll stream emits it.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A callback that receives a scroll event.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Parameters for the scroll direction change hook.
|
|
14
|
+
*/
|
|
15
|
+
|
|
16
|
+
// Strips the internal properties the stream adds before an event reaches a callback.
|
|
17
|
+
const toPublicEvent = ({
|
|
18
|
+
scrollIn: _scrollIn,
|
|
19
|
+
scrollOut: _scrollOut,
|
|
20
|
+
scrolled: _scrolled,
|
|
21
|
+
...publicEvent
|
|
22
|
+
}) => publicEvent;
|
|
9
23
|
|
|
10
24
|
/**
|
|
11
25
|
* A scroll hook that detects scroll direction changes (up/down) and
|
|
12
26
|
* triggers the appropriate callbacks. Commonly used to show/hide
|
|
13
27
|
* UI elements based on scroll behavior.
|
|
14
|
-
*
|
|
15
|
-
* @param {UseScrollDirectionChangeParams} params The hook parameters
|
|
28
|
+
* @param params The hook parameters.
|
|
16
29
|
*/
|
|
17
|
-
export default function useScrollDirectionChange({
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
export default function useScrollDirectionChange(params) {
|
|
31
|
+
const {
|
|
32
|
+
enabled,
|
|
33
|
+
offset = 100,
|
|
34
|
+
onlyFireOnDirectionChange = true,
|
|
35
|
+
onlyFireOnScrollUpAtTop = false,
|
|
36
|
+
onlyFireOnScrollUpAtTopOffset = 0,
|
|
37
|
+
onScrollUp,
|
|
38
|
+
onScrollDown
|
|
39
|
+
} = params;
|
|
26
40
|
const lastDirectionRef = useRef(null);
|
|
27
41
|
const downTriggeredRef = useRef(false);
|
|
28
42
|
const upTriggeredRef = useRef(false);
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Scroll event handler.
|
|
32
|
-
* Uses `event.direction` and triggers callbacks accordingly.
|
|
33
|
-
*/
|
|
34
|
-
const handleScroll = useCallback(/** @param {ViewScrollEvent} event The event */
|
|
35
|
-
event => {
|
|
43
|
+
const handleScroll = useCallback(event => {
|
|
36
44
|
if (!enabled || !event.scrolled || !event.direction) return;
|
|
37
45
|
const {
|
|
38
46
|
scrollTop,
|
|
@@ -43,45 +51,30 @@ export default function useScrollDirectionChange({
|
|
|
43
51
|
|
|
44
52
|
// Store current direction and reset flags if direction changed
|
|
45
53
|
if (directionChanged) {
|
|
46
|
-
// @ts-expect-error
|
|
47
54
|
lastDirectionRef.current = direction;
|
|
48
55
|
if (direction === 'down') downTriggeredRef.current = false;
|
|
49
56
|
if (direction === 'up') upTriggeredRef.current = false;
|
|
50
57
|
}
|
|
51
58
|
|
|
52
|
-
//
|
|
59
|
+
// Handle downward scroll
|
|
53
60
|
if (direction === 'down') {
|
|
54
61
|
const shouldFire = (!onlyFireOnDirectionChange || directionChanged || !downTriggeredRef.current) && scrollTop >= offset;
|
|
55
62
|
if (shouldFire && typeof onScrollDown === 'function') {
|
|
56
63
|
downTriggeredRef.current = true;
|
|
57
|
-
|
|
58
|
-
// Strip internal/legacy properties
|
|
59
|
-
const {
|
|
60
|
-
scrollIn,
|
|
61
|
-
scrollOut,
|
|
62
|
-
scrolled,
|
|
63
|
-
...publicEvent
|
|
64
|
-
} = event;
|
|
65
|
-
onScrollDown(publicEvent);
|
|
64
|
+
onScrollDown(toPublicEvent(event));
|
|
66
65
|
}
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
//
|
|
68
|
+
// Handle upward scroll
|
|
70
69
|
if (direction === 'up') {
|
|
71
|
-
// if user wants
|
|
70
|
+
// if user wants "only fire at the very top" and we are not at 0, skip
|
|
72
71
|
if (onlyFireOnScrollUpAtTop && scrollTop > onlyFireOnScrollUpAtTopOffset) {
|
|
73
72
|
return;
|
|
74
73
|
}
|
|
75
74
|
const shouldFire = !onlyFireOnDirectionChange || directionChanged || !upTriggeredRef.current;
|
|
76
75
|
if (shouldFire && typeof onScrollUp === 'function') {
|
|
77
76
|
upTriggeredRef.current = true;
|
|
78
|
-
|
|
79
|
-
scrollIn,
|
|
80
|
-
scrollOut,
|
|
81
|
-
scrolled,
|
|
82
|
-
...publicEvent
|
|
83
|
-
} = event;
|
|
84
|
-
onScrollUp(publicEvent);
|
|
77
|
+
onScrollUp(toPublicEvent(event));
|
|
85
78
|
}
|
|
86
79
|
}
|
|
87
80
|
}, [enabled, onlyFireOnDirectionChange, offset, onScrollDown, onlyFireOnScrollUpAtTop, onlyFireOnScrollUpAtTopOffset, onScrollUp]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../development/action-creators/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toggles the simulation of iOS safe area insets.
|
|
3
|
+
* @param visible Whether the insets should be visible or not.
|
|
4
|
+
* @returns The action object.
|
|
5
|
+
*/
|
|
6
|
+
export declare const toggleInsets: (visible?: boolean) => {
|
|
7
|
+
readonly type: "DEVELOPMENT_TOOLS_TOGGLE_INSETS";
|
|
8
|
+
readonly visible: boolean;
|
|
9
|
+
};
|
|
10
|
+
export type ToggleInsetsAction = ReturnType<typeof toggleInsets>;
|
|
11
|
+
/**
|
|
12
|
+
* Toggles the highlighting of the simulated iOS safe area insets.
|
|
13
|
+
* @param visible Whether the insets should be visible or not.
|
|
14
|
+
* @returns The action object.
|
|
15
|
+
*/
|
|
16
|
+
export declare const toggleInsetHighlight: (visible?: boolean) => {
|
|
17
|
+
readonly type: "DEVELOPMENT_TOOLS_TOGGLE_INSET_HIGHLIGHT";
|
|
18
|
+
readonly visible: boolean;
|
|
19
|
+
};
|
|
20
|
+
export type ToggleInsetHighlightAction = ReturnType<typeof toggleInsetHighlight>;
|
|
21
|
+
/**
|
|
22
|
+
* Toggles the CMS 2.0 preview mode.
|
|
23
|
+
* @param enabled Whether the CMS 2.0 preview should be enabled or not.
|
|
24
|
+
* @returns The action object.
|
|
25
|
+
*/
|
|
26
|
+
export declare const toggleCms2Preview: (enabled?: boolean) => {
|
|
27
|
+
readonly type: "DEVELOPMENT_TOOLS_TOGGLE_CMS2_PREVIEW";
|
|
28
|
+
readonly enabled: boolean;
|
|
29
|
+
};
|
|
30
|
+
export type ToggleCms2PreviewAction = ReturnType<typeof toggleCms2Preview>;
|
|
31
|
+
/**
|
|
32
|
+
* Toggles whether a color scheme can be selected without the app settings allowing it.
|
|
33
|
+
* @param enabled Whether the selection should be enabled or not.
|
|
34
|
+
* @returns The action object.
|
|
35
|
+
*/
|
|
36
|
+
export declare const toggleColorSchemeSelection: (enabled?: boolean) => {
|
|
37
|
+
readonly type: "DEVELOPMENT_TOOLS_TOGGLE_COLOR_SCHEME_SELECTION";
|
|
38
|
+
readonly enabled: boolean;
|
|
39
|
+
};
|
|
40
|
+
export type ToggleColorSchemeSelectionAction = ReturnType<typeof toggleColorSchemeSelection>;
|
|
41
|
+
/**
|
|
42
|
+
* Every action the development settings reducer handles.
|
|
43
|
+
*/
|
|
44
|
+
export type DevelopmentSettingsAction = ToggleInsetsAction | ToggleInsetHighlightAction | ToggleCms2PreviewAction | ToggleColorSchemeSelectionAction;
|
|
45
|
+
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../../development/action-creators/settings.ts"],"names":[],"mappings":"AAOA;;;;GAIG;AACH,eAAO,MAAM,YAAY,GAAI,iBAAc;;;CAGhC,CAAC;AAEZ,MAAM,MAAM,kBAAkB,GAAG,UAAU,CAAC,OAAO,YAAY,CAAC,CAAC;AAEjE;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,GAAI,iBAAc;;;CAGxC,CAAC;AAEZ,MAAM,MAAM,0BAA0B,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAEjF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,iBAAc;;;CAGrC,CAAC;AAEZ,MAAM,MAAM,uBAAuB,GAAG,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAE3E;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,GAAI,iBAAc;;;CAG9C,CAAC;AAEZ,MAAM,MAAM,gCAAgC,GAAG,UAAU,CAAC,OAAO,0BAA0B,CAAC,CAAC;AAE7F;;GAEG;AACH,MAAM,MAAM,yBAAyB,GACjC,kBAAkB,GAClB,0BAA0B,GAC1B,uBAAuB,GACvB,gCAAgC,CAAC"}
|
|
@@ -1,31 +1,42 @@
|
|
|
1
|
-
import { DEVELOPMENT_TOOLS_TOGGLE_INSETS, DEVELOPMENT_TOOLS_TOGGLE_INSET_HIGHLIGHT, DEVELOPMENT_TOOLS_TOGGLE_CMS2_PREVIEW } from "../constants";
|
|
1
|
+
import { DEVELOPMENT_TOOLS_TOGGLE_INSETS, DEVELOPMENT_TOOLS_TOGGLE_INSET_HIGHLIGHT, DEVELOPMENT_TOOLS_TOGGLE_CMS2_PREVIEW, DEVELOPMENT_TOOLS_TOGGLE_COLOR_SCHEME_SELECTION } from "../constants";
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Toggles the simulation of iOS safe area insets.
|
|
5
|
-
* @param
|
|
6
|
-
* @returns
|
|
5
|
+
* @param visible Whether the insets should be visible or not.
|
|
6
|
+
* @returns The action object.
|
|
7
7
|
*/
|
|
8
8
|
export const toggleInsets = (visible = true) => ({
|
|
9
9
|
type: DEVELOPMENT_TOOLS_TOGGLE_INSETS,
|
|
10
10
|
visible
|
|
11
11
|
});
|
|
12
|
-
|
|
13
12
|
/**
|
|
14
13
|
* Toggles the highlighting of the simulated iOS safe area insets.
|
|
15
|
-
* @param
|
|
16
|
-
* @returns
|
|
14
|
+
* @param visible Whether the insets should be visible or not.
|
|
15
|
+
* @returns The action object.
|
|
17
16
|
*/
|
|
18
17
|
export const toggleInsetHighlight = (visible = true) => ({
|
|
19
18
|
type: DEVELOPMENT_TOOLS_TOGGLE_INSET_HIGHLIGHT,
|
|
20
19
|
visible
|
|
21
20
|
});
|
|
22
|
-
|
|
23
21
|
/**
|
|
24
22
|
* Toggles the CMS 2.0 preview mode.
|
|
25
|
-
* @param
|
|
26
|
-
* @returns
|
|
23
|
+
* @param enabled Whether the CMS 2.0 preview should be enabled or not.
|
|
24
|
+
* @returns The action object.
|
|
27
25
|
*/
|
|
28
26
|
export const toggleCms2Preview = (enabled = true) => ({
|
|
29
27
|
type: DEVELOPMENT_TOOLS_TOGGLE_CMS2_PREVIEW,
|
|
30
28
|
enabled
|
|
31
|
-
});
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Toggles whether a color scheme can be selected without the app settings allowing it.
|
|
32
|
+
* @param enabled Whether the selection should be enabled or not.
|
|
33
|
+
* @returns The action object.
|
|
34
|
+
*/
|
|
35
|
+
export const toggleColorSchemeSelection = (enabled = true) => ({
|
|
36
|
+
type: DEVELOPMENT_TOOLS_TOGGLE_COLOR_SCHEME_SELECTION,
|
|
37
|
+
enabled
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* Every action the development settings reducer handles.
|
|
42
|
+
*/
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { StatusBarStyle } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Updates the status bar style storage where latest payload from the updateNavigationBarStyle
|
|
4
|
+
* app event is stored.
|
|
5
|
+
* @param style The event payload.
|
|
6
|
+
* @returns The action object.
|
|
7
|
+
*/
|
|
8
|
+
export declare const updateStatusBarStyleStorage: (style?: StatusBarStyle) => {
|
|
9
|
+
readonly type: "DEVELOPMENT_TOOLS_UPDATE_STATUS_BAR_STYLE_STORAGE";
|
|
10
|
+
readonly style: StatusBarStyle;
|
|
11
|
+
};
|
|
12
|
+
export type UpdateStatusBarStyleStorageAction = ReturnType<typeof updateStatusBarStyleStorage>;
|
|
13
|
+
/**
|
|
14
|
+
* Every action the development storage reducer handles.
|
|
15
|
+
*/
|
|
16
|
+
export type DevelopmentStorageAction = UpdateStatusBarStyleStorageAction;
|
|
17
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../../development/action-creators/storage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C;;;;;GAKG;AACH,eAAO,MAAM,2BAA2B,GAAI,QAAO,cAAmB;;;CAG3D,CAAC;AAEZ,MAAM,MAAM,iCAAiC,GAAG,UAAU,CAAC,OAAO,2BAA2B,CAAC,CAAC;AAE/F;;GAEG;AACH,MAAM,MAAM,wBAAwB,GAAG,iCAAiC,CAAC"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { DEVELOPMENT_TOOLS_UPDATE_STATUS_BAR_STYLE_STORAGE } from "../constants";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
* Updates the status bar style storage where latest payload from the updateNavigationBarStyle
|
|
5
4
|
* app event is stored.
|
|
6
|
-
* @param
|
|
7
|
-
* @returns
|
|
5
|
+
* @param style The event payload.
|
|
6
|
+
* @returns The action object.
|
|
8
7
|
*/
|
|
9
8
|
export const updateStatusBarStyleStorage = (style = {}) => ({
|
|
10
9
|
type: DEVELOPMENT_TOOLS_UPDATE_STATUS_BAR_STYLE_STORAGE,
|
|
11
10
|
style
|
|
12
|
-
});
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Every action the development storage reducer handles.
|
|
15
|
+
*/
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ClientInformation.d.ts","sourceRoot":"","sources":["../../../../development/components/ClientInformation/ClientInformation.tsx"],"names":[],"mappings":"AAsCA;;GAEG;AACH,QAAA,MAAM,iBAAiB,0CAoDtB,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useState } from 'react';
|
|
2
2
|
import { useSelector } from 'react-redux';
|
|
3
3
|
import { makeStyles } from '@shopgate/engage/styles';
|
|
4
4
|
import { Typography } from '@shopgate/engage/components';
|
|
@@ -27,8 +27,11 @@ const useStyles = makeStyles()(theme => ({
|
|
|
27
27
|
}));
|
|
28
28
|
|
|
29
29
|
/**
|
|
30
|
-
*
|
|
31
|
-
|
|
30
|
+
* The client information the app reports about itself.
|
|
31
|
+
*/
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* Renders the client information, and reveals the development settings on a long press.
|
|
32
35
|
*/
|
|
33
36
|
const ClientInformation = () => {
|
|
34
37
|
const {
|
|
@@ -38,7 +41,7 @@ const ClientInformation = () => {
|
|
|
38
41
|
const [deviceIdVisible, setDeviceIdVisible] = useState(false);
|
|
39
42
|
const [developmentSettingsVisible, setDevelopmentSettingsVisible] = useState(false);
|
|
40
43
|
|
|
41
|
-
// Press handler to show the device ID
|
|
44
|
+
// Press handler to show the device ID.
|
|
42
45
|
const longPressAttrs = useLongPress(() => {
|
|
43
46
|
if (!deviceIdVisible) {
|
|
44
47
|
setDeviceIdVisible(true);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"actions.d.ts","sourceRoot":"","sources":["../../../../development/components/ClientInformation/actions.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,kBAAkB,kBAG9B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../development/components/ClientInformation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface DevelopmentSettingsProps {
|
|
2
|
+
/**
|
|
3
|
+
* Whether the drawer is open.
|
|
4
|
+
*/
|
|
5
|
+
isOpen: boolean;
|
|
6
|
+
/**
|
|
7
|
+
* The function to call when the drawer should be closed.
|
|
8
|
+
*/
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Development settings component.
|
|
13
|
+
*/
|
|
14
|
+
declare const DevelopmentSettings: ({ isOpen, onClose, }: DevelopmentSettingsProps) => import("react").JSX.Element | null;
|
|
15
|
+
export default DevelopmentSettings;
|
|
16
|
+
//# sourceMappingURL=DevelopmentSettings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DevelopmentSettings.d.ts","sourceRoot":"","sources":["../../../../development/components/DevelopmentSettings/DevelopmentSettings.tsx"],"names":[],"mappings":"AAuBA,MAAM,WAAW,wBAAwB;IACvC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;GAEG;AACH,QAAA,MAAM,mBAAmB,GAAI,sBAG1B,wBAAwB,uCA2D1B,CAAC;AAEF,eAAe,mBAAmB,CAAC"}
|
|
@@ -1,31 +1,26 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
1
|
import { useSelector, useDispatch } from 'react-redux';
|
|
4
2
|
import { SheetDrawer } from '@shopgate/engage/components';
|
|
5
3
|
import { Button } from '@shopgate/engage/components/v2';
|
|
6
4
|
import { makeStyles } from '@shopgate/engage/styles';
|
|
7
5
|
import { getEnabledCMSVersion } from '@shopgate/engage/settings/selectors/merchantSettings';
|
|
8
6
|
import { getEnableCms2ForAllShoppers } from '@shopgate/engage/settings/selectors/shopSettings';
|
|
9
|
-
import { getIsCMS2PreviewEnabled } from "../../selectors";
|
|
10
|
-
import { toggleCms2Preview } from "../../action-creators";
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { getIsCMS2PreviewEnabled, getIsColorSchemeSelectionEnabled, getIsDev } from "../../selectors";
|
|
8
|
+
import { toggleCms2Preview, toggleColorSchemeSelection } from "../../action-creators";
|
|
9
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
10
|
const useStyles = makeStyles()(theme => ({
|
|
13
11
|
container: {
|
|
14
12
|
padding: theme.spacing(2, 2, 4),
|
|
15
13
|
display: 'flex',
|
|
16
|
-
|
|
14
|
+
flexDirection: 'column',
|
|
15
|
+
alignItems: 'center',
|
|
16
|
+
gap: theme.spacing(2)
|
|
17
17
|
},
|
|
18
18
|
button: {
|
|
19
19
|
fontWeight: theme.typography.fontWeightRegular
|
|
20
20
|
}
|
|
21
21
|
}));
|
|
22
|
-
|
|
23
22
|
/**
|
|
24
23
|
* Development settings component.
|
|
25
|
-
* @param {Object} props The component props.
|
|
26
|
-
* @param {boolean} props.isOpen Whether the drawer is open.
|
|
27
|
-
* @param {Function} props.onClose The function to call when the drawer should be closed.
|
|
28
|
-
* @returns {JSX.Element}
|
|
29
24
|
*/
|
|
30
25
|
const DevelopmentSettings = ({
|
|
31
26
|
isOpen,
|
|
@@ -38,29 +33,47 @@ const DevelopmentSettings = ({
|
|
|
38
33
|
const enabledCMSVersion = useSelector(getEnabledCMSVersion);
|
|
39
34
|
const enableCms2ForAllShoppers = useSelector(getEnableCms2ForAllShoppers);
|
|
40
35
|
const isCMS2PreviewEnabled = useSelector(getIsCMS2PreviewEnabled);
|
|
36
|
+
const isDev = useSelector(getIsDev);
|
|
37
|
+
const isColorSchemeSelectionEnabled = useSelector(getIsColorSchemeSelectionEnabled);
|
|
41
38
|
|
|
42
39
|
// No need to show the preview toggle if CMS 2.0 is not available for the merchant or if it's
|
|
43
40
|
// already enabled for all shoppers.
|
|
44
|
-
|
|
41
|
+
const showCms2PreviewToggle = !enableCms2ForAllShoppers && enabledCMSVersion !== 'v1';
|
|
42
|
+
if (!showCms2PreviewToggle && !isDev) {
|
|
45
43
|
return null;
|
|
46
44
|
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Closes the drawer before dispatching, so the action does not re-render behind the closing
|
|
48
|
+
* animation.
|
|
49
|
+
* @param action The action to dispatch.
|
|
50
|
+
*/
|
|
51
|
+
const closeAndDispatch = action => {
|
|
52
|
+
onClose();
|
|
53
|
+
setTimeout(() => {
|
|
54
|
+
dispatch(action);
|
|
55
|
+
}, 300);
|
|
56
|
+
};
|
|
57
|
+
return (
|
|
58
|
+
/*#__PURE__*/
|
|
59
|
+
// @ts-expect-error - SheetDrawer is not typed yet
|
|
60
|
+
_jsx(SheetDrawer, {
|
|
61
|
+
title: " ",
|
|
62
|
+
isOpen: isOpen,
|
|
63
|
+
onClose: onClose,
|
|
64
|
+
children: /*#__PURE__*/_jsxs("div", {
|
|
65
|
+
className: classes.container,
|
|
66
|
+
children: [showCms2PreviewToggle && /*#__PURE__*/_jsx(Button, {
|
|
67
|
+
className: classes.button,
|
|
68
|
+
onClick: () => closeAndDispatch(toggleCms2Preview(!isCMS2PreviewEnabled)),
|
|
69
|
+
children: `${isCMS2PreviewEnabled ? 'Disable' : 'Enable'} CMS 2.0 Preview`
|
|
70
|
+
}), isDev && /*#__PURE__*/_jsx(Button, {
|
|
71
|
+
className: classes.button,
|
|
72
|
+
onClick: () => closeAndDispatch(toggleColorSchemeSelection(!isColorSchemeSelectionEnabled)),
|
|
73
|
+
children: `${isColorSchemeSelectionEnabled ? 'Disable' : 'Enable'} Color Scheme Selection`
|
|
74
|
+
})]
|
|
62
75
|
})
|
|
63
76
|
})
|
|
64
|
-
|
|
77
|
+
);
|
|
65
78
|
};
|
|
66
79
|
export default DevelopmentSettings;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../development/components/DevelopmentSettings/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export interface DevelopmentToolsProps {
|
|
3
|
+
/**
|
|
4
|
+
* The child components.
|
|
5
|
+
*/
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
declare const _default: import("react").MemoExoticComponent<({ children }: DevelopmentToolsProps) => import("react").JSX.Element>;
|
|
9
|
+
export default _default;
|
|
10
|
+
//# sourceMappingURL=DevelopmentTools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DevelopmentTools.d.ts","sourceRoot":"","sources":["../../../../development/components/DevelopmentTools/DevelopmentTools.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAKvC,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;2EAKuC,qBAAqB;AAkB7D,wBAAsC"}
|