@schibsted/account-sdk-browser 5.0.0-beta.1 → 5.0.0-beta.2
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 +6 -4
- 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 +6 -4
- 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 +6 -4
- 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 +30 -1
- package/src/identity.js +3 -3
- package/src/version.js +1 -1
package/package.json
CHANGED
package/src/identity.d.ts
CHANGED
|
@@ -28,7 +28,8 @@ export class Identity extends TinyEmitter {
|
|
|
28
28
|
_sessionInitiatedSent: boolean;
|
|
29
29
|
window: any;
|
|
30
30
|
clientId: string;
|
|
31
|
-
|
|
31
|
+
sessionStorageCache: any;
|
|
32
|
+
localStorageCache: any;
|
|
32
33
|
redirectUri: string;
|
|
33
34
|
env: string;
|
|
34
35
|
log: Function;
|
|
@@ -36,6 +37,34 @@ export class Identity extends TinyEmitter {
|
|
|
36
37
|
_sessionDomain: string;
|
|
37
38
|
_enableSessionCaching: boolean;
|
|
38
39
|
_session: {};
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Read tabId from session storage
|
|
43
|
+
* @returns {number}
|
|
44
|
+
* @private
|
|
45
|
+
*/
|
|
46
|
+
private _getTabId;
|
|
47
|
+
/**
|
|
48
|
+
* Checks if getting session is blocked
|
|
49
|
+
* @private
|
|
50
|
+
*
|
|
51
|
+
* @returns {boolean|void}
|
|
52
|
+
*/
|
|
53
|
+
private _isSessionCallBlocked;
|
|
54
|
+
/**
|
|
55
|
+
* Block calls to get session
|
|
56
|
+
* @private
|
|
57
|
+
*
|
|
58
|
+
* @returns {void}
|
|
59
|
+
*/
|
|
60
|
+
private _blockSessionCall;
|
|
61
|
+
/**
|
|
62
|
+
* Unblocks calls to get session
|
|
63
|
+
* @private
|
|
64
|
+
*
|
|
65
|
+
* @returns {void}
|
|
66
|
+
*/
|
|
67
|
+
private _unblockSessionCall;
|
|
39
68
|
/**
|
|
40
69
|
* Set SPiD server URL
|
|
41
70
|
* @private
|
package/src/identity.js
CHANGED
|
@@ -219,9 +219,9 @@ export class Identity extends EventEmitter {
|
|
|
219
219
|
*/
|
|
220
220
|
_getTabId() {
|
|
221
221
|
if (this._enableSessionCaching) {
|
|
222
|
-
const tabId = this.
|
|
222
|
+
const tabId = this.sessionStorageCache.get(TAB_ID_KEY);
|
|
223
223
|
if (!tabId) {
|
|
224
|
-
this.
|
|
224
|
+
this.sessionStorageCache.set(TAB_ID_KEY, TAB_ID, TAB_ID_TTL);
|
|
225
225
|
return TAB_ID;
|
|
226
226
|
}
|
|
227
227
|
|
|
@@ -589,7 +589,7 @@ export class Identity extends EventEmitter {
|
|
|
589
589
|
}
|
|
590
590
|
let sessionData = null;
|
|
591
591
|
try {
|
|
592
|
-
sessionData = await this._sessionService.get('/v2/session');
|
|
592
|
+
sessionData = await this._sessionService.get('/v2/session', {tabId: this._getTabId()});
|
|
593
593
|
} catch (err) {
|
|
594
594
|
if (err && err.code === 400 && this._enableSessionCaching) {
|
|
595
595
|
const expiresIn = 1000 * (err.expiresIn || 300);
|
package/src/version.js
CHANGED