@shopgate/engage 7.26.0-beta.1 → 7.26.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 (101) hide show
  1. package/a11y/action-creators/index.js +9 -0
  2. package/a11y/components/FocusTrap/index.js +1 -0
  3. package/a11y/components/ModalStateTracker/index.js +14 -0
  4. package/a11y/components/Section/index.js +3 -3
  5. package/a11y/components/index.js +1 -1
  6. package/a11y/constants/index.js +1 -1
  7. package/a11y/hooks/index.js +37 -0
  8. package/a11y/index.js +1 -1
  9. package/a11y/reducers/index.js +6 -0
  10. package/a11y/selectors/index.js +8 -0
  11. package/cart/components/CartItem/CartItemProductLayout.style.js +1 -1
  12. package/cart/components/CartItem/CartItemProductProvider.js +1 -1
  13. package/cart/components/CartItem/CartItemProductTitle.js +2 -2
  14. package/cart/components/CartItem/CartItemQuantityPicker.js +1 -1
  15. package/components/Menu/components/Item/index.js +2 -2
  16. package/components/SheetDrawer/index.js +4 -3
  17. package/components/View/components/Content/index.js +2 -2
  18. package/components/View/provider.js +7 -4
  19. package/core/events/index.js +1 -0
  20. package/core/helpers/index.js +1 -1
  21. package/core/index.js +2 -4
  22. package/favorites/components/List/List.js +1 -1
  23. package/locations/action-creators/selectLocation.js +2 -1
  24. package/locations/actions/fetchLocations.js +1 -1
  25. package/locations/components/FulfillmentSheet/FulfillmentSheet.js +4 -3
  26. package/locations/components/FulfillmentSheet/FulfillmentSheetContent.js +5 -3
  27. package/locations/components/StockInfo/StockInfo.js +2 -2
  28. package/locations/components/StockInfo/StockInfoInventory.js +2 -2
  29. package/locations/components/StoreDetails/components/FindMoreStores.js +4 -0
  30. package/locations/components/StoreDetails/components/GetDirectionsButton.js +7 -0
  31. package/locations/components/StoreDetails/components/StoreDetails.js +5 -0
  32. package/locations/components/StoreDetails/components/StoreFinderMap.js +20 -0
  33. package/locations/components/StoreDetails/components/StoreFinderMap.style.js +1 -0
  34. package/locations/components/StoreDetails/components/StoreLocationMap.js +4 -0
  35. package/locations/components/StoreDetails/components/StoresNearby.js +4 -0
  36. package/locations/components/StoreDetails/components/StoresNearbyListItem.js +9 -0
  37. package/locations/components/StoreDetails/index.js +4 -0
  38. package/locations/components/StoreFinder/StoreFinder.js +3 -3
  39. package/locations/components/StoreFinder/StoreFinder.style.js +1 -2
  40. package/locations/components/StoreFinder/StoreFinderLocation.js +2 -2
  41. package/locations/components/StoreFinder/StoreFinderLocation.style.js +1 -1
  42. package/locations/components/StoreFinder/StoreFinderLocationHeader.js +2 -2
  43. package/locations/components/StoreFinder/StoreFinderLocationHeader.style.js +1 -1
  44. package/locations/components/StoreFinder/StoreFinderLocations.style.js +1 -2
  45. package/locations/components/StoreFinder/StoreFinderSearch.style.js +1 -1
  46. package/locations/components/StoreFinder/StoreFinderSelectLocationButton.js +2 -2
  47. package/locations/components/StoreFinder/StoreFinderStoreInfoButton.js +8 -0
  48. package/locations/components/StoreList/Store.style.js +1 -1
  49. package/locations/components/StoreList/StoreAddress.js +5 -3
  50. package/locations/components/StoreList/StoreAddressShort.js +5 -3
  51. package/locations/components/StoreList/StoreCard.js +2 -2
  52. package/locations/components/StoreList/StoreDetailsLine.js +6 -2
  53. package/locations/components/StoreList/StoreDistance.js +4 -2
  54. package/locations/components/StoreList/StoreHeader.js +2 -2
  55. package/locations/components/StoreList/StoreHoursToday.js +4 -2
  56. package/locations/components/StoreList/StoreListLocations.js +1 -1
  57. package/locations/components/StoreList/StoreListProduct.js +1 -1
  58. package/locations/components/StoreList/StoreListSearch.js +1 -1
  59. package/locations/components/StoreList/StoreOpeningHours.js +5 -3
  60. package/locations/components/StoreList/StoreOpeningHoursLine.js +4 -2
  61. package/locations/components/StoreList/StorePhoneNumber.js +4 -3
  62. package/locations/components/StoreList/StoreSelectLocationButton.js +1 -1
  63. package/locations/components/index.js +1 -1
  64. package/locations/constants/Portals.js +1 -1
  65. package/locations/constants/index.js +3 -1
  66. package/locations/constants/routes.js +1 -1
  67. package/locations/locations.streams.js +1 -1
  68. package/locations/providers/StoreDetailsContext.js +1 -0
  69. package/locations/providers/StoreDetailsProvider.js +4 -0
  70. package/locations/providers/StoreFinderProvider.js +4 -4
  71. package/locations/providers/index.js +1 -1
  72. package/locations/selectors/index.js +7 -2
  73. package/locations/subscriptions.js +3 -3
  74. package/login/components/ForgotPassword/ForgotPassword.style.js +1 -1
  75. package/package.json +12 -11
  76. package/product/components/Characteristics/Characteristic/components/Sheet/index.js +2 -2
  77. package/product/components/Characteristics/Characteristic/index.js +3 -2
  78. package/product/components/ProductBadges/index.js +1 -1
  79. package/product/components/ProductCard/index.js +2 -2
  80. package/product/components/ProductDiscountBadge/index.js +2 -2
  81. package/product/components/ProductImage/index.js +2 -2
  82. package/product/components/ProductProperties/Row.js +1 -1
  83. package/product/components/Rating/index.js +2 -2
  84. package/push-opt-in/components/PushOptInModal/index.js +1 -1
  85. package/push-opt-in/subscriptions/optInTrigger.js +1 -1
  86. package/reviews/components/Reviews/components/Header/components/AverageRating/index.js +6 -4
  87. package/reviews/components/Reviews/components/Header/components/NoReviews/index.js +3 -3
  88. package/reviews/components/Reviews/components/Header/components/ReviewsExcerpt/index.js +3 -3
  89. package/reviews/components/Reviews/components/Header/components/WriteReviewLink/index.js +3 -3
  90. package/reviews/components/Reviews/components/Header/components/WriteReviewLink/spec.js +2 -2
  91. package/reviews/components/Reviews/components/Header/index.js +5 -3
  92. package/reviews/components/Reviews/components/Header/spec.js +1 -1
  93. package/reviews/components/Reviews/components/ReviewsInfo/index.js +1 -2
  94. package/styles/reset/root.js +2 -1
  95. package/tracking/components/CookieConsentModal/index.js +1 -1
  96. package/locations/components/StoreFinder/StoreFinderLocationDetailsWide.js +0 -3
  97. package/locations/components/StoreFinder/StoreFinderLocationDetailsWide.style.js +0 -1
  98. package/locations/components/StoreFinder/StoreFinderMap.js +0 -4
  99. package/locations/components/StoreFinder/StoreFinderMap.style.js +0 -2
  100. package/locations/components/StoreFinder/StoreFinderStoresNear.js +0 -3
  101. package/locations/components/StoreFinder/StoreFinderStoresNear.style.js +0 -1
@@ -14,7 +14,7 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
14
14
  * @return {React.Component|null}
15
15
  */_defineProperty(_this2,"renderAvailability",function(value){var _this2$props=_this2.props,fulfillmentMethods=_this2$props.fulfillmentMethods,isFetching=_this2$props.isFetching;if(fulfillmentMethods||isFetching){return null;}var selection=_extends({},_this2.props.selection,_defineProperty({},_this2.props.charId,value));return React.createElement(VariantAvailability,{characteristics:selection,productId:_this2.props.productId});});return _this2;}_inherits(CharacteristicSheet,_PureComponent);return _createClass(CharacteristicSheet,[{key:"render",value:/**
16
16
  * @return {JSX}
17
- */function render(){var _this3=this;var _this$props=this.props,items=_this$props.items,label=_this$props.label,open=_this$props.open,selectedValue=_this$props.selectedValue,contextRef=_this$props.contextRef;var selectedIndex;if(selectedValue){selectedIndex=items.findIndex(function(item){return item.id===selectedValue;});}else{selectedIndex=items.findIndex(function(item){return item.selectable;});}return React.createElement(Fragment,null,React.createElement(ResponsiveContainer,{appAlways:true,breakpoint:"xs"},React.createElement(SheetDrawer,{title:label,isOpen:open,onClose:this.onClose,onDidOpen:this.onDidOpen},React.createElement(SheetList,{className:"theme__product__characteristic__sheet"},items.map(function(item,index){return React.createElement(Item,{item:item,key:item.id,onClick:_this3.handleItemClick,rightComponent:function rightComponent(){return _this3.renderAvailability(item.id);},selected:item.id===selectedValue,ref:index===selectedIndex?_this3.firstSelectableItemRef:null,characteristics:_extends({},_this3.props.selection,_defineProperty({},_this3.props.charId,item.id))});})))),React.createElement(ResponsiveContainer,{webOnly:true,breakpoint:">xs"},React.createElement(ThemeContext.Consumer,null,function(_ref){var contextProps=_extends({},(_objectDestructuringEmpty(_ref),_ref));return React.createElement(Menu,{isOpen:open,onClose:_this3.onClose,contextRef:contextRef},React.createElement(ThemeContext.Provider,{value:contextProps},items.map(function(item,index){return React.createElement(Item,{key:item.id,item:item,onClick:_this3.handleItemClick,rightComponent:function rightComponent(){return _this3.renderAvailability(item.id);},selected:item.id===selectedValue,ref:index===selectedIndex?_this3.firstSelectableItemRef:null,characteristics:_extends({},_this3.props.selection,_defineProperty({},_this3.props.charId,item.id))});})));})));}}]);}(PureComponent);/**
17
+ */function render(){var _this3=this;var _this$props=this.props,items=_this$props.items,label=_this$props.label,open=_this$props.open,selectedValue=_this$props.selectedValue,contextRef=_this$props.contextRef,onDidClose=_this$props.onDidClose;var selectedIndex;if(selectedValue){selectedIndex=items.findIndex(function(item){return item.id===selectedValue;});}else{selectedIndex=items.findIndex(function(item){return item.selectable;});}return React.createElement(Fragment,null,React.createElement(ResponsiveContainer,{appAlways:true,breakpoint:"xs"},React.createElement(SheetDrawer,{title:label,isOpen:open,onClose:this.onClose,onDidOpen:this.onDidOpen,onDidClose:onDidClose},React.createElement(SheetList,{className:"theme__product__characteristic__sheet"},items.map(function(item,index){return React.createElement(Item,{item:item,key:item.id,onClick:_this3.handleItemClick,rightComponent:function rightComponent(){return _this3.renderAvailability(item.id);},selected:item.id===selectedValue,ref:index===selectedIndex?_this3.firstSelectableItemRef:null,characteristics:_extends({},_this3.props.selection,_defineProperty({},_this3.props.charId,item.id))});})))),React.createElement(ResponsiveContainer,{webOnly:true,breakpoint:">xs"},React.createElement(ThemeContext.Consumer,null,function(_ref){var contextProps=_extends({},(_objectDestructuringEmpty(_ref),_ref));return React.createElement(Menu,{isOpen:open,onClose:_this3.onClose,contextRef:contextRef},React.createElement(ThemeContext.Provider,{value:contextProps},items.map(function(item,index){return React.createElement(Item,{key:item.id,item:item,onClick:_this3.handleItemClick,rightComponent:function rightComponent(){return _this3.renderAvailability(item.id);},selected:item.id===selectedValue,ref:index===selectedIndex?_this3.firstSelectableItemRef:null,characteristics:_extends({},_this3.props.selection,_defineProperty({},_this3.props.charId,item.id))});})));})));}}]);}(PureComponent);/**
18
18
  * @param {Object} props The original component props.
19
19
  * @returns {JSX}
20
- */_defineProperty(CharacteristicSheet,"defaultProps",{fulfillmentMethods:null,onClose:function onClose(){},onSelect:function onSelect(){},productId:null,selectedValue:null,contextRef:null,selection:null,isFetching:false});var SheetComponent=function SheetComponent(props){return React.createElement(ViewContext.Consumer,null,function(_ref2){var setAriaHidden=_ref2.setAriaHidden;return React.createElement(ProductContext.Consumer,null,function(_ref3){var productId=_ref3.productId,fulfillmentMethods=_ref3.fulfillmentMethods,isFetching=_ref3.isFetching;return React.createElement(VariantContext.Consumer,null,function(_ref4){var characteristics=_ref4.characteristics;return React.createElement(CharacteristicSheet,_extends({productId:productId,selection:characteristics,setViewAriaHidden:setAriaHidden,fulfillmentMethods:fulfillmentMethods,isFetching:isFetching},props));});});});};export default SheetComponent;
20
+ */_defineProperty(CharacteristicSheet,"defaultProps",{fulfillmentMethods:null,onClose:function onClose(){},onSelect:function onSelect(){},onDidClose:function onDidClose(){},productId:null,selectedValue:null,contextRef:null,selection:null,isFetching:false});var SheetComponent=function SheetComponent(props){return React.createElement(ViewContext.Consumer,null,function(_ref2){var setAriaHidden=_ref2.setAriaHidden;return React.createElement(ProductContext.Consumer,null,function(_ref3){var productId=_ref3.productId,fulfillmentMethods=_ref3.fulfillmentMethods,isFetching=_ref3.isFetching;return React.createElement(VariantContext.Consumer,null,function(_ref4){var characteristics=_ref4.characteristics;return React.createElement(CharacteristicSheet,_extends({productId:productId,selection:characteristics,setViewAriaHidden:setAriaHidden,fulfillmentMethods:fulfillmentMethods,isFetching:isFetching},props));});});});};export default SheetComponent;
@@ -7,7 +7,8 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
7
7
  * @param {Object} event The event object.
8
8
  */_defineProperty(_this2,"handleButtonClick",function(event){event.preventDefault();if(_this2.props.disabled){return;}_this2.setState({sheet:true});});/**
9
9
  * @param {string} valueId The ID of the selected value.
10
- */_defineProperty(_this2,"handleItemSelection",function(valueId){_this2.props.select({id:_this2.props.id,value:valueId});_this2.closeSheet();});_defineProperty(_this2,"closeSheet",function(){_this2.setState({sheet:false});if(_this2.props.charRef&&_this2.props.charRef.current){_this2.props.charRef.current.focus();}});_defineProperty(_this2,"removeHighlight",function(){_this2.setState({highlight:false});});/**
10
+ */_defineProperty(_this2,"handleItemSelection",function(valueId){_this2.props.select({id:_this2.props.id,value:valueId});_this2.closeSheet();});_defineProperty(_this2,"closeSheet",function(){_this2.setState({sheet:false});});_defineProperty(_this2,"sheetDidClose",function(){if(_this2.props.charRef&&_this2.props.charRef.current){// Focus the element that triggered the CharacteristicsSheet after it closes
11
+ _this2.props.charRef.current.focus();}});_defineProperty(_this2,"removeHighlight",function(){_this2.setState({highlight:false});});/**
11
12
  * Renders the transition contents.
12
13
  * @param {string} state The current transition state.
13
14
  * @returns {JSX}
@@ -15,4 +16,4 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
15
16
  * @param {Object} nextProps The next component props.
16
17
  */function UNSAFE_componentWillReceiveProps(nextProps){this.setState({highlight:nextProps.highlight});}},{key:"render",value:/**
17
18
  * @return {JSX}
18
- */function render(){var _this$context$i18n=this.context.i18n(),__=_this$context$i18n.__;var _this$props=this.props,id=_this$props.id,selected=_this$props.selected,values=_this$props.values,charRef=_this$props.charRef;var displayLabel=this.props.label;var translatedLabel=__('product.pick_an_attribute',[displayLabel]);return React.createElement(Fragment,null,React.createElement(Transition,{"in":this.state.highlight,timeout:500,onEntered:this.removeHighlight},this.transitionRenderer),React.createElement(Sheet,{charId:id,contextRef:charRef,items:values,label:translatedLabel,onClose:this.closeSheet,onSelect:this.handleItemSelection,open:this.state.sheet,selectedValue:selected}));}}]);}(PureComponent);_defineProperty(Characteristic,"contextTypes",{i18n:PropTypes.func});_defineProperty(Characteristic,"defaultProps",{selected:null});export default Characteristic;
19
+ */function render(){var _this$context$i18n=this.context.i18n(),__=_this$context$i18n.__;var _this$props=this.props,id=_this$props.id,selected=_this$props.selected,values=_this$props.values,charRef=_this$props.charRef;var displayLabel=this.props.label;var translatedLabel=__('product.pick_an_attribute',[displayLabel]);return React.createElement(Fragment,null,React.createElement(Transition,{"in":this.state.highlight,timeout:500,onEntered:this.removeHighlight},this.transitionRenderer),React.createElement(Sheet,{charId:id,contextRef:charRef,items:values,label:translatedLabel,onClose:this.closeSheet,onDidClose:this.sheetDidClose,onSelect:this.handleItemSelection,open:this.state.sheet,selectedValue:selected}));}}]);}(PureComponent);_defineProperty(Characteristic,"contextTypes",{i18n:PropTypes.func});_defineProperty(Characteristic,"defaultProps",{selected:null});export default Characteristic;
@@ -1,5 +1,5 @@
1
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 React,{useMemo}from'react';import PropTypes from'prop-types';import{css}from'glamor';import classNames from'classnames';import kebabCase from'lodash/kebabCase';import{SurroundPortals}from"../../../components";import{PORTAL_PRODUCT_BADGES}from"../../../components/constants";var styles={root:css({position:'absolute',paddingLeft:10,left:0,top:10,zIndex:5,transform:'translate3d(0, 0, 0)',display:'flex',pointerEvents:'none',width:'100%',' > *:empty':{display:'none'}}).toString()};/**
2
2
  * The ProductBadges component
3
3
  * @param {Object} props The component props
4
- * @returns {JSX}
4
+ * @returns {JSX.Element}
5
5
  */var ProductBadges=function ProductBadges(_ref){var children=_ref.children,location=_ref.location,productId=_ref.productId,portalProps=_ref.portalProps,className=_ref.className;var props=useMemo(function(){return _extends({},portalProps,{location:location,productId:productId});},[location,portalProps,productId]);var locationClass=useMemo(function(){if(!location){return'';}return"product_badges__".concat(kebabCase(location));},[location]);return React.createElement("div",{className:classNames(styles.root,className,'product_badges',locationClass)},React.createElement(SurroundPortals,{portalName:PORTAL_PRODUCT_BADGES,portalProps:props},children));};ProductBadges.defaultProps={portalProps:null,children:PropTypes.node,className:''};export default ProductBadges;
@@ -6,5 +6,5 @@ import React,{useMemo}from'react';import PropTypes from'prop-types';import{isBet
6
6
  * @param {boolean} props.hideRating Whether the rating should be hidden.
7
7
  * @param {boolean} props.hideName Whether the name should be hidden.
8
8
  * @param {number} props.titleRows The max number of rows for the product title.
9
- * @return {JSX}
10
- */function ProductCard(props){var product=props.product,hidePrice=props.hidePrice,hideRating=props.hideRating,hideName=props.hideName,titleRows=props.titleRows;var _getProductImageSetti=getProductImageSettings(),gridResolutions=_getProductImageSetti.ListImage;var _useWidgetSettings=useWidgetSettings('@shopgate/engage/rating'),_useWidgetSettings$sh=_useWidgetSettings.showEmptyRatingStars,showEmptyRatingStars=_useWidgetSettings$sh===void 0?false:_useWidgetSettings$sh;var showRatings=useMemo(function(){var _product$rating;if(!hideRating&&(product===null||product===void 0?void 0:(_product$rating=product.rating)===null||_product$rating===void 0?void 0:_product$rating.average)>0){return true;}if(!hideRating&&showEmptyRatingStars&&(product===null||product===void 0?void 0:product.rating)){return true;}return false;},[hideRating,product,showEmptyRatingStars]);return React.createElement(Link,{tagName:"a",href:getProductRoute(product.id),itemProp:"item",itemScope:true,itemType:"http://schema.org/Product"},isBeta()&&product.featuredMedia?React.createElement(FeaturedMedia,{type:product.featuredMedia.type,url:product.featuredMedia.url,altText:product.featuredMedia.altText}):React.createElement(ProductImage,{src:product.featuredImageBaseUrl,resolutions:gridResolutions,alt:product.name,itemProp:"image"}),React.createElement(ProductBadges,{location:location,productId:product.id},!!(!hidePrice&&product.price.discount)&&React.createElement("div",{className:styles.badgeWrapper},React.createElement(SurroundPortals,{portalName:PRODUCT_ITEM_DISCOUNT,portalProps:{productId:product.id}},React.createElement(DiscountBadge,{text:"-".concat(product.price.discount,"%")})))),!(hidePrice&&hideRating)&&React.createElement("div",{className:styles.details},showRatings&&React.createElement(RatingStars,{value:product.rating.average}),React.createElement(Swatches,{productId:product.id}),!hideName&&React.createElement(ProductName,{name:product.name,className:styles.title,testId:"Productname: ".concat(product.name),itemProp:"name",rows:titleRows||3}),React.createElement(MapPriceHint,{productId:product.id}),React.createElement(OrderQuantityHint,{productId:product.id}),!hidePrice&&React.createElement(SurroundPortals,{portalName:PRODUCT_ITEM_PRICE,portalProps:{productId:product.id,location:location}},React.createElement(ProductGridPrice,{product:product}))));}export default ProductCard;
9
+ * @return {JSX.Element}
10
+ */function ProductCard(props){var product=props.product,hidePrice=props.hidePrice,hideRating=props.hideRating,hideName=props.hideName,titleRows=props.titleRows;var _getProductImageSetti=getProductImageSettings(),gridResolutions=_getProductImageSetti.ListImage;var _useWidgetSettings=useWidgetSettings('@shopgate/engage/rating'),_useWidgetSettings$sh=_useWidgetSettings.showEmptyRatingStars,showEmptyRatingStars=_useWidgetSettings$sh===void 0?false:_useWidgetSettings$sh;var showRatings=useMemo(function(){var _product$rating;if(!hideRating&&(product===null||product===void 0?void 0:(_product$rating=product.rating)===null||_product$rating===void 0?void 0:_product$rating.average)>0){return true;}if(!hideRating&&showEmptyRatingStars&&(product===null||product===void 0?void 0:product.rating)){return true;}return false;},[hideRating,product,showEmptyRatingStars]);return React.createElement(Link,{className:"engage__product-card",href:getProductRoute(product.id),itemProp:"item",itemScope:true,itemType:"http://schema.org/Product",tabIndex:0},isBeta()&&product.featuredMedia?React.createElement(FeaturedMedia,{type:product.featuredMedia.type,url:product.featuredMedia.url,altText:product.featuredMedia.altText}):React.createElement(ProductImage,{src:product.featuredImageBaseUrl,resolutions:gridResolutions,alt:product.name,itemProp:"image"}),React.createElement(ProductBadges,{location:location,productId:product.id},!!(!hidePrice&&product.price.discount)&&React.createElement("div",{className:styles.badgeWrapper},React.createElement(SurroundPortals,{portalName:PRODUCT_ITEM_DISCOUNT,portalProps:{productId:product.id}},React.createElement(DiscountBadge,{text:"-".concat(product.price.discount,"%")})))),!(hidePrice&&hideRating)&&React.createElement("div",{className:styles.details},showRatings&&React.createElement(RatingStars,{value:product.rating.average}),React.createElement(Swatches,{productId:product.id}),!hideName&&React.createElement(ProductName,{name:product.name,className:styles.title,testId:"Productname: ".concat(product.name),itemProp:"name",rows:titleRows||3}),React.createElement(MapPriceHint,{productId:product.id}),React.createElement(OrderQuantityHint,{productId:product.id}),!hidePrice&&React.createElement(SurroundPortals,{portalName:PRODUCT_ITEM_PRICE,portalProps:{productId:product.id,location:location}},React.createElement(ProductGridPrice,{product:product}))));}export default ProductCard;
@@ -1,4 +1,4 @@
1
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 React from'react';import PropTypes from'prop-types';import{css}from'glamor';import{SurroundPortals}from'@shopgate/engage/components';import DiscountBadge from'@shopgate/pwa-ui-shared/DiscountBadge';import{PRODUCT_DISCOUNT}from'@shopgate/pwa-common-commerce/product/constants/Portals';import{useWidgetSettings}from'@shopgate/engage/core';import ProductBadges from"../ProductBadges";import styles from"./style";import connect from"./connector";/**
2
2
  * ProductDiscountBadge
3
- * @return {JSX}
4
- */var ProductDiscountBadge=function ProductDiscountBadge(_ref){var productId=_ref.productId,discount=_ref.discount;var _ref2=useWidgetSettings('@shopgate/engage/product/components/ProductDiscountBadge')||{},_ref2$pdp=_ref2.pdp,pdp=_ref2$pdp===void 0?{show:false,style:{}}:_ref2$pdp;return React.createElement(ProductBadges,{className:styles.portal,location:"productDiscountBadge",productId:productId,portalProps:_extends({},pdp)},pdp.show&&discount?React.createElement("div",{className:"".concat(styles.container," ").concat(css(pdp.style)," theme__product__product-discount"),"aria-hidden":true},React.createElement(SurroundPortals,{portalName:PRODUCT_DISCOUNT,portalProps:{productId:productId,discount:discount}},React.createElement(DiscountBadge,{className:styles.badge,text:"-".concat(discount,"%")}))):null);};ProductDiscountBadge.defaultProps={discount:null};export default connect(ProductDiscountBadge);
3
+ * @return {JSX.Element}
4
+ */var ProductDiscountBadge=function ProductDiscountBadge(_ref){var productId=_ref.productId,discount=_ref.discount;var _ref2=useWidgetSettings('@shopgate/engage/product/components/ProductDiscountBadge')||{},_ref2$pdp=_ref2.pdp,pdp=_ref2$pdp===void 0?{show:false,style:{}}:_ref2$pdp;return React.createElement(ProductBadges,{className:styles.portal,location:"productDiscountBadge",productId:productId,portalProps:_extends({},pdp)},pdp.show&&discount?React.createElement("div",{className:"".concat(styles.container," ").concat(css(pdp.style)," theme__product__product-discount")},React.createElement(SurroundPortals,{portalName:PRODUCT_DISCOUNT,portalProps:{productId:productId,discount:discount}},React.createElement(DiscountBadge,{className:styles.badge,text:"-".concat(discount,"%")}))):null);};ProductDiscountBadge.defaultProps={discount:null};export default connect(ProductDiscountBadge);
@@ -25,7 +25,7 @@ var showPlaceholder=!nextProps.src&&(!nextProps.srcmap||nextProps.srcmap.length=
25
25
  * Renders the component.
26
26
  * @returns {JSX.Element}
27
27
  */function render(){var _this$props=this.props,noBackground=_this$props.noBackground,className=_this$props.className,placeholderSrc=_this$props.placeholderSrc;var showInnerShadow=this.props.widgetSettings.showInnerShadow;if(typeof showInnerShadow==='undefined'){showInnerShadow=!appConfig.hideProductImageShadow;}if(this.state.imageLoadingFailed||this.state.showPlaceholder){// Image is not present or could not be loaded, show a placeholder.
28
- return React.createElement(SurroundPortals,{portalName:PORTAL_PRODUCT_IMAGE},React.createElement("div",{className:classnames(styles.placeholderContainer(this.getImageRatio()),_defineProperty(_defineProperty({},styles.innerShadow,showInnerShadow),className,!!className)),"aria-hidden":true},placeholderSrc?React.createElement(ProductImagePlaceholder,{src:placeholderSrc,showInnerShadow:showInnerShadow,noBackground:noBackground}):React.createElement("div",{className:styles.placeholderContent,"data-test-id":"placeHolder"},React.createElement(PlaceholderIcon,{className:styles.placeholder}))));}// Return the actual image.
29
- return React.createElement(SurroundPortals,{portalName:PORTAL_PRODUCT_IMAGE,portalProps:{src:this.props.src,resolutions:this.props.resolutions}},React.createElement("div",{"aria-hidden":true,className:"".concat(className," engage__product__product-image")},React.createElement(Image,_extends({},this.props,{className:showInnerShadow?styles.innerShadow:'',backgroundColor:noBackground?'transparent':colors.light,onError:this.imageLoadingFailed}))));}}]);}(Component);/**
28
+ return React.createElement(SurroundPortals,{portalName:PORTAL_PRODUCT_IMAGE},React.createElement("div",{className:classnames(styles.placeholderContainer(this.getImageRatio()),_defineProperty(_defineProperty({},styles.innerShadow,showInnerShadow),className,!!className))},placeholderSrc?React.createElement(ProductImagePlaceholder,{src:placeholderSrc,showInnerShadow:showInnerShadow,noBackground:noBackground}):React.createElement("div",{"aria-hidden":true,className:styles.placeholderContent,"data-test-id":"placeHolder"},React.createElement(PlaceholderIcon,{className:styles.placeholder}))));}// Return the actual image.
29
+ return React.createElement(SurroundPortals,{portalName:PORTAL_PRODUCT_IMAGE,portalProps:{src:this.props.src,resolutions:this.props.resolutions}},React.createElement("div",{className:"".concat(className," engage__product__product-image")},React.createElement(Image,_extends({},this.props,{className:showInnerShadow?styles.innerShadow:'',backgroundColor:noBackground?'transparent':colors.light,onError:this.imageLoadingFailed,"aria-hidden":!this.props.alt}))));}}]);}(Component);/**
30
30
  * See Image component manual for detailed description about the component property types.
31
31
  */_defineProperty(ProductImage,"defaultProps",{alt:null,animating:true,className:null,forcePlaceholder:false,highestResolutionLoaded:function highestResolutionLoaded(){},noBackground:false,ratio:null,resolutions:[{width:50,height:50,blur:2},{width:440,height:440}],src:null,srcmap:null,placeholderSrc:null,widgetSettings:{}});export{ProductImage as UnwrappedProductImage};export default connect(withWidgetSettings(ProductImage,'@shopgate/engage/product/ProductImage'));
@@ -2,4 +2,4 @@ import React from'react';import PropTypes from'prop-types';import{tableCell}from
2
2
  * Renders a single properties row.
3
3
  * @param {Object} props The component props.
4
4
  * @return {JSX.Element}
5
- */var Row=function Row(_ref){var label=_ref.label,value=_ref.value,type=_ref.type;return React.createElement("tr",{className:"engage__product__product-property","data-type":type,"data-label":label,"aria-label":"".concat(label,": ").concat(value),tabIndex:0},React.createElement("td",{className:tableCell,"aria-hidden":true},React.createElement("span",{dangerouslySetInnerHTML:{__html:label}})),React.createElement("td",{className:tableCell,"data-test-id":"property: ".concat(value),"aria-hidden":true},React.createElement("span",{dangerouslySetInnerHTML:{__html:value}})));};Row.defaultProps={type:null};export default React.memo(Row);
5
+ */var Row=function Row(_ref){var label=_ref.label,value=_ref.value,type=_ref.type;return React.createElement("tr",{className:"engage__product__product-property","data-type":type,"data-label":label,"aria-label":"".concat(typeof label==='string'?label:'',": ").concat(typeof value==='string'?value:''),tabIndex:0},React.createElement("td",{className:tableCell,"aria-hidden":true},React.createElement("span",{dangerouslySetInnerHTML:{__html:label}})),React.createElement("td",{className:tableCell,"data-test-id":"property: ".concat(value),"aria-hidden":true},React.createElement("span",{dangerouslySetInnerHTML:{__html:value}})));};Row.defaultProps={type:null};export default React.memo(Row);
@@ -3,5 +3,5 @@ function _typeof(obj){if(typeof Symbol==="function"&&typeof Symbol.iterator==="s
3
3
  */var scrollToRating=function scrollToRating(){var reviewsExcerpt=document.getElementById('reviewsExcerpt');if(_typeof(reviewsExcerpt)!=='object'||!reviewsExcerpt||!reviewsExcerpt.offsetTop||!reviewsExcerpt.closest||!reviewsExcerpt.closest('article')){return;}reviewsExcerpt.closest('article').scroll(0,reviewsExcerpt.offsetTop-30);};/**
4
4
  * The Rating component.
5
5
  * @param {Object} props The component props.
6
- * @return {JSX}
7
- */var Rating=function Rating(_ref){var rating=_ref.rating;var _useWidgetSettings=useWidgetSettings('@shopgate/engage/rating'),_useWidgetSettings$sh=_useWidgetSettings.showEmptyRatingStars,showEmptyRatingStars=_useWidgetSettings$sh===void 0?false:_useWidgetSettings$sh;var showRatings=useMemo(function(){if(hasReviews&&(rating===null||rating===void 0?void 0:rating.average)>0){return true;}if(hasReviews&&showEmptyRatingStars&&rating){return true;}return false;},[rating,showEmptyRatingStars]);return React.createElement(SurroundPortals,{portalName:PRODUCT_RATING},showRatings&&React.createElement("div",{className:container,onClick:scrollToRating,role:"link","aria-hidden":true},React.createElement(RatingStars,{value:rating.average,display:"big"}),React.createElement(RatingCount,{count:rating.count,prominent:true})));};Rating.defaultProps={rating:null};export default connect(memo(Rating));
6
+ * @return {JSX.Element}
7
+ */var Rating=function Rating(_ref){var rating=_ref.rating;var _useWidgetSettings=useWidgetSettings('@shopgate/engage/rating'),_useWidgetSettings$sh=_useWidgetSettings.showEmptyRatingStars,showEmptyRatingStars=_useWidgetSettings$sh===void 0?false:_useWidgetSettings$sh;var showRatings=useMemo(function(){if(hasReviews&&(rating===null||rating===void 0?void 0:rating.average)>0){return true;}if(hasReviews&&showEmptyRatingStars&&rating){return true;}return false;},[rating,showEmptyRatingStars]);return React.createElement(SurroundPortals,{portalName:PRODUCT_RATING},showRatings&&React.createElement("div",{className:container,onClick:scrollToRating,role:"presentation"},React.createElement(RatingStars,{value:rating.average,display:"big"}),React.createElement(RatingCount,{count:rating.count,prominent:true})));};Rating.defaultProps={rating:null};export default connect(memo(Rating));
@@ -7,4 +7,4 @@ try{// encode SVG string to UTF-8 byte array to handle non-Latin1 characters
7
7
  // (e.g. Unicode characters like emojis)
8
8
  var utf8Encoder=new TextEncoder();var svgBytes=utf8Encoder.encode(modalImageSVG);// Convert the byte array to a Base64 string
9
9
  var base64Svg=btoa(String.fromCharCode.apply(null,svgBytes));return"data:image/svg+xml;base64,".concat(base64Svg);}catch(e){return pushImage;}},[modalImageSVG,modalImageURL]);// Button event handlers are throttled to prevent multiple clicks
10
- var handleAllowPushOptIn=useCallback(throttle(allowPushOptIn,1000,{leading:true,trailing:false}),[]);var handleDenyPushOptIn=useCallback(throttle(denyPushOptIn,1000,{leading:true,trailing:false}),[]);if(!isPushOptInModalVisible){return null;}return React.createElement(Modal,{isOpened:isPushOptInModalVisible,classes:{content:styles.modalContent,layout:styles.modalLayout}},React.createElement(Grid,{className:classNames(styles.container,'push-opt-in-modal__container'),role:"alertdialog","aria-modal":true,"aria-labelledby":"pushOptInDialogTitle","aria-describedby":"pushOptInDialogMessage"},React.createElement(Grid.Item,{className:styles.item},React.createElement("img",{src:imageSRC,className:classNames(styles.image,'push-opt-in-modal__image'),alt:"","aria-hidden":"true"}),React.createElement(I18n.Text,{className:classNames(styles.title,'push-opt-in-modal__title'),string:modalTitle||'pushOptInModal.title',id:"pushOptInDialogTitle"}),React.createElement(I18n.Text,{className:classNames('push-opt-in-modal__message'),string:modalMessage||'pushOptInModal.message',id:"pushOptInDialogMessage"}),React.createElement(Button,{onClick:handleAllowPushOptIn,type:"primary",className:classNames(styles.button,'push-opt-in-modal__button-allow')},React.createElement(I18n.Text,{string:modalButtonAllow||'pushOptInModal.buttonAllow'})),React.createElement(Button,{onClick:handleDenyPushOptIn,type:"plain",className:classNames(styles.button,'push-opt-in-modal__button-deny')},React.createElement(I18n.Text,{string:modalButtonDeny||'pushOptInModal.buttonDeny',className:styles.buttonText})))));};export default connect(PushOptInModal);
10
+ var handleAllowPushOptIn=useCallback(throttle(allowPushOptIn,1000,{leading:true,trailing:false}),[]);var handleDenyPushOptIn=useCallback(throttle(denyPushOptIn,1000,{leading:true,trailing:false}),[]);if(!isPushOptInModalVisible){return null;}return React.createElement(Modal,{classes:{content:styles.modalContent,layout:styles.modalLayout}},React.createElement(Grid,{className:classNames(styles.container,'push-opt-in-modal__container'),role:"alertdialog","aria-modal":true,"aria-labelledby":"pushOptInDialogTitle","aria-describedby":"pushOptInDialogMessage"},React.createElement(Grid.Item,{className:styles.item},React.createElement("img",{src:imageSRC,className:classNames(styles.image,'push-opt-in-modal__image'),alt:"","aria-hidden":"true"}),React.createElement(I18n.Text,{className:classNames(styles.title,'push-opt-in-modal__title'),string:modalTitle||'pushOptInModal.title',id:"pushOptInDialogTitle"}),React.createElement(I18n.Text,{className:classNames('push-opt-in-modal__message'),string:modalMessage||'pushOptInModal.message',id:"pushOptInDialogMessage"}),React.createElement(Button,{onClick:handleAllowPushOptIn,type:"primary",className:classNames(styles.button,'push-opt-in-modal__button-allow')},React.createElement(I18n.Text,{string:modalButtonAllow||'pushOptInModal.buttonAllow'})),React.createElement(Button,{onClick:handleDenyPushOptIn,type:"plain",className:classNames(styles.button,'push-opt-in-modal__button-deny')},React.createElement(I18n.Text,{string:modalButtonDeny||'pushOptInModal.buttonDeny',className:styles.buttonText})))));};export default connect(PushOptInModal);
@@ -5,7 +5,7 @@ import _regeneratorRuntime from"@babel/runtime/regenerator";function _typeof(obj
5
5
  * @param {Object} subscriptionParams Params from the subscription callback
6
6
  * @param {string} configKey The "pushOptIn" key to be used
7
7
  * @param {Function} increaseCountAction Action to increase the count in Redux for the configKey
8
- * @returns {void}
8
+ * @returns {Promise<void>}
9
9
  */var showOptInAfterChecks=/*#__PURE__*/function(){var _ref3=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(_ref2,configKey,increaseCountAction){var dispatch,getState,_appConfig$pushOptIn,_appConfig$pushOptIn2,appStarts,ordersPlaced,rejectionMaxCount,minDaysBetweenOptIns,_ref4,pushStatus,state,configValue,resetAction,resetCountState,configCountState,mustShowModal,hasRepeats,minDaysElapsed,meta;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:dispatch=_ref2.dispatch,getState=_ref2.getState;if(appSupportsPushOptIn()){_context.next=3;break;}return _context.abrupt("return");case 3:_appConfig$pushOptIn=appConfig.pushOptIn,_appConfig$pushOptIn2=_appConfig$pushOptIn===void 0?{}:_appConfig$pushOptIn,appStarts=_appConfig$pushOptIn2.appStarts,ordersPlaced=_appConfig$pushOptIn2.ordersPlaced,rejectionMaxCount=_appConfig$pushOptIn2.rejectionMaxCount,minDaysBetweenOptIns=_appConfig$pushOptIn2.minDaysBetweenOptIns;// Deactivate feature when config is invalid
10
10
  if(!(typeof minDaysBetweenOptIns!=='number'||typeof rejectionMaxCount!=='number'||_typeof(ordersPlaced)!=='object'||_typeof(appStarts)!=='object')){_context.next=7;break;}logger.error('PushOptInTrigger - Config invalid',appConfig===null||appConfig===void 0?void 0:appConfig.pushOptIn);return _context.abrupt("return");case 7:_context.next=9;return dispatch(requestAppPermissionStatus({permissionId:PERMISSION_ID_PUSH}));case 9:_ref4=_context.sent;pushStatus=_ref4.status;if(!(pushStatus!==PERMISSION_STATUS_NOT_DETERMINED)){_context.next=13;break;}return _context.abrupt("return");case 13:dispatch(increaseCountAction());state=getPushOptInTriggerState(getState());configValue=appStarts;resetAction=resetAppStartCount;resetCountState=state.appStartResetCount;configCountState=state.appStartCount;if(configKey==='ordersPlaced'){configValue=ordersPlaced;resetAction=resetOrdersPlacedCount;resetCountState=state.ordersPlacedResetCount;configCountState=state.ordersPlacedCount;}if(!(state.rejectionCount>=rejectionMaxCount)){_context.next=22;break;}return _context.abrupt("return");case 22:mustShowModal=Number(configValue.value)>0&&configCountState>=configValue.value;hasRepeats=configValue.repeats===null||resetCountState<=configValue.repeats;minDaysElapsed=Date.now()-new Date(state.lastPopupAt)>=minDaysBetweenOptIns*DAY_IN_MS;if(mustShowModal&&hasRepeats&&minDaysElapsed){meta=getPushOptInTrackingMeta(getState());dispatch(softOptInShown({meta:meta}));dispatch(setLastPopupTimestamp());dispatch(resetAction());dispatch(showPushOptInModal(configKey));}case 26:case"end":return _context.stop();}},_callee);}));return function showOptInAfterChecks(_x,_x2,_x3){return _ref3.apply(this,arguments);};}();// event subscriber to handle app start based push opt in
11
11
  subscribe(cookieConsentInitialized$,/*#__PURE__*/function(){var _ref6=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref5){var dispatch,getState;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:dispatch=_ref5.dispatch,getState=_ref5.getState;_context2.next=3;return showOptInAfterChecks({dispatch:dispatch,getState:getState},'appStarts',increaseAppStartCount);case 3:case"end":return _context2.stop();}},_callee2);}));return function(_x4){return _ref6.apply(this,arguments);};}());// event subscriber to handle order based push opt in
@@ -1,7 +1,9 @@
1
- import React from'react';import PropTypes from'prop-types';import RatingStars from'@shopgate/pwa-ui-shared/RatingStars';import Link from'@shopgate/pwa-common/components/Link';import{ITEM_PATH}from'@shopgate/pwa-common-commerce/product/constants';import{bin2hex}from'@shopgate/pwa-common/helpers/data';import appConfig from'@shopgate/pwa-common/helpers/config';import RatingCount from"../../../RatingCount";import{container}from"./style";/**
1
+ import React from'react';import PropTypes from'prop-types';import RatingStars from'@shopgate/pwa-ui-shared/RatingStars';import{Link}from'@shopgate/engage/components';import{ITEM_PATH}from'@shopgate/pwa-common-commerce/product/constants';import{bin2hex}from'@shopgate/pwa-common/helpers/data';import appConfig from'@shopgate/pwa-common/helpers/config';import RatingCount from"../../../RatingCount";import{container}from"./style";/**
2
2
  * The average rating and number of ratings for a product.
3
- * @param {Object} rating The rating values.
4
- * @param {string} productId The related product ID.
5
- * @returns {JSX}
3
+ * @param {Object} props The component props
4
+ * @param {number} props.average The average rating
5
+ * @param {number} props.count The rating count
6
+ * @param {string} props.productId The related product ID.
7
+ * @returns {JSX.Element}
6
8
  */var AverageRating=function AverageRating(_ref){var average=_ref.average,count=_ref.count,productId=_ref.productId;if(!productId){return null;}return React.createElement(Link,{"data-test-id":"ratedStarsAverage",tagName:"a",href:"".concat(ITEM_PATH,"/").concat(bin2hex(productId),"/write_review"),disabled:!appConfig.showWriteReview,className:container,itemProp:"item",itemScope:true,itemType:"http://schema.org/Review"// eslint-disable-next-line jsx-a11y/aria-role
7
9
  ,role:"text"},React.createElement(RatingStars,{value:average,display:"large"}),React.createElement(RatingCount,{count:count}));};AverageRating.defaultProps={average:0,count:0,productId:null};export default AverageRating;
@@ -1,3 +1,3 @@
1
- import React,{Fragment}from'react';import PropTypes from'prop-types';import I18n from'@shopgate/pwa-common/components/I18n';import appConfig from'@shopgate/pwa-common/helpers/config';import AverageRating from"../AverageRating";import WriteReviewLink from"../WriteReviewLink";import*as styles from"./style";/**
2
- * @return {JSX}
3
- */var NoReviews=function NoReviews(_ref){var productId=_ref.productId;return React.createElement("div",{className:styles.container,"aria-hidden":true},React.createElement(AverageRating,{productId:productId}),React.createElement("div",{className:styles.noReviews},appConfig.showWriteReview&&React.createElement(Fragment,null,React.createElement(I18n.Text,{string:"reviews.no_reviews"}),React.createElement(WriteReviewLink,{productId:productId}))));};NoReviews.defaultProps={productId:null};export default NoReviews;
1
+ import React,{Fragment}from'react';import PropTypes from'prop-types';import{I18n}from'@shopgate/engage/components';import appConfig from'@shopgate/pwa-common/helpers/config';import AverageRating from"../AverageRating";import WriteReviewLink from"../WriteReviewLink";import*as styles from"./style";/**
2
+ * @return {JSX.Element}
3
+ */var NoReviews=function NoReviews(_ref){var productId=_ref.productId;return React.createElement("div",{className:styles.container},React.createElement(AverageRating,{productId:productId}),React.createElement("div",{className:styles.noReviews},appConfig.showWriteReview&&React.createElement(Fragment,null,React.createElement(I18n.Text,{string:"reviews.no_reviews"}),React.createElement(WriteReviewLink,{productId:productId}))));};NoReviews.defaultProps={productId:null};export default NoReviews;
@@ -1,4 +1,4 @@
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;}import React from'react';import PropTypes from'prop-types';import classNames from'classnames';import appConfig from'@shopgate/pwa-common/helpers/config';import I18n from'@shopgate/pwa-common/components/I18n';import RatingNumber from'@shopgate/pwa-ui-shared/RatingNumber';import AverageRating from"../AverageRating";import WriteReviewLink from"../WriteReviewLink";import*as styles from"./style";/* eslint-disable jsx-a11y/aria-role */ /**
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;}import React from'react';import PropTypes from'prop-types';import classNames from'classnames';import appConfig from'@shopgate/pwa-common/helpers/config';import I18n from'@shopgate/pwa-common/components/I18n';import{RatingNumber}from'@shopgate/engage/components';import AverageRating from"../AverageRating";import WriteReviewLink from"../WriteReviewLink";import*as styles from"./style";/**
2
2
  * @param {Object} props The component props.
3
- * @returns {JSX}
4
- */var ReviewsExcerpt=function ReviewsExcerpt(_ref){var productId=_ref.productId,average=_ref.average,count=_ref.count,withTopGap=_ref.withTopGap;return React.createElement("div",{className:classNames('engage__reviews__reviews-excerpt',_defineProperty(_defineProperty({},styles.withTopGapContainer,withTopGap),styles.container,!withTopGap)),id:"reviewsExcerpt"},React.createElement(AverageRating,{productId:productId,average:average,count:count}),React.createElement("div",{className:styles.reviewsLine,role:"text"},React.createElement(I18n.Text,{string:"reviews.rating",className:styles.averageRatingText},React.createElement(RatingNumber,{rating:average,className:styles.averageRatingNumber})),appConfig.showWriteReview&&React.createElement(WriteReviewLink,{productId:productId})));};/* eslint-enable jsx-a11y/aria-role */ReviewsExcerpt.defaultProps={average:0,count:0,productId:null,withTopGap:false};export default ReviewsExcerpt;
3
+ * @returns {JSX.Element}
4
+ */var ReviewsExcerpt=function ReviewsExcerpt(_ref){var productId=_ref.productId,average=_ref.average,count=_ref.count,withTopGap=_ref.withTopGap;return React.createElement("div",{className:classNames('engage__reviews__reviews-excerpt',_defineProperty(_defineProperty({},styles.withTopGapContainer,withTopGap),styles.container,!withTopGap)),id:"reviewsExcerpt"},React.createElement(AverageRating,{productId:productId,average:average,count:count}),React.createElement("div",{className:styles.reviewsLine},React.createElement(I18n.Text,{string:"reviews.rating",className:styles.averageRatingText},React.createElement(RatingNumber,{rating:average,className:styles.averageRatingNumber})),appConfig.showWriteReview&&React.createElement(WriteReviewLink,{productId:productId})));};ReviewsExcerpt.defaultProps={average:0,count:0,productId:null,withTopGap:false};export default ReviewsExcerpt;
@@ -1,4 +1,4 @@
1
- import React from'react';import PropTypes from'prop-types';import I18n from'@shopgate/pwa-common/components/I18n';import{i18n}from'@shopgate/engage/core';import{ITEM_PATH}from'@shopgate/pwa-common-commerce/product/constants';import{bin2hex}from'@shopgate/pwa-common/helpers/data';import ButtonLink from'@shopgate/pwa-ui-shared/ButtonLink';/**
1
+ import React from'react';import PropTypes from'prop-types';import{I18n}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core';import{ITEM_PATH}from'@shopgate/pwa-common-commerce/product/constants';import{bin2hex}from'@shopgate/pwa-common/helpers/data';import ButtonLink from'@shopgate/pwa-ui-shared/ButtonLink';/**
2
2
  * Link to add a review.
3
- * @returns {JSX|null}
4
- */var WriteReviewLink=function WriteReviewLink(_ref){var productId=_ref.productId;return React.createElement("div",{"data-test-id":"writeReview","aria-hidden":true,className:"engage__reviews__write-review-link"},React.createElement(ButtonLink,{href:"".concat(ITEM_PATH,"/").concat(bin2hex(productId),"/write_review"),noGap:true,"aria-label":i18n.text('reviews.button_add')},React.createElement(I18n.Text,{string:"reviews.button_add"})));};export default WriteReviewLink;
3
+ * @returns {JSX.Element}
4
+ */var WriteReviewLink=function WriteReviewLink(_ref){var productId=_ref.productId;return React.createElement("div",{"data-test-id":"writeReview",className:"engage__reviews__write-review-link"},React.createElement(ButtonLink,{href:"".concat(ITEM_PATH,"/").concat(bin2hex(productId),"/write_review"),noGap:true,"aria-label":i18n.text('reviews.button_add')},React.createElement(I18n.Text,{string:"reviews.button_add"})));};export default WriteReviewLink;
@@ -1,5 +1,5 @@
1
- import React from'react';import{Provider}from'react-redux';import configureStore from'redux-mock-store';import{mount}from'enzyme';import{mockedStateWithAll}from'@shopgate/pwa-common-commerce/reviews/mock';import WriteReviewLink from"./index";var mockedStore=configureStore();/**
1
+ import React from'react';import{Provider}from'react-redux';import configureStore from'redux-mock-store';import{mount}from'enzyme';import{mockedStateWithAll}from'@shopgate/pwa-common-commerce/reviews/mock';import WriteReviewLink from"./index";var mockedStore=configureStore();jest.mock('@shopgate/engage/components');/**
2
2
  * Creates component with provided store state.
3
3
  * @param {Object} mockedState Mocked stage.
4
4
  * @return {ReactWrapper}
5
- */var createComponent=function createComponent(mockedState){var Component=React.createElement(Provider,{store:mockedStore(mockedState)},React.createElement(WriteReviewLink,{productId:"foo"}));return mount(Component);};describe('<WriteReviewLink>',function(){var component=null;beforeEach(function(){jest.resetModules();});it('should render when current product is set',function(){component=createComponent(mockedStateWithAll);expect(component).toMatchSnapshot();expect(component.find('span').exists()).toBe(true);});});
5
+ */var createComponent=function createComponent(mockedState){var Component=React.createElement(Provider,{store:mockedStore(mockedState)},React.createElement(WriteReviewLink,{productId:"foo"}));return mount(Component);};describe('<WriteReviewLink>',function(){var component=null;beforeEach(function(){jest.resetModules();});it('should render when current product is set',function(){component=createComponent(mockedStateWithAll);expect(component).toMatchSnapshot();expect(component.find('Text[string="reviews.button_add"]').exists()).toBe(true);});});
@@ -1,6 +1,8 @@
1
1
  import React from'react';import PropTypes from'prop-types';import NoReviews from"./components/NoReviews";import ReviewsExcerpt from"./components/ReviewsExcerpt";import connect from"./connector";/**
2
2
  * The header of the reviews component
3
- * @param {Object} rating The rating values
4
- * @param {bool} withTopGap Adds additional top gap when true.
5
- * @returns {JSX}
3
+ * @param {Object} props The component props
4
+ * @param {string} props.productId The related product ID.
5
+ * @param {Object} props.rating The rating values
6
+ * @param {boolean} props.withTopGap Adds additional top gap when true.
7
+ * @returns {JSX.Element}
6
8
  */var Header=function Header(_ref){var productId=_ref.productId,rating=_ref.rating,withTopGap=_ref.withTopGap;if(!rating){return null;}var _rating$average=rating.average,average=_rating$average===void 0?0:_rating$average,_rating$count=rating.count,count=_rating$count===void 0?0:_rating$count;if(!average){return React.createElement(NoReviews,{productId:productId});}return React.createElement(ReviewsExcerpt,{productId:productId,average:average,count:count,withTopGap:withTopGap});};Header.defaultProps={productId:null,rating:null,withTopGap:false};export default connect(Header);
@@ -1,4 +1,4 @@
1
- import React from'react';import{Provider}from'react-redux';import{mount}from'enzyme';import configureStore from'redux-mock-store';import mockRenderOptions from'@shopgate/pwa-common/helpers/mocks/mockRenderOptions';import{mockProductId,mockedStateWithoutReview,mockedStateWithAll}from'@shopgate/pwa-common-commerce/reviews/mock';import Header from"./index";var mockedStore=configureStore();/**
1
+ import React from'react';import{Provider}from'react-redux';import{mount}from'enzyme';import configureStore from'redux-mock-store';import mockRenderOptions from'@shopgate/pwa-common/helpers/mocks/mockRenderOptions';import{mockProductId,mockedStateWithoutReview,mockedStateWithAll}from'@shopgate/pwa-common-commerce/reviews/mock';import Header from"./index";var mockedStore=configureStore();jest.mock('@shopgate/engage/components');/**
2
2
  * Creates component with provided store state.
3
3
  * @param {Object} mockedState Mocked stage.
4
4
  * @param {Object|null} props Rating prop.
@@ -1,5 +1,4 @@
1
1
  import React from'react';import{css}from'glamor';import classNames from'classnames';import appConfig from'@shopgate/pwa-common/helpers/config';import{Link}from'@shopgate/engage/components';var styles={root:css({textAlign:'center',marginTop:8,fontSize:'.875rem',fontWeight:300,lineHeight:1.5,padding:'0 1rem 1rem'}).toString(),link:css({textAlign:'center',fontWeight:600,marginTop:8}).toString()};var _appConfig$reviewsInf=appConfig.reviewsInfo,_appConfig$reviewsInf2=_appConfig$reviewsInf===void 0?{}:_appConfig$reviewsInf,text=_appConfig$reviewsInf2.text,linkText=_appConfig$reviewsInf2.linkText,linkUrl=_appConfig$reviewsInf2.linkUrl;/**
2
2
  * The ReviewsInfo component
3
- * @param {Object} props The component props
4
- * @returns {JSX}
3
+ * @returns {JSX.Element}
5
4
  */var ReviewsInfo=function ReviewsInfo(){if(!text){return null;}return React.createElement("div",{className:classNames(styles.root,'engage__reviews__review_info_text')},React.createElement("div",null,text,linkText&&linkUrl&&React.createElement(Link,{href:linkUrl,className:styles.link},linkText)));};export default ReviewsInfo;
@@ -1,2 +1,3 @@
1
- import{css}from'glamor';import{useScrollContainer,hasWebBridge,isIOSTheme}from'@shopgate/engage/core';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var typography=themeConfig.typography;var iosThemeActive=isIOSTheme();css.global('*, *:before, *:after',{boxSizing:'border-box'});css.global('*',{touchAction:'manipulation'});css.global('::-moz-focus-inner',{border:0});css.global('html, body',{WebkitTapHighlightColor:'transparent',width:'100%',height:'100%'});css.global('html',{overflow:useScrollContainer()?'hidden':'inherit',MozOsxFontSmoothing:'grayscale',WebkitFontSmoothing:'antialiased',MsTextSizeAdjust:'100%',WebkitTextSizeAdjust:'100%',minHeight:'100%'});css.global('body',{font:"".concat(typography.rootSize,"px/").concat(typography.lineHeight," ").concat(typography.family),overflow:'auto',margin:0,WebkitOverflowScrolling:'touch',WebkitUserSelect:hasWebBridge()?'inherit':'none',userSelect:hasWebBridge()?'inherit':'none',color:'var(--color-text-high-emphasis)'});css.global('[data-pattern]',{height:'100% !important'});css.global('html, body',{backgroundColor:'var(--page-background-color)'});if(hasWebBridge()&&!iosThemeActive){css.insert("@media(min-width: 600px) {\n html, body {\n background-color: var(--color-background-gutter-body, var(--page-background-color))\n }\n }");}// since iOS 15 button has a default color of blue rgb(0, 122, 255);
1
+ var _typography$family;import{css}from'glamor';import{useScrollContainer,hasWebBridge,isIOSTheme,isWindows,isDev}from'@shopgate/engage/core/helpers';import{themeConfig}from'@shopgate/engage';var typography=themeConfig.typography;var iosThemeActive=isIOSTheme();css.global('*, *:before, *:after',{boxSizing:'border-box'});css.global('*',{touchAction:'manipulation'});css.global('::-moz-focus-inner',{border:0});css.global('html, body',{WebkitTapHighlightColor:'transparent',width:'100%',height:'100%'});css.global('html',{overflow:useScrollContainer()?'hidden':'inherit',MozOsxFontSmoothing:'grayscale',WebkitFontSmoothing:'antialiased',MsTextSizeAdjust:'100%',WebkitTextSizeAdjust:'100%',minHeight:'100%'});// Include Roboto font on Windows in dev mode on iOS theme, so that developers see nice fonts.
2
+ var fontSuffix=isDev&&iosThemeActive&&isWindows&&!((_typography$family=typography.family)!==null&&_typography$family!==void 0?_typography$family:'').includes('Roboto')?', Roboto':'';css.global('body',{font:"".concat(typography.rootSize,"px/").concat(typography.lineHeight," ").concat(typography.family).concat(fontSuffix),overflow:'auto',margin:0,WebkitOverflowScrolling:'touch',WebkitUserSelect:hasWebBridge()?'inherit':'none',userSelect:hasWebBridge()?'inherit':'none',color:'var(--color-text-high-emphasis)'});css.global('[data-pattern]',{height:'100% !important'});css.global('html, body',{backgroundColor:'var(--page-background-color)'});if(hasWebBridge()&&!iosThemeActive){css.insert("@media(min-width: 600px) {\n html, body {\n background-color: var(--color-background-gutter-body, var(--page-background-color))\n }\n }");}// since iOS 15 button has a default color of blue rgb(0, 122, 255);
2
3
  css.global('button',{color:'inherit'});
@@ -7,4 +7,4 @@ try{// encode SVG string to UTF-8 byte array to handle non-Latin1 characters
7
7
  // (e.g. Unicode characters like emojis)
8
8
  var utf8Encoder=new TextEncoder();var svgBytes=utf8Encoder.encode(modalImageSVG);// Convert the byte array to a Base64 string
9
9
  var base64Svg=btoa(String.fromCharCode.apply(null,svgBytes));return"data:image/svg+xml;base64,".concat(base64Svg);}catch(e){return cookieImage;}},[modalImageSVG,modalImageURL]);// Button event handlers are throttled to prevent multiple clicks
10
- var handleAcceptAllCookies=useCallback(throttle(acceptAllCookies,1000,{leading:true,trailing:false}),[]);var handleAcceptRequiredCookies=useCallback(throttle(acceptRequiredCookies,1000,{leading:true,trailing:false}),[]);var handleOpenPrivacySettings=useCallback(throttle(openPrivacySettings,1000,{leading:true,trailing:false}),[]);if(!isCookieConsentModalVisible){return null;}return React.createElement(Modal,{isOpened:isCookieConsentModalVisible,classes:{content:styles.modalContent,layout:styles.modalLayout}},React.createElement(Grid,{component:"div",className:classNames(styles.container,'cookie-consent-modal__container'),role:"alertdialog","aria-modal":true,"aria-labelledby":"cookieConsentDialogTitle","aria-describedby":"cookieConsentDialogMessage"},React.createElement(Grid.Item,{component:"div",className:styles.item},React.createElement("img",{src:imageSRC,className:classNames(styles.image,'cookie-consent-modal__image'),alt:"","aria-hidden":"true"}),React.createElement(I18n.Text,{className:classNames(styles.title,'cookie-consent-modal__title'),string:modalTitle||'cookieConsentModal.title',id:"cookieConsentDialogTitle"}),React.createElement(I18n.Text,{string:modalMessage||'cookieConsentModal.message',className:classNames('cookie-consent-modal__message'),acceptPlainTextWithPlaceholders:true,id:"cookieConsentDialogMessage"},React.createElement(I18n.Placeholder,{forKey:"privacyLink"},React.createElement(ConditionalWrapper,{condition:!!privacyPolicyLink,wrapper:function wrapper(children){return React.createElement(Link,{href:privacyPolicyLink,tag:"span"},children);}},React.createElement(I18n.Text,{string:"cookieConsentModal.privacyText",className:styles.link})))),React.createElement(Grid.Item,{component:"div",className:styles.buttonWrapper},React.createElement(Button,{onClick:handleAcceptAllCookies,type:"primary",className:classNames(styles.button,'cookie-consent-modal__button-accept-all')},React.createElement(I18n.Text,{string:modalButtonAcceptAll||'cookieConsentModal.buttonAcceptAll'})),showRequiredCookiesButton?React.createElement(Button,{onClick:handleAcceptRequiredCookies,type:"simple",className:classNames(styles.button,'cookie-consent-modal__button-accept-required')},React.createElement(I18n.Text,{string:modalButtonOnlyRequired||'cookieConsentModal.modalButtonOnlyRequired'})):null,React.createElement(Button,{onClick:handleOpenPrivacySettings,type:"simple",className:classNames(styles.button,'cookie-consent-modal__button-open-settings')},React.createElement(I18n.Text,{string:modalButtonConfigureSettings||'cookieConsentModal.buttonConfigure'}))))));};CookieConsentModal.defaultProps={privacyPolicyLink:null};export default connect(CookieConsentModal);
10
+ var handleAcceptAllCookies=useCallback(throttle(acceptAllCookies,1000,{leading:true,trailing:false}),[]);var handleAcceptRequiredCookies=useCallback(throttle(acceptRequiredCookies,1000,{leading:true,trailing:false}),[]);var handleOpenPrivacySettings=useCallback(throttle(openPrivacySettings,1000,{leading:true,trailing:false}),[]);if(!isCookieConsentModalVisible){return null;}return React.createElement(Modal,{classes:{content:styles.modalContent,layout:styles.modalLayout}},React.createElement(Grid,{component:"div",className:classNames(styles.container,'cookie-consent-modal__container'),role:"alertdialog","aria-modal":true,"aria-labelledby":"cookieConsentDialogTitle","aria-describedby":"cookieConsentDialogMessage"},React.createElement(Grid.Item,{component:"div",className:styles.item},React.createElement("img",{src:imageSRC,className:classNames(styles.image,'cookie-consent-modal__image'),alt:"","aria-hidden":"true"}),React.createElement(I18n.Text,{className:classNames(styles.title,'cookie-consent-modal__title'),string:modalTitle||'cookieConsentModal.title',id:"cookieConsentDialogTitle"}),React.createElement(I18n.Text,{string:modalMessage||'cookieConsentModal.message',className:classNames('cookie-consent-modal__message'),acceptPlainTextWithPlaceholders:true,id:"cookieConsentDialogMessage"},React.createElement(I18n.Placeholder,{forKey:"privacyLink"},React.createElement(ConditionalWrapper,{condition:!!privacyPolicyLink,wrapper:function wrapper(children){return React.createElement(Link,{href:privacyPolicyLink,tag:"span"},children);}},React.createElement(I18n.Text,{string:"cookieConsentModal.privacyText",className:styles.link})))),React.createElement(Grid.Item,{component:"div",className:styles.buttonWrapper},React.createElement(Button,{onClick:handleAcceptAllCookies,type:"primary",className:classNames(styles.button,'cookie-consent-modal__button-accept-all')},React.createElement(I18n.Text,{string:modalButtonAcceptAll||'cookieConsentModal.buttonAcceptAll'})),showRequiredCookiesButton?React.createElement(Button,{onClick:handleAcceptRequiredCookies,type:"simple",className:classNames(styles.button,'cookie-consent-modal__button-accept-required')},React.createElement(I18n.Text,{string:modalButtonOnlyRequired||'cookieConsentModal.modalButtonOnlyRequired'})):null,React.createElement(Button,{onClick:handleOpenPrivacySettings,type:"simple",className:classNames(styles.button,'cookie-consent-modal__button-open-settings')},React.createElement(I18n.Text,{string:modalButtonConfigureSettings||'cookieConsentModal.buttonConfigure'}))))));};CookieConsentModal.defaultProps={privacyPolicyLink:null};export default connect(CookieConsentModal);
@@ -1,3 +0,0 @@
1
- import _isEmpty from"lodash/isEmpty";import _every from"lodash/every";import React,{Fragment,useMemo,useContext}from'react';import{Grid,I18n}from'@shopgate/engage/components';import{StoreFinderContext}from"../../locations.context";import{StoreAddress}from"../StoreList/StoreAddress";import{StoreOpeningHours}from"../StoreList/StoreOpeningHours";import{StoreHoursToday}from"../StoreList/StoreHoursToday";import{StoreDistance}from"../StoreList/StoreDistance";import StoreFinderGetDirectionsButton from"./StoreFinderGetDirectionsButton";import StoreFinderLocationHeaderPhoneNumber from"./StoreFinderLocationHeaderPhoneNumber";import{container,headingLine,storeName,storeHours,storeDistance,storeDetailsLine,storeAddress,storePhoneNumber,storeOpeningHours,directionButton}from"./StoreFinderLocationDetailsWide.style";import{StoreFinderSelectLocationButton}from"./StoreFinderSelectLocationButton";import{StoreContext}from"./Store.context";/**
2
- * @returns {JSX}
3
- */var StoreFinderLocationDetailsWide=function StoreFinderLocationDetailsWide(){var _useContext=useContext(StoreFinderContext),location=_useContext.selectedLocation,locations=_useContext.locations;var hasOperationHours=useMemo(function(){var _ref=location||{},operationHours=_ref.operationHours;return operationHours&&!_every(operationHours,_isEmpty);},[location]);if(!location||locations.length===0){return null;}return React.createElement(StoreContext.Provider,{value:location},React.createElement("div",{className:container},React.createElement(Grid,{className:headingLine},React.createElement(Grid.Item,{grow:1},React.createElement("div",{className:storeName},location.name),React.createElement("div",{className:storeHours},React.createElement(StoreHoursToday,{hours:location.operationHours,longLabel:true}))),React.createElement(Grid.Item,null,React.createElement("div",{className:storeDistance},React.createElement(StoreDistance,{distance:location.distance,unitSystem:location.unitSystem})),React.createElement(StoreFinderSelectLocationButton,null),React.createElement(StoreFinderGetDirectionsButton,{address:location.address,className:directionButton}))),React.createElement(Grid,{className:storeDetailsLine},React.createElement(Grid.Item,null,React.createElement("div",{className:storeAddress},React.createElement(StoreAddress,{pure:true,address:location.address})),location.address.phoneNumber&&React.createElement("div",{className:storePhoneNumber},React.createElement(I18n.Text,{string:"locations.phone"}),': ',React.createElement(StoreFinderLocationHeaderPhoneNumber,{phone:location.address.phoneNumber,pure:true}))),React.createElement(Grid.Item,{className:storeOpeningHours},hasOperationHours&&React.createElement(Fragment,null,React.createElement(I18n.Text,{string:"locations.store_hours"}),':',React.createElement(StoreOpeningHours,{pure:true,hours:location.operationHours}))))));};export default StoreFinderLocationDetailsWide;
@@ -1 +0,0 @@
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{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors,variables=themeConfig.variables;export var container=css({background:colors.light,border:"1px solid ".concat(colors.shade7),boxSizing:'border-box',boxShadow:'0px 1px 2px rgba(0, 0, 0, 0.25)',borderRadius:3,padding:variables.gap.big}).toString();var linePadding={paddingBottom:variables.gap.big};export var headingLine=css(_extends({},linePadding,{fontWeight:500,fontSize:'1.125rem',lineHeight:'1.5rem'})).toString();export var storeName=css({paddingBottom:variables.gap.small});export var storeDistance=css({textAlign:'right',':not(:empty)':{paddingBottom:variables.gap.small},' > *':{fontWeight:500,fontSize:'1.125rem',lineHeight:'1.5rem'}}).toString();export var storeHours=css({' > *':{color:'var(--color-text-medium-emphasis)',fontWeight:'normal'}}).toString();export var directionButton=css({minWidth:220}).toString();export var storeDetailsLine=css(_extends({},linePadding,{color:'var(--color-text-medium-emphasis)',justifyContent:'space-between'})).toString();export var storeAddress=css(_extends({},linePadding,{paddingRight:variables.gap.big,fontSize:'1.125rem',lineHeight:'1.5rem'})).toString();export var storePhoneNumber=css({fontSize:'1rem',' a':{color:'var(--color-primary)',textDecoration:'underline'}}).toString();export var storeOpeningHours=css({paddingRight:variables.gap.big,' > *':{color:'var(--color-text-medium-emphasis)'}}).toString();
@@ -1,4 +0,0 @@
1
- import React,{useContext,useMemo,useCallback}from'react';import PropTypes from'prop-types';import"../../assets/leaflet.css";import'leaflet-gesture-handling/dist/leaflet-gesture-handling.css';import Leaflet from'leaflet';import{GestureHandling}from'leaflet-gesture-handling';import{Map,Marker,TileLayer}from'react-leaflet';import{renderToString}from'react-dom/server';import MapMarkerIcon from'@shopgate/pwa-ui-shared/icons/MapMarkerIcon';import{StoreFinderContext}from"../../locations.context";import{container,marker,markerSelected,userPosition as userPositionStyle}from"./StoreFinderMap.style";Leaflet.Map.addInitHook('addHandler','gestureHandling',GestureHandling);/**
2
- * @param {Object} props The component props
3
- * @returns {JSX}
4
- */var StoreFinderMap=function StoreFinderMap(_ref){var showUserPosition=_ref.showUserPosition;var _useContext=useContext(StoreFinderContext),locations=_useContext.locations,selectedLocation=_useContext.selectedLocation,changeLocation=_useContext.changeLocation,userSearch=_useContext.userSearch;var iconHTML=useMemo(function(){return renderToString(React.createElement(MapMarkerIcon,null));},[]);var makerIcon=useMemo(function(){return Leaflet.divIcon({html:iconHTML,className:marker,iconSize:[40,40]});},[iconHTML]);var markerIconSelected=useMemo(function(){return Leaflet.divIcon({html:iconHTML,className:markerSelected,iconSize:[40,40]});},[iconHTML]);var userPositionIcon=useMemo(function(){return Leaflet.divIcon({html:'<div/>',className:userPositionStyle,iconSize:[20,20]});},[]);var positions=useMemo(function(){return locations.map(function(location){var code=location.code,latitude=location.latitude,longitude=location.longitude;var _ref2=selectedLocation||{},selectedCode=_ref2.code;var icon=selectedCode===code?markerIconSelected:makerIcon;return{code:code,location:location,icon:icon,position:[latitude,longitude]};});},[locations,makerIcon,markerIconSelected,selectedLocation]);var userPosition=useMemo(function(){var geolocation=userSearch.geolocation;if(!geolocation||!showUserPosition){return null;}var latitude=geolocation.latitude,longitude=geolocation.longitude;return{icon:userPositionIcon,position:[latitude,longitude]};},[showUserPosition,userPositionIcon,userSearch]);var viewport=useMemo(function(){var _ref3=selectedLocation||locations[0]||{},latitude=_ref3.latitude,longitude=_ref3.longitude;if(!latitude||!longitude){return(userPosition===null||userPosition===void 0?void 0:userPosition.position)||null;}return[latitude,longitude];},[locations,selectedLocation,userPosition]);var onMarkerClick=useCallback(function(event,location){changeLocation(location,true);},[changeLocation]);return React.createElement("div",{className:container},React.createElement(Map,{center:viewport,zoom:15,className:container,gestureHandling:Leaflet.Browser.mobile,touchZoom:true},React.createElement(TileLayer,{attribution:"&copy <a href=\"http://osm.org/copyright\">OpenStreetMap</a> contributors",url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),positions.map(function(_ref4){var position=_ref4.position,code=_ref4.code,location=_ref4.location,icon=_ref4.icon;return React.createElement(Marker,{key:code,icon:icon,position:position,onclick:function onclick(e){onMarkerClick(e,location);}});}),userPosition&&React.createElement(Marker,{key:"user-position",icon:userPosition.icon,position:userPosition.position})));};StoreFinderMap.defaultProps={showUserPosition:true};export default StoreFinderMap;
@@ -1,2 +0,0 @@
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;}import{css}from'glamor';import{responsiveMediaQuery}from'@shopgate/engage/styles';import{themeColors}from'@shopgate/pwa-common/helpers/config';export var container=css(_defineProperty(_defineProperty({height:'100%',width:'100%'},responsiveMediaQuery('>sm',{appAlways:true}),{borderRadius:3,overflow:'hidden'}),responsiveMediaQuery('<=sm',{appAlways:true}),{// position: 'fixed',
2
- zIndex:10,maxHeight:200}));export var marker=css({' svg':{height:40,width:40,fontSize:'1.5rem',color:"var(--color-text-medium-emphasis, ".concat(themeColors.shade9,")")}}).toString();export var markerSelected=css({' svg':{height:40,width:40,fontSize:'1.5rem',color:"var(--color-primary, ".concat(themeColors.primary,")")}}).toString();var pulseAnimation=css.keyframes({'0%':{boxShadow:'0 0 0 0px rgba(0, 0, 0, 0.2)'},'100%':{boxShadow:'0 0 0 10px rgba(0, 0, 0, 0)'}});export var userPosition=css({' div':{background:'var(--color-secondary)',border:'3px solid #fff',borderRadius:25,height:20,width:20,animation:"".concat(pulseAnimation," 2s infinite")}}).toString();
@@ -1,3 +0,0 @@
1
- import React,{useContext,useMemo}from'react';import{i18n}from'@shopgate/engage/core';import{StoreFinderContext}from"../../locations.context";import{container}from"./StoreFinderStoresNear.style";/**
2
- * @returns {JSX}
3
- */var StoreFinderStoresNear=function StoreFinderStoresNear(){var _useContext=useContext(StoreFinderContext),userSearch=_useContext.userSearch,locations=_useContext.locations;var hasZipCode=!!(userSearch===null||userSearch===void 0?void 0:userSearch.postalCode);var hasGeolocation=!!(userSearch===null||userSearch===void 0?void 0:userSearch.geolocation);var text=useMemo(function(){if(hasZipCode){return i18n.text('locations.stores_near.zip_code',{zipCode:userSearch.postalCode});}if(hasGeolocation){return i18n.text('locations.stores_near.location');}return'';},[hasGeolocation,hasZipCode,userSearch.postalCode]);if(!hasZipCode&&!hasGeolocation||locations.length===0){return React.createElement("div",{className:container});}return React.createElement("div",{className:container},text);};export default StoreFinderStoresNear;
@@ -1 +0,0 @@
1
- import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var variables=themeConfig.variables;export var container=css({fontSize:'1.125rem',fontWeight:500,color:'var(--color-text-high-emphasis)',padding:"0 ".concat(variables.gap.big,"px ").concat(variables.gap.small,"px ").concat(variables.gap.big,"px")});