@schibsted/account-sdk-browser 5.0.0-beta.2 → 5.0.1

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
@@ -2033,12 +2033,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2033
2033
  _this._sessionInitiatedSent = false;
2034
2034
  _this.window = window;
2035
2035
  _this.clientId = clientId;
2036
- _this.sessionStorageCache = new _cache_js__WEBPACK_IMPORTED_MODULE_60__["default"](function () {
2036
+ _this.cache = new _cache_js__WEBPACK_IMPORTED_MODULE_60__["default"](function () {
2037
2037
  return _this.window && _this.window.sessionStorage;
2038
2038
  });
2039
- _this.localStorageCache = new _cache_js__WEBPACK_IMPORTED_MODULE_60__["default"](function () {
2040
- return _this.window && _this.window.localStorage;
2041
- });
2042
2039
  _this.redirectUri = redirectUri;
2043
2040
  _this.env = env;
2044
2041
  _this.log = log;
@@ -2068,9 +2065,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2068
2065
  key: "_getTabId",
2069
2066
  value: function _getTabId() {
2070
2067
  if (this._enableSessionCaching) {
2071
- var tabId = this.sessionStorageCache.get(TAB_ID_KEY);
2068
+ var tabId = this.cache.get(TAB_ID_KEY);
2072
2069
  if (!tabId) {
2073
- this.sessionStorageCache.set(TAB_ID_KEY, TAB_ID, TAB_ID_TTL);
2070
+ this.cache.set(TAB_ID_KEY, TAB_ID, TAB_ID_TTL);
2074
2071
  return TAB_ID;
2075
2072
  }
2076
2073
  return tabId;
@@ -2086,7 +2083,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2086
2083
  }, {
2087
2084
  key: "_isSessionCallBlocked",
2088
2085
  value: function _isSessionCallBlocked() {
2089
- return this.localStorageCache.get(SESSION_CALL_BLOCKED_CACHE_KEY);
2086
+ if (this._enableSessionCaching) {
2087
+ return this.cache.get(SESSION_CALL_BLOCKED_CACHE_KEY);
2088
+ }
2090
2089
  }
2091
2090
 
2092
2091
  /**
@@ -2098,8 +2097,10 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2098
2097
  }, {
2099
2098
  key: "_blockSessionCall",
2100
2099
  value: function _blockSessionCall() {
2101
- var SESSION_CALL_BLOCKED = true;
2102
- this.localStorageCache.set(SESSION_CALL_BLOCKED_CACHE_KEY, SESSION_CALL_BLOCKED, SESSION_CALL_BLOCKED_TTL);
2100
+ if (this._enableSessionCaching) {
2101
+ var SESSION_CALL_BLOCKED = true;
2102
+ this.cache.set(SESSION_CALL_BLOCKED_CACHE_KEY, SESSION_CALL_BLOCKED, SESSION_CALL_BLOCKED_TTL);
2103
+ }
2103
2104
  }
2104
2105
 
2105
2106
  /**
@@ -2111,7 +2112,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2111
2112
  }, {
2112
2113
  key: "_unblockSessionCall",
2113
2114
  value: function _unblockSessionCall() {
2114
- this.localStorageCache.delete(SESSION_CALL_BLOCKED_CACHE_KEY);
2115
+ if (this._enableSessionCaching) {
2116
+ this.cache.delete(SESSION_CALL_BLOCKED_CACHE_KEY);
2117
+ }
2115
2118
  }
2116
2119
 
2117
2120
  /**
@@ -2455,7 +2458,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2455
2458
  break;
2456
2459
  }
2457
2460
  // Try to resolve from cache (it has a TTL)
2458
- cachedSession = _this2.sessionStorageCache.get(HAS_SESSION_CACHE_KEY);
2461
+ cachedSession = _this2.cache.get(HAS_SESSION_CACHE_KEY);
2459
2462
  if (!cachedSession) {
2460
2463
  _context.next = 4;
2461
2464
  break;
@@ -2477,7 +2480,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2477
2480
  _context.t0 = _context["catch"](5);
2478
2481
  if (_context.t0 && _context.t0.code === 400 && _this2._enableSessionCaching) {
2479
2482
  expiresIn = 1000 * (_context.t0.expiresIn || 300);
2480
- _this2.sessionStorageCache.set(HAS_SESSION_CACHE_KEY, {
2483
+ _this2.cache.set(HAS_SESSION_CACHE_KEY, {
2481
2484
  error: _context.t0
2482
2485
  }, expiresIn);
2483
2486
  }
@@ -2501,7 +2504,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2501
2504
  case 21:
2502
2505
  if (_this2._enableSessionCaching) {
2503
2506
  _expiresIn = 1000 * (sessionData.expiresIn || 300);
2504
- _this2.sessionStorageCache.set(HAS_SESSION_CACHE_KEY, sessionData, _expiresIn);
2507
+ _this2.cache.set(HAS_SESSION_CACHE_KEY, sessionData, _expiresIn);
2505
2508
  }
2506
2509
  case 22:
2507
2510
  return _context.abrupt("return", _postProcess(sessionData));
@@ -2572,7 +2575,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2572
2575
  }, {
2573
2576
  key: "clearCachedUserSession",
2574
2577
  value: function clearCachedUserSession() {
2575
- this.sessionStorageCache.delete(HAS_SESSION_CACHE_KEY);
2578
+ this.cache.delete(HAS_SESSION_CACHE_KEY);
2576
2579
  }
2577
2580
 
2578
2581
  /**
@@ -2967,7 +2970,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2967
2970
  _ref4$prompt = _ref4.prompt,
2968
2971
  prompt = _ref4$prompt === void 0 ? 'select_account' : _ref4$prompt;
2969
2972
  this._closePopup();
2970
- this.sessionStorageCache.delete(HAS_SESSION_CACHE_KEY);
2973
+ this.cache.delete(HAS_SESSION_CACHE_KEY);
2971
2974
  var url = this.loginUrl({
2972
2975
  state: state,
2973
2976
  acrValues: acrValues,
@@ -3040,7 +3043,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
3040
3043
  key: "logout",
3041
3044
  value: function logout() {
3042
3045
  var redirectUri = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.redirectUri;
3043
- this.sessionStorageCache.delete(HAS_SESSION_CACHE_KEY);
3046
+ this.cache.delete(HAS_SESSION_CACHE_KEY);
3044
3047
  this._maybeClearVarnishCookie();
3045
3048
  this.emit('logout');
3046
3049
  this.window.location.href = this.logoutUrl(redirectUri);
@@ -12033,7 +12036,7 @@ __webpack_require__.r(__webpack_exports__);
12033
12036
 
12034
12037
 
12035
12038
 
12036
- var version = '5.0.0-beta.2';
12039
+ var version = '5.0.1';
12037
12040
  /* harmony default export */ __webpack_exports__["default"] = (version);
12038
12041
 
12039
12042
  /***/ }),