@openreplay/tracker 3.5.0 → 3.5.1
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.d.ts +1 -0
- package/cjs/app/index.js +11 -3
- package/cjs/index.js +1 -1
- package/lib/app/index.d.ts +1 -0
- package/lib/app/index.js +11 -3
- package/lib/index.js +1 -1
- package/package.json +2 -2
package/cjs/app/index.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export default class App {
|
|
|
59
59
|
private readonly worker?;
|
|
60
60
|
constructor(projectKey: string, sessionToken: string | null | undefined, options: Partial<Options>);
|
|
61
61
|
private _debug;
|
|
62
|
+
private readonly preStartMessages;
|
|
62
63
|
send(message: Message, urgent?: boolean): void;
|
|
63
64
|
private commit;
|
|
64
65
|
attachCommitCallback(cb: CommitCallback): void;
|
package/cjs/app/index.js
CHANGED
|
@@ -31,7 +31,8 @@ class App {
|
|
|
31
31
|
this._userID = null;
|
|
32
32
|
this._metadata = {};
|
|
33
33
|
this.activityState = ActivityState.NotActive;
|
|
34
|
-
this.version = '3.5.
|
|
34
|
+
this.version = '3.5.1'; // TODO: version compatability check inside each plugin.
|
|
35
|
+
this.preStartMessages = [];
|
|
35
36
|
this.projectKey = projectKey;
|
|
36
37
|
this.options = Object.assign({
|
|
37
38
|
revID: '',
|
|
@@ -106,9 +107,16 @@ class App {
|
|
|
106
107
|
this.debug.error("OpenReplay error: ", context, e);
|
|
107
108
|
}
|
|
108
109
|
send(message, urgent = false) {
|
|
109
|
-
if (this.activityState
|
|
110
|
+
if (this.activityState === ActivityState.NotActive) {
|
|
110
111
|
return;
|
|
111
112
|
}
|
|
113
|
+
if (this.activityState === ActivityState.Starting) {
|
|
114
|
+
this.preStartMessages.push(message);
|
|
115
|
+
}
|
|
116
|
+
if (this.preStartMessages.length) {
|
|
117
|
+
this.messages.push(...this.preStartMessages);
|
|
118
|
+
this.preStartMessages.length = 0;
|
|
119
|
+
}
|
|
112
120
|
this.messages.push(message);
|
|
113
121
|
if (urgent) {
|
|
114
122
|
this.commit();
|
|
@@ -268,7 +276,7 @@ class App {
|
|
|
268
276
|
}
|
|
269
277
|
else {
|
|
270
278
|
return r.text().then(text => text === exports.CANCELED
|
|
271
|
-
? Promise.reject(exports.CANCELED)
|
|
279
|
+
? Promise.reject(exports.CANCELED) // TODO: return {error: CANCELED} instead
|
|
272
280
|
: Promise.reject(`Server error: ${r.status}. ${text}`));
|
|
273
281
|
}
|
|
274
282
|
})
|
package/cjs/index.js
CHANGED
|
@@ -129,7 +129,7 @@ class API {
|
|
|
129
129
|
// no-cors issue only with text/plain or not-set Content-Type
|
|
130
130
|
// req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
|
131
131
|
req.send(JSON.stringify({
|
|
132
|
-
trackerVersion: '3.5.
|
|
132
|
+
trackerVersion: '3.5.1',
|
|
133
133
|
projectKey: options.projectKey,
|
|
134
134
|
doNotTrack,
|
|
135
135
|
// TODO: add precise reason (an exact API missing)
|
package/lib/app/index.d.ts
CHANGED
|
@@ -59,6 +59,7 @@ export default class App {
|
|
|
59
59
|
private readonly worker?;
|
|
60
60
|
constructor(projectKey: string, sessionToken: string | null | undefined, options: Partial<Options>);
|
|
61
61
|
private _debug;
|
|
62
|
+
private readonly preStartMessages;
|
|
62
63
|
send(message: Message, urgent?: boolean): void;
|
|
63
64
|
private commit;
|
|
64
65
|
attachCommitCallback(cb: CommitCallback): void;
|
package/lib/app/index.js
CHANGED
|
@@ -28,7 +28,8 @@ export default class App {
|
|
|
28
28
|
this._userID = null;
|
|
29
29
|
this._metadata = {};
|
|
30
30
|
this.activityState = ActivityState.NotActive;
|
|
31
|
-
this.version = '3.5.
|
|
31
|
+
this.version = '3.5.1'; // TODO: version compatability check inside each plugin.
|
|
32
|
+
this.preStartMessages = [];
|
|
32
33
|
this.projectKey = projectKey;
|
|
33
34
|
this.options = Object.assign({
|
|
34
35
|
revID: '',
|
|
@@ -103,9 +104,16 @@ export default class App {
|
|
|
103
104
|
this.debug.error("OpenReplay error: ", context, e);
|
|
104
105
|
}
|
|
105
106
|
send(message, urgent = false) {
|
|
106
|
-
if (this.activityState
|
|
107
|
+
if (this.activityState === ActivityState.NotActive) {
|
|
107
108
|
return;
|
|
108
109
|
}
|
|
110
|
+
if (this.activityState === ActivityState.Starting) {
|
|
111
|
+
this.preStartMessages.push(message);
|
|
112
|
+
}
|
|
113
|
+
if (this.preStartMessages.length) {
|
|
114
|
+
this.messages.push(...this.preStartMessages);
|
|
115
|
+
this.preStartMessages.length = 0;
|
|
116
|
+
}
|
|
109
117
|
this.messages.push(message);
|
|
110
118
|
if (urgent) {
|
|
111
119
|
this.commit();
|
|
@@ -265,7 +273,7 @@ export default class App {
|
|
|
265
273
|
}
|
|
266
274
|
else {
|
|
267
275
|
return r.text().then(text => text === CANCELED
|
|
268
|
-
? Promise.reject(CANCELED)
|
|
276
|
+
? Promise.reject(CANCELED) // TODO: return {error: CANCELED} instead
|
|
269
277
|
: Promise.reject(`Server error: ${r.status}. ${text}`));
|
|
270
278
|
}
|
|
271
279
|
})
|
package/lib/index.js
CHANGED
|
@@ -125,7 +125,7 @@ export default class API {
|
|
|
125
125
|
// no-cors issue only with text/plain or not-set Content-Type
|
|
126
126
|
// req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
|
127
127
|
req.send(JSON.stringify({
|
|
128
|
-
trackerVersion: '3.5.
|
|
128
|
+
trackerVersion: '3.5.1',
|
|
129
129
|
projectKey: options.projectKey,
|
|
130
130
|
doNotTrack,
|
|
131
131
|
// 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": "3.5.
|
|
4
|
+
"version": "3.5.1",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"logging",
|
|
7
7
|
"replay"
|
|
@@ -41,6 +41,6 @@
|
|
|
41
41
|
"error-stack-parser": "^2.0.6"
|
|
42
42
|
},
|
|
43
43
|
"engines": {
|
|
44
|
-
"node": ">=
|
|
44
|
+
"node": ">=14"
|
|
45
45
|
}
|
|
46
46
|
}
|