@openreplay/tracker 9.0.10 → 9.0.11-beta.11
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 +4 -0
- package/cjs/app/index.js +1 -1
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +28 -11
- package/lib/app/index.js +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +28 -11
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
# 9.0.11
|
|
2
|
+
|
|
3
|
+
- new `resetTabOnWindowOpen` option to fix window.open issue with sessionStorage being inherited (replicating tabId bug), users still should use 'noopener=true' in window.open to prevent it in general...
|
|
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.
|
|
45
|
+
this.version = '9.0.11-beta.11'; // 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.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export type Options = Partial<AppOptions & ConsoleOptions & ExceptionOptions & I
|
|
|
20
20
|
sessionToken?: string;
|
|
21
21
|
respectDoNotTrack?: boolean;
|
|
22
22
|
autoResetOnWindowOpen?: boolean;
|
|
23
|
+
resetTabOnWindowOpen?: boolean;
|
|
23
24
|
network?: Partial<NetworkOptions>;
|
|
24
25
|
mouse?: Partial<MouseHandlerOptions>;
|
|
25
26
|
flags?: {
|
package/cjs/index.js
CHANGED
|
@@ -130,16 +130,33 @@ class API {
|
|
|
130
130
|
}
|
|
131
131
|
void this.featureFlags.reloadFlags();
|
|
132
132
|
});
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
133
|
+
const wOpen = window.open;
|
|
134
|
+
if (options.autoResetOnWindowOpen || options.resetTabOnWindowOpen) {
|
|
135
|
+
if (options.autoResetOnWindowOpen) {
|
|
136
|
+
app.attachStartCallback(() => {
|
|
137
|
+
// @ts-ignore ?
|
|
138
|
+
window.open = function (...args) {
|
|
139
|
+
app.resetNextPageSession(true);
|
|
140
|
+
wOpen.call(window, ...args);
|
|
141
|
+
app.resetNextPageSession(false);
|
|
142
|
+
};
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
if (options.resetTabOnWindowOpen) {
|
|
146
|
+
app.attachStartCallback(() => {
|
|
147
|
+
// window.open causes new tab to inherit sessionStorage completely,
|
|
148
|
+
// we don't really want that so we remove tabId for a short period
|
|
149
|
+
// @ts-ignore
|
|
150
|
+
window.open = function (...args) {
|
|
151
|
+
var _a;
|
|
152
|
+
const tabId = app.getTabId();
|
|
153
|
+
const sessStorage = (_a = app.sessionStorage) !== null && _a !== void 0 ? _a : window.sessionStorage;
|
|
154
|
+
sessStorage.removeItem(options.session_tabid_key || '__openreplay_tabid');
|
|
155
|
+
wOpen.call(window, ...args);
|
|
156
|
+
sessStorage.setItem(options.session_tabid_key || '__openreplay_tabid', tabId);
|
|
157
|
+
};
|
|
158
|
+
});
|
|
159
|
+
}
|
|
143
160
|
app.attachStopCallback(() => {
|
|
144
161
|
window.open = wOpen;
|
|
145
162
|
});
|
|
@@ -153,7 +170,7 @@ class API {
|
|
|
153
170
|
// no-cors issue only with text/plain or not-set Content-Type
|
|
154
171
|
// req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
|
155
172
|
req.send(JSON.stringify({
|
|
156
|
-
trackerVersion: '9.0.
|
|
173
|
+
trackerVersion: '9.0.11-beta.11',
|
|
157
174
|
projectKey: options.projectKey,
|
|
158
175
|
doNotTrack,
|
|
159
176
|
// 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.
|
|
42
|
+
this.version = '9.0.11-beta.11'; // 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.d.ts
CHANGED
|
@@ -20,6 +20,7 @@ export type Options = Partial<AppOptions & ConsoleOptions & ExceptionOptions & I
|
|
|
20
20
|
sessionToken?: string;
|
|
21
21
|
respectDoNotTrack?: boolean;
|
|
22
22
|
autoResetOnWindowOpen?: boolean;
|
|
23
|
+
resetTabOnWindowOpen?: boolean;
|
|
23
24
|
network?: Partial<NetworkOptions>;
|
|
24
25
|
mouse?: Partial<MouseHandlerOptions>;
|
|
25
26
|
flags?: {
|
package/lib/index.js
CHANGED
|
@@ -125,16 +125,33 @@ export default class API {
|
|
|
125
125
|
}
|
|
126
126
|
void this.featureFlags.reloadFlags();
|
|
127
127
|
});
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
128
|
+
const wOpen = window.open;
|
|
129
|
+
if (options.autoResetOnWindowOpen || options.resetTabOnWindowOpen) {
|
|
130
|
+
if (options.autoResetOnWindowOpen) {
|
|
131
|
+
app.attachStartCallback(() => {
|
|
132
|
+
// @ts-ignore ?
|
|
133
|
+
window.open = function (...args) {
|
|
134
|
+
app.resetNextPageSession(true);
|
|
135
|
+
wOpen.call(window, ...args);
|
|
136
|
+
app.resetNextPageSession(false);
|
|
137
|
+
};
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
if (options.resetTabOnWindowOpen) {
|
|
141
|
+
app.attachStartCallback(() => {
|
|
142
|
+
// window.open causes new tab to inherit sessionStorage completely,
|
|
143
|
+
// we don't really want that so we remove tabId for a short period
|
|
144
|
+
// @ts-ignore
|
|
145
|
+
window.open = function (...args) {
|
|
146
|
+
var _a;
|
|
147
|
+
const tabId = app.getTabId();
|
|
148
|
+
const sessStorage = (_a = app.sessionStorage) !== null && _a !== void 0 ? _a : window.sessionStorage;
|
|
149
|
+
sessStorage.removeItem(options.session_tabid_key || '__openreplay_tabid');
|
|
150
|
+
wOpen.call(window, ...args);
|
|
151
|
+
sessStorage.setItem(options.session_tabid_key || '__openreplay_tabid', tabId);
|
|
152
|
+
};
|
|
153
|
+
});
|
|
154
|
+
}
|
|
138
155
|
app.attachStopCallback(() => {
|
|
139
156
|
window.open = wOpen;
|
|
140
157
|
});
|
|
@@ -148,7 +165,7 @@ export default class API {
|
|
|
148
165
|
// no-cors issue only with text/plain or not-set Content-Type
|
|
149
166
|
// req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
|
150
167
|
req.send(JSON.stringify({
|
|
151
|
-
trackerVersion: '9.0.
|
|
168
|
+
trackerVersion: '9.0.11-beta.11',
|
|
152
169
|
projectKey: options.projectKey,
|
|
153
170
|
doNotTrack,
|
|
154
171
|
// TODO: add precise reason (an exact API missing)
|