@shopgate/engage 7.27.5-alpha.2 → 7.28.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.
Files changed (140) hide show
  1. package/category/components/CategoryImage/index.js +1 -1
  2. package/category/components/CategoryList/index.js +3 -7
  3. package/category/components/CategoryList/style.js +1 -1
  4. package/category/streams/index.js +1 -1
  5. package/components/ResponsiveContainer/breakpoints.js +2 -2
  6. package/components/SheetList/components/Item/index.js +7 -7
  7. package/components/View/components/Content/style.js +1 -1
  8. package/components/View/context.js +1 -1
  9. package/components/index.js +1 -1
  10. package/core/constants/index.js +1 -7
  11. package/core/contexts/ThemeResourcesContext.d.ts +1 -10
  12. package/core/contexts/ThemeResourcesContext.js +1 -1
  13. package/core/helpers/scrollContainer.js +2 -2
  14. package/core/hocs/withThemeResources.js +1 -4
  15. package/core/hooks/events/index.js +1 -1
  16. package/core/hooks/useThemeResources.js +5 -6
  17. package/core/providers/ThemeResourcesProvider.js +5 -9
  18. package/locations/action-creators/index.js +1 -1
  19. package/locations/action-creators/selectLocation.js +8 -5
  20. package/locations/action-creators/sendDefaultLocationCode.js +14 -0
  21. package/locations/actions/fetchDefaultLocation.js +1 -1
  22. package/locations/actions/sendDefaultLocationCode.js +2 -2
  23. package/locations/components/GlobalLocationSelector/GlobalLocationSelector.js +2 -2
  24. package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcher.js +3 -1
  25. package/locations/constants/ActionTypes.js +2 -1
  26. package/locations/constants/index.js +1 -1
  27. package/locations/index.js +1 -1
  28. package/locations/locations.streams.js +3 -1
  29. package/locations/providers/FulfillmentProvider.js +6 -5
  30. package/locations/providers/StoreDetailsProvider.js +4 -2
  31. package/locations/providers/StoreFinderProvider.js +5 -3
  32. package/locations/subscriptions.js +12 -13
  33. package/package.json +7 -9
  34. package/page/components/index.js +1 -1
  35. package/page/constants/index.js +1 -5
  36. package/page/index.js +2 -1
  37. package/page/selectors/index.js +2 -48
  38. package/product/components/ProductCard/index.js +1 -1
  39. package/product/components/ProductGridPrice/index.js +1 -1
  40. package/product/components/ProductSlider/index.js +4 -4
  41. package/product/components/index.js +1 -1
  42. package/styles/helpers/index.js +1 -1
  43. package/styles/helpers/setPageBackgroundColor.js +2 -2
  44. package/styles/index.js +1 -1
  45. package/tracking/selectors/cookieConsent.js +2 -2
  46. package/components/Typography/Typography.d.ts +0 -132
  47. package/components/Typography/Typography.js +0 -11
  48. package/components/Typography/index.js +0 -1
  49. package/core/hooks/events/usePressHandler.js +0 -38
  50. package/page/action-creators/index.js +0 -22
  51. package/page/components/Widgets/Overlay.js +0 -51
  52. package/page/components/Widgets/Tooltip.js +0 -22
  53. package/page/components/Widgets/Widget.js +0 -15
  54. package/page/components/Widgets/WidgetContext.d.ts +0 -42
  55. package/page/components/Widgets/WidgetContext.js +0 -9
  56. package/page/components/Widgets/WidgetProvider.js +0 -8
  57. package/page/components/Widgets/Widgets.js +0 -11
  58. package/page/components/Widgets/WidgetsPreviewContext.js +0 -9
  59. package/page/components/Widgets/WidgetsPreviewProvider.js +0 -8
  60. package/page/components/Widgets/constants.js +0 -4
  61. package/page/components/Widgets/events.js +0 -23
  62. package/page/components/Widgets/helpers.js +0 -23
  63. package/page/components/Widgets/hooks.js +0 -69
  64. package/page/components/Widgets/index.js +0 -1
  65. package/page/components/Widgets/types.d.ts +0 -127
  66. package/page/constants/actionTypes.js +0 -1
  67. package/page/hooks/index.d.ts +0 -60
  68. package/page/hooks/index.js +0 -25
  69. package/page/reducers/index.js +0 -6
  70. package/page/subscriptions/index.js +0 -4
  71. package/page/widgets/CategoryList/CategoryList.js +0 -4
  72. package/page/widgets/CategoryList/hooks.js +0 -14
  73. package/page/widgets/CategoryList/index.js +0 -1
  74. package/page/widgets/CategoryList/selectors.js +0 -8
  75. package/page/widgets/HTML/HTML.js +0 -5
  76. package/page/widgets/HTML/hooks.js +0 -12
  77. package/page/widgets/HTML/index.js +0 -1
  78. package/page/widgets/Headline/Headline.js +0 -5
  79. package/page/widgets/Headline/hooks.js +0 -8
  80. package/page/widgets/Headline/index.js +0 -1
  81. package/page/widgets/Placeholder/Placeholder.js +0 -5
  82. package/page/widgets/Placeholder/hooks.js +0 -12
  83. package/page/widgets/Placeholder/index.js +0 -1
  84. package/page/widgets/ProductList/ProductList.js +0 -5
  85. package/page/widgets/ProductList/hooks.js +0 -25
  86. package/page/widgets/ProductList/index.js +0 -1
  87. package/page/widgets/ProductSlider/ProductSlider.js +0 -5
  88. package/page/widgets/ProductSlider/hooks.js +0 -28
  89. package/page/widgets/ProductSlider/index.js +0 -1
  90. package/page/widgets/index.js +0 -1
  91. package/page/widgets/widgets.json +0 -20
  92. package/product/components/ProductGrid/components/Item/components/ItemDetails/index.js +0 -8
  93. package/product/components/ProductGrid/components/Item/components/ItemDetails/spec.js +0 -1
  94. package/product/components/ProductGrid/components/Item/components/ItemDiscount/index.js +0 -5
  95. package/product/components/ProductGrid/components/Item/components/ItemFavoritesButton/index.js +0 -5
  96. package/product/components/ProductGrid/components/Item/components/ItemFavoritesButton/spec.js +0 -1
  97. package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +0 -5
  98. package/product/components/ProductGrid/components/Item/components/ItemImage/spec.js +0 -1
  99. package/product/components/ProductGrid/components/Item/components/ItemName/index.js +0 -5
  100. package/product/components/ProductGrid/components/Item/components/ItemName/spec.js +0 -1
  101. package/product/components/ProductGrid/components/Item/components/ItemPrice/index.js +0 -5
  102. package/product/components/ProductGrid/components/Item/components/ItemPrice/spec.js +0 -1
  103. package/product/components/ProductGrid/components/Item/index.js +0 -7
  104. package/product/components/ProductGrid/components/Iterator/index.js +0 -5
  105. package/product/components/ProductGrid/components/Layout/index.js +0 -5
  106. package/product/components/ProductGrid/index.js +0 -22
  107. package/product/components/ProductGrid/spec.js +0 -1
  108. package/styles/helpers/color.js +0 -23
  109. package/styles/index.d.ts +0 -17
  110. package/styles/theme/createTheme/createBreakpoints.d.ts +0 -114
  111. package/styles/theme/createTheme/createBreakpoints.js +0 -41
  112. package/styles/theme/createTheme/createPalette.d.ts +0 -36
  113. package/styles/theme/createTheme/createPalette.js +0 -4
  114. package/styles/theme/createTheme/createSpacing.d.ts +0 -23
  115. package/styles/theme/createTheme/createSpacing.js +0 -14
  116. package/styles/theme/createTheme/createTypography.d.ts +0 -55
  117. package/styles/theme/createTheme/createTypography.js +0 -23
  118. package/styles/theme/createTheme/index.d.ts +0 -41
  119. package/styles/theme/createTheme/index.js +0 -5
  120. package/styles/theme/createTheme/transitions.d.ts +0 -100
  121. package/styles/theme/createTheme/transitions.js +0 -26
  122. package/styles/theme/createTheme/zIndex.d.ts +0 -12
  123. package/styles/theme/createTheme/zIndex.js +0 -3
  124. package/styles/theme/hooks/index.d.ts +0 -4
  125. package/styles/theme/hooks/index.js +0 -1
  126. package/styles/theme/hooks/useActiveBreakpoint.d.ts +0 -18
  127. package/styles/theme/hooks/useActiveBreakpoint.js +0 -4
  128. package/styles/theme/hooks/useMediaQuery.d.ts +0 -33
  129. package/styles/theme/hooks/useMediaQuery.js +0 -20
  130. package/styles/theme/hooks/useResponsiveValue.d.ts +0 -27
  131. package/styles/theme/hooks/useResponsiveValue.js +0 -4
  132. package/styles/theme/hooks/useTheme.d.ts +0 -8
  133. package/styles/theme/hooks/useTheme.js +0 -4
  134. package/styles/theme/index.d.ts +0 -8
  135. package/styles/theme/index.js +0 -1
  136. package/styles/theme/providers/ActiveBreakpointProvider.d.ts +0 -21
  137. package/styles/theme/providers/ActiveBreakpointProvider.js +0 -13
  138. package/styles/theme/providers/ThemeProvider.d.ts +0 -18
  139. package/styles/theme/providers/ThemeProvider.js +0 -7
  140. package/styles/tss/index.js +0 -3
@@ -1,5 +1,5 @@
1
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,{useState,useCallback}from'react';import PropTypes from'prop-types';import{Image}from'@shopgate/engage/components';import connect from"./connector";/**
2
2
  * The CategoryImage component
3
3
  * @param {Object} props The component props.
4
- * @returns {JSX.Element}
4
+ * @returns {JSX}
5
5
  */var CategoryImage=function CategoryImage(_ref){var className=_ref.className,src=_ref.src,placeholderSrc=_ref.placeholderSrc;var _useState=useState(!src),_useState2=_slicedToArray(_useState,2),showPlaceholder=_useState2[0],setShowPlaceholder=_useState2[1];var onImageError=useCallback(function(){setShowPlaceholder(true);},[setShowPlaceholder]);if(!showPlaceholder){return React.createElement(Image,{className:className,src:src,onError:onImageError});}if(!placeholderSrc){return null;}return React.createElement(Image,{key:"placeholder",className:className,src:placeholderSrc});};CategoryImage.defaultProps={src:null,placeholderSrc:null,className:null};export default connect(CategoryImage);
@@ -1,11 +1,7 @@
1
1
  import React from'react';import PropTypes from'prop-types';import classNames from'classnames';import{bin2hex}from'@shopgate/pwa-common/helpers/data';import{CATEGORY_PATH}from'@shopgate/pwa-common-commerce/category/constants';import Portal from'@shopgate/pwa-common/components/Portal';import{Placeholder}from'@shopgate/pwa-ui-shared';import{CATEGORY_ITEM}from'@shopgate/pwa-common-commerce/category/constants/Portals';import{i18n}from'@shopgate/engage/core';import{getShowAllProductsFilters}from'@shopgate/engage/category';import{SheetList,TextLink}from'@shopgate/engage/components';import CategoryImage from"../CategoryImage";import styles from"./style";/**
2
2
  * The CategoryList component.
3
3
  * @param {Object} props The component props.
4
- * @param {Object} props.parentCategory The parentCategory props.
5
4
  * @param {Array} props.categories The categories to display.
6
- * @param {number} props.prerender The number of rows to prerender.
7
- * @param {boolean} props.showAllProducts Whether to show all products
8
- * @param {boolean} props.showImages Whether to show category images
9
- * @param {boolean} props.showLeftSideImages Whether to show category images on the left side
10
- * @returns {JSX.Element}
11
- */var CategoryList=function CategoryList(_ref){var categories=_ref.categories,parentCategory=_ref.parentCategory,prerender=_ref.prerender,showAllProducts=_ref.showAllProducts,showImages=_ref.showImages,showLeftSideImages=_ref.showLeftSideImages;if(!categories||!categories.length){if(prerender===0){return null;}return React.createElement(SheetList,{className:classNames(styles.sheet,'engage__category__category-list')},Array(Math.min(prerender,8)).fill('').map(function(val,index){var key="placeholder-".concat(index);return React.createElement(Placeholder,{height:20,key:key,left:0,top:18,width:220});}));}var filters=getShowAllProductsFilters(parentCategory);return React.createElement(SheetList,{className:classNames(styles.sheet,'engage__category__category-list')},showAllProducts?React.createElement("div",{className:classNames(styles.showAllProducts,'engage__category__category-show-all-products')},React.createElement(Portal,{key:parentCategory.id,name:"category.show-all-products",props:{categoryId:parentCategory.id}},React.createElement(SheetList.Item,{link:"".concat(CATEGORY_PATH,"/").concat(bin2hex(parentCategory.id),"/all"),title:i18n.text('category.showAllProducts.label'),linkState:{categoryName:parentCategory.name,categoryId:parentCategory.id,filters:filters},testId:"showAllProducts",linkComponent:TextLink}))):null,categories.map(function(category){return React.createElement(Portal,{key:category.id,name:CATEGORY_ITEM,props:{categoryId:category.id}},React.createElement(SheetList.Item,{link:"".concat(CATEGORY_PATH,"/").concat(bin2hex(category.id)),title:category.name,description:category.description,linkState:{categoryId:category.id,title:category.name},testId:category.name,rightComponent:showImages?React.createElement(CategoryImage,{className:styles.image,src:category.imageUrl}):null,leftComponent:showLeftSideImages?React.createElement(CategoryImage,{className:styles.image,src:category.imageUrl}):null,linkComponent:TextLink}));}));};CategoryList.defaultProps={categories:null,parentCategory:null,prerender:0,showAllProducts:false,showImages:false,showLeftSideImages:false};export default CategoryList;
5
+ * @param {Array} props.categories The number of rows to prerender.
6
+ * @returns {JSX}
7
+ */var CategoryList=function CategoryList(_ref){var categories=_ref.categories,parentCategory=_ref.parentCategory,prerender=_ref.prerender,showAllProducts=_ref.showAllProducts,showImages=_ref.showImages;if(!categories||!categories.length){if(prerender===0){return null;}return React.createElement(SheetList,{className:classNames(styles.sheet,'engage__category__category-list')},Array(Math.min(prerender,8)).fill('').map(function(val,index){var key="placeholder-".concat(index);return React.createElement(Placeholder,{height:20,key:key,left:0,top:18,width:220});}));}var filters=getShowAllProductsFilters(parentCategory);return React.createElement(SheetList,{className:classNames(styles.sheet,'engage__category__category-list')},showAllProducts?React.createElement("div",{className:classNames(styles.showAllProducts,'engage__category__category-show-all-products')},React.createElement(Portal,{key:parentCategory.id,name:"category.show-all-products",props:{categoryId:parentCategory.id}},React.createElement(SheetList.Item,{link:"".concat(CATEGORY_PATH,"/").concat(bin2hex(parentCategory.id),"/all"),title:i18n.text('category.showAllProducts.label'),linkState:{categoryName:parentCategory.name,categoryId:parentCategory.id,filters:filters},testId:"showAllProducts",linkComponent:TextLink}))):null,categories.map(function(category){return React.createElement(Portal,{key:category.id,name:CATEGORY_ITEM,props:{categoryId:category.id}},React.createElement(SheetList.Item,{link:"".concat(CATEGORY_PATH,"/").concat(bin2hex(category.id)),title:category.name,description:category.description,linkState:{categoryId:category.id,title:category.name},testId:category.name,rightComponent:showImages?React.createElement(CategoryImage,{className:styles.image,src:category.imageUrl}):null,linkComponent:TextLink}));}));};CategoryList.defaultProps={categories:null,parentCategory:null,prerender:0,showAllProducts:false,showImages:false};export default CategoryList;
@@ -1 +1 @@
1
- import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors;var sheet=css({background:colors.light}).toString();var showAllProducts=css({fontWeight:700}).toString();var image=css({width:'30px',marginRight:8}).toString();export default{sheet:sheet,showAllProducts:showAllProducts,image:image};
1
+ import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors;var sheet=css({background:colors.light}).toString();var showAllProducts=css({fontWeight:700}).toString();var image=css({display:'none',background:'red',borderRadius:20}).toString();export default{sheet:sheet,showAllProducts:showAllProducts,image:image};
@@ -1 +1 @@
1
- import{preferredLocationDidUpdate$,preferredLocationDidUpdateGlobalNotOnCategory$,preferredLocationDidUpdateGlobalOnCategory$}from'@shopgate/engage/locations/locations.streams';import{categoryDidBackEnter$,categoryFiltersDidUpdate$}from'@shopgate/pwa-common-commerce/category/streams';export*from'@shopgate/pwa-common-commerce/category/streams';export var categoryProductsNeedUpdate$=preferredLocationDidUpdate$.merge(preferredLocationDidUpdateGlobalNotOnCategory$).switchMap(function(){return categoryDidBackEnter$.first();}).merge(categoryFiltersDidUpdate$).merge(preferredLocationDidUpdateGlobalOnCategory$);
1
+ import{preferredLocationDidUpdate$,preferredLocationDidUpdateGlobalNotOnCategory$,preferredLocationDidUpdateGlobalOnCategory$}from'@shopgate/engage/locations/locations.streams';import{categoryDidBackEnter$,categoryFiltersDidUpdate$}from'@shopgate/pwa-common-commerce/category/streams';import{productDataExpired$}from'@shopgate/pwa-common-commerce/product/streams';export*from'@shopgate/pwa-common-commerce/category/streams';export var categoryProductsNeedUpdate$=preferredLocationDidUpdate$.merge(preferredLocationDidUpdateGlobalNotOnCategory$).merge(productDataExpired$).switchMap(function(){return categoryDidBackEnter$.first();}).merge(categoryFiltersDidUpdate$).merge(preferredLocationDidUpdateGlobalOnCategory$);
@@ -1,5 +1,5 @@
1
1
  // Ugly imports to avoid breaking tests due to circular dependencies
2
- import{isIOSTheme}from'@shopgate/engage/core/helpers/isIOSTheme';import{hasWebBridge}from'@shopgate/engage/core/helpers/bridge';import{IS_PAGE_PREVIEW_ACTIVE}from'@shopgate/engage/page/constants';var iosThemeActive=isIOSTheme();/* eslint-disable extra-rules/no-single-line-objects */var breakpoints=[{name:'xs',from:0,to:600},{name:'sm',from:600,to:960},{name:'md',from:960,to:1280},{name:'lg',from:1280,to:1920},{name:'xl',from:1920,to:Number.MAX_VALUE}];/* eslint-enable extra-rules/no-single-line-objects */ /**
2
+ import{isIOSTheme}from'@shopgate/engage/core/helpers/isIOSTheme';import{hasWebBridge}from'@shopgate/engage/core/helpers/bridge';var iosThemeActive=isIOSTheme();/* eslint-disable extra-rules/no-single-line-objects */var breakpoints=[{name:'xs',from:0,to:600},{name:'sm',from:600,to:960},{name:'md',from:960,to:1280},{name:'lg',from:1280,to:1920},{name:'xl',from:1920,to:Number.MAX_VALUE}];/* eslint-enable extra-rules/no-single-line-objects */ /**
3
3
  * Generates a media query for different breakpoints and platform.
4
4
  * @param {Object} comparators Comparators.
5
5
  * @param {string} breakpoint Breakpoint rule.
@@ -9,6 +9,6 @@ import{isIOSTheme}from'@shopgate/engage/core/helpers/isIOSTheme';import{hasWebBr
9
9
  var breakpointStart=breakpoint.search(/[a-zA-Z]/);var comparatorString=breakpoint.substring(0,breakpointStart===-1?0:breakpointStart);var breakpointString=breakpoint.substring(breakpointStart===-1?0:breakpointStart);// Get configuration.
10
10
  var comparator=comparators[comparatorString];var config=breakpoints.find(function(b){return b.name===breakpointString;});// Web / App config.
11
11
  // Handle iOS theme as app for now so that media queries in shared components only work for app
12
- var isWeb=hasWebBridge()&&!iosThemeActive&&!IS_PAGE_PREVIEW_ACTIVE;// Always mode.
12
+ var isWeb=hasWebBridge()&&!iosThemeActive;// Always mode.
13
13
  if(webAlways&&isWeb||appAlways&&!isWeb){return true;}// Return media query that never evaluates for now.
14
14
  if(appOnly&&isWeb||webOnly&&!isWeb){return false;}return comparator(config.from,config.to,window.innerWidth);};export default breakpoints;
@@ -1,17 +1,17 @@
1
1
  function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_typeof=function _typeof(obj){return typeof obj;};}else{_typeof=function _typeof(obj){return obj&&typeof Symbol==="function"&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj;};}return _typeof(obj);}function _classCallCheck(instance,Constructor){if(!(instance instanceof Constructor)){throw new TypeError("Cannot call a class as a function");}}function _defineProperties(target,props){for(var i=0;i<props.length;i++){var descriptor=props[i];descriptor.enumerable=descriptor.enumerable||false;descriptor.configurable=true;if("value"in descriptor)descriptor.writable=true;Object.defineProperty(target,descriptor.key,descriptor);}}function _createClass(Constructor,protoProps,staticProps){if(protoProps)_defineProperties(Constructor.prototype,protoProps);if(staticProps)_defineProperties(Constructor,staticProps);return Constructor;}function _callSuper(_this,derived,args){function isNativeReflectConstruct(){if(typeof Reflect==="undefined"||!Reflect.construct)return false;if(Reflect.construct.sham)return false;if(typeof Proxy==="function")return true;try{return!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}));}catch(e){return false;}}derived=_getPrototypeOf(derived);return _possibleConstructorReturn(_this,isNativeReflectConstruct()?Reflect.construct(derived,args||[],_getPrototypeOf(_this).constructor):derived.apply(_this,args));}function _possibleConstructorReturn(self,call){if(call&&(_typeof(call)==="object"||typeof call==="function")){return call;}return _assertThisInitialized(self);}function _assertThisInitialized(self){if(self===void 0){throw new ReferenceError("this hasn't been initialised - super() hasn't been called");}return self;}function _getPrototypeOf(o){_getPrototypeOf=Object.setPrototypeOf?Object.getPrototypeOf:function _getPrototypeOf(o){return o.__proto__||Object.getPrototypeOf(o);};return _getPrototypeOf(o);}function _inherits(subClass,superClass){if(typeof superClass!=="function"&&superClass!==null){throw new TypeError("Super expression must either be null or a function");}subClass.prototype=Object.create(superClass&&superClass.prototype,{constructor:{value:subClass,writable:true,configurable:true}});if(superClass)_setPrototypeOf(subClass,superClass);}function _setPrototypeOf(o,p){_setPrototypeOf=Object.setPrototypeOf||function _setPrototypeOf(o,p){o.__proto__=p;return o;};return _setPrototypeOf(o,p);}function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{Component}from'react';import PropTypes from'prop-types';import classNames from'classnames';import{withForwardedRef}from'@shopgate/engage/core';import Grid from'@shopgate/pwa-common/components/Grid';import Link from'@shopgate/pwa-common/components/Link';import Glow from'@shopgate/pwa-ui-shared/Glow';import styles from"./style";/**
2
2
  * The list item component.
3
3
  */var Item=/*#__PURE__*/function(_Component){function Item(){_classCallCheck(this,Item);return _callSuper(this,Item,arguments);}_inherits(Item,_Component);return _createClass(Item,[{key:"shouldComponentUpdate",value:/**
4
- * Should only update when the `selected` or `disabled` or 'leftComponent' props change.
4
+ * Should only update what the `selected` or `disabled` props change.
5
5
  * @param {Object} nextProps The next set of component props.
6
- * @returns {boolean}
7
- */function shouldComponentUpdate(nextProps){return this.props.isSelected!==nextProps.isSelected||this.props.isDisabled!==nextProps.isDisabled||this.props.leftComponent!==nextProps.leftComponent;}/**
6
+ * @returns {JSX}
7
+ */function shouldComponentUpdate(nextProps){return this.props.isSelected!==nextProps.isSelected||this.props.isDisabled!==nextProps.isDisabled;}/**
8
8
  * Renders the bulk of the content.
9
9
  * @param {boolean} [isNested=true] Tells if the content is rendered nested.
10
- * @returns {JSX.Element}
11
- */},{key:"renderContent",value:function renderContent(){var isNested=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;var _this$props=this.props,isDisabled=_this$props.isDisabled,isSelected=_this$props.isSelected,title=_this$props.title,image=_this$props.image,rightComponent=_this$props.rightComponent,leftComponent=_this$props.leftComponent,forwardedRef=_this$props.forwardedRef,description=_this$props.description;var gridStyles=_defineProperty(_defineProperty({},styles.grid,true),styles.selected,isSelected);var titleStyles=_defineProperty(_defineProperty({},styles.title,true),styles.disabled,isDisabled);var ref=isNested?null:forwardedRef;return React.createElement("div",{"data-test-id":this.props.testId,ref:ref,className:"engage__sheet-list__item"},React.createElement(Grid,{className:classNames(gridStyles),component:"div"},image!==null&&React.createElement("div",{className:styles.image},image),leftComponent!==null&&React.createElement(Grid.Item,{component:"div",grow:1},leftComponent),React.createElement(Grid.Item,{className:classNames(titleStyles),component:"div",grow:1},React.createElement("div",null,title),description&&React.createElement("div",{className:styles.description,dangerouslySetInnerHTML:{__html:description}})),rightComponent!==null&&React.createElement(Grid.Item,{component:"div",grow:1},rightComponent)));}/**
12
- * @returns {JSX.Element}
10
+ * @returns {JSX}
11
+ */},{key:"renderContent",value:function renderContent(){var isNested=arguments.length>0&&arguments[0]!==undefined?arguments[0]:true;var _this$props=this.props,isDisabled=_this$props.isDisabled,isSelected=_this$props.isSelected,title=_this$props.title,image=_this$props.image,rightComponent=_this$props.rightComponent,forwardedRef=_this$props.forwardedRef,description=_this$props.description;var gridStyles=_defineProperty(_defineProperty({},styles.grid,true),styles.selected,isSelected);var titleStyles=_defineProperty(_defineProperty({},styles.title,true),styles.disabled,isDisabled);var ref=isNested?null:forwardedRef;return React.createElement("div",{"data-test-id":this.props.testId,ref:ref,className:"engage__sheet-list__item"},React.createElement(Grid,{className:classNames(gridStyles),component:"div"},image!==null&&React.createElement("div",{className:styles.image},image),React.createElement(Grid.Item,{className:classNames(titleStyles),component:"div",grow:1},React.createElement("div",null,title),description&&React.createElement("div",{className:styles.description,dangerouslySetInnerHTML:{__html:description}})),rightComponent!==null&&React.createElement(Grid.Item,{component:"div",grow:1},rightComponent)));}/**
12
+ * @returns {JSX}
13
13
  */},{key:"render",value:function render(){var _this$props2=this.props,link=_this$props2.link,linkState=_this$props2.linkState,LinkComponent=_this$props2.linkComponent,onClick=_this$props2.onClick,className=_this$props2.className,isDisabled=_this$props2.isDisabled,testId=_this$props2.testId,forwardedRef=_this$props2.forwardedRef,isSelected=_this$props2.isSelected;/**
14
14
  * If this item is disabled, selected or doesn't have a valid
15
15
  * link or click handler then wrap the content with other components.
16
16
  */if(isDisabled||!link&&!onClick){return this.renderContent(false);}// Wrap with a <Link> if the `link` prop is set.
17
- if(link){return React.createElement(Glow,{ref:forwardedRef,className:className,styles:{hover:styles.glowHover}},React.createElement(LinkComponent,{href:link,onClick:onClick,state:linkState,tabIndex:0},this.renderContent()));}return React.createElement("div",{onKeyPress:function onKeyPress(){},onClick:onClick,"data-test-id":testId,ref:forwardedRef,tabIndex:0,role:"option","aria-selected":isSelected},React.createElement(Glow,{className:className,styles:{hover:styles.glowHover}},this.renderContent()));}}]);}(Component);_defineProperty(Item,"defaultProps",{className:null,description:null,forwardedRef:null,image:null,isDisabled:false,isSelected:false,leftComponent:null,link:null,linkComponent:Link,linkState:null,onClick:null,rightComponent:null,testId:null});export default withForwardedRef(Item);
17
+ if(link){return React.createElement(Glow,{ref:forwardedRef,className:className,styles:{hover:styles.glowHover}},React.createElement(LinkComponent,{href:link,onClick:onClick,state:linkState,tabIndex:0},this.renderContent()));}return React.createElement("div",{onKeyPress:function onKeyPress(){},onClick:onClick,"data-test-id":testId,ref:forwardedRef,tabIndex:0,role:"option","aria-selected":isSelected},React.createElement(Glow,{className:className,styles:{hover:styles.glowHover}},this.renderContent()));}}]);}(Component);_defineProperty(Item,"defaultProps",{className:null,description:null,forwardedRef:null,image:null,isDisabled:false,isSelected:false,link:null,linkState:null,onClick:null,rightComponent:null,linkComponent:Link,testId:null});export default withForwardedRef(Item);
@@ -1 +1 @@
1
- function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}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{css}from'glamor';import{useScrollContainer}from'@shopgate/engage/core';import{responsiveMediaQuery}from'@shopgate/engage/styles';import{IS_PAGE_PREVIEW_ACTIVE}from'@shopgate/engage/page/constants';export default css(_extends({display:'flex',flexDirection:'column',width:'100vw'},useScrollContainer()?_extends({bottom:0,top:0,overflowScrolling:'touch',position:'absolute',WebkitOverflowScrolling:'touch'},IS_PAGE_PREVIEW_ACTIVE&&{scrollbarWidth:'thin',backgroundColor:'var(--page-background-color)'}):{height:'100%',backgroundColor:'var(--page-background-color)'},_defineProperty({},responsiveMediaQuery('>xs',{webOnly:true}),{width:'var(--page-content-width)'})));
1
+ function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}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{css}from'glamor';import{useScrollContainer}from'@shopgate/engage/core';import{responsiveMediaQuery}from'@shopgate/engage/styles';export default css(_extends({display:'flex',flexDirection:'column',width:'100vw'},useScrollContainer()?{bottom:0,top:0,overflowScrolling:'touch',position:'absolute',WebkitOverflowScrolling:'touch'}:{height:'100%',backgroundColor:'var(--page-background-color)'},_defineProperty({},responsiveMediaQuery('>xs',{webOnly:true}),{width:'var(--page-content-width)'})));
@@ -1 +1 @@
1
- import React from'react';import noop from'lodash/noop';export var ViewContext=React.createContext({top:null,bottom:null,ariaHidden:false,set:noop,setTop:noop,setBottom:noop,setContentRef:noop,getContentRef:function getContentRef(){return{current:null};},scrollTop:noop,setAriaHidden:noop});
1
+ import React from'react';export var ViewContext=React.createContext();
@@ -9,4 +9,4 @@ export{default as AccordionContainer}from'@shopgate/pwa-ui-shared/AccordionConta
9
9
  export{default as CartIconIOS}from'@shopgate/pwa-ui-ios/icons/CartIcon';export{default as FilterIconIOS}from'@shopgate/pwa-ui-ios/icons/FilterIcon';export{default as HomeIconIOS}from'@shopgate/pwa-ui-ios/icons/HomeIcon';export{default as ShareIconIOS}from'@shopgate/pwa-ui-ios/icons/ShareIcon';// ICONS ANDROID
10
10
  export{default as ShareIconAndroid}from'@shopgate/pwa-ui-material/icons/ShareIcon';// ICONS SHARED
11
11
  export{default as AccountBoxIcon}from'@shopgate/pwa-ui-shared/icons/AccountBoxIcon';export{default as AddMoreIcon}from'@shopgate/pwa-ui-shared/icons/AddMoreIcon';export{default as ArrowDropIcon}from'@shopgate/pwa-ui-shared/icons/ArrowDropIcon';export{default as ArrowIcon}from'@shopgate/pwa-ui-shared/icons/ArrowIcon';export{default as BarcodeScannerIcon}from'@shopgate/pwa-ui-shared/icons/BarcodeScannerIcon';export{default as BoxIcon}from'@shopgate/pwa-ui-shared/icons/BoxIcon';export{default as BrowseIcon}from'@shopgate/pwa-ui-shared/icons/BrowseIcon';export{default as BurgerIcon}from'@shopgate/pwa-ui-shared/icons/BurgerIcon';export{default as CartIcon}from'@shopgate/pwa-ui-shared/icons/CartIcon';export{default as CartPlusIcon}from'@shopgate/pwa-ui-shared/icons/CartPlusIcon';export{default as CartCouponIcon}from'@shopgate/pwa-ui-shared/icons/CartCouponIcon';export{default as CheckedIcon}from'@shopgate/pwa-ui-shared/icons/CheckedIcon';export{default as CheckIcon}from'@shopgate/pwa-ui-shared/icons/CheckIcon';export{default as ChevronIcon}from'@shopgate/pwa-ui-shared/icons/ChevronIcon';export{default as CreditCardIcon}from'@shopgate/pwa-ui-shared/icons/CreditCardIcon';export{default as CrossIcon}from'@shopgate/pwa-ui-shared/icons/CrossIcon';export{default as DescriptionIcon}from'@shopgate/pwa-ui-shared/icons/DescriptionIcon';export{default as FilterIcon}from'@shopgate/pwa-ui-shared/icons/FilterIcon';export{default as FlashEnabledIcon}from'@shopgate/pwa-ui-shared/icons/FlashEnabledIcon';export{default as FlashDisabledIcon}from'@shopgate/pwa-ui-shared/icons/FlashDisabledIcon';export{default as GridIcon}from'@shopgate/pwa-ui-shared/icons/GridIcon';export{default as HeartIcon}from'@shopgate/pwa-ui-shared/icons/HeartIcon';export{default as HeartOutlineIcon}from'@shopgate/pwa-ui-shared/icons/HeartOutlineIcon';export{default as HeartPlusIcon}from'@shopgate/pwa-ui-shared/icons/HeartPlusIcon';export{default as HeartPlusOutlineIcon}from'@shopgate/pwa-ui-shared/icons/HeartPlusOutlineIcon';export{default as HomeIcon}from'@shopgate/pwa-ui-shared/icons/HomeIcon';export{default as InfoIcon}from'@shopgate/pwa-ui-shared/icons/InfoIcon';export{default as InfoOutlineIcon}from'@shopgate/pwa-ui-shared/icons/InfoOutlineIcon';export{default as ListIcon}from'@shopgate/pwa-ui-shared/icons/ListIcon';export{default as LocatorIcon}from'@shopgate/pwa-ui-shared/icons/LocatorIcon';export{default as LocalShippingIcon}from'@shopgate/pwa-ui-shared/icons/LocalShippingIcon';export{default as LocationIcon}from'@shopgate/pwa-ui-shared/icons/LocationIcon';export{default as LockIcon}from'@shopgate/pwa-ui-shared/icons/LockIcon';export{default as LogoutIcon}from'@shopgate/pwa-ui-shared/icons/LogoutIcon';export{default as MagnifierIcon}from'@shopgate/pwa-ui-shared/icons/MagnifierIcon';export{default as MoreIcon}from'@shopgate/pwa-ui-shared/icons/MoreIcon';export{default as MoreVertIcon}from'@shopgate/pwa-ui-shared/icons/MoreVertIcon';export{default as PersonIcon}from'@shopgate/pwa-ui-shared/icons/PersonIcon';export{default as PhoneIcon}from'@shopgate/pwa-ui-shared/icons/PhoneIcon';export{default as PlaceholderIcon}from'@shopgate/pwa-ui-shared/icons/PlaceholderIcon';export{default as RadioCheckedIcon}from'@shopgate/pwa-ui-shared/icons/RadioCheckedIcon';export{default as RadioUncheckedIcon}from'@shopgate/pwa-ui-shared/icons/RadioUncheckedIcon';export{default as SecurityIcon}from'@shopgate/pwa-ui-shared/icons/SecurityIcon';export{default as ShoppingCartIcon}from'@shopgate/pwa-ui-shared/icons/ShoppingCartIcon';export{default as SortIcon}from'@shopgate/pwa-ui-shared/icons/SortIcon';export{default as StarHalfIcon}from'@shopgate/pwa-ui-shared/icons/StarHalfIcon';export{default as StarIcon}from'@shopgate/pwa-ui-shared/icons/StarIcon';export{default as StarOutlineIcon}from'@shopgate/pwa-ui-shared/icons/StarOutlineIcon';export{default as TickIcon}from'@shopgate/pwa-ui-shared/icons/TickIcon';export{default as TrashIcon}from'@shopgate/pwa-ui-shared/icons/TrashIcon';export{default as TrashOutlineIcon}from'@shopgate/pwa-ui-shared/icons/TrashOutlineIcon';export{default as UncheckedIcon}from'@shopgate/pwa-ui-shared/icons/UncheckedIcon';export{default as ViewListIcon}from'@shopgate/pwa-ui-shared/icons/ViewListIcon';export{default as VisibilityIcon}from'@shopgate/pwa-ui-shared/icons/VisibilityIcon';export{default as VisibilityOffIcon}from'@shopgate/pwa-ui-shared/icons/VisibilityOffIcon';export{default as TimeIcon}from'@shopgate/pwa-ui-shared/icons/TimeIcon';export{default as NotificationIcon}from'@shopgate/pwa-ui-shared/icons/NotificationIcon';// LOCAL
12
- export{MessageBar}from"./MessageBar";export{default as NavigationHandler}from"./NavigationHandler";export{default as TimeBoundary}from"./TimeBoundary";export{default as IntersectionVisibility}from"./IntersectionVisibility";export{default as VideoPlayer}from"./VideoPlayer";export{default as SheetDrawer}from"./SheetDrawer";export{default as SheetList}from"./SheetList";export{default as NullComponent}from"./NullComponent";export{default as View,ViewContext}from"./View";export{default as QuantityInput}from"./QuantityInput";export{default as QuantityLabel}from"./QuantityLabel";export{default as ResponsiveContainer}from"./ResponsiveContainer";export{default as BrandingColorBanner}from"./BrandingColorBanner";export{default as ScrollHeader}from"./ScrollHeader";export{default as Menu}from"./Menu";export{default as Toggle}from"./Toggle";export{Form}from"./Form";export{FormBuilder}from"./Form";export{Footer}from"./Footer";export{SideNavigation}from"./SideNavigation";export{default as TextLink}from"./TextLink/TextLink";export{ConditionalWrapper}from"./ConditionalWrapper";export{default as RadioGroupV2,useRadioGroup}from"./RadioGroup";export{default as RadioV2}from"./Radio";export{default as RadioCard}from"./RadioCard";export{default as ChipLayout}from"./ChipLayout";export{default as Logo}from"./Logo";export{default as PickerUtilize}from"./PickerUtilize";export{default as Switch}from"./Switch";export{default as SnackBarContainer}from"./SnackBarContainer";export{default as ConnectedReactPortal}from"./ConnectedReactPortal";export{Typography}from"./Typography";
12
+ export{MessageBar}from"./MessageBar";export{default as NavigationHandler}from"./NavigationHandler";export{default as TimeBoundary}from"./TimeBoundary";export{default as IntersectionVisibility}from"./IntersectionVisibility";export{default as VideoPlayer}from"./VideoPlayer";export{default as SheetDrawer}from"./SheetDrawer";export{default as SheetList}from"./SheetList";export{default as NullComponent}from"./NullComponent";export{default as View,ViewContext}from"./View";export{default as QuantityInput}from"./QuantityInput";export{default as QuantityLabel}from"./QuantityLabel";export{default as ResponsiveContainer}from"./ResponsiveContainer";export{default as BrandingColorBanner}from"./BrandingColorBanner";export{default as ScrollHeader}from"./ScrollHeader";export{default as Menu}from"./Menu";export{default as Toggle}from"./Toggle";export{Form}from"./Form";export{FormBuilder}from"./Form";export{Footer}from"./Footer";export{SideNavigation}from"./SideNavigation";export{default as TextLink}from"./TextLink/TextLink";export{ConditionalWrapper}from"./ConditionalWrapper";export{default as RadioGroupV2,useRadioGroup}from"./RadioGroup";export{default as RadioV2}from"./Radio";export{default as RadioCard}from"./RadioCard";export{default as ChipLayout}from"./ChipLayout";export{default as Logo}from"./Logo";export{default as PickerUtilize}from"./PickerUtilize";export{default as Switch}from"./Switch";export{default as SnackBarContainer}from"./SnackBarContainer";export{default as ConnectedReactPortal}from"./ConnectedReactPortal";
@@ -3,10 +3,4 @@ export*from'@shopgate/pwa-core/constants/ErrorManager';export*from'@shopgate/pwa
3
3
  export*from'@shopgate/pwa-common/constants/ActionTypes';export*from'@shopgate/pwa-common/constants/Configuration';export*from'@shopgate/pwa-common/constants/Device';export*from'@shopgate/pwa-common/constants/DisplayOptions';export*from'@shopgate/pwa-common/constants/Pipelines';export*from'@shopgate/pwa-common/constants/Portals';// CLIENT CONSTANTS
4
4
  export*from'@shopgate/pwa-common/constants/client';// MENU CONSTANTS
5
5
  export*from'@shopgate/pwa-common/constants/MenuIDs';// MODAL CONSTANTS
6
- export*from'@shopgate/pwa-common/constants/ModalTypes';export{INDEX_PATH,INDEX_PATH_DEEPLINK,LOGIN_PATH};/**
7
- * Helper constant that can be used as a return value in Redux selectors to prevent
8
- * unnecessary re-renders.
9
- */export var EMPTY_OBJECT=Object.freeze({});/**
10
- * Helper constant that can be used as a return value in Redux selectors to prevent
11
- * unnecessary re-renders.
12
- */export var EMPTY_ARRAY=Object.freeze([]);
6
+ export*from'@shopgate/pwa-common/constants/ModalTypes';export{INDEX_PATH,INDEX_PATH_DEEPLINK,LOGIN_PATH};
@@ -43,16 +43,7 @@ export interface ThemeResourcesContextType {
43
43
  * Mapping object that contains all available widgets.
44
44
  * Key is the widget code, value is the widget component.
45
45
  */
46
- widgets: {
47
- /**
48
- * All available widgets for Widget API v1
49
- */
50
- v1: ThemeWidgetMap;
51
- /**
52
- * All available widgets for Widget API v2
53
- */
54
- v2: ThemeWidgetMap;
55
- };
46
+ widgets: ThemeWidgetMap;
56
47
 
57
48
  /**
58
49
  * Mapping object that contains multiple components provided by the theme.
@@ -1,3 +1,3 @@
1
1
  import{createContext}from'react';/**
2
2
  * @typedef {import('./ThemeResourcesContext').ThemeResourcesContextType ThemeResourcesContextType}
3
- */ /** @type {import('react').Context<ThemeResourcesContextType>} */export default createContext({widgets:{v1:{},v2:{}},components:{}});
3
+ */ /** @type {import('react').Context<ThemeResourcesContextType>} */export default createContext({widgets:{},components:{}});
@@ -1,4 +1,4 @@
1
- import{IS_PAGE_PREVIEW_ACTIVE}from'@shopgate/engage/page/constants';import{hasWebBridge}from"./bridge";/**
1
+ import{hasWebBridge}from"./bridge";/**
2
2
  * Checks whether the app shall use a scroll container
3
3
  * @returns {boolean}
4
- */export var useScrollContainer=function useScrollContainer(){return IS_PAGE_PREVIEW_ACTIVE||!hasWebBridge();};
4
+ */export var useScrollContainer=function useScrollContainer(){return!hasWebBridge();};
@@ -12,8 +12,5 @@ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<argum
12
12
  * HOC that injects the `widgets` value of the ThemeResources context as a prop called
13
13
  * `themeWidgets`.
14
14
  * @param {React.ComponentType<any>} WrappedComponent The wrapped component
15
- * @param {Object} [options={}] Options for the HOC.
16
- * @param {"v1"|"v2"} [options.version='v1'] The API version of the widgets to return. Can be 'v1'
17
- * or 'v2'.
18
15
  * @returns {React.FC<any>}
19
- */export var withThemeWidgets=function withThemeWidgets(WrappedComponent){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};return function ThemeResourcesWrapper(props){var _options$version=options.version,version=_options$version===void 0?'v1':_options$version;var themeWidgets=useThemeWidgets(version);return React.createElement(WrappedComponent,_extends({},props,{themeWidgets:themeWidgets}));};};
16
+ */export var withThemeWidgets=function withThemeWidgets(WrappedComponent){return function ThemeResourcesWrapper(props){var themeWidgets=useThemeWidgets();return React.createElement(WrappedComponent,_extends({},props,{themeWidgets:themeWidgets}));};};
@@ -1 +1 @@
1
- export{default as usePressHandler}from"./usePressHandler";export{default as useLongPress}from"./useLongPress";export{default as useScrollDirectionChange}from"./useScrollDirectionChange";
1
+ export{default as useLongPress}from"./useLongPress";export{default as useScrollDirectionChange}from"./useScrollDirectionChange";
@@ -2,21 +2,20 @@ import{useContext}from'react';import ThemeResourcesContext from"../contexts/Them
2
2
  * @typedef {import('../contexts/ThemeResourcesContext').ThemeResourcesContextType
3
3
  * ThemeResourcesContextType}
4
4
  */ /**
5
- * @typedef {import('../contexts/ThemeResourcesContext').ThemeComponentMap ThemeComponentMap}
5
+ * @typedef {ThemeResourcesContextType['components']} ThemeComponentsType
6
6
  */ /**
7
- * @typedef {import('../contexts/ThemeResourcesContext').ThemeWidgetMap ThemeWidgetMap}
7
+ * @typedef {ThemeResourcesContextType['widgets']} ThemeWidgetsType
8
8
  */ /**
9
9
  * Hook to access to the ThemeResourceContext. The context provides access to different groups
10
10
  * of React components provided by the active theme.
11
11
  * @returns {ThemeResourcesContextType} Value of the ThemeResourceContext
12
12
  */export function useThemeResources(){return useContext(ThemeResourcesContext);}/**
13
13
  * Hook to access the components provided by the ThemeResourceContext
14
- * @returns {ThemeComponentMap} Mapping object that contains multiple components provided by the
14
+ * @returns {ThemeComponentsType} Mapping object that contains multiple components provided by the
15
15
  * theme.
16
16
  * Key is the component name, value is the component
17
17
  */export function useThemeComponents(){var _useThemeResources=useThemeResources(),components=_useThemeResources.components;return components;}/**
18
18
  * Hook to access the widgets provided by the ThemeResourceContext
19
- * @param {string} [version='v1'] The version of the widget API to use. Defaults to 'v1'.
20
- * @returns {ThemeWidgetMap} Mapping object that contains all available widgets.
19
+ * @returns {ThemeWidgetsType} Mapping object that contains all available widgets.
21
20
  * Key is the widget code, value is the widget component.
22
- */export function useThemeWidgets(){var version=arguments.length>0&&arguments[0]!==undefined?arguments[0]:'v1';var _useThemeResources2=useThemeResources(),widgets=_useThemeResources2.widgets;return widgets[version]?widgets[version]:widgets.v1;}
21
+ */export function useThemeWidgets(){var _useThemeResources2=useThemeResources(),widgets=_useThemeResources2.widgets;return widgets;}
@@ -1,18 +1,14 @@
1
1
  import React,{useMemo}from'react';import PropTypes from'prop-types';import{ThemeContext as LegacyThemeContext}from'@shopgate/pwa-common/context';import{ThemeResourcesContext}from"../contexts";/**
2
- * @typedef {import('../contexts/ThemeResourcesContext').ThemeComponentMap} ThemeComponentMap
3
- */ /**
4
- * @typedef {Object} Widgets
5
- * @property {ThemeComponentMap} v1 All available widgets for Widget API v1
6
- * @property {ThemeComponentMap} v2 All available widgets for Widget API v2
2
+ * @typedef {Object<string, React.ComponentType<any>>} ComponentMap
7
3
  */ /**
8
4
  * ThemeResourcesProvider component.
9
5
  * @param {Object} props The component props.
10
- * @param {Widgets} props.widgets Mapping object with all available widget components for the
6
+ * @param {ComponentMap} props.widgets Mapping object with all available widget components for the
11
7
  * theme. Key is the widget code, value is the widget component.
12
- * @param {ThemeComponentMap} props.components Object with shared theme components. Can be used by
8
+ * @param {ComponentMap} props.components Object with shared theme components. Can be used by
9
+ * extensions the get unified visual presentation.
10
+ * @param {ComponentMap} [props.legacyThemeAPI] Object with shared theme components. Can be used by
13
11
  * extensions the get unified visual presentation.
14
- * @param {ThemeComponentMap} [props.legacyThemeAPI] Object with shared theme components. Can be
15
- * used by extensions the get unified visual presentation.
16
12
  * Kept for backward compatibility with existing extensions which use the deprecated `ThemeContext`.
17
13
  * @param {React.ReactNode} props.children The component children.
18
14
  * @returns {JSX.Element}
@@ -1 +1 @@
1
- export{default as errorLocations}from"./errorLocations";export{default as selectLocation}from"./selectLocation";export{default as selectGlobalLocation}from"./selectGlobalLocation";export{default as storeFormInput}from"./storeFormInput";export{default as storeFulfillmentMethod}from"./storeFulfillmentMethod";export{default as setUserSearchPostalCode}from"./setUserSearchPostalCode";export{default as setUserSearchCountryCode}from"./setUserSearchCountryCode";export{default as setUserGeolocation}from"./setUserGeolocation";export{default as setStoreFinderSearchRadius}from"./setStoreFinderSearchRadius";export{default as errorProductLocations}from"./errorProductLocations";export{default as receiveLocations}from"./receiveLocations";export{default as receiveProductLocations}from"./receiveProductLocations";export{default as requestLocations}from"./requestLocations";export{default as requestProductLocations}from"./requestProductLocations";export{default as submitReservationRequest}from"./submitReservationRequest";export{default as submitReservationSuccess}from"./submitReservationSuccess";export{default as submitReservationError}from"./submitReservationError";export{default as requestProductInventories}from"./requestProductInventories";export{default as receiveProductInventories}from"./receiveProductInventories";export{default as errorProductInventories}from"./errorProductInventories";export{provideProductAlternativeLocation}from"./provideProductAlternativeLocation";export{default as requestInventories}from"./requestInventories";export{default as receiveInventories}from"./receiveInventories";export{default as errorInventories}from"./errorInventories";
1
+ export{default as errorLocations}from"./errorLocations";export{default as selectLocation}from"./selectLocation";export{default as selectGlobalLocation}from"./selectGlobalLocation";export{default as storeFormInput}from"./storeFormInput";export{default as storeFulfillmentMethod}from"./storeFulfillmentMethod";export{default as setUserSearchPostalCode}from"./setUserSearchPostalCode";export{default as setUserSearchCountryCode}from"./setUserSearchCountryCode";export{default as setUserGeolocation}from"./setUserGeolocation";export{default as setStoreFinderSearchRadius}from"./setStoreFinderSearchRadius";export{default as errorProductLocations}from"./errorProductLocations";export{default as receiveLocations}from"./receiveLocations";export{default as receiveProductLocations}from"./receiveProductLocations";export{default as requestLocations}from"./requestLocations";export{default as requestProductLocations}from"./requestProductLocations";export{default as submitReservationRequest}from"./submitReservationRequest";export{default as submitReservationSuccess}from"./submitReservationSuccess";export{default as submitReservationError}from"./submitReservationError";export{default as requestProductInventories}from"./requestProductInventories";export{default as receiveProductInventories}from"./receiveProductInventories";export{default as errorProductInventories}from"./errorProductInventories";export{provideProductAlternativeLocation}from"./provideProductAlternativeLocation";export{default as requestInventories}from"./requestInventories";export{default as receiveInventories}from"./receiveInventories";export{default as errorInventories}from"./errorInventories";export{sendSetDefaultLocationCodeRequest,sendSetDefaultLocationCodeSuccess,sendSetDefaultLocationCodeError}from"./sendDefaultLocationCode";
@@ -1,6 +1,9 @@
1
- import{SELECT_LOCATION}from"../constants";/**
2
- * Creates the dispatched SELECT_LOCATION action object.
3
- * @param {Object} location The location data to store for the use.
4
- * @param {boolean} showToast Whether to show a toast message.
1
+ import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{ToastProvider}from'@shopgate/engage/core/providers';import{i18n}from'@shopgate/engage/core/helpers';import{UIEvents}from'@shopgate/engage/core/events';import{SELECT_LOCATION}from"../constants";import{sendDefaultLocationCode}from"../actions";/**
2
+ * @param {Object} params Action parameters.
3
+ * @param {Object} params.location A location object.
4
+ * @param {boolean} [params.showToast=false] Whether to show a toast message. That indicates the
5
+ * location change.
6
+ * @param {boolean} [params.skipLocationSync=false] When set to TRUE, the location will not be
7
+ * synchronized with the backend.
5
8
  * @returns {Object}
6
- */var selectLocation=function selectLocation(location,showToast){return{type:SELECT_LOCATION,location:location,showToast:showToast};};export default selectLocation;
9
+ */var selectLocation=function selectLocation(params){return(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch){var location,_params$showToast,showToast,_params$skipLocationS,skipLocationSync;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:location=params.location,_params$showToast=params.showToast,showToast=_params$showToast===void 0?false:_params$showToast,_params$skipLocationS=params.skipLocationSync,skipLocationSync=_params$skipLocationS===void 0?false:_params$skipLocationS;if(!(!skipLocationSync&&location&&(location===null||location===void 0?void 0:location.code))){_context.next=4;break;}_context.next=4;return dispatch(sendDefaultLocationCode(location.code));case 4:dispatch({type:SELECT_LOCATION,location:location,showToast:showToast});if(showToast&&(location===null||location===void 0?void 0:location.name)){UIEvents.emit(ToastProvider.ADD,{id:'location.changed',message:i18n.text('location.preferredLocationChanged',{storeName:location.name})});}case 6:case"end":return _context.stop();}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}());};export default selectLocation;
@@ -0,0 +1,14 @@
1
+ import{SEND_SET_DEFAULT_LOCATION_CODE_REQUEST,SEND_SET_DEFAULT_LOCATION_CODE_ERROR,SEND_SET_DEFAULT_LOCATION_CODE_SUCCESS}from"../constants";/**
2
+ * Creates the dispatched SEND_SET_DEFAULT_LOCATION_CODE_REQUEST action object.
3
+ * @param {number} locationCode The sent location code
4
+ * @returns {Object}
5
+ */export var sendSetDefaultLocationCodeRequest=function sendSetDefaultLocationCodeRequest(locationCode){return{type:SEND_SET_DEFAULT_LOCATION_CODE_REQUEST,locationCode:locationCode};};/**
6
+ * Creates the dispatched SEND_SET_DEFAULT_LOCATION_CODE_SUCCESS action object.
7
+ * @param {number} locationCode The sent location code
8
+ * @returns {Object}
9
+ */export var sendSetDefaultLocationCodeSuccess=function sendSetDefaultLocationCodeSuccess(locationCode){return{type:SEND_SET_DEFAULT_LOCATION_CODE_SUCCESS,locationCode:locationCode};};/**
10
+ * Creates the dispatched SEND_SET_DEFAULT_LOCATION_CODE_ERROR action object.
11
+ * @param {number} locationCode The sent location code
12
+ * @param {string} errorCode The error code
13
+ * @returns {Object}
14
+ */export var sendSetDefaultLocationCodeError=function sendSetDefaultLocationCodeError(locationCode,errorCode){return{type:SEND_SET_DEFAULT_LOCATION_CODE_ERROR,locationCode:locationCode,errorCode:errorCode};};
@@ -1,4 +1,4 @@
1
1
  import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{mutable}from'@shopgate/engage/core/helpers';import{PipelineRequest}from'@shopgate/engage/core/classes';import selectLocation from"../action-creators/selectLocation";import{getPreferredLocation}from"../selectors";/**
2
2
  * Fetches the default location of the user
3
3
  * @returns {Function} redux thunk
4
- */var fetchDefaultLocation=function fetchDefaultLocation(){return(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch,getState){var _getPreferredLocation;var request,_ref2,location,selectedLocationCode;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:request=new PipelineRequest('shopgate.user.getDefaultLocation').dispatch();_context.next=3;return request;case 3:_ref2=_context.sent;location=_ref2.location;selectedLocationCode=(_getPreferredLocation=getPreferredLocation(getState()))===null||_getPreferredLocation===void 0?void 0:_getPreferredLocation.code;if(selectedLocationCode!==(location===null||location===void 0?void 0:location.code)||location===null){dispatch(selectLocation(location));}return _context.abrupt("return",request);case 8:case"end":return _context.stop();}},_callee);}));return function(_x,_x2){return _ref.apply(this,arguments);};}());};export default mutable(fetchDefaultLocation);
4
+ */var fetchDefaultLocation=function fetchDefaultLocation(){return(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch,getState){var _getPreferredLocation;var request,_ref2,location,selectedLocationCode;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:request=new PipelineRequest('shopgate.user.getDefaultLocation').dispatch();_context.next=3;return request;case 3:_ref2=_context.sent;location=_ref2.location;selectedLocationCode=(_getPreferredLocation=getPreferredLocation(getState()))===null||_getPreferredLocation===void 0?void 0:_getPreferredLocation.code;if(!(selectedLocationCode!==(location===null||location===void 0?void 0:location.code)||location===null)){_context.next=9;break;}_context.next=9;return dispatch(selectLocation({location:location,skipLocationSync:true}));case 9:return _context.abrupt("return",request);case 10:case"end":return _context.stop();}},_callee);}));return function(_x,_x2){return _ref.apply(this,arguments);};}());};export default mutable(fetchDefaultLocation);
@@ -1,6 +1,6 @@
1
- import{PipelineRequest}from"../../core";/**
1
+ import{sendSetDefaultLocationCodeRequest,sendSetDefaultLocationCodeSuccess,sendSetDefaultLocationCodeError}from'@shopgate/engage/locations/action-creators';import{PipelineRequest}from"../../core";/**
2
2
  * pipeline call to shopgate.user.sendDefaultLocationCodeCode.v1
3
3
  * to set user default location in data base
4
4
  * @param {string} locationCode The location code to send to backend
5
5
  * @returns {Function} redux thunk
6
- */var sendDefaultLocationCode=function sendDefaultLocationCode(locationCode){return function(){return new PipelineRequest('shopgate.user.setDefaultLocationCode').setInput({locationCode:locationCode}).dispatch();};};export default sendDefaultLocationCode;
6
+ */var sendDefaultLocationCode=function sendDefaultLocationCode(locationCode){return function(dispatch){dispatch(sendSetDefaultLocationCodeRequest(locationCode));var request=new PipelineRequest('shopgate.user.setDefaultLocationCode').setInput({locationCode:locationCode}).dispatch();request.then(function(){dispatch(sendSetDefaultLocationCodeSuccess(locationCode));})["catch"](function(error){dispatch(sendSetDefaultLocationCodeError(locationCode,error.code));});return request;};};export default sendDefaultLocationCode;
@@ -1,4 +1,4 @@
1
- import React,{useCallback,useMemo}from'react';import PropTypes from'prop-types';import{connect}from'react-redux';import{getCurrentRoute}from'@shopgate/pwa-common/selectors/router';import{selectGlobalLocation}from'@shopgate/engage/locations/action-creators';import{getPreferredLocation,getIsPending}from"../../selectors";import{getIsLocationBasedShopping}from"../../../core/selectors";import{FulfillmentSheet}from"../FulfillmentSheet";import{STAGE_SELECT_STORE,MULTI_LINE_RESERVE}from"../../constants";/**
1
+ import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import React,{useCallback,useMemo}from'react';import PropTypes from'prop-types';import{connect}from'react-redux';import{getCurrentRoute}from'@shopgate/pwa-common/selectors/router';import{selectGlobalLocation}from'@shopgate/engage/locations/action-creators';import{getPreferredLocation,getIsPending}from"../../selectors";import{getIsLocationBasedShopping}from"../../../core/selectors";import{FulfillmentSheet}from"../FulfillmentSheet";import{STAGE_SELECT_STORE,MULTI_LINE_RESERVE}from"../../constants";/**
2
2
  * Maps state to props.
3
3
  * @param {Object} state State
4
4
  * @return {Object}
@@ -11,6 +11,6 @@ import React,{useCallback,useMemo}from'react';import PropTypes from'prop-types';
11
11
  * in location based shopping mode.
12
12
  * @param {Object} props Components props.
13
13
  * @return {Object}
14
- */var GlobalLocationSelector=function GlobalLocationSelector(_ref){var isLocationBasedShopping=_ref.isLocationBasedShopping,preferredLocation=_ref.preferredLocation,selectLocation=_ref.selectGlobalLocation,routePatternAllowList=_ref.routePatternAllowList,currentRoute=_ref.currentRoute,isPending=_ref.isPending;var closeSheetHandler=useCallback(function(location){if(location){selectLocation(location);}},[selectLocation]);var renderComponent=useMemo(function(){if(!currentRoute){return false;}var _ref2=currentRoute||{},pattern=_ref2.pattern;if(routePatternAllowList&&!routePatternAllowList.includes(pattern)){return false;}// Either when location based shopping is disabled or the customer
14
+ */var GlobalLocationSelector=function GlobalLocationSelector(_ref){var isLocationBasedShopping=_ref.isLocationBasedShopping,preferredLocation=_ref.preferredLocation,selectGlobalLocationProp=_ref.selectGlobalLocation,routePatternAllowList=_ref.routePatternAllowList,currentRoute=_ref.currentRoute,isPending=_ref.isPending;var closeSheetHandler=useCallback(/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(location){return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(location){selectGlobalLocationProp(location);}case 1:case"end":return _context.stop();}},_callee);}));return function(_x){return _ref2.apply(this,arguments);};}(),[selectGlobalLocationProp]);var renderComponent=useMemo(function(){if(!currentRoute){return false;}var _ref3=currentRoute||{},pattern=_ref3.pattern;if(routePatternAllowList&&!routePatternAllowList.includes(pattern)){return false;}// Either when location based shopping is disabled or the customer
15
15
  // already chose a location we skip the dialog.
16
16
  return!isPending&&isLocationBasedShopping&&!preferredLocation;},[currentRoute,isLocationBasedShopping,isPending,preferredLocation,routePatternAllowList]);if(!renderComponent){return null;}return React.createElement(FulfillmentSheet,{stage:STAGE_SELECT_STORE,fulfillmentPath:MULTI_LINE_RESERVE,allowClose:false,onClose:closeSheetHandler,isInitialized:true,noProduct:true,noInventory:true,changeOnly:true,open:true});};GlobalLocationSelector.defaultProps={preferredLocation:null,isLocationBasedShopping:false,routePatternAllowList:null,currentRoute:null,isPending:false};export default connect(mapStateToProps,mapDispatchToProps)(GlobalLocationSelector);
@@ -1,3 +1,5 @@
1
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,{Fragment,useCallback,useState,useMemo}from'react';import PropTypes from'prop-types';import{FulfillmentSheet}from"../FulfillmentSheet";import{STAGE_SELECT_STORE,MULTI_LINE_RESERVE}from"../../constants";import GlobalLocationSwitcherDefault from"./GlobalLocationSwitcherDefault";import GlobalLocationSwitcherBar from"./GlobalLocationSwitcherBar";import connect from"./GlobalLocationSwitcher.connector";/**
2
2
  * @returns {JSX}
3
- */var GlobalLocationSwitcher=function GlobalLocationSwitcher(_ref){var isLocationBasedShopping=_ref.isLocationBasedShopping,preferredLocation=_ref.preferredLocation,renderBar=_ref.renderBar,standalone=_ref.standalone,selectGlobalLocation=_ref.selectGlobalLocation,editable=_ref.editable;var _useState=useState(false),_useState2=_slicedToArray(_useState,2),sheetOpen=_useState2[0],setSheetOpen=_useState2[1];var changeLocationHandler=useCallback(function(){setSheetOpen(true);},[]);var closeSheetHandler=useCallback(function(location){setSheetOpen(false);if(location){selectGlobalLocation(location);}},[selectGlobalLocation]);var locationName=useMemo(function(){return(preferredLocation===null||preferredLocation===void 0?void 0:preferredLocation.name)||null;},[preferredLocation]);if(!isLocationBasedShopping||!preferredLocation){return null;}return React.createElement(Fragment,null,renderBar?React.createElement(GlobalLocationSwitcherBar,{locationName:locationName,handleChange:changeLocationHandler,standalone:standalone}):React.createElement(GlobalLocationSwitcherDefault,{locationName:locationName,handleChange:changeLocationHandler,standalone:standalone,editable:editable}),sheetOpen&&React.createElement(FulfillmentSheet,{stage:STAGE_SELECT_STORE,fulfillmentPath:MULTI_LINE_RESERVE,allowClose:true,onClose:closeSheetHandler,isInitialized:true,noProduct:true,noInventory:true,changeOnly:true,open:true}));};GlobalLocationSwitcher.defaultProps={isLocationBasedShopping:false,preferredLocation:null,renderBar:false,editable:true,standalone:false};export default connect(GlobalLocationSwitcher);
3
+ */var GlobalLocationSwitcher=function GlobalLocationSwitcher(_ref){var isLocationBasedShopping=_ref.isLocationBasedShopping,preferredLocation=_ref.preferredLocation,renderBar=_ref.renderBar,standalone=_ref.standalone,selectGlobalLocation=_ref.selectGlobalLocation,editable=_ref.editable;var _useState=useState(false),_useState2=_slicedToArray(_useState,2),sheetOpen=_useState2[0],setSheetOpen=_useState2[1];var changeLocationHandler=useCallback(function(){setSheetOpen(true);},[]);var closeSheetHandler=useCallback(function(location){setSheetOpen(false);if(location&&location.code!==(preferredLocation===null||preferredLocation===void 0?void 0:preferredLocation.code)){// Only dispatch selectGlobalLocation when location really changed, since this action
4
+ // might clear product data from the resultsByHash product storage.
5
+ selectGlobalLocation(location);}},[preferredLocation,selectGlobalLocation]);var locationName=useMemo(function(){return(preferredLocation===null||preferredLocation===void 0?void 0:preferredLocation.name)||null;},[preferredLocation]);if(!isLocationBasedShopping||!preferredLocation){return null;}return React.createElement(Fragment,null,renderBar?React.createElement(GlobalLocationSwitcherBar,{locationName:locationName,handleChange:changeLocationHandler,standalone:standalone}):React.createElement(GlobalLocationSwitcherDefault,{locationName:locationName,handleChange:changeLocationHandler,standalone:standalone,editable:editable}),sheetOpen&&React.createElement(FulfillmentSheet,{stage:STAGE_SELECT_STORE,fulfillmentPath:MULTI_LINE_RESERVE,allowClose:true,onClose:closeSheetHandler,isInitialized:true,noProduct:true,noInventory:true,changeOnly:true,open:true}));};GlobalLocationSwitcher.defaultProps={isLocationBasedShopping:false,preferredLocation:null,renderBar:false,editable:true,standalone:false};export default connect(GlobalLocationSwitcher);
@@ -1,6 +1,7 @@
1
1
  // USER
2
2
  export var SELECT_LOCATION='SELECT_LOCATION';export var SELECT_GLOBAL_LOCATION='SELECT_GLOBAL_LOCATION';export var STORE_FORM_INPUT='STORE_FORM_INPUT';export var STORE_FULFILLMENT_METHOD='STORE_FULFILLMENT_METHOD';export var SET_USER_SEARCH_COUNTRY_CODE='SET_USER_SEARCH_COUNTRY_CODE';export var SET_USER_SEARCH_POSTAL_CODE='SET_USER_SEARCH_POSTAL_CODE';export var SET_USER_SEARCH_GEOLOCATION='SET_USER_SEARCH_GEOLOCATION';export var SET_USER_GEOLOCATION='SET_USER_GEOLOCATION';export var SET_STORE_FINDER_SEARCH_RADIUS='SET_STORE_FINDER_SEARCH_RADIUS';export var SET_LOCATIONS_PENDING='SET_LOCATIONS_PENDING';// LOCATIONS
3
- export var REQUEST_LOCATIONS='REQUEST_LOCATIONS';export var RECEIVE_LOCATIONS='RECEIVE_LOCATIONS';export var ERROR_LOCATIONS='ERROR_LOCATIONS';export var PROVIDE_PRODUCT_ALTERNATIVE_LOCATION='PROVIDE_PRODUCT_ALTERNATIVE_LOCATION';// PRODUCT LOCATIONS
3
+ export var REQUEST_LOCATIONS='REQUEST_LOCATIONS';export var RECEIVE_LOCATIONS='RECEIVE_LOCATIONS';export var ERROR_LOCATIONS='ERROR_LOCATIONS';export var PROVIDE_PRODUCT_ALTERNATIVE_LOCATION='PROVIDE_PRODUCT_ALTERNATIVE_LOCATION';// SEND SET DEFAULT LOCATION CODE REQUEST
4
+ export var SEND_SET_DEFAULT_LOCATION_CODE_REQUEST='SEND_SET_DEFAULT_LOCATION_CODE_REQUEST';export var SEND_SET_DEFAULT_LOCATION_CODE_SUCCESS='SEND_SET_DEFAULT_LOCATION_CODE_SUCCESS';export var SEND_SET_DEFAULT_LOCATION_CODE_ERROR='SEND_SET_DEFAULT_LOCATION_CODE_ERROR';// PRODUCT LOCATIONS
4
5
  export var REQUEST_PRODUCT_LOCATIONS='REQUEST_PRODUCT_LOCATIONS';export var RECEIVE_PRODUCT_LOCATIONS='RECEIVE_PRODUCT_LOCATIONS';export var ERROR_PRODUCT_LOCATIONS='ERROR_PRODUCT_LOCATIONS';// Does not belong here.
5
6
  // TODO: Put into a 'fulfillment' domain in engage package.
6
7
  // PRODUCT INVENTORIES
@@ -1,5 +1,5 @@
1
1
  // ACTION TYPES
2
- export{REQUEST_LOCATIONS,RECEIVE_LOCATIONS,ERROR_LOCATIONS,REQUEST_PRODUCT_INVENTORIES,RECEIVE_PRODUCT_INVENTORIES,ERROR_PRODUCT_INVENTORIES,REQUEST_INVENTORIES,RECEIVE_INVENTORIES,ERROR_INVENTORIES,SELECT_LOCATION,SELECT_GLOBAL_LOCATION,STORE_FORM_INPUT,STORE_FULFILLMENT_METHOD,SET_USER_SEARCH_COUNTRY_CODE,SET_USER_SEARCH_POSTAL_CODE,SET_USER_SEARCH_GEOLOCATION,SET_USER_GEOLOCATION,SET_STORE_FINDER_SEARCH_RADIUS,REQUEST_PRODUCT_LOCATIONS,RECEIVE_PRODUCT_LOCATIONS,ERROR_PRODUCT_LOCATIONS,SUBMIT_RESERVATION_REQUEST,SUBMIT_RESERVATION_SUCCESS,SUBMIT_RESERVATION_ERROR,FETCH_FULFILLMENT_SLOTS_ERROR,FETCH_FULFILLMENT_SLOTS_SUCCESS,PROVIDE_PRODUCT_ALTERNATIVE_LOCATION}from"./ActionTypes";// PIPELINES
2
+ export{REQUEST_LOCATIONS,RECEIVE_LOCATIONS,ERROR_LOCATIONS,REQUEST_PRODUCT_INVENTORIES,RECEIVE_PRODUCT_INVENTORIES,ERROR_PRODUCT_INVENTORIES,REQUEST_INVENTORIES,RECEIVE_INVENTORIES,ERROR_INVENTORIES,SELECT_LOCATION,SELECT_GLOBAL_LOCATION,STORE_FORM_INPUT,STORE_FULFILLMENT_METHOD,SET_USER_SEARCH_COUNTRY_CODE,SET_USER_SEARCH_POSTAL_CODE,SET_USER_SEARCH_GEOLOCATION,SET_USER_GEOLOCATION,SET_STORE_FINDER_SEARCH_RADIUS,REQUEST_PRODUCT_LOCATIONS,RECEIVE_PRODUCT_LOCATIONS,ERROR_PRODUCT_LOCATIONS,SUBMIT_RESERVATION_REQUEST,SUBMIT_RESERVATION_SUCCESS,SUBMIT_RESERVATION_ERROR,FETCH_FULFILLMENT_SLOTS_ERROR,FETCH_FULFILLMENT_SLOTS_SUCCESS,PROVIDE_PRODUCT_ALTERNATIVE_LOCATION,SEND_SET_DEFAULT_LOCATION_CODE_REQUEST,SEND_SET_DEFAULT_LOCATION_CODE_SUCCESS,SEND_SET_DEFAULT_LOCATION_CODE_ERROR}from"./ActionTypes";// PIPELINES
3
3
  export{SHOPGATE_STOREFRONT_GET_PRODUCT_LOCATIONS,SHOPGATE_STOREFRONT_CREATE_ORDER,SHOPGATE_STOREFRONT_GET_LOCATIONS,SHOPGATE_STOREFRONT_GET_PRODUCT_INVENTORIES,SHOPGATE_STOREFRONT_GET_INVENTORIES}from"./Pipelines";// PORTALS
4
4
  export{PRODUCT_FULFILLMENT_SELECTOR,PRODUCT_LOCATION_STOCK_INFO}from"./Portals";export var DIRECT_SHIP='directShip';export var DIRECT_SHIP_LABEL='locations.fulfillment.direct_ship';export var IN_STORE_PICKUP_BOPIS='inStorePickupBOPIS';export var IN_STORE_PICKUP_BOPIS_LABEL='locations.fulfillment.bopis';export var IN_STORE_PICKUP_ROPIS='inStorePickupROPIS';export var IN_STORE_PICKUP_ROPIS_LABEL='locations.fulfillment.ropis';export var ROPIS='ROPIS';export var BOPIS='BOPIS';export var QUICK_RESERVE='quickReserve';export var MULTI_LINE_RESERVE='multiLineReserve';export var SORT_CLOSEST_LOCATION='closestLocation';export var SORT_CLOSEST_LOCATION_WITH_INVENTORY='closestLocationWithInventory';export var DEFAULT_ROPE_FULFILLMENT_METHOD='defaultRopeFulfillmentMethod';export var USER_SEARCH_GEOLOCATION_LIFETIME=3e5;// 5 minutes for geolocation expire
5
5
  export var NEARBY_LOCATIONS_LIMIT=8;// 25 miles in km
@@ -3,7 +3,7 @@ export{fetchProductLocations}from"./actions";// COMPONENTS
3
3
  export{FulfillmentSelector,FulfillmentSheet,FulfillmentPathSelector,StoreList,StoreAddress,StoreOpeningHours,StorePhoneNumber,CartItemProductChangeLocation,CartChangeFulfillmentMethod,CartContextMenuItemChangeLocation,CartContextMenuItemChangeFulfillment,CartContextMenuChangeFulfillment,GlobalLocationSelector,GlobalLocationSwitcher,FulfillmentSlotSwitcher,StoreFinder,StockInfoLists}from"./components";// CONSTANTS
4
4
  export{PRODUCT_FULFILLMENT_SELECTOR,PRODUCT_LOCATION_STOCK_INFO,DIRECT_SHIP,DIRECT_SHIP_LABEL,IN_STORE_PICKUP_BOPIS_LABEL,IN_STORE_PICKUP_ROPIS_LABEL,ROPIS,BOPIS,DEFAULT_ROPE_FULFILLMENT_METHOD,QUICK_RESERVE,MULTI_LINE_RESERVE,STAGE_SELECT_STORE,STAGE_RESERVE_FORM,STAGE_RESPONSE_SUCCESS,STAGE_RESPONSE_ERROR,STAGE_FULFILLMENT_METHOD,STORE_FINDER_PATTERN}from"./constants";// SELECTORS
5
5
  export*from"./selectors";// STREAMS
6
- export{submitReservationSuccess$,preferredLocationDidUpdate$,preferredLocationDidUpdateGlobal$,preferredLocationDidUpdateGlobalNotOnCategory$,preferredLocationDidUpdateGlobalOnCategory$,preferredLocationDidUpdateGlobalNotOnSearch$,preferredLocationDidUpdateGlobalOnSearch$}from"./locations.streams";// HOOKS
6
+ export{submitReservationSuccess$,preferredLocationDidUpdate$,preferredLocationDidUpdateGlobal$,preferredLocationDidUpdateGlobalNotOnCategory$,preferredLocationDidUpdateGlobalOnCategory$,preferredLocationDidUpdateGlobalNotOnSearch$,preferredLocationDidUpdateGlobalOnSearch$,sendDefaultLocationCodeSuccess$}from"./locations.streams";// HOOKS
7
7
  export{useFulfillmentState}from"./locations.hooks";// TYPES
8
8
  // CONTEXT
9
9
  export{FulfillmentContext}from"./locations.context";
@@ -1 +1,3 @@
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{main$}from'@shopgate/pwa-common/streams';import{Observable}from'rxjs/Observable';import{cartReceived$}from'@shopgate/pwa-common-commerce/cart/streams';import{makeGetRoutePattern,getCurrentState,getCurrentRoute}from'@shopgate/pwa-common/selectors/router';import{routeWillEnter$}from'@shopgate/pwa-common/streams/router';import{ITEM_PATTERN}from'@shopgate/pwa-common-commerce/product/constants';import{getProductDataById}from'@shopgate/pwa-common-commerce/product/selectors/product';import{SEARCH_PATTERN}from'@shopgate/pwa-common-commerce/search/constants';import{CATEGORY_PATTERN}from'@shopgate/pwa-common-commerce/category/constants';import{FAVORITES_PATH}from'@shopgate/pwa-common-commerce/favorites/constants';import{SUBMIT_RESERVATION_SUCCESS,RECEIVE_PRODUCT_LOCATIONS,RECEIVE_LOCATIONS,SET_USER_SEARCH_COUNTRY_CODE,SET_USER_SEARCH_POSTAL_CODE,SET_USER_SEARCH_GEOLOCATION,SET_STORE_FINDER_SEARCH_RADIUS,SELECT_GLOBAL_LOCATION,STORE_FINDER_PATTERN,PROVIDE_PRODUCT_ALTERNATIVE_LOCATION,SELECT_LOCATION,STORE_DETAILS_PATTERN}from"./constants";import{RECEIVE_ORDER_DETAILS}from"../orders/constants";import{WISH_LIST_PATH}from"../account/constants";export var submitReservationSuccess$=main$.filter(function(_ref){var action=_ref.action;return action.type===SUBMIT_RESERVATION_SUCCESS;});export var receiveProductLocations$=main$.filter(function(_ref2){var action=_ref2.action;return action.type===RECEIVE_PRODUCT_LOCATIONS;});export var receiveOrderDetails$=main$.filter(function(_ref3){var action=_ref3.action;return action.type===RECEIVE_ORDER_DETAILS;});export var cartReceivedWithROPE$=cartReceived$.filter(function(_ref4){var _ref4$action$cart=_ref4.action.cart,_ref4$action$cart2=_ref4$action$cart===void 0?{}:_ref4$action$cart,_ref4$action$cart2$ca=_ref4$action$cart2.cartItems,cartItems=_ref4$action$cart2$ca===void 0?[]:_ref4$action$cart2$ca;return cartItems.some(function(item){var _item$fulfillment,_item$fulfillment$loc;return item===null||item===void 0?void 0:(_item$fulfillment=item.fulfillment)===null||_item$fulfillment===void 0?void 0:(_item$fulfillment$loc=_item$fulfillment.location)===null||_item$fulfillment$loc===void 0?void 0:_item$fulfillment$loc.code;});});export var userSearchChanged$=main$.filter(function(_ref5){var action=_ref5.action;return action.type===SET_USER_SEARCH_COUNTRY_CODE||action.type===SET_USER_SEARCH_POSTAL_CODE||action.type===SET_USER_SEARCH_GEOLOCATION||action.type===SET_STORE_FINDER_SEARCH_RADIUS;});export var fulfillmentLocationsReceivedFromProduct$=receiveProductLocations$.switchMap(function(data){var locations=data.action.locations;var locationCodes=locations.map(function(_ref6){var code=_ref6.code;return code;});return Observable.of(_extends({},data,{locationCodes:locationCodes}));});export var fulfillmentLocationsReceivedFromCart$=cartReceivedWithROPE$.switchMap(function(data){var _data$action$cart=data.action.cart,_data$action$cart2=_data$action$cart===void 0?{}:_data$action$cart,_data$action$cart2$ca=_data$action$cart2.cartItems,cartItems=_data$action$cart2$ca===void 0?[]:_data$action$cart2$ca;var locationCodes=cartItems.map(function(item){var _item$fulfillment2,_item$fulfillment2$lo;return item===null||item===void 0?void 0:(_item$fulfillment2=item.fulfillment)===null||_item$fulfillment2===void 0?void 0:(_item$fulfillment2$lo=_item$fulfillment2.location)===null||_item$fulfillment2$lo===void 0?void 0:_item$fulfillment2$lo.code;}).filter(Boolean);locationCodes=Array.from(new Set(locationCodes));return Observable.of(_extends({},data,{locationCodes:locationCodes}));});export var fulfillmentLocationsReceivedFromOrder$=receiveOrderDetails$.filter(function(_ref7){var _ref7$action$order=_ref7.action.order,_ref7$action$order2=_ref7$action$order===void 0?{}:_ref7$action$order,_ref7$action$order2$l=_ref7$action$order2.lineItems,lineItems=_ref7$action$order2$l===void 0?[]:_ref7$action$order2$l;return lineItems.some(function(item){return item.fulfillmentLocationCode;});}).switchMap(function(data){var _data$action$order=data.action.order,_data$action$order2=_data$action$order===void 0?{}:_data$action$order,_data$action$order2$l=_data$action$order2.lineItems,lineItems=_data$action$order2$l===void 0?[]:_data$action$order2$l;var locationCodes=lineItems.map(function(item){return item===null||item===void 0?void 0:item.fulfillmentLocationCode;}).filter(Boolean);locationCodes=Array.from(new Set(locationCodes));return Observable.of(_extends({},data,{locationCodes:locationCodes}));});export var fulfillmentLocationsReceived$=fulfillmentLocationsReceivedFromCart$.merge(fulfillmentLocationsReceivedFromOrder$).merge(fulfillmentLocationsReceivedFromProduct$);export var preferredLocationDidUpdateGlobal$=main$.filter(function(_ref8){var action=_ref8.action;return action.type===SELECT_GLOBAL_LOCATION;});export var preferredLocationDidUpdateGlobalOnWishlist$=preferredLocationDidUpdateGlobal$.filter(function(_ref9){var getState=_ref9.getState;var _getCurrentRoute=getCurrentRoute(getState()),pattern=_getCurrentRoute.pattern;return pattern===FAVORITES_PATH||pattern===WISH_LIST_PATH;});export var preferredLocationDidUpdateGlobalOnSearch$=preferredLocationDidUpdateGlobal$.filter(function(_ref10){var getState=_ref10.getState;var _getCurrentRoute2=getCurrentRoute(getState()),pattern=_getCurrentRoute2.pattern;return pattern===SEARCH_PATTERN;});export var preferredLocationDidUpdateGlobalNotOnSearch$=preferredLocationDidUpdateGlobal$.filter(function(_ref11){var getState=_ref11.getState;var _getCurrentRoute3=getCurrentRoute(getState()),pattern=_getCurrentRoute3.pattern;return pattern!==SEARCH_PATTERN;});export var preferredLocationDidUpdateGlobalOnCategory$=preferredLocationDidUpdateGlobal$.filter(function(_ref12){var getState=_ref12.getState;var _getCurrentRoute4=getCurrentRoute(getState()),pattern=_getCurrentRoute4.pattern;return pattern===CATEGORY_PATTERN;});export var preferredLocationDidUpdateGlobalNotOnCategory$=preferredLocationDidUpdateGlobal$.filter(function(_ref13){var getState=_ref13.getState;var _getCurrentRoute5=getCurrentRoute(getState()),pattern=_getCurrentRoute5.pattern;return pattern!==CATEGORY_PATTERN;});export var preferredLocationDidUpdate$=main$.filter(function(_ref14){var action=_ref14.action;return action.type===SELECT_LOCATION;});export var storeFinderWillEnter$=routeWillEnter$.filter(function(_ref15){var action=_ref15.action;return action.route.pattern===STORE_FINDER_PATTERN;});export var receiveLocations$=main$.filter(function(_ref16){var action=_ref16.action;return action.type===RECEIVE_LOCATIONS;});export var provideAlternativeLocation$=main$.filter(function(_ref17){var action=_ref17.action;return action.type===PROVIDE_PRODUCT_ALTERNATIVE_LOCATION;});export var preferredLocationDidUpdateOnPDP$=preferredLocationDidUpdateGlobal$.filter(function(_ref18){var getState=_ref18.getState;var getRoutePattern=makeGetRoutePattern();var routePattern=getRoutePattern(getState());return routePattern===ITEM_PATTERN;}).switchMap(function(_ref19){var dispatch=_ref19.dispatch,getState=_ref19.getState,action=_ref19.action;var state=getState();var _getCurrentState=getCurrentState(state),productId=_getCurrentState.productId;var productData=getProductDataById(state,{productId:productId});return Observable.of({action:_extends({},action,{productData:productData}),dispatch:dispatch,getState:getState});});export var storeDetailPageWillEnter$=routeWillEnter$.filter(function(_ref20){var action=_ref20.action;return action.route.pattern===STORE_DETAILS_PATTERN;});
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{main$}from'@shopgate/pwa-common/streams';import{Observable}from'rxjs/Observable';import{cartReceived$}from'@shopgate/pwa-common-commerce/cart/streams';import{makeGetRoutePattern,getCurrentState,getCurrentRoute}from'@shopgate/pwa-common/selectors/router';import{routeWillEnter$}from'@shopgate/pwa-common/streams/router';import{ITEM_PATTERN}from'@shopgate/pwa-common-commerce/product/constants';import{getProductDataById}from'@shopgate/pwa-common-commerce/product/selectors/product';import{SEARCH_PATTERN}from'@shopgate/pwa-common-commerce/search/constants';import{CATEGORY_PATTERN}from'@shopgate/pwa-common-commerce/category/constants';import{FAVORITES_PATH}from'@shopgate/pwa-common-commerce/favorites/constants';import{SUBMIT_RESERVATION_SUCCESS,RECEIVE_PRODUCT_LOCATIONS,RECEIVE_LOCATIONS,SET_USER_SEARCH_COUNTRY_CODE,SET_USER_SEARCH_POSTAL_CODE,SET_USER_SEARCH_GEOLOCATION,SET_STORE_FINDER_SEARCH_RADIUS,SELECT_GLOBAL_LOCATION,STORE_FINDER_PATTERN,PROVIDE_PRODUCT_ALTERNATIVE_LOCATION,SELECT_LOCATION,STORE_DETAILS_PATTERN,SEND_SET_DEFAULT_LOCATION_CODE_SUCCESS}from"./constants";import{RECEIVE_ORDER_DETAILS}from"../orders/constants";import{WISH_LIST_PATH}from"../account/constants";export var submitReservationSuccess$=main$.filter(function(_ref){var action=_ref.action;return action.type===SUBMIT_RESERVATION_SUCCESS;});export var receiveProductLocations$=main$.filter(function(_ref2){var action=_ref2.action;return action.type===RECEIVE_PRODUCT_LOCATIONS;});export var receiveOrderDetails$=main$.filter(function(_ref3){var action=_ref3.action;return action.type===RECEIVE_ORDER_DETAILS;});export var cartReceivedWithROPE$=cartReceived$.filter(function(_ref4){var _ref4$action$cart=_ref4.action.cart,_ref4$action$cart2=_ref4$action$cart===void 0?{}:_ref4$action$cart,_ref4$action$cart2$ca=_ref4$action$cart2.cartItems,cartItems=_ref4$action$cart2$ca===void 0?[]:_ref4$action$cart2$ca;return cartItems.some(function(item){var _item$fulfillment,_item$fulfillment$loc;return item===null||item===void 0?void 0:(_item$fulfillment=item.fulfillment)===null||_item$fulfillment===void 0?void 0:(_item$fulfillment$loc=_item$fulfillment.location)===null||_item$fulfillment$loc===void 0?void 0:_item$fulfillment$loc.code;});});export var userSearchChanged$=main$.filter(function(_ref5){var action=_ref5.action;return action.type===SET_USER_SEARCH_COUNTRY_CODE||action.type===SET_USER_SEARCH_POSTAL_CODE||action.type===SET_USER_SEARCH_GEOLOCATION||action.type===SET_STORE_FINDER_SEARCH_RADIUS;});export var fulfillmentLocationsReceivedFromProduct$=receiveProductLocations$.switchMap(function(data){var locations=data.action.locations;var locationCodes=locations.map(function(_ref6){var code=_ref6.code;return code;});return Observable.of(_extends({},data,{locationCodes:locationCodes}));});export var fulfillmentLocationsReceivedFromCart$=cartReceivedWithROPE$.switchMap(function(data){var _data$action$cart=data.action.cart,_data$action$cart2=_data$action$cart===void 0?{}:_data$action$cart,_data$action$cart2$ca=_data$action$cart2.cartItems,cartItems=_data$action$cart2$ca===void 0?[]:_data$action$cart2$ca;var locationCodes=cartItems.map(function(item){var _item$fulfillment2,_item$fulfillment2$lo;return item===null||item===void 0?void 0:(_item$fulfillment2=item.fulfillment)===null||_item$fulfillment2===void 0?void 0:(_item$fulfillment2$lo=_item$fulfillment2.location)===null||_item$fulfillment2$lo===void 0?void 0:_item$fulfillment2$lo.code;}).filter(Boolean);locationCodes=Array.from(new Set(locationCodes));return Observable.of(_extends({},data,{locationCodes:locationCodes}));});export var fulfillmentLocationsReceivedFromOrder$=receiveOrderDetails$.filter(function(_ref7){var _ref7$action$order=_ref7.action.order,_ref7$action$order2=_ref7$action$order===void 0?{}:_ref7$action$order,_ref7$action$order2$l=_ref7$action$order2.lineItems,lineItems=_ref7$action$order2$l===void 0?[]:_ref7$action$order2$l;return lineItems.some(function(item){return item.fulfillmentLocationCode;});}).switchMap(function(data){var _data$action$order=data.action.order,_data$action$order2=_data$action$order===void 0?{}:_data$action$order,_data$action$order2$l=_data$action$order2.lineItems,lineItems=_data$action$order2$l===void 0?[]:_data$action$order2$l;var locationCodes=lineItems.map(function(item){return item===null||item===void 0?void 0:item.fulfillmentLocationCode;}).filter(Boolean);locationCodes=Array.from(new Set(locationCodes));return Observable.of(_extends({},data,{locationCodes:locationCodes}));});export var fulfillmentLocationsReceived$=fulfillmentLocationsReceivedFromCart$.merge(fulfillmentLocationsReceivedFromOrder$).merge(fulfillmentLocationsReceivedFromProduct$);export var preferredLocationDidUpdateGlobal$=main$.filter(function(_ref8){var action=_ref8.action;return action.type===SELECT_GLOBAL_LOCATION;});export var preferredLocationDidUpdateGlobalOnWishlist$=preferredLocationDidUpdateGlobal$.filter(function(_ref9){var getState=_ref9.getState;var _getCurrentRoute=getCurrentRoute(getState()),pattern=_getCurrentRoute.pattern;return pattern===FAVORITES_PATH||pattern===WISH_LIST_PATH;});export var preferredLocationDidUpdateGlobalOnSearch$=preferredLocationDidUpdateGlobal$.filter(function(_ref10){var getState=_ref10.getState;var _getCurrentRoute2=getCurrentRoute(getState()),pattern=_getCurrentRoute2.pattern;return pattern===SEARCH_PATTERN;});export var preferredLocationDidUpdateGlobalNotOnSearch$=preferredLocationDidUpdateGlobal$.filter(function(_ref11){var getState=_ref11.getState;var _getCurrentRoute3=getCurrentRoute(getState()),pattern=_getCurrentRoute3.pattern;return pattern!==SEARCH_PATTERN;});export var preferredLocationDidUpdateGlobalOnCategory$=preferredLocationDidUpdateGlobal$.filter(function(_ref12){var getState=_ref12.getState;var _getCurrentRoute4=getCurrentRoute(getState()),pattern=_getCurrentRoute4.pattern;return pattern===CATEGORY_PATTERN;});export var preferredLocationDidUpdateGlobalNotOnCategory$=preferredLocationDidUpdateGlobal$.filter(function(_ref13){var getState=_ref13.getState;var _getCurrentRoute5=getCurrentRoute(getState()),pattern=_getCurrentRoute5.pattern;return pattern!==CATEGORY_PATTERN;});/**
2
+ * Emits when users select a new location
3
+ */export var preferredLocationDidUpdate$=main$.filter(function(_ref14){var action=_ref14.action;return action.type===SELECT_LOCATION;});export var storeFinderWillEnter$=routeWillEnter$.filter(function(_ref15){var action=_ref15.action;return action.route.pattern===STORE_FINDER_PATTERN;});export var receiveLocations$=main$.filter(function(_ref16){var action=_ref16.action;return action.type===RECEIVE_LOCATIONS;});export var provideAlternativeLocation$=main$.filter(function(_ref17){var action=_ref17.action;return action.type===PROVIDE_PRODUCT_ALTERNATIVE_LOCATION;});export var preferredLocationDidUpdateOnPDP$=preferredLocationDidUpdateGlobal$.filter(function(_ref18){var getState=_ref18.getState;var getRoutePattern=makeGetRoutePattern();var routePattern=getRoutePattern(getState());return routePattern===ITEM_PATTERN;}).switchMap(function(_ref19){var dispatch=_ref19.dispatch,getState=_ref19.getState,action=_ref19.action;var state=getState();var _getCurrentState=getCurrentState(state),productId=_getCurrentState.productId;var productData=getProductDataById(state,{productId:productId});return Observable.of({action:_extends({},action,{productData:productData}),dispatch:dispatch,getState:getState});});export var storeDetailPageWillEnter$=routeWillEnter$.filter(function(_ref20){var action=_ref20.action;return action.route.pattern===STORE_DETAILS_PATTERN;});export var sendDefaultLocationCodeSuccess$=main$.filter(function(_ref21){var action=_ref21.action;return action.type===SEND_SET_DEFAULT_LOCATION_CODE_SUCCESS;});
@@ -2,7 +2,8 @@ import _regeneratorRuntime from"@babel/runtime/regenerator";function _extends(){
2
2
  * Provides the fulfillment context.
3
3
  * @param {Object} props The component props.
4
4
  * @returns {JSX}
5
- */function FulfillmentProvider(props){var children=props.children,locations=props.locations,propsBaseProduct=props.baseProduct,propsProduct=props.product,productLocation=props.location,inventory=props.inventory,userInput=props.userInput,defaultFulfillmentMethod=props.fulfillmentMethod,defaultFulfillmentPath=props.fulfillmentPath,fulfillmentPaths=props.fulfillmentPaths,fulfillmentMethods=props.fulfillmentMethods,enabledFulfillmentMethods=props.enabledFulfillmentMethods,shopSettings=props.shopSettings,selectLocation=props.selectLocation,submitReservation=props.submitReservation,storeFormInput=props.storeFormInput,updateProductsInCart=props.updateProductsInCart,isFetching=props.isFetching,_props$noInventory=props.noInventory,noInventory=_props$noInventory===void 0?false:_props$noInventory,_props$open=props.open,open=_props$open===void 0?false:_props$open,_props$noLocationSele=props.noLocationSelection,noLocationSelection=_props$noLocationSele===void 0?false:_props$noLocationSele,_props$isStoreFinder=props.isStoreFinder,isStoreFinder=_props$isStoreFinder===void 0?false:_props$isStoreFinder,_props$isCart=props.isCart,isCart=_props$isCart===void 0?false:_props$isCart,defaultIsInitialized=props.isInitialized,updatePreferredLocation=props.updatePreferredLocation,_props$restrictMultiL=props.restrictMultiLocationOrders,restrictMultiLocationOrders=_props$restrictMultiL===void 0?false:_props$restrictMultiL,_props$cartProducts=props.cartProducts,cartProducts=_props$cartProducts===void 0?[]:_props$cartProducts,showModal=props.showModal,_props$fulfillmentSch=props.fulfillmentSchedulingEnabled,fulfillmentSchedulingEnabled=_props$fulfillmentSch===void 0?null:_props$fulfillmentSch,_props$activeFulfillm=props.activeFulfillmentSlot,activeFulfillmentSlot=_props$activeFulfillm===void 0?null:_props$activeFulfillm,_props$activeFulfillm2=props.activeFulfillmentSlotLocationCode,activeFulfillmentSlotLocationCode=_props$activeFulfillm2===void 0?null:_props$activeFulfillm2;var _useState=useState(defaultFulfillmentPath||null),_useState2=_slicedToArray(_useState,2),fulfillmentPath=_useState2[0],setFulfillmentPath=_useState2[1];var _useState3=useState(props.changeOnly),_useState4=_slicedToArray(_useState3,2),changeOnly=_useState4[0],setChangeOnly=_useState4[1];var _useState5=useState(open),_useState6=_slicedToArray(_useState5,2),isOpen=_useState6[0],setIsOpen=_useState6[1];var _useState7=useState(props.stage||null),_useState8=_slicedToArray(_useState7,2),stage=_useState8[0],setStage=_useState8[1];var _useState9=useState(null),_useState10=_slicedToArray(_useState9,2),fulfillmentMethod=_useState10[0],setFulfillmentMethod=_useState10[1];var _useState11=useState(null),_useState12=_slicedToArray(_useState11,2),orderNumbers=_useState12[0],setOrderNumbers=_useState12[1];var _useState13=useState(null),_useState14=_slicedToArray(_useState13,2),errors=_useState14[0],setErrors=_useState14[1];var _useState15=useState(propsProduct),_useState16=_slicedToArray(_useState15,2),product=_useState16[0],setProduct=_useState16[1];var _useState17=useState(false),_useState18=_slicedToArray(_useState17,2),isChangeFulfillment=_useState18[0],setIsChangeFulfillment=_useState18[1];var _useState19=useState(null),_useState20=_slicedToArray(_useState19,2),cartItem=_useState20[0],setCartItem=_useState20[1];var _useState21=useState(productLocation),_useState22=_slicedToArray(_useState21,2),storeFinderLocation=_useState22[0],setStoreFinderLocation=_useState22[1];var _useState23=useState(!isFetching),_useState24=_slicedToArray(_useState23,2),isLoading=_useState24[0],setIsLoading=_useState24[1];var isInitialized=useRef(defaultIsInitialized);useEffect(function(){if(defaultFulfillmentMethod){setFulfillmentMethod(defaultFulfillmentMethod);}},[defaultFulfillmentMethod]);var title=useMemo(function(){if(props.title!==null){return i18n.text(props.title);}switch(stage){default:case STAGE_SELECT_STORE:return i18n.text('locations.headline');case STAGE_RESERVE_FORM:return i18n.text('locations.place_reservation');case STAGE_RESPONSE_SUCCESS:return i18n.text('locations.success_heading');case STAGE_RESPONSE_ERROR:return i18n.text('locations.error_heading');case STAGE_FULFILLMENT_METHOD:return i18n.text('locations.change_fulfillment_method');}},[props.title,stage]);/** Effects for updating a state based on new props */useEffect(function(){return setIsOpen(open);},[open]);useEffect(function(){return setProduct(propsProduct);},[propsProduct]);useEffect(function(){if(updatePreferredLocation&&productLocation&&!isInitialized.current){isInitialized.current=true;selectLocation(productLocation);}},[productLocation,selectLocation,updatePreferredLocation]);useEffect(function(){setIsLoading(isFetching);},[isFetching]);/**
5
+ */function FulfillmentProvider(props){var children=props.children,locations=props.locations,propsBaseProduct=props.baseProduct,propsProduct=props.product,productLocation=props.location,inventory=props.inventory,userInput=props.userInput,defaultFulfillmentMethod=props.fulfillmentMethod,defaultFulfillmentPath=props.fulfillmentPath,fulfillmentPaths=props.fulfillmentPaths,fulfillmentMethods=props.fulfillmentMethods,enabledFulfillmentMethods=props.enabledFulfillmentMethods,shopSettings=props.shopSettings,selectLocation=props.selectLocation,submitReservation=props.submitReservation,storeFormInput=props.storeFormInput,updateProductsInCart=props.updateProductsInCart,isFetching=props.isFetching,_props$noInventory=props.noInventory,noInventory=_props$noInventory===void 0?false:_props$noInventory,_props$open=props.open,open=_props$open===void 0?false:_props$open,_props$noLocationSele=props.noLocationSelection,noLocationSelection=_props$noLocationSele===void 0?false:_props$noLocationSele,_props$isStoreFinder=props.isStoreFinder,isStoreFinder=_props$isStoreFinder===void 0?false:_props$isStoreFinder,_props$isCart=props.isCart,isCart=_props$isCart===void 0?false:_props$isCart,defaultIsInitialized=props.isInitialized,updatePreferredLocation=props.updatePreferredLocation,_props$restrictMultiL=props.restrictMultiLocationOrders,restrictMultiLocationOrders=_props$restrictMultiL===void 0?false:_props$restrictMultiL,_props$cartProducts=props.cartProducts,cartProducts=_props$cartProducts===void 0?[]:_props$cartProducts,showModal=props.showModal,_props$fulfillmentSch=props.fulfillmentSchedulingEnabled,fulfillmentSchedulingEnabled=_props$fulfillmentSch===void 0?null:_props$fulfillmentSch,_props$activeFulfillm=props.activeFulfillmentSlot,activeFulfillmentSlot=_props$activeFulfillm===void 0?null:_props$activeFulfillm,_props$activeFulfillm2=props.activeFulfillmentSlotLocationCode,activeFulfillmentSlotLocationCode=_props$activeFulfillm2===void 0?null:_props$activeFulfillm2;var _useState=useState(defaultFulfillmentPath||null),_useState2=_slicedToArray(_useState,2),fulfillmentPath=_useState2[0],setFulfillmentPath=_useState2[1];var _useState3=useState(props.changeOnly),_useState4=_slicedToArray(_useState3,2),changeOnly=_useState4[0],setChangeOnly=_useState4[1];var _useState5=useState(open),_useState6=_slicedToArray(_useState5,2),isOpen=_useState6[0],setIsOpen=_useState6[1];var _useState7=useState(props.stage||null),_useState8=_slicedToArray(_useState7,2),stage=_useState8[0],setStage=_useState8[1];var _useState9=useState(null),_useState10=_slicedToArray(_useState9,2),fulfillmentMethod=_useState10[0],setFulfillmentMethod=_useState10[1];var _useState11=useState(null),_useState12=_slicedToArray(_useState11,2),orderNumbers=_useState12[0],setOrderNumbers=_useState12[1];var _useState13=useState(null),_useState14=_slicedToArray(_useState13,2),errors=_useState14[0],setErrors=_useState14[1];var _useState15=useState(propsProduct),_useState16=_slicedToArray(_useState15,2),product=_useState16[0],setProduct=_useState16[1];var _useState17=useState(false),_useState18=_slicedToArray(_useState17,2),isChangeFulfillment=_useState18[0],setIsChangeFulfillment=_useState18[1];var _useState19=useState(null),_useState20=_slicedToArray(_useState19,2),cartItem=_useState20[0],setCartItem=_useState20[1];var _useState21=useState(productLocation),_useState22=_slicedToArray(_useState21,2),storeFinderLocation=_useState22[0],setStoreFinderLocation=_useState22[1];var _useState23=useState(!isFetching),_useState24=_slicedToArray(_useState23,2),isLoading=_useState24[0],setIsLoading=_useState24[1];var isInitialized=useRef(defaultIsInitialized);useEffect(function(){if(defaultFulfillmentMethod){setFulfillmentMethod(defaultFulfillmentMethod);}},[defaultFulfillmentMethod]);var title=useMemo(function(){if(props.title!==null){return i18n.text(props.title);}switch(stage){default:case STAGE_SELECT_STORE:return i18n.text('locations.headline');case STAGE_RESERVE_FORM:return i18n.text('locations.place_reservation');case STAGE_RESPONSE_SUCCESS:return i18n.text('locations.success_heading');case STAGE_RESPONSE_ERROR:return i18n.text('locations.error_heading');case STAGE_FULFILLMENT_METHOD:return i18n.text('locations.change_fulfillment_method');}},[props.title,stage]);/** Effects for updating a state based on new props */useEffect(function(){return setIsOpen(open);},[open]);useEffect(function(){return setProduct(propsProduct);},[propsProduct]);useEffect(function(){// eslint-disable-next-line require-jsdoc
6
+ var exec=/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:if(!(updatePreferredLocation&&productLocation&&!isInitialized.current)){_context.next=4;break;}isInitialized.current=true;_context.next=4;return selectLocation({location:productLocation});case 4:case"end":return _context.stop();}},_callee);}));return function exec(){return _ref.apply(this,arguments);};}();exec();},[productLocation,selectLocation,updatePreferredLocation]);useEffect(function(){setIsLoading(isFetching);},[isFetching]);/**
6
7
  * Checks whether the given stage is currently set.
7
8
  * @param {string} inputStage The stage to check for.
8
9
  * @returns {boolean}
@@ -19,8 +20,8 @@ import _regeneratorRuntime from"@babel/runtime/regenerator";function _extends(){
19
20
  */function sendReservation(_x){return _sendReservation.apply(this,arguments);}/**
20
21
  * @param {Object} location The selected location.
21
22
  * @returns {boolean}
22
- */function _sendReservation(){_sendReservation=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(values){var response;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_context2.next=3;return submitReservation(values,product);case 3:response=_context2.sent;if(response.errors&&response.errors.length>0){setStage(STAGE_RESPONSE_ERROR);setOrderNumbers(null);setErrors(response.errors);}setStage(STAGE_RESPONSE_SUCCESS);setOrderNumbers(response.orderNumbers);setErrors(null);_context2.next=16;break;case 10:_context2.prev=10;_context2.t0=_context2["catch"](0);logger.error(_context2.t0);setStage(STAGE_RESPONSE_ERROR);setOrderNumbers(null);setErrors([_context2.t0.message]);case 16:// Store the user's form in the user data.
23
- storeFormInput(values);case 17:case"end":return _context2.stop();}},_callee2,null,[[0,10]]);}));return _sendReservation.apply(this,arguments);}var confirmSelection=/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(location){var code,name,ropeCartProducts,cartHasDifferentCodes,confirmed,updateData;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:code=location.code,name=location.name;ropeCartProducts=cartProducts.filter(function(cartProduct){var _cartProduct$fulfillm;return[ROPIS,BOPIS].includes(cartProduct===null||cartProduct===void 0?void 0:(_cartProduct$fulfillm=cartProduct.fulfillment)===null||_cartProduct$fulfillm===void 0?void 0:_cartProduct$fulfillm.method);});if(!(!restrictMultiLocationOrders||ropeCartProducts.length===0)){_context.next=4;break;}return _context.abrupt("return",true);case 4:if(!(isCart&&ropeCartProducts.length===1)){_context.next=6;break;}return _context.abrupt("return",true);case 6:cartHasDifferentCodes=!!ropeCartProducts.map(function(_ref2){var _fulfillment$location;var fulfillment=_ref2.fulfillment;return fulfillment===null||fulfillment===void 0?void 0:(_fulfillment$location=fulfillment.location)===null||_fulfillment$location===void 0?void 0:_fulfillment$location.code;}).filter(Boolean).filter(function(cartProductCode){return cartProductCode!==code;}).length;if(!(ropeCartProducts.length>=1&&!cartHasDifferentCodes)){_context.next=9;break;}return _context.abrupt("return",true);case 9:_context.next=11;return showModal({title:'locations.multi_location_modal.title',message:'locations.multi_location_modal.message',confirm:'locations.multi_location_modal.change_store',dismiss:'common.cancel'});case 11:confirmed=_context.sent;if(!(confirmed&&ropeCartProducts.length)){_context.next=18;break;}updateData=ropeCartProducts.map(function(_ref3){var cartItemId=_ref3.id,fulfillment=_ref3.fulfillment;return{cartItemId:cartItemId,fulfillment:{method:fulfillment===null||fulfillment===void 0?void 0:fulfillment.method,location:{code:code,name:name||''}}};});setIsLoading(true);_context.next=17;return updateProductsInCart(updateData);case 17:setIsLoading(false);case 18:return _context.abrupt("return",confirmed);case 19:case"end":return _context.stop();}},_callee);}));return function confirmSelection(_x2){return _ref.apply(this,arguments);};}();/**
23
+ */function _sendReservation(){_sendReservation=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(values){var response;return _regeneratorRuntime.wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.prev=0;_context3.next=3;return submitReservation(values,product);case 3:response=_context3.sent;if(response.errors&&response.errors.length>0){setStage(STAGE_RESPONSE_ERROR);setOrderNumbers(null);setErrors(response.errors);}setStage(STAGE_RESPONSE_SUCCESS);setOrderNumbers(response.orderNumbers);setErrors(null);_context3.next=16;break;case 10:_context3.prev=10;_context3.t0=_context3["catch"](0);logger.error(_context3.t0);setStage(STAGE_RESPONSE_ERROR);setOrderNumbers(null);setErrors([_context3.t0.message]);case 16:// Store the user's form in the user data.
24
+ storeFormInput(values);case 17:case"end":return _context3.stop();}},_callee3,null,[[0,10]]);}));return _sendReservation.apply(this,arguments);}var confirmSelection=/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(location){var code,name,ropeCartProducts,cartHasDifferentCodes,confirmed,updateData;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:code=location.code,name=location.name;ropeCartProducts=cartProducts.filter(function(cartProduct){var _cartProduct$fulfillm;return[ROPIS,BOPIS].includes(cartProduct===null||cartProduct===void 0?void 0:(_cartProduct$fulfillm=cartProduct.fulfillment)===null||_cartProduct$fulfillm===void 0?void 0:_cartProduct$fulfillm.method);});if(!(!restrictMultiLocationOrders||ropeCartProducts.length===0)){_context2.next=4;break;}return _context2.abrupt("return",true);case 4:if(!(isCart&&ropeCartProducts.length===1)){_context2.next=6;break;}return _context2.abrupt("return",true);case 6:cartHasDifferentCodes=!!ropeCartProducts.map(function(_ref3){var _fulfillment$location;var fulfillment=_ref3.fulfillment;return fulfillment===null||fulfillment===void 0?void 0:(_fulfillment$location=fulfillment.location)===null||_fulfillment$location===void 0?void 0:_fulfillment$location.code;}).filter(Boolean).filter(function(cartProductCode){return cartProductCode!==code;}).length;if(!(ropeCartProducts.length>=1&&!cartHasDifferentCodes)){_context2.next=9;break;}return _context2.abrupt("return",true);case 9:_context2.next=11;return showModal({title:'locations.multi_location_modal.title',message:'locations.multi_location_modal.message',confirm:'locations.multi_location_modal.change_store',dismiss:'common.cancel'});case 11:confirmed=_context2.sent;if(!(confirmed&&ropeCartProducts.length)){_context2.next=18;break;}updateData=ropeCartProducts.map(function(_ref4){var cartItemId=_ref4.id,fulfillment=_ref4.fulfillment;return{cartItemId:cartItemId,fulfillment:{method:fulfillment===null||fulfillment===void 0?void 0:fulfillment.method,location:{code:code,name:name||''}}};});setIsLoading(true);_context2.next=17;return updateProductsInCart(updateData);case 17:setIsLoading(false);case 18:return _context2.abrupt("return",confirmed);case 19:case"end":return _context2.stop();}},_callee2);}));return function confirmSelection(_x2){return _ref2.apply(this,arguments);};}();/**
24
25
  * Handles multiline reservation.
25
26
  * @param {Object} location The selected location.
26
27
  */function handleMultilineReservation(location){if(product===null||location.code===null){return;}var fulfillment=_extends({method:fulfillmentMethod,location:{code:location.code,name:location.name||''}},fulfillmentSchedulingEnabled&&activeFulfillmentSlotLocationCode===location.code&&(activeFulfillmentSlot===null||activeFulfillmentSlot===void 0?void 0:activeFulfillmentSlot.id)?{slotId:activeFulfillmentSlot.id}:null);if(isChangeFulfillment&&cartItem){updateProductsInCart([{quantity:cartItem.quantity,cartItemId:cartItem.id,fulfillment:fulfillment}]);}handleClose(location,product.id);}/**
@@ -31,12 +32,12 @@ storeFormInput(values);case 17:case"end":return _context2.stop();}},_callee2,nul
31
32
  */function handleSelectLocation(_x3){return _handleSelectLocation.apply(this,arguments);}/**
32
33
  * @param {string} method The selected fulfillment method.
33
34
  * @param {Object} item The cart item to change.
34
- */function _handleSelectLocation(){_handleSelectLocation=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(location){var selectionConfirmed,handleReservationMethod;return _regeneratorRuntime.wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:if(!isLoading){_context3.next=2;break;}return _context3.abrupt("return");case 2:if(!updatePreferredLocation){_context3.next=7;break;}_context3.next=5;return confirmSelection(location);case 5:selectionConfirmed=_context3.sent;if(selectionConfirmed){selectLocation({code:location.code,name:location.name});}case 7:if(!changeOnly){_context3.next=10;break;}if(selectionConfirmed){handleClose(location,product&&product.id);}return _context3.abrupt("return");case 10:/**
35
+ */function _handleSelectLocation(){_handleSelectLocation=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(location){var selectionConfirmed,handleReservationMethod;return _regeneratorRuntime.wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:if(!isLoading){_context4.next=2;break;}return _context4.abrupt("return");case 2:if(!updatePreferredLocation){_context4.next=9;break;}_context4.next=5;return confirmSelection(location);case 5:selectionConfirmed=_context4.sent;if(!selectionConfirmed){_context4.next=9;break;}_context4.next=9;return selectLocation({location:{code:location.code,name:location.name}});case 9:if(!changeOnly){_context4.next=12;break;}if(selectionConfirmed){handleClose(location,product&&product.id);}return _context4.abrupt("return");case 12:/**
35
36
  * Select the reservation method strategy.
36
37
  * @param {string} method The reservation method.
37
38
  * @param {Object} storeLocation A store location
38
39
  */handleReservationMethod=function handleReservationMethod(method,storeLocation){if(!method){return;}if(method===QUICK_RESERVE){handleQuickReservation();}if(method===MULTI_LINE_RESERVE){handleMultilineReservation(storeLocation);}};// No fulfillment path selected yet.
39
- if(!(fulfillmentPath===null)){_context3.next=14;break;}if(fulfillmentPaths.length>1){FulfillmentPathSelector.open(function(method){if(!method){return;}handleReservationMethod(method,location);});}else if(fulfillmentPaths.length===1){handleReservationMethod(fulfillmentPaths[0],location);}return _context3.abrupt("return");case 14:if(!(fulfillmentPath===MULTI_LINE_RESERVE&&fulfillmentPaths.includes(MULTI_LINE_RESERVE))){_context3.next=17;break;}handleMultilineReservation(location);return _context3.abrupt("return");case 17:if(fulfillmentPath===QUICK_RESERVE){handleQuickReservation();}case 18:case"end":return _context3.stop();}},_callee3);}));return _handleSelectLocation.apply(this,arguments);}function handleChangeFulfillmentMethod(method,item){logger.assert(item.product.id===product.id,'Change fulfillment method is called with unexpected product id');setIsChangeFulfillment(true);setCartItem(item);if([ROPIS,BOPIS].includes(method)&&(item.fulfillment===null||item.fulfillment.method===DIRECT_SHIP)){/**
40
+ if(!(fulfillmentPath===null)){_context4.next=16;break;}if(fulfillmentPaths.length>1){FulfillmentPathSelector.open(function(method){if(!method){return;}handleReservationMethod(method,location);});}else if(fulfillmentPaths.length===1){handleReservationMethod(fulfillmentPaths[0],location);}return _context4.abrupt("return");case 16:if(!(fulfillmentPath===MULTI_LINE_RESERVE&&fulfillmentPaths.includes(MULTI_LINE_RESERVE))){_context4.next=19;break;}handleMultilineReservation(location);return _context4.abrupt("return");case 19:if(fulfillmentPath===QUICK_RESERVE){handleQuickReservation();}case 20:case"end":return _context4.stop();}},_callee4);}));return _handleSelectLocation.apply(this,arguments);}function handleChangeFulfillmentMethod(method,item){logger.assert(item.product.id===product.id,'Change fulfillment method is called with unexpected product id');setIsChangeFulfillment(true);setCartItem(item);if([ROPIS,BOPIS].includes(method)&&(item.fulfillment===null||item.fulfillment.method===DIRECT_SHIP)){/**
40
41
  * When the fulfillment method of the current cart item was DIRECT_SHIP before, and is
41
42
  * switched to a ROPE method, the customer needs to pick a store for the item.
42
43
  */setFulfillmentPath(MULTI_LINE_RESERVE);setStage(STAGE_SELECT_STORE);setFulfillmentMethod(method);setIsOpen(true);return;}if([DIRECT_SHIP,ROPIS,BOPIS].includes(method)){updateProductsInCart([{quantity:item.quantity,cartItemId:item.id,fulfillment:{method:method}}]);handleClose(null,item.product.id);}}var handleSelectStoreFinderLocation=useCallback(function(location){setStoreFinderLocation(location);},[]);var context={stage:stage,title:title,fulfillmentPath:fulfillmentPath,changeOnly:changeOnly,isStage:isStage,isOpen:isOpen,handleOpen:handleOpen,handleClose:handleClose,locations:locations,inventory:inventory,baseProduct:propsBaseProduct,product:product,location:productLocation,storeFinderLocation:storeFinderLocation,userInput:userInput,fulfillmentPaths:fulfillmentPaths,fulfillmentMethods:fulfillmentMethods,enabledFulfillmentMethods:enabledFulfillmentMethods,shopSettings:shopSettings,selectLocation:handleSelectLocation,selectStoreFinderLocation:handleSelectStoreFinderLocation,changeFulfillment:handleChangeFulfillmentMethod,sendReservation:sendReservation,orderNumbers:orderNumbers,errors:errors,noInventory:noInventory,noLocationSelection:noLocationSelection,isStoreFinder:isStoreFinder,isFetching:isFetching,isLoading:isLoading,setIsLoading:setIsLoading,meta:props.meta||undefined};return React.createElement(FulfillmentContext.Provider,{value:context},children);}FulfillmentProvider.defaultProps={open:false,changeOnly:false,updatePreferredLocation:true,fulfillmentMethods:null,title:null};var FulfillmentProviderWrapped=withCurrentProduct(connect(FulfillmentProvider));/**
@@ -1,4 +1,6 @@
1
- import React,{useMemo,useCallback}from'react';import{useSelector}from'react-redux';import PropTypes from'prop-types';import{useRoute}from'@shopgate/engage/core/hooks';import{getPreferredLocation,makeGetLocation,makeGetNearbyLocationsByLocationCode}from"../selectors";import connect from"./StoreFinder.connector";import{StoreDetailsContext}from"./StoreDetailsContext";/**
1
+ import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import React,{useMemo,useCallback}from'react';import{useSelector}from'react-redux';import PropTypes from'prop-types';import{useRoute}from'@shopgate/engage/core/hooks';import{getPreferredLocation,makeGetLocation,makeGetNearbyLocationsByLocationCode}from"../selectors";import connect from"./StoreFinder.connector";import{StoreDetailsContext}from"./StoreDetailsContext";/**
2
2
  * @param {Object} props The component props
3
3
  * @returns {JSX}
4
- */var StoreDetailsProvider=function StoreDetailsProvider(_ref){var children=_ref.children,selectGlobalLocation=_ref.selectGlobalLocation,selectLocation=_ref.selectLocation;var _useRoute=useRoute(),locationCode=_useRoute.params.code;var getLocation=useMemo(function(){return makeGetLocation(function(){return locationCode;});},[locationCode]);var routeLocation=useSelector(getLocation);var preferredLocation=useSelector(getPreferredLocation);var isRouteLocationPreferred=useMemo(function(){return preferredLocation&&routeLocation&&preferredLocation.code===routeLocation.code;},[preferredLocation,routeLocation]);var getNearbyLocations=useMemo(function(){return makeGetNearbyLocationsByLocationCode(locationCode);},[locationCode]);var nearbyLocations=useSelector(getNearbyLocations);var selectLocationCb=useCallback(function(location){selectLocation(location,true);selectGlobalLocation(location);},[selectLocation,selectGlobalLocation]);var value=useMemo(function(){return{preferredLocation:preferredLocation,routeLocation:routeLocation,nearbyLocations:nearbyLocations,isRouteLocationPreferred:isRouteLocationPreferred,selectLocation:selectLocationCb};},[isRouteLocationPreferred,nearbyLocations,preferredLocation,routeLocation,selectLocationCb]);return React.createElement(StoreDetailsContext.Provider,{value:value},children);};StoreDetailsProvider.defaultProps={children:null};export default connect(StoreDetailsProvider);
4
+ */var StoreDetailsProvider=function StoreDetailsProvider(_ref){var children=_ref.children,selectGlobalLocation=_ref.selectGlobalLocation,selectLocation=_ref.selectLocation;var _useRoute=useRoute(),locationCode=_useRoute.params.code;var getLocation=useMemo(function(){return makeGetLocation(function(){return locationCode;});},[locationCode]);var routeLocation=useSelector(getLocation);var preferredLocation=useSelector(getPreferredLocation);var isRouteLocationPreferred=useMemo(function(){return preferredLocation&&routeLocation&&preferredLocation.code===routeLocation.code;},[preferredLocation,routeLocation]);var getNearbyLocations=useMemo(function(){return makeGetNearbyLocationsByLocationCode(locationCode);},[locationCode]);var nearbyLocations=useSelector(getNearbyLocations);var selectLocationCb=useCallback(/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(location){return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.next=2;return selectLocation({location:location,showToast:true});case 2:if(location.code!==(preferredLocation===null||preferredLocation===void 0?void 0:preferredLocation.code)){// Only dispatch selectGlobalLocation when location really changed, since this action
5
+ // might clear product data from the resultsByHash product storage.
6
+ selectGlobalLocation(location);}case 3:case"end":return _context.stop();}},_callee);}));return function(_x){return _ref2.apply(this,arguments);};}(),[preferredLocation,selectLocation,selectGlobalLocation]);var value=useMemo(function(){return{preferredLocation:preferredLocation,routeLocation:routeLocation,nearbyLocations:nearbyLocations,isRouteLocationPreferred:isRouteLocationPreferred,selectLocation:selectLocationCb};},[isRouteLocationPreferred,nearbyLocations,preferredLocation,routeLocation,selectLocationCb]);return React.createElement(StoreDetailsContext.Provider,{value:value},children);};StoreDetailsProvider.defaultProps={children:null};export default connect(StoreDetailsProvider);