@openreplay/tracker 16.4.7-beta.1 → 16.4.8

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/lib/index.js CHANGED
@@ -5047,6 +5047,23 @@ class Session {
5047
5047
  this.app.sessionStorage.setItem(this.options.session_pageno_key, pageNo.toString());
5048
5048
  return pageNo;
5049
5049
  };
5050
+ this.getSessionToken = (projectKey) => {
5051
+ const tokenWithProject = this.token || this.app.sessionStorage.getItem(this.options.session_token_key);
5052
+ if (projectKey && tokenWithProject) {
5053
+ const savedProject = tokenWithProject.split('_&_')[1];
5054
+ if (!savedProject || savedProject !== projectKey) {
5055
+ this.app.sessionStorage.removeItem(this.options.session_token_key);
5056
+ this.token = undefined;
5057
+ return undefined;
5058
+ }
5059
+ }
5060
+ const token = tokenWithProject ? tokenWithProject.split('_&_')[0] : null;
5061
+ return token || undefined;
5062
+ };
5063
+ this.setSessionToken = (token, projectKey) => {
5064
+ this.token = `${token}_&_${projectKey}`;
5065
+ this.app.sessionStorage.setItem(this.options.session_token_key, `${token}_&_${projectKey}`);
5066
+ };
5050
5067
  this.app = params.app;
5051
5068
  this.options = params.options;
5052
5069
  this.createTabId();
@@ -5093,23 +5110,6 @@ class Session {
5093
5110
  setUserInfo(userInfo) {
5094
5111
  this.userInfo = userInfo;
5095
5112
  }
5096
- getSessionToken(projectKey) {
5097
- const tokenWithProject = this.token || this.app.sessionStorage.getItem(this.options.session_token_key);
5098
- if (projectKey && tokenWithProject) {
5099
- const savedProject = tokenWithProject.split('_&_')[1];
5100
- if (!savedProject || savedProject !== projectKey) {
5101
- this.app.sessionStorage.removeItem(this.options.session_token_key);
5102
- this.token = undefined;
5103
- return undefined;
5104
- }
5105
- }
5106
- const token = tokenWithProject ? tokenWithProject.split('_&_')[0] : null;
5107
- return token || undefined;
5108
- }
5109
- setSessionToken(token, projectKey) {
5110
- this.token = token;
5111
- this.app.sessionStorage.setItem(this.options.session_token_key, `${token}_&_${projectKey}`);
5112
- }
5113
5113
  applySessionHash(hash) {
5114
5114
  const hashParts = decodeURI(hash).split('&');
5115
5115
  let token = hash;
@@ -5272,7 +5272,7 @@ class App {
5272
5272
  this.stopCallbacks = [];
5273
5273
  this.commitCallbacks = [];
5274
5274
  this.activityState = ActivityState.NotActive;
5275
- this.version = '16.4.7-beta.1'; // TODO: version compatability check inside each plugin.
5275
+ this.version = '16.4.8'; // TODO: version compatability check inside each plugin.
5276
5276
  this.socketMode = false;
5277
5277
  this.compressionThreshold = 24 * 1000;
5278
5278
  this.bc = null;
@@ -5882,6 +5882,7 @@ class App {
5882
5882
  }, 250);
5883
5883
  this.bc.onmessage = (ev) => {
5884
5884
  if (ev.data.context === this.contextId || this.projectKey !== ev.data.projectKey) {
5885
+ this.debug.log('same ctx event', ev);
5885
5886
  return;
5886
5887
  }
5887
5888
  this.debug.log(ev);
@@ -9665,7 +9666,7 @@ class API {
9665
9666
  this.signalStartIssue = (reason, missingApi) => {
9666
9667
  const doNotTrack = this.checkDoNotTrack();
9667
9668
  console.log("Tracker couldn't start due to:", JSON.stringify({
9668
- trackerVersion: '16.4.7-beta.1',
9669
+ trackerVersion: '16.4.8',
9669
9670
  projectKey: this.options.projectKey,
9670
9671
  doNotTrack,
9671
9672
  reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,