@shopgate/engage
Version:
Shopgate's ENGAGE library.
1 lines • 1.98 kB
JavaScript
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{getGeolocation}from'@shopgate/engage/core';import setUserSearchGeolocation from"../action-creators/setUserSearchGeolocation";export default(function(){var _ref=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{},_ref$silent=_ref.silent,silent=_ref$silent===void 0?false:_ref$silent,_ref$useFallback=_ref.useFallback,useFallback=_ref$useFallback===void 0?false:_ref$useFallback,_ref$productId=_ref.productId,productId=_ref$productId===void 0?null:_ref$productId,_ref$isStoreFinder=_ref.isStoreFinder,isStoreFinder=_ref$isStoreFinder===void 0?false:_ref$isStoreFinder;return(/*#__PURE__*/function(){var _ref2=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch){var geolocation;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.prev=0;_context.next=3;return dispatch(getGeolocation({useSettingsModal:!silent,requestPermissions:!useFallback}));case 3:geolocation=_context.sent;dispatch(setUserSearchGeolocation(geolocation,productId,isStoreFinder,silent));return _context.abrupt("return",geolocation);case 8:_context.prev=8;_context.t0=_context["catch"](0);return _context.abrupt("return",null);case 11:case"end":return _context.stop();}},_callee,null,[[0,8]]);}));return function(_x){return _ref2.apply(this,arguments);};}());});