@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/global.js CHANGED
@@ -1986,6 +1986,9 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
1986
1986
  var HAS_SESSION_CACHE_KEY = 'hasSession-cache';
1987
1987
  var SESSION_CALL_BLOCKED_CACHE_KEY = 'sessionCallBlocked-cache';
1988
1988
  var SESSION_CALL_BLOCKED_TTL = 1000 * 60 * 5;
1989
+ var TAB_ID_KEY = 'tab-id-cache';
1990
+ var TAB_ID = Math.floor(Math.random() * 100000);
1991
+ var TAB_ID_TTL = 1000 * 60 * 60 * 24 * 30;
1989
1992
  var globalWindow = function globalWindow() {
1990
1993
  return window;
1991
1994
  };
@@ -2054,12 +2057,30 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2054
2057
  }
2055
2058
 
2056
2059
  /**
2057
- * Checks if getting session is blocked
2060
+ * Read tabId from session storage
2061
+ * @returns {number}
2058
2062
  * @private
2059
- *
2060
- * @returns {boolean|void}
2061
2063
  */
2062
2064
  _createClass(Identity, [{
2065
+ key: "_getTabId",
2066
+ value: function _getTabId() {
2067
+ if (this._enableSessionCaching) {
2068
+ var tabId = this.cache.get(TAB_ID_KEY);
2069
+ if (!tabId) {
2070
+ this.cache.set(TAB_ID_KEY, TAB_ID, TAB_ID_TTL);
2071
+ return TAB_ID;
2072
+ }
2073
+ return tabId;
2074
+ }
2075
+ }
2076
+
2077
+ /**
2078
+ * Checks if getting session is blocked
2079
+ * @private
2080
+ *
2081
+ * @returns {boolean|void}
2082
+ */
2083
+ }, {
2063
2084
  key: "_isSessionCallBlocked",
2064
2085
  value: function _isSessionCallBlocked() {
2065
2086
  if (this._enableSessionCaching) {
@@ -2447,7 +2468,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2447
2468
  sessionData = null;
2448
2469
  _context.prev = 5;
2449
2470
  _context.next = 8;
2450
- return _this2._sessionService.get('/v2/session');
2471
+ return _this2._sessionService.get('/v2/session', {
2472
+ tabId: _this2._getTabId()
2473
+ });
2451
2474
  case 8:
2452
2475
  sessionData = _context.sent;
2453
2476
  _context.next = 15;
@@ -2475,7 +2498,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
2475
2498
  _context.next = 20;
2476
2499
  return _this2.callbackBeforeRedirect();
2477
2500
  case 20:
2478
- return _context.abrupt("return", _this2._sessionService.makeUrl(sessionData.redirectURL));
2501
+ return _context.abrupt("return", _this2._sessionService.makeUrl(sessionData.redirectURL, {
2502
+ tabId: _this2._getTabId()
2503
+ }));
2479
2504
  case 21:
2480
2505
  if (_this2._enableSessionCaching) {
2481
2506
  _expiresIn = 1000 * (sessionData.expiresIn || 300);
@@ -12011,7 +12036,7 @@ __webpack_require__.r(__webpack_exports__);
12011
12036
 
12012
12037
 
12013
12038
 
12014
- var version = '5.0.0';
12039
+ var version = '5.0.1';
12015
12040
  /* harmony default export */ __webpack_exports__["default"] = (version);
12016
12041
 
12017
12042
  /***/ }),