@shopgate/pwa-common-commerce 6.23.0 → 6.23.2-rc.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/cart/reducers/index.js +3 -1
- package/package.json +3 -3
package/cart/reducers/index.js
CHANGED
|
@@ -6,4 +6,6 @@ var _excluded=["cartItems"];function _objectWithoutProperties(source,excluded){i
|
|
|
6
6
|
* @return {Object} The new state.
|
|
7
7
|
*/export default(function(){var state=arguments.length>0&&arguments[0]!==undefined?arguments[0]:defaultState;var action=arguments.length>1?arguments[1]:undefined;switch(action.type){case ADD_PRODUCTS_TO_CART:case ERROR_ADD_PRODUCTS_TO_CART:{return state;}case DELETE_PRODUCTS_FROM_CART:{return _extends({},state,{items:remove(state.items,function(item){return!action.cartItemIds.includes(item.id);})});}case UPDATE_PRODUCTS_IN_CART:{return _extends({},state,{items:state.items.map(function(item){var updateData=action.updateData;// Search the stored cart item, which shall be updated
|
|
8
8
|
var match=updateData.find(function(update){return item.id===update.cartItemId;});// Apply the updated quantity to the cart item in the store.
|
|
9
|
-
return _extends({},item,typeof match!=='undefined'&&{quantity:match.quantity});})});}case REQUEST_CART:{return _extends({},state,{isFetching:true,expires:0});}case RECEIVE_CART:{var _action$cart=action.cart,cartItems=_action$cart.cartItems,cart=_objectWithoutProperties(_action$cart,_excluded);return _extends({},state,cart,{
|
|
9
|
+
return _extends({},item,typeof match!=='undefined'&&{quantity:match.quantity});})});}case REQUEST_CART:{return _extends({},state,{isFetching:true,expires:0});}case RECEIVE_CART:{var _cart$flags$orderable,_cart$flags,_cart$flags$taxInclud,_cart$flags2;var _action$cart=action.cart,cartItems=_action$cart.cartItems,cart=_objectWithoutProperties(_action$cart,_excluded);return _extends({},state,cart,{// Map cart flags to properties on root level to establish compatibility with getCart
|
|
10
|
+
// pipelines that don't return "isOrderable" and "isTaxIncluded" flags
|
|
11
|
+
isOrderable:(_cart$flags$orderable=cart===null||cart===void 0?void 0:(_cart$flags=cart.flags)===null||_cart$flags===void 0?void 0:_cart$flags.orderable)!==null&&_cart$flags$orderable!==void 0?_cart$flags$orderable:true,isTaxIncluded:(_cart$flags$taxInclud=cart===null||cart===void 0?void 0:(_cart$flags2=cart.flags)===null||_cart$flags2===void 0?void 0:_cart$flags2.taxIncluded)!==null&&_cart$flags$taxInclud!==void 0?_cart$flags$taxInclud:true,expires:0,items:cartItems,isFetching:false,productPendingCount:0});}case ERROR_CART:return _extends({},state,{isFetching:false,expires:0});case SET_CART_PENDING_PRODUCT_COUNT:return _extends({},state,{productPendingCount:Math.max(0,action.count)});default:return state;}});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-common-commerce",
|
|
3
|
-
"version": "6.23.
|
|
3
|
+
"version": "6.23.2-rc.1",
|
|
4
4
|
"description": "Commerce library for the Shopgate Connect PWA.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Shopgate <support@shopgate.com>",
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
"reselect": "^3.0.1"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@shopgate/pwa-common": "6.23.
|
|
22
|
-
"@shopgate/pwa-core": "6.23.
|
|
21
|
+
"@shopgate/pwa-common": "6.23.2-rc.1",
|
|
22
|
+
"@shopgate/pwa-core": "6.23.2-rc.1",
|
|
23
23
|
"lodash": "^4.17.4",
|
|
24
24
|
"react": "~16.12.0",
|
|
25
25
|
"react-dom": "~16.12.0"
|