@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/index.js CHANGED
@@ -1109,6 +1109,9 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
1109
1109
  var HAS_SESSION_CACHE_KEY = 'hasSession-cache';
1110
1110
  var SESSION_CALL_BLOCKED_CACHE_KEY = 'sessionCallBlocked-cache';
1111
1111
  var SESSION_CALL_BLOCKED_TTL = 1000 * 60 * 5;
1112
+ var TAB_ID_KEY = 'tab-id-cache';
1113
+ var TAB_ID = Math.floor(Math.random() * 100000);
1114
+ var TAB_ID_TTL = 1000 * 60 * 60 * 24 * 30;
1112
1115
  var globalWindow = function globalWindow() {
1113
1116
  return window;
1114
1117
  };
@@ -1177,12 +1180,30 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1177
1180
  }
1178
1181
 
1179
1182
  /**
1180
- * Checks if getting session is blocked
1183
+ * Read tabId from session storage
1184
+ * @returns {number}
1181
1185
  * @private
1182
- *
1183
- * @returns {boolean|void}
1184
1186
  */
1185
1187
  _createClass(Identity, [{
1188
+ key: "_getTabId",
1189
+ value: function _getTabId() {
1190
+ if (this._enableSessionCaching) {
1191
+ var tabId = this.cache.get(TAB_ID_KEY);
1192
+ if (!tabId) {
1193
+ this.cache.set(TAB_ID_KEY, TAB_ID, TAB_ID_TTL);
1194
+ return TAB_ID;
1195
+ }
1196
+ return tabId;
1197
+ }
1198
+ }
1199
+
1200
+ /**
1201
+ * Checks if getting session is blocked
1202
+ * @private
1203
+ *
1204
+ * @returns {boolean|void}
1205
+ */
1206
+ }, {
1186
1207
  key: "_isSessionCallBlocked",
1187
1208
  value: function _isSessionCallBlocked() {
1188
1209
  if (this._enableSessionCaching) {
@@ -1570,7 +1591,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1570
1591
  sessionData = null;
1571
1592
  _context.prev = 5;
1572
1593
  _context.next = 8;
1573
- return _this2._sessionService.get('/v2/session');
1594
+ return _this2._sessionService.get('/v2/session', {
1595
+ tabId: _this2._getTabId()
1596
+ });
1574
1597
  case 8:
1575
1598
  sessionData = _context.sent;
1576
1599
  _context.next = 15;
@@ -1598,7 +1621,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
1598
1621
  _context.next = 20;
1599
1622
  return _this2.callbackBeforeRedirect();
1600
1623
  case 20:
1601
- return _context.abrupt("return", _this2._sessionService.makeUrl(sessionData.redirectURL));
1624
+ return _context.abrupt("return", _this2._sessionService.makeUrl(sessionData.redirectURL, {
1625
+ tabId: _this2._getTabId()
1626
+ }));
1602
1627
  case 21:
1603
1628
  if (_this2._enableSessionCaching) {
1604
1629
  _expiresIn = 1000 * (sessionData.expiresIn || 300);
@@ -11983,7 +12008,7 @@ __webpack_require__.r(__webpack_exports__);
11983
12008
 
11984
12009
 
11985
12010
 
11986
- var version = '5.0.0';
12011
+ var version = '5.0.1';
11987
12012
  /* harmony default export */ __webpack_exports__["default"] = (version);
11988
12013
 
11989
12014
  /***/ }),