@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/identity.js CHANGED
@@ -1153,6 +1153,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1153
1153
  _this.log = log;
1154
1154
  _this.callbackBeforeRedirect = callbackBeforeRedirect;
1155
1155
  _this._sessionDomain = sessionDomain;
1156
+ _this.cache.set("sessionFlowOngoing", false);
1156
1157
 
1157
1158
  // Internal hack: set to false to always refresh from hassession
1158
1159
  _this._enableSessionCaching = true;
@@ -1476,6 +1477,10 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1476
1477
  key: "hasSession",
1477
1478
  value: function hasSession() {
1478
1479
  var _this2 = this;
1480
+ var checkIfSessionOngoing = this.cache.get("sessionFlowOngoing");
1481
+ if (checkIfSessionOngoing) {
1482
+ return this._session;
1483
+ }
1479
1484
  if (this._hasSessionInProgress) {
1480
1485
  return this._hasSessionInProgress;
1481
1486
  }
@@ -1538,11 +1543,11 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1538
1543
  _context.next = 21;
1539
1544
  break;
1540
1545
  }
1541
- _context.next = 19;
1546
+ _this2.cache.set("sessionFlowOngoing", true);
1547
+ _context.next = 20;
1542
1548
  return _this2.callbackBeforeRedirect();
1543
- case 19:
1544
- _this2.window.location.href = _this2._sessionService.makeUrl(sessionData.redirectURL);
1545
- return _context.abrupt("return");
1549
+ case 20:
1550
+ return _context.abrupt("return", _this2._sessionService.makeUrl(sessionData.redirectURL));
1546
1551
  case 21:
1547
1552
  if (_this2._enableSessionCaching) {
1548
1553
  _expiresIn = 1000 * (sessionData.expiresIn || 300);
@@ -1562,6 +1567,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1562
1567
  }();
1563
1568
  this._hasSessionInProgress = _getSession().then(function (sessionData) {
1564
1569
  _this2._hasSessionInProgress = false;
1570
+ if (typeof sessionData === 'string' && Object(_validate_js__WEBPACK_IMPORTED_MODULE_55__["isUrl"])(sessionData)) {
1571
+ return _this2.window.location.href = sessionData;
1572
+ }
1565
1573
  return sessionData;
1566
1574
  }, function (err) {
1567
1575
  _this2.emit('error', err);
@@ -11924,7 +11932,7 @@ __webpack_require__.r(__webpack_exports__);
11924
11932
 
11925
11933
 
11926
11934
 
11927
- var version = '4.8.7-beta.3';
11935
+ var version = '4.8.7-beta.5';
11928
11936
  /* harmony default export */ __webpack_exports__["default"] = (version);
11929
11937
 
11930
11938
  /***/ })