@schibsted/account-sdk-browser 4.8.7-beta.3 → 4.8.7-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/es5/global.js CHANGED
@@ -2036,6 +2036,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2036
2036
  _this.log = log;
2037
2037
  _this.callbackBeforeRedirect = callbackBeforeRedirect;
2038
2038
  _this._sessionDomain = sessionDomain;
2039
+ _this.cache.set("sessionFlowOngoing", false);
2039
2040
 
2040
2041
  // Internal hack: set to false to always refresh from hassession
2041
2042
  _this._enableSessionCaching = true;
@@ -2359,6 +2360,10 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2359
2360
  key: "hasSession",
2360
2361
  value: function hasSession() {
2361
2362
  var _this2 = this;
2363
+ var checkIfSessionOngoing = this.cache.get("sessionFlowOngoing");
2364
+ if (checkIfSessionOngoing) {
2365
+ return this._session;
2366
+ }
2362
2367
  if (this._hasSessionInProgress) {
2363
2368
  return this._hasSessionInProgress;
2364
2369
  }
@@ -2421,11 +2426,11 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2421
2426
  _context.next = 21;
2422
2427
  break;
2423
2428
  }
2424
- _context.next = 19;
2429
+ _this2.cache.set("sessionFlowOngoing", true);
2430
+ _context.next = 20;
2425
2431
  return _this2.callbackBeforeRedirect();
2426
- case 19:
2427
- _this2.window.location.href = _this2._sessionService.makeUrl(sessionData.redirectURL);
2428
- return _context.abrupt("return");
2432
+ case 20:
2433
+ return _context.abrupt("return", _this2._sessionService.makeUrl(sessionData.redirectURL));
2429
2434
  case 21:
2430
2435
  if (_this2._enableSessionCaching) {
2431
2436
  _expiresIn = 1000 * (sessionData.expiresIn || 300);
@@ -2445,6 +2450,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2445
2450
  }();
2446
2451
  this._hasSessionInProgress = _getSession().then(function (sessionData) {
2447
2452
  _this2._hasSessionInProgress = false;
2453
+ if (typeof sessionData === 'string' && Object(_validate_js__WEBPACK_IMPORTED_MODULE_55__["isUrl"])(sessionData)) {
2454
+ return _this2.window.location.href = sessionData;
2455
+ }
2448
2456
  return sessionData;
2449
2457
  }, function (err) {
2450
2458
  _this2.emit('error', err);
@@ -11958,7 +11966,7 @@ __webpack_require__.r(__webpack_exports__);
11958
11966
 
11959
11967
 
11960
11968
 
11961
- var version = '4.8.7-beta.3';
11969
+ var version = '4.8.7-beta.5';
11962
11970
  /* harmony default export */ __webpack_exports__["default"] = (version);
11963
11971
 
11964
11972
  /***/ }),