@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/identity.js CHANGED
@@ -1150,12 +1150,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1150
1150
  _this._sessionInitiatedSent = false;
1151
1151
  _this.window = window;
1152
1152
  _this.clientId = clientId;
1153
- _this.sessionStorageCache = new _cache_js__WEBPACK_IMPORTED_MODULE_60__["default"](function () {
1153
+ _this.cache = new _cache_js__WEBPACK_IMPORTED_MODULE_60__["default"](function () {
1154
1154
  return _this.window && _this.window.sessionStorage;
1155
1155
  });
1156
- _this.localStorageCache = new _cache_js__WEBPACK_IMPORTED_MODULE_60__["default"](function () {
1157
- return _this.window && _this.window.localStorage;
1158
- });
1159
1156
  _this.redirectUri = redirectUri;
1160
1157
  _this.env = env;
1161
1158
  _this.log = log;
@@ -1185,9 +1182,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1185
1182
  key: "_getTabId",
1186
1183
  value: function _getTabId() {
1187
1184
  if (this._enableSessionCaching) {
1188
- var tabId = this.sessionStorageCache.get(TAB_ID_KEY);
1185
+ var tabId = this.cache.get(TAB_ID_KEY);
1189
1186
  if (!tabId) {
1190
- this.sessionStorageCache.set(TAB_ID_KEY, TAB_ID, TAB_ID_TTL);
1187
+ this.cache.set(TAB_ID_KEY, TAB_ID, TAB_ID_TTL);
1191
1188
  return TAB_ID;
1192
1189
  }
1193
1190
  return tabId;
@@ -1203,7 +1200,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1203
1200
  }, {
1204
1201
  key: "_isSessionCallBlocked",
1205
1202
  value: function _isSessionCallBlocked() {
1206
- return this.localStorageCache.get(SESSION_CALL_BLOCKED_CACHE_KEY);
1203
+ if (this._enableSessionCaching) {
1204
+ return this.cache.get(SESSION_CALL_BLOCKED_CACHE_KEY);
1205
+ }
1207
1206
  }
1208
1207
 
1209
1208
  /**
@@ -1215,8 +1214,10 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1215
1214
  }, {
1216
1215
  key: "_blockSessionCall",
1217
1216
  value: function _blockSessionCall() {
1218
- var SESSION_CALL_BLOCKED = true;
1219
- this.localStorageCache.set(SESSION_CALL_BLOCKED_CACHE_KEY, SESSION_CALL_BLOCKED, SESSION_CALL_BLOCKED_TTL);
1217
+ if (this._enableSessionCaching) {
1218
+ var SESSION_CALL_BLOCKED = true;
1219
+ this.cache.set(SESSION_CALL_BLOCKED_CACHE_KEY, SESSION_CALL_BLOCKED, SESSION_CALL_BLOCKED_TTL);
1220
+ }
1220
1221
  }
1221
1222
 
1222
1223
  /**
@@ -1228,7 +1229,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1228
1229
  }, {
1229
1230
  key: "_unblockSessionCall",
1230
1231
  value: function _unblockSessionCall() {
1231
- this.localStorageCache.delete(SESSION_CALL_BLOCKED_CACHE_KEY);
1232
+ if (this._enableSessionCaching) {
1233
+ this.cache.delete(SESSION_CALL_BLOCKED_CACHE_KEY);
1234
+ }
1232
1235
  }
1233
1236
 
1234
1237
  /**
@@ -1572,7 +1575,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1572
1575
  break;
1573
1576
  }
1574
1577
  // Try to resolve from cache (it has a TTL)
1575
- cachedSession = _this2.sessionStorageCache.get(HAS_SESSION_CACHE_KEY);
1578
+ cachedSession = _this2.cache.get(HAS_SESSION_CACHE_KEY);
1576
1579
  if (!cachedSession) {
1577
1580
  _context.next = 4;
1578
1581
  break;
@@ -1594,7 +1597,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1594
1597
  _context.t0 = _context["catch"](5);
1595
1598
  if (_context.t0 && _context.t0.code === 400 && _this2._enableSessionCaching) {
1596
1599
  expiresIn = 1000 * (_context.t0.expiresIn || 300);
1597
- _this2.sessionStorageCache.set(HAS_SESSION_CACHE_KEY, {
1600
+ _this2.cache.set(HAS_SESSION_CACHE_KEY, {
1598
1601
  error: _context.t0
1599
1602
  }, expiresIn);
1600
1603
  }
@@ -1618,7 +1621,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1618
1621
  case 21:
1619
1622
  if (_this2._enableSessionCaching) {
1620
1623
  _expiresIn = 1000 * (sessionData.expiresIn || 300);
1621
- _this2.sessionStorageCache.set(HAS_SESSION_CACHE_KEY, sessionData, _expiresIn);
1624
+ _this2.cache.set(HAS_SESSION_CACHE_KEY, sessionData, _expiresIn);
1622
1625
  }
1623
1626
  case 22:
1624
1627
  return _context.abrupt("return", _postProcess(sessionData));
@@ -1689,7 +1692,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1689
1692
  }, {
1690
1693
  key: "clearCachedUserSession",
1691
1694
  value: function clearCachedUserSession() {
1692
- this.sessionStorageCache.delete(HAS_SESSION_CACHE_KEY);
1695
+ this.cache.delete(HAS_SESSION_CACHE_KEY);
1693
1696
  }
1694
1697
 
1695
1698
  /**
@@ -2084,7 +2087,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2084
2087
  _ref4$prompt = _ref4.prompt,
2085
2088
  prompt = _ref4$prompt === void 0 ? 'select_account' : _ref4$prompt;
2086
2089
  this._closePopup();
2087
- this.sessionStorageCache.delete(HAS_SESSION_CACHE_KEY);
2090
+ this.cache.delete(HAS_SESSION_CACHE_KEY);
2088
2091
  var url = this.loginUrl({
2089
2092
  state: state,
2090
2093
  acrValues: acrValues,
@@ -2157,7 +2160,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2157
2160
  key: "logout",
2158
2161
  value: function logout() {
2159
2162
  var redirectUri = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.redirectUri;
2160
- this.sessionStorageCache.delete(HAS_SESSION_CACHE_KEY);
2163
+ this.cache.delete(HAS_SESSION_CACHE_KEY);
2161
2164
  this._maybeClearVarnishCookie();
2162
2165
  this.emit('logout');
2163
2166
  this.window.location.href = this.logoutUrl(redirectUri);
@@ -11999,7 +12002,7 @@ __webpack_require__.r(__webpack_exports__);
11999
12002
 
12000
12003
 
12001
12004
 
12002
- var version = '5.0.0-beta.2';
12005
+ var version = '5.0.1';
12003
12006
  /* harmony default export */ __webpack_exports__["default"] = (version);
12004
12007
 
12005
12008
  /***/ })