@openreplay/tracker 18.0.15 → 18.0.17-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 +46 -19
- package/dist/cjs/entry.js.map +1 -1
- package/dist/cjs/index.js +46 -19
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/main/app/nodes/maintainer.d.ts +2 -0
- package/dist/cjs/main/app/observer/observer.d.ts +1 -0
- package/dist/lib/entry.js +46 -19
- package/dist/lib/entry.js.map +1 -1
- package/dist/lib/index.js +46 -19
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/main/app/nodes/maintainer.d.ts +2 -0
- package/dist/lib/main/app/observer/observer.d.ts +1 -0
- package/dist/types/main/app/nodes/maintainer.d.ts +2 -0
- package/dist/types/main/app/observer/observer.d.ts +1 -0
- package/package.json +1 -1
package/dist/cjs/entry.js
CHANGED
|
@@ -2217,22 +2217,32 @@ class Logger {
|
|
|
2217
2217
|
}
|
|
2218
2218
|
|
|
2219
2219
|
const SECOND = 1000;
|
|
2220
|
-
function processMapInBatches(map, batchSize, processBatchCallback
|
|
2220
|
+
function processMapInBatches(map, batchSize, processBatchCallback,
|
|
2221
|
+
// reports the pending inter-batch timeout so the caller can cancel it on stop()
|
|
2222
|
+
onScheduled,
|
|
2223
|
+
// called once the whole map has been walked (or there was nothing to walk)
|
|
2224
|
+
onComplete) {
|
|
2221
2225
|
const iterator = map.entries();
|
|
2222
2226
|
function processNextBatch() {
|
|
2223
|
-
|
|
2227
|
+
let processed = 0;
|
|
2224
2228
|
let result = iterator.next();
|
|
2225
|
-
|
|
2226
|
-
|
|
2229
|
+
// process inline as we pull from the iterator — no intermediate array.
|
|
2230
|
+
// deleting from the map during iteration (via unregisterNode) is safe:
|
|
2231
|
+
// unvisited deleted entries are skipped, newly added nodes get visited.
|
|
2232
|
+
while (!result.done && processed < batchSize) {
|
|
2233
|
+
const node = result.value[1];
|
|
2234
|
+
if (node) {
|
|
2235
|
+
processBatchCallback(node);
|
|
2236
|
+
}
|
|
2237
|
+
processed++;
|
|
2227
2238
|
result = iterator.next();
|
|
2228
2239
|
}
|
|
2229
|
-
if (
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
setTimeout(processNextBatch, 50);
|
|
2240
|
+
if (processed > 0) {
|
|
2241
|
+
// yield the thread between batches so the browser can run other work
|
|
2242
|
+
onScheduled(setTimeout(processNextBatch, 50));
|
|
2243
|
+
}
|
|
2244
|
+
else {
|
|
2245
|
+
onComplete();
|
|
2236
2246
|
}
|
|
2237
2247
|
}
|
|
2238
2248
|
processNextBatch();
|
|
@@ -2271,17 +2281,29 @@ class Maintainer {
|
|
|
2271
2281
|
constructor(nodes, unregisterNode, options) {
|
|
2272
2282
|
this.nodes = nodes;
|
|
2273
2283
|
this.unregisterNode = unregisterNode;
|
|
2284
|
+
this.isScanning = false;
|
|
2274
2285
|
this.start = () => {
|
|
2275
2286
|
if (!this.options.enabled) {
|
|
2276
2287
|
return;
|
|
2277
2288
|
}
|
|
2278
2289
|
this.stop();
|
|
2279
2290
|
this.interval = setInterval(() => {
|
|
2291
|
+
// a previous scan may still be walking the map across batch timeouts
|
|
2292
|
+
// (large DOM and/or background-tab timer throttling). don't pile up.
|
|
2293
|
+
if (this.isScanning) {
|
|
2294
|
+
return;
|
|
2295
|
+
}
|
|
2296
|
+
this.isScanning = true;
|
|
2280
2297
|
processMapInBatches(this.nodes, this.options.batchSize, (node) => {
|
|
2281
2298
|
const isActive = isNodeStillActive(node)[0];
|
|
2282
2299
|
if (!isActive) {
|
|
2283
2300
|
this.unregisterNode(node);
|
|
2284
2301
|
}
|
|
2302
|
+
}, (timeout) => {
|
|
2303
|
+
this.batchTimeout = timeout;
|
|
2304
|
+
}, () => {
|
|
2305
|
+
this.batchTimeout = undefined;
|
|
2306
|
+
this.isScanning = false;
|
|
2285
2307
|
});
|
|
2286
2308
|
}, this.options.interval);
|
|
2287
2309
|
};
|
|
@@ -2289,6 +2311,11 @@ class Maintainer {
|
|
|
2289
2311
|
if (this.interval) {
|
|
2290
2312
|
clearInterval(this.interval);
|
|
2291
2313
|
}
|
|
2314
|
+
if (this.batchTimeout) {
|
|
2315
|
+
clearTimeout(this.batchTimeout);
|
|
2316
|
+
this.batchTimeout = undefined;
|
|
2317
|
+
}
|
|
2318
|
+
this.isScanning = false;
|
|
2292
2319
|
};
|
|
2293
2320
|
this.options = { ...defaults$1, ...options };
|
|
2294
2321
|
}
|
|
@@ -3074,6 +3101,10 @@ function isObservable(node) {
|
|
|
3074
3101
|
}
|
|
3075
3102
|
return !isIgnored(node);
|
|
3076
3103
|
}
|
|
3104
|
+
const PRESERVE_VALUE_INPUT_TYPES = new Set(['button', 'reset', 'submit', 'checkbox', 'radio']);
|
|
3105
|
+
function shouldSkipValueAttribute(node) {
|
|
3106
|
+
return hasTag(node, 'input') && !PRESERVE_VALUE_INPUT_TYPES.has(node.type);
|
|
3107
|
+
}
|
|
3077
3108
|
/*
|
|
3078
3109
|
TODO:
|
|
3079
3110
|
- fix unbinding logic + send all removals first (ensure sequence is correct)
|
|
@@ -3254,11 +3285,7 @@ class Observer {
|
|
|
3254
3285
|
name.substring(0, 2) === 'on') {
|
|
3255
3286
|
return;
|
|
3256
3287
|
}
|
|
3257
|
-
if (name === 'value' &&
|
|
3258
|
-
hasTag(node, 'input') &&
|
|
3259
|
-
node.type !== 'button' &&
|
|
3260
|
-
node.type !== 'reset' &&
|
|
3261
|
-
node.type !== 'submit') {
|
|
3288
|
+
if (name === 'value' && shouldSkipValueAttribute(node)) {
|
|
3262
3289
|
return;
|
|
3263
3290
|
}
|
|
3264
3291
|
if (value === null) {
|
|
@@ -4249,7 +4276,7 @@ class App {
|
|
|
4249
4276
|
this.stopCallbacks = [];
|
|
4250
4277
|
this.commitCallbacks = [];
|
|
4251
4278
|
this.activityState = ActivityState.NotActive;
|
|
4252
|
-
this.version = '18.0.
|
|
4279
|
+
this.version = '18.0.17-beta.0'; // TODO: version compatability check inside each plugin.
|
|
4253
4280
|
this.socketMode = false;
|
|
4254
4281
|
this.compressionThreshold = 24 * 1000;
|
|
4255
4282
|
this.bc = null;
|
|
@@ -9584,7 +9611,7 @@ class ConstantProperties {
|
|
|
9584
9611
|
user_id: this.user_id,
|
|
9585
9612
|
distinct_id: this.deviceId,
|
|
9586
9613
|
sdk_edition: 'web',
|
|
9587
|
-
sdk_version: '18.0.
|
|
9614
|
+
sdk_version: '18.0.17-beta.0',
|
|
9588
9615
|
timezone: getUTCOffsetString(),
|
|
9589
9616
|
search_engine: this.searchEngine,
|
|
9590
9617
|
};
|
|
@@ -10286,7 +10313,7 @@ class API {
|
|
|
10286
10313
|
this.signalStartIssue = (reason, missingApi) => {
|
|
10287
10314
|
const doNotTrack = this.checkDoNotTrack();
|
|
10288
10315
|
console.log("Tracker couldn't start due to:", JSON.stringify({
|
|
10289
|
-
trackerVersion: '18.0.
|
|
10316
|
+
trackerVersion: '18.0.17-beta.0',
|
|
10290
10317
|
projectKey: this.options.projectKey,
|
|
10291
10318
|
doNotTrack,
|
|
10292
10319
|
reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,
|