@shopgate/engage 7.28.0-beta.6 → 7.29.0-alpha.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/category/components/CategoryImage/index.js +1 -1
- package/category/components/CategoryList/index.js +7 -3
- package/category/components/CategoryList/style.js +1 -1
- package/components/ResponsiveContainer/breakpoints.js +2 -2
- package/components/SheetList/components/Item/index.js +7 -7
- package/components/Typography/Typography.d.ts +132 -0
- package/components/Typography/Typography.js +11 -0
- package/components/Typography/index.js +1 -0
- package/components/View/components/Content/style.js +1 -1
- package/components/View/context.js +1 -1
- package/components/index.js +1 -1
- package/core/constants/index.js +7 -1
- package/core/contexts/ThemeResourcesContext.d.ts +10 -1
- package/core/contexts/ThemeResourcesContext.js +1 -1
- package/core/helpers/scrollContainer.js +2 -2
- package/core/hocs/withThemeResources.js +4 -1
- package/core/hooks/events/index.js +1 -1
- package/core/hooks/events/usePressHandler.js +38 -0
- package/core/hooks/useThemeResources.js +6 -5
- package/core/providers/ThemeResourcesProvider.js +9 -5
- package/locations/subscriptions.js +2 -2
- package/package.json +9 -7
- package/page/action-creators/index.js +22 -0
- package/page/components/Widgets/Overlay.js +51 -0
- package/page/components/Widgets/Tooltip.js +22 -0
- package/page/components/Widgets/Widget.js +17 -0
- package/page/components/Widgets/WidgetContext.d.ts +42 -0
- package/page/components/Widgets/WidgetContext.js +9 -0
- package/page/components/Widgets/WidgetProvider.js +8 -0
- package/page/components/Widgets/Widgets.js +11 -0
- package/page/components/Widgets/WidgetsPreviewContext.js +9 -0
- package/page/components/Widgets/WidgetsPreviewProvider.js +8 -0
- package/page/components/Widgets/constants.js +4 -0
- package/page/components/Widgets/events.js +23 -0
- package/page/components/Widgets/helpers.js +23 -0
- package/page/components/Widgets/hooks.js +69 -0
- package/page/components/Widgets/index.js +1 -0
- package/page/components/Widgets/types.d.ts +132 -0
- package/page/components/index.js +1 -1
- package/page/constants/actionTypes.js +1 -0
- package/page/constants/index.js +5 -1
- package/page/helpers/index.d.ts +47 -0
- package/page/helpers/index.js +12 -0
- package/page/hooks/index.d.ts +60 -0
- package/page/hooks/index.js +25 -0
- package/page/index.js +1 -2
- package/page/reducers/index.js +15 -0
- package/page/selectors/index.js +48 -2
- package/page/subscriptions/index.js +4 -0
- package/page/widgets/CategoryList/CategoryList.js +4 -0
- package/page/widgets/CategoryList/hooks.js +14 -0
- package/page/widgets/CategoryList/index.js +1 -0
- package/page/widgets/CategoryList/selectors.js +8 -0
- package/page/widgets/HTML/HTML.js +5 -0
- package/page/widgets/HTML/hooks.js +12 -0
- package/page/widgets/HTML/index.js +1 -0
- package/page/widgets/Headline/Headline.js +5 -0
- package/page/widgets/Headline/hooks.js +8 -0
- package/page/widgets/Headline/index.js +1 -0
- package/page/widgets/Placeholder/Placeholder.js +5 -0
- package/page/widgets/Placeholder/hooks.js +12 -0
- package/page/widgets/Placeholder/index.js +1 -0
- package/page/widgets/ProductList/ProductList.js +5 -0
- package/page/widgets/ProductList/hooks.js +19 -0
- package/page/widgets/ProductList/index.js +1 -0
- package/page/widgets/ProductSlider/ProductSlider.js +5 -0
- package/page/widgets/ProductSlider/hooks.js +22 -0
- package/page/widgets/ProductSlider/index.js +1 -0
- package/page/widgets/index.js +1 -0
- package/page/widgets/widgets.json +20 -0
- package/product/components/ProductCard/index.js +1 -1
- package/product/components/ProductGrid/components/Item/components/ItemDetails/index.js +8 -0
- package/product/components/ProductGrid/components/Item/components/ItemDetails/spec.js +1 -0
- package/product/components/ProductGrid/components/Item/components/ItemDiscount/index.js +5 -0
- package/product/components/ProductGrid/components/Item/components/ItemFavoritesButton/index.js +5 -0
- package/product/components/ProductGrid/components/Item/components/ItemFavoritesButton/spec.js +1 -0
- package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +5 -0
- package/product/components/ProductGrid/components/Item/components/ItemImage/spec.js +1 -0
- package/product/components/ProductGrid/components/Item/components/ItemName/index.js +5 -0
- package/product/components/ProductGrid/components/Item/components/ItemName/spec.js +1 -0
- package/product/components/ProductGrid/components/Item/components/ItemPrice/index.js +5 -0
- package/product/components/ProductGrid/components/Item/components/ItemPrice/spec.js +1 -0
- package/product/components/ProductGrid/components/Item/index.js +7 -0
- package/product/components/ProductGrid/components/Iterator/index.js +5 -0
- package/product/components/ProductGrid/components/Layout/index.js +5 -0
- package/product/components/ProductGrid/index.js +22 -0
- package/product/components/ProductGrid/spec.js +1 -0
- package/product/components/ProductGridPrice/index.js +1 -1
- package/product/components/ProductSlider/index.js +4 -4
- package/product/components/index.js +1 -1
- package/styles/helpers/color.js +23 -0
- package/styles/helpers/index.js +1 -1
- package/styles/helpers/setPageBackgroundColor.js +2 -2
- package/styles/index.d.ts +17 -0
- package/styles/index.js +1 -1
- package/styles/theme/createTheme/createBreakpoints.d.ts +114 -0
- package/styles/theme/createTheme/createBreakpoints.js +41 -0
- package/styles/theme/createTheme/createPalette.d.ts +36 -0
- package/styles/theme/createTheme/createPalette.js +4 -0
- package/styles/theme/createTheme/createSpacing.d.ts +23 -0
- package/styles/theme/createTheme/createSpacing.js +14 -0
- package/styles/theme/createTheme/createTypography.d.ts +55 -0
- package/styles/theme/createTheme/createTypography.js +23 -0
- package/styles/theme/createTheme/index.d.ts +41 -0
- package/styles/theme/createTheme/index.js +5 -0
- package/styles/theme/createTheme/transitions.d.ts +100 -0
- package/styles/theme/createTheme/transitions.js +26 -0
- package/styles/theme/createTheme/zIndex.d.ts +12 -0
- package/styles/theme/createTheme/zIndex.js +3 -0
- package/styles/theme/hooks/index.d.ts +4 -0
- package/styles/theme/hooks/index.js +1 -0
- package/styles/theme/hooks/useActiveBreakpoint.d.ts +18 -0
- package/styles/theme/hooks/useActiveBreakpoint.js +4 -0
- package/styles/theme/hooks/useMediaQuery.d.ts +33 -0
- package/styles/theme/hooks/useMediaQuery.js +20 -0
- package/styles/theme/hooks/useResponsiveValue.d.ts +27 -0
- package/styles/theme/hooks/useResponsiveValue.js +4 -0
- package/styles/theme/hooks/useTheme.d.ts +8 -0
- package/styles/theme/hooks/useTheme.js +4 -0
- package/styles/theme/index.d.ts +8 -0
- package/styles/theme/index.js +1 -0
- package/styles/theme/providers/ActiveBreakpointProvider.d.ts +21 -0
- package/styles/theme/providers/ActiveBreakpointProvider.js +13 -0
- package/styles/theme/providers/ThemeProvider.d.ts +18 -0
- package/styles/theme/providers/ThemeProvider.js +7 -0
- package/styles/tss/index.js +3 -0
- package/tracking/selectors/cookieConsent.js +2 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as useActiveBreakpoint}from"./useActiveBreakpoint";export{default as useMediaQuery}from"./useMediaQuery";export{default as useResponsiveValue}from"./useResponsiveValue";export{default as useTheme}from"./useTheme";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Breakpoint } from '..';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns the active breakpoint for the current window size.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```js
|
|
8
|
+
* import React from 'react';
|
|
9
|
+
* import { useActiveBreakpoint } from '@shopgate/engage/styles';
|
|
10
|
+
*
|
|
11
|
+
* export default function MyComponent() {
|
|
12
|
+
* const activeBreakpoint = useActiveBreakpoint();
|
|
13
|
+
*
|
|
14
|
+
* return (<span>{`active breakpoint: ${activeBreakpoint}`}</span>)
|
|
15
|
+
* }
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export default function useActiveBreakpoint(): Breakpoint;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{useContext}from'react';import{ActiveBreakpointContext}from"../providers/ActiveBreakpointProvider";// eslint-disable-next-line valid-jsdoc
|
|
2
|
+
/**
|
|
3
|
+
* Returns the active breakpoint for the current window size.
|
|
4
|
+
*/var useActiveBreakpoint=function useActiveBreakpoint(){return useContext(ActiveBreakpointContext);};export default useActiveBreakpoint;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Theme } from '..';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Creates a media query hook that can be used to check if a media query matches the current
|
|
5
|
+
* viewport.
|
|
6
|
+
* @param {string|ThemeFn} queryInput The media query string or a function that receives the theme
|
|
7
|
+
* and returns a media query string.
|
|
8
|
+
* @returns {boolean} Returns true if the media query matches, false otherwise.
|
|
9
|
+
*
|
|
10
|
+
* @example Use the useTheme hook to get access to the breakpoint helper functions:
|
|
11
|
+
* ```js
|
|
12
|
+
* import React from 'react';
|
|
13
|
+
* import { useTheme, useMediaQuery } from '@shopgate/engage/styles';
|
|
14
|
+
*
|
|
15
|
+
* export default function MyComponent() {
|
|
16
|
+
* const theme = useTheme();
|
|
17
|
+
* const matches = useMediaQuery(theme.breakpoints.up('sm'));
|
|
18
|
+
*
|
|
19
|
+
* return (<span>{`theme.breakpoints.up('sm') matches: ${matches}`}</span>)
|
|
20
|
+
* }
|
|
21
|
+
*```
|
|
22
|
+
* @example Alternatively, you can use a callback function, accepting the theme as a first argument:
|
|
23
|
+
* ```js
|
|
24
|
+
* import React from 'react';
|
|
25
|
+
* import { useMediaQuery } from '@shopgate/engage/styles';
|
|
26
|
+
*
|
|
27
|
+
* export default function MyComponent() {
|
|
28
|
+
* const matches = useMediaQuery((theme) => theme.breakpoints.up('sm'));
|
|
29
|
+
*
|
|
30
|
+
* return (<span>{`theme.breakpoints.up('sm') matches: ${matches}`}</span>)
|
|
31
|
+
* }
|
|
32
|
+
*/
|
|
33
|
+
export default function useMediaQuery(queryInput: string | ((theme: Theme) => string)): boolean;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import{useState,useEffect}from'react';import useTheme from"./useTheme";/**
|
|
2
|
+
* React hook to check if a media query matches the current viewport.
|
|
3
|
+
* Doesn't accept media query strings that start with '@media'.
|
|
4
|
+
* @param {string} query A media query string, e.g. '(min-width: 600px)'
|
|
5
|
+
* @returns {boolean} Returns true if the media query matches, false otherwise.
|
|
6
|
+
*/var useMediaQueryInternal=function useMediaQueryInternal(query){var _useState=useState(function(){return window.matchMedia(query).matches;}),_useState2=_slicedToArray(_useState,2),match=_useState2[0],setMatch=_useState2[1];useEffect(function(){var queryList=window.matchMedia(query);/**
|
|
7
|
+
* Update the match state when the media query changes.
|
|
8
|
+
*/var updateMatch=function updateMatch(){setMatch(queryList.matches);};queryList.addEventListener('change',updateMatch);return function(){queryList.removeEventListener('change',updateMatch);};},[query]);return match;};/**
|
|
9
|
+
* @typedef {import('./useTheme').Theme} Theme
|
|
10
|
+
*/ /**
|
|
11
|
+
* @callback ThemeFn
|
|
12
|
+
* @param {Theme} theme The current theme object.
|
|
13
|
+
*/ /**
|
|
14
|
+
* Creates a media query hook that can be used to check if a media query matches the current
|
|
15
|
+
* viewport.
|
|
16
|
+
* @param {string|ThemeFn} queryInput The media query string or a function that receives the theme
|
|
17
|
+
* and returns a media query string.
|
|
18
|
+
* @returns {boolean} Returns true if the media query matches, false otherwise.
|
|
19
|
+
*/var useMediaQuery=function useMediaQuery(queryInput){var theme=useTheme();var query=typeof queryInput==='function'?queryInput(theme):queryInput;// Remove the '@media' prefix if it exists, as useMediaQueryInternal expects a plain media query.
|
|
20
|
+
query=query.replace(/^@media( ?)/m,'');var match=useMediaQueryInternal(query);return match;};export default useMediaQuery;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Breakpoint } from '..';
|
|
2
|
+
|
|
3
|
+
type BreakpointValueMap<T> = Partial<Record<Breakpoint, T>>;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Returns the value for the current breakpoint based on the provided responsive values object.
|
|
7
|
+
* It is also responsive to window resizing and returning the appropriate value according to the
|
|
8
|
+
* new window size.
|
|
9
|
+
* @param values The responsive values object
|
|
10
|
+
* @example
|
|
11
|
+
* ```js
|
|
12
|
+
* import React from 'react';
|
|
13
|
+
* import { useResponsiveValue } from '@shopgate/engage/styles';
|
|
14
|
+
*
|
|
15
|
+
* export default function MyComponent() {
|
|
16
|
+
* const flexDir = useResponsiveValue({
|
|
17
|
+
* xs: "column",
|
|
18
|
+
* lg: "row"
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* return (<span style={{ display: 'flex', flexDirection: flexDir }} />)
|
|
22
|
+
* }
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export default function useResponsiveValue<const T extends BreakpointValueMap<any>>(
|
|
26
|
+
values: T
|
|
27
|
+
): T[keyof T];
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import useTheme from"./useTheme";import useActiveBreakpoint from"./useActiveBreakpoint";// eslint-disable-next-line require-jsdoc
|
|
2
|
+
var useResponsiveValue=function useResponsiveValue(values){var theme=useTheme();var active=useActiveBreakpoint();if(!active)return undefined;// Get the keys of the breakpoints in the theme
|
|
3
|
+
var breakpoints=[].concat(theme.breakpoints.keys);var activeIndex=breakpoints.indexOf(active);// Walk from the active breakpoint down to smallest
|
|
4
|
+
for(var i=activeIndex;i>=0;i-=1){var bp=breakpoints[i];if(values[bp]!==undefined){return values[bp];}}return undefined;};export default useResponsiveValue;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export{default as ThemeProvider}from"./providers/ThemeProvider";export{createTheme}from"./createTheme";export{useActiveBreakpoint,useMediaQuery,useResponsiveValue,useTheme}from"./hooks";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ReactNode, JSX, Context } from 'react';
|
|
2
|
+
import { Breakpoint } from '..';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* React Context for current active breakpoint.
|
|
6
|
+
*/
|
|
7
|
+
export const ActiveBreakpointContext: Context<Breakpoint | undefined>;
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Props for the ActiveBreakpointProvider.
|
|
11
|
+
*/
|
|
12
|
+
export interface ActiveBreakpointProviderProps {
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Provides the current active breakpoint to child components.
|
|
18
|
+
*/
|
|
19
|
+
declare function ActiveBreakpointProvider(props: ActiveBreakpointProviderProps): JSX.Element;
|
|
20
|
+
|
|
21
|
+
export default ActiveBreakpointProvider;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React,{createContext,useEffect,useState}from'react';import PropTypes from'prop-types';import{useTheme}from'@shopgate/engage/styles';/**
|
|
2
|
+
* @typedef {import('..').Breakpoint} Breakpoint
|
|
3
|
+
*/ /** @type {import('react').Context<Breakpoint>} */export var ActiveBreakpointContext=createContext(undefined);/**
|
|
4
|
+
* @param {Object} props The component props
|
|
5
|
+
* @param {React.ReactNode} props.children The children to render within the provider
|
|
6
|
+
* @returns {JSX.Element} The ActiveBreakpointProvider component
|
|
7
|
+
*/var ActiveBreakpointProvider=function ActiveBreakpointProvider(_ref){var children=_ref.children;var theme=useTheme();// ['xl', 'lg', ..., 'xs']
|
|
8
|
+
var breakpoints=[].concat(theme.breakpoints.keys).reverse();/**
|
|
9
|
+
* Retrieve the initial breakpoint based on the current window size.
|
|
10
|
+
* @returns {Breakpoint|undefined} The initial breakpoint based on the current window size.
|
|
11
|
+
*/var getInitialBreakpoint=function getInitialBreakpoint(){if(typeof window==='undefined')return undefined;return breakpoints.find(function(bp){return window.matchMedia(theme.breakpoints.up(bp).replace(/^@media( ?)/m,'')).matches;});};/** @type {[Breakpoint, React.Dispatch<React.SetStateAction<Breakpoint>>]} */var _useState=useState(getInitialBreakpoint),_useState2=_slicedToArray(_useState,2),active=_useState2[0],setActive=_useState2[1];useEffect(function(){if(typeof window==='undefined')return undefined;var queries=breakpoints.map(function(bp){return{bp:bp,mql:window.matchMedia(theme.breakpoints.up(bp).replace(/^@media( ?)/m,''))};});/**
|
|
12
|
+
* Updates the active breakpoint based on the current media query matches.
|
|
13
|
+
*/var update=function update(){var matched=queries.find(function(_ref2){var mql=_ref2.mql;return mql.matches;});setActive(matched===null||matched===void 0?void 0:matched.bp);};queries.forEach(function(_ref3){var mql=_ref3.mql;return mql.addEventListener('change',update);});return function(){return queries.forEach(function(_ref4){var mql=_ref4.mql;return mql.removeEventListener('change',update);});};},[breakpoints,theme]);return React.createElement(ActiveBreakpointContext.Provider,{value:active},children);};export default ActiveBreakpointProvider;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Theme } from '..';
|
|
2
|
+
|
|
3
|
+
export const ThemeContext: React.Context<Theme>;
|
|
4
|
+
|
|
5
|
+
export interface ThemeProviderProps<Theme = Theme> {
|
|
6
|
+
children: React.ReactNode;
|
|
7
|
+
/**
|
|
8
|
+
* The theme object to provide to the context.
|
|
9
|
+
*/
|
|
10
|
+
theme: Partial<Theme> | ((outerTheme: Theme) => Theme);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* The ThemeProvider component provides the theme context to its children.
|
|
15
|
+
*/
|
|
16
|
+
export default function ThemeProvider<T = Theme>(
|
|
17
|
+
props: ThemeProviderProps<T>
|
|
18
|
+
): React.ReactElement<ThemeProviderProps<T>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React,{createContext,memo}from'react';import PropTypes from'prop-types';import ActiveBreakpointProvider from"./ActiveBreakpointProvider";/** @typedef {import('../index').Theme} Theme */ /** @type {import('react').Context<Theme>} */export var ThemeContext=createContext();/**
|
|
2
|
+
* The ThemeProvider component provides the theme context to its children.
|
|
3
|
+
* @param {Object} props The component props
|
|
4
|
+
* @param {Theme} props.theme The theme object to provide
|
|
5
|
+
* @param {React.ReactNode} props.children The children to render within the provider
|
|
6
|
+
* @returns {JSX.Element} The ThemeProvider component
|
|
7
|
+
*/var ThemeProvider=function ThemeProvider(_ref){var children=_ref.children,theme=_ref.theme;return React.createElement(ThemeContext.Provider,{value:theme},React.createElement(ActiveBreakpointProvider,null,children));};export default memo(ThemeProvider);
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import createCache from'@emotion/cache';import{createMakeAndWithStyles,createTss}from'tss-react';import{useTheme}from'@shopgate/engage/styles';export{GlobalStyles,keyframes}from'tss-react';export var emotionCache=createCache({// All tss-react styles will be prefixed with `.tss-*` instead of `.css-*`
|
|
2
|
+
key:'tss'});var _createTss=createTss({useContext:useTheme}),tss=_createTss.tss;// Create makeStyles and withStyles functions for tss-react package
|
|
3
|
+
export{tss};var _createMakeAndWithSty=createMakeAndWithStyles({useTheme:useTheme}),makeStyles=_createMakeAndWithSty.makeStyles,withStyles=_createMakeAndWithSty.withStyles;export{makeStyles,withStyles};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{createSelector}from'reselect';import{appConfig}from'@shopgate/engage';import{appSupportsCookieConsent}from'@shopgate/engage/core/helpers';var _appConfig$cookieCons=appConfig.cookieConsent,_appConfig$cookieCons2=_appConfig$cookieCons===void 0?{}:_appConfig$cookieCons,isCookieConsentActivated=_appConfig$cookieCons2.isCookieConsentActivated,showComfortCookiesToggle=_appConfig$cookieCons2.showComfortCookiesToggle;/**
|
|
1
|
+
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{createSelector}from'reselect';import{appConfig}from'@shopgate/engage';import{IS_PAGE_PREVIEW_ACTIVE}from'@shopgate/engage/page/constants';import{appSupportsCookieConsent}from'@shopgate/engage/core/helpers';var _appConfig$cookieCons=appConfig.cookieConsent,_appConfig$cookieCons2=_appConfig$cookieCons===void 0?{}:_appConfig$cookieCons,isCookieConsentActivated=_appConfig$cookieCons2.isCookieConsentActivated,showComfortCookiesToggle=_appConfig$cookieCons2.showComfortCookiesToggle;/**
|
|
2
2
|
* Selects the cookie consent modal state.
|
|
3
3
|
* @param {Object} state The current state of the cookie consent modal.
|
|
4
4
|
* @returns {Object} whether cookie consent modal is shown.
|
|
@@ -11,7 +11,7 @@ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<argum
|
|
|
11
11
|
* inactive, app doesn't support the feature).
|
|
12
12
|
* @returns {boolean} Whether the cookie consent process is handled either by user
|
|
13
13
|
* or by app/feature settings
|
|
14
|
-
*/export var getIsCookieConsentHandled=createSelector(getCookieSettingsState,function(settingsState){if(!isCookieConsentActivated||!appSupportsCookieConsent()){return true;}return(settingsState===null||settingsState===void 0?void 0:settingsState.comfortCookiesAccepted)!==null||(settingsState===null||settingsState===void 0?void 0:settingsState.statisticsCookiesAccepted)!==null;});/**
|
|
14
|
+
*/export var getIsCookieConsentHandled=createSelector(getCookieSettingsState,function(settingsState){if(!isCookieConsentActivated||!appSupportsCookieConsent()||IS_PAGE_PREVIEW_ACTIVE){return true;}return(settingsState===null||settingsState===void 0?void 0:settingsState.comfortCookiesAccepted)!==null||(settingsState===null||settingsState===void 0?void 0:settingsState.statisticsCookiesAccepted)!==null;});/**
|
|
15
15
|
* Selects the property of the comfort cookie settings.
|
|
16
16
|
* @private This selector is intended to be used internally. When a cookie consent status needs
|
|
17
17
|
* to be checked for a feature, please use `getAreComfortCookiesAccepted` instead.
|