@schibsted/account-sdk-browser 4.8.7-beta.4 → 4.8.7-beta.6

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,10 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1153
1153
  _this.log = log;
1154
1154
  _this.callbackBeforeRedirect = callbackBeforeRedirect;
1155
1155
  _this._sessionDomain = sessionDomain;
1156
+ if (_this._enableSessionCaching) {
1157
+ var expiresIn = 1000 * 300;
1158
+ _this.cache.set("sessionFlowOngoing", false, expiresIn);
1159
+ }
1156
1160
 
1157
1161
  // Internal hack: set to false to always refresh from hassession
1158
1162
  _this._enableSessionCaching = true;
@@ -1476,6 +1480,10 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1476
1480
  key: "hasSession",
1477
1481
  value: function hasSession() {
1478
1482
  var _this2 = this;
1483
+ var checkIfSessionOngoing = this.cache.get("sessionFlowOngoing");
1484
+ if (checkIfSessionOngoing) {
1485
+ return this._session;
1486
+ }
1479
1487
  if (this._hasSessionInProgress) {
1480
1488
  return this._hasSessionInProgress;
1481
1489
  }
@@ -1495,7 +1503,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1495
1503
  };
1496
1504
  var _getSession = /*#__PURE__*/function () {
1497
1505
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1498
- var cachedSession, sessionData, expiresIn, _expiresIn;
1506
+ var cachedSession, sessionData, expiresIn, _expiresIn, _expiresIn2;
1499
1507
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1500
1508
  while (1) switch (_context.prev = _context.next) {
1501
1509
  case 0:
@@ -1531,25 +1539,29 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1531
1539
  throw _context.t0;
1532
1540
  case 15:
1533
1541
  if (!sessionData) {
1534
- _context.next = 21;
1542
+ _context.next = 22;
1535
1543
  break;
1536
1544
  }
1537
1545
  if (!_checkRedirectionNeed(sessionData)) {
1538
- _context.next = 20;
1546
+ _context.next = 21;
1539
1547
  break;
1540
1548
  }
1541
- _context.next = 19;
1549
+ if (_this2._enableSessionCaching) {
1550
+ _expiresIn = 1000 * 300;
1551
+ _this2.cache.set("sessionFlowOngoing", true, _expiresIn);
1552
+ }
1553
+ _context.next = 20;
1542
1554
  return _this2.callbackBeforeRedirect();
1543
- case 19:
1544
- return _context.abrupt("return", _this2._sessionService.makeUrl(sessionData.redirectURL));
1545
1555
  case 20:
1556
+ return _context.abrupt("return", _this2._sessionService.makeUrl(sessionData.redirectURL));
1557
+ case 21:
1546
1558
  if (_this2._enableSessionCaching) {
1547
- _expiresIn = 1000 * (sessionData.expiresIn || 300);
1548
- _this2.cache.set(HAS_SESSION_CACHE_KEY, sessionData, _expiresIn);
1559
+ _expiresIn2 = 1000 * (sessionData.expiresIn || 300);
1560
+ _this2.cache.set(HAS_SESSION_CACHE_KEY, sessionData, _expiresIn2);
1549
1561
  }
1550
- case 21:
1551
- return _context.abrupt("return", _postProcess(sessionData));
1552
1562
  case 22:
1563
+ return _context.abrupt("return", _postProcess(sessionData));
1564
+ case 23:
1553
1565
  case "end":
1554
1566
  return _context.stop();
1555
1567
  }
@@ -11926,7 +11938,7 @@ __webpack_require__.r(__webpack_exports__);
11926
11938
 
11927
11939
 
11928
11940
 
11929
- var version = '4.8.7-beta.4';
11941
+ var version = '4.8.7-beta.6';
11930
11942
  /* harmony default export */ __webpack_exports__["default"] = (version);
11931
11943
 
11932
11944
  /***/ })