@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/identity.js
CHANGED
|
@@ -1200,14 +1200,15 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
1200
1200
|
}
|
|
1201
1201
|
|
|
1202
1202
|
/**
|
|
1203
|
-
* Checks if calling GET session is blocked
|
|
1203
|
+
* Checks if calling GET session is blocked by a cache storage
|
|
1204
1204
|
* @private
|
|
1205
|
-
* @
|
|
1205
|
+
* @param {Cache} cache - cache to check
|
|
1206
|
+
* @returns {string|null}
|
|
1206
1207
|
*/
|
|
1207
1208
|
}, {
|
|
1208
1209
|
key: "_isSessionCallBlocked",
|
|
1209
|
-
value: function _isSessionCallBlocked() {
|
|
1210
|
-
return
|
|
1210
|
+
value: function _isSessionCallBlocked(cache) {
|
|
1211
|
+
return cache.get(SESSION_CALL_BLOCKED_CACHE_KEY);
|
|
1211
1212
|
}
|
|
1212
1213
|
|
|
1213
1214
|
/**
|
|
@@ -1218,6 +1219,10 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
1218
1219
|
}, {
|
|
1219
1220
|
key: "_blockSessionCall",
|
|
1220
1221
|
value: function _blockSessionCall() {
|
|
1222
|
+
// session storage block protects against single tab, multiple identity instance concurrency
|
|
1223
|
+
this.sessionStorageCache.set(SESSION_CALL_BLOCKED_CACHE_KEY, this._tabId, SESSION_CALL_BLOCKED_TTL);
|
|
1224
|
+
|
|
1225
|
+
// local storage block protects against cross-tab concurrency
|
|
1221
1226
|
this.localStorageCache.set(SESSION_CALL_BLOCKED_CACHE_KEY, this._tabId, SESSION_CALL_BLOCKED_TTL);
|
|
1222
1227
|
}
|
|
1223
1228
|
|
|
@@ -1229,9 +1234,10 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
1229
1234
|
}, {
|
|
1230
1235
|
key: "_unblockSessionCallByTab",
|
|
1231
1236
|
value: function _unblockSessionCallByTab() {
|
|
1232
|
-
if (this._isSessionCallBlocked() === this._tabId) {
|
|
1237
|
+
if (this._isSessionCallBlocked(this.localStorageCache) === this._tabId) {
|
|
1233
1238
|
this.localStorageCache.delete(SESSION_CALL_BLOCKED_CACHE_KEY);
|
|
1234
1239
|
}
|
|
1240
|
+
this.sessionStorageCache.delete(SESSION_CALL_BLOCKED_CACHE_KEY);
|
|
1235
1241
|
}
|
|
1236
1242
|
|
|
1237
1243
|
/**
|
|
@@ -1573,8 +1579,8 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
1573
1579
|
while (1) switch (_context.prev = _context.next) {
|
|
1574
1580
|
case 0:
|
|
1575
1581
|
_context.prev = 0;
|
|
1576
|
-
|
|
1577
|
-
|
|
1582
|
+
/* Blocking future calls to session-service. This lock is removed after the response is processed
|
|
1583
|
+
to account for redirection that can happen towards session-service too */
|
|
1578
1584
|
_this2._blockSessionCall();
|
|
1579
1585
|
_context.next = 4;
|
|
1580
1586
|
return _this2._sessionService.get('/v2/session', {
|
|
@@ -1656,7 +1662,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
1656
1662
|
}
|
|
1657
1663
|
return _context3.abrupt("return", _postProcess(cachedSession));
|
|
1658
1664
|
case 4:
|
|
1659
|
-
if (!_this2._isSessionCallBlocked()) {
|
|
1665
|
+
if (!(_this2._isSessionCallBlocked(_this2.sessionStorageCache) || _this2._isSessionCallBlocked(_this2.localStorageCache))) {
|
|
1660
1666
|
_context3.next = 13;
|
|
1661
1667
|
break;
|
|
1662
1668
|
}
|
|
@@ -1713,9 +1719,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
1713
1719
|
randomWaitTime = MIN_SESSION_CALL_WAIT_TIME + randomWaitingStep * 100;
|
|
1714
1720
|
_context4.next = 5;
|
|
1715
1721
|
return new Promise(function (resolve) {
|
|
1716
|
-
setTimeout(
|
|
1717
|
-
return resolve();
|
|
1718
|
-
}, randomWaitTime);
|
|
1722
|
+
return setTimeout(resolve, randomWaitTime);
|
|
1719
1723
|
});
|
|
1720
1724
|
case 5:
|
|
1721
1725
|
_context4.next = 7;
|
|
@@ -2015,9 +2019,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2015
2019
|
throw new _SDKError_js__WEBPACK_IMPORTED_MODULE_63__["default"]('externalParty cannot be empty');
|
|
2016
2020
|
case 9:
|
|
2017
2021
|
_toHexDigest = function _toHexDigest(hashBuffer) {
|
|
2018
|
-
//
|
|
2022
|
+
// Convert buffer to byte array
|
|
2019
2023
|
var hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
2020
|
-
//
|
|
2024
|
+
// Convert bytes to hex string
|
|
2021
2025
|
return hashArray.map(function (b) {
|
|
2022
2026
|
return b.toString(16).padStart(2, '0');
|
|
2023
2027
|
}).join('');
|
|
@@ -2348,7 +2352,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2348
2352
|
_ref9$prompt = _ref9.prompt,
|
|
2349
2353
|
prompt = _ref9$prompt === void 0 ? 'select_account' : _ref9$prompt;
|
|
2350
2354
|
if (_typeof(arguments[0]) !== 'object') {
|
|
2351
|
-
//
|
|
2355
|
+
// Backward compatibility
|
|
2352
2356
|
state = arguments[0];
|
|
2353
2357
|
acrValues = arguments[1];
|
|
2354
2358
|
scope = arguments[2] || scope;
|
|
@@ -12140,7 +12144,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
12140
12144
|
|
|
12141
12145
|
|
|
12142
12146
|
|
|
12143
|
-
var version = '5.0.1-beta.
|
|
12147
|
+
var version = '5.0.1-beta.4';
|
|
12144
12148
|
/* harmony default export */ __webpack_exports__["default"] = (version);
|
|
12145
12149
|
|
|
12146
12150
|
/***/ })
|