@shopgate/pwa-common 7.12.0-beta.4 → 7.12.0-beta.5
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
|
@@ -6,11 +6,11 @@ import _regeneratorRuntime from"@babel/runtime/regenerator";function _extends(){
|
|
|
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(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch){var _ref2,recaptchaEnabled,googleCloudSiteKey,recaptchaToken,request;return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_ref2=appConfig===null||appConfig===void 0?void 0:appConfig.recaptcha,recaptchaEnabled=_ref2.enabled,googleCloudSiteKey=_ref2.googleCloudSiteKey;dispatch(requestLogin(parameters.login,parameters.password,strategy));if(!(recaptchaEnabled&&googleCloudSiteKey)){_context.next=
|
|
9
|
+
*/function login(parameters,redirect){var strategy=arguments.length>2&&arguments[2]!==undefined?arguments[2]:DEFAULT_LOGIN_STRATEGY;return(/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(dispatch){var _ref2,recaptchaEnabled,googleCloudSiteKey,recaptchaToken,request;return _regeneratorRuntime.wrap(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:_ref2=appConfig===null||appConfig===void 0?void 0:appConfig.recaptcha,recaptchaEnabled=_ref2.enabled,googleCloudSiteKey=_ref2.googleCloudSiteKey;dispatch(requestLogin(parameters.login,parameters.password,strategy));if(!(recaptchaEnabled&&googleCloudSiteKey)){_context.next=13;break;}_context.prev=3;_context.next=6;return new Promise(function(resolve){return window.grecaptcha.enterprise.ready(resolve);});case 6:_context.next=8;return window.grecaptcha.enterprise.execute(googleCloudSiteKey,{action:'login'});case 8:recaptchaToken=_context.sent;_context.next=13;break;case 11:_context.prev=11;_context.t0=_context["catch"](3);case 13:request=new PipelineRequest(SHOPGATE_USER_LOGIN_USER).setTrusted().setErrorBlacklist([EINVALIDCALL,ELEGACYSGCONNECT,EINCOMPLETELOGIN]).setInput({strategy:strategy,parameters:_extends({},parameters,{},recaptchaToken?{recaptchaToken:recaptchaToken}:null)}).dispatch();request.then(function(result){var success=result.success,messages=result.messages,sessionLifetimeInSeconds=result.sessionLifetimeInSeconds;if(success){dispatch(successLogin(redirect,strategy,sessionLifetimeInSeconds));}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.
|
|
13
13
|
*/dispatch(successLogin(redirect,strategy));}else if(code===ELEGACYSGCONNECT){/**
|
|
14
14
|
* The app is connected to the shop system via the legacy shopgate connect. Login via
|
|
15
15
|
* the shop system credentials failed and further steps are necessary to login the user.
|
|
16
|
-
*/dispatch(errorLegacyConnectRegister());dispatch(errorLogin([],ELEGACYSGCONNECT));}else{dispatch(errorLogin([],code));}});return _context.abrupt("return",request);case
|
|
16
|
+
*/dispatch(errorLegacyConnectRegister());dispatch(errorLogin([],ELEGACYSGCONNECT));}else{dispatch(errorLogin([],code));}});return _context.abrupt("return",request);case 16:case"end":return _context.stop();}}},_callee,null,[[3,11]]);}));return function(_x){return _ref.apply(this,arguments);};}());}/** @mixes {MutableFunction} */export default mutable(login);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/pwa-common",
|
|
3
|
-
"version": "7.12.0-beta.
|
|
3
|
+
"version": "7.12.0-beta.5",
|
|
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": "6.0.1",
|
|
19
|
-
"@shopgate/pwa-benchmark": "7.12.0-beta.
|
|
19
|
+
"@shopgate/pwa-benchmark": "7.12.0-beta.5",
|
|
20
20
|
"@virtuous/conductor": "~2.5.0",
|
|
21
21
|
"@virtuous/react-conductor": "~2.5.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": "7.12.0-beta.
|
|
47
|
+
"@shopgate/pwa-core": "7.12.0-beta.5",
|
|
48
48
|
"lodash": "^4.17.4",
|
|
49
49
|
"prop-types": "~15.7.2",
|
|
50
50
|
"react": "~16.12.0",
|