@shopgate/pwa-common-commerce 7.5.0-beta.4 → 7.5.0-beta.8
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.5.0-beta.
|
|
3
|
+
"version": "7.5.0-beta.8",
|
|
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": "^3.0.1"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
|
-
"@shopgate/pwa-common": "7.5.0-beta.
|
|
23
|
-
"@shopgate/pwa-core": "7.5.0-beta.
|
|
22
|
+
"@shopgate/pwa-common": "7.5.0-beta.8",
|
|
23
|
+
"@shopgate/pwa-core": "7.5.0-beta.8",
|
|
24
24
|
"lodash": "^4.17.4",
|
|
25
25
|
"react": "~16.12.0",
|
|
26
26
|
"react-dom": "~16.12.0"
|
|
@@ -3,4 +3,7 @@ function _extends(){_extends=Object.assign||function(target){for(var i=1;i<argum
|
|
|
3
3
|
* @param {string} productId The product ID.
|
|
4
4
|
* @param {boolean} forceFetch Skips shouldFetchData check. Always fetches.
|
|
5
5
|
* @return {Function} A redux thunk.
|
|
6
|
-
*/function fetchProduct(productId){var forceFetch=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;return function(dispatch,getState){var state=getState();var product=getProductById(state,{productId:productId});if(!forceFetch&&!shouldFetchData(product)){if(product.productData){
|
|
6
|
+
*/function fetchProduct(productId){var forceFetch=arguments.length>1&&arguments[1]!==undefined?arguments[1]:false;return function(dispatch,getState){var state=getState();var product=getProductById(state,{productId:productId});if(!forceFetch&&!shouldFetchData(product)){if(product.productData){/*
|
|
7
|
+
This timeout is needed here to make sure receivedVisibleProduct$ comes after
|
|
8
|
+
productWillEnter$. Otherwise productIsReady$ is not working correctly.
|
|
9
|
+
*/setTimeout(function(){dispatch(receiveProductCached(product.productData));},0);}return undefined;}var path=getCurrentPathname(state);LoadingProvider.setLoading(path);var requestParams=_extends({},configuration.get(DEFAULT_PRODUCTS_FETCH_PARAMS),{productId:productId});dispatch(requestProduct(productId,forceFetch));var request=new PipelineRequest(SHOPGATE_CATALOG_GET_PRODUCT).setInput(requestParams).dispatch();request.then(function(result){LoadingProvider.unsetLoading(path);dispatch(receiveProduct(productId,result));})["catch"](function(error){LoadingProvider.unsetLoading(path);dispatch(errorProduct(productId,error.code));});return request;};}/** @mixes {MutableFunction} */export default mutable(fetchProduct);
|
|
@@ -198,7 +198,7 @@ var _product$baseProductI=product.baseProductId,baseProductId=_product$baseProdu
|
|
|
198
198
|
* @return {Array|null}
|
|
199
199
|
*/export var getProductImages=createSelector(getProductImagesState,getProductId,getBaseProductId,function(images,productId,baseProductId){var _ref4=images[productId]||{},productImages=_ref4.images,isFetching=_ref4.isFetching;if(isFetching){return null;}// If the product doesn't have images after fetching
|
|
200
200
|
if(baseProductId&&(!Array.isArray(productImages)||!productImages.length)){// ...check the base product.
|
|
201
|
-
var _ref5=images[baseProductId]||{},baseProductImages=_ref5.images;if(!Array.isArray(baseProductImages)||!baseProductImages.length){return null;}return baseProductImages;}return productImages||null;});/**
|
|
201
|
+
var _ref5=images[baseProductId]||{},baseProductImages=_ref5.images;if(!Array.isArray(baseProductImages)||!baseProductImages.length){return null;}return baseProductImages;}return productImages||null;});export var getFeaturedImage=createSelector(getProduct,getBaseProduct,function(product,baseProduct){var productImage=null;var baseProductImage=null;if(product===null||product===void 0?void 0:product.featuredMedia){productImage=product.featuredMedia.type==='image'?product.featuredMedia.url:null;}if(baseProduct===null||baseProduct===void 0?void 0:baseProduct.featuredMedia){baseProductImage=baseProduct.featuredMedia.type==='image'?baseProduct.featuredMedia.url:null;}return productImage||baseProductImage||(product===null||product===void 0?void 0:product.featuredImageBaseUrl)||(product===null||product===void 0?void 0:product.featuredImageUrl);});/**
|
|
202
202
|
* Retrieves the product variant data.
|
|
203
203
|
* @param {Object} state The current application state.
|
|
204
204
|
* @param {Object} props The component props.
|