@schibsted/account-sdk-browser 5.0.1-beta.3 → 5.0.1-beta.4
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 +19 -15
- package/es5/global.js.map +1 -1
- package/es5/global.min.js +1 -1
- package/es5/global.min.js.map +1 -1
- package/es5/identity.js +19 -15
- package/es5/identity.js.map +1 -1
- package/es5/identity.min.js +1 -1
- package/es5/identity.min.js.map +1 -1
- package/es5/index.js +19 -15
- package/es5/index.js.map +1 -1
- package/es5/index.min.js +1 -1
- package/es5/index.min.js.map +1 -1
- package/es5/monetization.js +1 -1
- package/es5/monetization.js.map +1 -1
- package/es5/monetization.min.js +1 -1
- package/es5/monetization.min.js.map +1 -1
- package/package.json +1 -1
- package/src/identity.d.ts +4 -3
- package/src/identity.js +47 -28
- package/src/version.js +1 -1
package/es5/global.js
CHANGED
|
@@ -2083,14 +2083,15 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2083
2083
|
}
|
|
2084
2084
|
|
|
2085
2085
|
/**
|
|
2086
|
-
* Checks if calling GET session is blocked
|
|
2086
|
+
* Checks if calling GET session is blocked by a cache storage
|
|
2087
2087
|
* @private
|
|
2088
|
-
* @
|
|
2088
|
+
* @param {Cache} cache - cache to check
|
|
2089
|
+
* @returns {string|null}
|
|
2089
2090
|
*/
|
|
2090
2091
|
}, {
|
|
2091
2092
|
key: "_isSessionCallBlocked",
|
|
2092
|
-
value: function _isSessionCallBlocked() {
|
|
2093
|
-
return
|
|
2093
|
+
value: function _isSessionCallBlocked(cache) {
|
|
2094
|
+
return cache.get(SESSION_CALL_BLOCKED_CACHE_KEY);
|
|
2094
2095
|
}
|
|
2095
2096
|
|
|
2096
2097
|
/**
|
|
@@ -2101,6 +2102,10 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2101
2102
|
}, {
|
|
2102
2103
|
key: "_blockSessionCall",
|
|
2103
2104
|
value: function _blockSessionCall() {
|
|
2105
|
+
// session storage block protects against single tab, multiple identity instance concurrency
|
|
2106
|
+
this.sessionStorageCache.set(SESSION_CALL_BLOCKED_CACHE_KEY, this._tabId, SESSION_CALL_BLOCKED_TTL);
|
|
2107
|
+
|
|
2108
|
+
// local storage block protects against cross-tab concurrency
|
|
2104
2109
|
this.localStorageCache.set(SESSION_CALL_BLOCKED_CACHE_KEY, this._tabId, SESSION_CALL_BLOCKED_TTL);
|
|
2105
2110
|
}
|
|
2106
2111
|
|
|
@@ -2112,9 +2117,10 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2112
2117
|
}, {
|
|
2113
2118
|
key: "_unblockSessionCallByTab",
|
|
2114
2119
|
value: function _unblockSessionCallByTab() {
|
|
2115
|
-
if (this._isSessionCallBlocked() === this._tabId) {
|
|
2120
|
+
if (this._isSessionCallBlocked(this.localStorageCache) === this._tabId) {
|
|
2116
2121
|
this.localStorageCache.delete(SESSION_CALL_BLOCKED_CACHE_KEY);
|
|
2117
2122
|
}
|
|
2123
|
+
this.sessionStorageCache.delete(SESSION_CALL_BLOCKED_CACHE_KEY);
|
|
2118
2124
|
}
|
|
2119
2125
|
|
|
2120
2126
|
/**
|
|
@@ -2456,8 +2462,8 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2456
2462
|
while (1) switch (_context.prev = _context.next) {
|
|
2457
2463
|
case 0:
|
|
2458
2464
|
_context.prev = 0;
|
|
2459
|
-
|
|
2460
|
-
|
|
2465
|
+
/* Blocking future calls to session-service. This lock is removed after the response is processed
|
|
2466
|
+
to account for redirection that can happen towards session-service too */
|
|
2461
2467
|
_this2._blockSessionCall();
|
|
2462
2468
|
_context.next = 4;
|
|
2463
2469
|
return _this2._sessionService.get('/v2/session', {
|
|
@@ -2539,7 +2545,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2539
2545
|
}
|
|
2540
2546
|
return _context3.abrupt("return", _postProcess(cachedSession));
|
|
2541
2547
|
case 4:
|
|
2542
|
-
if (!_this2._isSessionCallBlocked()) {
|
|
2548
|
+
if (!(_this2._isSessionCallBlocked(_this2.sessionStorageCache) || _this2._isSessionCallBlocked(_this2.localStorageCache))) {
|
|
2543
2549
|
_context3.next = 13;
|
|
2544
2550
|
break;
|
|
2545
2551
|
}
|
|
@@ -2596,9 +2602,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2596
2602
|
randomWaitTime = MIN_SESSION_CALL_WAIT_TIME + randomWaitingStep * 100;
|
|
2597
2603
|
_context4.next = 5;
|
|
2598
2604
|
return new Promise(function (resolve) {
|
|
2599
|
-
setTimeout(
|
|
2600
|
-
return resolve();
|
|
2601
|
-
}, randomWaitTime);
|
|
2605
|
+
return setTimeout(resolve, randomWaitTime);
|
|
2602
2606
|
});
|
|
2603
2607
|
case 5:
|
|
2604
2608
|
_context4.next = 7;
|
|
@@ -2898,9 +2902,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2898
2902
|
throw new _SDKError_js__WEBPACK_IMPORTED_MODULE_63__["default"]('externalParty cannot be empty');
|
|
2899
2903
|
case 9:
|
|
2900
2904
|
_toHexDigest = function _toHexDigest(hashBuffer) {
|
|
2901
|
-
//
|
|
2905
|
+
// Convert buffer to byte array
|
|
2902
2906
|
var hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
2903
|
-
//
|
|
2907
|
+
// Convert bytes to hex string
|
|
2904
2908
|
return hashArray.map(function (b) {
|
|
2905
2909
|
return b.toString(16).padStart(2, '0');
|
|
2906
2910
|
}).join('');
|
|
@@ -3231,7 +3235,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
3231
3235
|
_ref9$prompt = _ref9.prompt,
|
|
3232
3236
|
prompt = _ref9$prompt === void 0 ? 'select_account' : _ref9$prompt;
|
|
3233
3237
|
if (_typeof(arguments[0]) !== 'object') {
|
|
3234
|
-
//
|
|
3238
|
+
// Backward compatibility
|
|
3235
3239
|
state = arguments[0];
|
|
3236
3240
|
acrValues = arguments[1];
|
|
3237
3241
|
scope = arguments[2] || scope;
|
|
@@ -12174,7 +12178,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
12174
12178
|
|
|
12175
12179
|
|
|
12176
12180
|
|
|
12177
|
-
var version = '5.0.1-beta.
|
|
12181
|
+
var version = '5.0.1-beta.4';
|
|
12178
12182
|
/* harmony default export */ __webpack_exports__["default"] = (version);
|
|
12179
12183
|
|
|
12180
12184
|
/***/ }),
|