@schibsted/account-sdk-browser 5.0.1 → 5.1.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/README.md +1 -7
- package/es5/global.js +20 -23
- 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 +20 -23
- 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 +20 -23
- 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 +2 -1
- package/src/identity.js +21 -26
- package/src/version.js +1 -1
package/es5/identity.js
CHANGED
|
@@ -1150,9 +1150,12 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
1150
1150
|
_this._sessionInitiatedSent = false;
|
|
1151
1151
|
_this.window = window;
|
|
1152
1152
|
_this.clientId = clientId;
|
|
1153
|
-
_this.
|
|
1153
|
+
_this.sessionStorageCache = new _cache_js__WEBPACK_IMPORTED_MODULE_60__["default"](function () {
|
|
1154
1154
|
return _this.window && _this.window.sessionStorage;
|
|
1155
1155
|
});
|
|
1156
|
+
_this.localStorageCache = new _cache_js__WEBPACK_IMPORTED_MODULE_60__["default"](function () {
|
|
1157
|
+
return _this.window && _this.window.localStorage;
|
|
1158
|
+
});
|
|
1156
1159
|
_this.redirectUri = redirectUri;
|
|
1157
1160
|
_this.env = env;
|
|
1158
1161
|
_this.log = log;
|
|
@@ -1182,9 +1185,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
1182
1185
|
key: "_getTabId",
|
|
1183
1186
|
value: function _getTabId() {
|
|
1184
1187
|
if (this._enableSessionCaching) {
|
|
1185
|
-
var tabId = this.
|
|
1188
|
+
var tabId = this.sessionStorageCache.get(TAB_ID_KEY);
|
|
1186
1189
|
if (!tabId) {
|
|
1187
|
-
this.
|
|
1190
|
+
this.sessionStorageCache.set(TAB_ID_KEY, TAB_ID, TAB_ID_TTL);
|
|
1188
1191
|
return TAB_ID;
|
|
1189
1192
|
}
|
|
1190
1193
|
return tabId;
|
|
@@ -1200,9 +1203,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
1200
1203
|
}, {
|
|
1201
1204
|
key: "_isSessionCallBlocked",
|
|
1202
1205
|
value: function _isSessionCallBlocked() {
|
|
1203
|
-
|
|
1204
|
-
return this.cache.get(SESSION_CALL_BLOCKED_CACHE_KEY);
|
|
1205
|
-
}
|
|
1206
|
+
return this.localStorageCache.get(SESSION_CALL_BLOCKED_CACHE_KEY);
|
|
1206
1207
|
}
|
|
1207
1208
|
|
|
1208
1209
|
/**
|
|
@@ -1214,10 +1215,8 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
1214
1215
|
}, {
|
|
1215
1216
|
key: "_blockSessionCall",
|
|
1216
1217
|
value: function _blockSessionCall() {
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
this.cache.set(SESSION_CALL_BLOCKED_CACHE_KEY, SESSION_CALL_BLOCKED, SESSION_CALL_BLOCKED_TTL);
|
|
1220
|
-
}
|
|
1218
|
+
var SESSION_CALL_BLOCKED = true;
|
|
1219
|
+
this.localStorageCache.set(SESSION_CALL_BLOCKED_CACHE_KEY, SESSION_CALL_BLOCKED, SESSION_CALL_BLOCKED_TTL);
|
|
1221
1220
|
}
|
|
1222
1221
|
|
|
1223
1222
|
/**
|
|
@@ -1229,9 +1228,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
1229
1228
|
}, {
|
|
1230
1229
|
key: "_unblockSessionCall",
|
|
1231
1230
|
value: function _unblockSessionCall() {
|
|
1232
|
-
|
|
1233
|
-
this.cache.delete(SESSION_CALL_BLOCKED_CACHE_KEY);
|
|
1234
|
-
}
|
|
1231
|
+
this.localStorageCache.delete(SESSION_CALL_BLOCKED_CACHE_KEY);
|
|
1235
1232
|
}
|
|
1236
1233
|
|
|
1237
1234
|
/**
|
|
@@ -1575,7 +1572,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
1575
1572
|
break;
|
|
1576
1573
|
}
|
|
1577
1574
|
// Try to resolve from cache (it has a TTL)
|
|
1578
|
-
cachedSession = _this2.
|
|
1575
|
+
cachedSession = _this2.sessionStorageCache.get(HAS_SESSION_CACHE_KEY);
|
|
1579
1576
|
if (!cachedSession) {
|
|
1580
1577
|
_context.next = 4;
|
|
1581
1578
|
break;
|
|
@@ -1585,7 +1582,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
1585
1582
|
sessionData = null;
|
|
1586
1583
|
_context.prev = 5;
|
|
1587
1584
|
_context.next = 8;
|
|
1588
|
-
return _this2._sessionService.get('
|
|
1585
|
+
return _this2._sessionService.get('v2/session', {
|
|
1589
1586
|
tabId: _this2._getTabId()
|
|
1590
1587
|
});
|
|
1591
1588
|
case 8:
|
|
@@ -1597,7 +1594,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
1597
1594
|
_context.t0 = _context["catch"](5);
|
|
1598
1595
|
if (_context.t0 && _context.t0.code === 400 && _this2._enableSessionCaching) {
|
|
1599
1596
|
expiresIn = 1000 * (_context.t0.expiresIn || 300);
|
|
1600
|
-
_this2.
|
|
1597
|
+
_this2.sessionStorageCache.set(HAS_SESSION_CACHE_KEY, {
|
|
1601
1598
|
error: _context.t0
|
|
1602
1599
|
}, expiresIn);
|
|
1603
1600
|
}
|
|
@@ -1621,7 +1618,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
1621
1618
|
case 21:
|
|
1622
1619
|
if (_this2._enableSessionCaching) {
|
|
1623
1620
|
_expiresIn = 1000 * (sessionData.expiresIn || 300);
|
|
1624
|
-
_this2.
|
|
1621
|
+
_this2.sessionStorageCache.set(HAS_SESSION_CACHE_KEY, sessionData, _expiresIn);
|
|
1625
1622
|
}
|
|
1626
1623
|
case 22:
|
|
1627
1624
|
return _context.abrupt("return", _postProcess(sessionData));
|
|
@@ -1692,7 +1689,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
1692
1689
|
}, {
|
|
1693
1690
|
key: "clearCachedUserSession",
|
|
1694
1691
|
value: function clearCachedUserSession() {
|
|
1695
|
-
this.
|
|
1692
|
+
this.sessionStorageCache.delete(HAS_SESSION_CACHE_KEY);
|
|
1696
1693
|
}
|
|
1697
1694
|
|
|
1698
1695
|
/**
|
|
@@ -2020,7 +2017,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2020
2017
|
case 0:
|
|
2021
2018
|
_context10.prev = 0;
|
|
2022
2019
|
_context10.next = 3;
|
|
2023
|
-
return this._globalSessionService.get('
|
|
2020
|
+
return this._globalSessionService.get('user-context');
|
|
2024
2021
|
case 3:
|
|
2025
2022
|
return _context10.abrupt("return", _context10.sent);
|
|
2026
2023
|
case 6:
|
|
@@ -2087,7 +2084,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2087
2084
|
_ref4$prompt = _ref4.prompt,
|
|
2088
2085
|
prompt = _ref4$prompt === void 0 ? 'select_account' : _ref4$prompt;
|
|
2089
2086
|
this._closePopup();
|
|
2090
|
-
this.
|
|
2087
|
+
this.sessionStorageCache.delete(HAS_SESSION_CACHE_KEY);
|
|
2091
2088
|
var url = this.loginUrl({
|
|
2092
2089
|
state: state,
|
|
2093
2090
|
acrValues: acrValues,
|
|
@@ -2160,7 +2157,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2160
2157
|
key: "logout",
|
|
2161
2158
|
value: function logout() {
|
|
2162
2159
|
var redirectUri = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.redirectUri;
|
|
2163
|
-
this.
|
|
2160
|
+
this.sessionStorageCache.delete(HAS_SESSION_CACHE_KEY);
|
|
2164
2161
|
this._maybeClearVarnishCookie();
|
|
2165
2162
|
this.emit('logout');
|
|
2166
2163
|
this.window.location.href = this.logoutUrl(redirectUri);
|
|
@@ -2218,7 +2215,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2218
2215
|
maxAge = isNaN(arguments[7]) ? maxAge : arguments[7];
|
|
2219
2216
|
}
|
|
2220
2217
|
var isValidAcrValue = function isValidAcrValue(acrValue) {
|
|
2221
|
-
return Object(_validate_js__WEBPACK_IMPORTED_MODULE_55__["isStrIn"])(acrValue, ['password', 'otp', 'sms', 'eid-no', 'eid-se', 'eid-fi', 'eid'], true);
|
|
2218
|
+
return Object(_validate_js__WEBPACK_IMPORTED_MODULE_55__["isStrIn"])(acrValue, ['password', 'otp', 'sms', 'eid-dk', 'eid-no', 'eid-se', 'eid-fi', 'eid'], true);
|
|
2222
2219
|
};
|
|
2223
2220
|
Object(_validate_js__WEBPACK_IMPORTED_MODULE_55__["assert"])(!acrValues || Object(_validate_js__WEBPACK_IMPORTED_MODULE_55__["isStrIn"])(acrValues, ['', 'otp-email'], true) || acrValues.split(' ').every(isValidAcrValue), "The acrValues parameter is not acceptable: ".concat(acrValues));
|
|
2224
2221
|
Object(_validate_js__WEBPACK_IMPORTED_MODULE_55__["assert"])(Object(_validate_js__WEBPACK_IMPORTED_MODULE_55__["isUrl"])(redirectUri), "loginUrl(): redirectUri must be a valid url but is ".concat(redirectUri));
|
|
@@ -12002,7 +11999,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
12002
11999
|
|
|
12003
12000
|
|
|
12004
12001
|
|
|
12005
|
-
var version = '5.
|
|
12002
|
+
var version = '5.1.1';
|
|
12006
12003
|
/* harmony default export */ __webpack_exports__["default"] = (version);
|
|
12007
12004
|
|
|
12008
12005
|
/***/ })
|