@shopgate/pwa-common 6.18.8 → 6.18.100
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/actions/user/login.js +2 -2
- package/package.json +3 -3
package/actions/user/login.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{PipelineRequest,EINVALIDCALL,ELEGACYSGCONNECT,EINCOMPLETELOGIN}from'@shopgate/pwa-core';import{requestLogin,successLogin,errorLogin,errorLegacyConnectRegister}from"../../action-creators/user";import{SHOPGATE_USER_LOGIN_USER}from"../../constants/Pipelines";import{DEFAULT_LOGIN_STRATEGY}from"../../constants/user";import{mutable}from"../../helpers/redux";/**
|
|
1
|
+
import _regeneratorRuntime from"@babel/runtime/regenerator";function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}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{PipelineRequest,EINVALIDCALL,ELEGACYSGCONNECT,EINCOMPLETELOGIN}from'@shopgate/pwa-core';import{requestLogin,successLogin,errorLogin,errorLegacyConnectRegister}from"../../action-creators/user";import{SHOPGATE_USER_LOGIN_USER}from"../../constants/Pipelines";import{DEFAULT_LOGIN_STRATEGY}from"../../constants/user";import{mutable}from"../../helpers/redux";/**
|
|
2
2
|
* Login the current user.
|
|
3
3
|
* @param {Object} parameters The login credentials.
|
|
4
4
|
* @param {string} parameters.login The username to login.
|
|
@@ -6,7 +6,7 @@ import{PipelineRequest,EINVALIDCALL,ELEGACYSGCONNECT,EINCOMPLETELOGIN}from'@shop
|
|
|
6
6
|
* @param {string} redirect The location to redirect to when logged in.
|
|
7
7
|
* @param {string} strategy basic or facebook, amazon, etc
|
|
8
8
|
* @return {Function} A redux thunk.
|
|
9
|
-
*/function login(parameters,redirect){var strategy=arguments.length>2&&arguments[2]!==undefined?arguments[2]:DEFAULT_LOGIN_STRATEGY;return function(dispatch){dispatch(requestLogin(parameters.login,parameters.password,strategy));var request=new PipelineRequest(SHOPGATE_USER_LOGIN_USER).setTrusted().setErrorBlacklist([EINVALIDCALL,ELEGACYSGCONNECT,EINCOMPLETELOGIN]).setInput({strategy:strategy,parameters:parameters}).dispatch();request.then(function(result){var success=result.success,messages=result.messages;if(success){dispatch(successLogin(redirect,strategy));}else{dispatch(errorLogin(messages));}})["catch"](function(error){var code=error.code;if(code===EINVALIDCALL){/**
|
|
9
|
+
*/function login(parameters,redirect){var strategy=arguments.length>2&&arguments[2]!==undefined?arguments[2]:DEFAULT_LOGIN_STRATEGY;return function(dispatch){dispatch(requestLogin(parameters.login,parameters.password,strategy));var request=new Promise(function(resolve){return window.grecaptcha.enterprise.ready(resolve);}).then(/*#__PURE__*/_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(){var result;return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.next=2;return window.grecaptcha.enterprise.execute('6LeB-CgpAAAAAD-NGyWz9YQ-ahJFvnl1ADf1_gVn',{action:'login'});case 2:result=_context.sent;return _context.abrupt("return",result);case 4:case"end":return _context.stop();}}},_callee);}))).then(function(token){return new PipelineRequest(SHOPGATE_USER_LOGIN_USER).setTrusted().setErrorBlacklist([EINVALIDCALL,ELEGACYSGCONNECT,EINCOMPLETELOGIN]).setInput({strategy:strategy,parameters:_extends({},parameters,{recaptchaToken:token})}).dispatch();});request.then(function(result){var success=result.success,messages=result.messages;if(success){dispatch(successLogin(redirect,strategy));}else{dispatch(errorLogin(messages));}})["catch"](function(error){var code=error.code;if(code===EINVALIDCALL){/**
|
|
10
10
|
* This code is thrown when the login request failed, because the user was already logged
|
|
11
11
|
* in. In that situation the success action can also dispatch to trigger the necessary
|
|
12
12
|
* processes which has to happen after a successful login.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-common",
|
|
3
|
-
"version": "6.18.
|
|
3
|
+
"version": "6.18.100",
|
|
4
4
|
"description": "Common library for the Shopgate Connect PWA.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Shopgate <support@shopgate.com>",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@sentry/browser": "^4.6.3",
|
|
19
|
-
"@shopgate/pwa-benchmark": "6.18.
|
|
19
|
+
"@shopgate/pwa-benchmark": "6.18.100",
|
|
20
20
|
"@virtuous/conductor": "~2.4.0",
|
|
21
21
|
"@virtuous/react-conductor": "~2.4.0",
|
|
22
22
|
"@virtuous/redux-persister": "1.1.0-beta.7",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"url-search-params": "^0.10.0"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@shopgate/pwa-core": "6.18.
|
|
47
|
+
"@shopgate/pwa-core": "6.18.100",
|
|
48
48
|
"lodash": "^4.17.4",
|
|
49
49
|
"prop-types": "~15.7.2",
|
|
50
50
|
"react": "~16.12.0",
|