@shopgate/pwa-common-commerce 7.23.0 → 7.23.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-common-commerce",
|
|
3
|
-
"version": "7.23.
|
|
3
|
+
"version": "7.23.1",
|
|
4
4
|
"description": "Commerce library for the Shopgate Connect PWA.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Shopgate <support@shopgate.com>",
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
"reselect": "^4.1.8"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@shopgate/pwa-common": "7.23.
|
|
23
|
-
"@shopgate/pwa-core": "7.23.
|
|
22
|
+
"@shopgate/pwa-common": "7.23.1",
|
|
23
|
+
"@shopgate/pwa-core": "7.23.1",
|
|
24
24
|
"lodash": "^4.17.4",
|
|
25
25
|
"react": "~16.14.0",
|
|
26
26
|
"react-dom": "~16.14.0"
|
|
@@ -4,6 +4,6 @@ function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimi
|
|
|
4
4
|
*/function product(subscribe){var processProduct$=productReceived$.merge(cachedProductReceived$);subscribe(productWillEnter$,function(_ref){var action=_ref.action,dispatch=_ref.dispatch;var productId=action.route.params.productId;var variantId=action.route.state.productId;var id=variantId||hex2bin(productId);dispatch(fetchProduct(id));dispatch(fetchProductDescription(id));dispatch(fetchProductProperties(id));dispatch(fetchProductImages(id));dispatch(fetchProductShipping(id));/**
|
|
5
5
|
* This feature is currently in BETA testing.
|
|
6
6
|
* It should only be used for approved BETA Client Projects
|
|
7
|
-
*/dispatch(fetchProductMedia(id));});subscribe(galleryWillEnter$,function(_ref2){var action=_ref2.action,dispatch=_ref2.dispatch;var productId=action.route.params.productId;dispatch(fetchProductImages(hex2bin(productId)));
|
|
7
|
+
*/dispatch(fetchProductMedia(id));});subscribe(galleryWillEnter$,function(_ref2){var action=_ref2.action,dispatch=_ref2.dispatch;var productId=action.route.params.productId;dispatch(fetchProductImages(hex2bin(productId)));});subscribe(processProduct$,function(_ref3){var action=_ref3.action,dispatch=_ref3.dispatch;var _action$productData=action.productData,id=_action$productData.id,_action$productData$f=_action$productData.flags,flags=_action$productData$f===void 0?{hasVariants:false,hasOptions:false}:_action$productData$f,baseProductId=_action$productData.baseProductId,active=_action$productData.active;if(baseProductId){dispatch(fetchProduct(baseProductId));dispatch(fetchProductImages(baseProductId));}if(active&&flags.hasVariants){dispatch(fetchProductVariants(id));}if(active&&flags.hasOptions){dispatch(fetchProductOptions(id));}});var errorProductResourcesNotFoundFirst$=receivedVisibleProduct$.filter(function(_ref4){var _action$productData2;var action=_ref4.action;var active=action===null||action===void 0?void 0:(_action$productData2=action.productData)===null||_action$productData2===void 0?void 0:_action$productData2.active;return!!active;}).switchMap(function(){return errorProductResourcesNotFound$.first();});/** Refresh product data after some of resources has ENOTFOUND code */subscribe(errorProductResourcesNotFoundFirst$,function(_ref5){var action=_ref5.action,dispatch=_ref5.dispatch;var productId=action.productId;dispatch(fetchProduct(productId,true));});var productNotFound$=visibleProductNotFound$.withLatestFrom(receivedVisibleProduct$.startWith({action:{productData:{}}}));/** Visible product is no more available */subscribe(productNotFound$,function(_ref6){var _ref7=_slicedToArray(_ref6,2),_ref7$=_ref7[0],action=_ref7$.action,dispatch=_ref7$.dispatch,productData=_ref7[1].action.productData;var productId=action.productId;var name=productData.id===productId?productData.name:productId;dispatch(showModal({confirm:null,dismiss:'modal.ok',title:'modal.title_error',message:'product.no_more_found',params:{name:name}}));dispatch(historyPop());dispatch(expireProductById(productId));});subscribe(productRelationsReceived$,function(_ref8){var dispatch=_ref8.dispatch,getState=_ref8.getState,action=_ref8.action;var hash=action.hash;var productIds=getProductRelationsByHash(hash)(getState());dispatch(fetchProductsById(productIds));});/**
|
|
8
8
|
* Expire products after checkout, fetch updated data
|
|
9
9
|
*/subscribe(checkoutSucceeded$,function(_ref9){var dispatch=_ref9.dispatch,action=_ref9.action;var products=action.products;var productIds=products.map(function(p){return p.product.id;});productIds.forEach(function(id){return dispatch(expireProductById(id));});dispatch(fetchProductsById(productIds));});var productNotAvailableEffDates$=productNotAvailable$.filter(function(_ref10){var action=_ref10.action;return action.reason===NOT_AVAILABLE_EFFECTIVITY_DATES;});/** PDP expired effectivity dates */var productNotAvailableEffDatesPDP$=productNotAvailableEffDates$.withLatestFrom(routeWillEnter$).filter(function(_ref11){var _ref12=_slicedToArray(_ref11,2),notAvailable=_ref12[0],willEnter=_ref12[1];return willEnter.action.route.pattern===ITEM_PATTERN&¬Available.action.productId===willEnter.action.route.state.productId;}).map(function(_ref13){var _ref14=_slicedToArray(_ref13,1),notAvailable=_ref14[0];return notAvailable;});subscribe(productNotAvailableEffDatesPDP$,function(_ref15){var action=_ref15.action,getState=_ref15.getState,dispatch=_ref15.dispatch,events=_ref15.events;var _ref16=getThemeSettings('product')||{},_ref16$effectivityDat=_ref16.effectivityDates,_ref16$effectivityDat2=_ref16$effectivityDat===void 0?{}:_ref16$effectivityDat,accessExpired=_ref16$effectivityDat2.accessExpired;if(accessExpired===false){var productId=action.productId;dispatch(historyPop());var name=getProductName(getState(),{productId:productId});events.emit(ToastProvider.ADD,{id:'product.available.not_search_similar',message:'product.available.not_search_similar',messageParams:{name:name},action:function action(){return dispatch(historyPush({pathname:getSearchRoute(name)}));}});}});/** Expired effectivity dates products after PLP leave */var productNotAvailableEffDatesPLP$=productNotAvailableEffDates$.buffer(routeWillLeave$).filter(function(buffered){return buffered.length;});subscribe(productNotAvailableEffDatesPLP$,function(buffered){var _buffered=_slicedToArray(buffered,1),dispatch=_buffered[0].dispatch;var productIds=buffered.map(function(params){return params.action.productId;});dispatch(expireProductById(productIds,true));});subscribe(fetchProductsRequested$,function(_ref17){var dispatch=_ref17.dispatch,productId=_ref17.action.productId;dispatch(fetchProductsById(Array.isArray(productId)?productId:[productId]));});}export default product;
|