@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/index.js CHANGED
@@ -1159,6 +1159,10 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1159
1159
  _this.log = log;
1160
1160
  _this.callbackBeforeRedirect = callbackBeforeRedirect;
1161
1161
  _this._sessionDomain = sessionDomain;
1162
+ if (_this._enableSessionCaching) {
1163
+ var expiresIn = 1000 * 300;
1164
+ _this.cache.set("sessionFlowOngoing", false, expiresIn);
1165
+ }
1162
1166
 
1163
1167
  // Internal hack: set to false to always refresh from hassession
1164
1168
  _this._enableSessionCaching = true;
@@ -1482,6 +1486,10 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1482
1486
  key: "hasSession",
1483
1487
  value: function hasSession() {
1484
1488
  var _this2 = this;
1489
+ var checkIfSessionOngoing = this.cache.get("sessionFlowOngoing");
1490
+ if (checkIfSessionOngoing) {
1491
+ return this._session;
1492
+ }
1485
1493
  if (this._hasSessionInProgress) {
1486
1494
  return this._hasSessionInProgress;
1487
1495
  }
@@ -1501,7 +1509,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1501
1509
  };
1502
1510
  var _getSession = /*#__PURE__*/function () {
1503
1511
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
1504
- var cachedSession, sessionData, expiresIn, _expiresIn;
1512
+ var cachedSession, sessionData, expiresIn, _expiresIn, _expiresIn2;
1505
1513
  return _regeneratorRuntime().wrap(function _callee$(_context) {
1506
1514
  while (1) switch (_context.prev = _context.next) {
1507
1515
  case 0:
@@ -1537,25 +1545,29 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1537
1545
  throw _context.t0;
1538
1546
  case 15:
1539
1547
  if (!sessionData) {
1540
- _context.next = 21;
1548
+ _context.next = 22;
1541
1549
  break;
1542
1550
  }
1543
1551
  if (!_checkRedirectionNeed(sessionData)) {
1544
- _context.next = 20;
1552
+ _context.next = 21;
1545
1553
  break;
1546
1554
  }
1547
- _context.next = 19;
1555
+ if (_this2._enableSessionCaching) {
1556
+ _expiresIn = 1000 * 300;
1557
+ _this2.cache.set("sessionFlowOngoing", true, _expiresIn);
1558
+ }
1559
+ _context.next = 20;
1548
1560
  return _this2.callbackBeforeRedirect();
1549
- case 19:
1550
- return _context.abrupt("return", _this2._sessionService.makeUrl(sessionData.redirectURL));
1551
1561
  case 20:
1562
+ return _context.abrupt("return", _this2._sessionService.makeUrl(sessionData.redirectURL));
1563
+ case 21:
1552
1564
  if (_this2._enableSessionCaching) {
1553
- _expiresIn = 1000 * (sessionData.expiresIn || 300);
1554
- _this2.cache.set(HAS_SESSION_CACHE_KEY, sessionData, _expiresIn);
1565
+ _expiresIn2 = 1000 * (sessionData.expiresIn || 300);
1566
+ _this2.cache.set(HAS_SESSION_CACHE_KEY, sessionData, _expiresIn2);
1555
1567
  }
1556
- case 21:
1557
- return _context.abrupt("return", _postProcess(sessionData));
1558
1568
  case 22:
1569
+ return _context.abrupt("return", _postProcess(sessionData));
1570
+ case 23:
1559
1571
  case "end":
1560
1572
  return _context.stop();
1561
1573
  }
@@ -11932,7 +11944,7 @@ __webpack_require__.r(__webpack_exports__);
11932
11944
 
11933
11945
 
11934
11946
 
11935
- var version = '4.8.7-beta.4';
11947
+ var version = '4.8.7-beta.6';
11936
11948
  /* harmony default export */ __webpack_exports__["default"] = (version);
11937
11949
 
11938
11950
  /***/ }),