@shopgate/pwa-common-commerce 7.5.0-beta.2 → 7.5.0-beta.3

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.2",
3
+ "version": "7.5.0-beta.3",
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.2",
23
- "@shopgate/pwa-core": "7.5.0-beta.2",
22
+ "@shopgate/pwa-common": "7.5.0-beta.3",
23
+ "@shopgate/pwa-core": "7.5.0-beta.3",
24
24
  "lodash": "^4.17.4",
25
25
  "react": "~16.12.0",
26
26
  "react-dom": "~16.12.0"
@@ -1,7 +1,7 @@
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 handleSearch from"./handleSearch";import handleNoResults from"./handleNoResults";import successHandleScanner from"../action-creators/successHandleScanner";/**
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{mutable}from'@shopgate/pwa-common/helpers/redux';import handleSearch from"./handleSearch";import handleNoResults from"./handleNoResults";import successHandleScanner from"../action-creators/successHandleScanner";/**
2
2
  * Handle bar code
3
3
  * @param {ScannerEvent} event Scanner event that emitted.
4
4
  * @param {string} format Format of the scanned code.
5
5
  * @param {string} payload Barcode payload.
6
6
  * @return {Function} A redux thunk.
7
- */export default(function(event){return(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch){var scope,format,payload;return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:scope=event.scope,format=event.format,payload=event.payload;_context.next=3;return dispatch(handleSearch(payload));case 3:if(!_context.sent){_context.next=7;break;}dispatch(successHandleScanner(scope,format,payload));_context.next=8;break;case 7:dispatch(handleNoResults(event,'scanner.noResult.barCode'));case 8:case"end":return _context.stop();}}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}());});
7
+ */var handleBarCode=function handleBarCode(event){return(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch){var scope,format,payload;return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:scope=event.scope,format=event.format,payload=event.payload;_context.next=3;return dispatch(handleSearch(payload));case 3:if(!_context.sent){_context.next=7;break;}dispatch(successHandleScanner(scope,format,payload));_context.next=8;break;case 7:dispatch(handleNoResults(event,'scanner.noResult.barCode'));case 8:case"end":return _context.stop();}}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}());};/** @mixes {MutableFunction} */export default mutable(handleBarCode);
@@ -1,6 +1,6 @@
1
- import _regeneratorRuntime from"@babel/runtime/regenerator";function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}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{historyReplace}from'@shopgate/pwa-common/actions/router';import fetchProductsByQuery from'@shopgate/pwa-common-commerce/product/actions/fetchProductsByQuery';import{getProductRoute}from'@shopgate/pwa-common-commerce/product/helpers';import{getSearchRoute}from'@shopgate/pwa-common-commerce/search/helpers';/**
1
+ import _regeneratorRuntime from"@babel/runtime/regenerator";function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}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{historyReplace}from'@shopgate/pwa-common/actions/router';import{mutable}from'@shopgate/pwa-common/helpers/redux';import fetchProductsByQuery from'@shopgate/pwa-common-commerce/product/actions/fetchProductsByQuery';import{getProductRoute}from'@shopgate/pwa-common-commerce/product/helpers';import{getSearchRoute}from'@shopgate/pwa-common-commerce/search/helpers';/**
2
2
  * Handle product search. The thunk will return false if nothing was found or true if it processed
3
3
  * the action as it should.
4
4
  * @param {string} searchPhrase The search phrase.
5
5
  * @return {Function} A redux thunk.
6
- */export default(function(searchPhrase){return(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch){var _ref2,_ref2$products,products,_products,first,productId;return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return dispatch(fetchProductsByQuery(2,searchPhrase));case 2:_ref2=_context.sent;_ref2$products=_ref2.products;products=_ref2$products===void 0?[]:_ref2$products;if(products.length){_context.next=7;break;}return _context.abrupt("return",false);case 7:if(products.length===1){_products=_slicedToArray(products,1),first=_products[0];productId=typeof first==='string'?first:first.id;dispatch(historyReplace({pathname:getProductRoute(productId)}));}else{dispatch(historyReplace({pathname:getSearchRoute(searchPhrase)}));}return _context.abrupt("return",true);case 9:case"end":return _context.stop();}}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}());});
6
+ */var handleSearch=function handleSearch(searchPhrase){return(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch){var _ref2,_ref2$products,products,_products,first,productId;return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return dispatch(fetchProductsByQuery(2,searchPhrase));case 2:_ref2=_context.sent;_ref2$products=_ref2.products;products=_ref2$products===void 0?[]:_ref2$products;if(products.length){_context.next=7;break;}return _context.abrupt("return",false);case 7:if(products.length===1){_products=_slicedToArray(products,1),first=_products[0];productId=typeof first==='string'?first:first.id;dispatch(historyReplace({pathname:getProductRoute(productId)}));}else{dispatch(historyReplace({pathname:getSearchRoute(searchPhrase)}));}return _context.abrupt("return",true);case 9:case"end":return _context.stop();}}},_callee);}));return function(_x){return _ref.apply(this,arguments);};}());};/** @mixes {MutableFunction} */export default mutable(handleSearch);