@shopgate/pwa-common-commerce 7.12.3 → 7.12.4-beta.2
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.
|
@@ -5,4 +5,4 @@ import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGenera
|
|
|
5
5
|
* @returns {Function} A redux thunk.
|
|
6
6
|
*/function fetchFavorites(){var ignoreCache=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;var listId=arguments.length>1&&arguments[1]!==undefined?arguments[1]:undefined;return(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch,getState){var lists,defaultList,takenListId,data,timestamp,request,result;return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:// Fallback for deprecated calls without list id.
|
|
7
7
|
lists=getState().favorites.lists.lists;defaultList=(lists===null||lists===void 0?void 0:lists[0])||{code:'DEFAULT'};takenListId=listId||defaultList.code;// Check cache.
|
|
8
|
-
data=getState().favorites.products.byList[takenListId];if(!(!ignoreCache&&!shouldFetchData(data))){_context.next=6;break;}return _context.abrupt("return",null);case 6:timestamp=Date.now();dispatch(requestFavorites(takenListId));request=new PipelineRequest(SHOPGATE_USER_GET_FAVORITES).setVersion(2).setInput({favoritesListId:takenListId}).setErrorBlacklist([EFAVORITE,EUNKNOWN,EBIGAPI,ELIMIT]).dispatch();_context.prev=9;_context.next=12;return request;case 12:result=_context.sent;dispatch(
|
|
8
|
+
data=getState().favorites.products.byList[takenListId];if(!(!ignoreCache&&!shouldFetchData(data))){_context.next=6;break;}return _context.abrupt("return",null);case 6:timestamp=Date.now();dispatch(requestFavorites(takenListId));request=new PipelineRequest(SHOPGATE_USER_GET_FAVORITES).setVersion(2).setInput({favoritesListId:takenListId}).setErrorBlacklist([EFAVORITE,EUNKNOWN,EBIGAPI,ELIMIT]).dispatch();_context.prev=9;_context.next=12;return request;case 12:result=_context.sent;dispatch(receiveProducts({products:result.items.map(function(_ref2){var product=_ref2.product;return product;}),fetchInventory:false}));dispatch(receiveFavorites(result.items,timestamp,takenListId));return _context.abrupt("return",result);case 18:_context.prev=18;_context.t0=_context["catch"](9);dispatch(errorFetchFavorites(_context.t0,takenListId));return _context.abrupt("return",null);case 22:case"end":return _context.stop();}}},_callee,null,[[9,18]]);}));return function(_x,_x2){return _ref.apply(this,arguments);};}());}/** @mixes {MutableFunction} */export default mutable(fetchFavorites);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-common-commerce",
|
|
3
|
-
"version": "7.12.
|
|
3
|
+
"version": "7.12.4-beta.2",
|
|
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.12.
|
|
23
|
-
"@shopgate/pwa-core": "7.12.
|
|
22
|
+
"@shopgate/pwa-common": "7.12.4-beta.2",
|
|
23
|
+
"@shopgate/pwa-core": "7.12.4-beta.2",
|
|
24
24
|
"lodash": "^4.17.4",
|
|
25
25
|
"react": "~16.12.0",
|
|
26
26
|
"react-dom": "~16.12.0"
|