@shopgate/engage 7.26.0-beta.1 → 7.26.0-beta.3
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/action-creators/index.js +9 -0
- package/a11y/components/FocusTrap/index.js +1 -0
- package/a11y/components/ModalStateTracker/index.js +14 -0
- package/a11y/components/Section/index.js +3 -3
- package/a11y/components/index.js +1 -1
- package/a11y/constants/index.js +1 -1
- package/a11y/hooks/index.js +37 -0
- package/a11y/index.js +1 -1
- package/a11y/reducers/index.js +6 -0
- package/a11y/selectors/index.js +8 -0
- package/cart/components/CartItem/CartItemProductLayout.style.js +1 -1
- package/cart/components/CartItem/CartItemProductProvider.js +1 -1
- package/cart/components/CartItem/CartItemProductTitle.js +2 -2
- package/cart/components/CartItem/CartItemQuantityPicker.js +1 -1
- package/components/Menu/components/Item/index.js +2 -2
- package/components/SheetDrawer/index.js +4 -3
- package/components/View/components/Content/index.js +2 -2
- package/components/View/provider.js +7 -4
- package/core/events/index.js +1 -0
- package/core/helpers/index.js +1 -1
- package/core/index.js +2 -4
- package/favorites/components/List/List.js +1 -1
- package/locations/action-creators/selectLocation.js +2 -1
- package/locations/actions/fetchLocations.js +1 -1
- package/locations/components/FulfillmentSheet/FulfillmentSheet.js +4 -3
- package/locations/components/FulfillmentSheet/FulfillmentSheetContent.js +5 -3
- package/locations/components/StockInfo/StockInfo.js +2 -2
- package/locations/components/StockInfo/StockInfoInventory.js +2 -2
- package/locations/components/StoreDetails/components/FindMoreStores.js +4 -0
- package/locations/components/StoreDetails/components/GetDirectionsButton.js +7 -0
- package/locations/components/StoreDetails/components/StoreDetails.js +5 -0
- package/locations/components/StoreDetails/components/StoreFinderMap.js +20 -0
- package/locations/components/StoreDetails/components/StoreFinderMap.style.js +1 -0
- package/locations/components/StoreDetails/components/StoreLocationMap.js +4 -0
- package/locations/components/StoreDetails/components/StoresNearby.js +4 -0
- package/locations/components/StoreDetails/components/StoresNearbyListItem.js +9 -0
- package/locations/components/StoreDetails/index.js +4 -0
- package/locations/components/StoreFinder/StoreFinder.js +3 -3
- package/locations/components/StoreFinder/StoreFinder.style.js +1 -2
- package/locations/components/StoreFinder/StoreFinderLocation.js +2 -2
- package/locations/components/StoreFinder/StoreFinderLocation.style.js +1 -1
- package/locations/components/StoreFinder/StoreFinderLocationHeader.js +2 -2
- package/locations/components/StoreFinder/StoreFinderLocationHeader.style.js +1 -1
- package/locations/components/StoreFinder/StoreFinderLocations.style.js +1 -2
- package/locations/components/StoreFinder/StoreFinderSearch.style.js +1 -1
- package/locations/components/StoreFinder/StoreFinderSelectLocationButton.js +2 -2
- package/locations/components/StoreFinder/StoreFinderStoreInfoButton.js +8 -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 +6 -2
- package/locations/components/StoreList/StoreDistance.js +4 -2
- 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/StoreListSearch.js +1 -1
- package/locations/components/StoreList/StoreOpeningHours.js +5 -3
- package/locations/components/StoreList/StoreOpeningHoursLine.js +4 -2
- 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/Portals.js +1 -1
- package/locations/constants/index.js +3 -1
- package/locations/constants/routes.js +1 -1
- package/locations/locations.streams.js +1 -1
- package/locations/providers/StoreDetailsContext.js +1 -0
- package/locations/providers/StoreDetailsProvider.js +4 -0
- package/locations/providers/StoreFinderProvider.js +4 -4
- package/locations/providers/index.js +1 -1
- package/locations/selectors/index.js +7 -2
- package/locations/subscriptions.js +3 -3
- package/login/components/ForgotPassword/ForgotPassword.style.js +1 -1
- package/package.json +12 -11
- package/product/components/Characteristics/Characteristic/components/Sheet/index.js +2 -2
- package/product/components/Characteristics/Characteristic/index.js +3 -2
- 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 +2 -2
- package/product/components/ProductProperties/Row.js +1 -1
- package/product/components/Rating/index.js +2 -2
- package/product/components/RelationsSlider/RelationsSliderContent.js +1 -1
- package/product/components/RelationsSlider/style.js +1 -1
- package/push-opt-in/components/PushOptInModal/index.js +1 -1
- package/push-opt-in/subscriptions/optInTrigger.js +1 -1
- 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/styles/reset/root.js +2 -1
- package/tracking/components/CookieConsentModal/index.js +1 -1
- package/locations/components/StoreFinder/StoreFinderLocationDetailsWide.js +0 -3
- package/locations/components/StoreFinder/StoreFinderLocationDetailsWide.style.js +0 -1
- package/locations/components/StoreFinder/StoreFinderMap.js +0 -4
- package/locations/components/StoreFinder/StoreFinderMap.style.js +0 -2
- package/locations/components/StoreFinder/StoreFinderStoresNear.js +0 -3
- package/locations/components/StoreFinder/StoreFinderStoresNear.style.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var variables=themeConfig.variables;export var container=css({}).toString();export var selected=css({}).toString();export var directionsButton=css({padding:"0 ".concat(variables.gap.big,"px ").concat(variables.gap.big,"px")}).toString();
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import React,{useContext,
|
|
1
|
+
import React,{useContext,useMemo}from'react';import{Grid,LocationIcon}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core/helpers';import{StoreContext}from"./Store.context";import{StoreFinderContext}from"../../locations.context";import{StoreDistance}from"../StoreList/StoreDistance";import{StoreHoursToday}from"../StoreList/StoreHoursToday";import{StoreAddress}from"../StoreList/StoreAddress";import StoreFinderLocationHeaderPhoneNumber from"./StoreFinderLocationHeaderPhoneNumber";import{container,storeName,storeDistance,storeHoursToday,clickable,storeNameWrapper,myStore,myStoreIcon,myStoreWrapper}from"./StoreFinderLocationHeader.style";/**
|
|
2
2
|
* @returns {JSX}
|
|
3
|
-
*/var StoreFinderLocationHeader=function StoreFinderLocationHeader(){var store=useContext(StoreContext);var name=store.name,distance=store.distance,unitSystem=store.unitSystem,operationHours=store.operationHours,address=store.address;var _useContext=useContext(StoreFinderContext),
|
|
3
|
+
*/var StoreFinderLocationHeader=function StoreFinderLocationHeader(){var store=useContext(StoreContext);var name=store.name,distance=store.distance,unitSystem=store.unitSystem,operationHours=store.operationHours,address=store.address;var _useContext=useContext(StoreFinderContext),selectedLocation=_useContext.selectedLocation;var isSelectedLocation=useMemo(function(){return(selectedLocation===null||selectedLocation===void 0?void 0:selectedLocation.code)===(store===null||store===void 0?void 0:store.code);},[selectedLocation,store]);return React.createElement("div",{className:container},React.createElement("div",{className:clickable},React.createElement(Grid,null,React.createElement(Grid.Item,{grow:1},React.createElement("div",{className:storeNameWrapper},React.createElement("div",{className:storeName},name),isSelectedLocation&&React.createElement("div",{className:myStoreWrapper},React.createElement("div",{className:myStoreIcon},React.createElement(LocationIcon,{size:20})),React.createElement("div",{className:myStore},i18n.text('location.myStore'))))),React.createElement(Grid.Item,{className:storeDistance},React.createElement(StoreDistance,{distance:distance,unitSystem:unitSystem}))),React.createElement("div",{className:storeHoursToday},React.createElement(StoreHoursToday,{hours:operationHours})),React.createElement(StoreAddress,{address:address})),React.createElement(StoreFinderLocationHeaderPhoneNumber,{phone:address.phoneNumber}));};export default StoreFinderLocationHeader;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var variables=themeConfig.variables;export var container=css({padding:variables.gap.big,display:'flex',flexDirection:'column',color:'var(--color-text-low-emphasis)',' > *':{margin:0},' svg':{color:'var(--color-text-low-emphasis)'},' li':{paddingTop:0},' a':{color:'var(--color-primary)',textDecoration:'underline'},fontSize:'0.875rem',lineHeight:'1.5rem',' > *:not(:last-child)':{paddingBottom:variables.gap.xsmall,paddingTop:0}}).toString();export var clickable=css({' > *':{margin:0,paddingTop:0},' > *:not(:last-child)':{paddingBottom:variables.gap.xsmall,paddingTop:0}}).toString();export var storeName=css({fontSize:'1rem',fontWeight:500,color:'var(--color-text-high-emphasis)'}).toString();export var myStoreWrapper=css({display:'flex',alignItems:'center'}).toString();export var myStore=css({color:'var(--color-primary)',fontSize:'1rem',fontWeight:500}).toString();export var myStoreIcon=css({' svg':{color:'var(--color-primary)'},marginRight:'4px'}).toString();export var storeNameWrapper=css({flexWrap:'wrap',display:'flex',gap:'2px 12px'});export var storeDistance=css({lineHeight:'1.65rem',paddingLeft:variables.gap.small}).toString();export var storeHoursToday=css({' > *':{color:'var(--color-text-low-emphasis)'}}).toString();
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
}));export var cardList=css(_defineProperty({padding:variables.gap.big},responsiveMediaQuery('<=sm',{appAlways:true}),{paddingTop:0})).toString();export var card=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,':not(:last-child)':{marginBottom:gapM}}).toString();
|
|
1
|
+
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors,variables=themeConfig.variables;var gapM=variables.gap.small+variables.gap.xsmall;export var container=css({paddingTop:2,borderTop:'none',overflowY:'unset',WebkitOverflowScrolling:'unset'});export var cardList=css({paddingTop:0}).toString();export var card=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,':not(:last-child)':{marginBottom:gapM}}).toString();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
import{css}from'glamor';import{themeVariables}from'@shopgate/pwa-common/helpers/config';export var container=css({paddingBottom:themeVariables.gap.small});
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import React,{useCallback,useContext}from'react';import{RippleButton}from'@shopgate/engage/components';import{StoreContext}from"./Store.context";import{i18n}from"../../../core";import{StoreFinderContext}from"../../locations.context";import{selectLocationButton,selectLocationButtonWrapper}from"../StoreList/Store.style";/**
|
|
1
|
+
import React,{useCallback,useContext,useMemo}from'react';import{RippleButton}from'@shopgate/engage/components';import{StoreContext}from"./Store.context";import{i18n}from"../../../core";import{StoreFinderContext}from"../../locations.context";import{selectLocationButton,selectLocationButtonWrapper}from"../StoreList/Store.style";/**
|
|
2
2
|
* The StoreFinderSelectLocationButton component.
|
|
3
3
|
* Renders if route query.selectLocation param is passed
|
|
4
4
|
* @returns {JSX.Element}
|
|
5
|
-
*/export var StoreFinderSelectLocationButton=function StoreFinderSelectLocationButton(){var store=useContext(StoreContext);var _useContext=useContext(StoreFinderContext),selectLocation=_useContext.selectLocation,isLoading=_useContext.isLoading;var handleClick=useCallback(function(e){e.stopPropagation();selectLocation(store);},[selectLocation,store]);return React.createElement("div",{className:selectLocationButtonWrapper},React.createElement(RippleButton,{onClick:handleClick,className:selectLocationButton.toString(),disabled:isLoading||(store===null||store===void 0?void 0:store.isComingSoon)},i18n.text('locations.select_location')));};
|
|
5
|
+
*/export var StoreFinderSelectLocationButton=function StoreFinderSelectLocationButton(){var store=useContext(StoreContext);var _useContext=useContext(StoreFinderContext),selectLocation=_useContext.selectLocation,isLoading=_useContext.isLoading,selectedLocation=_useContext.selectedLocation;var handleClick=useCallback(function(e){e.stopPropagation();selectLocation(store);},[selectLocation,store]);var isSelected=useMemo(function(){return(selectedLocation===null||selectedLocation===void 0?void 0:selectedLocation.code)===(store===null||store===void 0?void 0:store.code);},[selectedLocation,store]);return React.createElement("div",{className:selectLocationButtonWrapper},React.createElement(RippleButton,{onClick:handleClick,className:selectLocationButton.toString(),disabled:isLoading||(store===null||store===void 0?void 0:store.isComingSoon)||isSelected},i18n.text((store===null||store===void 0?void 0:store.isComingSoon)?'location.comingSoon':'locations.select_location')));};
|
|
@@ -0,0 +1,8 @@
|
|
|
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 +1 @@
|
|
|
1
|
-
function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import{css}from'glamor';import{themeVariables,themeColors}from'@shopgate/pwa-common/helpers/config';import{responsiveMediaQuery}from'@shopgate/engage/styles';var gap=themeVariables.gap;var baseCardPadding="".concat(gap.small,"px ").concat(gap.big,"px");var gapM=gap.small+gap.xsmall;export var stores=css(
|
|
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{themeVariables,themeColors}from'@shopgate/pwa-common/helpers/config';import{responsiveMediaQuery}from'@shopgate/engage/styles';var gap=themeVariables.gap;var baseCardPadding="".concat(gap.small,"px ").concat(gap.big,"px");var gapM=gap.small+gap.xsmall;export var stores=css({background:"var(--color-background-accent, ".concat(themeColors.background,")"),padding:"".concat(gapM,"px ").concat(gapM,"px ").concat(gap.big,"px"),fontSize:'0.875rem',boxShadow:'inset rgba(0, 0, 0, .117647) 0 1px 6px, inset rgba(0, 0, 0, .117647) 0 1px 4px'}).toString();export var storeCard=css({background:themeColors.light,marginBottom:gapM,':last-of-type':{marginBottom:0},border:"1px solid ".concat(themeColors.shade7),boxSizing:'border-box',boxShadow:'0px 1px 2px rgba(0, 0, 0, 0.25)',borderRadius:'0px 0px 3px 3px'}).toString();export var storeCardPlaceholder=css({margin:'10px 0',height:36}).toString();export var storeHeader=css({cursor:'pointer',padding:"".concat(baseCardPadding," ").concat(gap.xsmall,"px")}).toString();export var disabled=css({cursor:'not-allowed'}).toString();export var storeName=css({fontSize:'1rem',fontWeight:500}).toString();export var storeDistance=css(_defineProperty({whiteSpace:'nowrap',color:"var(--color-text-medium-emphasis, ".concat(themeColors.gray,")")},responsiveMediaQuery('>sm',{webOnly:true}),{fontSize:'0.875rem'})).toString();export var storeDetailsBody=css({padding:baseCardPadding,borderTop:"1px solid ".concat(themeColors.shade7)}).toString();export var storeDetailsAccordion=css({justifyContent:'space-between'}).toString();export var storeHoursToday=css({color:"var(--color-text-medium-emphasis, ".concat(themeColors.gray,")")}).toString();export var address=css({display:'flex',flexFlow:'row nowrap',color:"var(--color-text-medium-emphasis, ".concat(themeColors.gray,")"),marginBottom:4}).toString();export var addressIcon=css({color:'var(--color-text-medium-emphasis)',fontSize:'1.4rem',padding:"".concat(gap.xsmall,"px ").concat(gap.big,"px 0 0")}).toString();export var detailsIcon=css({color:'var(--color-text-medium-emphasis)',fontSize:'1.4rem',padding:"".concat(gap.xsmall,"px ").concat(gap.big,"px 0 0")}).toString();export var detailsIconLinked=css({color:'var(--color-primary)'}).toString();export var detailsLine=css({marginTop:gapM}).toString();export var details=css({paddingTop:gap.xsmall}).toString();export var openingHours=css({display:'table',color:'var(--color-text-medium-emphasis)'}).toString();export var openingHoursRow=css({display:'table-row'}).toString();export var openingHoursDay=css({display:'table-cell',paddingRight:gap.big}).toString();export var detailsPrimary=css({margin:0,color:"var(--color-primary, ".concat(themeColors.primary,")"),lineHeight:'1.375rem'}).toString();export var detailsSecondary=css({color:"var(--color-text-medium-emphasis, ".concat(themeColors.shade11,")"),fontSize:'0.75rem'}).toString();export var selectLocationButtonWrapper=css({padding:"0 ".concat(gap.big,"px ").concat(gap.small,"px ").concat(gap.big,"px")});export var stockInfoContainer=css({marginTop:8,':empty':{display:'none'}});export var selectLocationButton=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")}});
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import*as React from'react';import
|
|
1
|
+
import*as React from'react';import PropTypes from'prop-types';import{StoreContext}from"./Store.context";import{FulfillmentContext}from"../../locations.context";import{StockInfo}from"../StockInfo";import{LocationIcon}from"../../../components";import{i18n}from"../../../core";import{address as container,addressIcon,stockInfoContainer}from"./Store.style";/**
|
|
2
2
|
* Renders the pickup location's address information.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
|
-
* @
|
|
5
|
-
|
|
4
|
+
* @param {Object} props.address The address object.
|
|
5
|
+
* @param {boolean} props.pure Whether to only render the address without any wrapper components.
|
|
6
|
+
* @returns {JSX.Element}
|
|
7
|
+
*/export function StoreAddress(_ref){var address=_ref.address,pure=_ref.pure;var store=React.useContext(StoreContext);var _React$useContext=React.useContext(FulfillmentContext),product=_React$useContext.product;if(!address){return null;}var addressContent=React.createElement("div",null,React.createElement("div",{"data-test-id":"street"},address.street),address.street2&&address.street2!==''&&React.createElement("div",{"data-test-id":"street2"},address.street2),address.street3&&address.street3!==''&&React.createElement("div",{"data-test-id":"street3"},address.street3),address.street4&&address.street4!==''&&React.createElement("div",{"data-test-id":"street4"},address.street4),i18n.text('locations.address',address));if(pure){return addressContent;}return React.createElement("div",{className:container},React.createElement("div",{className:addressIcon,"aria-hidden":true},React.createElement(LocationIcon,null)),React.createElement("div",null,addressContent,product&&React.createElement("div",{className:stockInfoContainer},React.createElement(StockInfo,{location:store,product:product,showStoreName:false}))));}StoreAddress.defaultProps={address:null,pure:false};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import React,{Fragment,useMemo}from'react';import{i18n,generateGoogleMapsDirectionsUrl}from'@shopgate/engage/core';import{LocationIcon,Link,Ellipsis,I18n}from'@shopgate/engage/components';import{StoreDetailsLine}from"./StoreDetailsLine";import{detailsPrimary,detailsSecondary}from"./Store.style";/**
|
|
1
|
+
import React,{Fragment,useMemo}from'react';import PropTypes from'prop-types';import{i18n,generateGoogleMapsDirectionsUrl}from'@shopgate/engage/core';import{LocationIcon,Link,Ellipsis,I18n}from'@shopgate/engage/components';import{StoreDetailsLine}from"./StoreDetailsLine";import{detailsPrimary,detailsSecondary}from"./Store.style";/**
|
|
2
2
|
* Renders the pickup location's address information.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
|
-
* @
|
|
5
|
-
|
|
4
|
+
* @param {Object} props.address The address object.
|
|
5
|
+
* @param {boolean} props.showFull Whether to show the full address.
|
|
6
|
+
* @returns {JSX.Element}
|
|
7
|
+
*/export function StoreAddressShort(_ref){var address=_ref.address,showFull=_ref.showFull;var mapsUrl=useMemo(function(){return address&&generateGoogleMapsDirectionsUrl(address);},[address]);if(!address){return null;}var addressLabel="".concat(address.street+(address.street2?", ".concat(address.street2):'')+(address.street3?", ".concat(address.street3):'')+(address.street4?", ".concat(address.street4):'')+i18n.text('locations.address',address),": ").concat(i18n.text('locations.map_open'));return React.createElement(Link,{target:"_blank",href:mapsUrl,role:"button","aria-label":addressLabel},React.createElement(StoreDetailsLine,{icon:LocationIcon,linked:true},showFull&&React.createElement(Fragment,null,React.createElement("p",{className:detailsPrimary},address.street),address.street2&&address.street2!==''&&React.createElement("p",{className:detailsPrimary},address.street2),address.street3&&address.street3!==''&&React.createElement("p",{className:detailsPrimary},address.street3),address.street4&&address.street4!==''&&React.createElement("p",{className:detailsPrimary},address.street4)),React.createElement(Ellipsis,{rows:1,className:detailsPrimary},i18n.text('locations.address',address)),React.createElement(I18n.Text,{string:"locations.map_open",className:detailsSecondary,"aria-label":": ".concat(i18n.text('locations.map_open'))})));}StoreAddressShort.defaultProps={address:null,showFull:false};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React,{useContext,Fragment}from'react';import{
|
|
1
|
+
import React,{useContext,Fragment}from'react';import{StoreContext}from"./Store.context";import{StoreHeader}from"./StoreHeader";import{StoreDetails}from"./StoreDetails";import{StoreSelectLocationButton}from"./StoreSelectLocationButton";/**
|
|
2
2
|
* Renders the store's card.
|
|
3
3
|
* @returns {JSX}
|
|
4
|
-
*/export function StoreCard(){var store=useContext(StoreContext);if(!store||!store.address){return null;}return React.createElement(Fragment,null,React.createElement(StoreHeader,null),React.createElement(StoreDetails,null),React.createElement(
|
|
4
|
+
*/export function StoreCard(){var store=useContext(StoreContext);if(!store||!store.address){return null;}return React.createElement(Fragment,null,React.createElement(StoreHeader,null),React.createElement(StoreDetails,null),React.createElement(StoreSelectLocationButton,null));}
|
|
@@ -1,4 +1,8 @@
|
|
|
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*as React from'react';import classNames from'classnames';import{Grid}from'@shopgate/engage/components';import{detailsLine,detailsIcon,detailsIconLinked,details}from"./Store.style";/**
|
|
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*as React from'react';import PropTypes from'prop-types';import classNames from'classnames';import{Grid}from'@shopgate/engage/components';import{detailsLine,detailsIcon,detailsIconLinked,details}from"./Store.style";/**
|
|
2
2
|
* Renders a single store headline.
|
|
3
|
-
* @
|
|
3
|
+
* @param {Object} props The component props.
|
|
4
|
+
* @param {React.ReactElement} props.icon The icon component.
|
|
5
|
+
* @param {boolean} props.linked Whether the details should be linked.
|
|
6
|
+
* @param {React.ReactNode} props.children The component children.
|
|
7
|
+
* @returns {JSX.Element}
|
|
4
8
|
*/export function StoreDetailsLine(_ref){var Icon=_ref.icon,children=_ref.children,linked=_ref.linked;return React.createElement(Grid,{className:detailsLine},React.createElement(Grid.Item,{shrink:0,className:classNames(detailsIcon,_defineProperty({},detailsIconLinked,linked))},React.createElement(Icon,{"aria-hidden":true})),React.createElement(Grid.Item,{grow:1,className:details},children));}StoreDetailsLine.defaultProps={linked:false};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import React from'react';import formatDistance from"../../helpers/formatDistance";import{storeDistance}from"./Store.style";export var UNIT_SYSTEM_METRIC='metric';export var UNIT_SYSTEM_IMPERIAL='imperial';/**
|
|
1
|
+
import React from'react';import PropTypes from'prop-types';import formatDistance from"../../helpers/formatDistance";import{storeDistance}from"./Store.style";export var UNIT_SYSTEM_METRIC='metric';export var UNIT_SYSTEM_IMPERIAL='imperial';/**
|
|
2
2
|
* Renders a single store distance.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
|
-
* @
|
|
4
|
+
* @param {number} props.distance The distance.
|
|
5
|
+
* @param {string} props.unitSystem The unit system.
|
|
6
|
+
* @returns {JSX.Element}
|
|
5
7
|
*/export function StoreDistance(_ref){var _ref$distance=_ref.distance,distance=_ref$distance===void 0?null:_ref$distance,_ref$unitSystem=_ref.unitSystem,unitSystem=_ref$unitSystem===void 0?UNIT_SYSTEM_METRIC:_ref$unitSystem;if(distance===null){return null;}return React.createElement("span",{className:storeDistance},formatDistance(distance,unitSystem===UNIT_SYSTEM_IMPERIAL));}StoreDistance.defaultProps={distance:null,unitSystem:UNIT_SYSTEM_METRIC};
|
|
@@ -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,{
|
|
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}from'react';import classNames from'classnames';import{Grid,ResponsiveContainer}from'@shopgate/engage/components';import{isProductAvailable}from"../../helpers";import{FulfillmentContext}from"../../locations.context";import{StoreContext}from"./Store.context";import{StoreDistance}from"./StoreDistance";import{StoreHoursToday}from"./StoreHoursToday";import{StoreSelectLocationButton}from"./StoreSelectLocationButton";import{StockInfo}from"../StockInfo";import{storeHeader,storeName,disabled}from"./Store.style";/**
|
|
2
2
|
* Renders a single store headline.
|
|
3
3
|
* @returns {JSX}
|
|
4
|
-
*/export function StoreHeader(){var store=useContext(StoreContext);var _useContext=useContext(FulfillmentContext),
|
|
4
|
+
*/export function StoreHeader(){var store=useContext(StoreContext);var _useContext=useContext(FulfillmentContext),product=_useContext.product;var isAvailable=isProductAvailable(store,store===null||store===void 0?void 0:store.inventory);var name=store.name,distance=store.distance,unitSystem=store.unitSystem;return React.createElement("div",{className:classNames(storeHeader,_defineProperty({},disabled,!isAvailable))},React.createElement(Grid,null,React.createElement(Grid.Item,{grow:1,className:storeName},name,React.createElement(ResponsiveContainer,{breakpoint:">=sm",webOnly:true},React.createElement("ul",null,React.createElement(Grid.Item,{shrink:0},React.createElement(StockInfo,{location:store,product:product,showStoreName:false}),React.createElement(StoreDistance,{distance:distance,unitSystem:unitSystem}))))),React.createElement(ResponsiveContainer,{breakpoint:"<sm",appAlways:true},React.createElement(Grid.Item,{shrink:0},React.createElement(StoreDistance,{distance:distance,unitSystem:unitSystem}))),React.createElement(ResponsiveContainer,{breakpoint:">=sm",webOnly:true},React.createElement(Grid.Item,{shrink:0},React.createElement(StoreSelectLocationButton,null)))),React.createElement(StoreHoursToday,{hours:store.operationHours}));}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import React from'react';import{i18n}from"../../../core";import{storeHoursToday}from"./Store.style";var weekdays=['sun','mon','tue','wed','thu','fri','sat'];/**
|
|
1
|
+
import React from'react';import PropTypes from'prop-types';import{i18n}from"../../../core";import{storeHoursToday}from"./Store.style";var weekdays=['sun','mon','tue','wed','thu','fri','sat'];/**
|
|
2
2
|
* Renders the store's opening hours for "today".
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
|
-
* @
|
|
4
|
+
* @param {Object} props.hours The store's opening hours.
|
|
5
|
+
* @param {boolean} props.longLabel Whether to render the opening hours with a long label
|
|
6
|
+
* @returns {JSX.Element}
|
|
5
7
|
*/export function StoreHoursToday(_ref){var hours=_ref.hours,longLabel=_ref.longLabel;if(!hours){return null;}var today=weekdays[new Date().getDay()];var hoursToday=hours[today]||null;if(!hoursToday||hoursToday===''){return null;}var label=longLabel?'locations.today_hours_long':'locations.today_hours';return React.createElement("div",{className:storeHoursToday},i18n.text(label,{hours:hoursToday}));}StoreHoursToday.defaultProps={hours:null,longLabel:false};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React,{useContext}from'react';import{CardList,SurroundPortals}from'@shopgate/engage/components';import PlaceholderLabel from'@shopgate/pwa-ui-shared/PlaceholderLabel';import{FulfillmentContext}from"../../locations.context";import{StoreContext}from"./Store.context";import{StoreCard}from"./StoreCard";import{stores,storeCard,storeCardPlaceholder}from"./Store.style";import{FULFILLMENT_SHEET_STORE_LIST}from"../../constants/Portals";/**
|
|
2
2
|
* Renders the locations.
|
|
3
|
-
* @returns {JSX}
|
|
3
|
+
* @returns {JSX.Element}
|
|
4
4
|
*/function StoreListLocations(){var _useContext=useContext(FulfillmentContext),locations=_useContext.locations,isLoading=_useContext.isLoading;if(!isLoading&&(!locations||locations.length===0)){return null;}var showPlaceholder=isLoading&&(!locations||locations.length===0);return React.createElement(SurroundPortals,{portalName:FULFILLMENT_SHEET_STORE_LIST,portalProps:{locations:locations}},React.createElement(CardList,{className:stores},React.createElement(PlaceholderLabel,{className:storeCardPlaceholder,ready:!showPlaceholder},locations.map(function(location){return React.createElement(CardList.Item,{className:storeCard,key:location.code},React.createElement(StoreContext.Provider,{value:location},React.createElement(StoreCard,null)));}))));}export default StoreListLocations;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React,{useContext}from'react';import{ProductImage}from"../../../product";import{FulfillmentContext}from"../../locations.context";import StoreListProductName from"./StoreListProductName";import StoreListProductInfo from"./StoreListProductInfo";import*as styles from"./StoreListProduct.style";import{SurroundPortals}from"../../../components";import{FULFILLMENT_SHEET_PRODUCT}from"../../constants/Portals";/**
|
|
2
2
|
* Renders the product information of the store list.
|
|
3
|
-
* @returns {JSX}
|
|
3
|
+
* @returns {JSX.Element}
|
|
4
4
|
*/function StoreListProduct(){var _useContext=useContext(FulfillmentContext),product=_useContext.product;if(!product){return null;}/* eslint-disable jsx-a11y/aria-role */return React.createElement(SurroundPortals,{portalName:FULFILLMENT_SHEET_PRODUCT,portalProps:{product:product}},React.createElement("div",{className:styles.productContainer,role:"text"},React.createElement("div",{className:styles.productContainerInner},React.createElement("div",{className:styles.productImage},React.createElement(ProductImage,{src:product.featuredImageBaseUrl})),React.createElement("div",{className:styles.productContent},React.createElement(StoreListProductName,null),React.createElement(StoreListProductInfo,null)))));/* eslint-enable jsx-a11y/aria-role */}export default StoreListProduct;
|
|
@@ -20,4 +20,4 @@ if(!supportedCountries.includes(countryCode)){handleCountrySelectChange({target:
|
|
|
20
20
|
*/var handleLocateMeButton=useCallback(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:setInputPostalCode('');setIsLoading(true);_context.next=4;return setGeolocation({productId:productId,isStoreFinder:isStoreFinder});case 4:setIsLoading(false);case 5:case"end":return _context.stop();}},_callee);})),[isStoreFinder,productId,setGeolocation,setIsLoading]);/**
|
|
21
21
|
* Updates the local state for the postal code input.
|
|
22
22
|
* @param {SyntheticEvent} event A React event object
|
|
23
|
-
*/var handlePostalCodeChange=function handlePostalCodeChange(event){setInputPostalCode(event.target.value);};var countries=useCountriesNames(supportedCountries);var hasSupportedCountries=supportedCountries&&supportedCountries.length>1;return React.createElement(SurroundPortals,{portalName:FULFILLMENT_SHEET_SEARCH,portalProps:{product:product}},React.createElement("div",{className:container},hasSupportedCountries&&React.createElement("div",{className:countriesCell},React.createElement("div",{className:selectContainer},React.createElement("select",{name:"countryCode",value:countryCode,onChange:handleCountrySelectChange,className:select},Object.keys(countries).map(function(key){return React.createElement("option",{className:"option",value:key,key:key},countries[key]);})))),React.createElement("div",{className:inputCell},React.createElement("div",{className:inputContainer},React.createElement("span",{className:inputIcon,"aria-hidden":true},React.createElement(MagnifierIcon,null)),React.createElement("input",{ref:inputEl,name:"postalCode",className:input,value:inputPostalCode,onChange:handlePostalCodeChange,onBlur:handlePostalCodeBlur,onKeyDown:handlePostalCodeSubmitKeyDown,disabled:isLoading,type:"search",
|
|
23
|
+
*/var handlePostalCodeChange=function handlePostalCodeChange(event){setInputPostalCode(event.target.value);};var countries=useCountriesNames(supportedCountries);var hasSupportedCountries=supportedCountries&&supportedCountries.length>1;return React.createElement(SurroundPortals,{portalName:FULFILLMENT_SHEET_SEARCH,portalProps:{product:product}},React.createElement("div",{className:container},hasSupportedCountries&&React.createElement("div",{className:countriesCell},React.createElement("div",{className:selectContainer},React.createElement("select",{name:"countryCode",value:countryCode,onChange:handleCountrySelectChange,className:select},Object.keys(countries).map(function(key){return React.createElement("option",{className:"option",value:key,key:key},countries[key]);})))),React.createElement("div",{className:inputCell},React.createElement("div",{className:inputContainer},React.createElement("span",{className:inputIcon,"aria-hidden":true},React.createElement(MagnifierIcon,null)),React.createElement("input",{ref:inputEl,name:"postalCode",className:input,value:inputPostalCode,onChange:handlePostalCodeChange,onBlur:handlePostalCodeBlur,onKeyDown:handlePostalCodeSubmitKeyDown,disabled:isLoading,type:"search",autoComplete:"off",autoCorrect:"off",placeholder:i18n.text('locations.search_placeholder'),"aria-label":i18n.text('locations.search_placeholder')}),React.createElement("button",{onClick:handleLocateMeButton,type:"button",className:inputIcon,"aria-label":i18n.text('locations.stores_near.location')},React.createElement(LocatorIcon,null)))),React.createElement("div",{className:radiusCell},isStoreFinder&&React.createElement(StoreListSearchRadius,null))),message&&React.createElement(MessageBar,{messages:[{type:'error',message:message,icon:InfoIcon}],classNames:{icon:iconClass}}));}StoreListSearch.defaultProps={postalCode:null,isStoreFinder:false};export default connect(memo(StoreListSearch));
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import _isEmpty from"lodash/isEmpty";import _every from"lodash/every";import React from'react';import{getWeekDaysOrder}from'@shopgate/engage/core';import{I18n,TimeIcon}from'@shopgate/engage/components';import{StoreDetailsLine}from"./StoreDetailsLine";import{StoreOpeningHoursLine}from"./StoreOpeningHoursLine";import{openingHours,detailsSecondary}from"./Store.style";/**
|
|
1
|
+
import _isEmpty from"lodash/isEmpty";import _every from"lodash/every";import React from'react';import PropTypes from'prop-types';import{getWeekDaysOrder}from'@shopgate/engage/core';import{I18n,TimeIcon}from'@shopgate/engage/components';import{StoreDetailsLine}from"./StoreDetailsLine";import{StoreOpeningHoursLine}from"./StoreOpeningHoursLine";import{openingHours,detailsSecondary}from"./Store.style";/**
|
|
2
2
|
* Renders the store's opening hours.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
|
-
* @
|
|
5
|
-
|
|
4
|
+
* @param {Object} props.hours The store's opening hours.
|
|
5
|
+
* @param {boolean} props.pure Whether to render the opening hours without any wrapper components
|
|
6
|
+
* @returns {JSX.Element}
|
|
7
|
+
*/export function StoreOpeningHours(_ref){var hours=_ref.hours,pure=_ref.pure;if(!hours||_every(hours,_isEmpty)){return null;}var storeHours=React.createElement("div",{className:openingHours},React.createElement("table",null,React.createElement("tbody",null,getWeekDaysOrder().map(function(weekDay){return React.createElement(StoreOpeningHoursLine,{hours:hours[weekDay],day:weekDay,key:weekDay});}))));if(pure){return storeHours;}return React.createElement(StoreDetailsLine,{icon:TimeIcon},React.createElement(I18n.Text,{string:"locations.hours_details",className:detailsSecondary}),storeHours);}StoreOpeningHours.defaultProps={hours:null,pure:false};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import React from'react';import{i18n}from"../../../core";import{openingHoursRow,openingHoursDay}from"./Store.style";/**
|
|
1
|
+
import React from'react';import PropTypes from'prop-types';import{i18n}from"../../../core";import{openingHoursRow,openingHoursDay}from"./Store.style";/**
|
|
2
2
|
* Renders a single opening hours line.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
|
-
* @
|
|
4
|
+
* @param {string} props.day The day.
|
|
5
|
+
* @param {string} props.hours The hours line.
|
|
6
|
+
* @returns {JSX.Element}
|
|
5
7
|
*/export function StoreOpeningHoursLine(_ref){var day=_ref.day,hours=_ref.hours;if(!hours||hours===''){return null;}return React.createElement("tr",{className:openingHoursRow,"aria-label":"".concat(i18n.text("locations.".concat(day)),": ").concat(hours),tabIndex:0,role:"row"},React.createElement("td",{className:openingHoursDay,"aria-hidden":true},i18n.text("locations.".concat(day))),React.createElement("td",{"aria-hidden":true},hours));}StoreOpeningHoursLine.defaultProps={hours:null};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React from'react';import{I18n,PhoneIcon
|
|
1
|
+
import React from'react';import PropTypes from'prop-types';import{I18n,PhoneIcon}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core';import{StoreDetailsLine}from"./StoreDetailsLine";import{detailsPrimary,detailsSecondary}from"./Store.style";/**
|
|
2
2
|
* Renders the store's phone number.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
|
-
* @
|
|
5
|
-
|
|
4
|
+
* @param {string} props.phone The store's phone number.
|
|
5
|
+
* @returns {JSX.Element}
|
|
6
|
+
*/export function StorePhoneNumber(_ref){var phone=_ref.phone;if(!phone){return null;}return React.createElement("a",{href:"tel:".concat(phone),"aria-label":"".concat(i18n.text('locations.phone'),": ").concat(phone),tabIndex:0},React.createElement(StoreDetailsLine,{icon:PhoneIcon,linked:true},React.createElement("div",{className:detailsPrimary,"aria-hidden":true},phone),React.createElement(I18n.Text,{string:"locations.phone",className:detailsSecondary,"aria-hidden":true})));}StorePhoneNumber.defaultProps={phone:null};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React,{useContext,useCallback}from'react';import{RippleButton}from'@shopgate/engage/components';import PropTypes from'prop-types';import{isProductAvailable}from"../../helpers";import{StoreContext}from"./Store.context";import{i18n,useWidgetSettings}from"../../../core";import{FulfillmentContext}from"../../locations.context";import{selectLocationButton,selectLocationButtonWrapper}from"./Store.style";import connect from"./StoreListSearch.connector";/**
|
|
2
2
|
* The StoreSelectLocationButton component.
|
|
3
3
|
* @returns {JSX.Element}
|
|
4
|
-
*/var StoreSelectLocationButton=function StoreSelectLocationButton(_ref){var setPostalCode=_ref.setPostalCode;var store=useContext(StoreContext);var _ref2=useWidgetSettings('@shopgate/engage/locations')||{},_ref2$setUserSearchZi=_ref2.setUserSearchZipLocationFromSelection,setUserSearchZipLocationFromSelection=_ref2$setUserSearchZi===void 0?true:_ref2$setUserSearchZi;var _useContext=useContext(FulfillmentContext),selectLocation=_useContext.selectLocation,noInventory=_useContext.noInventory,isLoading=_useContext.isLoading,product=_useContext.product;var isAvailable=isProductAvailable(store,store===null||store===void 0?void 0:store.inventory);var handleClick=useCallback(function(e){e.stopPropagation();if(noInventory||isAvailable){if(setUserSearchZipLocationFromSelection){setPostalCode(store.address.postalCode,product===null||product===void 0?void 0:product.id);}selectLocation(store);}},[isAvailable,noInventory,product,selectLocation,setPostalCode,setUserSearchZipLocationFromSelection,store]);return React.createElement("div",{className:selectLocationButtonWrapper},React.createElement(RippleButton,{onClick:handleClick,className:selectLocationButton.toString(),disabled:isLoading||(store===null||store===void 0?void 0:store.isComingSoon)||!noInventory&&!isAvailable},i18n.text('locations.select_location')));};var connectedStoreSelectLocationButton=connect(StoreSelectLocationButton);export{connectedStoreSelectLocationButton as StoreSelectLocationButton};
|
|
4
|
+
*/var StoreSelectLocationButton=function StoreSelectLocationButton(_ref){var setPostalCode=_ref.setPostalCode;var store=useContext(StoreContext);var _ref2=useWidgetSettings('@shopgate/engage/locations')||{},_ref2$setUserSearchZi=_ref2.setUserSearchZipLocationFromSelection,setUserSearchZipLocationFromSelection=_ref2$setUserSearchZi===void 0?true:_ref2$setUserSearchZi;var _useContext=useContext(FulfillmentContext),selectLocation=_useContext.selectLocation,noInventory=_useContext.noInventory,isLoading=_useContext.isLoading,product=_useContext.product;var isAvailable=isProductAvailable(store,store===null||store===void 0?void 0:store.inventory);var handleClick=useCallback(function(e){e.stopPropagation();if(noInventory||isAvailable){if(setUserSearchZipLocationFromSelection){setPostalCode(store.address.postalCode,product===null||product===void 0?void 0:product.id);}selectLocation(store);}},[isAvailable,noInventory,product,selectLocation,setPostalCode,setUserSearchZipLocationFromSelection,store]);return React.createElement("div",{className:selectLocationButtonWrapper},React.createElement(RippleButton,{onClick:handleClick,className:selectLocationButton.toString(),disabled:isLoading||(store===null||store===void 0?void 0:store.isComingSoon)||!noInventory&&!isAvailable},i18n.text((store===null||store===void 0?void 0:store.isComingSoon)?'location.comingSoon':'locations.select_location')));};var connectedStoreSelectLocationButton=connect(StoreSelectLocationButton);export{connectedStoreSelectLocationButton as StoreSelectLocationButton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{FulfillmentSelector}from"./FulfillmentSelector";export{FulfillmentSheet}from"./FulfillmentSheet";export{FulfillmentPathSelector}from"./FulfillmentPathSelector";export{StoreList,StoreOpeningHours,StorePhoneNumber,StoreAddress}from"./StoreList";export{CartItemProductChangeLocation,CartChangeFulfillmentMethod,CartContextMenuItemChangeLocation,CartContextMenuItemChangeFulfillment,CartContextMenuChangeFulfillment}from"./Cart";export{GlobalLocationSelector}from"./GlobalLocationSelector";export{GlobalLocationSwitcher}from"./GlobalLocationSwitcher";export{FulfillmentSlotSwitcher}from"./FulfillmentSlotSwitcher";export{StoreFinder}from"./StoreFinder";export{StockInfo}from"./StockInfo";export{default as StockInfoLists}from"./StockInfoLists";
|
|
1
|
+
export{FulfillmentSelector}from"./FulfillmentSelector";export{FulfillmentSheet}from"./FulfillmentSheet";export{FulfillmentPathSelector}from"./FulfillmentPathSelector";export{StoreList,StoreOpeningHours,StorePhoneNumber,StoreAddress}from"./StoreList";export{CartItemProductChangeLocation,CartChangeFulfillmentMethod,CartContextMenuItemChangeLocation,CartContextMenuItemChangeFulfillment,CartContextMenuChangeFulfillment}from"./Cart";export{GlobalLocationSelector}from"./GlobalLocationSelector";export{GlobalLocationSwitcher}from"./GlobalLocationSwitcher";export{FulfillmentSlotSwitcher}from"./FulfillmentSlotSwitcher";export{StoreFinder}from"./StoreFinder";export{StockInfo}from"./StockInfo";export{default as StockInfoLists}from"./StockInfoLists";export{default as StoreDetails}from"./StoreDetails";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import{PRODUCT}from'@shopgate/pwa-common-commerce/product/constants/Portals';import{PRODUCT_ITEM}from'@shopgate/pwa-common-commerce/category/constants/Portals';// CONTENTS
|
|
2
|
-
var FULFILLMENT_SELECTOR='fulfillment-selector';var LOCATION_STOCK_INFO='location-stock-info';var SEARCH='search';var STORE_LIST='store_list';var ALTERNATIVE='alternative';var CHANGE='change';var LOCATION='location';/* PRODUCT DETAILS */export var PRODUCT_FULFILLMENT_SELECTOR="".concat(PRODUCT,".").concat(FULFILLMENT_SELECTOR);export var PRODUCT_FULFILLMENT_SELECTOR_LOCATION="".concat(PRODUCT,".").concat(FULFILLMENT_SELECTOR,".").concat(LOCATION);export var PRODUCT_FULFILLMENT_CHANGE_LOCATION="".concat(PRODUCT,".").concat(FULFILLMENT_SELECTOR,".").concat(CHANGE,".").concat(LOCATION);export var PRODUCT_FULFILLMENT_SELECTOR_ALTERNATIVE_LOCATION="".concat(PRODUCT,".").concat(FULFILLMENT_SELECTOR,".").concat(ALTERNATIVE,".").concat(LOCATION);export var PRODUCT_LOCATION_STOCK_INFO="".concat(PRODUCT,".").concat(LOCATION_STOCK_INFO);/* PRODUCT LISTS */export var PRODUCT_LOCATION_STOCK_INFO_LIST="".concat(PRODUCT_ITEM,".").concat(LOCATION_STOCK_INFO);/* FULFILLMENT SHEET */export var FULFILLMENT_SHEET='fulfillment-sheet';export var FULFILLMENT_SHEET_PRODUCT="".concat(FULFILLMENT_SHEET,".").concat(PRODUCT);export var FULFILLMENT_SHEET_SEARCH="".concat(FULFILLMENT_SHEET,".").concat(SEARCH);export var FULFILLMENT_SHEET_STORE_LIST="".concat(FULFILLMENT_SHEET,".").concat(STORE_LIST);
|
|
2
|
+
var FULFILLMENT_SELECTOR='fulfillment-selector';var LOCATION_STOCK_INFO='location-stock-info';var SEARCH='search';var STORE_LIST='store_list';var ALTERNATIVE='alternative';var CHANGE='change';var LOCATION='location';var STORE_DETAILS='store-details';/* PRODUCT DETAILS */export var PRODUCT_FULFILLMENT_SELECTOR="".concat(PRODUCT,".").concat(FULFILLMENT_SELECTOR);export var PRODUCT_FULFILLMENT_SELECTOR_LOCATION="".concat(PRODUCT,".").concat(FULFILLMENT_SELECTOR,".").concat(LOCATION);export var PRODUCT_FULFILLMENT_CHANGE_LOCATION="".concat(PRODUCT,".").concat(FULFILLMENT_SELECTOR,".").concat(CHANGE,".").concat(LOCATION);export var PRODUCT_FULFILLMENT_SELECTOR_ALTERNATIVE_LOCATION="".concat(PRODUCT,".").concat(FULFILLMENT_SELECTOR,".").concat(ALTERNATIVE,".").concat(LOCATION);export var PRODUCT_LOCATION_STOCK_INFO="".concat(PRODUCT,".").concat(LOCATION_STOCK_INFO);/* PRODUCT LISTS */export var PRODUCT_LOCATION_STOCK_INFO_LIST="".concat(PRODUCT_ITEM,".").concat(LOCATION_STOCK_INFO);/* FULFILLMENT SHEET */export var FULFILLMENT_SHEET='fulfillment-sheet';export var FULFILLMENT_SHEET_PRODUCT="".concat(FULFILLMENT_SHEET,".").concat(PRODUCT);export var FULFILLMENT_SHEET_SEARCH="".concat(FULFILLMENT_SHEET,".").concat(SEARCH);export var FULFILLMENT_SHEET_STORE_LIST="".concat(FULFILLMENT_SHEET,".").concat(STORE_LIST);/* STORE DETAILS */export var STORE_DETAILS_LOCATION_MAP="".concat(STORE_DETAILS,".location-map");
|
|
@@ -2,4 +2,6 @@
|
|
|
2
2
|
export{REQUEST_LOCATIONS,RECEIVE_LOCATIONS,ERROR_LOCATIONS,REQUEST_PRODUCT_INVENTORIES,RECEIVE_PRODUCT_INVENTORIES,ERROR_PRODUCT_INVENTORIES,REQUEST_INVENTORIES,RECEIVE_INVENTORIES,ERROR_INVENTORIES,SELECT_LOCATION,SELECT_GLOBAL_LOCATION,STORE_FORM_INPUT,STORE_FULFILLMENT_METHOD,SET_USER_SEARCH_COUNTRY_CODE,SET_USER_SEARCH_POSTAL_CODE,SET_USER_SEARCH_GEOLOCATION,SET_USER_GEOLOCATION,SET_STORE_FINDER_SEARCH_RADIUS,REQUEST_PRODUCT_LOCATIONS,RECEIVE_PRODUCT_LOCATIONS,ERROR_PRODUCT_LOCATIONS,SUBMIT_RESERVATION_REQUEST,SUBMIT_RESERVATION_SUCCESS,SUBMIT_RESERVATION_ERROR,FETCH_FULFILLMENT_SLOTS_ERROR,FETCH_FULFILLMENT_SLOTS_SUCCESS,PROVIDE_PRODUCT_ALTERNATIVE_LOCATION}from"./ActionTypes";// PIPELINES
|
|
3
3
|
export{SHOPGATE_STOREFRONT_GET_PRODUCT_LOCATIONS,SHOPGATE_STOREFRONT_CREATE_ORDER,SHOPGATE_STOREFRONT_GET_LOCATIONS,SHOPGATE_STOREFRONT_GET_PRODUCT_INVENTORIES,SHOPGATE_STOREFRONT_GET_INVENTORIES}from"./Pipelines";// PORTALS
|
|
4
4
|
export{PRODUCT_FULFILLMENT_SELECTOR,PRODUCT_LOCATION_STOCK_INFO}from"./Portals";export var DIRECT_SHIP='directShip';export var DIRECT_SHIP_LABEL='locations.fulfillment.direct_ship';export var IN_STORE_PICKUP_BOPIS='inStorePickupBOPIS';export var IN_STORE_PICKUP_BOPIS_LABEL='locations.fulfillment.bopis';export var IN_STORE_PICKUP_ROPIS='inStorePickupROPIS';export var IN_STORE_PICKUP_ROPIS_LABEL='locations.fulfillment.ropis';export var ROPIS='ROPIS';export var BOPIS='BOPIS';export var QUICK_RESERVE='quickReserve';export var MULTI_LINE_RESERVE='multiLineReserve';export var SORT_CLOSEST_LOCATION='closestLocation';export var SORT_CLOSEST_LOCATION_WITH_INVENTORY='closestLocationWithInventory';export var DEFAULT_ROPE_FULFILLMENT_METHOD='defaultRopeFulfillmentMethod';export var USER_SEARCH_GEOLOCATION_LIFETIME=3e5;// 5 minutes for geolocation expire
|
|
5
|
-
export
|
|
5
|
+
export var NEARBY_LOCATIONS_LIMIT=8;// 25 miles in km
|
|
6
|
+
export var NEARBY_LOCATIONS_RADIUS=25*1.60934;// 10 miles in km
|
|
7
|
+
export var MAP_RADIUS_KM=10*1.60934;export{STAGE_SELECT_STORE,STAGE_RESERVE_FORM,STAGE_RESPONSE_SUCCESS,STAGE_RESPONSE_ERROR,STAGE_FULFILLMENT_METHOD}from"./Stages";export{STORE_FINDER_PATTERN,STORE_DETAILS_PATTERN,STORE_DETAILS_PATH}from"./routes";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export var STORE_FINDER_PATTERN='/storefinder';
|
|
1
|
+
export var STORE_FINDER_PATTERN='/storefinder';export var STORE_DETAILS_PATH='/store-details';export var STORE_DETAILS_PATTERN='/store-details/:code';
|
|
@@ -1 +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{main$}from'@shopgate/pwa-common/streams';import{Observable}from'rxjs/Observable';import{cartReceived$}from'@shopgate/pwa-common-commerce/cart/streams';import{makeGetRoutePattern,getCurrentState,getCurrentRoute}from'@shopgate/pwa-common/selectors/router';import{routeWillEnter$}from'@shopgate/pwa-common/streams/router';import{ITEM_PATTERN}from'@shopgate/pwa-common-commerce/product/constants';import{getProductDataById}from'@shopgate/pwa-common-commerce/product/selectors/product';import{SEARCH_PATTERN}from'@shopgate/pwa-common-commerce/search/constants';import{CATEGORY_PATTERN}from'@shopgate/pwa-common-commerce/category/constants';import{FAVORITES_PATH}from'@shopgate/pwa-common-commerce/favorites/constants';import{SUBMIT_RESERVATION_SUCCESS,RECEIVE_PRODUCT_LOCATIONS,RECEIVE_LOCATIONS,SET_USER_SEARCH_COUNTRY_CODE,SET_USER_SEARCH_POSTAL_CODE,SET_USER_SEARCH_GEOLOCATION,SET_STORE_FINDER_SEARCH_RADIUS,SELECT_GLOBAL_LOCATION,STORE_FINDER_PATTERN,PROVIDE_PRODUCT_ALTERNATIVE_LOCATION,SELECT_LOCATION}from"./constants";import{RECEIVE_ORDER_DETAILS}from"../orders/constants";import{WISH_LIST_PATH}from"../account/constants";export var submitReservationSuccess$=main$.filter(function(_ref){var action=_ref.action;return action.type===SUBMIT_RESERVATION_SUCCESS;});export var receiveProductLocations$=main$.filter(function(_ref2){var action=_ref2.action;return action.type===RECEIVE_PRODUCT_LOCATIONS;});export var receiveOrderDetails$=main$.filter(function(_ref3){var action=_ref3.action;return action.type===RECEIVE_ORDER_DETAILS;});export var cartReceivedWithROPE$=cartReceived$.filter(function(_ref4){var _ref4$action$cart=_ref4.action.cart,_ref4$action$cart2=_ref4$action$cart===void 0?{}:_ref4$action$cart,_ref4$action$cart2$ca=_ref4$action$cart2.cartItems,cartItems=_ref4$action$cart2$ca===void 0?[]:_ref4$action$cart2$ca;return cartItems.some(function(item){var _item$fulfillment,_item$fulfillment$loc;return item===null||item===void 0?void 0:(_item$fulfillment=item.fulfillment)===null||_item$fulfillment===void 0?void 0:(_item$fulfillment$loc=_item$fulfillment.location)===null||_item$fulfillment$loc===void 0?void 0:_item$fulfillment$loc.code;});});export var userSearchChanged$=main$.filter(function(_ref5){var action=_ref5.action;return action.type===SET_USER_SEARCH_COUNTRY_CODE||action.type===SET_USER_SEARCH_POSTAL_CODE||action.type===SET_USER_SEARCH_GEOLOCATION||action.type===SET_STORE_FINDER_SEARCH_RADIUS;});export var fulfillmentLocationsReceivedFromProduct$=receiveProductLocations$.switchMap(function(data){var locations=data.action.locations;var locationCodes=locations.map(function(_ref6){var code=_ref6.code;return code;});return Observable.of(_extends({},data,{locationCodes:locationCodes}));});export var fulfillmentLocationsReceivedFromCart$=cartReceivedWithROPE$.switchMap(function(data){var _data$action$cart=data.action.cart,_data$action$cart2=_data$action$cart===void 0?{}:_data$action$cart,_data$action$cart2$ca=_data$action$cart2.cartItems,cartItems=_data$action$cart2$ca===void 0?[]:_data$action$cart2$ca;var locationCodes=cartItems.map(function(item){var _item$fulfillment2,_item$fulfillment2$lo;return item===null||item===void 0?void 0:(_item$fulfillment2=item.fulfillment)===null||_item$fulfillment2===void 0?void 0:(_item$fulfillment2$lo=_item$fulfillment2.location)===null||_item$fulfillment2$lo===void 0?void 0:_item$fulfillment2$lo.code;}).filter(Boolean);locationCodes=Array.from(new Set(locationCodes));return Observable.of(_extends({},data,{locationCodes:locationCodes}));});export var fulfillmentLocationsReceivedFromOrder$=receiveOrderDetails$.filter(function(_ref7){var _ref7$action$order=_ref7.action.order,_ref7$action$order2=_ref7$action$order===void 0?{}:_ref7$action$order,_ref7$action$order2$l=_ref7$action$order2.lineItems,lineItems=_ref7$action$order2$l===void 0?[]:_ref7$action$order2$l;return lineItems.some(function(item){return item.fulfillmentLocationCode;});}).switchMap(function(data){var _data$action$order=data.action.order,_data$action$order2=_data$action$order===void 0?{}:_data$action$order,_data$action$order2$l=_data$action$order2.lineItems,lineItems=_data$action$order2$l===void 0?[]:_data$action$order2$l;var locationCodes=lineItems.map(function(item){return item===null||item===void 0?void 0:item.fulfillmentLocationCode;}).filter(Boolean);locationCodes=Array.from(new Set(locationCodes));return Observable.of(_extends({},data,{locationCodes:locationCodes}));});export var fulfillmentLocationsReceived$=fulfillmentLocationsReceivedFromCart$.merge(fulfillmentLocationsReceivedFromOrder$).merge(fulfillmentLocationsReceivedFromProduct$);export var preferredLocationDidUpdateGlobal$=main$.filter(function(_ref8){var action=_ref8.action;return action.type===SELECT_GLOBAL_LOCATION;});export var preferredLocationDidUpdateGlobalOnWishlist$=preferredLocationDidUpdateGlobal$.filter(function(_ref9){var getState=_ref9.getState;var _getCurrentRoute=getCurrentRoute(getState()),pattern=_getCurrentRoute.pattern;return pattern===FAVORITES_PATH||pattern===WISH_LIST_PATH;});export var preferredLocationDidUpdateGlobalOnSearch$=preferredLocationDidUpdateGlobal$.filter(function(_ref10){var getState=_ref10.getState;var _getCurrentRoute2=getCurrentRoute(getState()),pattern=_getCurrentRoute2.pattern;return pattern===SEARCH_PATTERN;});export var preferredLocationDidUpdateGlobalNotOnSearch$=preferredLocationDidUpdateGlobal$.filter(function(_ref11){var getState=_ref11.getState;var _getCurrentRoute3=getCurrentRoute(getState()),pattern=_getCurrentRoute3.pattern;return pattern!==SEARCH_PATTERN;});export var preferredLocationDidUpdateGlobalOnCategory$=preferredLocationDidUpdateGlobal$.filter(function(_ref12){var getState=_ref12.getState;var _getCurrentRoute4=getCurrentRoute(getState()),pattern=_getCurrentRoute4.pattern;return pattern===CATEGORY_PATTERN;});export var preferredLocationDidUpdateGlobalNotOnCategory$=preferredLocationDidUpdateGlobal$.filter(function(_ref13){var getState=_ref13.getState;var _getCurrentRoute5=getCurrentRoute(getState()),pattern=_getCurrentRoute5.pattern;return pattern!==CATEGORY_PATTERN;});export var preferredLocationDidUpdate$=main$.filter(function(_ref14){var action=_ref14.action;return action.type===SELECT_LOCATION;});export var storeFinderWillEnter$=routeWillEnter$.filter(function(_ref15){var action=_ref15.action;return action.route.pattern===STORE_FINDER_PATTERN;});export var receiveLocations$=main$.filter(function(_ref16){var action=_ref16.action;return action.type===RECEIVE_LOCATIONS;});export var provideAlternativeLocation$=main$.filter(function(_ref17){var action=_ref17.action;return action.type===PROVIDE_PRODUCT_ALTERNATIVE_LOCATION;});export var preferredLocationDidUpdateOnPDP$=preferredLocationDidUpdateGlobal$.filter(function(_ref18){var getState=_ref18.getState;var getRoutePattern=makeGetRoutePattern();var routePattern=getRoutePattern(getState());return routePattern===ITEM_PATTERN;}).switchMap(function(_ref19){var dispatch=_ref19.dispatch,getState=_ref19.getState,action=_ref19.action;var state=getState();var _getCurrentState=getCurrentState(state),productId=_getCurrentState.productId;var productData=getProductDataById(state,{productId:productId});return Observable.of({action:_extends({},action,{productData:productData}),dispatch:dispatch,getState:getState});});
|
|
1
|
+
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{main$}from'@shopgate/pwa-common/streams';import{Observable}from'rxjs/Observable';import{cartReceived$}from'@shopgate/pwa-common-commerce/cart/streams';import{makeGetRoutePattern,getCurrentState,getCurrentRoute}from'@shopgate/pwa-common/selectors/router';import{routeWillEnter$}from'@shopgate/pwa-common/streams/router';import{ITEM_PATTERN}from'@shopgate/pwa-common-commerce/product/constants';import{getProductDataById}from'@shopgate/pwa-common-commerce/product/selectors/product';import{SEARCH_PATTERN}from'@shopgate/pwa-common-commerce/search/constants';import{CATEGORY_PATTERN}from'@shopgate/pwa-common-commerce/category/constants';import{FAVORITES_PATH}from'@shopgate/pwa-common-commerce/favorites/constants';import{SUBMIT_RESERVATION_SUCCESS,RECEIVE_PRODUCT_LOCATIONS,RECEIVE_LOCATIONS,SET_USER_SEARCH_COUNTRY_CODE,SET_USER_SEARCH_POSTAL_CODE,SET_USER_SEARCH_GEOLOCATION,SET_STORE_FINDER_SEARCH_RADIUS,SELECT_GLOBAL_LOCATION,STORE_FINDER_PATTERN,PROVIDE_PRODUCT_ALTERNATIVE_LOCATION,SELECT_LOCATION,STORE_DETAILS_PATTERN}from"./constants";import{RECEIVE_ORDER_DETAILS}from"../orders/constants";import{WISH_LIST_PATH}from"../account/constants";export var submitReservationSuccess$=main$.filter(function(_ref){var action=_ref.action;return action.type===SUBMIT_RESERVATION_SUCCESS;});export var receiveProductLocations$=main$.filter(function(_ref2){var action=_ref2.action;return action.type===RECEIVE_PRODUCT_LOCATIONS;});export var receiveOrderDetails$=main$.filter(function(_ref3){var action=_ref3.action;return action.type===RECEIVE_ORDER_DETAILS;});export var cartReceivedWithROPE$=cartReceived$.filter(function(_ref4){var _ref4$action$cart=_ref4.action.cart,_ref4$action$cart2=_ref4$action$cart===void 0?{}:_ref4$action$cart,_ref4$action$cart2$ca=_ref4$action$cart2.cartItems,cartItems=_ref4$action$cart2$ca===void 0?[]:_ref4$action$cart2$ca;return cartItems.some(function(item){var _item$fulfillment,_item$fulfillment$loc;return item===null||item===void 0?void 0:(_item$fulfillment=item.fulfillment)===null||_item$fulfillment===void 0?void 0:(_item$fulfillment$loc=_item$fulfillment.location)===null||_item$fulfillment$loc===void 0?void 0:_item$fulfillment$loc.code;});});export var userSearchChanged$=main$.filter(function(_ref5){var action=_ref5.action;return action.type===SET_USER_SEARCH_COUNTRY_CODE||action.type===SET_USER_SEARCH_POSTAL_CODE||action.type===SET_USER_SEARCH_GEOLOCATION||action.type===SET_STORE_FINDER_SEARCH_RADIUS;});export var fulfillmentLocationsReceivedFromProduct$=receiveProductLocations$.switchMap(function(data){var locations=data.action.locations;var locationCodes=locations.map(function(_ref6){var code=_ref6.code;return code;});return Observable.of(_extends({},data,{locationCodes:locationCodes}));});export var fulfillmentLocationsReceivedFromCart$=cartReceivedWithROPE$.switchMap(function(data){var _data$action$cart=data.action.cart,_data$action$cart2=_data$action$cart===void 0?{}:_data$action$cart,_data$action$cart2$ca=_data$action$cart2.cartItems,cartItems=_data$action$cart2$ca===void 0?[]:_data$action$cart2$ca;var locationCodes=cartItems.map(function(item){var _item$fulfillment2,_item$fulfillment2$lo;return item===null||item===void 0?void 0:(_item$fulfillment2=item.fulfillment)===null||_item$fulfillment2===void 0?void 0:(_item$fulfillment2$lo=_item$fulfillment2.location)===null||_item$fulfillment2$lo===void 0?void 0:_item$fulfillment2$lo.code;}).filter(Boolean);locationCodes=Array.from(new Set(locationCodes));return Observable.of(_extends({},data,{locationCodes:locationCodes}));});export var fulfillmentLocationsReceivedFromOrder$=receiveOrderDetails$.filter(function(_ref7){var _ref7$action$order=_ref7.action.order,_ref7$action$order2=_ref7$action$order===void 0?{}:_ref7$action$order,_ref7$action$order2$l=_ref7$action$order2.lineItems,lineItems=_ref7$action$order2$l===void 0?[]:_ref7$action$order2$l;return lineItems.some(function(item){return item.fulfillmentLocationCode;});}).switchMap(function(data){var _data$action$order=data.action.order,_data$action$order2=_data$action$order===void 0?{}:_data$action$order,_data$action$order2$l=_data$action$order2.lineItems,lineItems=_data$action$order2$l===void 0?[]:_data$action$order2$l;var locationCodes=lineItems.map(function(item){return item===null||item===void 0?void 0:item.fulfillmentLocationCode;}).filter(Boolean);locationCodes=Array.from(new Set(locationCodes));return Observable.of(_extends({},data,{locationCodes:locationCodes}));});export var fulfillmentLocationsReceived$=fulfillmentLocationsReceivedFromCart$.merge(fulfillmentLocationsReceivedFromOrder$).merge(fulfillmentLocationsReceivedFromProduct$);export var preferredLocationDidUpdateGlobal$=main$.filter(function(_ref8){var action=_ref8.action;return action.type===SELECT_GLOBAL_LOCATION;});export var preferredLocationDidUpdateGlobalOnWishlist$=preferredLocationDidUpdateGlobal$.filter(function(_ref9){var getState=_ref9.getState;var _getCurrentRoute=getCurrentRoute(getState()),pattern=_getCurrentRoute.pattern;return pattern===FAVORITES_PATH||pattern===WISH_LIST_PATH;});export var preferredLocationDidUpdateGlobalOnSearch$=preferredLocationDidUpdateGlobal$.filter(function(_ref10){var getState=_ref10.getState;var _getCurrentRoute2=getCurrentRoute(getState()),pattern=_getCurrentRoute2.pattern;return pattern===SEARCH_PATTERN;});export var preferredLocationDidUpdateGlobalNotOnSearch$=preferredLocationDidUpdateGlobal$.filter(function(_ref11){var getState=_ref11.getState;var _getCurrentRoute3=getCurrentRoute(getState()),pattern=_getCurrentRoute3.pattern;return pattern!==SEARCH_PATTERN;});export var preferredLocationDidUpdateGlobalOnCategory$=preferredLocationDidUpdateGlobal$.filter(function(_ref12){var getState=_ref12.getState;var _getCurrentRoute4=getCurrentRoute(getState()),pattern=_getCurrentRoute4.pattern;return pattern===CATEGORY_PATTERN;});export var preferredLocationDidUpdateGlobalNotOnCategory$=preferredLocationDidUpdateGlobal$.filter(function(_ref13){var getState=_ref13.getState;var _getCurrentRoute5=getCurrentRoute(getState()),pattern=_getCurrentRoute5.pattern;return pattern!==CATEGORY_PATTERN;});export var preferredLocationDidUpdate$=main$.filter(function(_ref14){var action=_ref14.action;return action.type===SELECT_LOCATION;});export var storeFinderWillEnter$=routeWillEnter$.filter(function(_ref15){var action=_ref15.action;return action.route.pattern===STORE_FINDER_PATTERN;});export var receiveLocations$=main$.filter(function(_ref16){var action=_ref16.action;return action.type===RECEIVE_LOCATIONS;});export var provideAlternativeLocation$=main$.filter(function(_ref17){var action=_ref17.action;return action.type===PROVIDE_PRODUCT_ALTERNATIVE_LOCATION;});export var preferredLocationDidUpdateOnPDP$=preferredLocationDidUpdateGlobal$.filter(function(_ref18){var getState=_ref18.getState;var getRoutePattern=makeGetRoutePattern();var routePattern=getRoutePattern(getState());return routePattern===ITEM_PATTERN;}).switchMap(function(_ref19){var dispatch=_ref19.dispatch,getState=_ref19.getState,action=_ref19.action;var state=getState();var _getCurrentState=getCurrentState(state),productId=_getCurrentState.productId;var productData=getProductDataById(state,{productId:productId});return Observable.of({action:_extends({},action,{productData:productData}),dispatch:dispatch,getState:getState});});export var storeDetailPageWillEnter$=routeWillEnter$.filter(function(_ref20){var action=_ref20.action;return action.route.pattern===STORE_DETAILS_PATTERN;});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createContext}from'react';export var StoreDetailsContext=createContext({});
|
|
@@ -0,0 +1,4 @@
|
|
|
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);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import React,{useMemo,useCallback}from'react';import PropTypes from'prop-types';import{useSelector}from'react-redux';import{LoadingProvider}from'@shopgate/pwa-common/providers';import{getPreferredLocation}from"../selectors";import{STORE_FINDER_PATTERN}from"../constants";import{StoreFinderContext}from"../locations.context";import connect from"./StoreFinder.connector";import{useNavigation}from"../../core";/**
|
|
2
2
|
* @param {Object} props The component props
|
|
3
3
|
* @returns {JSX}
|
|
4
|
-
*/var StoreFinderProvider=function StoreFinderProvider(_ref){var children=_ref.children,locations=_ref.locations,isFetching=_ref.isFetching,shopSettings=_ref.shopSettings,userSearch=_ref.userSearch,storeFinderSearch=_ref.storeFinderSearch,
|
|
5
|
-
pop();},[selectLocation,selectGlobalLocation,pop])
|
|
4
|
+
*/var StoreFinderProvider=function StoreFinderProvider(_ref){var children=_ref.children,locations=_ref.locations,isFetching=_ref.isFetching,shopSettings=_ref.shopSettings,userSearch=_ref.userSearch,storeFinderSearch=_ref.storeFinderSearch,selectGlobalLocation=_ref.selectGlobalLocation,selectLocation=_ref.selectLocation;var _useNavigation=useNavigation(),pop=_useNavigation.pop;var selectedLocation=useSelector(getPreferredLocation);var selectLocationCb=useCallback(function(location){selectLocation(location,true);selectGlobalLocation(location);// Back navigation
|
|
5
|
+
pop();},[selectLocation,selectGlobalLocation,pop]);/**
|
|
6
6
|
* @param {bool} loading
|
|
7
|
-
*/var setIsLoading=useCallback(function(loading){if(loading){LoadingProvider.setLoading(STORE_FINDER_PATTERN);return;}LoadingProvider.unsetLoading(STORE_FINDER_PATTERN);},[]);var value=useMemo(function(){return{locations:locations,selectedLocation:selectedLocation,
|
|
7
|
+
*/var setIsLoading=useCallback(function(loading){if(loading){LoadingProvider.setLoading(STORE_FINDER_PATTERN);return;}LoadingProvider.unsetLoading(STORE_FINDER_PATTERN);},[]);var value=useMemo(function(){return{locations:locations,selectedLocation:selectedLocation,selectLocation:selectLocationCb,isFetching:isFetching,shopSettings:shopSettings,userSearch:userSearch,storeFinderSearch:storeFinderSearch,setIsLoading:setIsLoading};},[isFetching,locations,selectLocationCb,selectedLocation,shopSettings,storeFinderSearch,userSearch,setIsLoading]);return React.createElement(StoreFinderContext.Provider,{value:value},children);};StoreFinderProvider.defaultProps={children:null,locations:[],isFetching:false,shopSettings:null,userSearch:null,storeFinderSearch:null};export default connect(StoreFinderProvider);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as FulfillmentProvider,openSheet}from"./FulfillmentProvider";export{default as StoreFinderProvider}from"./StoreFinderProvider";
|
|
1
|
+
export{default as FulfillmentProvider,openSheet}from"./FulfillmentProvider";export{default as StoreFinderProvider}from"./StoreFinderProvider";export{default as StoreDetailsProvider}from"./StoreDetailsProvider";export{StoreDetailsContext}from"./StoreDetailsContext";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _excluded=["geolocation"];function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{createSelector}from'reselect';import pickBy from'lodash/pickBy';import{getUserData,
|
|
1
|
+
var _excluded=["geolocation"];function _objectWithoutProperties(source,excluded){if(source==null)return{};var target=_objectWithoutPropertiesLoose(source,excluded);var key,i;if(Object.getOwnPropertySymbols){var sourceSymbolKeys=Object.getOwnPropertySymbols(source);for(i=0;i<sourceSymbolKeys.length;i++){key=sourceSymbolKeys[i];if(excluded.indexOf(key)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(source,key))continue;target[key]=source[key];}}return target;}function _objectWithoutPropertiesLoose(source,excluded){if(source==null)return{};var target={};var sourceKeys=Object.keys(source);var key,i;for(i=0;i<sourceKeys.length;i++){key=sourceKeys[i];if(excluded.indexOf(key)>=0)continue;target[key]=source[key];}return target;}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import{createSelector}from'reselect';import pickBy from'lodash/pickBy';import{getExternalCustomerNumber,getUserData,getUserId}from'@shopgate/engage/user';import{generateSortedHash}from'@shopgate/pwa-common/helpers/redux/generateSortedHash';import{getProduct}from'@shopgate/engage/product/selectors/product';import{getCurrentRoute}from'@shopgate/pwa-common/selectors/router';import{getIsLocationBasedShopping,makeUseLocationFulfillmentMethods}from'@shopgate/engage/core/selectors';import{makeGetEnabledFulfillmentMethods}from"../../core/config";import{makeIsProductActive,makeIsBaseProductActive}from"../../product/selectors/product";import{isProductAvailable}from"../helpers/productInventory";import{DIRECT_SHIP,NEARBY_LOCATIONS_LIMIT,NEARBY_LOCATIONS_RADIUS}from"../constants";/**
|
|
2
2
|
* Selector to retrieve a product's fulfillment methods.
|
|
3
3
|
* @returns {Function}
|
|
4
4
|
*/export var getProductFulfillmentMethods=createSelector(getProduct,function(product){if(!product||!product.fulfillmentMethods||product.fulfillmentMethods.length===0){return null;}return product.fulfillmentMethods;});/**
|
|
@@ -137,4 +137,9 @@ if(!method){try{var available=getProductFulfillmentMethods(state,props);return(a
|
|
|
137
137
|
*/export var getProductAlternativeLocationParams=createSelector(getUserGeolocation,getUserSearch,getPreferredLocation,function(userGeolocation,userSearch,preferredLocation){if(!userSearch){return null;}var params={countryCode:userSearch.countryCode};if(userGeolocation){params.geolocation=userGeolocation;}else if(userSearch.geolocation){params.geolocation=userSearch.geolocation;}else if(userSearch.postalCode){params.postalCode=userSearch.postalCode;}else if(preferredLocation){params.geolocation={latitude:preferredLocation.latitude,longitude:preferredLocation.longitude};}return params;});/**
|
|
138
138
|
* @param {Function} getParams get params for fetch locations.
|
|
139
139
|
* @returns {Array}
|
|
140
|
-
*/export var getProductAlternativeLocations=createSelector(function(_,props){return props.productId;},function(_,props){return props.params;},getLocationsStorage,getProductAlternativeLocationParams,function(productId,propsParams,storage,alternativeParams){if(!alternativeParams){return null;}var fetchParams=_extends({productCode:productId},alternativeParams,{},propsParams);if(fetchParams.geolocation){fetchParams.latitude=fetchParams.geolocation.latitude;fetchParams.longitude=fetchParams.geolocation.longitude;delete fetchParams.geolocation;}var sortedHash=generateSortedHash(fetchParams);var codes=storage.locationsByFilter[sortedHash];if(!codes){return null;}return codes.map(function(code){return storage.locationsByCode[code];}).map(function(location){var pair=generateSortedHash({productCode:productId,locationCode:location.code});var productInventory=storage.inventoriesByCodePair[pair]||{};if(!productInventory.isAvailable){return null;}return _extends({},location,{productInventory:productInventory});}).filter(Boolean);})
|
|
140
|
+
*/export var getProductAlternativeLocations=createSelector(function(_,props){return props.productId;},function(_,props){return props.params;},getLocationsStorage,getProductAlternativeLocationParams,function(productId,propsParams,storage,alternativeParams){if(!alternativeParams){return null;}var fetchParams=_extends({productCode:productId},alternativeParams,{},propsParams);if(fetchParams.geolocation){fetchParams.latitude=fetchParams.geolocation.latitude;fetchParams.longitude=fetchParams.geolocation.longitude;delete fetchParams.geolocation;}var sortedHash=generateSortedHash(fetchParams);var codes=storage.locationsByFilter[sortedHash];if(!codes){return null;}return codes.map(function(code){return storage.locationsByCode[code];}).map(function(location){var pair=generateSortedHash({productCode:productId,locationCode:location.code});var productInventory=storage.inventoriesByCodePair[pair]||{};if(!productInventory.isAvailable){return null;}return _extends({},location,{productInventory:productInventory});}).filter(Boolean);});/**
|
|
141
|
+
* Creates a selector that retrieves nearby locations for a location referenced by a location code.
|
|
142
|
+
* @param {string} locationCode Location code.
|
|
143
|
+
* @returns {Function}
|
|
144
|
+
*/export var makeGetNearbyLocationsByLocationCode=function makeGetNearbyLocationsByLocationCode(locationCode){var getFilteredLocationsForRoute=makeGetFilteredLocations(function(state){var routeLocation=makeGetLocation(function(){return locationCode;})(state);return{latitude:routeLocation===null||routeLocation===void 0?void 0:routeLocation.latitude,longitude:routeLocation===null||routeLocation===void 0?void 0:routeLocation.longitude,limit:NEARBY_LOCATIONS_LIMIT,radius:NEARBY_LOCATIONS_RADIUS};});return createSelector(getFilteredLocationsForRoute,function(locations){// remove current location from nearby locations
|
|
145
|
+
var filteredLocations=locations.filter(function(location){return location.code!==locationCode;});return filteredLocations;});};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _regeneratorRuntime from"@babel/runtime/regenerator";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);}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{getProductsResult,productIsReady$,productsReceived$,productsReceivedCached$,RECEIVE_PRODUCTS_CACHED,variantDidChange$}from'@shopgate/engage/product';import{
|
|
1
|
+
import _regeneratorRuntime from"@babel/runtime/regenerator";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);}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{getProductsResult,productIsReady$,productsReceived$,productsReceivedCached$,RECEIVE_PRODUCTS_CACHED,variantDidChange$}from'@shopgate/engage/product';import{ToastProvider,appDidStart$,routeWillEnter$,UIEvents,getCurrentRoute,hex2bin,getThemeSettings,getCurrentSearchQuery,i18n,appWillInit$,appInitialization}from'@shopgate/engage/core';import{cartReceived$,fetchCart,cartDidEnter$,getCartItems}from'@shopgate/engage/cart';import{userDidLogin$}from'@shopgate/engage/user';import{receiveFavoritesWhileVisible$}from'@shopgate/pwa-common-commerce/favorites/streams';import{getFavoritesProductsIds,isFetching}from'@shopgate/pwa-common-commerce/favorites/selectors';import{categoryDidBackEnter$}from'@shopgate/pwa-common-commerce/category/streams';import{searchDidBackEntered$}from'@shopgate/pwa-common-commerce/search/streams';import{hasNewServices}from'@shopgate/engage/core/helpers';import{cookieConsentInitialized$}from'@shopgate/engage/tracking/streams';import{getUserSearch,getStoreFinderSearch,getPreferredLocation,getIsPending,getProductAlternativeLocationParams,getProductAlternativeLocations,makeGetLocation}from"./selectors";import{fetchDefaultLocation,fetchLocations,fetchProductLocations,sendDefaultLocationCode,setPending,setUserGeolocation}from"./actions";import{setShowInventoryInLists,showInventoryInLists}from"./helpers";import fetchInventories from"./actions/fetchInventories";import{EVENT_SET_OPEN}from"./providers/FulfillmentProvider";import fetchProductInventories from"./actions/fetchProductInventories";import{submitReservationSuccess$,userSearchChanged$,storeFinderWillEnter$,preferredLocationDidUpdate$,preferredLocationDidUpdateOnPDP$,provideAlternativeLocation$,preferredLocationDidUpdateGlobalOnWishlist$,storeDetailPageWillEnter$}from"./locations.streams";import selectLocation from"./action-creators/selectLocation";import{NEARBY_LOCATIONS_RADIUS,SET_STORE_FINDER_SEARCH_RADIUS,NEARBY_LOCATIONS_LIMIT}from"./constants";import selectGlobalLocation from"./action-creators/selectGlobalLocation";var initialLocationsResolve;var initialLocationsReject;var initialLocationsPromise=new Promise(function(resolve,reject){initialLocationsResolve=resolve;initialLocationsReject=reject;});/**
|
|
2
2
|
* Sets a location once the location has been validated.
|
|
3
3
|
* @param {string} locationCode Location code
|
|
4
4
|
* @param {Function} dispatch Redux dispatch function
|
|
@@ -6,7 +6,7 @@ import _regeneratorRuntime from"@babel/runtime/regenerator";function _extends(){
|
|
|
6
6
|
*/var setLocationOnceAvailable=/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(locationCode,dispatch){var _ref3,initialLocations;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.prev=0;_context.next=3;return initialLocationsPromise;case 3:_ref3=_context.sent;initialLocations=_ref3.locations;if(initialLocations.some(function(l){return l.code===locationCode;})){_context.next=7;break;}return _context.abrupt("return");case 7:dispatch(selectLocation({code:locationCode}));requestAnimationFrame(function(){dispatch(setPending(false));});_context.next=13;break;case 11:_context.prev=11;_context.t0=_context["catch"](0);case 13:case"end":return _context.stop();}},_callee,null,[[0,11]]);}));return function setLocationOnceAvailable(_x,_x2){return _ref.apply(this,arguments);};}();/**
|
|
7
7
|
* Locations subscriptions.
|
|
8
8
|
* @param {Function} subscribe The subscribe function.
|
|
9
|
-
*/function locationsSubscriber(subscribe){subscribe(appWillInit$,function(){appInitialization.set('location',/*#__PURE__*/function(){var _ref5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref4){var dispatch;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:dispatch=_ref4.dispatch;if(!hasNewServices()){_context2.next=4;break;}_context2.next=4;return dispatch(fetchDefaultLocation());case 4:case"end":return _context2.stop();}},_callee2);}));return function(_x3){return _ref5.apply(this,arguments);};}());});subscribe(preferredLocationDidUpdate$,function(_ref6){var dispatch=_ref6.dispatch,getState=_ref6.getState;var preferredLocation=getPreferredLocation(getState());if(preferredLocation){dispatch(sendDefaultLocationCode(preferredLocation.code));}});subscribe(cookieConsentInitialized$,/*#__PURE__*/function(){var _ref8=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref7){var dispatch,getState,userSearch,_ref10,locations,preferredLocation,code,hasLocation,_ref12,preferredLocationDefault,locationToPreselect;return _regeneratorRuntime.wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:dispatch=_ref7.dispatch,getState=_ref7.getState;if(hasNewServices()){_context3.next=3;break;}return _context3.abrupt("return");case 3:// Fetch merchants locations.
|
|
9
|
+
*/function locationsSubscriber(subscribe){subscribe(appWillInit$,function(){appInitialization.set('location',/*#__PURE__*/function(){var _ref5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref4){var dispatch;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:dispatch=_ref4.dispatch;if(!hasNewServices()){_context2.next=4;break;}_context2.next=4;return dispatch(fetchDefaultLocation());case 4:case"end":return _context2.stop();}},_callee2);}));return function(_x3){return _ref5.apply(this,arguments);};}());});subscribe(preferredLocationDidUpdate$,function(_ref6){var dispatch=_ref6.dispatch,getState=_ref6.getState,action=_ref6.action,events=_ref6.events;var preferredLocation=getPreferredLocation(getState());if(preferredLocation){dispatch(sendDefaultLocationCode(preferredLocation.code));}var _action$location=action.location,location=_action$location===void 0?{}:_action$location,showToast=action.showToast;if(showToast){events.emit(ToastProvider.ADD,{id:'location.changed',message:i18n.text('location.preferredLocationChanged',{storeName:location===null||location===void 0?void 0:location.name})});}});subscribe(cookieConsentInitialized$,/*#__PURE__*/function(){var _ref8=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref7){var dispatch,getState,userSearch,_ref10,locations,preferredLocation,code,hasLocation,_ref12,preferredLocationDefault,locationToPreselect;return _regeneratorRuntime.wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:dispatch=_ref7.dispatch,getState=_ref7.getState;if(hasNewServices()){_context3.next=3;break;}return _context3.abrupt("return");case 3:// Fetch merchants locations.
|
|
10
10
|
userSearch=getUserSearch(getState());_context3.prev=4;_context3.next=7;return dispatch(fetchLocations(userSearch));case 7:_ref10=_context3.sent;locations=_ref10.locations;preferredLocation=getPreferredLocation(getState());if(!preferredLocation){_context3.next=16;break;}code=preferredLocation.code;// Check if the preferred location is included within the fetched locations
|
|
11
11
|
hasLocation=!!locations.find(function(location){return location.code===code;});if(hasLocation){_context3.next=16;break;}_context3.next=16;return dispatch(fetchLocations({codes:[code]}));case 16:// Preset preferredLocation if configured
|
|
12
12
|
_ref12=getThemeSettings('@shopgate/engage/locations')||{},preferredLocationDefault=_ref12.preferredLocationDefault;if(preferredLocationDefault){// check if there is already a preferredLocation for the user, if not set one
|
|
@@ -24,4 +24,4 @@ userSearch=getUserSearch(state);storeFinderSearch=getStoreFinderSearch(state);_c
|
|
|
24
24
|
* Provide alternative location on PDP when preferred location is out of stock
|
|
25
25
|
*/subscribe(alternative$,/*#__PURE__*/function(){var _ref23=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref22){var action,dispatch,getState,state,alternativeLocations,productId,params,alternativeParams,fetchParams;return _regeneratorRuntime.wrap(function _callee7$(_context7){while(1)switch(_context7.prev=_context7.next){case 0:action=_ref22.action,dispatch=_ref22.dispatch,getState=_ref22.getState;_context7.next=3;return dispatch(setUserGeolocation({silent:true}));case 3:// Get new state with geolocation
|
|
26
26
|
state=getState();alternativeLocations=getProductAlternativeLocations(state,action);if(!alternativeLocations){_context7.next=7;break;}return _context7.abrupt("return");case 7:productId=action.productId,params=action.params;alternativeParams=getProductAlternativeLocationParams(state);fetchParams=_extends({},alternativeParams,{},params);if(fetchParams.geolocation||fetchParams.postalCode){dispatch(fetchProductLocations(productId,fetchParams));}case 11:case"end":return _context7.stop();}},_callee7);}));return function(_x8){return _ref23.apply(this,arguments);};}());subscribe(categoryDidBackEnter$.merge(searchDidBackEntered$),function(_ref24){var _getProductsResult;var action=_ref24.action,dispatch=_ref24.dispatch,getState=_ref24.getState;var state=getState();if(!showInventoryInLists(state)){return;}var categoryId=action.route.params.categoryId;var query=getCurrentSearchQuery(state);var products=(_getProductsResult=getProductsResult(state,{categoryId:hex2bin(categoryId),searchPhrase:query}))===null||_getProductsResult===void 0?void 0:_getProductsResult.products;if(!products||!products.length){return;}var productCodes=products.map(function(_ref25){var id=_ref25.id;return id;});dispatch(fetchInventories(productCodes));});subscribe(productsReceived$.merge(productsReceivedCached$),function(_ref26){var action=_ref26.action,dispatch=_ref26.dispatch,getState=_ref26.getState;if(!showInventoryInLists(getState())){return;}if(!action.products||!action.products.length||(action===null||action===void 0?void 0:action.fetchInventory)===false){return;}var productCodes=action.type!==RECEIVE_PRODUCTS_CACHED?action.products.map(function(_ref27){var id=_ref27.id;return id;}):action.products;dispatch(fetchInventories(productCodes));});subscribe(receiveFavoritesWhileVisible$.merge(preferredLocationDidUpdateGlobalOnWishlist$),function(_ref28){var dispatch=_ref28.dispatch,getState=_ref28.getState;var state=getState();if(!showInventoryInLists(state)||isFetching(getState())){return;}var productIds=getFavoritesProductsIds(state);if(!productIds||!productIds.length){return;}dispatch(fetchInventories(productIds));});subscribe(appDidStart$,function(_ref29){var getState=_ref29.getState;// enable inventory in product lists for some users
|
|
27
|
-
setShowInventoryInLists(getState());});}export default locationsSubscriber;
|
|
27
|
+
setShowInventoryInLists(getState());});subscribe(storeDetailPageWillEnter$,/*#__PURE__*/function(){var _ref31=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref30){var dispatch,getState,route,getLocation,location;return _regeneratorRuntime.wrap(function _callee8$(_context8){while(1)switch(_context8.prev=_context8.next){case 0:dispatch=_ref30.dispatch,getState=_ref30.getState;route=getCurrentRoute(getState());getLocation=makeGetLocation(function(){return route.params.code;});location=getLocation(getState());_context8.next=6;return dispatch(fetchLocations({geolocation:{longitude:location.longitude,latitude:location.latitude},limit:NEARBY_LOCATIONS_LIMIT,radius:NEARBY_LOCATIONS_RADIUS}));case 6:case"end":return _context8.stop();}},_callee8);}));return function(_x9){return _ref31.apply(this,arguments);};}());}export default locationsSubscriber;
|
|
@@ -1 +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);}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{themeConfig}from'@shopgate/pwa-common/helpers/config';import{StylePresets}from'@shopgate/engage/components/Form';var variables=themeConfig.variables,colors=themeConfig.colors;export var container=css(_defineProperty({flexGrow:1,padding:"".concat(variables.gap.small*3,"px ").concat(variables.gap.big,"px")},responsiveMediaQuery('>sm',{webOnly:true}),{width:'50%'}));export var headline=css(_defineProperty({fontSize:'2.1875rem',lineHeight:1,fontWeight:500,paddingBottom:variables.gap.big},responsiveMediaQuery('>sm',{webOnly:true}),{fontSize:'2rem',fontWeight:'normal'}));export var subline=css({fontSize:'1.125rem',color:colors.
|
|
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);}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{themeConfig}from'@shopgate/pwa-common/helpers/config';import{StylePresets}from'@shopgate/engage/components/Form';var variables=themeConfig.variables,colors=themeConfig.colors;export var container=css(_defineProperty({flexGrow:1,padding:"".concat(variables.gap.small*3,"px ").concat(variables.gap.big,"px")},responsiveMediaQuery('>sm',{webOnly:true}),{width:'50%'}));export var headline=css(_defineProperty({fontSize:'2.1875rem',lineHeight:1,fontWeight:500,paddingBottom:variables.gap.big},responsiveMediaQuery('>sm',{webOnly:true}),{fontSize:'2rem',fontWeight:'normal'}));export var subline=css({fontSize:'1.125rem',color:"var(--color-text-medium-emphasis, ".concat(colors.shade6,")"),marginBottom:variables.gap.big,marginTop:4});export var form=css(_extends({paddingTop:24},StylePresets.OUTLINED_FORM_FIELDS,{' .simpleInput':{paddingLeft:variables.gap.big}})).toString();export var buttonContainer=css({paddingTop:variables.gap.big*2,paddingBottom:variables.gap.big*1.5}).toString();export var button=css({width:'100%'}).toString();export var input=css({' .label':{color:"var(--color-text-medium-emphasis, ".concat(colors.shade6,")")},' .placeholder':{color:"var(--color-text-medium-emphasis, ".concat(colors.shade6,")")},' .simpleInput':{color:'var(--color-text-heigh-emphasis)'}}).toString();export var resetInstructions=css({paddingTop:variables.gap.big,display:'flex',alignItems:'center'});export var resetInstructionsEmail=css({fontWeight:'bold',color:'var(--color-secondary)'});export var goBackButtonContainer=css({padding:"".concat(variables.gap.big,"px 0")}).toString();export var goBackButton=css({fontSize:'0.875rem !important',padding:'0 !important',' > div ':{padding:0,display:'flex'}}).toString();export var goBackButtonIcon=css({display:'inline-block',fontSize:'1.375rem !important',alignSelf:'center',marginRight:variables.gap.xsmall,marginLeft:-3,marginTop:-2}).toString();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/engage",
|
|
3
|
-
"version": "7.26.0-beta.
|
|
3
|
+
"version": "7.26.0-beta.3",
|
|
4
4
|
"description": "Shopgate's ENGAGE library.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Shopgate <support@shopgate.com>",
|
|
@@ -15,27 +15,28 @@
|
|
|
15
15
|
"connect"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@shopgate/native-modules": "1.0.0-beta.
|
|
19
|
-
"@shopgate/pwa-common": "7.26.0-beta.
|
|
20
|
-
"@shopgate/pwa-common-commerce": "7.26.0-beta.
|
|
21
|
-
"@shopgate/pwa-core": "7.26.0-beta.
|
|
22
|
-
"@shopgate/pwa-ui-ios": "7.26.0-beta.
|
|
23
|
-
"@shopgate/pwa-ui-material": "7.26.0-beta.
|
|
24
|
-
"@shopgate/pwa-ui-shared": "7.26.0-beta.
|
|
18
|
+
"@shopgate/native-modules": "^1.0.0-beta.22",
|
|
19
|
+
"@shopgate/pwa-common": "7.26.0-beta.3",
|
|
20
|
+
"@shopgate/pwa-common-commerce": "7.26.0-beta.3",
|
|
21
|
+
"@shopgate/pwa-core": "7.26.0-beta.3",
|
|
22
|
+
"@shopgate/pwa-ui-ios": "7.26.0-beta.3",
|
|
23
|
+
"@shopgate/pwa-ui-material": "7.26.0-beta.3",
|
|
24
|
+
"@shopgate/pwa-ui-shared": "7.26.0-beta.3",
|
|
25
25
|
"@stripe/react-stripe-js": "^1.16.5",
|
|
26
26
|
"@stripe/stripe-js": "^1.3.1",
|
|
27
27
|
"@virtuous/conductor": "~2.5.0",
|
|
28
28
|
"babel-plugin-transform-es3-member-expression-literals": "^6.8.0",
|
|
29
29
|
"babel-plugin-transform-es3-property-literals": "^6.8.0",
|
|
30
30
|
"color": "^3.1.2",
|
|
31
|
+
"focus-trap-react": "^11.0.3",
|
|
31
32
|
"immer": "^8.0.1",
|
|
32
33
|
"intersection-observer": "^0.6.0",
|
|
33
|
-
"leaflet": "^1.
|
|
34
|
-
"leaflet-gesture-handling": "^1.
|
|
34
|
+
"leaflet": "^1.8.0",
|
|
35
|
+
"leaflet-gesture-handling": "^1.2.2",
|
|
35
36
|
"lodash": "^4.17.11",
|
|
36
37
|
"moment": "^2.27.0",
|
|
37
38
|
"react-helmet": "^5.1.3",
|
|
38
|
-
"react-leaflet": "^2.
|
|
39
|
+
"react-leaflet": "^3.2.5",
|
|
39
40
|
"react-phone-number-input": "^3.2.16",
|
|
40
41
|
"react-player": "1.11.0",
|
|
41
42
|
"react-portal": "^3.1.0",
|