@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/global.js CHANGED
@@ -2036,6 +2036,10 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2036
2036
  _this.log = log;
2037
2037
  _this.callbackBeforeRedirect = callbackBeforeRedirect;
2038
2038
  _this._sessionDomain = sessionDomain;
2039
+ if (_this._enableSessionCaching) {
2040
+ var expiresIn = 1000 * 300;
2041
+ _this.cache.set("sessionFlowOngoing", false, expiresIn);
2042
+ }
2039
2043
 
2040
2044
  // Internal hack: set to false to always refresh from hassession
2041
2045
  _this._enableSessionCaching = true;
@@ -2359,6 +2363,10 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2359
2363
  key: "hasSession",
2360
2364
  value: function hasSession() {
2361
2365
  var _this2 = this;
2366
+ var checkIfSessionOngoing = this.cache.get("sessionFlowOngoing");
2367
+ if (checkIfSessionOngoing) {
2368
+ return this._session;
2369
+ }
2362
2370
  if (this._hasSessionInProgress) {
2363
2371
  return this._hasSessionInProgress;
2364
2372
  }
@@ -2378,7 +2386,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2378
2386
  };
2379
2387
  var _getSession = /*#__PURE__*/function () {
2380
2388
  var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
2381
- var cachedSession, sessionData, expiresIn, _expiresIn;
2389
+ var cachedSession, sessionData, expiresIn, _expiresIn, _expiresIn2;
2382
2390
  return _regeneratorRuntime().wrap(function _callee$(_context) {
2383
2391
  while (1) switch (_context.prev = _context.next) {
2384
2392
  case 0:
@@ -2414,25 +2422,29 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2414
2422
  throw _context.t0;
2415
2423
  case 15:
2416
2424
  if (!sessionData) {
2417
- _context.next = 21;
2425
+ _context.next = 22;
2418
2426
  break;
2419
2427
  }
2420
2428
  if (!_checkRedirectionNeed(sessionData)) {
2421
- _context.next = 20;
2429
+ _context.next = 21;
2422
2430
  break;
2423
2431
  }
2424
- _context.next = 19;
2432
+ if (_this2._enableSessionCaching) {
2433
+ _expiresIn = 1000 * 300;
2434
+ _this2.cache.set("sessionFlowOngoing", true, _expiresIn);
2435
+ }
2436
+ _context.next = 20;
2425
2437
  return _this2.callbackBeforeRedirect();
2426
- case 19:
2427
- return _context.abrupt("return", _this2._sessionService.makeUrl(sessionData.redirectURL));
2428
2438
  case 20:
2439
+ return _context.abrupt("return", _this2._sessionService.makeUrl(sessionData.redirectURL));
2440
+ case 21:
2429
2441
  if (_this2._enableSessionCaching) {
2430
- _expiresIn = 1000 * (sessionData.expiresIn || 300);
2431
- _this2.cache.set(HAS_SESSION_CACHE_KEY, sessionData, _expiresIn);
2442
+ _expiresIn2 = 1000 * (sessionData.expiresIn || 300);
2443
+ _this2.cache.set(HAS_SESSION_CACHE_KEY, sessionData, _expiresIn2);
2432
2444
  }
2433
- case 21:
2434
- return _context.abrupt("return", _postProcess(sessionData));
2435
2445
  case 22:
2446
+ return _context.abrupt("return", _postProcess(sessionData));
2447
+ case 23:
2436
2448
  case "end":
2437
2449
  return _context.stop();
2438
2450
  }
@@ -11960,7 +11972,7 @@ __webpack_require__.r(__webpack_exports__);
11960
11972
 
11961
11973
 
11962
11974
 
11963
- var version = '4.8.7-beta.4';
11975
+ var version = '4.8.7-beta.6';
11964
11976
  /* harmony default export */ __webpack_exports__["default"] = (version);
11965
11977
 
11966
11978
  /***/ }),