@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/README.md
CHANGED
|
@@ -263,13 +263,7 @@ where it's difficult to do their own transpilation, we do provide some opt-in es
|
|
|
263
263
|
But then regardless of whether you use the es5 versions or not, you might need to polyfill certain
|
|
264
264
|
things that might be missing in the browsers you wish to support. A quick test using IE11 showed
|
|
265
265
|
that we needed polyfills for `Promise`, `URL`, `Object.entries`, `fetch`, `Number.isFinite` and
|
|
266
|
-
`Number.isInteger`.
|
|
267
|
-
using `console.log` as a parameter to any SDK function that supports logging), you might also need
|
|
268
|
-
to polyfill `console` and `console.log` (yeah, it's baffling, but a [known
|
|
269
|
-
issue](https://stackoverflow.com/questions/22315167/in-ie11-how-to-use-console-log) in IE). We added
|
|
270
|
-
them from polyfill.io like this:
|
|
271
|
-
|
|
272
|
-
<script src="https://cdn.polyfill.io/v2/polyfill.js?features=Promise,URL,Object.entries,fetch,Number.isFinite,Number.isInteger,console,console.log"></script>
|
|
266
|
+
`Number.isInteger`.
|
|
273
267
|
|
|
274
268
|
#### Cookies
|
|
275
269
|
|
package/es5/global.js
CHANGED
|
@@ -2033,9 +2033,12 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2033
2033
|
_this._sessionInitiatedSent = false;
|
|
2034
2034
|
_this.window = window;
|
|
2035
2035
|
_this.clientId = clientId;
|
|
2036
|
-
_this.
|
|
2036
|
+
_this.sessionStorageCache = new _cache_js__WEBPACK_IMPORTED_MODULE_60__["default"](function () {
|
|
2037
2037
|
return _this.window && _this.window.sessionStorage;
|
|
2038
2038
|
});
|
|
2039
|
+
_this.localStorageCache = new _cache_js__WEBPACK_IMPORTED_MODULE_60__["default"](function () {
|
|
2040
|
+
return _this.window && _this.window.localStorage;
|
|
2041
|
+
});
|
|
2039
2042
|
_this.redirectUri = redirectUri;
|
|
2040
2043
|
_this.env = env;
|
|
2041
2044
|
_this.log = log;
|
|
@@ -2065,9 +2068,9 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2065
2068
|
key: "_getTabId",
|
|
2066
2069
|
value: function _getTabId() {
|
|
2067
2070
|
if (this._enableSessionCaching) {
|
|
2068
|
-
var tabId = this.
|
|
2071
|
+
var tabId = this.sessionStorageCache.get(TAB_ID_KEY);
|
|
2069
2072
|
if (!tabId) {
|
|
2070
|
-
this.
|
|
2073
|
+
this.sessionStorageCache.set(TAB_ID_KEY, TAB_ID, TAB_ID_TTL);
|
|
2071
2074
|
return TAB_ID;
|
|
2072
2075
|
}
|
|
2073
2076
|
return tabId;
|
|
@@ -2083,9 +2086,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2083
2086
|
}, {
|
|
2084
2087
|
key: "_isSessionCallBlocked",
|
|
2085
2088
|
value: function _isSessionCallBlocked() {
|
|
2086
|
-
|
|
2087
|
-
return this.cache.get(SESSION_CALL_BLOCKED_CACHE_KEY);
|
|
2088
|
-
}
|
|
2089
|
+
return this.localStorageCache.get(SESSION_CALL_BLOCKED_CACHE_KEY);
|
|
2089
2090
|
}
|
|
2090
2091
|
|
|
2091
2092
|
/**
|
|
@@ -2097,10 +2098,8 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2097
2098
|
}, {
|
|
2098
2099
|
key: "_blockSessionCall",
|
|
2099
2100
|
value: function _blockSessionCall() {
|
|
2100
|
-
|
|
2101
|
-
|
|
2102
|
-
this.cache.set(SESSION_CALL_BLOCKED_CACHE_KEY, SESSION_CALL_BLOCKED, SESSION_CALL_BLOCKED_TTL);
|
|
2103
|
-
}
|
|
2101
|
+
var SESSION_CALL_BLOCKED = true;
|
|
2102
|
+
this.localStorageCache.set(SESSION_CALL_BLOCKED_CACHE_KEY, SESSION_CALL_BLOCKED, SESSION_CALL_BLOCKED_TTL);
|
|
2104
2103
|
}
|
|
2105
2104
|
|
|
2106
2105
|
/**
|
|
@@ -2112,9 +2111,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2112
2111
|
}, {
|
|
2113
2112
|
key: "_unblockSessionCall",
|
|
2114
2113
|
value: function _unblockSessionCall() {
|
|
2115
|
-
|
|
2116
|
-
this.cache.delete(SESSION_CALL_BLOCKED_CACHE_KEY);
|
|
2117
|
-
}
|
|
2114
|
+
this.localStorageCache.delete(SESSION_CALL_BLOCKED_CACHE_KEY);
|
|
2118
2115
|
}
|
|
2119
2116
|
|
|
2120
2117
|
/**
|
|
@@ -2458,7 +2455,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2458
2455
|
break;
|
|
2459
2456
|
}
|
|
2460
2457
|
// Try to resolve from cache (it has a TTL)
|
|
2461
|
-
cachedSession = _this2.
|
|
2458
|
+
cachedSession = _this2.sessionStorageCache.get(HAS_SESSION_CACHE_KEY);
|
|
2462
2459
|
if (!cachedSession) {
|
|
2463
2460
|
_context.next = 4;
|
|
2464
2461
|
break;
|
|
@@ -2468,7 +2465,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2468
2465
|
sessionData = null;
|
|
2469
2466
|
_context.prev = 5;
|
|
2470
2467
|
_context.next = 8;
|
|
2471
|
-
return _this2._sessionService.get('
|
|
2468
|
+
return _this2._sessionService.get('v2/session', {
|
|
2472
2469
|
tabId: _this2._getTabId()
|
|
2473
2470
|
});
|
|
2474
2471
|
case 8:
|
|
@@ -2480,7 +2477,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2480
2477
|
_context.t0 = _context["catch"](5);
|
|
2481
2478
|
if (_context.t0 && _context.t0.code === 400 && _this2._enableSessionCaching) {
|
|
2482
2479
|
expiresIn = 1000 * (_context.t0.expiresIn || 300);
|
|
2483
|
-
_this2.
|
|
2480
|
+
_this2.sessionStorageCache.set(HAS_SESSION_CACHE_KEY, {
|
|
2484
2481
|
error: _context.t0
|
|
2485
2482
|
}, expiresIn);
|
|
2486
2483
|
}
|
|
@@ -2504,7 +2501,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2504
2501
|
case 21:
|
|
2505
2502
|
if (_this2._enableSessionCaching) {
|
|
2506
2503
|
_expiresIn = 1000 * (sessionData.expiresIn || 300);
|
|
2507
|
-
_this2.
|
|
2504
|
+
_this2.sessionStorageCache.set(HAS_SESSION_CACHE_KEY, sessionData, _expiresIn);
|
|
2508
2505
|
}
|
|
2509
2506
|
case 22:
|
|
2510
2507
|
return _context.abrupt("return", _postProcess(sessionData));
|
|
@@ -2575,7 +2572,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2575
2572
|
}, {
|
|
2576
2573
|
key: "clearCachedUserSession",
|
|
2577
2574
|
value: function clearCachedUserSession() {
|
|
2578
|
-
this.
|
|
2575
|
+
this.sessionStorageCache.delete(HAS_SESSION_CACHE_KEY);
|
|
2579
2576
|
}
|
|
2580
2577
|
|
|
2581
2578
|
/**
|
|
@@ -2903,7 +2900,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2903
2900
|
case 0:
|
|
2904
2901
|
_context10.prev = 0;
|
|
2905
2902
|
_context10.next = 3;
|
|
2906
|
-
return this._globalSessionService.get('
|
|
2903
|
+
return this._globalSessionService.get('user-context');
|
|
2907
2904
|
case 3:
|
|
2908
2905
|
return _context10.abrupt("return", _context10.sent);
|
|
2909
2906
|
case 6:
|
|
@@ -2970,7 +2967,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
2970
2967
|
_ref4$prompt = _ref4.prompt,
|
|
2971
2968
|
prompt = _ref4$prompt === void 0 ? 'select_account' : _ref4$prompt;
|
|
2972
2969
|
this._closePopup();
|
|
2973
|
-
this.
|
|
2970
|
+
this.sessionStorageCache.delete(HAS_SESSION_CACHE_KEY);
|
|
2974
2971
|
var url = this.loginUrl({
|
|
2975
2972
|
state: state,
|
|
2976
2973
|
acrValues: acrValues,
|
|
@@ -3043,7 +3040,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
3043
3040
|
key: "logout",
|
|
3044
3041
|
value: function logout() {
|
|
3045
3042
|
var redirectUri = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.redirectUri;
|
|
3046
|
-
this.
|
|
3043
|
+
this.sessionStorageCache.delete(HAS_SESSION_CACHE_KEY);
|
|
3047
3044
|
this._maybeClearVarnishCookie();
|
|
3048
3045
|
this.emit('logout');
|
|
3049
3046
|
this.window.location.href = this.logoutUrl(redirectUri);
|
|
@@ -3101,7 +3098,7 @@ var Identity = /*#__PURE__*/function (_EventEmitter) {
|
|
|
3101
3098
|
maxAge = isNaN(arguments[7]) ? maxAge : arguments[7];
|
|
3102
3099
|
}
|
|
3103
3100
|
var isValidAcrValue = function isValidAcrValue(acrValue) {
|
|
3104
|
-
return Object(_validate_js__WEBPACK_IMPORTED_MODULE_55__["isStrIn"])(acrValue, ['password', 'otp', 'sms', 'eid-no', 'eid-se', 'eid-fi', 'eid'], true);
|
|
3101
|
+
return Object(_validate_js__WEBPACK_IMPORTED_MODULE_55__["isStrIn"])(acrValue, ['password', 'otp', 'sms', 'eid-dk', 'eid-no', 'eid-se', 'eid-fi', 'eid'], true);
|
|
3105
3102
|
};
|
|
3106
3103
|
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));
|
|
3107
3104
|
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));
|
|
@@ -12036,7 +12033,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
12036
12033
|
|
|
12037
12034
|
|
|
12038
12035
|
|
|
12039
|
-
var version = '5.
|
|
12036
|
+
var version = '5.1.1';
|
|
12040
12037
|
/* harmony default export */ __webpack_exports__["default"] = (version);
|
|
12041
12038
|
|
|
12042
12039
|
/***/ }),
|