@openreplay/tracker 18.0.6 → 18.0.7-beta.0
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/dist/cjs/entry.js +36 -7
- package/dist/cjs/entry.js.map +1 -1
- package/dist/cjs/index.js +36 -7
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/main/app/observer/observer.d.ts +5 -0
- package/dist/lib/entry.js +36 -7
- package/dist/lib/entry.js.map +1 -1
- package/dist/lib/index.js +36 -7
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/main/app/observer/observer.d.ts +5 -0
- package/dist/types/main/app/observer/observer.d.ts +5 -0
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -3347,6 +3347,13 @@ class Observer {
|
|
|
3347
3347
|
this.throttledSetNodeData.clear();
|
|
3348
3348
|
this.generation++;
|
|
3349
3349
|
}
|
|
3350
|
+
/** Clear pending throttled-trailing setNodeData calls. Called from
|
|
3351
|
+
* top-level observe() before re-snapshotting so the second snapshot's
|
|
3352
|
+
* emissions fire as fresh first-calls instead of being deduped against
|
|
3353
|
+
* stale lastCalls entries from the previous snapshot. */
|
|
3354
|
+
resetThrottledSetNodeData() {
|
|
3355
|
+
this.throttledSetNodeData.clear();
|
|
3356
|
+
}
|
|
3350
3357
|
}
|
|
3351
3358
|
|
|
3352
3359
|
class IFrameObserver extends Observer {
|
|
@@ -3621,6 +3628,14 @@ class TopObserver extends Observer {
|
|
|
3621
3628
|
observer.handleShadowRoot(shadow);
|
|
3622
3629
|
return shadow;
|
|
3623
3630
|
};
|
|
3631
|
+
// Reset the throttled setNodeData state before re-snapshotting. Without this,
|
|
3632
|
+
// a re-snapshot triggered by restart() (e.g. auth token age) within the throttle
|
|
3633
|
+
// window (30ms) of the previous snapshot would dedupe its setNodeData emissions
|
|
3634
|
+
// against the previous snapshot's lastCalls and queue trailing fires whose
|
|
3635
|
+
// args reflect the post-restart DOM state (often empty for antd v5 cssinjs
|
|
3636
|
+
// placeholders). Disconnecting first would also work but observe() isn't
|
|
3637
|
+
// always preceded by disconnect().
|
|
3638
|
+
this.resetThrottledSetNodeData();
|
|
3624
3639
|
this.app.nodes.clear();
|
|
3625
3640
|
// Can observe documentElement (<html>) here, because it is not supposed to be changing.
|
|
3626
3641
|
// However, it is possible in some exotic cases and may cause an ignorance of the newly created <html>
|
|
@@ -4009,7 +4024,7 @@ class App {
|
|
|
4009
4024
|
this.stopCallbacks = [];
|
|
4010
4025
|
this.commitCallbacks = [];
|
|
4011
4026
|
this.activityState = ActivityState.NotActive;
|
|
4012
|
-
this.version = '18.0.
|
|
4027
|
+
this.version = '18.0.7-beta.0'; // TODO: version compatability check inside each plugin.
|
|
4013
4028
|
this.socketMode = false;
|
|
4014
4029
|
this.compressionThreshold = 24 * 1000;
|
|
4015
4030
|
this.bc = null;
|
|
@@ -6073,9 +6088,11 @@ function Input (app, opts) {
|
|
|
6073
6088
|
}
|
|
6074
6089
|
const inputValues = new Map();
|
|
6075
6090
|
const checkboxValues = new Map();
|
|
6091
|
+
const selectValues = new Map();
|
|
6076
6092
|
app.attachStopCallback(() => {
|
|
6077
6093
|
inputValues.clear();
|
|
6078
6094
|
checkboxValues.clear();
|
|
6095
|
+
selectValues.clear();
|
|
6079
6096
|
tagSelectorMap.clear();
|
|
6080
6097
|
});
|
|
6081
6098
|
function trackInputValue(id, node) {
|
|
@@ -6092,6 +6109,13 @@ function Input (app, opts) {
|
|
|
6092
6109
|
checkboxValues.set(id, value);
|
|
6093
6110
|
app.send(SetInputChecked(id, value));
|
|
6094
6111
|
}
|
|
6112
|
+
function trackSelectValue(id, node) {
|
|
6113
|
+
if (selectValues.get(id) === node.value) {
|
|
6114
|
+
return;
|
|
6115
|
+
}
|
|
6116
|
+
selectValues.set(id, node.value);
|
|
6117
|
+
sendInputValue(id, node);
|
|
6118
|
+
}
|
|
6095
6119
|
// The only way (to our knowledge) to track all kinds of input changes, including those made by JS
|
|
6096
6120
|
app.ticker.attach(() => {
|
|
6097
6121
|
inputValues.forEach((value, id) => {
|
|
@@ -6106,6 +6130,12 @@ function Input (app, opts) {
|
|
|
6106
6130
|
return checkboxValues.delete(id);
|
|
6107
6131
|
trackCheckboxValue(id, node.checked);
|
|
6108
6132
|
});
|
|
6133
|
+
selectValues.forEach((_, id) => {
|
|
6134
|
+
const node = app.nodes.getNode(id);
|
|
6135
|
+
if (!node)
|
|
6136
|
+
return selectValues.delete(id);
|
|
6137
|
+
trackSelectValue(id, node);
|
|
6138
|
+
});
|
|
6109
6139
|
}, 3);
|
|
6110
6140
|
function sendInputChange(id, node, hesitationTime, inputTime) {
|
|
6111
6141
|
const { value, mask } = getInputValue(id, node);
|
|
@@ -6122,8 +6152,8 @@ function Input (app, opts) {
|
|
|
6122
6152
|
}
|
|
6123
6153
|
// TODO: support multiple select (?): use selectedOptions;
|
|
6124
6154
|
if (hasTag(node, 'select')) {
|
|
6125
|
-
|
|
6126
|
-
app.nodes.attachNodeListener(node, 'change', () =>
|
|
6155
|
+
trackSelectValue(id, node);
|
|
6156
|
+
app.nodes.attachNodeListener(node, 'change', () => trackSelectValue(id, node));
|
|
6127
6157
|
}
|
|
6128
6158
|
if (isTextFieldElement(node)) {
|
|
6129
6159
|
trackInputValue(id, node);
|
|
@@ -7399,7 +7429,7 @@ class NetworkMessage {
|
|
|
7399
7429
|
return null;
|
|
7400
7430
|
const gqlHeader = "application/graphql-response";
|
|
7401
7431
|
const isGraphql = messageInfo.url.includes("/graphql")
|
|
7402
|
-
|| Object.values(messageInfo.request.headers).some(v => v
|
|
7432
|
+
|| Object.values(messageInfo.request.headers).some(v => v.includes(gqlHeader));
|
|
7403
7433
|
if (isGraphql && messageInfo.response.body && typeof messageInfo.response.body === 'string') {
|
|
7404
7434
|
const isError = messageInfo.response.body.includes("errors");
|
|
7405
7435
|
messageInfo.status = isError ? 400 : 200;
|
|
@@ -7503,7 +7533,6 @@ const genStringBody = (body) => {
|
|
|
7503
7533
|
}
|
|
7504
7534
|
else if (body instanceof Blob ||
|
|
7505
7535
|
body instanceof ReadableStream ||
|
|
7506
|
-
ArrayBuffer.isView(body) ||
|
|
7507
7536
|
body instanceof ArrayBuffer) {
|
|
7508
7537
|
result = 'byte data';
|
|
7509
7538
|
}
|
|
@@ -8992,7 +9021,7 @@ class ConstantProperties {
|
|
|
8992
9021
|
user_id: this.user_id,
|
|
8993
9022
|
distinct_id: this.deviceId,
|
|
8994
9023
|
sdk_edition: 'web',
|
|
8995
|
-
sdk_version: '18.0.
|
|
9024
|
+
sdk_version: '18.0.7-beta.0',
|
|
8996
9025
|
timezone: getUTCOffsetString(),
|
|
8997
9026
|
search_engine: this.searchEngine,
|
|
8998
9027
|
};
|
|
@@ -9694,7 +9723,7 @@ class API {
|
|
|
9694
9723
|
this.signalStartIssue = (reason, missingApi) => {
|
|
9695
9724
|
const doNotTrack = this.checkDoNotTrack();
|
|
9696
9725
|
console.log("Tracker couldn't start due to:", JSON.stringify({
|
|
9697
|
-
trackerVersion: '18.0.
|
|
9726
|
+
trackerVersion: '18.0.7-beta.0',
|
|
9698
9727
|
projectKey: this.options.projectKey,
|
|
9699
9728
|
doNotTrack,
|
|
9700
9729
|
reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,
|