@openreplay/tracker 14.0.6-beta.0 → 14.0.6-beta.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.js +1 -1
- package/cjs/app/observer/observer.d.ts +1 -1
- package/cjs/app/observer/observer.js +26 -9
- package/cjs/index.js +1 -1
- package/lib/app/index.js +1 -1
- package/lib/app/observer/observer.d.ts +1 -1
- package/lib/app/observer/observer.js +26 -9
- package/lib/index.js +1 -1
- package/package.json +1 -1
package/cjs/app/index.js
CHANGED
|
@@ -94,7 +94,7 @@ class App {
|
|
|
94
94
|
this.stopCallbacks = [];
|
|
95
95
|
this.commitCallbacks = [];
|
|
96
96
|
this.activityState = ActivityState.NotActive;
|
|
97
|
-
this.version = '14.0.6-beta.
|
|
97
|
+
this.version = '14.0.6-beta.1'; // TODO: version compatability check inside each plugin.
|
|
98
98
|
this.socketMode = false;
|
|
99
99
|
this.compressionThreshold = 24 * 1000;
|
|
100
100
|
this.bc = null;
|
|
@@ -11,7 +11,7 @@ export default abstract class Observer {
|
|
|
11
11
|
constructor(app: App, isTopContext?: boolean);
|
|
12
12
|
private clear;
|
|
13
13
|
/**
|
|
14
|
-
* Unbinds the
|
|
14
|
+
* Unbinds the removed nodes in case of iframe src change.
|
|
15
15
|
*/
|
|
16
16
|
private handleIframeSrcChange;
|
|
17
17
|
private sendNodeAttribute;
|
|
@@ -80,7 +80,7 @@ class Observer {
|
|
|
80
80
|
continue;
|
|
81
81
|
}
|
|
82
82
|
if (target instanceof HTMLIFrameElement && name === 'src') {
|
|
83
|
-
this.handleIframeSrcChange(target
|
|
83
|
+
this.handleIframeSrcChange(target);
|
|
84
84
|
}
|
|
85
85
|
let attr = this.attributesMap.get(id);
|
|
86
86
|
if (attr === undefined) {
|
|
@@ -104,13 +104,33 @@ class Observer {
|
|
|
104
104
|
this.textSet.clear();
|
|
105
105
|
}
|
|
106
106
|
/**
|
|
107
|
-
* Unbinds the
|
|
107
|
+
* Unbinds the removed nodes in case of iframe src change.
|
|
108
108
|
*/
|
|
109
|
-
handleIframeSrcChange(iframe
|
|
109
|
+
handleIframeSrcChange(iframe) {
|
|
110
110
|
const oldContentDocument = iframe.contentDocument;
|
|
111
111
|
if (oldContentDocument) {
|
|
112
|
-
this.
|
|
113
|
-
|
|
112
|
+
const id = this.app.nodes.getID(oldContentDocument);
|
|
113
|
+
if (id !== undefined) {
|
|
114
|
+
const walker = document.createTreeWalker(oldContentDocument, NodeFilter.SHOW_ELEMENT + NodeFilter.SHOW_TEXT, {
|
|
115
|
+
acceptNode: (node) => isIgnored(node) || this.app.nodes.getID(node) === undefined
|
|
116
|
+
? NodeFilter.FILTER_REJECT
|
|
117
|
+
: NodeFilter.FILTER_ACCEPT,
|
|
118
|
+
},
|
|
119
|
+
// @ts-ignore
|
|
120
|
+
false);
|
|
121
|
+
let removed = 0;
|
|
122
|
+
const totalBeforeRemove = this.app.nodes.getNodeCount();
|
|
123
|
+
while (walker.nextNode()) {
|
|
124
|
+
if (!iframe.contentDocument.contains(walker.currentNode)) {
|
|
125
|
+
removed += 1;
|
|
126
|
+
this.app.nodes.unregisterNode(walker.currentNode);
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
const removedPercent = Math.floor((removed / totalBeforeRemove) * 100);
|
|
130
|
+
if (removedPercent > 30) {
|
|
131
|
+
this.app.send((0, messages_gen_js_1.UnbindNodes)(removedPercent));
|
|
132
|
+
}
|
|
133
|
+
}
|
|
114
134
|
}
|
|
115
135
|
}
|
|
116
136
|
sendNodeAttribute(id, node, name, value) {
|
|
@@ -198,11 +218,8 @@ class Observer {
|
|
|
198
218
|
this.bindNode(walker.currentNode);
|
|
199
219
|
}
|
|
200
220
|
}
|
|
201
|
-
unbindTree(node
|
|
221
|
+
unbindTree(node) {
|
|
202
222
|
const id = this.app.nodes.unregisterNode(node);
|
|
203
|
-
if (force && id) {
|
|
204
|
-
this.recents.set(id, RecentsType.Removed);
|
|
205
|
-
}
|
|
206
223
|
if (id !== undefined && this.recents.get(id) === RecentsType.Removed) {
|
|
207
224
|
// Sending RemoveNode only for parent to maintain
|
|
208
225
|
this.app.send((0, messages_gen_js_1.RemoveNode)(id));
|
package/cjs/index.js
CHANGED
|
@@ -98,7 +98,7 @@ class API {
|
|
|
98
98
|
const orig = this.options.ingestPoint || index_js_1.DEFAULT_INGEST_POINT;
|
|
99
99
|
req.open('POST', orig + '/v1/web/not-started');
|
|
100
100
|
req.send(JSON.stringify({
|
|
101
|
-
trackerVersion: '14.0.6-beta.
|
|
101
|
+
trackerVersion: '14.0.6-beta.1',
|
|
102
102
|
projectKey: this.options.projectKey,
|
|
103
103
|
doNotTrack,
|
|
104
104
|
reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,
|
package/lib/app/index.js
CHANGED
|
@@ -65,7 +65,7 @@ export default class App {
|
|
|
65
65
|
this.stopCallbacks = [];
|
|
66
66
|
this.commitCallbacks = [];
|
|
67
67
|
this.activityState = ActivityState.NotActive;
|
|
68
|
-
this.version = '14.0.6-beta.
|
|
68
|
+
this.version = '14.0.6-beta.1'; // TODO: version compatability check inside each plugin.
|
|
69
69
|
this.socketMode = false;
|
|
70
70
|
this.compressionThreshold = 24 * 1000;
|
|
71
71
|
this.bc = null;
|
|
@@ -11,7 +11,7 @@ export default abstract class Observer {
|
|
|
11
11
|
constructor(app: App, isTopContext?: boolean);
|
|
12
12
|
private clear;
|
|
13
13
|
/**
|
|
14
|
-
* Unbinds the
|
|
14
|
+
* Unbinds the removed nodes in case of iframe src change.
|
|
15
15
|
*/
|
|
16
16
|
private handleIframeSrcChange;
|
|
17
17
|
private sendNodeAttribute;
|
|
@@ -78,7 +78,7 @@ export default class Observer {
|
|
|
78
78
|
continue;
|
|
79
79
|
}
|
|
80
80
|
if (target instanceof HTMLIFrameElement && name === 'src') {
|
|
81
|
-
this.handleIframeSrcChange(target
|
|
81
|
+
this.handleIframeSrcChange(target);
|
|
82
82
|
}
|
|
83
83
|
let attr = this.attributesMap.get(id);
|
|
84
84
|
if (attr === undefined) {
|
|
@@ -102,13 +102,33 @@ export default class Observer {
|
|
|
102
102
|
this.textSet.clear();
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
|
-
* Unbinds the
|
|
105
|
+
* Unbinds the removed nodes in case of iframe src change.
|
|
106
106
|
*/
|
|
107
|
-
handleIframeSrcChange(iframe
|
|
107
|
+
handleIframeSrcChange(iframe) {
|
|
108
108
|
const oldContentDocument = iframe.contentDocument;
|
|
109
109
|
if (oldContentDocument) {
|
|
110
|
-
this.
|
|
111
|
-
|
|
110
|
+
const id = this.app.nodes.getID(oldContentDocument);
|
|
111
|
+
if (id !== undefined) {
|
|
112
|
+
const walker = document.createTreeWalker(oldContentDocument, NodeFilter.SHOW_ELEMENT + NodeFilter.SHOW_TEXT, {
|
|
113
|
+
acceptNode: (node) => isIgnored(node) || this.app.nodes.getID(node) === undefined
|
|
114
|
+
? NodeFilter.FILTER_REJECT
|
|
115
|
+
: NodeFilter.FILTER_ACCEPT,
|
|
116
|
+
},
|
|
117
|
+
// @ts-ignore
|
|
118
|
+
false);
|
|
119
|
+
let removed = 0;
|
|
120
|
+
const totalBeforeRemove = this.app.nodes.getNodeCount();
|
|
121
|
+
while (walker.nextNode()) {
|
|
122
|
+
if (!iframe.contentDocument.contains(walker.currentNode)) {
|
|
123
|
+
removed += 1;
|
|
124
|
+
this.app.nodes.unregisterNode(walker.currentNode);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
const removedPercent = Math.floor((removed / totalBeforeRemove) * 100);
|
|
128
|
+
if (removedPercent > 30) {
|
|
129
|
+
this.app.send(UnbindNodes(removedPercent));
|
|
130
|
+
}
|
|
131
|
+
}
|
|
112
132
|
}
|
|
113
133
|
}
|
|
114
134
|
sendNodeAttribute(id, node, name, value) {
|
|
@@ -196,11 +216,8 @@ export default class Observer {
|
|
|
196
216
|
this.bindNode(walker.currentNode);
|
|
197
217
|
}
|
|
198
218
|
}
|
|
199
|
-
unbindTree(node
|
|
219
|
+
unbindTree(node) {
|
|
200
220
|
const id = this.app.nodes.unregisterNode(node);
|
|
201
|
-
if (force && id) {
|
|
202
|
-
this.recents.set(id, RecentsType.Removed);
|
|
203
|
-
}
|
|
204
221
|
if (id !== undefined && this.recents.get(id) === RecentsType.Removed) {
|
|
205
222
|
// Sending RemoveNode only for parent to maintain
|
|
206
223
|
this.app.send(RemoveNode(id));
|
package/lib/index.js
CHANGED
|
@@ -67,7 +67,7 @@ export default class API {
|
|
|
67
67
|
const orig = this.options.ingestPoint || DEFAULT_INGEST_POINT;
|
|
68
68
|
req.open('POST', orig + '/v1/web/not-started');
|
|
69
69
|
req.send(JSON.stringify({
|
|
70
|
-
trackerVersion: '14.0.6-beta.
|
|
70
|
+
trackerVersion: '14.0.6-beta.1',
|
|
71
71
|
projectKey: this.options.projectKey,
|
|
72
72
|
doNotTrack,
|
|
73
73
|
reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,
|