@shopgate/engage 7.25.0-beta.2 → 7.26.0-beta.1
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/styles.js +2 -0
- package/cart/components/CartItem/CartItemProductLayout.js +3 -3
- package/cart/components/CartItem/CartItemProductLayout.style.js +1 -1
- package/cart/components/CartItem/CartItemProductTitle.js +5 -4
- package/cart/components/CartItems/CartItemCard.style.js +1 -1
- package/cart/components/PaymentBar/PaymentBarCheckoutButton.js +3 -3
- package/cart/components/Substitution/index.js +1 -1
- package/components/Menu/components/Item/index.js +2 -2
- package/components/TextLink/TextLink.js +3 -3
- package/components/Toggle/index.js +2 -2
- package/core/helpers/index.js +1 -1
- package/favorites/components/ItemFulfillmentMethod/ItemFulfillmentMethod.js +1 -1
- package/favorites/components/List/List.js +3 -3
- package/favorites/components/List/ListAccordionHeader.js +8 -0
- package/favorites/components/List/ListAccordionLabel.js +5 -4
- package/favorites/components/ListChooser/ListChooser.js +1 -1
- package/filter/components/PriceSlider/components/Label/index.js +1 -1
- package/locations/action-creators/selectLocation.js +1 -2
- package/locations/actions/fetchLocations.js +1 -1
- package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherBar.js +3 -3
- package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcherBar.style.js +1 -1
- package/locations/components/StockInfo/StockInfo.js +2 -2
- package/locations/components/StockInfo/StockInfoInventory.js +2 -2
- package/locations/components/StoreFinder/StoreFinder.js +3 -3
- package/locations/components/StoreFinder/StoreFinder.style.js +2 -1
- package/locations/components/StoreFinder/StoreFinderLocation.js +2 -2
- package/locations/components/StoreFinder/StoreFinderLocation.style.js +1 -1
- package/locations/components/StoreFinder/StoreFinderLocationDetailsWide.js +3 -0
- package/locations/components/StoreFinder/StoreFinderLocationDetailsWide.style.js +1 -0
- package/locations/components/StoreFinder/StoreFinderLocationHeader.js +2 -2
- package/locations/components/StoreFinder/StoreFinderLocationHeader.style.js +1 -1
- package/locations/components/StoreFinder/StoreFinderLocations.style.js +2 -1
- package/locations/components/StoreFinder/StoreFinderMap.js +4 -0
- package/locations/components/StoreFinder/StoreFinderMap.style.js +2 -0
- package/locations/components/StoreFinder/StoreFinderSearch.style.js +1 -1
- package/locations/components/StoreFinder/StoreFinderSelectLocationButton.js +2 -2
- package/locations/components/StoreFinder/StoreFinderStoresNear.js +3 -0
- package/locations/components/StoreFinder/StoreFinderStoresNear.style.js +1 -0
- package/locations/components/StoreList/Store.style.js +1 -1
- package/locations/components/StoreList/StoreAddress.js +2 -2
- package/locations/components/StoreList/StoreAddressShort.js +2 -2
- package/locations/components/StoreList/StoreCard.js +2 -2
- package/locations/components/StoreList/StoreDetailsLine.js +1 -1
- package/locations/components/StoreList/StoreDistance.js +1 -1
- package/locations/components/StoreList/StoreHeader.js +2 -2
- package/locations/components/StoreList/StoreListProduct.style.js +1 -1
- package/locations/components/StoreList/StoreListSearch.js +1 -1
- package/locations/components/StoreList/StoreListSearch.style.js +1 -1
- package/locations/components/StoreList/StoreOpeningHours.js +1 -1
- package/locations/components/StoreList/StoreOpeningHoursLine.js +1 -1
- package/locations/components/StoreList/StorePhoneNumber.js +2 -2
- package/locations/components/StoreList/StoreSelectLocationButton.js +1 -1
- package/locations/components/index.js +1 -1
- package/locations/constants/index.js +1 -3
- package/locations/constants/routes.js +1 -1
- package/locations/locations.streams.js +1 -1
- package/locations/providers/StoreFinderProvider.js +4 -4
- package/locations/providers/index.js +1 -1
- package/locations/selectors/index.js +2 -7
- package/locations/subscriptions.js +3 -3
- package/login/components/ForgotPassword/ForgotPassword.style.js +1 -1
- package/package.json +11 -11
- package/product/components/Header/PriceStriked/style.js +1 -1
- package/product/components/OrderQuantityHint/style.js +1 -1
- package/product/components/ProductImage/index.js +4 -4
- package/product/components/ProductName/ProductName.js +1 -1
- package/product/components/ProductName/ProductNameContent.js +1 -1
- package/product/components/ProductProperties/Row.js +1 -1
- package/styles/reset/root.js +1 -2
- package/locations/components/StoreDetails/components/FindMoreStores.js +0 -4
- package/locations/components/StoreDetails/components/GetDirectionsButton.js +0 -7
- package/locations/components/StoreDetails/components/StoreDetails.js +0 -5
- package/locations/components/StoreDetails/components/StoreFinderMap.js +0 -20
- package/locations/components/StoreDetails/components/StoreFinderMap.style.js +0 -1
- package/locations/components/StoreDetails/components/StoreLocationMap.js +0 -4
- package/locations/components/StoreDetails/components/StoresNearby.js +0 -4
- package/locations/components/StoreDetails/components/StoresNearbyListItem.js +0 -9
- package/locations/components/StoreDetails/index.js +0 -4
- package/locations/components/StoreFinder/StoreFinderStoreInfoButton.js +0 -8
- package/locations/providers/StoreDetailsContext.js +0 -1
- package/locations/providers/StoreDetailsProvider.js +0 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React,{useContext,Fragment}from'react';import{StoreContext}from"./Store.context";import{StoreHeader}from"./StoreHeader";import{StoreDetails}from"./StoreDetails";import{StoreSelectLocationButton}from"./StoreSelectLocationButton";/**
|
|
1
|
+
import React,{useContext,Fragment}from'react';import{ResponsiveContainer}from'@shopgate/engage/components';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(StoreSelectLocationButton,null));}
|
|
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(ResponsiveContainer,{breakpoint:"<sm",appAlways:true},React.createElement(StoreSelectLocationButton,null)));}
|
|
@@ -1,4 +1,4 @@
|
|
|
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*as React from'react';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
|
* @returns {JSX}
|
|
4
|
-
*/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,
|
|
4
|
+
*/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,4 +1,4 @@
|
|
|
1
|
-
import React from'react';import
|
|
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';/**
|
|
2
2
|
* Renders a single store distance.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @returns {JSX}
|
|
@@ -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,{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";/**
|
|
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,{useCallback,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),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}));}
|
|
4
|
+
*/export function StoreHeader(){var store=useContext(StoreContext);var _useContext=useContext(FulfillmentContext),selectLocation=_useContext.selectLocation,product=_useContext.product;var isAvailable=isProductAvailable(store,store===null||store===void 0?void 0:store.inventory);var handleClick=useCallback(function(){if(isAvailable){selectLocation(store);}},[isAvailable,selectLocation,store]);var name=store.name,distance=store.distance,unitSystem=store.unitSystem;return React.createElement("div",{className:classNames(storeHeader,_defineProperty({},disabled,!isAvailable)),onClick:handleClick,onKeyDown:handleClick,role:"button",tabIndex:0},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 +1 @@
|
|
|
1
|
-
import{css}from'glamor';import{themeVariables,themeColors}from'@shopgate/pwa-common/helpers/config';export var productContainer=css({padding:"".concat(themeVariables.gap.bigger,"px ").concat(themeVariables.gap.bigger,"px ").concat(themeVariables.gap.small,"px"),boxShadow:"inset 0 1px 0 ".concat(themeColors.shade7)}).toString();export var productContainerInner=css({display:'flex',flexFlow:'row nowrap'}).toString();export var productImage=css({flex:'0 0 auto',width:'2.5rem',height:'2.5rem',background:themeColors.placeholder,marginRight:themeVariables.gap.bigger}).toString();export var productContent=css({flexGrow:1,display:'block'}).toString();export var productName=css({fontSize:'1.25rem',fontWeight:600,marginBottom:themeVariables.gap.small}).toString();export var productInfo=css({alignItems:'flex-end',color:'var(--color-text-high-emphasis)'}).toString();export var productInfoLeft=css({fontSize:'0.875rem',color:themeColors.
|
|
1
|
+
import{css}from'glamor';import{themeVariables,themeColors}from'@shopgate/pwa-common/helpers/config';export var productContainer=css({padding:"".concat(themeVariables.gap.bigger,"px ").concat(themeVariables.gap.bigger,"px ").concat(themeVariables.gap.small,"px"),boxShadow:"inset 0 1px 0 ".concat(themeColors.shade7)}).toString();export var productContainerInner=css({display:'flex',flexFlow:'row nowrap'}).toString();export var productImage=css({flex:'0 0 auto',width:'2.5rem',height:'2.5rem',background:themeColors.placeholder,marginRight:themeVariables.gap.bigger}).toString();export var productContent=css({flexGrow:1,display:'block'}).toString();export var productName=css({fontSize:'1.25rem',fontWeight:600,marginBottom:themeVariables.gap.small}).toString();export var productInfo=css({alignItems:'flex-end',color:'var(--color-text-high-emphasis)'}).toString();export var productInfoLeft=css({fontSize:'0.875rem',color:themeColors.shade11}).toString();export var priceInfo=css({color:"var(--color-primary, ".concat(themeColors.primary,")"),flexGrow:0,textAlign:'right',wordBreak:'break-word',' > ul ':{flexDirection:'column-reverse'}}).toString();
|
|
@@ -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",autoComplete:"off",autoCorrect:"off",placeholder: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));
|
|
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",inputMode:"numeric",pattern:"[0-9]*",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 +1 @@
|
|
|
1
|
-
import{css}from'glamor';import{themeColors,themeVariables}from'@shopgate/pwa-common/helpers/config';export var container=css({padding:'0 12px 8px 12px',background:themeColors.light,display:'grid',gridTemplateColumns:'auto 1fr',gridTemplateRows:'auto',gridTemplateAreas:"\n \"countries input\"\n \"radius radius\"\n "});export var countriesCell=css({gridArea:'countries',maxWidth:160,paddingRight:themeVariables.gap.small});export var inputCell=css({gridArea:'input'});export var radiusCell=css({gridArea:'radius',':not(:empty)':{height:38,marginTop:themeVariables.gap.small}});export var selectContainer=css({position:'relative',display:'flex',alignItems:'stretch',height:'100%','&:after':{zIndex:2,content:'""',position:'absolute',display:'block',top:'50%',right:themeVariables.gap.small*1.5,transform:'translate3d(0, -25%, 0)',width:5,height:5,border:'5px solid transparent',borderTopColor:themeColors.shade6}});export var select=css({appearance:'none',border:"1px solid ".concat(themeColors.shade7),padding:"0 ".concat(themeVariables.gap.bigger+themeVariables.gap.small*1.5,"px 0 ").concat(themeVariables.gap.big*0.75,"px"),color:themeColors.
|
|
1
|
+
import{css}from'glamor';import{themeColors,themeVariables}from'@shopgate/pwa-common/helpers/config';export var container=css({padding:'0 12px 8px 12px',background:themeColors.light,display:'grid',gridTemplateColumns:'auto 1fr',gridTemplateRows:'auto',gridTemplateAreas:"\n \"countries input\"\n \"radius radius\"\n "});export var countriesCell=css({gridArea:'countries',maxWidth:160,paddingRight:themeVariables.gap.small});export var inputCell=css({gridArea:'input'});export var radiusCell=css({gridArea:'radius',':not(:empty)':{height:38,marginTop:themeVariables.gap.small}});export var selectContainer=css({position:'relative',display:'flex',alignItems:'stretch',height:'100%','&:after':{zIndex:2,content:'""',position:'absolute',display:'block',top:'50%',right:themeVariables.gap.small*1.5,transform:'translate3d(0, -25%, 0)',width:5,height:5,border:'5px solid transparent',borderTopColor:themeColors.shade6}});export var select=css({appearance:'none',border:"1px solid ".concat(themeColors.shade7),padding:"0 ".concat(themeVariables.gap.bigger+themeVariables.gap.small*1.5,"px 0 ").concat(themeVariables.gap.big*0.75,"px"),color:themeColors.shade11,fontSize:'1rem',borderRadius:4,width:'100%',outline:0});export var inputContainer=css({background:themeColors.light,border:"1px solid ".concat(themeColors.shade7),borderRadius:4,display:'flex',alignItems:'center',width:'100%'});export var input=css({margin:'3px 0',width:'100%',lineHeight:'28px',outline:'none',verticalAlign:'middle',WebkitAppearance:'none'});export var inputIcon=css({padding:0,margin:'0 8px',color:themeColors.shade9,fontSize:'1.23rem',flexShrink:0,outline:0});export var iconClass=css({fontSize:'1.25rem !important'}).toString();
|
|
@@ -2,4 +2,4 @@ import _isEmpty from"lodash/isEmpty";import _every from"lodash/every";import Rea
|
|
|
2
2
|
* Renders the store's opening hours.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @returns {JSX}
|
|
5
|
-
*/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},
|
|
5
|
+
*/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},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};
|
|
@@ -2,4 +2,4 @@ import React from'react';import{i18n}from"../../../core";import{openingHoursRow,
|
|
|
2
2
|
* Renders a single opening hours line.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @returns {JSX}
|
|
5
|
-
*/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},React.createElement("td",{className:openingHoursDay,"aria-hidden":true},
|
|
5
|
+
*/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,5 @@
|
|
|
1
|
-
import React from'react';import{I18n,PhoneIcon}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core';import{StoreDetailsLine}from"./StoreDetailsLine";import{detailsPrimary,detailsSecondary}from"./Store.style";/**
|
|
1
|
+
import React from'react';import{I18n,PhoneIcon,Link}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
4
|
* @returns {JSX}
|
|
5
|
-
*/export function StorePhoneNumber(_ref){var phone=_ref.phone;if(!phone){return null;}return React.createElement(
|
|
5
|
+
*/export function StorePhoneNumber(_ref){var phone=_ref.phone;if(!phone){return null;}return React.createElement(Link,{href:"tel:".concat(phone),role:"button","aria-label":"".concat(i18n.text('locations.phone'),": ").concat(phone)},React.createElement(StoreDetailsLine,{icon:PhoneIcon,linked:true},React.createElement("div",{className:detailsPrimary},phone),React.createElement(I18n.Text,{string:"locations.phone",className:detailsSecondary})));}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(
|
|
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};
|
|
@@ -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";
|
|
@@ -2,6 +2,4 @@
|
|
|
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
|
|
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";
|
|
5
|
+
export{STAGE_SELECT_STORE,STAGE_RESERVE_FORM,STAGE_RESPONSE_SUCCESS,STAGE_RESPONSE_ERROR,STAGE_FULFILLMENT_METHOD}from"./Stages";export{STORE_FINDER_PATTERN}from"./routes";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export var STORE_FINDER_PATTERN='/storefinder';
|
|
1
|
+
export var STORE_FINDER_PATTERN='/storefinder';
|
|
@@ -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
|
|
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,7 +1,7 @@
|
|
|
1
|
-
import React,{useMemo,useCallback}from'react';import PropTypes from'prop-types';import{
|
|
1
|
+
function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React,{useMemo,useState,useCallback,useEffect}from'react';import PropTypes from'prop-types';import{LoadingProvider}from'@shopgate/pwa-common/providers';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,selectGlobalLocation=_ref.selectGlobalLocation,selectLocation=_ref.selectLocation;var _useNavigation=useNavigation(),pop=_useNavigation.pop;var selectedLocation=
|
|
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,storeListRef=_ref.storeListRef,selectGlobalLocation=_ref.selectGlobalLocation,selectLocation=_ref.selectLocation;var _useNavigation=useNavigation(),pop=_useNavigation.pop;var _useState=useState(null),_useState2=_slicedToArray(_useState,2),selectedLocation=_useState2[0],setSelectedLocation=_useState2[1];var _useState3=useState(null),_useState4=_slicedToArray(_useState3,2),locationsHash=_useState4[0],setLocationsHash=_useState4[1];var changeLocation=useCallback(function(location){var scrollIntoView=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;setSelectedLocation(location);if(scrollIntoView&&storeListRef.current){var container=storeListRef.current;var element=container.querySelector("[data-location-code=\"".concat(location.code,"\"]"));var scrollParams={top:element.parentNode.offsetTop-container.offsetTop-10,behavior:'smooth'};var _getComputedStyle2=getComputedStyle(container),overflowY=_getComputedStyle2.overflowY;if(overflowY==='scroll'){container.scroll(scrollParams);}else{window.scroll(scrollParams);}}},[storeListRef]);var selectLocationCb=useCallback(function(location){setSelectedLocation(location);selectLocation(location);selectGlobalLocation(location);// Back navigation
|
|
5
|
+
pop();},[selectLocation,selectGlobalLocation,pop]);useEffect(function(){var hash=JSON.stringify(locations.map(function(_ref2){var code=_ref2.code;return code;}));if(hash!==locationsHash){setLocationsHash(hash);changeLocation(locations[0]);}});/**
|
|
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,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);
|
|
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,changeLocation:changeLocation,selectLocation:selectLocationCb,isFetching:isFetching,shopSettings:shopSettings,userSearch:userSearch,storeFinderSearch:storeFinderSearch,setIsLoading:setIsLoading};},[isFetching,locations,changeLocation,selectLocationCb,selectedLocation,shopSettings,storeFinderSearch,userSearch,setIsLoading]);return React.createElement(StoreFinderContext.Provider,{value:value},children);};StoreFinderProvider.defaultProps={children:null,locations:[],storeListRef:null,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";
|
|
@@ -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{getExternalCustomerNumber,
|
|
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,getExternalCustomerNumber,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}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,9 +137,4 @@ 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);})
|
|
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;});};
|
|
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);});
|
|
@@ -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{cartReceived$,fetchCart,cartDidEnter$,getCartItems}from'@shopgate/engage/cart';import{userDidLogin$}from'@shopgate/engage/user';import{appDidStart$,routeWillEnter$,UIEvents,getCurrentRoute,hex2bin,getThemeSettings,getCurrentSearchQuery,appWillInit$,appInitialization}from'@shopgate/engage/core';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}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$,preferredLocationDidUpdateOnPDP$,provideAlternativeLocation$,preferredLocationDidUpdateGlobalOnWishlist$,preferredLocationDidUpdate$}from"./locations.streams";import selectLocation from"./action-creators/selectLocation";import{SET_STORE_FINDER_SEARCH_RADIUS}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
|
|
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.
|
|
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());});
|
|
27
|
+
setShowInventoryInLists(getState());});}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:
|
|
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.shade11,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:colors.shade11},' .placeholder':{color:colors.shade11},' .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.
|
|
3
|
+
"version": "7.26.0-beta.1",
|
|
4
4
|
"description": "Shopgate's ENGAGE library.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Shopgate <support@shopgate.com>",
|
|
@@ -15,13 +15,13 @@
|
|
|
15
15
|
"connect"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@shopgate/native-modules": "
|
|
19
|
-
"@shopgate/pwa-common": "7.
|
|
20
|
-
"@shopgate/pwa-common-commerce": "7.
|
|
21
|
-
"@shopgate/pwa-core": "7.
|
|
22
|
-
"@shopgate/pwa-ui-ios": "7.
|
|
23
|
-
"@shopgate/pwa-ui-material": "7.
|
|
24
|
-
"@shopgate/pwa-ui-shared": "7.
|
|
18
|
+
"@shopgate/native-modules": "1.0.0-beta.18",
|
|
19
|
+
"@shopgate/pwa-common": "7.26.0-beta.1",
|
|
20
|
+
"@shopgate/pwa-common-commerce": "7.26.0-beta.1",
|
|
21
|
+
"@shopgate/pwa-core": "7.26.0-beta.1",
|
|
22
|
+
"@shopgate/pwa-ui-ios": "7.26.0-beta.1",
|
|
23
|
+
"@shopgate/pwa-ui-material": "7.26.0-beta.1",
|
|
24
|
+
"@shopgate/pwa-ui-shared": "7.26.0-beta.1",
|
|
25
25
|
"@stripe/react-stripe-js": "^1.16.5",
|
|
26
26
|
"@stripe/stripe-js": "^1.3.1",
|
|
27
27
|
"@virtuous/conductor": "~2.5.0",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"color": "^3.1.2",
|
|
31
31
|
"immer": "^8.0.1",
|
|
32
32
|
"intersection-observer": "^0.6.0",
|
|
33
|
-
"leaflet": "^1.
|
|
34
|
-
"leaflet-gesture-handling": "^1.
|
|
33
|
+
"leaflet": "^1.6.0",
|
|
34
|
+
"leaflet-gesture-handling": "^1.1.8",
|
|
35
35
|
"lodash": "^4.17.11",
|
|
36
36
|
"moment": "^2.27.0",
|
|
37
37
|
"react-helmet": "^5.1.3",
|
|
38
|
-
"react-leaflet": "^
|
|
38
|
+
"react-leaflet": "^2.7.0",
|
|
39
39
|
"react-phone-number-input": "^3.2.16",
|
|
40
40
|
"react-player": "1.11.0",
|
|
41
41
|
"react-portal": "^3.1.0",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors,variables=themeConfig.variables;var placeholder=css({height:16,width:'70%',marginTop:5,marginBottom:2}).toString();var msrp=css({color:colors.
|
|
1
|
+
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var colors=themeConfig.colors,variables=themeConfig.variables;var placeholder=css({height:16,width:'70%',marginTop:5,marginBottom:2}).toString();var msrp=css({color:colors.shade11,fontSize:'0.875rem',marginRight:variables.gap.small/2}).toString();var msrpStriked=css({display:'inline',fontSize:'0.875rem'}).toString();export default{placeholder:placeholder,msrp:msrp,msrpStriked:msrpStriked};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';export var hint=css({fontSize:'0.75rem',color:"var(--color-text-medium-emphasis, ".concat(themeConfig.colors.
|
|
1
|
+
import{css}from'glamor';import{themeConfig}from'@shopgate/pwa-common/helpers/config';export var hint=css({fontSize:'0.75rem',color:"var(--color-text-medium-emphasis, ".concat(themeConfig.colors.shade11,")")});
|
|
@@ -23,9 +23,9 @@ var showPlaceholder=!nextProps.src&&(!nextProps.srcmap||nextProps.srcmap.length=
|
|
|
23
23
|
* @return {boolean} Update or not.
|
|
24
24
|
*/},{key:"shouldComponentUpdate",value:function shouldComponentUpdate(nextProps,nextState){return!isEqual(this.props,nextProps)||!isEqual(this.state,nextState);}},{key:"render",value:/**
|
|
25
25
|
* Renders the component.
|
|
26
|
-
* @returns {JSX}
|
|
26
|
+
* @returns {JSX.Element}
|
|
27
27
|
*/function render(){var _this$props=this.props,noBackground=_this$props.noBackground,className=_this$props.className,placeholderSrc=_this$props.placeholderSrc;var showInnerShadow=this.props.widgetSettings.showInnerShadow;if(typeof showInnerShadow==='undefined'){showInnerShadow=!appConfig.hideProductImageShadow;}if(this.state.imageLoadingFailed||this.state.showPlaceholder){// Image is not present or could not be loaded, show a placeholder.
|
|
28
|
-
return React.createElement(SurroundPortals,{portalName:PORTAL_PRODUCT_IMAGE},React.createElement("div",{className:classnames(styles.placeholderContainer(this.getImageRatio()),_defineProperty(_defineProperty({},styles.innerShadow,showInnerShadow),className,!!className)),"aria-hidden":
|
|
29
|
-
return React.createElement(SurroundPortals,{portalName:PORTAL_PRODUCT_IMAGE,portalProps:{src:this.props.src,resolutions:this.props.resolutions}},React.createElement("div",{"aria-hidden":
|
|
28
|
+
return React.createElement(SurroundPortals,{portalName:PORTAL_PRODUCT_IMAGE},React.createElement("div",{className:classnames(styles.placeholderContainer(this.getImageRatio()),_defineProperty(_defineProperty({},styles.innerShadow,showInnerShadow),className,!!className)),"aria-hidden":true},placeholderSrc?React.createElement(ProductImagePlaceholder,{src:placeholderSrc,showInnerShadow:showInnerShadow,noBackground:noBackground}):React.createElement("div",{className:styles.placeholderContent,"data-test-id":"placeHolder"},React.createElement(PlaceholderIcon,{className:styles.placeholder}))));}// Return the actual image.
|
|
29
|
+
return React.createElement(SurroundPortals,{portalName:PORTAL_PRODUCT_IMAGE,portalProps:{src:this.props.src,resolutions:this.props.resolutions}},React.createElement("div",{"aria-hidden":true,className:"".concat(className," engage__product__product-image")},React.createElement(Image,_extends({},this.props,{className:showInnerShadow?styles.innerShadow:'',backgroundColor:noBackground?'transparent':colors.light,onError:this.imageLoadingFailed}))));}}]);}(Component);/**
|
|
30
30
|
* See Image component manual for detailed description about the component property types.
|
|
31
|
-
*/_defineProperty(ProductImage,"defaultProps",{alt:null,animating:true,
|
|
31
|
+
*/_defineProperty(ProductImage,"defaultProps",{alt:null,animating:true,className:null,forcePlaceholder:false,highestResolutionLoaded:function highestResolutionLoaded(){},noBackground:false,ratio:null,resolutions:[{width:50,height:50,blur:2},{width:440,height:440}],src:null,srcmap:null,placeholderSrc:null,widgetSettings:{}});export{ProductImage as UnwrappedProductImage};export default connect(withWidgetSettings(ProductImage,'@shopgate/engage/product/ProductImage'));
|
|
@@ -1,4 +1,4 @@
|
|
|
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 React from'react';import PropTypes from'prop-types';import{css}from'glamor';import classNames from'classnames';import{responsiveMediaQuery}from'@shopgate/engage/styles';import{ConditionalWrapper,SurroundPortals}from'@shopgate/engage/components';import ProductNameContent from"./ProductNameContent";var styles={wrapper:css(_defineProperty({},responsiveMediaQuery('>xs',{webOnly:true}),{wordBreak:'keep-all !important',hyphens:'none !important'})).toString()};/**
|
|
2
2
|
* @param {Object} props The component props
|
|
3
|
-
* @returns {JSX}
|
|
3
|
+
* @returns {JSX.Element}
|
|
4
4
|
*/var ProductName=function ProductName(_ref){var name=_ref.name,className=_ref.className,testId=_ref.testId,ellipsis=_ref.ellipsis,portalName=_ref.portalName,portalProps=_ref.portalProps,itemProp=_ref.itemProp,rows=_ref.rows,style=_ref.style;return React.createElement(ConditionalWrapper,{condition:!!portalName,wrapper:function wrapper(children){return React.createElement(SurroundPortals,{portalName:portalName,portalProps:portalProps},children);}},React.createElement("div",{className:classNames(styles.wrapper,className),style:style,itemProp:itemProp,"data-test-id":testId,"aria-label":"".concat(name,".")},React.createElement(ProductNameContent,{name:name,ellipsis:ellipsis,rows:rows})));};ProductName.defaultProps={name:null,className:null,ellipsis:true,itemProp:null,portalName:null,portalProps:null,style:null,rows:null,testId:null};export default ProductName;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from'react';import PropTypes from'prop-types';import{Ellipsis,ConditionalWrapper}from'@shopgate/engage/components';/**
|
|
2
2
|
* @param {Object} props The component props
|
|
3
3
|
* @returns {JSX}
|
|
4
|
-
*/var ProductNameContent=function ProductNameContent(_ref){var name=_ref.name,ellipsis=_ref.ellipsis,rows=_ref.rows;return React.createElement(ConditionalWrapper,{condition:ellipsis,wrapper:function wrapper(children){return React.createElement(Ellipsis,{rows:rows!==null?rows:undefined},React.createElement("span",
|
|
4
|
+
*/var ProductNameContent=function ProductNameContent(_ref){var name=_ref.name,ellipsis=_ref.ellipsis,rows=_ref.rows;return React.createElement(ConditionalWrapper,{condition:ellipsis,wrapper:function wrapper(children){return React.createElement(Ellipsis,{rows:rows!==null?rows:undefined},React.createElement("span",null,children));}},React.createElement("span",{dangerouslySetInnerHTML:{__html:name}}));};ProductNameContent.defaultProps={name:null,ellipsis:true,rows:null};export default ProductNameContent;
|
|
@@ -2,4 +2,4 @@ import React from'react';import PropTypes from'prop-types';import{tableCell}from
|
|
|
2
2
|
* Renders a single properties row.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @return {JSX.Element}
|
|
5
|
-
*/var Row=function Row(_ref){var label=_ref.label,value=_ref.value,type=_ref.type;return React.createElement("tr",{className:"engage__product__product-property","data-type":type,"data-label":label},React.createElement("td",{className:tableCell},React.createElement("span",{dangerouslySetInnerHTML:{__html:label}})),React.createElement("td",{className:tableCell,"data-test-id":"property: ".concat(value)},React.createElement("span",{dangerouslySetInnerHTML:{__html:value}})));};Row.defaultProps={type:null};export default React.memo(Row);
|
|
5
|
+
*/var Row=function Row(_ref){var label=_ref.label,value=_ref.value,type=_ref.type;return React.createElement("tr",{className:"engage__product__product-property","data-type":type,"data-label":label,"aria-label":"".concat(label,": ").concat(value),tabIndex:0},React.createElement("td",{className:tableCell,"aria-hidden":true},React.createElement("span",{dangerouslySetInnerHTML:{__html:label}})),React.createElement("td",{className:tableCell,"data-test-id":"property: ".concat(value),"aria-hidden":true},React.createElement("span",{dangerouslySetInnerHTML:{__html:value}})));};Row.defaultProps={type:null};export default React.memo(Row);
|
package/styles/reset/root.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var fontSuffix=isDev&&iosThemeActive&&isWindows&&!((_typography$family=typography.family)!==null&&_typography$family!==void 0?_typography$family:'').includes('Roboto')?', Roboto':'';css.global('body',{font:"".concat(typography.rootSize,"px/").concat(typography.lineHeight," ").concat(typography.family).concat(fontSuffix),overflow:'auto',margin:0,WebkitOverflowScrolling:'touch',WebkitUserSelect:hasWebBridge()?'inherit':'none',userSelect:hasWebBridge()?'inherit':'none',color:'var(--color-text-high-emphasis)'});css.global('[data-pattern]',{height:'100% !important'});css.global('html, body',{backgroundColor:'var(--page-background-color)'});if(hasWebBridge()&&!iosThemeActive){css.insert("@media(min-width: 600px) {\n html, body {\n background-color: var(--color-background-gutter-body, var(--page-background-color))\n }\n }");}// since iOS 15 button has a default color of blue rgb(0, 122, 255);
|
|
1
|
+
import{css}from'glamor';import{useScrollContainer,hasWebBridge,isIOSTheme}from'@shopgate/engage/core';import{themeConfig}from'@shopgate/pwa-common/helpers/config';var typography=themeConfig.typography;var iosThemeActive=isIOSTheme();css.global('*, *:before, *:after',{boxSizing:'border-box'});css.global('*',{touchAction:'manipulation'});css.global('::-moz-focus-inner',{border:0});css.global('html, body',{WebkitTapHighlightColor:'transparent',width:'100%',height:'100%'});css.global('html',{overflow:useScrollContainer()?'hidden':'inherit',MozOsxFontSmoothing:'grayscale',WebkitFontSmoothing:'antialiased',MsTextSizeAdjust:'100%',WebkitTextSizeAdjust:'100%',minHeight:'100%'});css.global('body',{font:"".concat(typography.rootSize,"px/").concat(typography.lineHeight," ").concat(typography.family),overflow:'auto',margin:0,WebkitOverflowScrolling:'touch',WebkitUserSelect:hasWebBridge()?'inherit':'none',userSelect:hasWebBridge()?'inherit':'none',color:'var(--color-text-high-emphasis)'});css.global('[data-pattern]',{height:'100% !important'});css.global('html, body',{backgroundColor:'var(--page-background-color)'});if(hasWebBridge()&&!iosThemeActive){css.insert("@media(min-width: 600px) {\n html, body {\n background-color: var(--color-background-gutter-body, var(--page-background-color))\n }\n }");}// since iOS 15 button has a default color of blue rgb(0, 122, 255);
|
|
3
2
|
css.global('button',{color:'inherit'});
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React from'react';import{css}from'glamor';import{i18n}from'@shopgate/engage/core/helpers';import{MagnifierIcon,LocatorIcon,Link}from'@shopgate/engage/components';import{themeColors}from'@shopgate/pwa-common/helpers/config';import classNames from'classnames';import{STORE_FINDER_PATTERN}from"../../../constants";var styles={container:css({margin:'16px 0px'}),title:css({fontSize:'20px',fontWeight:'500',color:'var(--color-primary)',marginBottom:'8px'}),inputCell:css({gridArea:'input'}),inputContainer:css({position:'relative',background:themeColors.light,border:"1px solid ".concat(themeColors.shade7),borderRadius:4,display:'flex',alignItems:'center',width:'100%'}),inputIcon:css({padding:0,margin:'0 8px',color:themeColors.shade9,fontSize:'1.23rem',flexShrink:0,outline:0}),input:css({margin:'3px 0',width:'100%',lineHeight:'28px',outline:'none',verticalAlign:'middle',WebkitAppearance:'none'}),inputOverlay:css({position:'absolute',height:'100%',width:'100%'})};/**
|
|
2
|
-
* Find more stores component.
|
|
3
|
-
* @returns {JSX}
|
|
4
|
-
* */var FindMoreStores=function FindMoreStores(){return React.createElement("div",{className:styles.container},React.createElement("div",{className:styles.title,"aria-hidden":true},i18n.text('location.findMoreStores')),React.createElement("div",{className:styles.inputCell},React.createElement("div",{className:styles.inputContainer},React.createElement("span",{className:styles.inputIcon,"aria-hidden":true},React.createElement(MagnifierIcon,null)),React.createElement("input",{name:"postalCode",className:styles.input,disabled:true,type:"search",autoComplete:"off",autoCorrect:"off",placeholder:"","aria-hidden":true}),React.createElement("div",{className:styles.inputIcon},React.createElement(LocatorIcon,null)),React.createElement(Link,{href:STORE_FINDER_PATTERN,className:classNames(styles.inputOverlay),role:"button","aria-label":i18n.text('location.findMoreStores')},React.createElement("div",null)))));};export default FindMoreStores;
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React,{useMemo}from'react';import{css}from'glamor';import{historyPush}from'@shopgate/pwa-common/actions/router';import PropTypes from'prop-types';import{Button}from'@shopgate/engage/components';import{generateGoogleMapsDirectionsUrl,i18n}from'@shopgate/engage/core';import{useDispatch}from'react-redux';var styles={container:css({}),buttonText:css({color:'var(--color-primary)'})};/**
|
|
2
|
-
* @param {Object} props The component props
|
|
3
|
-
* @param {Object} props.address The address object.
|
|
4
|
-
* @returns {JSX}
|
|
5
|
-
*/var GetDirectionsButton=function GetDirectionsButton(_ref){var address=_ref.address;var dispatch=useDispatch();var url=useMemo(function(){return address&&generateGoogleMapsDirectionsUrl(address);},[address]);/**
|
|
6
|
-
* Handles the button click.
|
|
7
|
-
*/var handleClick=function handleClick(){dispatch(historyPush({pathname:url,state:{target:'_blank'}}));};return React.createElement("div",{className:styles.container},React.createElement(Button,{onClick:handleClick,role:"button",type:"plain"},React.createElement("span",{className:styles.buttonText},i18n.text('location.getDirections'))));};GetDirectionsButton.defaultProps={address:null};export default GetDirectionsButton;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}import React,{useContext,useMemo}from'react';import{css}from'glamor';import{LocationIcon,Button,Link,ConditionalWrapper}from'@shopgate/engage/components';import{getWeekDaysOrder}from'@shopgate/engage/core';import{i18n}from'@shopgate/engage/core/helpers';import classNames from'classnames';import moment from'moment';import{StoreDetailsContext}from"../../../providers/StoreDetailsContext";import GetDirectionsButton from"./GetDirectionsButton";var styles={headerWrapper:css({display:'flex'}),headerIcon:css({color:'var(--color-primary)',fontSize:20,alignContent:'center',marginRight:4}),header:css({color:'var(--color-primary)',fontWeight:'600',fontSize:20}),locationName:css({fontSize:20,fontWeight:'600',marginBottom:8}),locationRow:css({display:'flex',gap:8,flexWrap:'wrap'}),locationColumn:css({flex:1,minWidth:'200px','& > p':{margin:0}}),storeHoursColumn:css({flex:1,minWidth:'250px',maxWidth:'455px'}),storeHours:css({fontSize:17,fontWeight:'600'}),storeHoursLine:css({}),storeHoursWeekday:css({textAlign:'left'}),bold:css({fontWeight:'600'}),storeHoursOpeningTime:css({textAlign:'right'}),phone:css({fontSize:17,fontWeight:'600'}),phoneNumber:css({textDecoration:'underline'}),makeMyStoreButton:css({color:'var(--color-primary)'}),comingSoon:css({fontStyle:'italic'}),buttonRow:css({display:'flex',alignItems:'center',gap:'8px 30px',flexWrap:'wrap',margin:'8px 0'})};/**
|
|
2
|
-
* Store details component.
|
|
3
|
-
* @returns {JSX}
|
|
4
|
-
*/var StoreDetails=function StoreDetails(){var _useContext=useContext(StoreDetailsContext),selectLocation=_useContext.selectLocation,routeLocation=_useContext.routeLocation,isRouteLocationPreferred=_useContext.isRouteLocationPreferred;var _ref=routeLocation||{},_ref$address=_ref.address,address=_ref$address===void 0?{}:_ref$address,_ref$operationHours=_ref.operationHours,operationHours=_ref$operationHours===void 0?{}:_ref$operationHours,isComingSoon=_ref.isComingSoon;var currentDay=moment().format('ddd').toLowerCase();// Check if there are any opening hours to hide the section if not
|
|
5
|
-
var hasOpeningHours=useMemo(function(){return Object.keys(operationHours).length>0&&Object.values(operationHours).some(function(value){return value&&typeof value==='string'&&value.length>0;});},[operationHours]);if(!routeLocation){return null;}return React.createElement("div",null,React.createElement(ConditionalWrapper,{condition:!isRouteLocationPreferred,wrapper:function wrapper(children){return React.createElement(Button,{onClick:function onClick(){return selectLocation(routeLocation,true);},role:"button",type:"plain"},children);}},React.createElement("div",{className:styles.headerWrapper},React.createElement("div",{className:styles.headerIcon},React.createElement(LocationIcon,{className:styles.icon,size:20})),React.createElement("div",{className:styles.header},isRouteLocationPreferred?i18n.text('location.myStore'):i18n.text('location.makeMyStore')))),React.createElement("div",{className:styles.locationName},routeLocation.name),React.createElement("div",{className:styles.locationRow},React.createElement("div",{className:styles.locationColumn},React.createElement("p",null,address===null||address===void 0?void 0:address.street),(address===null||address===void 0?void 0:address.street2)&&address.street2!==''&&React.createElement("p",null,address.street2),(address===null||address===void 0?void 0:address.street3)&&address.street3!==''&&React.createElement("p",null,address.street3),(address===null||address===void 0?void 0:address.street4)&&address.street4!==''&&React.createElement("p",null,address.street4),React.createElement("p",null,i18n.text('locations.address',address)),React.createElement("div",{className:styles.buttonRow},React.createElement(GetDirectionsButton,{address:address}),!isComingSoon&&!isRouteLocationPreferred&&React.createElement(Button,{onClick:function onClick(){return selectLocation(routeLocation,true);},role:"button",type:"plain",className:classNames(styles.makeMyStoreButton)},React.createElement("span",null,i18n.text('location.makeMyStore'))),isComingSoon&&React.createElement("div",{className:styles.comingSoon},i18n.text('location.comingSoon'))),(address===null||address===void 0?void 0:address.phoneNumber)&&React.createElement(React.Fragment,null,React.createElement("div",{className:styles.phone},"".concat(i18n.text('location.phone'),": ")),React.createElement("div",{className:styles.phoneNumber},React.createElement(Link,{href:"tel:".concat(address.phoneNumber),className:classNames(styles.phoneNumber),target:"_blank",role:"button","aria-label":address.phoneNumber},address.phoneNumber)))),hasOpeningHours&&React.createElement("div",{className:styles.storeHoursColumn},React.createElement("div",{className:styles.storeHours},"".concat(i18n.text('location.storeHours'),":")),React.createElement("table",null,React.createElement("tbody",null,getWeekDaysOrder().map(function(weekDay){if(!operationHours[weekDay]){return null;}return React.createElement("tr",{className:styles.storeHoursLine,key:weekDay,"aria-label":"".concat(i18n.text("locations.".concat(weekDay)),": ").concat(operationHours[weekDay]),tabIndex:0},React.createElement("td",{className:classNames(styles.storeHoursWeekday,_defineProperty({},styles.bold,weekDay===currentDay)),"aria-hidden":true},"".concat(i18n.text("locations.".concat(weekDay)),":")),React.createElement("td",{className:classNames(styles.storeHoursOpeningTime,_defineProperty({},styles.bold,weekDay===currentDay)),"aria-hidden":true},operationHours[weekDay]));}))))));};export default StoreDetails;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React,{useCallback,useMemo,useContext,useRef,useEffect}from'react';import{useDispatch}from'react-redux';import{Circle,MapContainer,Marker,TileLayer}from'react-leaflet';import{GestureHandling}from'leaflet-gesture-handling';import"../../../assets/leaflet.css";import'leaflet-gesture-handling/dist/leaflet-gesture-handling.css';import Leaflet from'leaflet';import{renderToString}from'react-dom/server';import MapMarkerIcon from'@shopgate/pwa-ui-shared/icons/MapMarkerIcon';import{historyPush}from'@shopgate/engage/core';import{container,markerSelected}from"./StoreFinderMap.style";import{MAP_RADIUS_KM}from"../../../constants";import{StoreDetailsContext}from"../../../providers/StoreDetailsContext";Leaflet.Map.addInitHook('addHandler','gestureHandling',GestureHandling);/**
|
|
2
|
-
* @returns {JSX.Element}
|
|
3
|
-
*/var StoreFinderMap=function StoreFinderMap(){var mapContainerRef=useRef(null);var dispatch=useDispatch();/**
|
|
4
|
-
* Handles the click on the OpenStreetMap copyright
|
|
5
|
-
* Cause the copyright is only a plain a tag
|
|
6
|
-
* this causes weird routing in the app
|
|
7
|
-
* To prevent this we need to handle the click on the a tag
|
|
8
|
-
* @param {Event} e The event
|
|
9
|
-
* @returns {void}
|
|
10
|
-
* */var handleOpenStreetMapCopyrightClick=useCallback(function(e){if(e.target.tagName==='A'&&e.target.href){e.preventDefault();dispatch(historyPush({pathname:e.target.href}));}},[dispatch]);// check the mapContainerRef if any a tag is clicked
|
|
11
|
-
// to catch the click on the OpenStreetMap copyright
|
|
12
|
-
useEffect(function(){if(mapContainerRef.current){mapContainerRef.current.addEventListener('click',handleOpenStreetMapCopyrightClick);}return function(){if(mapContainerRef.current){mapContainerRef.current.removeEventListener('click',handleOpenStreetMapCopyrightClick);}};},[handleOpenStreetMapCopyrightClick]);var _useContext=useContext(StoreDetailsContext),routeLocation=_useContext.routeLocation;var iconHTML=useMemo(function(){return renderToString(React.createElement(MapMarkerIcon,null));},[]);var markerIconSelected=useMemo(function(){return Leaflet.divIcon({html:iconHTML,className:markerSelected,iconSize:[40,40]});},[iconHTML]);var _ref=routeLocation||{},code=_ref.code,latitude=_ref.latitude,longitude=_ref.longitude;var viewport=useMemo(function(){if(!latitude||!longitude){return null;}return[latitude,longitude];},[latitude,longitude]);/**
|
|
13
|
-
* Enables touch and gestures on the map
|
|
14
|
-
* @param {Object} map available parameters for the map
|
|
15
|
-
*/var handleMapCreated=function handleMapCreated(map){map.gestureHandling.enable();map.attributionControl.setPrefix('');if(Leaflet.Browser.mobile){map.touchZoom.enable();}};/**
|
|
16
|
-
* Creates coordinates for a bounding box around a center point
|
|
17
|
-
* @param {Array} center The center point
|
|
18
|
-
* @param {number} distanceInMeter The distance in meters
|
|
19
|
-
* @returns {Array} The bounds
|
|
20
|
-
*/var createBounds=useCallback(function(_ref2,distanceInMeter){var _ref3=_slicedToArray(_ref2,2),lat=_ref3[0],lng=_ref3[1];var EARTH_RADIUS_KM=6371;var distanceInKm=distanceInMeter/1000;var distanceToBoundaryInKm=distanceInKm/2;var latInRadians=lat*(Math.PI/180);var deltaLat=distanceToBoundaryInKm/EARTH_RADIUS_KM*(180/Math.PI);var deltaLng=distanceToBoundaryInKm/EARTH_RADIUS_KM*(180/Math.PI)/Math.cos(latInRadians);return[[lat-deltaLat,lng-deltaLng],[lat+deltaLat,lng+deltaLng]];},[]);var radiusinMeters=MAP_RADIUS_KM*1000;var bounds=useMemo(function(){if(!viewport||!MAP_RADIUS_KM){return null;}return createBounds(viewport,radiusinMeters);},[createBounds,radiusinMeters,viewport]);var debug=false;if(!routeLocation){return null;}return React.createElement("div",{className:container,"aria-hidden":true,ref:mapContainerRef},React.createElement(MapContainer,{center:viewport,bounds:bounds,className:container,whenCreated:handleMapCreated},debug&&React.createElement(Circle,{center:viewport,radius:radiusinMeters,color:"blue"}),React.createElement(TileLayer,{attribution:"© <a href=\"https://osm.org/copyright\">OpenStreetMap</a> contributors",url:"https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"}),React.createElement(Marker,{key:code,icon:markerIconSelected,position:[latitude,longitude]})));};export default StoreFinderMap;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{css}from'glamor';import{themeColors}from'@shopgate/pwa-common/helpers/config';export var container=css({height:'100%',width:'100%'});export var markerSelected=css({' svg':{height:40,width:40,fontSize:'1.5rem',color:"var(--color-primary, ".concat(themeColors.primary,")")}}).toString();
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React,{useRef}from'react';import{css}from'glamor';import StoreFinderMap from"./StoreFinderMap";import{StoreFinderProvider}from"../../../providers";var styles={container:css({maxHeight:'250px',height:'250px',width:'100%',marginTop:'10px',marginBottom:'10px'}).toString()};/**
|
|
2
|
-
* Store location map component.
|
|
3
|
-
* @returns {JSX.Element}
|
|
4
|
-
*/var StoreLocationMap=function StoreLocationMap(){var storeListRef=useRef(null);return React.createElement(StoreFinderProvider,{storeListRef:storeListRef},React.createElement("div",{className:styles.container},React.createElement(StoreFinderMap,null)));};export default StoreLocationMap;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React,{useContext}from'react';import{css}from'glamor';import{i18n}from'@shopgate/engage/core/helpers';import StoresNearbyListItem from"./StoresNearbyListItem";import{StoreDetailsContext}from"../../../providers/StoreDetailsContext";var styles={title:css({fontSize:20,fontWeight:'600',marginBottom:12}),table:css({width:'100%'})};/**
|
|
2
|
-
* Show stores nearby selected location
|
|
3
|
-
* @returns {JSX}
|
|
4
|
-
*/var StoresNearby=function StoresNearby(){var _useContext=useContext(StoreDetailsContext),nearbyLocations=_useContext.nearbyLocations;return React.createElement("div",null,React.createElement("div",{className:styles.title},i18n.text('location.storesNearby')),nearbyLocations.length>0&&React.createElement("table",{className:styles.table},React.createElement("tbody",null,nearbyLocations.map(function(location){return React.createElement(StoresNearbyListItem,{location:location,key:location.code});}))),nearbyLocations.length===0&&React.createElement("div",null,i18n.text('location.noStoresNearby')));};export default StoresNearby;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React,{useContext}from'react';import{useDispatch}from'react-redux';import PropTypes from'prop-types';import{css}from'glamor';import{Button}from'@shopgate/engage/components';import{i18n}from'@shopgate/engage/core/helpers';import{historyPush}from'@shopgate/engage/core';import formatDistance from"../../../helpers/formatDistance";import{STORE_DETAILS_PATH}from"../../../constants";import{StoreDetailsContext}from"../../../providers/StoreDetailsContext";var styles={button:css({fontSize:'14px !important',padding:'0px !important'}).toString(),locationRow:css({borderBottom:'1px solid #e8e8e8',borderTop:'1px solid #e8e8e8','> td:first-child > div':{paddingLeft:0},'> td:last-child > div':{paddingRight:0}}),distance:css({textWrapMode:'nowrap',alignContent:'center',verticalAlign:'middle',fontWeight:'500'}),makeMyStore:css({textWrapMode:'nowrap',alignContent:'center',verticalAlign:'middle'}),storeInfo:css({textWrapMode:'nowrap',alignContent:'center',verticalAlign:'middle'}),name:css({textAlign:'start'}),cellContainer:css({padding:'8px',textAlign:'end'}),cell:css({verticalAlign:'middle'}),buttonContainer:css({display:'flex',gap:'4px 16px',flexWrap:'wrap',justifyContent:'flex-end'})};/**
|
|
2
|
-
* Shows a location in a row
|
|
3
|
-
* @param {Object} props Props
|
|
4
|
-
* @param {Object} props.location Location
|
|
5
|
-
* @returns {JSX}
|
|
6
|
-
*/var StoresNearbyListItem=function StoresNearbyListItem(_ref){var location=_ref.location;var dispatch=useDispatch();var _useContext=useContext(StoreDetailsContext),preferredLocation=_useContext.preferredLocation,selectLocation=_useContext.selectLocation;var name=location.name,distance=location.distance,unitSystem=location.unitSystem,code=location.code,isComingSoon=location.isComingSoon;var isPreferredLocation=preferredLocation&&preferredLocation.code===code;/**
|
|
7
|
-
* Opens the store details page
|
|
8
|
-
* @param {string} locationCode Location code
|
|
9
|
-
*/var openStoreDetails=function openStoreDetails(locationCode){dispatch(historyPush({pathname:"".concat(STORE_DETAILS_PATH,"/").concat(locationCode)}));};return React.createElement("tr",{className:styles.locationRow},React.createElement("td",{className:styles.cell},React.createElement("div",{className:styles.cellContainer},React.createElement("div",{className:styles.name},name))),React.createElement("td",{className:styles.cell},React.createElement("div",{className:styles.cellContainer},React.createElement("div",{className:styles.distance},formatDistance(distance||0,unitSystem==='imperial')))),React.createElement("td",{className:styles.cell},React.createElement("div",{className:styles.cellContainer},React.createElement("div",{className:styles.buttonContainer},React.createElement("div",{className:styles.makeMyStore},!isComingSoon&&React.createElement(Button,{className:styles.button,onClick:function onClick(){return selectLocation(location,true);},role:"button",type:"primary",flat:true,disabled:isPreferredLocation,wrapContent:false},"".concat(i18n.text('location.makeMyStore'))),isComingSoon&&React.createElement(Button,{className:styles.button,role:"button",type:"primary",flat:true,disabled:true,wrapContent:false},i18n.text('location.comingSoon'))),React.createElement("div",{className:styles.storeInfo},React.createElement(Button,{className:styles.button,role:"button",type:"primary",flat:true,onClick:function onClick(){return openStoreDetails(code);},wrapContent:false},i18n.text('locations.details')))))));};export default StoresNearbyListItem;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import React from'react';import{css}from'glamor';import{themeConfig}from'@shopgate/engage';import StoreDetails from"./components/StoreDetails";import StoreLocationMap from"./components/StoreLocationMap";import StoresNearby from"./components/StoresNearby";import FindMoreStores from"./components/FindMoreStores";import{StoreDetailsProvider}from"../../providers";var styles={page:css({padding:"".concat(themeConfig.variables.gap.small,"px ").concat(themeConfig.variables.gap.big,"px")}).toString()};/**
|
|
2
|
-
* @param {Object} props .
|
|
3
|
-
* @returns {JSX}
|
|
4
|
-
*/var StoreDetailsContent=function StoreDetailsContent(){return React.createElement(StoreDetailsProvider,null,React.createElement("div",{className:styles.page},React.createElement(StoreDetails,null),React.createElement(StoreLocationMap,null),React.createElement(StoresNearby,null),React.createElement(FindMoreStores,null)));};export default StoreDetailsContent;
|