@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/index.js CHANGED
@@ -1159,6 +1159,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1159
1159
  _this.log = log;
1160
1160
  _this.callbackBeforeRedirect = callbackBeforeRedirect;
1161
1161
  _this._sessionDomain = sessionDomain;
1162
+ _this.cache.set("sessionFlowOngoing", false);
1162
1163
 
1163
1164
  // Internal hack: set to false to always refresh from hassession
1164
1165
  _this._enableSessionCaching = true;
@@ -1482,6 +1483,10 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1482
1483
  key: "hasSession",
1483
1484
  value: function hasSession() {
1484
1485
  var _this2 = this;
1486
+ var checkIfSessionOngoing = this.cache.get("sessionFlowOngoing");
1487
+ if (checkIfSessionOngoing) {
1488
+ return this._session;
1489
+ }
1485
1490
  if (this._hasSessionInProgress) {
1486
1491
  return this._hasSessionInProgress;
1487
1492
  }
@@ -1544,11 +1549,11 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1544
1549
  _context.next = 21;
1545
1550
  break;
1546
1551
  }
1547
- _context.next = 19;
1552
+ _this2.cache.set("sessionFlowOngoing", true);
1553
+ _context.next = 20;
1548
1554
  return _this2.callbackBeforeRedirect();
1549
- case 19:
1550
- _this2.window.location.href = _this2._sessionService.makeUrl(sessionData.redirectURL);
1551
- return _context.abrupt("return");
1555
+ case 20:
1556
+ return _context.abrupt("return", _this2._sessionService.makeUrl(sessionData.redirectURL));
1552
1557
  case 21:
1553
1558
  if (_this2._enableSessionCaching) {
1554
1559
  _expiresIn = 1000 * (sessionData.expiresIn || 300);
@@ -1568,6 +1573,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1568
1573
  }();
1569
1574
  this._hasSessionInProgress = _getSession().then(function (sessionData) {
1570
1575
  _this2._hasSessionInProgress = false;
1576
+ if (typeof sessionData === 'string' && Object(_validate_js__WEBPACK_IMPORTED_MODULE_55__["isUrl"])(sessionData)) {
1577
+ return _this2.window.location.href = sessionData;
1578
+ }
1571
1579
  return sessionData;
1572
1580
  }, function (err) {
1573
1581
  _this2.emit('error', err);
@@ -11930,7 +11938,7 @@ __webpack_require__.r(__webpack_exports__);
11930
11938
 
11931
11939
 
11932
11940
 
11933
- var version = '4.8.7-beta.3';
11941
+ var version = '4.8.7-beta.5';
11934
11942
  /* harmony default export */ __webpack_exports__["default"] = (version);
11935
11943
 
11936
11944
  /***/ }),