@openreplay/tracker 3.4.12 → 3.4.13
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/cjs/app/index.js +14 -2
- package/cjs/index.js +1 -1
- package/lib/app/index.js +14 -2
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/cjs/app/index.js
CHANGED
|
@@ -17,7 +17,7 @@ class App {
|
|
|
17
17
|
this.commitCallbacks = [];
|
|
18
18
|
this._sessionID = null;
|
|
19
19
|
this.isActive = false;
|
|
20
|
-
this.version = '3.4.
|
|
20
|
+
this.version = '3.4.13';
|
|
21
21
|
this.projectKey = projectKey;
|
|
22
22
|
this.options = Object.assign({
|
|
23
23
|
revID: '',
|
|
@@ -203,13 +203,18 @@ class App {
|
|
|
203
203
|
connAttemptGap: this.options.connAttemptGap,
|
|
204
204
|
};
|
|
205
205
|
this.worker.postMessage(messageData); // brings delay of 10th ms?
|
|
206
|
+
let token = sessionStorage.getItem(this.options.session_token_key);
|
|
207
|
+
const tokenIsActive = localStorage.getItem("__or_at_" + token);
|
|
208
|
+
if (tokenIsActive) {
|
|
209
|
+
token = null;
|
|
210
|
+
}
|
|
206
211
|
return window.fetch(this.options.ingestPoint + '/v1/web/start', {
|
|
207
212
|
method: 'POST',
|
|
208
213
|
headers: {
|
|
209
214
|
'Content-Type': 'application/json',
|
|
210
215
|
},
|
|
211
216
|
body: JSON.stringify({
|
|
212
|
-
token
|
|
217
|
+
token,
|
|
213
218
|
userUUID: localStorage.getItem(this.options.local_uuid_key),
|
|
214
219
|
projectKey: this.projectKey,
|
|
215
220
|
revID: this.revID,
|
|
@@ -240,6 +245,13 @@ class App {
|
|
|
240
245
|
}
|
|
241
246
|
sessionStorage.setItem(this.options.session_token_key, token);
|
|
242
247
|
localStorage.setItem(this.options.local_uuid_key, userUUID);
|
|
248
|
+
localStorage.setItem("__or_at_" + token, "true");
|
|
249
|
+
this.attachEventListener(window, 'beforeunload', () => {
|
|
250
|
+
localStorage.removeItem("__or_at_" + token);
|
|
251
|
+
}, false);
|
|
252
|
+
this.attachEventListener(window, 'pagehide', () => {
|
|
253
|
+
localStorage.removeItem("__or_at_" + token);
|
|
254
|
+
}, false);
|
|
243
255
|
if (typeof sessionID === 'string') {
|
|
244
256
|
this._sessionID = sessionID;
|
|
245
257
|
}
|
package/cjs/index.js
CHANGED
|
@@ -115,7 +115,7 @@ class API {
|
|
|
115
115
|
// no-cors issue only with text/plain or not-set Content-Type
|
|
116
116
|
// req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
|
117
117
|
req.send(JSON.stringify({
|
|
118
|
-
trackerVersion: '3.4.
|
|
118
|
+
trackerVersion: '3.4.13',
|
|
119
119
|
projectKey: options.projectKey,
|
|
120
120
|
doNotTrack,
|
|
121
121
|
// TODO: add precise reason (an exact API missing)
|
package/lib/app/index.js
CHANGED
|
@@ -14,7 +14,7 @@ export default class App {
|
|
|
14
14
|
this.commitCallbacks = [];
|
|
15
15
|
this._sessionID = null;
|
|
16
16
|
this.isActive = false;
|
|
17
|
-
this.version = '3.4.
|
|
17
|
+
this.version = '3.4.13';
|
|
18
18
|
this.projectKey = projectKey;
|
|
19
19
|
this.options = Object.assign({
|
|
20
20
|
revID: '',
|
|
@@ -200,13 +200,18 @@ export default class App {
|
|
|
200
200
|
connAttemptGap: this.options.connAttemptGap,
|
|
201
201
|
};
|
|
202
202
|
this.worker.postMessage(messageData); // brings delay of 10th ms?
|
|
203
|
+
let token = sessionStorage.getItem(this.options.session_token_key);
|
|
204
|
+
const tokenIsActive = localStorage.getItem("__or_at_" + token);
|
|
205
|
+
if (tokenIsActive) {
|
|
206
|
+
token = null;
|
|
207
|
+
}
|
|
203
208
|
return window.fetch(this.options.ingestPoint + '/v1/web/start', {
|
|
204
209
|
method: 'POST',
|
|
205
210
|
headers: {
|
|
206
211
|
'Content-Type': 'application/json',
|
|
207
212
|
},
|
|
208
213
|
body: JSON.stringify({
|
|
209
|
-
token
|
|
214
|
+
token,
|
|
210
215
|
userUUID: localStorage.getItem(this.options.local_uuid_key),
|
|
211
216
|
projectKey: this.projectKey,
|
|
212
217
|
revID: this.revID,
|
|
@@ -237,6 +242,13 @@ export default class App {
|
|
|
237
242
|
}
|
|
238
243
|
sessionStorage.setItem(this.options.session_token_key, token);
|
|
239
244
|
localStorage.setItem(this.options.local_uuid_key, userUUID);
|
|
245
|
+
localStorage.setItem("__or_at_" + token, "true");
|
|
246
|
+
this.attachEventListener(window, 'beforeunload', () => {
|
|
247
|
+
localStorage.removeItem("__or_at_" + token);
|
|
248
|
+
}, false);
|
|
249
|
+
this.attachEventListener(window, 'pagehide', () => {
|
|
250
|
+
localStorage.removeItem("__or_at_" + token);
|
|
251
|
+
}, false);
|
|
240
252
|
if (typeof sessionID === 'string') {
|
|
241
253
|
this._sessionID = sessionID;
|
|
242
254
|
}
|
package/lib/index.js
CHANGED
|
@@ -111,7 +111,7 @@ export default class API {
|
|
|
111
111
|
// no-cors issue only with text/plain or not-set Content-Type
|
|
112
112
|
// req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
|
113
113
|
req.send(JSON.stringify({
|
|
114
|
-
trackerVersion: '3.4.
|
|
114
|
+
trackerVersion: '3.4.13',
|
|
115
115
|
projectKey: options.projectKey,
|
|
116
116
|
doNotTrack,
|
|
117
117
|
// TODO: add precise reason (an exact API missing)
|