@openreplay/tracker 9.0.10 → 9.0.11-beta.0

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/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # 9.0.11
2
+
3
+ - fix window.open issue with sessionStorage being inherited (replicating tabId bug)
4
+
1
5
  # 9.0.10
2
6
 
3
7
  - added `excludedResourceUrls` to timings options to better sanitize network data
package/cjs/app/index.js CHANGED
@@ -42,7 +42,7 @@ class App {
42
42
  this.stopCallbacks = [];
43
43
  this.commitCallbacks = [];
44
44
  this.activityState = ActivityState.NotActive;
45
- this.version = '9.0.10'; // TODO: version compatability check inside each plugin.
45
+ this.version = '9.0.11-beta.0'; // TODO: version compatability check inside each plugin.
46
46
  this.compressionThreshold = 24 * 1000;
47
47
  this.restartAttempts = 0;
48
48
  this.bc = null;
package/cjs/index.js CHANGED
@@ -130,8 +130,8 @@ class API {
130
130
  }
131
131
  void this.featureFlags.reloadFlags();
132
132
  });
133
+ const wOpen = window.open;
133
134
  if (options.autoResetOnWindowOpen) {
134
- const wOpen = window.open;
135
135
  app.attachStartCallback(() => {
136
136
  // @ts-ignore ?
137
137
  window.open = function (...args) {
@@ -144,6 +144,21 @@ class API {
144
144
  window.open = wOpen;
145
145
  });
146
146
  }
147
+ else {
148
+ app.attachStartCallback(() => {
149
+ // this function causes new tab to inherit sessionStorage completely,
150
+ // we don't really want that so we remove tabId for a short period
151
+ // @ts-ignore
152
+ window.open = function (...args) {
153
+ var _a;
154
+ const tabId = app.getTabId();
155
+ const sessStorage = (_a = app.sessionStorage) !== null && _a !== void 0 ? _a : window.sessionStorage;
156
+ sessStorage.removeItem(options.session_tabid_key || '__openreplay_tabid');
157
+ wOpen.call(window, ...args);
158
+ sessStorage.setItem(options.session_tabid_key || '__openreplay_tabid', tabId);
159
+ };
160
+ });
161
+ }
147
162
  }
148
163
  else {
149
164
  console.log("OpenReplay: browser doesn't support API required for tracking or doNotTrack is set to 1.");
@@ -153,7 +168,7 @@ class API {
153
168
  // no-cors issue only with text/plain or not-set Content-Type
154
169
  // req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
155
170
  req.send(JSON.stringify({
156
- trackerVersion: '9.0.10',
171
+ trackerVersion: '9.0.11-beta.0',
157
172
  projectKey: options.projectKey,
158
173
  doNotTrack,
159
174
  // TODO: add precise reason (an exact API missing)
package/lib/app/index.js CHANGED
@@ -39,7 +39,7 @@ export default class App {
39
39
  this.stopCallbacks = [];
40
40
  this.commitCallbacks = [];
41
41
  this.activityState = ActivityState.NotActive;
42
- this.version = '9.0.10'; // TODO: version compatability check inside each plugin.
42
+ this.version = '9.0.11-beta.0'; // TODO: version compatability check inside each plugin.
43
43
  this.compressionThreshold = 24 * 1000;
44
44
  this.restartAttempts = 0;
45
45
  this.bc = null;
package/lib/index.js CHANGED
@@ -125,8 +125,8 @@ export default class API {
125
125
  }
126
126
  void this.featureFlags.reloadFlags();
127
127
  });
128
+ const wOpen = window.open;
128
129
  if (options.autoResetOnWindowOpen) {
129
- const wOpen = window.open;
130
130
  app.attachStartCallback(() => {
131
131
  // @ts-ignore ?
132
132
  window.open = function (...args) {
@@ -139,6 +139,21 @@ export default class API {
139
139
  window.open = wOpen;
140
140
  });
141
141
  }
142
+ else {
143
+ app.attachStartCallback(() => {
144
+ // this function causes new tab to inherit sessionStorage completely,
145
+ // we don't really want that so we remove tabId for a short period
146
+ // @ts-ignore
147
+ window.open = function (...args) {
148
+ var _a;
149
+ const tabId = app.getTabId();
150
+ const sessStorage = (_a = app.sessionStorage) !== null && _a !== void 0 ? _a : window.sessionStorage;
151
+ sessStorage.removeItem(options.session_tabid_key || '__openreplay_tabid');
152
+ wOpen.call(window, ...args);
153
+ sessStorage.setItem(options.session_tabid_key || '__openreplay_tabid', tabId);
154
+ };
155
+ });
156
+ }
142
157
  }
143
158
  else {
144
159
  console.log("OpenReplay: browser doesn't support API required for tracking or doNotTrack is set to 1.");
@@ -148,7 +163,7 @@ export default class API {
148
163
  // no-cors issue only with text/plain or not-set Content-Type
149
164
  // req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
150
165
  req.send(JSON.stringify({
151
- trackerVersion: '9.0.10',
166
+ trackerVersion: '9.0.11-beta.0',
152
167
  projectKey: options.projectKey,
153
168
  doNotTrack,
154
169
  // TODO: add precise reason (an exact API missing)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@openreplay/tracker",
3
3
  "description": "The OpenReplay tracker main package",
4
- "version": "9.0.10",
4
+ "version": "9.0.11-beta.0",
5
5
  "keywords": [
6
6
  "logging",
7
7
  "replay"