@openreplay/tracker 17.1.4 → 17.1.6
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/common/messages.gen.d.ts +1 -44
- package/dist/cjs/entry.js +131 -98
- package/dist/cjs/entry.js.map +1 -1
- package/dist/cjs/index.js +122 -98
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/main/app/canvas.d.ts +9 -0
- package/dist/cjs/main/app/messages.gen.d.ts +0 -5
- package/dist/cjs/main/singleton.d.ts +1 -0
- package/dist/lib/common/messages.gen.d.ts +1 -44
- package/dist/lib/entry.js +131 -98
- package/dist/lib/entry.js.map +1 -1
- package/dist/lib/index.js +122 -98
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/main/app/canvas.d.ts +9 -0
- package/dist/lib/main/app/messages.gen.d.ts +0 -5
- package/dist/lib/main/singleton.d.ts +1 -0
- package/dist/types/common/messages.gen.d.ts +1 -44
- package/dist/types/main/app/canvas.d.ts +9 -0
- package/dist/types/main/app/messages.gen.d.ts +0 -5
- package/dist/types/main/singleton.d.ts +1 -0
- package/package.json +1 -1
|
@@ -27,9 +27,6 @@ export declare const enum Type {
|
|
|
27
27
|
StringDictGlobal = 34,
|
|
28
28
|
SetNodeAttributeDictGlobal = 35,
|
|
29
29
|
NodeAnimationResult = 36,
|
|
30
|
-
CSSInsertRule = 37,
|
|
31
|
-
CSSDeleteRule = 38,
|
|
32
|
-
Fetch = 39,
|
|
33
30
|
Profiler = 40,
|
|
34
31
|
OTable = 41,
|
|
35
32
|
StateAction = 42,
|
|
@@ -48,13 +45,11 @@ export declare const enum Type {
|
|
|
48
45
|
SetPageVisibility = 55,
|
|
49
46
|
LoadFontFace = 57,
|
|
50
47
|
SetNodeFocus = 58,
|
|
51
|
-
LongTask = 59,
|
|
52
48
|
SetNodeAttributeURLBased = 60,
|
|
53
49
|
SetCSSDataURLBased = 61,
|
|
54
50
|
TechnicalInfo = 63,
|
|
55
51
|
CustomIssue = 64,
|
|
56
52
|
SetNodeSlot = 65,
|
|
57
|
-
CSSInsertRuleURLBased = 67,
|
|
58
53
|
MouseClick = 68,
|
|
59
54
|
MouseClickDeprecated = 69,
|
|
60
55
|
CreateIFrameDocument = 70,
|
|
@@ -244,27 +239,6 @@ export type NodeAnimationResult = [
|
|
|
244
239
|
number,
|
|
245
240
|
string
|
|
246
241
|
];
|
|
247
|
-
export type CSSInsertRule = [
|
|
248
|
-
Type.CSSInsertRule,
|
|
249
|
-
number,
|
|
250
|
-
string,
|
|
251
|
-
number
|
|
252
|
-
];
|
|
253
|
-
export type CSSDeleteRule = [
|
|
254
|
-
Type.CSSDeleteRule,
|
|
255
|
-
number,
|
|
256
|
-
number
|
|
257
|
-
];
|
|
258
|
-
export type Fetch = [
|
|
259
|
-
Type.Fetch,
|
|
260
|
-
string,
|
|
261
|
-
string,
|
|
262
|
-
string,
|
|
263
|
-
string,
|
|
264
|
-
number,
|
|
265
|
-
number,
|
|
266
|
-
number
|
|
267
|
-
];
|
|
268
242
|
export type Profiler = [
|
|
269
243
|
Type.Profiler,
|
|
270
244
|
string,
|
|
@@ -371,16 +345,6 @@ export type SetNodeFocus = [
|
|
|
371
345
|
Type.SetNodeFocus,
|
|
372
346
|
number
|
|
373
347
|
];
|
|
374
|
-
export type LongTask = [
|
|
375
|
-
Type.LongTask,
|
|
376
|
-
number,
|
|
377
|
-
number,
|
|
378
|
-
number,
|
|
379
|
-
number,
|
|
380
|
-
string,
|
|
381
|
-
string,
|
|
382
|
-
string
|
|
383
|
-
];
|
|
384
348
|
export type SetNodeAttributeURLBased = [
|
|
385
349
|
Type.SetNodeAttributeURLBased,
|
|
386
350
|
number,
|
|
@@ -409,13 +373,6 @@ export type SetNodeSlot = [
|
|
|
409
373
|
number,
|
|
410
374
|
number
|
|
411
375
|
];
|
|
412
|
-
export type CSSInsertRuleURLBased = [
|
|
413
|
-
Type.CSSInsertRuleURLBased,
|
|
414
|
-
number,
|
|
415
|
-
string,
|
|
416
|
-
number,
|
|
417
|
-
string
|
|
418
|
-
];
|
|
419
376
|
export type MouseClick = [
|
|
420
377
|
Type.MouseClick,
|
|
421
378
|
number,
|
|
@@ -626,5 +583,5 @@ export type WebVitals = [
|
|
|
626
583
|
string,
|
|
627
584
|
string
|
|
628
585
|
];
|
|
629
|
-
type Message = Timestamp | SetPageLocationDeprecated | SetViewportSize | SetViewportScroll | CreateDocument | CreateElementNode | CreateTextNode | MoveNode | RemoveNode | SetNodeAttribute | RemoveNodeAttribute | SetNodeData | SetNodeScroll | SetInputTarget | SetInputValue | SetInputChecked | MouseMove | NetworkRequestDeprecated | ConsoleLog | PageLoadTiming | PageRenderTiming | CustomEvent | UserID | UserAnonymousID | Metadata | StringDictGlobal | SetNodeAttributeDictGlobal | NodeAnimationResult |
|
|
586
|
+
type Message = Timestamp | SetPageLocationDeprecated | SetViewportSize | SetViewportScroll | CreateDocument | CreateElementNode | CreateTextNode | MoveNode | RemoveNode | SetNodeAttribute | RemoveNodeAttribute | SetNodeData | SetNodeScroll | SetInputTarget | SetInputValue | SetInputChecked | MouseMove | NetworkRequestDeprecated | ConsoleLog | PageLoadTiming | PageRenderTiming | CustomEvent | UserID | UserAnonymousID | Metadata | StringDictGlobal | SetNodeAttributeDictGlobal | NodeAnimationResult | Profiler | OTable | StateAction | ReduxDeprecated | Vuex | MobX | NgRx | GraphQLDeprecated | PerformanceTrack | StringDictDeprecated | SetNodeAttributeDictDeprecated | StringDict | SetNodeAttributeDict | ResourceTimingDeprecatedDeprecated | ConnectionInformation | SetPageVisibility | LoadFontFace | SetNodeFocus | SetNodeAttributeURLBased | SetCSSDataURLBased | TechnicalInfo | CustomIssue | SetNodeSlot | MouseClick | MouseClickDeprecated | CreateIFrameDocument | AdoptedSSReplaceURLBased | AdoptedSSInsertRuleURLBased | AdoptedSSDeleteRule | AdoptedSSAddOwner | AdoptedSSRemoveOwner | JSException | Zustand | BatchMetadata | PartitionedMessage | NetworkRequest | WSChannel | ResourceTiming | Incident | LongAnimationTask | InputChange | SelectionChange | MouseThrashing | UnbindNodes | ResourceTimingDeprecated | TabChange | TabData | CanvasNode | TagTrigger | Redux | SetPageLocation | GraphQL | WebVitals;
|
|
630
587
|
export default Message;
|
package/dist/cjs/entry.js
CHANGED
|
@@ -1135,7 +1135,7 @@ const stars = 'repeat' in String.prototype
|
|
|
1135
1135
|
? (str) => '*'.repeat(str.length)
|
|
1136
1136
|
: (str) => str.replace(/./g, '*');
|
|
1137
1137
|
function normSpaces(str) {
|
|
1138
|
-
return str.trim().replace(/\s+/g, ' ');
|
|
1138
|
+
return str ? str.trim().replace(/\s+/g, ' ') : '';
|
|
1139
1139
|
}
|
|
1140
1140
|
// isAbsoluteUrl regexp: /^([a-z][a-z\d\+\-\.]*:)?\/\//i.test(url)
|
|
1141
1141
|
function isURL(s) {
|
|
@@ -1636,33 +1636,6 @@ function NodeAnimationResult(id, styles) {
|
|
|
1636
1636
|
styles,
|
|
1637
1637
|
];
|
|
1638
1638
|
}
|
|
1639
|
-
function CSSInsertRule(id, rule, index) {
|
|
1640
|
-
return [
|
|
1641
|
-
37 /* Messages.Type.CSSInsertRule */,
|
|
1642
|
-
id,
|
|
1643
|
-
rule,
|
|
1644
|
-
index,
|
|
1645
|
-
];
|
|
1646
|
-
}
|
|
1647
|
-
function CSSDeleteRule(id, index) {
|
|
1648
|
-
return [
|
|
1649
|
-
38 /* Messages.Type.CSSDeleteRule */,
|
|
1650
|
-
id,
|
|
1651
|
-
index,
|
|
1652
|
-
];
|
|
1653
|
-
}
|
|
1654
|
-
function Fetch(method, url, request, response, status, timestamp, duration) {
|
|
1655
|
-
return [
|
|
1656
|
-
39 /* Messages.Type.Fetch */,
|
|
1657
|
-
method,
|
|
1658
|
-
url,
|
|
1659
|
-
request,
|
|
1660
|
-
response,
|
|
1661
|
-
status,
|
|
1662
|
-
timestamp,
|
|
1663
|
-
duration,
|
|
1664
|
-
];
|
|
1665
|
-
}
|
|
1666
1639
|
function Profiler(name, duration, args, result) {
|
|
1667
1640
|
return [
|
|
1668
1641
|
40 /* Messages.Type.Profiler */,
|
|
@@ -1805,18 +1778,6 @@ function SetNodeFocus(id) {
|
|
|
1805
1778
|
id,
|
|
1806
1779
|
];
|
|
1807
1780
|
}
|
|
1808
|
-
function LongTask(timestamp, duration, context, containerType, containerSrc, containerId, containerName) {
|
|
1809
|
-
return [
|
|
1810
|
-
59 /* Messages.Type.LongTask */,
|
|
1811
|
-
timestamp,
|
|
1812
|
-
duration,
|
|
1813
|
-
context,
|
|
1814
|
-
containerType,
|
|
1815
|
-
containerSrc,
|
|
1816
|
-
containerId,
|
|
1817
|
-
containerName,
|
|
1818
|
-
];
|
|
1819
|
-
}
|
|
1820
1781
|
function SetNodeAttributeURLBased(id, name, value, baseURL) {
|
|
1821
1782
|
return [
|
|
1822
1783
|
60 /* Messages.Type.SetNodeAttributeURLBased */,
|
|
@@ -1855,15 +1816,6 @@ function SetNodeSlot(id, slotID) {
|
|
|
1855
1816
|
slotID,
|
|
1856
1817
|
];
|
|
1857
1818
|
}
|
|
1858
|
-
function CSSInsertRuleURLBased(id, rule, index, baseURL) {
|
|
1859
|
-
return [
|
|
1860
|
-
67 /* Messages.Type.CSSInsertRuleURLBased */,
|
|
1861
|
-
id,
|
|
1862
|
-
rule,
|
|
1863
|
-
index,
|
|
1864
|
-
baseURL,
|
|
1865
|
-
];
|
|
1866
|
-
}
|
|
1867
1819
|
function MouseClick(id, hesitationTime, label, selector, normalizedX, normalizedY) {
|
|
1868
1820
|
return [
|
|
1869
1821
|
68 /* Messages.Type.MouseClick */,
|
|
@@ -2143,9 +2095,6 @@ var _Messages = /*#__PURE__*/Object.freeze({
|
|
|
2143
2095
|
AdoptedSSRemoveOwner: AdoptedSSRemoveOwner,
|
|
2144
2096
|
AdoptedSSReplaceURLBased: AdoptedSSReplaceURLBased,
|
|
2145
2097
|
BatchMetadata: BatchMetadata,
|
|
2146
|
-
CSSDeleteRule: CSSDeleteRule,
|
|
2147
|
-
CSSInsertRule: CSSInsertRule,
|
|
2148
|
-
CSSInsertRuleURLBased: CSSInsertRuleURLBased,
|
|
2149
2098
|
CanvasNode: CanvasNode,
|
|
2150
2099
|
ConnectionInformation: ConnectionInformation,
|
|
2151
2100
|
ConsoleLog: ConsoleLog,
|
|
@@ -2155,7 +2104,6 @@ var _Messages = /*#__PURE__*/Object.freeze({
|
|
|
2155
2104
|
CreateTextNode: CreateTextNode,
|
|
2156
2105
|
CustomEvent: CustomEvent,
|
|
2157
2106
|
CustomIssue: CustomIssue,
|
|
2158
|
-
Fetch: Fetch,
|
|
2159
2107
|
GraphQL: GraphQL,
|
|
2160
2108
|
GraphQLDeprecated: GraphQLDeprecated,
|
|
2161
2109
|
Incident: Incident,
|
|
@@ -2163,7 +2111,6 @@ var _Messages = /*#__PURE__*/Object.freeze({
|
|
|
2163
2111
|
JSException: JSException,
|
|
2164
2112
|
LoadFontFace: LoadFontFace,
|
|
2165
2113
|
LongAnimationTask: LongAnimationTask$1,
|
|
2166
|
-
LongTask: LongTask,
|
|
2167
2114
|
Metadata: Metadata,
|
|
2168
2115
|
MobX: MobX,
|
|
2169
2116
|
MouseClick: MouseClick,
|
|
@@ -2385,7 +2332,13 @@ class CanvasRecorder {
|
|
|
2385
2332
|
this.app = app;
|
|
2386
2333
|
this.options = options;
|
|
2387
2334
|
this.snapshots = {};
|
|
2388
|
-
this.intervals =
|
|
2335
|
+
this.intervals = new Map();
|
|
2336
|
+
this.observers = new Map();
|
|
2337
|
+
this.uploadQueue = 0;
|
|
2338
|
+
this.MAX_CONCURRENT_UPLOADS = 2;
|
|
2339
|
+
this.MAX_QUEUE_SIZE = 50; // ~500 images max (50 batches × 10 images)
|
|
2340
|
+
this.pendingBatches = [];
|
|
2341
|
+
this.isProcessingQueue = false;
|
|
2389
2342
|
this.restartTracking = () => {
|
|
2390
2343
|
this.clear();
|
|
2391
2344
|
this.app.nodes.scanTree(this.captureCanvas);
|
|
@@ -2396,34 +2349,33 @@ class CanvasRecorder {
|
|
|
2396
2349
|
return;
|
|
2397
2350
|
}
|
|
2398
2351
|
const isIgnored = this.app.sanitizer.isObscured(id) || this.app.sanitizer.isHidden(id);
|
|
2399
|
-
if (isIgnored ||
|
|
2352
|
+
if (isIgnored || this.snapshots[id]) {
|
|
2400
2353
|
return;
|
|
2401
2354
|
}
|
|
2402
2355
|
const observer = new IntersectionObserver((entries) => {
|
|
2403
2356
|
entries.forEach((entry) => {
|
|
2404
2357
|
if (entry.isIntersecting) {
|
|
2405
|
-
if (
|
|
2406
|
-
|
|
2407
|
-
this.snapshots[id].paused = false;
|
|
2408
|
-
}
|
|
2409
|
-
else {
|
|
2410
|
-
this.recordCanvas(entry.target, id);
|
|
2411
|
-
}
|
|
2412
|
-
/**
|
|
2413
|
-
* We can switch this to start observing when element is in the view
|
|
2414
|
-
* but otherwise right now we're just pausing when it's not
|
|
2415
|
-
* just to save some bandwidth and space on backend
|
|
2416
|
-
* */
|
|
2417
|
-
// observer.unobserve(entry.target)
|
|
2358
|
+
if (this.snapshots[id] && this.snapshots[id].createdAt) {
|
|
2359
|
+
this.snapshots[id].paused = false;
|
|
2418
2360
|
}
|
|
2419
2361
|
else {
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2362
|
+
this.recordCanvas(entry.target, id);
|
|
2363
|
+
}
|
|
2364
|
+
/**
|
|
2365
|
+
* We can switch this to start observing when element is in the view
|
|
2366
|
+
* but otherwise right now we're just pausing when it's not
|
|
2367
|
+
* just to save some bandwidth and space on backend
|
|
2368
|
+
* */
|
|
2369
|
+
// observer.unobserve(entry.target)
|
|
2370
|
+
}
|
|
2371
|
+
else {
|
|
2372
|
+
if (this.snapshots[id]) {
|
|
2373
|
+
this.snapshots[id].paused = true;
|
|
2423
2374
|
}
|
|
2424
2375
|
}
|
|
2425
2376
|
});
|
|
2426
2377
|
});
|
|
2378
|
+
this.observers.set(id, observer);
|
|
2427
2379
|
observer.observe(node);
|
|
2428
2380
|
};
|
|
2429
2381
|
this.recordCanvas = (node, id) => {
|
|
@@ -2433,15 +2385,23 @@ class CanvasRecorder {
|
|
|
2433
2385
|
createdAt: ts,
|
|
2434
2386
|
paused: false,
|
|
2435
2387
|
dummy: document.createElement('canvas'),
|
|
2388
|
+
isCapturing: false,
|
|
2389
|
+
isStopped: false,
|
|
2436
2390
|
};
|
|
2437
2391
|
const canvasMsg = CanvasNode(id.toString(), ts);
|
|
2438
2392
|
this.app.send(canvasMsg);
|
|
2393
|
+
const cachedCanvas = node;
|
|
2439
2394
|
const captureFn = (canvas) => {
|
|
2395
|
+
if (!this.snapshots[id] || this.snapshots[id].isCapturing || this.snapshots[id].isStopped) {
|
|
2396
|
+
return;
|
|
2397
|
+
}
|
|
2398
|
+
this.snapshots[id].isCapturing = true;
|
|
2440
2399
|
captureSnapshot(canvas, this.options.quality, this.snapshots[id].dummy, this.options.fixedScaling, this.fileExt, (blob) => {
|
|
2441
|
-
if (
|
|
2400
|
+
if (this.snapshots[id]) {
|
|
2401
|
+
this.snapshots[id].isCapturing = false;
|
|
2402
|
+
}
|
|
2403
|
+
if (!blob || !this.snapshots[id] || this.snapshots[id].isStopped) {
|
|
2442
2404
|
return;
|
|
2443
|
-
if (!this.snapshots[id]) {
|
|
2444
|
-
return this.app.debug.warn('Canvas not present in snapshots after capture:', this.snapshots, id);
|
|
2445
2405
|
}
|
|
2446
2406
|
this.snapshots[id].images.push({ id: this.app.timestamp(), data: blob });
|
|
2447
2407
|
if (this.snapshots[id].images.length > 9) {
|
|
@@ -2451,32 +2411,29 @@ class CanvasRecorder {
|
|
|
2451
2411
|
});
|
|
2452
2412
|
};
|
|
2453
2413
|
const int = setInterval(() => {
|
|
2454
|
-
const
|
|
2455
|
-
|
|
2456
|
-
if (!this.snapshots[id]) {
|
|
2414
|
+
const snapshot = this.snapshots[id];
|
|
2415
|
+
if (!snapshot || snapshot.isStopped) {
|
|
2457
2416
|
this.app.debug.log('Canvas is not present in {snapshots}');
|
|
2458
|
-
|
|
2417
|
+
this.cleanupCanvas(id);
|
|
2459
2418
|
return;
|
|
2460
2419
|
}
|
|
2461
|
-
if (!
|
|
2462
|
-
this.app.debug.log('Canvas element not in sync',
|
|
2463
|
-
|
|
2420
|
+
if (!document.contains(cachedCanvas)) {
|
|
2421
|
+
this.app.debug.log('Canvas element not in sync', cachedCanvas, node);
|
|
2422
|
+
this.cleanupCanvas(id);
|
|
2464
2423
|
return;
|
|
2465
2424
|
}
|
|
2466
|
-
|
|
2467
|
-
if (
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
captureFn(canvas);
|
|
2475
|
-
}
|
|
2425
|
+
if (!snapshot.paused) {
|
|
2426
|
+
if (this.options.useAnimationFrame) {
|
|
2427
|
+
requestAnimationFrame(() => {
|
|
2428
|
+
captureFn(cachedCanvas);
|
|
2429
|
+
});
|
|
2430
|
+
}
|
|
2431
|
+
else {
|
|
2432
|
+
captureFn(cachedCanvas);
|
|
2476
2433
|
}
|
|
2477
2434
|
}
|
|
2478
2435
|
}, this.interval);
|
|
2479
|
-
this.intervals.
|
|
2436
|
+
this.intervals.set(id, int);
|
|
2480
2437
|
};
|
|
2481
2438
|
this.fileExt = options.fileExt ?? 'webp';
|
|
2482
2439
|
this.interval = 1000 / options.fps;
|
|
@@ -2491,6 +2448,30 @@ class CanvasRecorder {
|
|
|
2491
2448
|
if (Object.keys(this.snapshots).length === 0) {
|
|
2492
2449
|
return;
|
|
2493
2450
|
}
|
|
2451
|
+
if (this.pendingBatches.length >= this.MAX_QUEUE_SIZE) {
|
|
2452
|
+
this.app.debug.warn('Upload queue full, dropping canvas batch');
|
|
2453
|
+
return;
|
|
2454
|
+
}
|
|
2455
|
+
this.pendingBatches.push({ images, canvasId, createdAt });
|
|
2456
|
+
if (!this.isProcessingQueue) {
|
|
2457
|
+
this.processUploadQueue();
|
|
2458
|
+
}
|
|
2459
|
+
}
|
|
2460
|
+
async processUploadQueue() {
|
|
2461
|
+
this.isProcessingQueue = true;
|
|
2462
|
+
while (this.pendingBatches.length > 0) {
|
|
2463
|
+
if (this.uploadQueue >= this.MAX_CONCURRENT_UPLOADS) {
|
|
2464
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
2465
|
+
continue;
|
|
2466
|
+
}
|
|
2467
|
+
const batch = this.pendingBatches.shift();
|
|
2468
|
+
if (!batch)
|
|
2469
|
+
break;
|
|
2470
|
+
this.uploadBatch(batch.images, batch.canvasId, batch.createdAt);
|
|
2471
|
+
}
|
|
2472
|
+
this.isProcessingQueue = false;
|
|
2473
|
+
}
|
|
2474
|
+
uploadBatch(images, canvasId, createdAt) {
|
|
2494
2475
|
const formData = new FormData();
|
|
2495
2476
|
images.forEach((snapshot) => {
|
|
2496
2477
|
const blob = snapshot.data;
|
|
@@ -2508,6 +2489,7 @@ class CanvasRecorder {
|
|
|
2508
2489
|
void this.app.start({}, true);
|
|
2509
2490
|
}, 250);
|
|
2510
2491
|
};
|
|
2492
|
+
this.uploadQueue++;
|
|
2511
2493
|
fetch(this.app.options.ingestPoint + '/v1/web/images', {
|
|
2512
2494
|
method: 'POST',
|
|
2513
2495
|
headers: {
|
|
@@ -2523,10 +2505,50 @@ class CanvasRecorder {
|
|
|
2523
2505
|
})
|
|
2524
2506
|
.catch((e) => {
|
|
2525
2507
|
this.app.debug.error('error saving canvas', e);
|
|
2508
|
+
})
|
|
2509
|
+
.finally(() => {
|
|
2510
|
+
this.uploadQueue--;
|
|
2526
2511
|
});
|
|
2527
2512
|
}
|
|
2513
|
+
cleanupCanvas(id) {
|
|
2514
|
+
if (this.snapshots[id]) {
|
|
2515
|
+
this.snapshots[id].isStopped = true;
|
|
2516
|
+
}
|
|
2517
|
+
const interval = this.intervals.get(id);
|
|
2518
|
+
if (interval) {
|
|
2519
|
+
clearInterval(interval);
|
|
2520
|
+
this.intervals.delete(id);
|
|
2521
|
+
}
|
|
2522
|
+
const observer = this.observers.get(id);
|
|
2523
|
+
if (observer) {
|
|
2524
|
+
observer.disconnect();
|
|
2525
|
+
this.observers.delete(id);
|
|
2526
|
+
}
|
|
2527
|
+
if (this.snapshots[id]?.dummy) {
|
|
2528
|
+
const dummy = this.snapshots[id].dummy;
|
|
2529
|
+
dummy.width = 0;
|
|
2530
|
+
dummy.height = 0;
|
|
2531
|
+
}
|
|
2532
|
+
delete this.snapshots[id];
|
|
2533
|
+
}
|
|
2528
2534
|
clear() {
|
|
2529
|
-
|
|
2535
|
+
// Flush remaining images before cleanup
|
|
2536
|
+
Object.keys(this.snapshots).forEach((idStr) => {
|
|
2537
|
+
const id = parseInt(idStr, 10);
|
|
2538
|
+
const snapshot = this.snapshots[id];
|
|
2539
|
+
if (snapshot && snapshot.images.length > 0) {
|
|
2540
|
+
this.sendSnaps(snapshot.images, id, snapshot.createdAt);
|
|
2541
|
+
snapshot.images = [];
|
|
2542
|
+
}
|
|
2543
|
+
});
|
|
2544
|
+
Object.keys(this.snapshots).forEach((idStr) => {
|
|
2545
|
+
const id = parseInt(idStr, 10);
|
|
2546
|
+
this.cleanupCanvas(id);
|
|
2547
|
+
});
|
|
2548
|
+
// don't clear pendingBatches or stop queue processing
|
|
2549
|
+
// to allow flushed images to finish uploading in the background
|
|
2550
|
+
this.intervals.clear();
|
|
2551
|
+
this.observers.clear();
|
|
2530
2552
|
this.snapshots = {};
|
|
2531
2553
|
}
|
|
2532
2554
|
}
|
|
@@ -4346,7 +4368,7 @@ class Ticker {
|
|
|
4346
4368
|
* this value is injected during build time via rollup
|
|
4347
4369
|
* */
|
|
4348
4370
|
// @ts-ignore
|
|
4349
|
-
const workerBodyFn = "!function(){\"use strict\";class t{constructor(t,s,i,e=10,n=250,h,r){this.onUnauthorised=s,this.onFailure=i,this.MAX_ATTEMPTS_COUNT=e,this.ATTEMPT_TIMEOUT=n,this.onCompress=h,this.pageNo=r,this.attemptsCount=0,this.busy=!1,this.queue=[],this.token=null,this.lastBatchNum=0,this.ingestURL=t+\"/v1/web/i\",this.isCompressing=void 0!==h}getQueueStatus(){return 0===this.queue.length&&!this.busy}authorise(t){this.token=t,this.busy||this.sendNext()}push(t){if(this.busy||!this.token)this.queue.push(t);else if(this.busy=!0,this.isCompressing&&this.onCompress)this.onCompress(t);else{const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}}sendNext(){const t=this.queue.shift();if(t)if(this.busy=!0,this.isCompressing&&this.onCompress)this.onCompress(t);else{const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}else this.busy=!1}retry(t,s,i){this.attemptsCount>=this.MAX_ATTEMPTS_COUNT?this.onFailure(`Failed to send batch after ${this.attemptsCount} attempts.`):(this.attemptsCount++,setTimeout((()=>this.sendBatch(t,s,i)),this.ATTEMPT_TIMEOUT*this.attemptsCount))}sendBatch(t,s,i){var e;const n=null==i?void 0:i.toString().replace(/^([^_]+)_([^_]+).*/,\"$1_$2_$3\");this.busy=!0;const h={Authorization:`Bearer ${this.token}`};s&&(h[\"Content-Encoding\"]=\"gzip\"),null!==this.token?fetch(`${this.ingestURL}?batch=${null!==(e=this.pageNo)&&void 0!==e?e:\"noPageNum\"}_${null!=n?n:\"noBatchNum\"}`,{body:t,method:\"POST\",headers:h,keepalive:t.length<65536}).then((e=>{if(401===e.status)return this.busy=!1,void this.onUnauthorised();e.status>=400?this.retry(t,s,`${null!=i?i:\"noBatchNum\"}_network:${e.status}`):(this.attemptsCount=0,this.sendNext())})).catch((e=>{console.warn(\"OpenReplay:\",e),this.retry(t,s,`${null!=i?i:\"noBatchNum\"}_reject:${e.message}`)})):setTimeout((()=>{this.sendBatch(t,s,`${null!=i?i:\"noBatchNum\"}_newToken`)}),500)}sendCompressed(t){const s=++this.lastBatchNum;this.sendBatch(t,!0,s)}sendUncompressed(t){const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}clean(){this.sendNext(),setTimeout((()=>{this.token=null,this.queue.length=0}),10)}}const s=\"function\"==typeof TextEncoder?new TextEncoder:{encode(t){const s=t.length,i=new Uint8Array(3*s);let e=-1;for(let n=0,h=0,r=0;r!==s;){if(n=t.charCodeAt(r),r+=1,n>=55296&&n<=56319){if(r===s){i[e+=1]=239,i[e+=1]=191,i[e+=1]=189;break}if(h=t.charCodeAt(r),!(h>=56320&&h<=57343)){i[e+=1]=239,i[e+=1]=191,i[e+=1]=189;continue}if(n=1024*(n-55296)+h-56320+65536,r+=1,n>65535){i[e+=1]=240|n>>>18,i[e+=1]=128|n>>>12&63,i[e+=1]=128|n>>>6&63,i[e+=1]=128|63&n;continue}}n<=127?i[e+=1]=0|n:n<=2047?(i[e+=1]=192|n>>>6,i[e+=1]=128|63&n):(i[e+=1]=224|n>>>12,i[e+=1]=128|n>>>6&63,i[e+=1]=128|63&n)}return i.subarray(0,e+1)}};class i{constructor(t){this.size=t,this.offset=0,this.checkpointOffset=0,this.data=new Uint8Array(t)}getCurrentOffset(){return this.offset}checkpoint(){this.checkpointOffset=this.offset}get isEmpty(){return 0===this.offset}skip(t){return this.offset+=t,this.offset<=this.size}set(t,s){this.data.set(t,s)}boolean(t){return this.data[this.offset++]=+t,this.offset<=this.size}uint(t){for((t<0||t>Number.MAX_SAFE_INTEGER)&&(t=0);t>=128;)this.data[this.offset++]=t%256|128,t=Math.floor(t/128);return this.data[this.offset++]=t,this.offset<=this.size}int(t){return t=Math.round(t),this.uint(t>=0?2*t:-2*t-1)}string(t){const i=s.encode(t),e=i.byteLength;return!(!this.uint(e)||this.offset+e>this.size)&&(this.data.set(i,this.offset),this.offset+=e,!0)}reset(){this.offset=0,this.checkpointOffset=0}flush(){const t=this.data.slice(0,this.checkpointOffset);return this.reset(),t}}class e extends i{encode(t){switch(t[0]){case 0:case 11:case 114:case 115:return this.uint(t[1]);case 4:case 44:case 47:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3]);case 5:case 20:case 38:case 65:case 70:case 75:case 76:case 77:case 82:return this.uint(t[1])&&this.uint(t[2]);case 6:return this.int(t[1])&&this.int(t[2]);case 7:return!0;case 8:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.string(t[4])&&this.boolean(t[5]);case 9:case 10:case 24:case 35:case 51:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3]);case 12:case 52:case 61:case 71:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3]);case 13:case 14:case 17:case 34:case 36:case 50:case 54:return this.uint(t[1])&&this.string(t[2]);case 16:return this.uint(t[1])&&this.int(t[2])&&this.int(t[3]);case 18:return this.uint(t[1])&&this.string(t[2])&&this.int(t[3]);case 19:return this.uint(t[1])&&this.boolean(t[2]);case 21:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.string(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8]);case 22:case 27:case 30:case 41:case 45:case 46:case 43:case 63:case 64:case 79:case 124:return this.string(t[1])&&this.string(t[2]);case 23:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8])&&this.uint(t[9]);case 28:case 29:case 42:case 117:case 118:return this.string(t[1]);case 37:return this.uint(t[1])&&this.string(t[2])&&this.uint(t[3]);case 39:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.uint(t[7]);case 40:return this.string(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4]);case 48:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.int(t[5]);case 49:return this.int(t[1])&&this.int(t[2])&&this.uint(t[3])&&this.uint(t[4]);case 53:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8]);case 55:return this.boolean(t[1]);case 57:case 60:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 58:case 120:return this.int(t[1]);case 59:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.string(t[5])&&this.string(t[6])&&this.string(t[7]);case 67:case 73:return this.uint(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.string(t[4]);case 68:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])&&this.uint(t[6]);case 69:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4]);case 78:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 81:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.int(t[4])&&this.string(t[5]);case 83:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.string(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8])&&this.uint(t[9]);case 84:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.uint(t[4])&&this.string(t[5])&&this.string(t[6]);case 85:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8])&&this.uint(t[9])&&this.boolean(t[10])&&this.uint(t[11])&&this.uint(t[12])&&this.uint(t[13])&&this.uint(t[14])&&this.uint(t[15])&&this.uint(t[16])&&this.uint(t[17]);case 87:return this.string(t[1])&&this.int(t[2])&&this.int(t[3]);case 89:return this.string(t[1])&&this.int(t[2])&&this.int(t[3])&&this.int(t[4])&&this.int(t[5])&&this.string(t[6]);case 112:return this.uint(t[1])&&this.string(t[2])&&this.boolean(t[3])&&this.string(t[4])&&this.int(t[5])&&this.int(t[6]);case 113:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3]);case 116:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8])&&this.uint(t[9])&&this.boolean(t[10]);case 119:return this.string(t[1])&&this.uint(t[2]);case 121:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.uint(t[4]);case 122:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.string(t[4]);case 123:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])}}}class n{constructor(t,s,i,n,h,r){this.pageNo=t,this.timestamp=s,this.url=i,this.onBatch=n,this.tabId=h,this.onOfflineEnd=r,this.nextIndex=0,this.beaconSize=2e5,this.encoder=new e(this.beaconSize),this.sizeBuffer=new Uint8Array(3),this.isEmpty=!0,this.checkpoints=[],this.beaconSizeLimit=1e6,this.prepare()}writeType(t){return this.encoder.uint(t[0])}writeFields(t){return this.encoder.encode(t)}writeSizeAt(t,s){for(let s=0;s<3;s++)this.sizeBuffer[s]=t>>8*s;this.encoder.set(this.sizeBuffer,s)}prepare(){if(!this.encoder.isEmpty)return;this.checkpoints.length=0;const t=[81,1,this.pageNo,this.nextIndex,this.timestamp,this.url],s=[0,this.timestamp],i=[118,this.tabId];this.writeType(t),this.writeFields(t),this.writeWithSize(s),this.writeWithSize(i),this.isEmpty=!0}writeWithSize(t){const s=this.encoder;if(!this.writeType(t)||!s.skip(3))return!1;const i=s.getCurrentOffset(),e=this.writeFields(t);if(e){const e=s.getCurrentOffset()-i;if(e>16777215)return console.warn(\"OpenReplay: max message size overflow.\"),!1;this.writeSizeAt(e,i-3),s.checkpoint(),this.checkpoints.push(s.getCurrentOffset()),this.isEmpty=this.isEmpty&&0===t[0],this.nextIndex++}return e}setBeaconSizeLimit(t){this.beaconSizeLimit=t}writeMessage(t){if(-1===t[0])return this.finaliseBatch(),this.onOfflineEnd();0===t[0]&&(this.timestamp=t[1]),122===t[0]&&(this.url=t[1]),this.writeWithSize(t)||(this.finaliseBatch(),this.writeWithSize(t)||(this.encoder=new e(this.beaconSizeLimit),this.prepare(),this.writeWithSize(t)?this.finaliseBatch():console.warn(\"OpenReplay: beacon size overflow. Skipping large message.\",t,this),this.encoder=new e(this.beaconSize),this.prepare()))}finaliseBatch(t=!1){if(this.isEmpty)return;const s=this.encoder.flush();this.onBatch(s,t),this.prepare()}clean(){this.encoder.reset(),this.checkpoints.length=0}}var h;!function(t){t[t.NotActive=0]=\"NotActive\",t[t.Starting=1]=\"Starting\",t[t.Stopping=2]=\"Stopping\",t[t.Active=3]=\"Active\",t[t.Stopped=4]=\"Stopped\"}(h||(h={}));let r=null,u=null,a=h.NotActive;function o(t){u&&u.finaliseBatch(t)}function c(){return new Promise((t=>{a=h.Stopping,null!==p&&(clearInterval(p),p=null),u&&(u.clean(),u=null),r&&(r.clean(),setTimeout((()=>{r=null}),20)),setTimeout((()=>{a=h.NotActive,t(null)}),100)}))}function g(){[h.Stopped,h.Stopping].includes(a)||(postMessage(\"a_stop\"),c().then((()=>{postMessage(\"a_start\")})))}let l,p=null;self.onmessage=({data:s})=>{if(\"stop\"===s)return o(),void c().then((()=>{a=h.Stopped}));if(\"forceFlushBatch\"!==s)if(\"closing\"!==s){if(!Array.isArray(s)){if(\"compressed\"===s.type){if(!r)return console.debug(\"OR WebWorker: sender not initialised. Compressed batch.\"),void g();s.batch&&r.sendCompressed(s.batch)}if(\"uncompressed\"===s.type){if(!r)return console.debug(\"OR WebWorker: sender not initialised. Uncompressed batch.\"),void g();s.batch&&r.sendUncompressed(s.batch)}return\"start\"===s.type?(a=h.Starting,r=new t(s.ingestPoint,(()=>{g()}),(t=>{!function(t){postMessage({type:\"failure\",reason:t}),c()}(t)}),s.connAttemptCount,s.connAttemptGap,(t=>{postMessage({type:\"compress\",batch:t},[t.buffer])}),s.pageNo),u=new n(s.pageNo,s.timestamp,s.url,((t,s)=>{r&&(s?r.sendUncompressed(t):r.push(t))}),s.tabId,(()=>postMessage({type:\"queue_empty\"}))),null===p&&(p=setInterval(o,3e4)),a=h.Active):\"auth\"===s.type?r?u?(r.authorise(s.token),void(s.beaconSizeLimit&&u.setBeaconSizeLimit(s.beaconSizeLimit))):(console.debug(\"OR WebWorker: writer not initialised. Received auth.\"),void g()):(console.debug(\"OR WebWorker: sender not initialised. Received auth.\"),void g()):void 0}if(u){const t=u;s.forEach((s=>{55===s[0]&&(s[1]?l=setTimeout((()=>g()),18e5):clearTimeout(l)),t.writeMessage(s)}))}else postMessage(\"not_init\"),g()}else o(!0);else o()}}();\n";
|
|
4371
|
+
const workerBodyFn = "!function(){\"use strict\";class t{constructor(t,s,i,e=10,n=250,h,r){this.onUnauthorised=s,this.onFailure=i,this.MAX_ATTEMPTS_COUNT=e,this.ATTEMPT_TIMEOUT=n,this.onCompress=h,this.pageNo=r,this.attemptsCount=0,this.busy=!1,this.queue=[],this.token=null,this.lastBatchNum=0,this.ingestURL=t+\"/v1/web/i\",this.isCompressing=void 0!==h}getQueueStatus(){return 0===this.queue.length&&!this.busy}authorise(t){this.token=t,this.busy||this.sendNext()}push(t){if(this.busy||!this.token)this.queue.push(t);else if(this.busy=!0,this.isCompressing&&this.onCompress)this.onCompress(t);else{const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}}sendNext(){const t=this.queue.shift();if(t)if(this.busy=!0,this.isCompressing&&this.onCompress)this.onCompress(t);else{const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}else this.busy=!1}retry(t,s,i){this.attemptsCount>=this.MAX_ATTEMPTS_COUNT?this.onFailure(`Failed to send batch after ${this.attemptsCount} attempts.`):(this.attemptsCount++,setTimeout((()=>this.sendBatch(t,s,i)),this.ATTEMPT_TIMEOUT*this.attemptsCount))}sendBatch(t,s,i){var e;const n=null==i?void 0:i.toString().replace(/^([^_]+)_([^_]+).*/,\"$1_$2_$3\");this.busy=!0;const h={Authorization:`Bearer ${this.token}`};s&&(h[\"Content-Encoding\"]=\"gzip\"),null!==this.token?fetch(`${this.ingestURL}?batch=${null!==(e=this.pageNo)&&void 0!==e?e:\"noPageNum\"}_${null!=n?n:\"noBatchNum\"}`,{body:t,method:\"POST\",headers:h,keepalive:t.length<65536}).then((e=>{if(401===e.status)return this.busy=!1,void this.onUnauthorised();e.status>=400?this.retry(t,s,`${null!=i?i:\"noBatchNum\"}_network:${e.status}`):(this.attemptsCount=0,this.sendNext())})).catch((e=>{console.warn(\"OpenReplay:\",e),this.retry(t,s,`${null!=i?i:\"noBatchNum\"}_reject:${e.message}`)})):setTimeout((()=>{this.sendBatch(t,s,`${null!=i?i:\"noBatchNum\"}_newToken`)}),500)}sendCompressed(t){const s=++this.lastBatchNum;this.sendBatch(t,!0,s)}sendUncompressed(t){const s=++this.lastBatchNum;this.sendBatch(t,!1,s)}clean(){this.sendNext(),setTimeout((()=>{this.token=null,this.queue.length=0}),10)}}const s=\"function\"==typeof TextEncoder?new TextEncoder:{encode(t){const s=t.length,i=new Uint8Array(3*s);let e=-1;for(let n=0,h=0,r=0;r!==s;){if(n=t.charCodeAt(r),r+=1,n>=55296&&n<=56319){if(r===s){i[e+=1]=239,i[e+=1]=191,i[e+=1]=189;break}if(h=t.charCodeAt(r),!(h>=56320&&h<=57343)){i[e+=1]=239,i[e+=1]=191,i[e+=1]=189;continue}if(n=1024*(n-55296)+h-56320+65536,r+=1,n>65535){i[e+=1]=240|n>>>18,i[e+=1]=128|n>>>12&63,i[e+=1]=128|n>>>6&63,i[e+=1]=128|63&n;continue}}n<=127?i[e+=1]=0|n:n<=2047?(i[e+=1]=192|n>>>6,i[e+=1]=128|63&n):(i[e+=1]=224|n>>>12,i[e+=1]=128|n>>>6&63,i[e+=1]=128|63&n)}return i.subarray(0,e+1)}};class i{constructor(t){this.size=t,this.offset=0,this.checkpointOffset=0,this.data=new Uint8Array(t)}getCurrentOffset(){return this.offset}checkpoint(){this.checkpointOffset=this.offset}get isEmpty(){return 0===this.offset}skip(t){return this.offset+=t,this.offset<=this.size}set(t,s){this.data.set(t,s)}boolean(t){return this.data[this.offset++]=+t,this.offset<=this.size}uint(t){for((t<0||t>Number.MAX_SAFE_INTEGER)&&(t=0);t>=128;)this.data[this.offset++]=t%256|128,t=Math.floor(t/128);return this.data[this.offset++]=t,this.offset<=this.size}int(t){return t=Math.round(t),this.uint(t>=0?2*t:-2*t-1)}string(t){const i=s.encode(t),e=i.byteLength;return!(!this.uint(e)||this.offset+e>this.size)&&(this.data.set(i,this.offset),this.offset+=e,!0)}reset(){this.offset=0,this.checkpointOffset=0}flush(){const t=this.data.slice(0,this.checkpointOffset);return this.reset(),t}}class e extends i{encode(t){switch(t[0]){case 0:case 11:case 114:case 115:return this.uint(t[1]);case 4:case 44:case 47:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3]);case 5:case 20:case 65:case 70:case 75:case 76:case 77:case 82:return this.uint(t[1])&&this.uint(t[2]);case 6:return this.int(t[1])&&this.int(t[2]);case 7:return!0;case 8:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.string(t[4])&&this.boolean(t[5]);case 9:case 10:case 24:case 35:case 51:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3]);case 12:case 52:case 61:case 71:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3]);case 13:case 14:case 17:case 34:case 36:case 50:case 54:return this.uint(t[1])&&this.string(t[2]);case 16:return this.uint(t[1])&&this.int(t[2])&&this.int(t[3]);case 18:return this.uint(t[1])&&this.string(t[2])&&this.int(t[3]);case 19:return this.uint(t[1])&&this.boolean(t[2]);case 21:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.string(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8]);case 22:case 27:case 30:case 41:case 45:case 46:case 43:case 63:case 64:case 79:case 124:return this.string(t[1])&&this.string(t[2]);case 23:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8])&&this.uint(t[9]);case 28:case 29:case 42:case 117:case 118:return this.string(t[1]);case 40:return this.string(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4]);case 48:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.int(t[5]);case 49:return this.int(t[1])&&this.int(t[2])&&this.uint(t[3])&&this.uint(t[4]);case 53:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8]);case 55:return this.boolean(t[1]);case 57:case 60:return this.uint(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 58:case 120:return this.int(t[1]);case 68:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])&&this.uint(t[6]);case 69:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3])&&this.string(t[4]);case 73:return this.uint(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.string(t[4]);case 78:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4]);case 81:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.int(t[4])&&this.string(t[5]);case 83:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.string(t[5])&&this.uint(t[6])&&this.uint(t[7])&&this.uint(t[8])&&this.uint(t[9]);case 84:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.uint(t[4])&&this.string(t[5])&&this.string(t[6]);case 85:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8])&&this.uint(t[9])&&this.boolean(t[10])&&this.uint(t[11])&&this.uint(t[12])&&this.uint(t[13])&&this.uint(t[14])&&this.uint(t[15])&&this.uint(t[16])&&this.uint(t[17]);case 87:return this.string(t[1])&&this.int(t[2])&&this.int(t[3]);case 89:return this.string(t[1])&&this.int(t[2])&&this.int(t[3])&&this.int(t[4])&&this.int(t[5])&&this.string(t[6]);case 112:return this.uint(t[1])&&this.string(t[2])&&this.boolean(t[3])&&this.string(t[4])&&this.int(t[5])&&this.int(t[6]);case 113:return this.uint(t[1])&&this.uint(t[2])&&this.string(t[3]);case 116:return this.uint(t[1])&&this.uint(t[2])&&this.uint(t[3])&&this.uint(t[4])&&this.uint(t[5])&&this.uint(t[6])&&this.string(t[7])&&this.string(t[8])&&this.uint(t[9])&&this.boolean(t[10]);case 119:return this.string(t[1])&&this.uint(t[2]);case 121:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.uint(t[4]);case 122:return this.string(t[1])&&this.string(t[2])&&this.uint(t[3])&&this.string(t[4]);case 123:return this.string(t[1])&&this.string(t[2])&&this.string(t[3])&&this.string(t[4])&&this.uint(t[5])}}}class n{constructor(t,s,i,n,h,r){this.pageNo=t,this.timestamp=s,this.url=i,this.onBatch=n,this.tabId=h,this.onOfflineEnd=r,this.nextIndex=0,this.beaconSize=2e5,this.encoder=new e(this.beaconSize),this.sizeBuffer=new Uint8Array(3),this.isEmpty=!0,this.checkpoints=[],this.beaconSizeLimit=1e6,this.prepare()}writeType(t){return this.encoder.uint(t[0])}writeFields(t){return this.encoder.encode(t)}writeSizeAt(t,s){for(let s=0;s<3;s++)this.sizeBuffer[s]=t>>8*s;this.encoder.set(this.sizeBuffer,s)}prepare(){if(!this.encoder.isEmpty)return;this.checkpoints.length=0;const t=[81,1,this.pageNo,this.nextIndex,this.timestamp,this.url],s=[0,this.timestamp],i=[118,this.tabId];this.writeType(t),this.writeFields(t),this.writeWithSize(s),this.writeWithSize(i),this.isEmpty=!0}writeWithSize(t){const s=this.encoder;if(!this.writeType(t)||!s.skip(3))return!1;const i=s.getCurrentOffset(),e=this.writeFields(t);if(e){const e=s.getCurrentOffset()-i;if(e>16777215)return console.warn(\"OpenReplay: max message size overflow.\"),!1;this.writeSizeAt(e,i-3),s.checkpoint(),this.checkpoints.push(s.getCurrentOffset()),this.isEmpty=this.isEmpty&&0===t[0],this.nextIndex++}return e}setBeaconSizeLimit(t){this.beaconSizeLimit=t}writeMessage(t){if(-1===t[0])return this.finaliseBatch(),this.onOfflineEnd();0===t[0]&&(this.timestamp=t[1]),122===t[0]&&(this.url=t[1]),this.writeWithSize(t)||(this.finaliseBatch(),this.writeWithSize(t)||(this.encoder=new e(this.beaconSizeLimit),this.prepare(),this.writeWithSize(t)?this.finaliseBatch():console.warn(\"OpenReplay: beacon size overflow. Skipping large message.\",t,this),this.encoder=new e(this.beaconSize),this.prepare()))}finaliseBatch(t=!1){if(this.isEmpty)return;const s=this.encoder.flush();this.onBatch(s,t),this.prepare()}clean(){this.encoder.reset(),this.checkpoints.length=0}}var h;!function(t){t[t.NotActive=0]=\"NotActive\",t[t.Starting=1]=\"Starting\",t[t.Stopping=2]=\"Stopping\",t[t.Active=3]=\"Active\",t[t.Stopped=4]=\"Stopped\"}(h||(h={}));let r=null,u=null,a=h.NotActive;function o(t){u&&u.finaliseBatch(t)}function c(){return new Promise((t=>{a=h.Stopping,null!==p&&(clearInterval(p),p=null),u&&(u.clean(),u=null),r&&(r.clean(),setTimeout((()=>{r=null}),20)),setTimeout((()=>{a=h.NotActive,t(null)}),100)}))}function g(){[h.Stopped,h.Stopping].includes(a)||(postMessage(\"a_stop\"),c().then((()=>{postMessage(\"a_start\")})))}let l,p=null;self.onmessage=({data:s})=>{if(\"stop\"===s)return o(),void c().then((()=>{a=h.Stopped}));if(\"forceFlushBatch\"!==s)if(\"closing\"!==s){if(!Array.isArray(s)){if(\"compressed\"===s.type){if(!r)return console.debug(\"OR WebWorker: sender not initialised. Compressed batch.\"),void g();s.batch&&r.sendCompressed(s.batch)}if(\"uncompressed\"===s.type){if(!r)return console.debug(\"OR WebWorker: sender not initialised. Uncompressed batch.\"),void g();s.batch&&r.sendUncompressed(s.batch)}return\"start\"===s.type?(a=h.Starting,r=new t(s.ingestPoint,(()=>{g()}),(t=>{!function(t){postMessage({type:\"failure\",reason:t}),c()}(t)}),s.connAttemptCount,s.connAttemptGap,(t=>{postMessage({type:\"compress\",batch:t},[t.buffer])}),s.pageNo),u=new n(s.pageNo,s.timestamp,s.url,((t,s)=>{r&&(s?r.sendUncompressed(t):r.push(t))}),s.tabId,(()=>postMessage({type:\"queue_empty\"}))),null===p&&(p=setInterval(o,3e4)),a=h.Active):\"auth\"===s.type?r?u?(r.authorise(s.token),void(s.beaconSizeLimit&&u.setBeaconSizeLimit(s.beaconSizeLimit))):(console.debug(\"OR WebWorker: writer not initialised. Received auth.\"),void g()):(console.debug(\"OR WebWorker: sender not initialised. Received auth.\"),void g()):void 0}if(u){const t=u;s.forEach((s=>{55===s[0]&&(s[1]?l=setTimeout((()=>g()),18e5):clearTimeout(l)),t.writeMessage(s)}))}else postMessage(\"not_init\"),g()}else o(!0);else o()}}();\n";
|
|
4350
4372
|
const CANCELED = 'canceled';
|
|
4351
4373
|
const bufferStorageKey = 'or_buffer_1';
|
|
4352
4374
|
const UnsuccessfulStart = (reason) => ({ reason, success: false });
|
|
@@ -4402,7 +4424,7 @@ class App {
|
|
|
4402
4424
|
this.stopCallbacks = [];
|
|
4403
4425
|
this.commitCallbacks = [];
|
|
4404
4426
|
this.activityState = ActivityState.NotActive;
|
|
4405
|
-
this.version = '17.1.
|
|
4427
|
+
this.version = '17.1.6'; // TODO: version compatability check inside each plugin.
|
|
4406
4428
|
this.socketMode = false;
|
|
4407
4429
|
this.compressionThreshold = 24 * 1000;
|
|
4408
4430
|
this.bc = null;
|
|
@@ -8826,6 +8848,8 @@ function webAnimations(app, options = {}) {
|
|
|
8826
8848
|
handled.add(anim);
|
|
8827
8849
|
anim.addEventListener('finish', () => {
|
|
8828
8850
|
const lastKF = anim.effect.getKeyframes().at(-1);
|
|
8851
|
+
if (!lastKF)
|
|
8852
|
+
return;
|
|
8829
8853
|
const computedStyle = getComputedStyle(el);
|
|
8830
8854
|
const keys = Object.keys(lastKF).filter((p) => !toIgnore.includes(p));
|
|
8831
8855
|
// @ts-ignore
|
|
@@ -9237,7 +9261,7 @@ class ConstantProperties {
|
|
|
9237
9261
|
user_id: this.user_id,
|
|
9238
9262
|
distinct_id: this.deviceId,
|
|
9239
9263
|
sdk_edition: 'web',
|
|
9240
|
-
sdk_version: '17.1.
|
|
9264
|
+
sdk_version: '17.1.6',
|
|
9241
9265
|
timezone: getUTCOffsetString(),
|
|
9242
9266
|
search_engine: this.searchEngine,
|
|
9243
9267
|
};
|
|
@@ -9881,7 +9905,7 @@ class API {
|
|
|
9881
9905
|
this.signalStartIssue = (reason, missingApi) => {
|
|
9882
9906
|
const doNotTrack = this.checkDoNotTrack();
|
|
9883
9907
|
console.log("Tracker couldn't start due to:", JSON.stringify({
|
|
9884
|
-
trackerVersion: '17.1.
|
|
9908
|
+
trackerVersion: '17.1.6',
|
|
9885
9909
|
projectKey: this.options.projectKey,
|
|
9886
9910
|
doNotTrack,
|
|
9887
9911
|
reason: missingApi.length ? `missing api: ${missingApi.join(',')}` : reason,
|
|
@@ -10340,6 +10364,15 @@ class TrackerSingleton {
|
|
|
10340
10364
|
}
|
|
10341
10365
|
this.instance.setUserID(id);
|
|
10342
10366
|
}
|
|
10367
|
+
get analytics() {
|
|
10368
|
+
if (this.instance?.analytics) {
|
|
10369
|
+
return this.instance.analytics;
|
|
10370
|
+
}
|
|
10371
|
+
else {
|
|
10372
|
+
return null;
|
|
10373
|
+
}
|
|
10374
|
+
}
|
|
10375
|
+
;
|
|
10343
10376
|
/**
|
|
10344
10377
|
* Set metadata for the current session
|
|
10345
10378
|
*
|