@shopgate/engage 7.27.5-alpha.1 → 7.28.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/category/components/CategoryImage/index.js +1 -1
- package/category/components/CategoryList/index.js +3 -7
- package/category/components/CategoryList/style.js +1 -1
- package/category/streams/index.js +1 -1
- package/components/ResponsiveContainer/breakpoints.js +2 -2
- package/components/SheetList/components/Item/index.js +7 -7
- package/components/View/components/Content/style.js +1 -1
- package/components/View/context.js +1 -1
- package/components/index.js +1 -1
- package/core/constants/index.js +1 -7
- package/core/contexts/ThemeResourcesContext.d.ts +1 -10
- package/core/contexts/ThemeResourcesContext.js +1 -1
- package/core/helpers/scrollContainer.js +2 -2
- package/core/hocs/withThemeResources.js +1 -4
- package/core/hooks/events/index.js +1 -1
- package/core/hooks/useThemeResources.js +5 -6
- package/core/providers/ThemeResourcesProvider.js +5 -9
- package/locations/action-creators/index.js +1 -1
- package/locations/action-creators/selectLocation.js +8 -5
- package/locations/action-creators/sendDefaultLocationCode.js +14 -0
- package/locations/actions/fetchDefaultLocation.js +1 -1
- package/locations/actions/sendDefaultLocationCode.js +2 -2
- package/locations/components/GlobalLocationSelector/GlobalLocationSelector.js +2 -2
- package/locations/components/GlobalLocationSwitcher/GlobalLocationSwitcher.js +3 -1
- package/locations/constants/ActionTypes.js +2 -1
- package/locations/constants/index.js +1 -1
- package/locations/index.js +1 -1
- package/locations/locations.streams.js +3 -1
- package/locations/providers/FulfillmentProvider.js +6 -5
- package/locations/providers/StoreDetailsProvider.js +4 -2
- package/locations/providers/StoreFinderProvider.js +5 -3
- package/locations/subscriptions.js +12 -13
- package/package.json +7 -9
- package/page/components/index.js +1 -1
- package/page/constants/index.js +1 -5
- package/page/index.js +2 -1
- package/page/selectors/index.js +2 -48
- package/product/components/ProductCard/index.js +1 -1
- package/product/components/ProductGridPrice/index.js +1 -1
- package/product/components/ProductSlider/index.js +4 -4
- package/product/components/index.js +1 -1
- package/styles/helpers/index.js +1 -1
- package/styles/helpers/setPageBackgroundColor.js +2 -2
- package/styles/index.js +1 -1
- package/tracking/selectors/cookieConsent.js +2 -2
- package/components/Typography/Typography.d.ts +0 -132
- package/components/Typography/Typography.js +0 -11
- package/components/Typography/index.js +0 -1
- package/core/hooks/events/usePressHandler.js +0 -38
- package/page/action-creators/index.js +0 -22
- package/page/components/Widgets/Overlay.js +0 -51
- package/page/components/Widgets/Tooltip.js +0 -22
- package/page/components/Widgets/Widget.js +0 -15
- package/page/components/Widgets/WidgetContext.d.ts +0 -42
- package/page/components/Widgets/WidgetContext.js +0 -9
- package/page/components/Widgets/WidgetProvider.js +0 -8
- package/page/components/Widgets/Widgets.js +0 -11
- package/page/components/Widgets/WidgetsPreviewContext.js +0 -9
- package/page/components/Widgets/WidgetsPreviewProvider.js +0 -8
- package/page/components/Widgets/constants.js +0 -4
- package/page/components/Widgets/events.js +0 -23
- package/page/components/Widgets/helpers.js +0 -23
- package/page/components/Widgets/hooks.js +0 -69
- package/page/components/Widgets/index.js +0 -1
- package/page/components/Widgets/types.d.ts +0 -127
- package/page/constants/actionTypes.js +0 -1
- package/page/hooks/index.d.ts +0 -60
- package/page/hooks/index.js +0 -25
- package/page/reducers/index.js +0 -6
- package/page/subscriptions/index.js +0 -4
- package/page/widgets/CategoryList/CategoryList.js +0 -4
- package/page/widgets/CategoryList/hooks.js +0 -14
- package/page/widgets/CategoryList/index.js +0 -1
- package/page/widgets/HTML/HTML.js +0 -5
- package/page/widgets/HTML/hooks.js +0 -12
- package/page/widgets/HTML/index.js +0 -1
- package/page/widgets/Headline/Headline.js +0 -5
- package/page/widgets/Headline/hooks.js +0 -8
- package/page/widgets/Headline/index.js +0 -1
- package/page/widgets/Placeholder/Placeholder.js +0 -5
- package/page/widgets/Placeholder/hooks.js +0 -12
- package/page/widgets/Placeholder/index.js +0 -1
- package/page/widgets/ProductList/ProductList.js +0 -5
- package/page/widgets/ProductList/hooks.js +0 -25
- package/page/widgets/ProductList/index.js +0 -1
- package/page/widgets/ProductSlider/ProductSlider.js +0 -5
- package/page/widgets/ProductSlider/hooks.js +0 -28
- package/page/widgets/ProductSlider/index.js +0 -1
- package/page/widgets/index.js +0 -1
- package/page/widgets/widgets.json +0 -20
- package/product/components/ProductGrid/components/Item/components/ItemDetails/index.js +0 -8
- package/product/components/ProductGrid/components/Item/components/ItemDetails/spec.js +0 -1
- package/product/components/ProductGrid/components/Item/components/ItemDiscount/index.js +0 -5
- package/product/components/ProductGrid/components/Item/components/ItemFavoritesButton/index.js +0 -5
- package/product/components/ProductGrid/components/Item/components/ItemFavoritesButton/spec.js +0 -1
- package/product/components/ProductGrid/components/Item/components/ItemImage/index.js +0 -5
- package/product/components/ProductGrid/components/Item/components/ItemImage/spec.js +0 -1
- package/product/components/ProductGrid/components/Item/components/ItemName/index.js +0 -5
- package/product/components/ProductGrid/components/Item/components/ItemName/spec.js +0 -1
- package/product/components/ProductGrid/components/Item/components/ItemPrice/index.js +0 -5
- package/product/components/ProductGrid/components/Item/components/ItemPrice/spec.js +0 -1
- package/product/components/ProductGrid/components/Item/index.js +0 -7
- package/product/components/ProductGrid/components/Iterator/index.js +0 -5
- package/product/components/ProductGrid/components/Layout/index.js +0 -5
- package/product/components/ProductGrid/index.js +0 -22
- package/product/components/ProductGrid/spec.js +0 -1
- package/styles/helpers/color.js +0 -23
- package/styles/index.d.ts +0 -17
- package/styles/theme/createTheme/createBreakpoints.d.ts +0 -114
- package/styles/theme/createTheme/createBreakpoints.js +0 -41
- package/styles/theme/createTheme/createPalette.d.ts +0 -36
- package/styles/theme/createTheme/createPalette.js +0 -4
- package/styles/theme/createTheme/createSpacing.d.ts +0 -23
- package/styles/theme/createTheme/createSpacing.js +0 -14
- package/styles/theme/createTheme/createTypography.d.ts +0 -55
- package/styles/theme/createTheme/createTypography.js +0 -23
- package/styles/theme/createTheme/index.d.ts +0 -41
- package/styles/theme/createTheme/index.js +0 -5
- package/styles/theme/createTheme/transitions.d.ts +0 -100
- package/styles/theme/createTheme/transitions.js +0 -26
- package/styles/theme/createTheme/zIndex.d.ts +0 -12
- package/styles/theme/createTheme/zIndex.js +0 -3
- package/styles/theme/hooks/index.d.ts +0 -4
- package/styles/theme/hooks/index.js +0 -1
- package/styles/theme/hooks/useActiveBreakpoint.d.ts +0 -18
- package/styles/theme/hooks/useActiveBreakpoint.js +0 -4
- package/styles/theme/hooks/useMediaQuery.d.ts +0 -33
- package/styles/theme/hooks/useMediaQuery.js +0 -20
- package/styles/theme/hooks/useResponsiveValue.d.ts +0 -27
- package/styles/theme/hooks/useResponsiveValue.js +0 -4
- package/styles/theme/hooks/useTheme.d.ts +0 -8
- package/styles/theme/hooks/useTheme.js +0 -4
- package/styles/theme/index.d.ts +0 -8
- package/styles/theme/index.js +0 -1
- package/styles/theme/providers/ActiveBreakpointProvider.d.ts +0 -21
- package/styles/theme/providers/ActiveBreakpointProvider.js +0 -13
- package/styles/theme/providers/ThemeProvider.d.ts +0 -18
- package/styles/theme/providers/ThemeProvider.js +0 -7
- package/styles/tss/index.js +0 -3
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import React,{useMemo,useCallback}from'react';import PropTypes from'prop-types';import{useSelector}from'react-redux';import{LoadingProvider}from'@shopgate/pwa-common/providers';import{getPreferredLocation}from"../selectors";import{STORE_FINDER_PATTERN}from"../constants";import{StoreFinderContext}from"../locations.context";import connect from"./StoreFinder.connector";import{useNavigation}from"../../core";/**
|
|
1
|
+
import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import React,{useMemo,useCallback}from'react';import PropTypes from'prop-types';import{useSelector}from'react-redux';import{LoadingProvider}from'@shopgate/pwa-common/providers';import{getPreferredLocation}from"../selectors";import{STORE_FINDER_PATTERN}from"../constants";import{StoreFinderContext}from"../locations.context";import connect from"./StoreFinder.connector";import{useNavigation}from"../../core";/**
|
|
2
2
|
* @param {Object} props The component props
|
|
3
3
|
* @returns {JSX}
|
|
4
|
-
*/var StoreFinderProvider=function StoreFinderProvider(_ref){var children=_ref.children,locations=_ref.locations,isFetching=_ref.isFetching,shopSettings=_ref.shopSettings,userSearch=_ref.userSearch,storeFinderSearch=_ref.storeFinderSearch,selectGlobalLocation=_ref.selectGlobalLocation,selectLocation=_ref.selectLocation;var _useNavigation=useNavigation(),pop=_useNavigation.pop;var selectedLocation=useSelector(getPreferredLocation);var selectLocationCb=useCallback(function(location){selectLocation(location,true);
|
|
5
|
-
|
|
4
|
+
*/var StoreFinderProvider=function StoreFinderProvider(_ref){var children=_ref.children,locations=_ref.locations,isFetching=_ref.isFetching,shopSettings=_ref.shopSettings,userSearch=_ref.userSearch,storeFinderSearch=_ref.storeFinderSearch,selectGlobalLocation=_ref.selectGlobalLocation,selectLocation=_ref.selectLocation;var _useNavigation=useNavigation(),pop=_useNavigation.pop;var selectedLocation=useSelector(getPreferredLocation);var selectLocationCb=useCallback(/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(location){return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.next=2;return selectLocation({location:location,showToast:true});case 2:if(location.code!==(selectedLocation===null||selectedLocation===void 0?void 0:selectedLocation.code)){// Only dispatch selectGlobalLocation when location really changed, since this action
|
|
5
|
+
// might clear product data from the resultsByHash product storage.
|
|
6
|
+
selectGlobalLocation(location);}// Back navigation
|
|
7
|
+
pop();case 4:case"end":return _context.stop();}},_callee);}));return function(_x){return _ref2.apply(this,arguments);};}(),[selectedLocation,pop,selectLocation,selectGlobalLocation]);/**
|
|
6
8
|
* @param {bool} loading
|
|
7
9
|
*/var setIsLoading=useCallback(function(loading){if(loading){LoadingProvider.setLoading(STORE_FINDER_PATTERN);return;}LoadingProvider.unsetLoading(STORE_FINDER_PATTERN);},[]);var value=useMemo(function(){return{locations:locations,selectedLocation:selectedLocation,selectLocation:selectLocationCb,isFetching:isFetching,shopSettings:shopSettings,userSearch:userSearch,storeFinderSearch:storeFinderSearch,setIsLoading:setIsLoading};},[isFetching,locations,selectLocationCb,selectedLocation,shopSettings,storeFinderSearch,userSearch,setIsLoading]);return React.createElement(StoreFinderContext.Provider,{value:value},children);};StoreFinderProvider.defaultProps={children:null,locations:[],isFetching:false,shopSettings:null,userSearch:null,storeFinderSearch:null};export default connect(StoreFinderProvider);
|
|
@@ -1,27 +1,26 @@
|
|
|
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{appDidStart$,routeWillEnter$,UIEvents,getCurrentRoute,hex2bin,getThemeSettings,getCurrentSearchQuery,appWillInit$,appInitialization}from'@shopgate/engage/core';import{cartReceived$,fetchCart,cartDidEnter$,getCartItems}from'@shopgate/engage/cart';import{userDidLogin$}from'@shopgate/engage/user';import{receiveFavoritesWhileVisible$}from'@shopgate/pwa-common-commerce/favorites/streams';import{getFavoritesProductsIds,isFetching}from'@shopgate/pwa-common-commerce/favorites/selectors';import{categoryDidBackEnter$}from'@shopgate/pwa-common-commerce/category/streams';import{searchDidBackEntered$}from'@shopgate/pwa-common-commerce/search/streams';import{hasNewServices}from'@shopgate/engage/core/helpers';import{cookieConsentInitialized$}from'@shopgate/engage/tracking/streams';import{getUserSearch,getStoreFinderSearch,getPreferredLocation,getIsPending,getProductAlternativeLocationParams,getProductAlternativeLocations,makeGetLocation}from"./selectors";import{fetchDefaultLocation,fetchLocations,fetchProductLocations,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$,storeDetailPageWillEnter$}from"./locations.streams";import selectLocation from"./action-creators/selectLocation";import{NEARBY_LOCATIONS_RADIUS,SET_STORE_FINDER_SEARCH_RADIUS,NEARBY_LOCATIONS_LIMIT}from"./constants";import selectGlobalLocation from"./action-creators/selectGlobalLocation";var initialLocationsResolve;var initialLocationsReject;var initialLocationsPromise=new Promise(function(resolve,reject){initialLocationsResolve=resolve;initialLocationsReject=reject;});/**
|
|
2
2
|
* Sets a location once the location has been validated.
|
|
3
3
|
* @param {string} locationCode Location code
|
|
4
4
|
* @param {Function} dispatch Redux dispatch function
|
|
5
5
|
* @returns {Promise}
|
|
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=
|
|
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:_context.next=9;return dispatch(selectLocation({location:{code:locationCode}}));case 9:requestAnimationFrame(function(){dispatch(setPending(false));});_context.next=14;break;case 12:_context.prev=12;_context.t0=_context["catch"](0);case 14:case"end":return _context.stop();}},_callee,null,[[0,12]]);}));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(!
|
|
10
|
-
userSearch=getUserSearch(getState());_context3.prev=4;_context3.next=7;return dispatch(fetchLocations(userSearch));case 7:
|
|
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(cookieConsentInitialized$,/*#__PURE__*/function(){var _ref7=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee3(_ref6){var dispatch,getState,userSearch,_ref9,locations,preferredLocation,code,hasLocation,_ref11,preferredLocationDefault,locationToPreselect;return _regeneratorRuntime.wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:dispatch=_ref6.dispatch,getState=_ref6.getState;if(hasNewServices()){_context3.next=3;break;}return _context3.abrupt("return");case 3:// Fetch merchants locations.
|
|
10
|
+
userSearch=getUserSearch(getState());_context3.prev=4;_context3.next=7;return dispatch(fetchLocations(userSearch));case 7:_ref9=_context3.sent;locations=_ref9.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
|
-
|
|
13
|
-
if(!preferredLocation){locationToPreselect=locations.find(function(l){return l.code===preferredLocationDefault;});if(locationToPreselect){dispatch(selectLocation({code:preferredLocationDefault}));}}}initialLocationsResolve(locations);_context3.next=24;break;case 21:_context3.prev=21;_context3.t0=_context3["catch"](4);initialLocationsReject(_context3.t0);case 24:UIEvents.addListener(EVENT_SET_OPEN,function(){var route=getCurrentRoute(getState());if(!route.params.productId&&!route.state.productId){return;}var productId=route.state.productId||hex2bin(route.params.productId);if(productId){dispatch(fetchProductLocations(productId,getUserSearch(getState())));}});case 25:case"end":return _context3.stop();}},_callee3,null,[[4,21]]);}));return function(_x4){return _ref8.apply(this,arguments);};}());subscribe(userSearchChanged$,/*#__PURE__*/function(){var _ref14=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref13){var dispatch,getState,action,productId,isStoreFinder,silent,state,userSearch,storeFinderSearch;return _regeneratorRuntime.wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:dispatch=_ref13.dispatch,getState=_ref13.getState,action=_ref13.action;productId=action.productId,isStoreFinder=action.isStoreFinder,silent=action.silent;if(!(silent===true)){_context4.next=4;break;}return _context4.abrupt("return");case 4:state=getState();userSearch=getUserSearch(state);if(!(isStoreFinder||action.type===SET_STORE_FINDER_SEARCH_RADIUS)){_context4.next=12;break;}storeFinderSearch=getStoreFinderSearch(state);_context4.next=10;return dispatch(fetchLocations(_extends({},userSearch,{},storeFinderSearch,{enableInLocationFinder:true})));case 10:_context4.next=19;break;case 12:if(productId){_context4.next=17;break;}_context4.next=15;return dispatch(fetchLocations(userSearch));case 15:_context4.next=19;break;case 17:_context4.next=19;return dispatch(fetchProductLocations(productId,userSearch));case 19:case"end":return _context4.stop();}},_callee4);}));return function(_x5){return _ref14.apply(this,arguments);};}());var productInventoryNeedsUpdate$=productIsReady$.merge(variantDidChange$).merge(preferredLocationDidUpdateOnPDP$).debounceTime(200);subscribe(productInventoryNeedsUpdate$,function(_ref15){var action=_ref15.action,dispatch=_ref15.dispatch,getState=_ref15.getState;var productData=action.productData;// Skip if no fulfillment methods are set.
|
|
12
|
+
_ref11=getThemeSettings('@shopgate/engage/locations')||{},preferredLocationDefault=_ref11.preferredLocationDefault;if(!preferredLocationDefault){_context3.next=23;break;}if(preferredLocation){_context3.next=23;break;}locationToPreselect=locations.find(function(l){return l.code===preferredLocationDefault;});if(!locationToPreselect){_context3.next=23;break;}_context3.next=23;return dispatch(selectLocation({location:{code:preferredLocationDefault}}));case 23:initialLocationsResolve(locations);_context3.next=29;break;case 26:_context3.prev=26;_context3.t0=_context3["catch"](4);initialLocationsReject(_context3.t0);case 29:UIEvents.addListener(EVENT_SET_OPEN,function(){var route=getCurrentRoute(getState());if(!route.params.productId&&!route.state.productId){return;}var productId=route.state.productId||hex2bin(route.params.productId);if(productId){dispatch(fetchProductLocations(productId,getUserSearch(getState())));}});case 30:case"end":return _context3.stop();}},_callee3,null,[[4,26]]);}));return function(_x4){return _ref7.apply(this,arguments);};}());subscribe(userSearchChanged$,/*#__PURE__*/function(){var _ref13=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee4(_ref12){var dispatch,getState,action,productId,isStoreFinder,silent,state,userSearch,storeFinderSearch;return _regeneratorRuntime.wrap(function _callee4$(_context4){while(1)switch(_context4.prev=_context4.next){case 0:dispatch=_ref12.dispatch,getState=_ref12.getState,action=_ref12.action;productId=action.productId,isStoreFinder=action.isStoreFinder,silent=action.silent;if(!(silent===true)){_context4.next=4;break;}return _context4.abrupt("return");case 4:state=getState();userSearch=getUserSearch(state);if(!(isStoreFinder||action.type===SET_STORE_FINDER_SEARCH_RADIUS)){_context4.next=12;break;}storeFinderSearch=getStoreFinderSearch(state);_context4.next=10;return dispatch(fetchLocations(_extends({},userSearch,{},storeFinderSearch,{enableInLocationFinder:true})));case 10:_context4.next=19;break;case 12:if(productId){_context4.next=17;break;}_context4.next=15;return dispatch(fetchLocations(userSearch));case 15:_context4.next=19;break;case 17:_context4.next=19;return dispatch(fetchProductLocations(productId,userSearch));case 19:case"end":return _context4.stop();}},_callee4);}));return function(_x5){return _ref13.apply(this,arguments);};}());var productInventoryNeedsUpdate$=productIsReady$.merge(variantDidChange$).merge(preferredLocationDidUpdateOnPDP$).debounceTime(200);subscribe(productInventoryNeedsUpdate$,function(_ref14){var action=_ref14.action,dispatch=_ref14.dispatch,getState=_ref14.getState;var productData=action.productData;// Skip if no fulfillment methods are set.
|
|
14
13
|
if(!productData||!productData.fulfillmentMethods||productData.fulfillmentMethods.length===0){return;}var state=getState();var preferredLocation=getPreferredLocation(state);if(!preferredLocation){return;}// Fetch inventories for this specific product.
|
|
15
14
|
dispatch(fetchProductInventories(action.productData.id,{locationCodes:[preferredLocation.code]}));});// Core config and cart subscriptions
|
|
16
|
-
var fetchCart$=cartDidEnter$.switchMap(function(){return submitReservationSuccess$.first();}).delay(500);subscribe(fetchCart$,function(
|
|
17
|
-
userSearch=getUserSearch(state);storeFinderSearch=getStoreFinderSearch(state);_context5.next=6;return dispatch(fetchLocations(_extends({},userSearch,{},storeFinderSearch,{enableInLocationFinder:true})));case 6:case"end":return _context5.stop();}},_callee5);}));return function(_x6){return
|
|
15
|
+
var fetchCart$=cartDidEnter$.switchMap(function(){return submitReservationSuccess$.first();}).delay(500);subscribe(fetchCart$,function(_ref15){var dispatch=_ref15.dispatch;dispatch(fetchCart());});subscribe(storeFinderWillEnter$,/*#__PURE__*/function(){var _ref17=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee5(_ref16){var dispatch,getState,state,userSearch,storeFinderSearch;return _regeneratorRuntime.wrap(function _callee5$(_context5){while(1)switch(_context5.prev=_context5.next){case 0:dispatch=_ref16.dispatch,getState=_ref16.getState;state=getState();// Fetch merchants locations.
|
|
16
|
+
userSearch=getUserSearch(state);storeFinderSearch=getStoreFinderSearch(state);_context5.next=6;return dispatch(fetchLocations(_extends({},userSearch,{},storeFinderSearch,{enableInLocationFinder:true})));case 6:case"end":return _context5.stop();}},_callee5);}));return function(_x6){return _ref17.apply(this,arguments);};}());/**
|
|
18
17
|
* Makes sure that the active location is switched after logging in
|
|
19
18
|
* to a location that is also available in the cart.
|
|
20
19
|
* Avoids having a selected location that differs from the cart
|
|
21
|
-
*/var afterCartMerge$=userDidLogin$.mergeMap(function(){return cartReceived$.first();});subscribe(afterCartMerge$,/*#__PURE__*/function(){var
|
|
20
|
+
*/var afterCartMerge$=userDidLogin$.mergeMap(function(){return cartReceived$.first();});subscribe(afterCartMerge$,/*#__PURE__*/function(){var _ref19=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee6(_ref18){var _cartItems$,_cartItems$$fulfillme,_cartItems$$fulfillme2;var dispatch,getState,state,cartItems,preferredLocation,activeCartLocation,firstLocationCode;return _regeneratorRuntime.wrap(function _callee6$(_context6){while(1)switch(_context6.prev=_context6.next){case 0:dispatch=_ref18.dispatch,getState=_ref18.getState;state=getState();cartItems=getCartItems(state);preferredLocation=getPreferredLocation(state,{});if(cartItems===null||cartItems===void 0?void 0:cartItems.length){_context6.next=6;break;}return _context6.abrupt("return");case 6:activeCartLocation=cartItems.find(function(item){var _item$fulfillment,_item$fulfillment$loc;return((_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)===(preferredLocation===null||preferredLocation===void 0?void 0:preferredLocation.code);});if(!activeCartLocation){_context6.next=9;break;}return _context6.abrupt("return");case 9:firstLocationCode=(_cartItems$=cartItems[0])===null||_cartItems$===void 0?void 0:(_cartItems$$fulfillme=_cartItems$.fulfillment)===null||_cartItems$$fulfillme===void 0?void 0:(_cartItems$$fulfillme2=_cartItems$$fulfillme.location)===null||_cartItems$$fulfillme2===void 0?void 0:_cartItems$$fulfillme2.code;if(firstLocationCode){_context6.next=12;break;}return _context6.abrupt("return");case 12:_context6.next=14;return dispatch(selectLocation({location:{code:firstLocationCode}}));case 14:dispatch(selectGlobalLocation({code:firstLocationCode}));case 15:case"end":return _context6.stop();}},_callee6);}));return function(_x7){return _ref19.apply(this,arguments);};}());/**
|
|
22
21
|
* Handles an added store url parameter that will set the default store location
|
|
23
|
-
*/subscribe(routeWillEnter$,function(
|
|
22
|
+
*/subscribe(routeWillEnter$,function(_ref20){var action=_ref20.action,dispatch=_ref20.dispatch,getState=_ref20.getState;var locationCode=action.route.query.store;if(!locationCode){if(!getIsPending(getState())){dispatch(setPending(false));}return;}setLocationOnceAvailable(locationCode,dispatch);});var alternative$=productInventoryNeedsUpdate$.switchMap(function(){return provideAlternativeLocation$.first();});/**
|
|
24
23
|
* Provide alternative location on PDP when preferred location is out of stock
|
|
25
|
-
*/subscribe(alternative$,/*#__PURE__*/function(){var
|
|
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
|
|
27
|
-
setShowInventoryInLists(getState());});subscribe(storeDetailPageWillEnter$,/*#__PURE__*/function(){var
|
|
24
|
+
*/subscribe(alternative$,/*#__PURE__*/function(){var _ref22=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee7(_ref21){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=_ref21.action,dispatch=_ref21.dispatch,getState=_ref21.getState;_context7.next=3;return dispatch(setUserGeolocation({silent:true}));case 3:// Get new state with geolocation
|
|
25
|
+
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 _ref22.apply(this,arguments);};}());subscribe(categoryDidBackEnter$.merge(searchDidBackEntered$),function(_ref23){var _getProductsResult;var action=_ref23.action,dispatch=_ref23.dispatch,getState=_ref23.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(_ref24){var id=_ref24.id;return id;});dispatch(fetchInventories(productCodes));});subscribe(productsReceived$.merge(productsReceivedCached$),function(_ref25){var action=_ref25.action,dispatch=_ref25.dispatch,getState=_ref25.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(_ref26){var id=_ref26.id;return id;}):action.products;dispatch(fetchInventories(productCodes));});subscribe(receiveFavoritesWhileVisible$.merge(preferredLocationDidUpdateGlobalOnWishlist$),function(_ref27){var dispatch=_ref27.dispatch,getState=_ref27.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(_ref28){var getState=_ref28.getState;// enable inventory in product lists for some users
|
|
26
|
+
setShowInventoryInLists(getState());});subscribe(storeDetailPageWillEnter$,/*#__PURE__*/function(){var _ref30=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee8(_ref29){var dispatch,getState,route,getLocation,location;return _regeneratorRuntime.wrap(function _callee8$(_context8){while(1)switch(_context8.prev=_context8.next){case 0:dispatch=_ref29.dispatch,getState=_ref29.getState;route=getCurrentRoute(getState());getLocation=makeGetLocation(function(){return route.params.code;});location=getLocation(getState());_context8.next=6;return dispatch(fetchLocations({geolocation:{longitude:location.longitude,latitude:location.latitude},limit:NEARBY_LOCATIONS_LIMIT,radius:NEARBY_LOCATIONS_RADIUS}));case 6:case"end":return _context8.stop();}},_callee8);}));return function(_x9){return _ref30.apply(this,arguments);};}());}export default locationsSubscriber;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/engage",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.28.0-beta.1",
|
|
4
4
|
"description": "Shopgate's ENGAGE library.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Shopgate <support@shopgate.com>",
|
|
@@ -15,14 +15,13 @@
|
|
|
15
15
|
"connect"
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@emotion/react": "^11.14.0",
|
|
19
18
|
"@shopgate/native-modules": "1.0.0-beta.25",
|
|
20
|
-
"@shopgate/pwa-common": "7.
|
|
21
|
-
"@shopgate/pwa-common-commerce": "7.
|
|
22
|
-
"@shopgate/pwa-core": "7.
|
|
23
|
-
"@shopgate/pwa-ui-ios": "7.
|
|
24
|
-
"@shopgate/pwa-ui-material": "7.
|
|
25
|
-
"@shopgate/pwa-ui-shared": "7.
|
|
19
|
+
"@shopgate/pwa-common": "7.28.0-beta.1",
|
|
20
|
+
"@shopgate/pwa-common-commerce": "7.28.0-beta.1",
|
|
21
|
+
"@shopgate/pwa-core": "7.28.0-beta.1",
|
|
22
|
+
"@shopgate/pwa-ui-ios": "7.28.0-beta.1",
|
|
23
|
+
"@shopgate/pwa-ui-material": "7.28.0-beta.1",
|
|
24
|
+
"@shopgate/pwa-ui-shared": "7.28.0-beta.1",
|
|
26
25
|
"@stripe/react-stripe-js": "^1.16.5",
|
|
27
26
|
"@stripe/stripe-js": "^1.3.1",
|
|
28
27
|
"@virtuous/conductor": "~2.5.0",
|
|
@@ -41,7 +40,6 @@
|
|
|
41
40
|
"react-phone-number-input": "^3.2.16",
|
|
42
41
|
"react-player": "1.11.0",
|
|
43
42
|
"react-portal": "^3.1.0",
|
|
44
|
-
"tss-react": "^4.9.18",
|
|
45
43
|
"validate.js": "^0.13.1"
|
|
46
44
|
},
|
|
47
45
|
"devDependencies": {
|
package/page/components/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as NotFound}from"./NotFound";
|
|
1
|
+
export{default as NotFound}from"./NotFound";
|
package/page/constants/index.js
CHANGED
|
@@ -1,5 +1 @@
|
|
|
1
|
-
import{PAGE_PATH,PAGE_PATTERN}from'@shopgate/pwa-common/constants/RoutePaths';export*from'@shopgate/pwa-common/constants/PageIDs';export{PAGE_PATH,PAGE_PATTERN};export
|
|
2
|
-
* Checks if the app is currently in page preview mode.
|
|
3
|
-
*/export var IS_PAGE_PREVIEW_ACTIVE=window.location.pathname.startsWith(PAGE_PREVIEW_PATTERN);/**
|
|
4
|
-
* One hour in milliseconds
|
|
5
|
-
*/export var PAGE_STATE_LIFETIME=3600000;
|
|
1
|
+
import{PAGE_PATH,PAGE_PATTERN}from'@shopgate/pwa-common/constants/RoutePaths';export*from'@shopgate/pwa-common/constants/PageIDs';export{PAGE_PATH,PAGE_PATTERN};export var IMPRINT_PATH="".concat(PAGE_PATH,"/imprint");export var PAYMENT_PATH="".concat(PAGE_PATH,"/payment");export var PRIVACY_PATH="".concat(PAGE_PATH,"/privacy");export var RETURN_POLICY_PATH="".concat(PAGE_PATH,"/return_policy");export var SHIPPING_PATH="".concat(PAGE_PATH,"/shipping");export var TERMS_PATH="".concat(PAGE_PATH,"/terms");
|
package/page/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
/** @module page */export*from"./actions";export*from"./components";export*from"./constants"
|
|
1
|
+
/** @module page */export*from"./actions";export*from"./components";export*from"./constants";// eslint-disable-next-line import/export
|
|
2
|
+
export*from"./selectors";
|
package/page/selectors/index.js
CHANGED
|
@@ -1,53 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import{createSelector}from'reselect';import{makeGetMenu,makeGetIsFetchingMenu}from'@shopgate/engage/core/selectors';import{LEGAL_MENU}from'@shopgate/engage/core/constants';import{hasNewServices}from'@shopgate/engage/core';import{PRIVACY_PATH}from"../constants";export*from'@shopgate/pwa-common/selectors/page';/**
|
|
2
2
|
* Creates a selector that retrieves the privacy policy link.
|
|
3
3
|
*
|
|
4
4
|
* When the new services are active, the link is extracted from the "shopgate.cms.getMenu" response.
|
|
5
5
|
* Otherwise it's a static link to the legacy privacy page.
|
|
6
6
|
* @returns {string|null}
|
|
7
|
-
*/export var makeGetPrivacyPolicyLink=function makeGetPrivacyPolicyLink(){var getMenu=makeGetMenu(LEGAL_MENU);var getIsFetchingMenu=makeGetIsFetchingMenu(LEGAL_MENU);return createSelector(getMenu,getIsFetchingMenu,function(menu,fetching){if(!hasNewServices()){return PRIVACY_PATH;}if(fetching||!menu){return null;}var entry=menu.find(function(item){return item.url.includes('privacy');})||{};return(entry===null||entry===void 0?void 0:entry.url)||null;});}
|
|
8
|
-
* @param {Object} state The current application state.
|
|
9
|
-
* @return {Function} A selector function that retrieves the pageV2 state.
|
|
10
|
-
*/var getPageV2State=function getPageV2State(state){return state.pageV2;};/**
|
|
11
|
-
* List of available page types.
|
|
12
|
-
* @typedef {'cms' | 'category'} PageType
|
|
13
|
-
*/ /**
|
|
14
|
-
* List of available dropzone types.
|
|
15
|
-
* @typedef {'cmsWidgetList'} DropzoneType
|
|
16
|
-
*/ /**
|
|
17
|
-
* Creates a selector that retrieves page data based on the type and slug.
|
|
18
|
-
* @param {Object} params The selector params
|
|
19
|
-
* @param {PageType} [params.type] The type of the page.
|
|
20
|
-
* @param {string|null} [params.slug=null] The slug of the page (optional).
|
|
21
|
-
* @returns {Function} A selector function that retrieves the page data.
|
|
22
|
-
*/export var makeGetPage=function makeGetPage(_ref){var _ref$type=_ref.type,type=_ref$type===void 0?'cms':_ref$type,_ref$slug=_ref.slug,slug=_ref$slug===void 0?null:_ref$slug;return createSelector(getPageV2State,function(pageState){if(type&&slug){var _pageState$type;return((_pageState$type=pageState[type])===null||_pageState$type===void 0?void 0:_pageState$type[slug])||null;}return pageState[type]||null;});};/**
|
|
23
|
-
* Creates a selector that retrieves the widget list from a page based on the type, slug and
|
|
24
|
-
* and dropzone name.
|
|
25
|
-
* @param {Object} params The selector params
|
|
26
|
-
* @param {PageType} [params.type='cms'] The type of the page.
|
|
27
|
-
* @param {DropzoneType} [params.dropzone='cmsWidgetList'] The dropzone name to retrieve the widget
|
|
28
|
-
* list from.
|
|
29
|
-
* @param {string|null} [params.slug=null] The slug of the page (optional).
|
|
30
|
-
* @returns {Function} A selector function that retrieves the widget list.
|
|
31
|
-
*/export var makeGetWidgetsFromPage=function makeGetWidgetsFromPage(_ref2){var _ref2$type=_ref2.type,type=_ref2$type===void 0?'cms':_ref2$type,_ref2$slug=_ref2.slug,slug=_ref2$slug===void 0?null:_ref2$slug,_ref2$dropzone=_ref2.dropzone,dropzone=_ref2$dropzone===void 0?'cmsWidgetList':_ref2$dropzone;var getPage=makeGetPage({type:type,slug:slug});return createSelector(getPage,function(page){var _ref3,_page$data,_page$data$dropzones;if(!page){return undefined;}return(_ref3=(_page$data=page.data)===null||_page$data===void 0?void 0:(_page$data$dropzones=_page$data.dropzones)===null||_page$data$dropzones===void 0?void 0:_page$data$dropzones[dropzone])!==null&&_ref3!==void 0?_ref3:[];});};/**
|
|
32
|
-
* Creates a selector that generates a hash to select results for widget products.
|
|
33
|
-
* @param {'searchTerm' | 'itemNumbers' | 'brand' | 'category' |'highlights'} type Type of the
|
|
34
|
-
* request to make.
|
|
35
|
-
* @param {Object} options Request options
|
|
36
|
-
* @param {string} id Unique identifier to find the result in the state.
|
|
37
|
-
* @returns {Function} A selector function that generates a hash for the widget products result.
|
|
38
|
-
*/var makeGetWidgetProductsResultHash=function makeGetWidgetProductsResultHash(type,options,id){var value=options.value,sort=options.sort,useDefaultRequestForProductIds=options.useDefaultRequestForProductIds,productIdType=options.productIdType;var transformedSort=transformDisplayOptions(sort);return createSelector(getFulfillmentParams,function(fulfillmentParams){var _hashParams;var hashParams={};switch(type){case'highlights':hashParams={id:id,pipeline:SHOPGATE_CATALOG_GET_HIGHLIGHT_PRODUCTS,sort:transformedSort};break;case'searchTerm':case'brand':hashParams=_extends({id:id,searchPhrase:value,sort:transformedSort},fulfillmentParams);break;case'itemNumbers':hashParams=_extends({id:id,productIds:value,productIdType:productIdType},!useDefaultRequestForProductIds&&{sort:transformedSort},{},fulfillmentParams);break;case'category':hashParams=_extends({id:id,categoryId:value,sort:transformedSort},fulfillmentParams);break;default:}return generateResultHash(hashParams,!!((_hashParams=hashParams)===null||_hashParams===void 0?void 0:_hashParams.sort),false);});};/**
|
|
39
|
-
* @param {'searchTerm' | 'itemNumbers' | 'brand' | 'category' |'highlights'} type Type of the
|
|
40
|
-
* request to make.
|
|
41
|
-
* @param {Object} options Request options
|
|
42
|
-
* @param {string} id Unique identifier to find the result in the state.
|
|
43
|
-
* @returns {Function} A selector function that retrieves the widget products result by hash.
|
|
44
|
-
*/var makeGetWidgetProductResultsByHash=function makeGetWidgetProductResultsByHash(type,options,id){var getWidgetProductResultsHash=makeGetWidgetProductsResultHash(type,options,id);return createSelector(getProductState,getWidgetProductResultsHash,function(productState,hash){return productState.resultsByHash[hash];});};/**
|
|
45
|
-
* Creates a selector that collects products for a widget.
|
|
46
|
-
* @param {'searchTerm' | 'itemNumbers' | 'brand' | 'category' |'highlights'} type Type of the
|
|
47
|
-
* request to make.
|
|
48
|
-
* @param {Object} options Request options
|
|
49
|
-
* @param {string} id Unique identifier to find the result in the state.
|
|
50
|
-
* @returns {Function} A selector function that collects products for a widget.
|
|
51
|
-
*/export var makeGetWidgetProducts=function makeGetWidgetProducts(type,options,id){var getWidgetProductResultsHash=makeGetWidgetProductsResultHash(type,options,id);var getWidgetProductResultsByHash=makeGetWidgetProductResultsByHash(type,options,id);return createSelector(function(state){return state;},function(state,props){return props!==null&&props!==void 0?props:{};},getWidgetProductResultsHash,getWidgetProductResultsByHash,function(state,props,resultsHash,resultsByHash){var result=_extends({isFetching:(resultsByHash===null||resultsByHash===void 0?void 0:resultsByHash.isFetching)||false},getPopulatedProductsResult(state,props,resultsHash,resultsByHash));// Since the getProducts pipeline does not support sorting when a product ID list is
|
|
52
|
-
// provided, we need to sort the products manually here.
|
|
53
|
-
if(type==='itemNumbers'){if(options.sort===SORT_PRICE_ASC){result.products=result.products.sort(function(p1,p2){return p1.price.unitPrice-p2.price.unitPrice;});}if(options.sort===SORT_PRICE_DESC){result.products=result.products.sort(function(p1,p2){return p2.price.unitPrice-p1.price.unitPrice;});}}return result;});};
|
|
7
|
+
*/export var makeGetPrivacyPolicyLink=function makeGetPrivacyPolicyLink(){var getMenu=makeGetMenu(LEGAL_MENU);var getIsFetchingMenu=makeGetIsFetchingMenu(LEGAL_MENU);return createSelector(getMenu,getIsFetchingMenu,function(menu,fetching){if(!hasNewServices()){return PRIVACY_PATH;}if(fetching||!menu){return null;}var entry=menu.find(function(item){return item.url.includes('privacy');})||{};return(entry===null||entry===void 0?void 0:entry.url)||null;});};
|
|
@@ -8,7 +8,7 @@ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<argum
|
|
|
8
8
|
* @param {number} props.titleRows The max number of rows for the product title.
|
|
9
9
|
* @param {string} props.url Optional alternative url for the product link
|
|
10
10
|
* @return {JSX.Element}
|
|
11
|
-
*/function ProductCard(props){var product=props.product,hidePrice=props.hidePrice,hideRating=props.hideRating,hideName=props.hideName,titleRows=props.titleRows,url=props.url;var _useProductListType=useProductListType(),meta=_useProductListType.meta;var _getProductImageSetti=getProductImageSettings(),gridResolutions=_getProductImageSetti.ListImage;var _useWidgetSettings=useWidgetSettings('@shopgate/engage/rating'),_useWidgetSettings$sh=_useWidgetSettings.showEmptyRatingStars,showEmptyRatingStars=_useWidgetSettings$sh===void 0?false:_useWidgetSettings$sh;var showRatings=useMemo(function(){var _product$rating;if(!hideRating&&(product===null||product===void 0?void 0:(_product$rating=product.rating)===null||_product$rating===void 0?void 0:_product$rating.average)>0){return true;}if(!hideRating&&showEmptyRatingStars&&(product===null||product===void 0?void 0:product.rating)){return true;}return false;},[hideRating,product,showEmptyRatingStars]);return React.createElement(Link,{className:"engage__product-card",href:url||getProductRoute(product.id),itemProp:"item",itemScope:true,itemType:"http://schema.org/Product",tabIndex:0,state:_extends({},meta)},isBeta()&&product.featuredMedia?React.createElement(FeaturedMedia,{type:product.featuredMedia.type,url:product.featuredMedia.url,altText:product.featuredMedia.altText}):React.createElement(ProductImage,{src:product.featuredImageBaseUrl,resolutions:gridResolutions,alt:product.name,itemProp:"image"}),React.createElement(ProductBadges,{location:location,productId:product.id},!!(!hidePrice&&product.price.discount)&&React.createElement("div",{className:styles.badgeWrapper},React.createElement(SurroundPortals,{portalName:PRODUCT_ITEM_DISCOUNT,portalProps:{productId:product.id}},React.createElement(DiscountBadge,{text:"-".concat(product.price.discount,"%")})))),!(hidePrice&&hideRating
|
|
11
|
+
*/function ProductCard(props){var product=props.product,hidePrice=props.hidePrice,hideRating=props.hideRating,hideName=props.hideName,titleRows=props.titleRows,url=props.url;var _useProductListType=useProductListType(),meta=_useProductListType.meta;var _getProductImageSetti=getProductImageSettings(),gridResolutions=_getProductImageSetti.ListImage;var _useWidgetSettings=useWidgetSettings('@shopgate/engage/rating'),_useWidgetSettings$sh=_useWidgetSettings.showEmptyRatingStars,showEmptyRatingStars=_useWidgetSettings$sh===void 0?false:_useWidgetSettings$sh;var showRatings=useMemo(function(){var _product$rating;if(!hideRating&&(product===null||product===void 0?void 0:(_product$rating=product.rating)===null||_product$rating===void 0?void 0:_product$rating.average)>0){return true;}if(!hideRating&&showEmptyRatingStars&&(product===null||product===void 0?void 0:product.rating)){return true;}return false;},[hideRating,product,showEmptyRatingStars]);return React.createElement(Link,{className:"engage__product-card",href:url||getProductRoute(product.id),itemProp:"item",itemScope:true,itemType:"http://schema.org/Product",tabIndex:0,state:_extends({},meta)},isBeta()&&product.featuredMedia?React.createElement(FeaturedMedia,{type:product.featuredMedia.type,url:product.featuredMedia.url,altText:product.featuredMedia.altText}):React.createElement(ProductImage,{src:product.featuredImageBaseUrl,resolutions:gridResolutions,alt:product.name,itemProp:"image"}),React.createElement(ProductBadges,{location:location,productId:product.id},!!(!hidePrice&&product.price.discount)&&React.createElement("div",{className:styles.badgeWrapper},React.createElement(SurroundPortals,{portalName:PRODUCT_ITEM_DISCOUNT,portalProps:{productId:product.id}},React.createElement(DiscountBadge,{text:"-".concat(product.price.discount,"%")})))),!(hidePrice&&hideRating)&&React.createElement("div",{className:"".concat(styles.details," engage__product-card__information")},showRatings&&React.createElement(RatingStars,{value:product.rating.average}),React.createElement(Swatches,{productId:product.id}),!hideName&&React.createElement(ProductName,{name:product.name,className:styles.title,testId:"Productname: ".concat(product.name),itemProp:"name",rows:titleRows||3}),React.createElement(MapPriceHint,{productId:product.id}),React.createElement(OrderQuantityHint,{productId:product.id}),!hidePrice&&React.createElement(SurroundPortals,{portalName:PRODUCT_ITEM_PRICE,portalProps:{productId:product.id,location:location}},React.createElement(ProductGridPrice,{product:product}))));}/**
|
|
12
12
|
* After a refactoring of the Theme API ProductCard component, this component replaced a
|
|
13
13
|
* sub-component of the ProductCard.
|
|
14
14
|
* The original implementation exposed a couple of sub-components that don't exist in the new
|
|
@@ -2,5 +2,5 @@ import React,{Fragment}from'react';import PropTypes from'prop-types';import{Grid
|
|
|
2
2
|
* The ProductGridPrice component is supposed to be used to display prices at product grids. It
|
|
3
3
|
* renders a row with the current price and a strike price when present. As same as the price info.
|
|
4
4
|
* @param {Object} product A product entity.
|
|
5
|
-
* @return {JSX
|
|
5
|
+
* @return {JSX}
|
|
6
6
|
*/var ProductGridPrice=function ProductGridPrice(_ref){var product=_ref.product;var price=product.price;return React.createElement(Fragment,null,React.createElement(Grid,{className:"".concat(styles.priceWrapper," engage__product__product-grid-price"),wrap:true},React.createElement(Grid.Item,{grow:1},React.createElement(Price,{currency:price.currency,discounted:!!price.discount,unitPrice:price.unitPrice,unitPriceMin:price.unitPriceMin})),price.msrp>0&&price.unitPrice!==price.msrp&&React.createElement(Grid.Item,null,React.createElement(PriceStriked,{className:styles.strikedPrice,value:price.msrp,currency:price.currency})),!price.msrp&&price.unitPriceStriked>0&&price.unitPrice!==price.unitPriceStriked&&React.createElement(Grid.Item,null,React.createElement(PriceStriked,{className:styles.strikedPrice,value:price.unitPriceStriked,currency:price.currency}))),React.createElement(PriceInfo,{product:product,className:styles.basicPrice,wrapper:function wrapper(children){return React.createElement(Grid,null,React.createElement(Grid.Item,null,children));}}));};export default withPriceCalculation(ProductGridPrice);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import React from'react';import PropTypes from'prop-types';import{useWidgetSettings}from'@shopgate/engage/core';import{useThemeComponents}from'@shopgate/engage/core/hooks';import{Swiper}from'@shopgate/engage/components';import{ProductListTypeProvider,ProductListEntryProvider}from'@shopgate/engage/product/providers';import{container,items}from"./style";export var WIDGET_ID='@shopgate/engage/product/ProductSlider';/**
|
|
2
2
|
* @param {Object} props The component props.
|
|
3
|
-
* @returns {JSX
|
|
4
|
-
*/function ProductSlider(props){var autoplay=props.autoplay,className=props.className,delay=props.delay,productIds=props.productIds,snap=props.snap,scope=props.scope,meta=props.meta
|
|
5
|
-
var _useThemeComponents=useThemeComponents(),ProductCard=_useThemeComponents.ProductCard;var Item=item||ProductCard;return React.createElement(ProductListTypeProvider,{type:"productSlider",subType:scope,meta:meta},React.createElement(Swiper,_extends({},autoplay&&{autoplay:{delay:delay}},{className:"".concat(className," engage__product__product-slider"),controls:false,indicators:false,freeMode:!snap
|
|
3
|
+
* @returns {JSX}
|
|
4
|
+
*/function ProductSlider(props){var autoplay=props.autoplay,className=props.className,delay=props.delay,productIds=props.productIds,snap=props.snap,scope=props.scope,meta=props.meta;var widgetSettings=useWidgetSettings(WIDGET_ID)||{};var _ref=props.slidesPerView?props:widgetSettings,_ref$slidesPerView=_ref.slidesPerView,slidesPerView=_ref$slidesPerView===void 0?2.3:_ref$slidesPerView;// ProductSlider items are rendered with the ProductCard component provided by the theme.
|
|
5
|
+
var _useThemeComponents=useThemeComponents(),ProductCard=_useThemeComponents.ProductCard;var Item=props.item||ProductCard;return React.createElement(ProductListTypeProvider,{type:"productSlider",subType:scope,meta:meta},React.createElement(Swiper,_extends({},autoplay&&{autoplay:{delay:delay}},{className:"".concat(className," engage__product__product-slider"),controls:false,indicators:false,loop:false,freeMode:!snap,slidesPerView:slidesPerView}),productIds.map(function(id){return React.createElement(Swiper.Item,{key:id,className:container},React.createElement(ProductListEntryProvider,{productId:id},React.createElement(Item,{productId:id,style:items})));})));}ProductSlider.WIDGET_ID=WIDGET_ID;ProductSlider.defaultProps={autoplay:false,className:null,delay:10,item:null,slidesPerView:null,snap:false,scope:null,meta:null};export default ProductSlider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./Availability";export{default as Characteristics}from"./Characteristics";export{default as Description}from"./Description";export{default as EffectivityDates}from"./EffectivityDates";export{default as MapPriceHint}from"./MapPriceHint";export*from"./Media";export{default as MediaSlider}from"./MediaSlider";export{default as Options}from"./Options";export{SelectOption,TextOption}from"./Options";export{default as OrderQuantityHint}from"./OrderQuantityHint";export{default as PriceDifference}from"./PriceDifference";export*from"./PriceInfo";export{default as ProductBadges}from"./ProductBadges";export{default as ProductCard}from"./ProductCard";export{default as ProductCharacteristics}from"./ProductCharacteristics";export{default as ProductDiscountBadge}from"./ProductDiscountBadge";export{default as
|
|
1
|
+
export*from"./Availability";export{default as Characteristics}from"./Characteristics";export{default as Description}from"./Description";export{default as EffectivityDates}from"./EffectivityDates";export{default as MapPriceHint}from"./MapPriceHint";export*from"./Media";export{default as MediaSlider}from"./MediaSlider";export{default as Options}from"./Options";export{SelectOption,TextOption}from"./Options";export{default as OrderQuantityHint}from"./OrderQuantityHint";export{default as PriceDifference}from"./PriceDifference";export*from"./PriceInfo";export{default as ProductBadges}from"./ProductBadges";export{default as ProductCard}from"./ProductCard";export{default as ProductCharacteristics}from"./ProductCharacteristics";export{default as ProductDiscountBadge}from"./ProductDiscountBadge";export{default as ProductGridPrice}from"./ProductGridPrice";export{default as ProductImage}from"./ProductImage";export{default as ProductList}from"./ProductList";export*from"./ProductName";export{default as ProductProperties}from"./ProductProperties/ProductProperties";export{default as ProductSlider}from"./ProductSlider";export*from"./ProductVariants";export{default as QuantityPicker}from"./QuantityPicker";export{default as Rating}from"./Rating";export*from"./RelationsSlider";export*from"./Swatch";export*from"./Swatches";export*from"./UnitQuantityPicker";
|
package/styles/helpers/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{getCSSCustomProp,setCSSCustomProp}from"./cssCustomProperties";export{updatePageInsets}from"./updatePageInsets";export{setPageBackgroundColor}from"./setPageBackgroundColor";export{setPageContentWidth}from"./setPageContentWidth";export{setViewportHeight}from"./setViewportHeight";export{toggleBodyScroll}from"./toggleBodyScroll";export{initCSSCustomProps,initCSSCustomPropsFallback}from"./initCSSCustomProperties";export{loadCustomStyles}from"./loadCustomStyles";export
|
|
1
|
+
export{getCSSCustomProp,setCSSCustomProp}from"./cssCustomProperties";export{updatePageInsets}from"./updatePageInsets";export{setPageBackgroundColor}from"./setPageBackgroundColor";export{setPageContentWidth}from"./setPageContentWidth";export{setViewportHeight}from"./setViewportHeight";export{toggleBodyScroll}from"./toggleBodyScroll";export{initCSSCustomProps,initCSSCustomPropsFallback}from"./initCSSCustomProperties";export{loadCustomStyles}from"./loadCustomStyles";export{responsiveMediaQuery}from"../../components/ResponsiveContainer/mediaQuery";export{responsiveCondition}from"../../components/ResponsiveContainer/condition";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{themeConfig}from'@shopgate/pwa-common/helpers/config';import{hasWebBridge}from'@shopgate/engage/core/helpers';import{
|
|
1
|
+
import{themeConfig}from'@shopgate/pwa-common/helpers/config';import{hasWebBridge}from'@shopgate/engage/core/helpers';import{setCSSCustomProp}from"./cssCustomProperties";var defaultBackgroundColor=themeConfig.colors.light;/**
|
|
2
2
|
* Updates the page background color.
|
|
3
3
|
* @param {string} color The new background color.
|
|
4
4
|
*/export var setPageBackgroundColor=function setPageBackgroundColor(){var color=arguments.length>0&&arguments[0]!==undefined?arguments[0]:defaultBackgroundColor;// Curbside website changes never its background color
|
|
5
|
-
if(!hasWebBridge()
|
|
5
|
+
if(!hasWebBridge()){setCSSCustomProp('--page-background-color',color);}};
|
package/styles/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./helpers";
|
|
1
|
+
export*from"./helpers";
|
|
@@ -1,4 +1,4 @@
|
|
|
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{createSelector}from'reselect';import{appConfig}from'@shopgate/engage';import{
|
|
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{createSelector}from'reselect';import{appConfig}from'@shopgate/engage';import{appSupportsCookieConsent}from'@shopgate/engage/core/helpers';var _appConfig$cookieCons=appConfig.cookieConsent,_appConfig$cookieCons2=_appConfig$cookieCons===void 0?{}:_appConfig$cookieCons,isCookieConsentActivated=_appConfig$cookieCons2.isCookieConsentActivated,showComfortCookiesToggle=_appConfig$cookieCons2.showComfortCookiesToggle;/**
|
|
2
2
|
* Selects the cookie consent modal state.
|
|
3
3
|
* @param {Object} state The current state of the cookie consent modal.
|
|
4
4
|
* @returns {Object} whether cookie consent modal is shown.
|
|
@@ -11,7 +11,7 @@ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<argum
|
|
|
11
11
|
* inactive, app doesn't support the feature).
|
|
12
12
|
* @returns {boolean} Whether the cookie consent process is handled either by user
|
|
13
13
|
* or by app/feature settings
|
|
14
|
-
*/export var getIsCookieConsentHandled=createSelector(getCookieSettingsState,function(settingsState){if(!isCookieConsentActivated||!appSupportsCookieConsent()
|
|
14
|
+
*/export var getIsCookieConsentHandled=createSelector(getCookieSettingsState,function(settingsState){if(!isCookieConsentActivated||!appSupportsCookieConsent()){return true;}return(settingsState===null||settingsState===void 0?void 0:settingsState.comfortCookiesAccepted)!==null||(settingsState===null||settingsState===void 0?void 0:settingsState.statisticsCookiesAccepted)!==null;});/**
|
|
15
15
|
* Selects the property of the comfort cookie settings.
|
|
16
16
|
* @private This selector is intended to be used internally. When a cookie consent status needs
|
|
17
17
|
* to be checked for a feature, please use `getAreComfortCookiesAccepted` instead.
|
|
@@ -1,132 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Variant as ThemeVariant } from '../../styles/theme/createTheme/createTypography';
|
|
3
|
-
|
|
4
|
-
type Variant = ThemeVariant | 'srOnly';
|
|
5
|
-
|
|
6
|
-
export type TypographyClassKey =
|
|
7
|
-
| 'root'
|
|
8
|
-
| 'h1'
|
|
9
|
-
| 'h2'
|
|
10
|
-
| 'h3'
|
|
11
|
-
| 'h4'
|
|
12
|
-
| 'h5'
|
|
13
|
-
| 'h6'
|
|
14
|
-
| 'subtitle1'
|
|
15
|
-
| 'subtitle2'
|
|
16
|
-
| 'body1'
|
|
17
|
-
| 'body2'
|
|
18
|
-
| 'caption'
|
|
19
|
-
| 'button'
|
|
20
|
-
| 'overline'
|
|
21
|
-
| 'srOnly'
|
|
22
|
-
| 'alignLeft'
|
|
23
|
-
| 'alignCenter'
|
|
24
|
-
| 'alignRight'
|
|
25
|
-
| 'alignJustify'
|
|
26
|
-
| 'noWrap'
|
|
27
|
-
| 'gutterBottom'
|
|
28
|
-
| 'paragraph'
|
|
29
|
-
| 'colorInherit'
|
|
30
|
-
| 'colorPrimary'
|
|
31
|
-
| 'colorSecondary'
|
|
32
|
-
| 'colorTextPrimary'
|
|
33
|
-
| 'colorTextSecondary'
|
|
34
|
-
| 'colorTextTertiary'
|
|
35
|
-
| 'colorError'
|
|
36
|
-
| 'colorWarning'
|
|
37
|
-
| 'colorSuccess'
|
|
38
|
-
| 'displayInline'
|
|
39
|
-
| 'displayBlock';
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* Props for the polymorphic Typography component.
|
|
43
|
-
*
|
|
44
|
-
* @template C - the element or component type to render (defaults to 'span')
|
|
45
|
-
*/
|
|
46
|
-
export type TypographyProps<
|
|
47
|
-
C extends React.ElementType = 'span'
|
|
48
|
-
> = {
|
|
49
|
-
/**
|
|
50
|
-
* Set the text-align on the component.
|
|
51
|
-
* @default "inherit"
|
|
52
|
-
*/
|
|
53
|
-
align?: 'inherit' | 'left' | 'center' | 'right' | 'justify';
|
|
54
|
-
color?:
|
|
55
|
-
| 'initial'
|
|
56
|
-
| 'inherit'
|
|
57
|
-
| 'primary'
|
|
58
|
-
| 'secondary'
|
|
59
|
-
| 'textPrimary'
|
|
60
|
-
| 'textSecondary'
|
|
61
|
-
| 'textTertiary'
|
|
62
|
-
| 'error'
|
|
63
|
-
| 'warning'
|
|
64
|
-
| 'success';
|
|
65
|
-
/**
|
|
66
|
-
* Controls the display type
|
|
67
|
-
* @default "initial"
|
|
68
|
-
*/
|
|
69
|
-
display?: 'initial' | 'block' | 'inline';
|
|
70
|
-
/**
|
|
71
|
-
* If `true`, the text will have a bottom margin.
|
|
72
|
-
* @default false
|
|
73
|
-
*/
|
|
74
|
-
gutterBottom?: boolean;
|
|
75
|
-
/**
|
|
76
|
-
* If true, the text will not wrap, but instead will truncate with a text overflow ellipsis.
|
|
77
|
-
* Note that text overflow can only happen with block or inline-block level elements
|
|
78
|
-
* (the element needs to have a width in order to overflow).
|
|
79
|
-
* @default false
|
|
80
|
-
*/
|
|
81
|
-
noWrap?: boolean;
|
|
82
|
-
/**
|
|
83
|
-
* If true, the text will have a bottom margin.
|
|
84
|
-
* @default false
|
|
85
|
-
*/
|
|
86
|
-
paragraph?: boolean;
|
|
87
|
-
/**
|
|
88
|
-
* Applies the theme typography styles.
|
|
89
|
-
* @default "body1"
|
|
90
|
-
*/
|
|
91
|
-
variant?: Variant | 'inherit';
|
|
92
|
-
/**
|
|
93
|
-
* The component used for the root node. Either a string to use a HTML element or a component.
|
|
94
|
-
* Overrides the behavior of the variantMapping prop.
|
|
95
|
-
*/
|
|
96
|
-
component?: C;
|
|
97
|
-
/**
|
|
98
|
-
* The component maps the variant prop to a range of different HTML element types.
|
|
99
|
-
* For instance, subtitle1 to <h6>. If you wish to change that mapping, you can provide your own.
|
|
100
|
-
* Alternatively, you can use the component prop.
|
|
101
|
-
*/
|
|
102
|
-
variantMapping?: Partial<Record<Variant, string>>;
|
|
103
|
-
/**
|
|
104
|
-
* Additional CSS class names to apply to the root element.
|
|
105
|
-
*/
|
|
106
|
-
className?: string;
|
|
107
|
-
/**
|
|
108
|
-
* Override specific variant styles
|
|
109
|
-
*/
|
|
110
|
-
classes?: Partial<Record<TypographyClassKey, string>>;
|
|
111
|
-
/**
|
|
112
|
-
* Content to render inside the component
|
|
113
|
-
*/
|
|
114
|
-
children?: React.ReactNode;
|
|
115
|
-
/**
|
|
116
|
-
* Element type or custom component to render
|
|
117
|
-
* @internal
|
|
118
|
-
*/
|
|
119
|
-
as?: C;
|
|
120
|
-
} & Omit<React.ComponentPropsWithRef<C>, 'children' | 'as' | 'component'>;
|
|
121
|
-
|
|
122
|
-
/**
|
|
123
|
-
* The Typography component is used to render text with various styles and alignments.
|
|
124
|
-
* It uses the theme's typography styles and can be customized with props.
|
|
125
|
-
*/
|
|
126
|
-
export declare const Typography: <
|
|
127
|
-
C extends React.ElementType = 'span'
|
|
128
|
-
>(
|
|
129
|
-
props: TypographyProps<C> & { ref?: React.ComponentPropsWithRef<C>['ref'] }
|
|
130
|
-
) => React.ReactElement | null;
|
|
131
|
-
|
|
132
|
-
export default Typography;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
var _excluded=["align","className","color","component","display","gutterBottom","noWrap","paragraph","variant","variantMapping","classes"];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;}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;}import*as React from'react';import PropTypes from'prop-types';import{withStyles}from'@shopgate/engage/styles';import classNames from'classnames';/**
|
|
2
|
-
* Capitalizes the first letter of a string.
|
|
3
|
-
* @param {string} string The string to capitalize.
|
|
4
|
-
* @returns {string} The string with the first letter capitalized.
|
|
5
|
-
*/var capitalize=function capitalize(string){return string.charAt(0).toUpperCase()+string.slice(1);};/**
|
|
6
|
-
* @typedef {import('../../styles').Theme} Theme
|
|
7
|
-
*/ /**
|
|
8
|
-
* Creates the styles for the Typography component.
|
|
9
|
-
* @param {Theme} theme The theme object.
|
|
10
|
-
* @returns {Object} The styles object.
|
|
11
|
-
*/export var styles=function styles(theme){return{/* Styles applied to the root element. */root:{margin:0},/* Styles applied to the root element if `variant="body2"`. */body2:theme.typography.body2,/* Styles applied to the root element if `variant="body1"`. */body1:theme.typography.body1,/* Styles applied to the root element if `variant="caption"`. */caption:theme.typography.caption,/* Styles applied to the root element if `variant="button"`. */button:theme.typography.button,/* Styles applied to the root element if `variant="h1"`. */h1:theme.typography.h1,/* Styles applied to the root element if `variant="h2"`. */h2:theme.typography.h2,/* Styles applied to the root element if `variant="h3"`. */h3:theme.typography.h3,/* Styles applied to the root element if `variant="h4"`. */h4:theme.typography.h4,/* Styles applied to the root element if `variant="h5"`. */h5:theme.typography.h5,/* Styles applied to the root element if `variant="h6"`. */h6:theme.typography.h6,/* Styles applied to the root element if `variant="subtitle1"`. */subtitle1:theme.typography.subtitle1,/* Styles applied to the root element if `variant="subtitle2"`. */subtitle2:theme.typography.subtitle2,/* Styles applied to the root element if `variant="overline"`. */overline:theme.typography.overline,/* Styles applied to the root element if `variant="srOnly"`. Only accessible to screen readers. */srOnly:{position:'absolute',height:1,width:1,overflow:'hidden'},/* Styles applied to the root element if `align="left"`. */alignLeft:{textAlign:'left'},/* Styles applied to the root element if `align="center"`. */alignCenter:{textAlign:'center'},/* Styles applied to the root element if `align="right"`. */alignRight:{textAlign:'right'},/* Styles applied to the root element if `align="justify"`. */alignJustify:{textAlign:'justify'},/* Styles applied to the root element if `nowrap={true}`. */noWrap:{overflow:'hidden',textOverflow:'ellipsis',whiteSpace:'nowrap'},/* Styles applied to the root element if `gutterBottom={true}`. */gutterBottom:{marginBottom:'0.35em'},/* Styles applied to the root element if `paragraph={true}`. */paragraph:{marginBottom:16},/* Styles applied to the root element if `color="inherit"`. */colorInherit:{color:'inherit'},/* Styles applied to the root element if `color="primary"`. */colorPrimary:{color:theme.palette.primary.main},/* Styles applied to the root element if `color="secondary"`. */colorSecondary:{color:theme.palette.secondary.main},/* Styles applied to the root element if `color="textPrimary"`. */colorTextPrimary:{color:theme.palette.text.primary},/* Styles applied to the root element if `color="textSecondary"`. */colorTextSecondary:{color:theme.palette.text.secondary},colorTextTertiary:{color:theme.palette.text.tertiary},/* Styles applied to the root element if `color="error"`. */colorError:{color:theme.palette.error.main},/* Styles applied to the root element if `color="warning"` */colorWarning:{color:theme.palette.warning.main},/* Styles applied to the root element if `color="success"` */colorSuccess:{color:theme.palette.success.main},/* Styles applied to the root element if `display="inline"`. */displayInline:{display:'inline'},/* Styles applied to the root element if `display="block"`. */displayBlock:{display:'block'}};};var defaultVariantMapping={h1:'h1',h2:'h2',h3:'h3',h4:'h4',h5:'h5',h6:'h6',subtitle1:'h6',subtitle2:'h6',body1:'p',body2:'p'};var Typography=React.forwardRef(function(props,ref){var _props$align=props.align,align=_props$align===void 0?'inherit':_props$align,className=props.className,_props$color=props.color,color=_props$color===void 0?'initial':_props$color,component=props.component,_props$display=props.display,display=_props$display===void 0?'initial':_props$display,_props$gutterBottom=props.gutterBottom,gutterBottom=_props$gutterBottom===void 0?false:_props$gutterBottom,_props$noWrap=props.noWrap,noWrap=_props$noWrap===void 0?false:_props$noWrap,_props$paragraph=props.paragraph,paragraph=_props$paragraph===void 0?false:_props$paragraph,_props$variant=props.variant,variant=_props$variant===void 0?'body1':_props$variant,_props$variantMapping=props.variantMapping,variantMapping=_props$variantMapping===void 0?defaultVariantMapping:_props$variantMapping,classes=props.classes,other=_objectWithoutProperties(props,_excluded);var Component=component||(paragraph?'p':variantMapping[variant]||defaultVariantMapping[variant])||'span';return React.createElement(Component,_extends({className:classNames(classes.root,_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty({},classes[variant],variant!=='inherit'),classes["color".concat(capitalize(color))],color!=='initial'),classes.noWrap,noWrap),classes.gutterBottom,gutterBottom),classes.paragraph,paragraph),classes["align".concat(capitalize(align))],align!=='inherit'),classes["display".concat(capitalize(display))],display!=='initial'),className),ref:ref},other));});Typography.defaultProps={align:'inherit',children:null,className:undefined,color:'initial',component:null,display:'initial',gutterBottom:false,noWrap:false,paragraph:false,variant:'body1',variantMapping:defaultVariantMapping};export default withStyles(Typography,styles,{name:'Typography'});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export{default as Typography}from"./Typography";
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import{useCallback}from'react';/**
|
|
2
|
-
* @typedef {Object} PressHandlers
|
|
3
|
-
* @property {Function} onClick - Click event handler.
|
|
4
|
-
* @property {Function} onKeyDown - Keydown handler for Enter/Space.
|
|
5
|
-
*/ /**
|
|
6
|
-
* Improves development for accessibility by simplifying registration of multiple
|
|
7
|
-
* listeners (click, Enter, Space) to invoke the a callback when an element is
|
|
8
|
-
* interacted with.
|
|
9
|
-
*
|
|
10
|
-
* @param {Function} onPress Callback to run when the element is interacted with
|
|
11
|
-
* @param {Object} [options] Optional configuration
|
|
12
|
-
* @param {boolean} [options.triggerOnSpace=true] Whether Space triggers onActivate
|
|
13
|
-
* @param {boolean} [options.triggerOnEnter=false] Whether Enter triggers onActivate
|
|
14
|
-
* @returns {PressHandlers} handlers - Event handlers to spread onto an element
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```js
|
|
18
|
-
* function MyPressableButton({ onActivate }) {
|
|
19
|
-
* // Only Enter will trigger activation; Space is disabled
|
|
20
|
-
* const handlers = usePressHandler(onActivate, {
|
|
21
|
-
* triggerOnEnter: true,
|
|
22
|
-
* triggerOnSpace: false,
|
|
23
|
-
* })
|
|
24
|
-
* //
|
|
25
|
-
* return (
|
|
26
|
-
* <div
|
|
27
|
-
* {...handlers}
|
|
28
|
-
* role="button"
|
|
29
|
-
* tabIndex={0}
|
|
30
|
-
* >
|
|
31
|
-
* Press Me (Enter only)
|
|
32
|
-
* </div>
|
|
33
|
-
* )
|
|
34
|
-
* }
|
|
35
|
-
* ```
|
|
36
|
-
*/function usePressHandler(onPress){var options=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};var _options$triggerOnSpa=options.triggerOnSpace,triggerOnSpace=_options$triggerOnSpa===void 0?true:_options$triggerOnSpa,_options$triggerOnEnt=options.triggerOnEnter,triggerOnEnter=_options$triggerOnEnt===void 0?false:_options$triggerOnEnt;var handleKeyDown=useCallback(function(e){// Check for Enter
|
|
37
|
-
if(triggerOnEnter&&e.key==='Enter'){e.preventDefault();onPress(e);}// Check for Space (may be ' ' or 'Spacebar')
|
|
38
|
-
if(triggerOnSpace&&(e.key===' '||e.key==='Spacebar')){e.preventDefault();onPress(e);}},[onPress,triggerOnEnter,triggerOnSpace]);var handleClick=useCallback(function(e){onPress(e);},[onPress]);return{onClick:handleClick,onKeyDown:handleKeyDown};}export default usePressHandler;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import{REQUEST_PAGE_CONFIG_V2,RECEIVE_PAGE_CONFIG_V2,ERROR_PAGE_CONFIG_V2}from"../constants";/**
|
|
2
|
-
* @typedef {'cms' | 'category'} PageType
|
|
3
|
-
*/ /**
|
|
4
|
-
* Creates the dispatched REQUEST_PAGE_CONFIG_V2 action object.
|
|
5
|
-
* @param {Object} params The action params
|
|
6
|
-
* @param {PageType} params.type The type of the page.
|
|
7
|
-
* @param {string} [params.slug=null] The slug of the page (optional).
|
|
8
|
-
* @returns {Object} The dispatched action object.
|
|
9
|
-
*/export var requestPageConfigV2=function requestPageConfigV2(_ref){var type=_ref.type,_ref$slug=_ref.slug,slug=_ref$slug===void 0?null:_ref$slug;return{type:REQUEST_PAGE_CONFIG_V2,pageType:type,pageSlug:slug};};/**
|
|
10
|
-
* Creates the dispatched RECEIVE_PAGE_CONFIG_V2 action object.
|
|
11
|
-
* @param {Object} params The action params
|
|
12
|
-
* @param {PageType} params.type The type of the page.
|
|
13
|
-
* @param {Object} params.data The page data
|
|
14
|
-
* @param {string} [params.slug=null] The slug of the page (optional).
|
|
15
|
-
* @returns {Object} The dispatched action object.
|
|
16
|
-
*/export var receivePageConfigV2=function receivePageConfigV2(_ref2){var type=_ref2.type,data=_ref2.data,_ref2$slug=_ref2.slug,slug=_ref2$slug===void 0?null:_ref2$slug;return{type:RECEIVE_PAGE_CONFIG_V2,pageType:type,pageSlug:slug,data:data};};/**
|
|
17
|
-
* Creates the dispatched ERROR_PAGE_CONFIG_V2 action object.
|
|
18
|
-
* @param {Object} params The action params
|
|
19
|
-
* @param {PageType} params.type The type of the page.
|
|
20
|
-
* @param {string} [params.slug=null] The slug of the page (optional).
|
|
21
|
-
* @returns {Object} The dispatched action object.
|
|
22
|
-
*/export var errorPageConfigV2=function errorPageConfigV2(_ref3){var type=_ref3.type,_ref3$slug=_ref3.slug,slug=_ref3$slug===void 0?null:_ref3$slug;return{type:ERROR_PAGE_CONFIG_V2,pageType:type,pageSlug:slug};};
|