@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/index.js CHANGED
@@ -1156,12 +1156,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1156
1156
  _this._sessionInitiatedSent = false;
1157
1157
  _this.window = window;
1158
1158
  _this.clientId = clientId;
1159
- _this.sessionStorageCache = new _cache_js__WEBPACK_IMPORTED_MODULE_60__["default"](function () {
1159
+ _this.cache = new _cache_js__WEBPACK_IMPORTED_MODULE_60__["default"](function () {
1160
1160
  return _this.window && _this.window.sessionStorage;
1161
1161
  });
1162
- _this.localStorageCache = new _cache_js__WEBPACK_IMPORTED_MODULE_60__["default"](function () {
1163
- return _this.window && _this.window.localStorage;
1164
- });
1165
1162
  _this.redirectUri = redirectUri;
1166
1163
  _this.env = env;
1167
1164
  _this.log = log;
@@ -1191,9 +1188,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1191
1188
  key: "_getTabId",
1192
1189
  value: function _getTabId() {
1193
1190
  if (this._enableSessionCaching) {
1194
- var tabId = this.sessionStorageCache.get(TAB_ID_KEY);
1191
+ var tabId = this.cache.get(TAB_ID_KEY);
1195
1192
  if (!tabId) {
1196
- this.sessionStorageCache.set(TAB_ID_KEY, TAB_ID, TAB_ID_TTL);
1193
+ this.cache.set(TAB_ID_KEY, TAB_ID, TAB_ID_TTL);
1197
1194
  return TAB_ID;
1198
1195
  }
1199
1196
  return tabId;
@@ -1209,7 +1206,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1209
1206
  }, {
1210
1207
  key: "_isSessionCallBlocked",
1211
1208
  value: function _isSessionCallBlocked() {
1212
- return this.localStorageCache.get(SESSION_CALL_BLOCKED_CACHE_KEY);
1209
+ if (this._enableSessionCaching) {
1210
+ return this.cache.get(SESSION_CALL_BLOCKED_CACHE_KEY);
1211
+ }
1213
1212
  }
1214
1213
 
1215
1214
  /**
@@ -1221,8 +1220,10 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1221
1220
  }, {
1222
1221
  key: "_blockSessionCall",
1223
1222
  value: function _blockSessionCall() {
1224
- var SESSION_CALL_BLOCKED = true;
1225
- this.localStorageCache.set(SESSION_CALL_BLOCKED_CACHE_KEY, SESSION_CALL_BLOCKED, SESSION_CALL_BLOCKED_TTL);
1223
+ if (this._enableSessionCaching) {
1224
+ var SESSION_CALL_BLOCKED = true;
1225
+ this.cache.set(SESSION_CALL_BLOCKED_CACHE_KEY, SESSION_CALL_BLOCKED, SESSION_CALL_BLOCKED_TTL);
1226
+ }
1226
1227
  }
1227
1228
 
1228
1229
  /**
@@ -1234,7 +1235,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1234
1235
  }, {
1235
1236
  key: "_unblockSessionCall",
1236
1237
  value: function _unblockSessionCall() {
1237
- this.localStorageCache.delete(SESSION_CALL_BLOCKED_CACHE_KEY);
1238
+ if (this._enableSessionCaching) {
1239
+ this.cache.delete(SESSION_CALL_BLOCKED_CACHE_KEY);
1240
+ }
1238
1241
  }
1239
1242
 
1240
1243
  /**
@@ -1578,7 +1581,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1578
1581
  break;
1579
1582
  }
1580
1583
  // Try to resolve from cache (it has a TTL)
1581
- cachedSession = _this2.sessionStorageCache.get(HAS_SESSION_CACHE_KEY);
1584
+ cachedSession = _this2.cache.get(HAS_SESSION_CACHE_KEY);
1582
1585
  if (!cachedSession) {
1583
1586
  _context.next = 4;
1584
1587
  break;
@@ -1600,7 +1603,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1600
1603
  _context.t0 = _context["catch"](5);
1601
1604
  if (_context.t0 && _context.t0.code === 400 && _this2._enableSessionCaching) {
1602
1605
  expiresIn = 1000 * (_context.t0.expiresIn || 300);
1603
- _this2.sessionStorageCache.set(HAS_SESSION_CACHE_KEY, {
1606
+ _this2.cache.set(HAS_SESSION_CACHE_KEY, {
1604
1607
  error: _context.t0
1605
1608
  }, expiresIn);
1606
1609
  }
@@ -1624,7 +1627,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1624
1627
  case 21:
1625
1628
  if (_this2._enableSessionCaching) {
1626
1629
  _expiresIn = 1000 * (sessionData.expiresIn || 300);
1627
- _this2.sessionStorageCache.set(HAS_SESSION_CACHE_KEY, sessionData, _expiresIn);
1630
+ _this2.cache.set(HAS_SESSION_CACHE_KEY, sessionData, _expiresIn);
1628
1631
  }
1629
1632
  case 22:
1630
1633
  return _context.abrupt("return", _postProcess(sessionData));
@@ -1695,7 +1698,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1695
1698
  }, {
1696
1699
  key: "clearCachedUserSession",
1697
1700
  value: function clearCachedUserSession() {
1698
- this.sessionStorageCache.delete(HAS_SESSION_CACHE_KEY);
1701
+ this.cache.delete(HAS_SESSION_CACHE_KEY);
1699
1702
  }
1700
1703
 
1701
1704
  /**
@@ -2090,7 +2093,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2090
2093
  _ref4$prompt = _ref4.prompt,
2091
2094
  prompt = _ref4$prompt === void 0 ? 'select_account' : _ref4$prompt;
2092
2095
  this._closePopup();
2093
- this.sessionStorageCache.delete(HAS_SESSION_CACHE_KEY);
2096
+ this.cache.delete(HAS_SESSION_CACHE_KEY);
2094
2097
  var url = this.loginUrl({
2095
2098
  state: state,
2096
2099
  acrValues: acrValues,
@@ -2163,7 +2166,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2163
2166
  key: "logout",
2164
2167
  value: function logout() {
2165
2168
  var redirectUri = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.redirectUri;
2166
- this.sessionStorageCache.delete(HAS_SESSION_CACHE_KEY);
2169
+ this.cache.delete(HAS_SESSION_CACHE_KEY);
2167
2170
  this._maybeClearVarnishCookie();
2168
2171
  this.emit('logout');
2169
2172
  this.window.location.href = this.logoutUrl(redirectUri);
@@ -12005,7 +12008,7 @@ __webpack_require__.r(__webpack_exports__);
12005
12008
 
12006
12009
 
12007
12010
 
12008
- var version = '5.0.0-beta.2';
12011
+ var version = '5.0.1';
12009
12012
  /* harmony default export */ __webpack_exports__["default"] = (version);
12010
12013
 
12011
12014
  /***/ }),