@openreplay/tracker 16.4.2-beta.2 → 16.4.2-beta.3
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/dist/cjs/entry.js +22 -14
- package/dist/cjs/entry.js.map +1 -1
- package/dist/cjs/index.js +22 -14
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/main/app/session.d.ts +2 -2
- package/dist/lib/entry.js +22 -14
- package/dist/lib/entry.js.map +1 -1
- package/dist/lib/index.js +22 -14
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/main/app/session.d.ts +2 -2
- package/dist/types/main/app/session.d.ts +2 -2
- package/package.json +1 -1
package/dist/lib/index.js
CHANGED
|
@@ -5085,13 +5085,21 @@ class Session {
|
|
|
5085
5085
|
setUserInfo(userInfo) {
|
|
5086
5086
|
this.userInfo = userInfo;
|
|
5087
5087
|
}
|
|
5088
|
-
getSessionToken() {
|
|
5088
|
+
getSessionToken(projectKey) {
|
|
5089
5089
|
const token = this.token || this.app.sessionStorage.getItem(this.options.session_token_key);
|
|
5090
|
+
if (projectKey && token) {
|
|
5091
|
+
const savedProject = token.split('_&_')[1];
|
|
5092
|
+
if (!savedProject || savedProject !== projectKey) {
|
|
5093
|
+
this.app.sessionStorage.removeItem(this.options.session_token_key);
|
|
5094
|
+
this.token = undefined;
|
|
5095
|
+
return undefined;
|
|
5096
|
+
}
|
|
5097
|
+
}
|
|
5090
5098
|
return token || undefined;
|
|
5091
5099
|
}
|
|
5092
|
-
setSessionToken(token) {
|
|
5100
|
+
setSessionToken(token, projectKey) {
|
|
5093
5101
|
this.token = token;
|
|
5094
|
-
this.app.sessionStorage.setItem(this.options.session_token_key, token);
|
|
5102
|
+
this.app.sessionStorage.setItem(this.options.session_token_key, `${token}_&_${projectKey}`);
|
|
5095
5103
|
}
|
|
5096
5104
|
applySessionHash(hash) {
|
|
5097
5105
|
const hashParts = decodeURI(hash).split('&');
|
|
@@ -5255,7 +5263,7 @@ class App {
|
|
|
5255
5263
|
this.stopCallbacks = [];
|
|
5256
5264
|
this.commitCallbacks = [];
|
|
5257
5265
|
this.activityState = ActivityState.NotActive;
|
|
5258
|
-
this.version = '16.4.2-beta.
|
|
5266
|
+
this.version = '16.4.2-beta.3'; // TODO: version compatability check inside each plugin.
|
|
5259
5267
|
this.socketMode = false;
|
|
5260
5268
|
this.compressionThreshold = 24 * 1000;
|
|
5261
5269
|
this.bc = null;
|
|
@@ -5296,7 +5304,7 @@ class App {
|
|
|
5296
5304
|
if (data.line === proto.iframeId) {
|
|
5297
5305
|
this.parentActive = true;
|
|
5298
5306
|
this.rootId = data.id;
|
|
5299
|
-
this.session.setSessionToken(data.token);
|
|
5307
|
+
this.session.setSessionToken(data.token, this.projectKey);
|
|
5300
5308
|
this.frameOderNumber = data.frameOrderNumber;
|
|
5301
5309
|
this.debug.log('starting iframe tracking', data);
|
|
5302
5310
|
this.allowAppStart();
|
|
@@ -5338,7 +5346,7 @@ class App {
|
|
|
5338
5346
|
this.trackedFrames.push(data.context);
|
|
5339
5347
|
}
|
|
5340
5348
|
await this.waitStarted();
|
|
5341
|
-
const token = this.session.getSessionToken();
|
|
5349
|
+
const token = this.session.getSessionToken(this.projectKey);
|
|
5342
5350
|
const order = this.trackedFrames.findIndex((f) => f === data.context) + 1;
|
|
5343
5351
|
if (order === 0) {
|
|
5344
5352
|
this.debug.error('Couldnt get order number for iframe', data.context, this.trackedFrames);
|
|
@@ -5702,17 +5710,17 @@ class App {
|
|
|
5702
5710
|
this.debug.log(ev);
|
|
5703
5711
|
if (ev.data.line === proto.resp) {
|
|
5704
5712
|
const sessionToken = ev.data.token;
|
|
5705
|
-
this.session.setSessionToken(sessionToken);
|
|
5713
|
+
this.session.setSessionToken(sessionToken, this.projectKey);
|
|
5706
5714
|
this.allowAppStart();
|
|
5707
5715
|
}
|
|
5708
5716
|
if (ev.data.line === proto.reg) {
|
|
5709
5717
|
const sessionToken = ev.data.token;
|
|
5710
5718
|
this.session.regenerateTabId();
|
|
5711
|
-
this.session.setSessionToken(sessionToken);
|
|
5719
|
+
this.session.setSessionToken(sessionToken, this.projectKey);
|
|
5712
5720
|
this.allowAppStart();
|
|
5713
5721
|
}
|
|
5714
5722
|
if (ev.data.line === proto.ask) {
|
|
5715
|
-
const token = this.session.getSessionToken();
|
|
5723
|
+
const token = this.session.getSessionToken(this.projectKey);
|
|
5716
5724
|
if (token && this.bc) {
|
|
5717
5725
|
this.bc.postMessage({
|
|
5718
5726
|
line: ev.data.source === thisTab ? proto.reg : proto.resp,
|
|
@@ -5987,7 +5995,7 @@ class App {
|
|
|
5987
5995
|
};
|
|
5988
5996
|
}
|
|
5989
5997
|
getSessionToken() {
|
|
5990
|
-
return this.session.getSessionToken();
|
|
5998
|
+
return this.session.getSessionToken(this.projectKey);
|
|
5991
5999
|
}
|
|
5992
6000
|
getSessionID() {
|
|
5993
6001
|
return this.session.getInfo().sessionID || undefined;
|
|
@@ -6049,7 +6057,7 @@ class App {
|
|
|
6049
6057
|
checkSessionToken(forceNew) {
|
|
6050
6058
|
const lsReset = this.sessionStorage.getItem(this.options.session_reset_key) !== null;
|
|
6051
6059
|
const needNewSessionID = forceNew || lsReset;
|
|
6052
|
-
const sessionToken = this.session.getSessionToken();
|
|
6060
|
+
const sessionToken = this.session.getSessionToken(this.projectKey);
|
|
6053
6061
|
return needNewSessionID || !sessionToken;
|
|
6054
6062
|
}
|
|
6055
6063
|
/**
|
|
@@ -6316,7 +6324,7 @@ class App {
|
|
|
6316
6324
|
connAttemptGap: this.options.connAttemptGap,
|
|
6317
6325
|
tabId: this.session.getTabId(),
|
|
6318
6326
|
});
|
|
6319
|
-
const sessionToken = this.session.getSessionToken();
|
|
6327
|
+
const sessionToken = this.session.getSessionToken(this.projectKey);
|
|
6320
6328
|
const isNewSession = this.checkSessionToken(startOpts.forceNew);
|
|
6321
6329
|
this.sessionStorage.removeItem(this.options.session_reset_key);
|
|
6322
6330
|
this.debug.log('OpenReplay: starting session; need new session id?', isNewSession, 'session token: ', sessionToken);
|
|
@@ -6369,7 +6377,7 @@ class App {
|
|
|
6369
6377
|
return UnsuccessfulStart(reason);
|
|
6370
6378
|
}
|
|
6371
6379
|
this.delay = delay;
|
|
6372
|
-
this.session.setSessionToken(token);
|
|
6380
|
+
this.session.setSessionToken(token, this.projectKey);
|
|
6373
6381
|
this.session.setUserInfo({
|
|
6374
6382
|
userBrowser,
|
|
6375
6383
|
userCity,
|
|
@@ -9635,7 +9643,7 @@ class API {
|
|
|
9635
9643
|
this.signalStartIssue = (reason, missingApi) => {
|
|
9636
9644
|
const doNotTrack = this.checkDoNotTrack();
|
|
9637
9645
|
console.log("Tracker couldn't start due to:", JSON.stringify({
|
|
9638
|
-
trackerVersion: '16.4.2-beta.
|
|
9646
|
+
trackerVersion: '16.4.2-beta.3',
|
|
9639
9647
|
projectKey: this.options.projectKey,
|
|
9640
9648
|
doNotTrack,
|
|
9641
9649
|
reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,
|