@openreplay/tracker 11.0.3 → 11.0.5
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 +9 -0
- package/cjs/app/canvas.d.ts +3 -0
- package/cjs/app/canvas.js +23 -7
- package/cjs/app/index.d.ts +2 -0
- package/cjs/app/index.js +15 -6
- package/cjs/app/nodes.d.ts +1 -0
- package/cjs/app/nodes.js +3 -0
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +7 -1
- package/coverage/clover.xml +840 -739
- package/coverage/coverage-final.json +13 -12
- package/coverage/lcov-report/index.html +33 -33
- package/coverage/lcov-report/main/app/canvas.ts.html +23 -14
- package/coverage/lcov-report/main/app/guards.ts.html +1 -1
- package/coverage/lcov-report/main/app/index.html +16 -16
- package/coverage/lcov-report/main/app/index.ts.html +478 -82
- package/coverage/lcov-report/main/app/logger.ts.html +25 -91
- package/coverage/lcov-report/main/app/messages.gen.ts.html +62 -5
- package/coverage/lcov-report/main/app/nodes.ts.html +1 -1
- package/coverage/lcov-report/main/app/observer/iframe_observer.ts.html +2 -2
- package/coverage/lcov-report/main/app/observer/iframe_offsets.ts.html +1 -1
- package/coverage/lcov-report/main/app/observer/index.html +1 -1
- package/coverage/lcov-report/main/app/observer/shadow_root_observer.ts.html +2 -2
- package/coverage/lcov-report/main/app/observer/top_observer.ts.html +1 -1
- package/coverage/lcov-report/main/app/sanitizer.ts.html +1 -1
- package/coverage/lcov-report/main/app/session.ts.html +1 -1
- package/coverage/lcov-report/main/app/ticker.ts.html +1 -1
- package/coverage/lcov-report/main/index.html +9 -9
- package/coverage/lcov-report/main/index.ts.html +182 -11
- package/coverage/lcov-report/main/modules/Network/beaconProxy.ts.html +1 -1
- package/coverage/lcov-report/main/modules/Network/fetchProxy.ts.html +21 -6
- package/coverage/lcov-report/main/modules/Network/index.html +6 -6
- package/coverage/lcov-report/main/modules/Network/index.ts.html +1 -1
- package/coverage/lcov-report/main/modules/Network/networkMessage.ts.html +1 -1
- package/coverage/lcov-report/main/modules/Network/utils.ts.html +1 -1
- package/coverage/lcov-report/main/modules/Network/xhrProxy.ts.html +3 -3
- package/coverage/lcov-report/main/modules/attributeSender.ts.html +1 -1
- package/coverage/lcov-report/main/modules/axiosSpy.ts.html +1 -1
- package/coverage/lcov-report/main/modules/conditionsManager.ts.html +112 -67
- package/coverage/lcov-report/main/modules/connection.ts.html +1 -1
- package/coverage/lcov-report/main/modules/console.ts.html +1 -1
- package/coverage/lcov-report/main/modules/constructedStyleSheets.ts.html +1 -1
- package/coverage/lcov-report/main/modules/cssrules.ts.html +1 -1
- package/coverage/lcov-report/main/modules/exception.ts.html +1 -1
- package/coverage/lcov-report/main/modules/featureFlags.ts.html +1 -1
- package/coverage/lcov-report/main/modules/focus.ts.html +1 -1
- package/coverage/lcov-report/main/modules/fonts.ts.html +1 -1
- package/coverage/lcov-report/main/modules/img.ts.html +1 -1
- package/coverage/lcov-report/main/modules/index.html +34 -19
- package/coverage/lcov-report/main/modules/input.ts.html +1 -1
- package/coverage/lcov-report/main/modules/mouse.ts.html +1 -1
- package/coverage/lcov-report/main/modules/network.ts.html +1 -1
- package/coverage/lcov-report/main/modules/performance.ts.html +1 -1
- package/coverage/lcov-report/main/modules/scroll.ts.html +1 -1
- package/coverage/lcov-report/main/modules/selection.ts.html +1 -1
- package/coverage/lcov-report/main/modules/tabs.ts.html +1 -1
- package/coverage/lcov-report/main/modules/tagWatcher.ts.html +307 -0
- package/coverage/lcov-report/main/modules/timing.ts.html +1 -1
- package/coverage/lcov-report/main/modules/userTesting/SignalManager.ts.html +1 -1
- package/coverage/lcov-report/main/modules/userTesting/dnd.ts.html +1 -1
- package/coverage/lcov-report/main/modules/userTesting/index.html +1 -1
- package/coverage/lcov-report/main/modules/userTesting/index.ts.html +1 -1
- package/coverage/lcov-report/main/modules/userTesting/recorder.ts.html +1 -1
- package/coverage/lcov-report/main/modules/userTesting/styles.ts.html +1 -1
- package/coverage/lcov-report/main/modules/userTesting/utils.ts.html +1 -1
- package/coverage/lcov-report/main/modules/viewport.ts.html +1 -1
- package/coverage/lcov-report/main/utils.ts.html +1 -1
- package/coverage/lcov-report/webworker/BatchWriter.ts.html +23 -5
- package/coverage/lcov-report/webworker/MessageEncoder.gen.ts.html +17 -5
- package/coverage/lcov-report/webworker/PrimitiveEncoder.ts.html +1 -1
- package/coverage/lcov-report/webworker/QueueSender.ts.html +18 -6
- package/coverage/lcov-report/webworker/index.html +19 -19
- package/coverage/lcov-report/webworker/index.ts.html +15 -12
- package/coverage/lcov.info +1576 -1355
- package/lib/app/canvas.d.ts +3 -0
- package/lib/app/canvas.js +23 -7
- package/lib/app/index.d.ts +2 -0
- package/lib/app/index.js +15 -6
- package/lib/app/nodes.d.ts +1 -0
- package/lib/app/nodes.js +3 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +7 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
# 11.0.5
|
|
2
|
+
|
|
3
|
+
- add method to restart canvas tracking (in case of context recreation)
|
|
4
|
+
- scan dom tree for canvas els on tracker start
|
|
5
|
+
|
|
6
|
+
# 11.0.4
|
|
7
|
+
|
|
8
|
+
- some additional security for canvas capture (check if canvas el itself is obscured/ignored)
|
|
9
|
+
|
|
1
10
|
# 11.0.3
|
|
2
11
|
|
|
3
12
|
- move all logs under internal debugger
|
package/cjs/app/canvas.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import App from '../app/index.js';
|
|
|
2
2
|
interface Options {
|
|
3
3
|
fps: number;
|
|
4
4
|
quality: 'low' | 'medium' | 'high';
|
|
5
|
+
isDebug?: boolean;
|
|
5
6
|
}
|
|
6
7
|
declare class CanvasRecorder {
|
|
7
8
|
private readonly app;
|
|
@@ -11,6 +12,8 @@ declare class CanvasRecorder {
|
|
|
11
12
|
private readonly interval;
|
|
12
13
|
constructor(app: App, options: Options);
|
|
13
14
|
startTracking(): void;
|
|
15
|
+
restartTracking: () => void;
|
|
16
|
+
handleCanvasEl: (node: Node) => void;
|
|
14
17
|
sendSnaps(images: {
|
|
15
18
|
data: string;
|
|
16
19
|
id: number;
|
package/cjs/app/canvas.js
CHANGED
|
@@ -8,12 +8,17 @@ class CanvasRecorder {
|
|
|
8
8
|
this.options = options;
|
|
9
9
|
this.snapshots = {};
|
|
10
10
|
this.intervals = [];
|
|
11
|
-
this.
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
this.restartTracking = () => {
|
|
12
|
+
this.clear();
|
|
13
|
+
this.app.nodes.scanTree(this.handleCanvasEl);
|
|
14
|
+
};
|
|
15
|
+
this.handleCanvasEl = (node) => {
|
|
15
16
|
const id = this.app.nodes.getID(node);
|
|
16
|
-
if (!id || !(0, guards_js_1.hasTag)(node, 'canvas')
|
|
17
|
+
if (!id || !(0, guards_js_1.hasTag)(node, 'canvas')) {
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const isIgnored = this.app.sanitizer.isObscured(id) || this.app.sanitizer.isHidden(id);
|
|
21
|
+
if (isIgnored || !(0, guards_js_1.hasTag)(node, 'canvas') || this.snapshots[id]) {
|
|
17
22
|
return;
|
|
18
23
|
}
|
|
19
24
|
const ts = this.app.timestamp();
|
|
@@ -40,7 +45,16 @@ class CanvasRecorder {
|
|
|
40
45
|
}
|
|
41
46
|
}, this.interval);
|
|
42
47
|
this.intervals.push(int);
|
|
43
|
-
}
|
|
48
|
+
};
|
|
49
|
+
this.interval = 1000 / options.fps;
|
|
50
|
+
}
|
|
51
|
+
startTracking() {
|
|
52
|
+
setTimeout(() => {
|
|
53
|
+
this.app.nodes.scanTree(this.handleCanvasEl);
|
|
54
|
+
this.app.nodes.attachNodeCallback((node) => {
|
|
55
|
+
this.handleCanvasEl(node);
|
|
56
|
+
});
|
|
57
|
+
}, 500);
|
|
44
58
|
}
|
|
45
59
|
sendSnaps(images, canvasId, createdAt) {
|
|
46
60
|
var _a;
|
|
@@ -51,7 +65,9 @@ class CanvasRecorder {
|
|
|
51
65
|
images.forEach((snapshot) => {
|
|
52
66
|
const blob = dataUrlToBlob(snapshot.data)[0];
|
|
53
67
|
formData.append('snapshot', blob, `${createdAt}_${canvasId}_${snapshot.id}.jpeg`);
|
|
54
|
-
|
|
68
|
+
if (this.options.isDebug) {
|
|
69
|
+
saveImageData(snapshot.data, `${createdAt}_${canvasId}_${snapshot.id}.jpeg`);
|
|
70
|
+
}
|
|
55
71
|
});
|
|
56
72
|
fetch(this.app.options.ingestPoint + '/v1/web/images', {
|
|
57
73
|
method: 'POST',
|
package/cjs/app/index.d.ts
CHANGED
|
@@ -50,6 +50,7 @@ type AppOptions = {
|
|
|
50
50
|
__is_snippet: boolean;
|
|
51
51
|
__debug_report_edp: string | null;
|
|
52
52
|
__debug__?: LoggerOptions;
|
|
53
|
+
__save_canvas_locally?: boolean;
|
|
53
54
|
localStorage: Storage | null;
|
|
54
55
|
sessionStorage: Storage | null;
|
|
55
56
|
forceSingleTab?: boolean;
|
|
@@ -127,6 +128,7 @@ export default class App {
|
|
|
127
128
|
active(): boolean;
|
|
128
129
|
resetNextPageSession(flag: boolean): void;
|
|
129
130
|
private _start;
|
|
131
|
+
restartCanvasTracking: () => void;
|
|
130
132
|
onUxtCb: never[];
|
|
131
133
|
addOnUxtCb(cb: (id: number) => void): void;
|
|
132
134
|
getUxtId(): number | null;
|
package/cjs/app/index.js
CHANGED
|
@@ -42,13 +42,17 @@ class App {
|
|
|
42
42
|
this.stopCallbacks = [];
|
|
43
43
|
this.commitCallbacks = [];
|
|
44
44
|
this.activityState = ActivityState.NotActive;
|
|
45
|
-
this.version = '11.0.
|
|
45
|
+
this.version = '11.0.5'; // TODO: version compatability check inside each plugin.
|
|
46
46
|
this.compressionThreshold = 24 * 1000;
|
|
47
47
|
this.restartAttempts = 0;
|
|
48
48
|
this.bc = null;
|
|
49
49
|
this.canvasRecorder = null;
|
|
50
50
|
this._usingOldFetchPlugin = false;
|
|
51
51
|
this.delay = 0;
|
|
52
|
+
this.restartCanvasTracking = () => {
|
|
53
|
+
var _a;
|
|
54
|
+
(_a = this.canvasRecorder) === null || _a === void 0 ? void 0 : _a.restartTracking();
|
|
55
|
+
};
|
|
52
56
|
this.onUxtCb = [];
|
|
53
57
|
// if (options.onStart !== undefined) {
|
|
54
58
|
// deprecationWarn("'onStart' option", "tracker.start().then(/* handle session info */)")
|
|
@@ -69,6 +73,7 @@ class App {
|
|
|
69
73
|
verbose: false,
|
|
70
74
|
__is_snippet: false,
|
|
71
75
|
__debug_report_edp: null,
|
|
76
|
+
__save_canvas_locally: false,
|
|
72
77
|
localStorage: null,
|
|
73
78
|
sessionStorage: null,
|
|
74
79
|
disableStringDict: false,
|
|
@@ -498,15 +503,19 @@ class App {
|
|
|
498
503
|
});
|
|
499
504
|
this.compressionThreshold = compressionThreshold;
|
|
500
505
|
const onStartInfo = { sessionToken: token, userUUID, sessionID };
|
|
501
|
-
// TODO: start as early as possible (before receiving the token)
|
|
502
|
-
this.startCallbacks.forEach((cb) => cb(onStartInfo)); // MBTODO: callbacks after DOM "mounted" (observed)
|
|
503
|
-
this.observer.observe();
|
|
504
|
-
this.ticker.start();
|
|
505
506
|
if (canvasEnabled) {
|
|
506
507
|
this.canvasRecorder =
|
|
507
|
-
(_a = this.canvasRecorder) !== null && _a !== void 0 ? _a : new canvas_js_1.default(this, {
|
|
508
|
+
(_a = this.canvasRecorder) !== null && _a !== void 0 ? _a : new canvas_js_1.default(this, {
|
|
509
|
+
fps: canvasFPS,
|
|
510
|
+
quality: canvasQuality,
|
|
511
|
+
isDebug: this.options.__save_canvas_locally,
|
|
512
|
+
});
|
|
508
513
|
this.canvasRecorder.startTracking();
|
|
509
514
|
}
|
|
515
|
+
// TODO: start as early as possible (before receiving the token)
|
|
516
|
+
this.startCallbacks.forEach((cb) => cb(onStartInfo)); // MBTODO: callbacks after DOM "mounted" (observed)
|
|
517
|
+
this.observer.observe();
|
|
518
|
+
this.ticker.start();
|
|
510
519
|
this.activityState = ActivityState.Active;
|
|
511
520
|
this.notify.log('OpenReplay tracking started.');
|
|
512
521
|
// get rid of onStart ?
|
package/cjs/app/nodes.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export default class Nodes {
|
|
|
7
7
|
private readonly elementListeners;
|
|
8
8
|
constructor(node_id: string);
|
|
9
9
|
attachNodeCallback(nodeCallback: NodeCallback): void;
|
|
10
|
+
scanTree: (cb: (node: Node | void) => void) => void;
|
|
10
11
|
attachNodeListener(node: Node, type: string, listener: EventListener, useCapture?: boolean): void;
|
|
11
12
|
registerNode(node: Node): [/*id:*/ number, /*isNew:*/ boolean];
|
|
12
13
|
unregisterNode(node: Node): number | undefined;
|
package/cjs/app/nodes.js
CHANGED
|
@@ -8,6 +8,9 @@ class Nodes {
|
|
|
8
8
|
this.totalNodeAmount = 0;
|
|
9
9
|
this.nodeCallbacks = [];
|
|
10
10
|
this.elementListeners = new Map();
|
|
11
|
+
this.scanTree = (cb) => {
|
|
12
|
+
this.nodes.forEach((node) => cb(node));
|
|
13
|
+
};
|
|
11
14
|
}
|
|
12
15
|
// Attached once per Tracker instance
|
|
13
16
|
attachNodeCallback(nodeCallback) {
|
package/cjs/index.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export default class API {
|
|
|
39
39
|
reloadFlags(): Promise<void>;
|
|
40
40
|
getFeatureFlag(flagName: string): IFeatureFlag | undefined;
|
|
41
41
|
getAllFeatureFlags(): IFeatureFlag[];
|
|
42
|
+
restartCanvasTracking: () => void;
|
|
42
43
|
use<T>(fn: (app: App | null, options?: Options) => T): T;
|
|
43
44
|
isActive(): boolean;
|
|
44
45
|
start(startOpts?: Partial<StartOptions>): Promise<StartPromiseReturn>;
|
package/cjs/index.js
CHANGED
|
@@ -60,6 +60,12 @@ class API {
|
|
|
60
60
|
constructor(options) {
|
|
61
61
|
this.options = options;
|
|
62
62
|
this.app = null;
|
|
63
|
+
this.restartCanvasTracking = () => {
|
|
64
|
+
if (this.app === null) {
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
this.app.restartCanvasTracking();
|
|
68
|
+
};
|
|
63
69
|
this.handleError = (e, metadata = {}) => {
|
|
64
70
|
if (this.app === null) {
|
|
65
71
|
return;
|
|
@@ -162,7 +168,7 @@ class API {
|
|
|
162
168
|
// no-cors issue only with text/plain or not-set Content-Type
|
|
163
169
|
// req.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
|
|
164
170
|
req.send(JSON.stringify({
|
|
165
|
-
trackerVersion: '11.0.
|
|
171
|
+
trackerVersion: '11.0.5',
|
|
166
172
|
projectKey: options.projectKey,
|
|
167
173
|
doNotTrack,
|
|
168
174
|
// TODO: add precise reason (an exact API missing)
|