@shopgate/engage 7.25.0-beta.3 → 7.25.0-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/a11y/components/FocusTrap/index.js +1 -0
- package/a11y/components/index.js +1 -1
- package/a11y/hooks/index.js +6 -0
- package/a11y/index.js +1 -1
- package/a11y/styles.js +2 -0
- package/cart/components/CartItem/CartItemProductLayout.js +3 -3
- package/cart/components/CartItem/CartItemProductLayout.style.js +1 -1
- package/cart/components/CartItem/CartItemProductProvider.js +1 -1
- package/cart/components/CartItem/CartItemProductTitle.js +5 -4
- package/cart/components/CartItem/CartItemQuantityPicker.js +1 -1
- package/cart/components/CartItems/CartItemCard.style.js +1 -1
- package/cart/components/PaymentBar/PaymentBarCheckoutButton.js +3 -3
- package/cart/components/Substitution/index.js +1 -1
- package/components/Menu/components/Item/index.js +3 -3
- package/components/TextLink/TextLink.js +3 -3
- package/components/Toggle/index.js +2 -2
- package/favorites/components/ItemFulfillmentMethod/ItemFulfillmentMethod.js +1 -1
- package/favorites/components/List/List.js +3 -3
- package/favorites/components/List/ListAccordionHeader.js +8 -0
- package/favorites/components/List/ListAccordionLabel.js +5 -4
- package/favorites/components/ListChooser/ListChooser.js +1 -1
- package/filter/components/PriceSlider/components/Label/index.js +1 -1
- package/locations/action-creators/selectLocation.js +1 -2
- package/locations/actions/fetchLocations.js +1 -1
- package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherBar.js +3 -3
- package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherBar.style.js +1 -1
- package/locations/components/StockInfo/StockInfo.js +2 -2
- package/locations/components/StockInfo/StockInfoInventory.js +2 -2
- package/locations/components/StoreFinder/StoreFinder.js +3 -3
- package/locations/components/StoreFinder/StoreFinder.style.js +2 -1
- package/locations/components/StoreFinder/StoreFinderLocation.js +2 -2
- package/locations/components/StoreFinder/StoreFinderLocation.style.js +1 -1
- package/locations/components/StoreFinder/StoreFinderLocationDetailsWide.js +3 -0
- package/locations/components/StoreFinder/StoreFinderLocationDetailsWide.style.js +1 -0
- package/locations/components/StoreFinder/StoreFinderLocationHeader.js +2 -2
- package/locations/components/StoreFinder/StoreFinderLocationHeader.style.js +1 -1
- package/locations/components/StoreFinder/StoreFinderLocations.style.js +2 -1
- package/locations/components/StoreFinder/StoreFinderMap.js +4 -0
- package/locations/components/StoreFinder/StoreFinderMap.style.js +2 -0
- package/locations/components/StoreFinder/StoreFinderSearch.style.js +1 -1
- package/locations/components/StoreFinder/StoreFinderSelectLocationButton.js +2 -2
- package/locations/components/StoreFinder/StoreFinderStoresNear.js +3 -0
- package/locations/components/StoreFinder/StoreFinderStoresNear.style.js +1 -0
- package/locations/components/StoreList/Store.style.js +1 -1
- package/locations/components/StoreList/StoreAddress.js +5 -3
- package/locations/components/StoreList/StoreAddressShort.js +5 -3
- package/locations/components/StoreList/StoreCard.js +2 -2
- package/locations/components/StoreList/StoreDetailsLine.js +7 -3
- package/locations/components/StoreList/StoreDistance.js +3 -1
- package/locations/components/StoreList/StoreHeader.js +2 -2
- package/locations/components/StoreList/StoreHoursToday.js +4 -2
- package/locations/components/StoreList/StoreListLocations.js +1 -1
- package/locations/components/StoreList/StoreListProduct.js +1 -1
- package/locations/components/StoreList/StoreListProduct.style.js +1 -1
- package/locations/components/StoreList/StoreListSearch.js +1 -1
- package/locations/components/StoreList/StoreListSearch.style.js +1 -1
- package/locations/components/StoreList/StoreOpeningHours.js +5 -3
- package/locations/components/StoreList/StoreOpeningHoursLine.js +5 -3
- package/locations/components/StoreList/StorePhoneNumber.js +4 -3
- package/locations/components/StoreList/StoreSelectLocationButton.js +1 -1
- package/locations/components/index.js +1 -1
- package/locations/constants/index.js +1 -3
- package/locations/constants/routes.js +1 -1
- package/locations/locations.streams.js +1 -1
- package/locations/providers/StoreFinderProvider.js +4 -4
- package/locations/providers/index.js +1 -1
- package/locations/selectors/index.js +2 -7
- package/locations/subscriptions.js +3 -3
- package/login/components/ForgotPassword/ForgotPassword.style.js +1 -1
- package/package.json +12 -11
- package/product/components/Header/PriceStriked/style.js +1 -1
- package/product/components/OrderQuantityHint/style.js +1 -1
- package/product/components/ProductBadges/index.js +1 -1
- package/product/components/ProductCard/index.js +2 -2
- package/product/components/ProductDiscountBadge/index.js +2 -2
- package/product/components/ProductImage/index.js +4 -4
- package/product/components/ProductName/ProductName.js +1 -1
- package/product/components/ProductName/ProductNameContent.js +1 -1
- package/product/components/ProductProperties/Row.js +1 -1
- package/product/components/Rating/index.js +2 -2
- package/reviews/components/Reviews/components/Header/components/AverageRating/index.js +6 -4
- package/reviews/components/Reviews/components/Header/components/NoReviews/index.js +3 -3
- package/reviews/components/Reviews/components/Header/components/ReviewsExcerpt/index.js +3 -3
- package/reviews/components/Reviews/components/Header/components/WriteReviewLink/index.js +3 -3
- package/reviews/components/Reviews/components/Header/components/WriteReviewLink/spec.js +2 -2
- package/reviews/components/Reviews/components/Header/index.js +5 -3
- package/reviews/components/Reviews/components/Header/spec.js +1 -1
- package/reviews/components/Reviews/components/ReviewsInfo/index.js +1 -2
- package/locations/components/StoreDetails/components/FindMoreStores.js +0 -4
- package/locations/components/StoreDetails/components/GetDirectionsButton.js +0 -7
- package/locations/components/StoreDetails/components/StoreDetails.js +0 -5
- package/locations/components/StoreDetails/components/StoreFinderMap.js +0 -20
- package/locations/components/StoreDetails/components/StoreFinderMap.style.js +0 -1
- package/locations/components/StoreDetails/components/StoreLocationMap.js +0 -4
- package/locations/components/StoreDetails/components/StoresNearby.js +0 -4
- package/locations/components/StoreDetails/components/StoresNearbyListItem.js +0 -9
- package/locations/components/StoreDetails/index.js +0 -4
- package/locations/components/StoreFinder/StoreFinderStoreInfoButton.js +0 -8
- package/locations/providers/StoreDetailsContext.js +0 -1
- package/locations/providers/StoreDetailsProvider.js +0 -4
|
@@ -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},React.createElement("td",{className:tableCell},React.createElement("span",{dangerouslySetInnerHTML:{__html:label}})),React.createElement("td",{className:tableCell,"data-test-id":"property: ".concat(value)},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:"
|
|
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));
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import React from'react';import PropTypes from'prop-types';import RatingStars from'@shopgate/pwa-ui-shared/RatingStars';import
|
|
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}
|
|
4
|
-
* @param {
|
|
5
|
-
* @
|
|
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
|
|
2
|
-
* @return {JSX}
|
|
3
|
-
*/var NoReviews=function NoReviews(_ref){var productId=_ref.productId;return React.createElement("div",{className:styles.container
|
|
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
|
|
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
|
|
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
|
|
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
|
|
4
|
-
*/var WriteReviewLink=function WriteReviewLink(_ref){var productId=_ref.productId;return React.createElement("div",{"data-test-id":"writeReview",
|
|
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('
|
|
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}
|
|
4
|
-
* @param {
|
|
5
|
-
* @
|
|
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
|
-
* @
|
|
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,4 +0,0 @@
|
|
|
1
|
-
import React from'react';import{css}from'glamor';import{i18n}from'@shopgate/engage/core/helpers';import{MagnifierIcon,LocatorIcon,Link}from'@shopgate/engage/components';import{themeColors}from'@shopgate/pwa-common/helpers/config';import classNames from'classnames';import{STORE_FINDER_PATTERN}from"../../../constants";var styles={container:css({margin:'16px 0px'}),title:css({fontSize:'20px',fontWeight:'500',color:'var(--color-primary)',marginBottom:'8px'}),inputCell:css({gridArea:'input'}),inputContainer:css({position:'relative',background:themeColors.light,border:"1px solid ".concat(themeColors.shade7),borderRadius:4,display:'flex',alignItems:'center',width:'100%'}),inputIcon:css({padding:0,margin:'0 8px',color:themeColors.shade9,fontSize:'1.23rem',flexShrink:0,outline:0}),input:css({margin:'3px 0',width:'100%',lineHeight:'28px',outline:'none',verticalAlign:'middle',WebkitAppearance:'none'}),inputOverlay:css({position:'absolute',height:'100%',width:'100%'})};/**
|
|
2
|
-
* Find more stores component.
|
|
3
|
-
* @returns {JSX}
|
|
4
|
-
* */var FindMoreStores=function FindMoreStores(){return React.createElement("div",{className:styles.container},React.createElement("div",{className:styles.title,"aria-hidden":true},i18n.text('location.findMoreStores')),React.createElement("div",{className:styles.inputCell},React.createElement("div",{className:styles.inputContainer},React.createElement("span",{className:styles.inputIcon,"aria-hidden":true},React.createElement(MagnifierIcon,null)),React.createElement("input",{name:"postalCode",className:styles.input,disabled:true,type:"search",autoComplete:"off",autoCorrect:"off",placeholder:"","aria-hidden":true}),React.createElement("div",{className:styles.inputIcon},React.createElement(LocatorIcon,null)),React.createElement(Link,{href:STORE_FINDER_PATTERN,className:classNames(styles.inputOverlay),role:"button","aria-label":i18n.text('location.findMoreStores')},React.createElement("div",null)))));};export default FindMoreStores;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React,{useMemo}from'react';import{css}from'glamor';import{historyPush}from'@shopgate/pwa-common/actions/router';import PropTypes from'prop-types';import{Button}from'@shopgate/engage/components';import{generateGoogleMapsDirectionsUrl,i18n}from'@shopgate/engage/core';import{useDispatch}from'react-redux';var styles={container:css({}),buttonText:css({color:'var(--color-primary)'})};/**
|
|
2
|
-
* @param {Object} props The component props
|
|
3
|
-
* @param {Object} props.address The address object.
|
|
4
|
-
* @returns {JSX}
|
|
5
|
-
*/var GetDirectionsButton=function GetDirectionsButton(_ref){var address=_ref.address;var dispatch=useDispatch();var url=useMemo(function(){return address&&generateGoogleMapsDirectionsUrl(address);},[address]);/**
|
|
6
|
-
* Handles the button click.
|
|
7
|
-
*/var handleClick=function handleClick(){dispatch(historyPush({pathname:url,state:{target:'_blank'}}));};return React.createElement("div",{className:styles.container},React.createElement(Button,{onClick:handleClick,role:"button",type:"plain"},React.createElement("span",{className:styles.buttonText},i18n.text('location.getDirections'))));};GetDirectionsButton.defaultProps={address:null};export default GetDirectionsButton;
|
|
@@ -1,5 +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 React,{useContext,useMemo}from'react';import{css}from'glamor';import{LocationIcon,Button,Link,ConditionalWrapper}from'@shopgate/engage/components';import{getWeekDaysOrder}from'@shopgate/engage/core';import{i18n}from'@shopgate/engage/core/helpers';import classNames from'classnames';import moment from'moment';import{StoreDetailsContext}from"../../../providers/StoreDetailsContext";import GetDirectionsButton from"./GetDirectionsButton";var styles={headerWrapper:css({display:'flex'}),headerIcon:css({color:'var(--color-primary)',fontSize:20,alignContent:'center',marginRight:4}),header:css({color:'var(--color-primary)',fontWeight:'600',fontSize:20}),locationName:css({fontSize:20,fontWeight:'600',marginBottom:8}),locationRow:css({display:'flex',gap:8,flexWrap:'wrap'}),locationColumn:css({flex:1,minWidth:'200px','& > p':{margin:0}}),storeHoursColumn:css({flex:1,minWidth:'250px',maxWidth:'455px'}),storeHours:css({fontSize:17,fontWeight:'600'}),storeHoursLine:css({}),storeHoursWeekday:css({textAlign:'left'}),bold:css({fontWeight:'600'}),storeHoursOpeningTime:css({textAlign:'right'}),phone:css({fontSize:17,fontWeight:'600'}),phoneNumber:css({textDecoration:'underline'}),makeMyStoreButton:css({color:'var(--color-primary)'}),comingSoon:css({fontStyle:'italic'}),buttonRow:css({display:'flex',alignItems:'center',gap:'8px 30px',flexWrap:'wrap',margin:'8px 0'})};/**
|
|
2
|
-
* Store details component.
|
|
3
|
-
* @returns {JSX}
|
|
4
|
-
*/var StoreDetails=function StoreDetails(){var _useContext=useContext(StoreDetailsContext),selectLocation=_useContext.selectLocation,routeLocation=_useContext.routeLocation,isRouteLocationPreferred=_useContext.isRouteLocationPreferred;var _ref=routeLocation||{},_ref$address=_ref.address,address=_ref$address===void 0?{}:_ref$address,_ref$operationHours=_ref.operationHours,operationHours=_ref$operationHours===void 0?{}:_ref$operationHours,isComingSoon=_ref.isComingSoon;var currentDay=moment().format('ddd').toLowerCase();// Check if there are any opening hours to hide the section if not
|
|
5
|
-
var hasOpeningHours=useMemo(function(){return Object.keys(operationHours).length>0&&Object.values(operationHours).some(function(value){return value&&typeof value==='string'&&value.length>0;});},[operationHours]);if(!routeLocation){return null;}return React.createElement("div",null,React.createElement(ConditionalWrapper,{condition:!isRouteLocationPreferred,wrapper:function wrapper(children){return React.createElement(Button,{onClick:function onClick(){return selectLocation(routeLocation,true);},role:"button",type:"plain"},children);}},React.createElement("div",{className:styles.headerWrapper},React.createElement("div",{className:styles.headerIcon},React.createElement(LocationIcon,{className:styles.icon,size:20})),React.createElement("div",{className:styles.header},isRouteLocationPreferred?i18n.text('location.myStore'):i18n.text('location.makeMyStore')))),React.createElement("div",{className:styles.locationName},routeLocation.name),React.createElement("div",{className:styles.locationRow},React.createElement("div",{className:styles.locationColumn},React.createElement("p",null,address===null||address===void 0?void 0:address.street),(address===null||address===void 0?void 0:address.street2)&&address.street2!==''&&React.createElement("p",null,address.street2),(address===null||address===void 0?void 0:address.street3)&&address.street3!==''&&React.createElement("p",null,address.street3),(address===null||address===void 0?void 0:address.street4)&&address.street4!==''&&React.createElement("p",null,address.street4),React.createElement("p",null,i18n.text('locations.address',address)),React.createElement("div",{className:styles.buttonRow},React.createElement(GetDirectionsButton,{address:address}),!isComingSoon&&!isRouteLocationPreferred&&React.createElement(Button,{onClick:function onClick(){return selectLocation(routeLocation,true);},role:"button",type:"plain",className:classNames(styles.makeMyStoreButton)},React.createElement("span",null,i18n.text('location.makeMyStore'))),isComingSoon&&React.createElement("div",{className:styles.comingSoon},i18n.text('location.comingSoon'))),(address===null||address===void 0?void 0:address.phoneNumber)&&React.createElement(React.Fragment,null,React.createElement("div",{className:styles.phone},"".concat(i18n.text('location.phone'),": ")),React.createElement("div",{className:styles.phoneNumber},React.createElement(Link,{href:"tel:".concat(address.phoneNumber),className:classNames(styles.phoneNumber),target:"_blank",role:"button","aria-label":address.phoneNumber},address.phoneNumber)))),hasOpeningHours&&React.createElement("div",{className:styles.storeHoursColumn},React.createElement("div",{className:styles.storeHours},"".concat(i18n.text('location.storeHours'),":")),React.createElement("table",null,React.createElement("tbody",null,getWeekDaysOrder().map(function(weekDay){if(!operationHours[weekDay]){return null;}return React.createElement("tr",{className:styles.storeHoursLine,key:weekDay,"aria-label":"".concat(i18n.text("locations.".concat(weekDay)),": ").concat(operationHours[weekDay]),tabIndex:0},React.createElement("td",{className:classNames(styles.storeHoursWeekday,_defineProperty({},styles.bold,weekDay===currentDay)),"aria-hidden":true},"".concat(i18n.text("locations.".concat(weekDay)),":")),React.createElement("td",{className:classNames(styles.storeHoursOpeningTime,_defineProperty({},styles.bold,weekDay===currentDay)),"aria-hidden":true},operationHours[weekDay]));}))))));};export default StoreDetails;
|
|
@@ -1,20 +0,0 @@
|
|
|
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,{useCallback,useMemo,useContext,useRef,useEffect}from'react';import{useDispatch}from'react-redux';import{Circle,MapContainer,Marker,TileLayer}from'react-leaflet';import{GestureHandling}from'leaflet-gesture-handling';import"../../../assets/leaflet.css";import'leaflet-gesture-handling/dist/leaflet-gesture-handling.css';import Leaflet from'leaflet';import{renderToString}from'react-dom/server';import MapMarkerIcon from'@shopgate/pwa-ui-shared/icons/MapMarkerIcon';import{historyPush}from'@shopgate/engage/core';import{container,markerSelected}from"./StoreFinderMap.style";import{MAP_RADIUS_KM}from"../../../constants";import{StoreDetailsContext}from"../../../providers/StoreDetailsContext";Leaflet.Map.addInitHook('addHandler','gestureHandling',GestureHandling);/**
|
|
2
|
-
* @returns {JSX.Element}
|
|
3
|
-
*/var StoreFinderMap=function StoreFinderMap(){var mapContainerRef=useRef(null);var dispatch=useDispatch();/**
|
|
4
|
-
* Handles the click on the OpenStreetMap copyright
|
|
5
|
-
* Cause the copyright is only a plain a tag
|
|
6
|
-
* this causes weird routing in the app
|
|
7
|
-
* To prevent this we need to handle the click on the a tag
|
|
8
|
-
* @param {Event} e The event
|
|
9
|
-
* @returns {void}
|
|
10
|
-
* */var handleOpenStreetMapCopyrightClick=useCallback(function(e){if(e.target.tagName==='A'&&e.target.href){e.preventDefault();dispatch(historyPush({pathname:e.target.href}));}},[dispatch]);// check the mapContainerRef if any a tag is clicked
|
|
11
|
-
// to catch the click on the OpenStreetMap copyright
|
|
12
|
-
useEffect(function(){if(mapContainerRef.current){mapContainerRef.current.addEventListener('click',handleOpenStreetMapCopyrightClick);}return function(){if(mapContainerRef.current){mapContainerRef.current.removeEventListener('click',handleOpenStreetMapCopyrightClick);}};},[handleOpenStreetMapCopyrightClick]);var _useContext=useContext(StoreDetailsContext),routeLocation=_useContext.routeLocation;var iconHTML=useMemo(function(){return renderToString(React.createElement(MapMarkerIcon,null));},[]);var markerIconSelected=useMemo(function(){return Leaflet.divIcon({html:iconHTML,className:markerSelected,iconSize:[40,40]});},[iconHTML]);var _ref=routeLocation||{},code=_ref.code,latitude=_ref.latitude,longitude=_ref.longitude;var viewport=useMemo(function(){if(!latitude||!longitude){return null;}return[latitude,longitude];},[latitude,longitude]);/**
|
|
13
|
-
* Enables touch and gestures on the map
|
|
14
|
-
* @param {Object} map available parameters for the map
|
|
15
|
-
*/var handleMapCreated=function handleMapCreated(map){map.gestureHandling.enable();map.attributionControl.setPrefix('');if(Leaflet.Browser.mobile){map.touchZoom.enable();}};/**
|
|
16
|
-
* Creates coordinates for a bounding box around a center point
|
|
17
|
-
* @param {Array} center The center point
|
|
18
|
-
* @param {number} distanceInMeter The distance in meters
|
|
19
|
-
* @returns {Array} The bounds
|
|
20
|
-
*/var createBounds=useCallback(function(_ref2,distanceInMeter){var _ref3=_slicedToArray(_ref2,2),lat=_ref3[0],lng=_ref3[1];var EARTH_RADIUS_KM=6371;var distanceInKm=distanceInMeter/1000;var distanceToBoundaryInKm=distanceInKm/2;var latInRadians=lat*(Math.PI/180);var deltaLat=distanceToBoundaryInKm/EARTH_RADIUS_KM*(180/Math.PI);var deltaLng=distanceToBoundaryInKm/EARTH_RADIUS_KM*(180/Math.PI)/Math.cos(latInRadians);return[[lat-deltaLat,lng-deltaLng],[lat+deltaLat,lng+deltaLng]];},[]);var radiusinMeters=MAP_RADIUS_KM*1000;var bounds=useMemo(function(){if(!viewport||!MAP_RADIUS_KM){return null;}return createBounds(viewport,radiusinMeters);},[createBounds,radiusinMeters,viewport]);var debug=false;if(!routeLocation){return null;}return React.createElement("div",{className:container,"aria-hidden":true,ref:mapContainerRef},React.createElement(MapContainer,{center:viewport,bounds:bounds,className:container,whenCreated:handleMapCreated},debug&&React.createElement(Circle,{center:viewport,radius:radiusinMeters,color:"blue"}),React.createElement(TileLayer,{attribution:"© <a href=\"https://osm.org/copyright\">OpenStreetMap</a>",url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),React.createElement(Marker,{key:code,icon:markerIconSelected,position:[latitude,longitude]})));};export default StoreFinderMap;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{css}from'glamor';import{themeColors}from'@shopgate/pwa-common/helpers/config';export var container=css({height:'100%',width:'100%'});export var markerSelected=css({' svg':{height:40,width:40,fontSize:'1.5rem',color:"var(--color-primary, ".concat(themeColors.primary,")")}}).toString();
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React,{useRef}from'react';import{css}from'glamor';import StoreFinderMap from"./StoreFinderMap";import{StoreFinderProvider}from"../../../providers";var styles={container:css({maxHeight:'250px',height:'250px',width:'100%',marginTop:'10px',marginBottom:'10px'}).toString()};/**
|
|
2
|
-
* Store location map component.
|
|
3
|
-
* @returns {JSX.Element}
|
|
4
|
-
*/var StoreLocationMap=function StoreLocationMap(){var storeListRef=useRef(null);return React.createElement(StoreFinderProvider,{storeListRef:storeListRef},React.createElement("div",{className:styles.container},React.createElement(StoreFinderMap,null)));};export default StoreLocationMap;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React,{useContext}from'react';import{css}from'glamor';import{i18n}from'@shopgate/engage/core/helpers';import StoresNearbyListItem from"./StoresNearbyListItem";import{StoreDetailsContext}from"../../../providers/StoreDetailsContext";var styles={title:css({fontSize:20,fontWeight:'600',marginBottom:12}),table:css({width:'100%'})};/**
|
|
2
|
-
* Show stores nearby selected location
|
|
3
|
-
* @returns {JSX}
|
|
4
|
-
*/var StoresNearby=function StoresNearby(){var _useContext=useContext(StoreDetailsContext),nearbyLocations=_useContext.nearbyLocations;return React.createElement("div",null,React.createElement("div",{className:styles.title},i18n.text('location.storesNearby')),nearbyLocations.length>0&&React.createElement("table",{className:styles.table},React.createElement("tbody",null,nearbyLocations.map(function(location){return React.createElement(StoresNearbyListItem,{location:location,key:location.code});}))),nearbyLocations.length===0&&React.createElement("div",null,i18n.text('location.noStoresNearby')));};export default StoresNearby;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React,{useContext}from'react';import{useDispatch}from'react-redux';import PropTypes from'prop-types';import{css}from'glamor';import{Button}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core/helpers';import{historyPush}from'@shopgate/engage/core';import formatDistance from"../../../helpers/formatDistance";import{STORE_DETAILS_PATH}from"../../../constants";import{StoreDetailsContext}from"../../../providers/StoreDetailsContext";var styles={button:css({fontSize:'14px !important',padding:'0px !important'}).toString(),locationRow:css({borderBottom:'1px solid #e8e8e8',borderTop:'1px solid #e8e8e8','> td:first-child > div':{paddingLeft:0},'> td:last-child > div':{paddingRight:0}}),distance:css({textWrapMode:'nowrap',alignContent:'center',verticalAlign:'middle',fontWeight:'500'}),makeMyStore:css({textWrapMode:'nowrap',alignContent:'center',verticalAlign:'middle'}),storeInfo:css({textWrapMode:'nowrap',alignContent:'center',verticalAlign:'middle'}),name:css({textAlign:'start'}),cellContainer:css({padding:'8px',textAlign:'end'}),cell:css({verticalAlign:'middle'}),buttonContainer:css({display:'flex',gap:'4px 16px',flexWrap:'wrap',justifyContent:'flex-end'})};/**
|
|
2
|
-
* Shows a location in a row
|
|
3
|
-
* @param {Object} props Props
|
|
4
|
-
* @param {Object} props.location Location
|
|
5
|
-
* @returns {JSX}
|
|
6
|
-
*/var StoresNearbyListItem=function StoresNearbyListItem(_ref){var location=_ref.location;var dispatch=useDispatch();var _useContext=useContext(StoreDetailsContext),preferredLocation=_useContext.preferredLocation,selectLocation=_useContext.selectLocation;var name=location.name,distance=location.distance,unitSystem=location.unitSystem,code=location.code,isComingSoon=location.isComingSoon;var isPreferredLocation=preferredLocation&&preferredLocation.code===code;/**
|
|
7
|
-
* Opens the store details page
|
|
8
|
-
* @param {string} locationCode Location code
|
|
9
|
-
*/var openStoreDetails=function openStoreDetails(locationCode){dispatch(historyPush({pathname:"".concat(STORE_DETAILS_PATH,"/").concat(locationCode)}));};return React.createElement("tr",{className:styles.locationRow},React.createElement("td",{className:styles.cell},React.createElement("div",{className:styles.cellContainer},React.createElement("div",{className:styles.name},name))),React.createElement("td",{className:styles.cell},React.createElement("div",{className:styles.cellContainer},React.createElement("div",{className:styles.distance},formatDistance(distance||0,unitSystem==='imperial')))),React.createElement("td",{className:styles.cell},React.createElement("div",{className:styles.cellContainer},React.createElement("div",{className:styles.buttonContainer},React.createElement("div",{className:styles.makeMyStore},!isComingSoon&&React.createElement(Button,{className:styles.button,onClick:function onClick(){return selectLocation(location,true);},role:"button",type:"primary",flat:true,disabled:isPreferredLocation,wrapContent:false},"".concat(i18n.text('location.makeMyStore'))),isComingSoon&&React.createElement(Button,{className:styles.button,role:"button",type:"primary",flat:true,disabled:true,wrapContent:false},i18n.text('location.comingSoon'))),React.createElement("div",{className:styles.storeInfo},React.createElement(Button,{className:styles.button,role:"button",type:"primary",flat:true,onClick:function onClick(){return openStoreDetails(code);},wrapContent:false},i18n.text('locations.details')))))));};export default StoresNearbyListItem;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React from'react';import{css}from'glamor';import{themeConfig}from'@shopgate/engage';import StoreDetails from"./components/StoreDetails";import StoreLocationMap from"./components/StoreLocationMap";import StoresNearby from"./components/StoresNearby";import FindMoreStores from"./components/FindMoreStores";import{StoreDetailsProvider}from"../../providers";var styles={page:css({padding:"".concat(themeConfig.variables.gap.small,"px ").concat(themeConfig.variables.gap.big,"px")}).toString()};/**
|
|
2
|
-
* @param {Object} props .
|
|
3
|
-
* @returns {JSX}
|
|
4
|
-
*/var StoreDetailsContent=function StoreDetailsContent(){return React.createElement(StoreDetailsProvider,null,React.createElement("div",{className:styles.page},React.createElement(StoreDetails,null),React.createElement(StoreLocationMap,null),React.createElement(StoresNearby,null),React.createElement(FindMoreStores,null)));};export default StoreDetailsContent;
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import React,{useCallback,useContext}from'react';import classNames from'classnames';import PropTypes from'prop-types';import{RippleButton}from'@shopgate/engage/components';import{historyPush}from'@shopgate/engage/core';import{connect}from'react-redux';import{css}from'glamor';import{themeColors,themeVariables}from'@shopgate/pwa-common/helpers/config';import{StoreContext}from"./Store.context";import{i18n}from"../../../core";import{StoreFinderContext}from"../../locations.context";import{STORE_DETAILS_PATH}from"../../constants";var gap=themeVariables.gap;var styles={showStoreInfoButton:css({width:'100%',fontSize:'.875rem !important',':not(:disabled)':{background:"var(--color-primary, ".concat(themeColors.primary,")!important"),color:"var(--color-primary-contrast, ".concat(themeColors.primaryContrast,")!important")}}),showStoreInfoButtonWrapper:css({padding:"0 ".concat(gap.big,"px ").concat(gap.small,"px ").concat(gap.big,"px")})};/**
|
|
2
|
-
* @param {Function} dispatch The dispatch function.
|
|
3
|
-
* @returns {Object}
|
|
4
|
-
*/var mapDispatchToProps=function mapDispatchToProps(dispatch){return{openStoreDetail:function openStoreDetail(code){return dispatch(historyPush({pathname:"".concat(STORE_DETAILS_PATH,"/").concat(code)}));}};};/**
|
|
5
|
-
* The StoreFinderStoreInfoButton component.
|
|
6
|
-
* @param {Function} openStoreDetail The openStoreDetail function.
|
|
7
|
-
* @returns {JSX}
|
|
8
|
-
*/var StoreFinderStoreInfoButton=function StoreFinderStoreInfoButton(_ref){var openStoreDetail=_ref.openStoreDetail;var store=useContext(StoreContext);var _useContext=useContext(StoreFinderContext),isLoading=_useContext.isLoading;var handleClick=useCallback(function(e){e.stopPropagation();openStoreDetail(store===null||store===void 0?void 0:store.code);},[openStoreDetail,store]);return React.createElement("div",{className:styles.showStoreInfoButtonWrapper},React.createElement(RippleButton,{onClick:handleClick,className:classNames(styles.showStoreInfoButton),disabled:isLoading},i18n.text('locations.store_info')));};export default connect(null,mapDispatchToProps)(StoreFinderStoreInfoButton);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{createContext}from'react';export var StoreDetailsContext=createContext({});
|
|
@@ -1,4 +0,0 @@
|
|
|
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";/**
|
|
2
|
-
* @param {Object} props The component props
|
|
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);
|