@schibsted/account-sdk-browser 5.0.0 → 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
@@ -1103,6 +1103,9 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
1103
1103
  var HAS_SESSION_CACHE_KEY = 'hasSession-cache';
1104
1104
  var SESSION_CALL_BLOCKED_CACHE_KEY = 'sessionCallBlocked-cache';
1105
1105
  var SESSION_CALL_BLOCKED_TTL = 1000 * 60 * 5;
1106
+ var TAB_ID_KEY = 'tab-id-cache';
1107
+ var TAB_ID = Math.floor(Math.random() * 100000);
1108
+ var TAB_ID_TTL = 1000 * 60 * 60 * 24 * 30;
1106
1109
  var globalWindow = function globalWindow() {
1107
1110
  return window;
1108
1111
  };
@@ -1171,12 +1174,30 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1171
1174
  }
1172
1175
 
1173
1176
  /**
1174
- * Checks if getting session is blocked
1177
+ * Read tabId from session storage
1178
+ * @returns {number}
1175
1179
  * @private
1176
- *
1177
- * @returns {boolean|void}
1178
1180
  */
1179
1181
  _createClass(Identity, [{
1182
+ key: "_getTabId",
1183
+ value: function _getTabId() {
1184
+ if (this._enableSessionCaching) {
1185
+ var tabId = this.cache.get(TAB_ID_KEY);
1186
+ if (!tabId) {
1187
+ this.cache.set(TAB_ID_KEY, TAB_ID, TAB_ID_TTL);
1188
+ return TAB_ID;
1189
+ }
1190
+ return tabId;
1191
+ }
1192
+ }
1193
+
1194
+ /**
1195
+ * Checks if getting session is blocked
1196
+ * @private
1197
+ *
1198
+ * @returns {boolean|void}
1199
+ */
1200
+ }, {
1180
1201
  key: "_isSessionCallBlocked",
1181
1202
  value: function _isSessionCallBlocked() {
1182
1203
  if (this._enableSessionCaching) {
@@ -1564,7 +1585,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1564
1585
  sessionData = null;
1565
1586
  _context.prev = 5;
1566
1587
  _context.next = 8;
1567
- return _this2._sessionService.get('/v2/session');
1588
+ return _this2._sessionService.get('/v2/session', {
1589
+ tabId: _this2._getTabId()
1590
+ });
1568
1591
  case 8:
1569
1592
  sessionData = _context.sent;
1570
1593
  _context.next = 15;
@@ -1592,7 +1615,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1592
1615
  _context.next = 20;
1593
1616
  return _this2.callbackBeforeRedirect();
1594
1617
  case 20:
1595
- return _context.abrupt("return", _this2._sessionService.makeUrl(sessionData.redirectURL));
1618
+ return _context.abrupt("return", _this2._sessionService.makeUrl(sessionData.redirectURL, {
1619
+ tabId: _this2._getTabId()
1620
+ }));
1596
1621
  case 21:
1597
1622
  if (_this2._enableSessionCaching) {
1598
1623
  _expiresIn = 1000 * (sessionData.expiresIn || 300);
@@ -11977,7 +12002,7 @@ __webpack_require__.r(__webpack_exports__);
11977
12002
 
11978
12003
 
11979
12004
 
11980
- var version = '5.0.0';
12005
+ var version = '5.0.1';
11981
12006
  /* harmony default export */ __webpack_exports__["default"] = (version);
11982
12007
 
11983
12008
  /***/ })