@tracelog/lib 0.7.0 → 0.7.2
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/browser/tracelog.esm.js +147 -150
- package/dist/browser/tracelog.esm.js.map +1 -1
- package/dist/browser/tracelog.js +2 -2
- package/dist/browser/tracelog.js.map +1 -1
- package/dist/cjs/handlers/click.handler.js +1 -1
- package/dist/cjs/handlers/performance.handler.js +1 -1
- package/dist/cjs/types/index.d.ts +0 -1
- package/dist/cjs/types/index.js +0 -1
- package/dist/cjs/types/test-bridge.types.d.ts +9 -9
- package/dist/cjs/utils/browser/qa-mode.utils.js +1 -1
- package/dist/cjs/utils/emitter.utils.d.ts +1 -1
- package/dist/cjs/utils/network/url.utils.d.ts +1 -1
- package/dist/esm/handlers/click.handler.js +1 -1
- package/dist/esm/handlers/performance.handler.js +1 -1
- package/dist/esm/types/index.d.ts +0 -1
- package/dist/esm/types/index.js +0 -1
- package/dist/esm/types/test-bridge.types.d.ts +9 -9
- package/dist/esm/utils/browser/qa-mode.utils.js +1 -1
- package/dist/esm/utils/emitter.utils.d.ts +1 -1
- package/dist/esm/utils/network/url.utils.d.ts +1 -1
- package/package.json +1 -1
- package/dist/cjs/types/tag.types.d.ts +0 -43
- package/dist/cjs/types/tag.types.js +0 -31
- package/dist/esm/types/tag.types.d.ts +0 -43
- package/dist/esm/types/tag.types.js +0 -28
|
@@ -49,7 +49,7 @@ const m = {
|
|
|
49
49
|
/<embed\b[^>]*>/gi,
|
|
50
50
|
/<object\b[^<]*(?:(?!<\/object>)<[^<]*)*<\/object>/gi
|
|
51
51
|
];
|
|
52
|
-
var
|
|
52
|
+
var j = /* @__PURE__ */ ((r) => (r.Localhost = "localhost:8080", r.Fail = "localhost:9999", r))(j || {}), _ = /* @__PURE__ */ ((r) => (r.Mobile = "mobile", r.Tablet = "tablet", r.Desktop = "desktop", r.Unknown = "unknown", r))(_ || {}), X = /* @__PURE__ */ ((r) => (r.EVENT = "event", r.QUEUE = "queue", r))(X || {}), d = /* @__PURE__ */ ((r) => (r.PAGE_VIEW = "page_view", r.CLICK = "click", r.SCROLL = "scroll", r.SESSION_START = "session_start", r.SESSION_END = "session_end", r.CUSTOM = "custom", r.WEB_VITALS = "web_vitals", r.ERROR = "error", r))(d || {}), D = /* @__PURE__ */ ((r) => (r.UP = "up", r.DOWN = "down", r))(D || {}), L = /* @__PURE__ */ ((r) => (r.JS_ERROR = "js_error", r.PROMISE_REJECTION = "promise_rejection", r))(L || {}), R = /* @__PURE__ */ ((r) => (r.QA = "qa", r))(R || {});
|
|
53
53
|
class C extends Error {
|
|
54
54
|
constructor(e, t, s) {
|
|
55
55
|
super(e), this.errorCode = t, this.layer = s, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
|
|
@@ -60,7 +60,7 @@ class y extends C {
|
|
|
60
60
|
super(e, "APP_CONFIG_INVALID", t);
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
|
-
class
|
|
63
|
+
class Pe extends C {
|
|
64
64
|
constructor(e, t = "config") {
|
|
65
65
|
super(e, "SESSION_TIMEOUT_INVALID", t);
|
|
66
66
|
}
|
|
@@ -75,12 +75,12 @@ class v extends C {
|
|
|
75
75
|
super(e, "INTEGRATION_INVALID", t);
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
class
|
|
78
|
+
class xt extends C {
|
|
79
79
|
constructor(e, t, s = "runtime") {
|
|
80
80
|
super(e, "INITIALIZATION_TIMEOUT", s), this.timeoutMs = t;
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
|
-
const
|
|
83
|
+
const De = (r, e) => {
|
|
84
84
|
if (e) {
|
|
85
85
|
if (e instanceof Error) {
|
|
86
86
|
const t = e.message.replace(/\s+at\s+.*$/gm, "").replace(/\(.*?:\d+:\d+\)/g, "");
|
|
@@ -90,13 +90,13 @@ const He = (r, e) => {
|
|
|
90
90
|
}
|
|
91
91
|
return `[TraceLog] ${r}`;
|
|
92
92
|
}, o = (r, e, t) => {
|
|
93
|
-
const { error: s, data: n, showToClient: i = !1 } = t ?? {}, a = s ?
|
|
93
|
+
const { error: s, data: n, showToClient: i = !1 } = t ?? {}, a = s ? De(e, s) : `[TraceLog] ${e}`, l = r === "error" ? "error" : r === "warn" ? "warn" : "log";
|
|
94
94
|
if (!(r === "debug" || r === "info" && !i))
|
|
95
95
|
if (n !== void 0) {
|
|
96
|
-
const c =
|
|
96
|
+
const c = ke(n);
|
|
97
97
|
console[l](a, c);
|
|
98
98
|
} else n !== void 0 ? console[l](a, n) : console[l](a);
|
|
99
|
-
},
|
|
99
|
+
}, ke = (r) => {
|
|
100
100
|
const e = {}, t = ["token", "password", "secret", "key", "apikey", "api_key", "sessionid", "session_id"];
|
|
101
101
|
for (const [s, n] of Object.entries(r)) {
|
|
102
102
|
const i = s.toLowerCase();
|
|
@@ -105,27 +105,27 @@ const He = (r, e) => {
|
|
|
105
105
|
return e;
|
|
106
106
|
};
|
|
107
107
|
let W, pe;
|
|
108
|
-
const
|
|
108
|
+
const Ue = () => {
|
|
109
109
|
typeof window < "u" && !W && (W = window.matchMedia("(pointer: coarse)"), pe = window.matchMedia("(hover: none)"));
|
|
110
|
-
},
|
|
110
|
+
}, He = () => {
|
|
111
111
|
try {
|
|
112
112
|
const r = navigator;
|
|
113
113
|
if (r.userAgentData && typeof r.userAgentData.mobile == "boolean")
|
|
114
114
|
return r.userAgentData.platform && /ipad|tablet/i.test(r.userAgentData.platform) ? _.Tablet : r.userAgentData.mobile ? _.Mobile : _.Desktop;
|
|
115
|
-
|
|
115
|
+
Ue();
|
|
116
116
|
const e = window.innerWidth, t = W?.matches ?? !1, s = pe?.matches ?? !1, n = "ontouchstart" in window || navigator.maxTouchPoints > 0, i = navigator.userAgent.toLowerCase(), a = /mobile|android|iphone|ipod|blackberry|iemobile|opera mini/.test(i), l = /tablet|ipad|android(?!.*mobile)/.test(i);
|
|
117
117
|
return e <= 767 || a && n ? _.Mobile : e >= 768 && e <= 1024 || l || t && s && n ? _.Tablet : _.Desktop;
|
|
118
118
|
} catch (r) {
|
|
119
119
|
return o("warn", "Device detection failed, defaulting to desktop", { error: r }), _.Desktop;
|
|
120
120
|
}
|
|
121
|
-
}, T = "tlog", le = `${T}:qa_mode`,
|
|
121
|
+
}, T = "tlog", le = `${T}:qa_mode`, xe = `${T}:uid`, Ve = (r) => r ? `${T}:${r}:queue` : `${T}:queue`, Fe = (r) => r ? `${T}:${r}:session` : `${T}:session`, Ge = (r) => r ? `${T}:${r}:broadcast` : `${T}:broadcast`, _e = {
|
|
122
122
|
LCP: 4e3,
|
|
123
123
|
FCP: 1800,
|
|
124
124
|
CLS: 0.25,
|
|
125
125
|
INP: 200,
|
|
126
126
|
TTFB: 800,
|
|
127
127
|
LONG_TASK: 50
|
|
128
|
-
},
|
|
128
|
+
}, ze = 1e3, Te = [
|
|
129
129
|
// Email addresses
|
|
130
130
|
/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/gi,
|
|
131
131
|
// US Phone numbers (various formats)
|
|
@@ -140,10 +140,10 @@ const Ve = () => {
|
|
|
140
140
|
/Bearer\s+[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?(?:\.[A-Za-z0-9_-]+)?/gi,
|
|
141
141
|
// Passwords in connection strings (protocol://user:password@host)
|
|
142
142
|
/:\/\/[^:/]+:([^@]+)@/gi
|
|
143
|
-
], ce = 500, ue = 5e3, k = 50,
|
|
143
|
+
], ce = 500, ue = 5e3, k = 50, $e = k * 2, de = "tlog_mode", Qe = "qa", Be = () => {
|
|
144
144
|
if (sessionStorage.getItem(le) === "true")
|
|
145
145
|
return !0;
|
|
146
|
-
const e = new URLSearchParams(window.location.search), s = e.get(de) ===
|
|
146
|
+
const e = new URLSearchParams(window.location.search), s = e.get(de) === Qe;
|
|
147
147
|
if (s) {
|
|
148
148
|
sessionStorage.setItem(le, "true"), e.delete(de);
|
|
149
149
|
const n = e.toString(), i = `${window.location.pathname}${n ? "?" + n : ""}${window.location.hash}`;
|
|
@@ -167,10 +167,10 @@ const Ve = () => {
|
|
|
167
167
|
e[i] = n;
|
|
168
168
|
}
|
|
169
169
|
}), Object.keys(e).length ? e : void 0;
|
|
170
|
-
},
|
|
170
|
+
}, je = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (r) => {
|
|
171
171
|
const e = Math.random() * 16 | 0;
|
|
172
172
|
return (r === "x" ? e : e & 3 | 8).toString(16);
|
|
173
|
-
}),
|
|
173
|
+
}), Xe = () => {
|
|
174
174
|
const r = Date.now();
|
|
175
175
|
let e = "";
|
|
176
176
|
try {
|
|
@@ -188,7 +188,7 @@ const Ve = () => {
|
|
|
188
188
|
} catch {
|
|
189
189
|
return !1;
|
|
190
190
|
}
|
|
191
|
-
},
|
|
191
|
+
}, We = (r) => {
|
|
192
192
|
if (r.integrations?.tracelog?.projectId) {
|
|
193
193
|
const n = new URL(window.location.href).hostname.split(".");
|
|
194
194
|
if (n.length === 0)
|
|
@@ -256,7 +256,7 @@ const Ve = () => {
|
|
|
256
256
|
return t;
|
|
257
257
|
}
|
|
258
258
|
return null;
|
|
259
|
-
},
|
|
259
|
+
}, Ye = (r) => {
|
|
260
260
|
if (typeof r != "object" || r === null)
|
|
261
261
|
return {};
|
|
262
262
|
try {
|
|
@@ -266,15 +266,15 @@ const Ve = () => {
|
|
|
266
266
|
const t = e instanceof Error ? e.message : String(e);
|
|
267
267
|
throw new Error(`[TraceLog] Metadata sanitization failed: ${t}`);
|
|
268
268
|
}
|
|
269
|
-
},
|
|
269
|
+
}, Ke = (r) => {
|
|
270
270
|
if (r !== void 0 && (r === null || typeof r != "object"))
|
|
271
271
|
throw new y("Configuration must be an object", "config");
|
|
272
272
|
if (r) {
|
|
273
273
|
if (r.sessionTimeout !== void 0 && (typeof r.sessionTimeout != "number" || r.sessionTimeout < 3e4 || r.sessionTimeout > 864e5))
|
|
274
|
-
throw new
|
|
274
|
+
throw new Pe(m.INVALID_SESSION_TIMEOUT, "config");
|
|
275
275
|
if (r.globalMetadata !== void 0 && (typeof r.globalMetadata != "object" || r.globalMetadata === null))
|
|
276
276
|
throw new y(m.INVALID_GLOBAL_METADATA, "config");
|
|
277
|
-
if (r.scrollContainerSelectors !== void 0 &&
|
|
277
|
+
if (r.scrollContainerSelectors !== void 0 && Ze(r.scrollContainerSelectors), r.integrations && Je(r.integrations), r.sensitiveQueryParams !== void 0) {
|
|
278
278
|
if (!Array.isArray(r.sensitiveQueryParams))
|
|
279
279
|
throw new y(m.INVALID_SENSITIVE_QUERY_PARAMS, "config");
|
|
280
280
|
for (const e of r.sensitiveQueryParams)
|
|
@@ -286,7 +286,7 @@ const Ve = () => {
|
|
|
286
286
|
if (r.samplingRate !== void 0 && (typeof r.samplingRate != "number" || r.samplingRate < 0 || r.samplingRate > 1))
|
|
287
287
|
throw new oe(m.INVALID_SAMPLING_RATE, "config");
|
|
288
288
|
}
|
|
289
|
-
},
|
|
289
|
+
}, qe = (r) => {
|
|
290
290
|
if (r.includes("<") || r.includes(">") || /on\w+\s*=/i.test(r) || !/^[a-zA-Z0-9\-_#.[\]="':, >+~*()]+$/.test(r))
|
|
291
291
|
return !1;
|
|
292
292
|
let t = 0;
|
|
@@ -297,7 +297,7 @@ const Ve = () => {
|
|
|
297
297
|
for (const n of r)
|
|
298
298
|
if (n === "[" && s++, n === "]" && s--, s < 0) return !1;
|
|
299
299
|
return s === 0;
|
|
300
|
-
},
|
|
300
|
+
}, Ze = (r) => {
|
|
301
301
|
const e = Array.isArray(r) ? r : [r];
|
|
302
302
|
for (const t of e) {
|
|
303
303
|
if (typeof t != "string" || t.trim() === "")
|
|
@@ -309,7 +309,7 @@ const Ve = () => {
|
|
|
309
309
|
isEmpty: t === "" || typeof t == "string" && t.trim() === ""
|
|
310
310
|
}
|
|
311
311
|
}), new y(m.INVALID_SCROLL_CONTAINER_SELECTORS, "config");
|
|
312
|
-
if (!
|
|
312
|
+
if (!qe(t))
|
|
313
313
|
throw o("error", "Invalid or potentially unsafe CSS selector", {
|
|
314
314
|
showToClient: !0,
|
|
315
315
|
data: {
|
|
@@ -318,7 +318,7 @@ const Ve = () => {
|
|
|
318
318
|
}
|
|
319
319
|
}), new y("Invalid or potentially unsafe CSS selector", "config");
|
|
320
320
|
}
|
|
321
|
-
},
|
|
321
|
+
}, Je = (r) => {
|
|
322
322
|
if (r) {
|
|
323
323
|
if (r.tracelog && (!r.tracelog.projectId || typeof r.tracelog.projectId != "string" || r.tracelog.projectId.trim() === ""))
|
|
324
324
|
throw new v(m.INVALID_TRACELOG_PROJECT_ID, "config");
|
|
@@ -343,8 +343,8 @@ const Ve = () => {
|
|
|
343
343
|
throw new v('Google Analytics measurement ID must start with "G-" or "UA-"', "config");
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
|
-
},
|
|
347
|
-
|
|
346
|
+
}, et = (r) => {
|
|
347
|
+
Ke(r);
|
|
348
348
|
const e = {
|
|
349
349
|
...r ?? {},
|
|
350
350
|
sessionTimeout: r?.sessionTimeout ?? 9e5,
|
|
@@ -357,7 +357,7 @@ const Ve = () => {
|
|
|
357
357
|
...e.integrations.custom,
|
|
358
358
|
allowHttp: e.integrations.custom.allowHttp ?? !1
|
|
359
359
|
}), e;
|
|
360
|
-
},
|
|
360
|
+
}, tt = (r) => {
|
|
361
361
|
if (typeof r == "string")
|
|
362
362
|
return !0;
|
|
363
363
|
if (typeof r == "object" && r !== null && !Array.isArray(r)) {
|
|
@@ -374,7 +374,7 @@ const Ve = () => {
|
|
|
374
374
|
return !0;
|
|
375
375
|
}
|
|
376
376
|
return !1;
|
|
377
|
-
},
|
|
377
|
+
}, rt = (r) => {
|
|
378
378
|
if (typeof r != "object" || r === null)
|
|
379
379
|
return !1;
|
|
380
380
|
for (const e of Object.values(r)) {
|
|
@@ -388,7 +388,7 @@ const Ve = () => {
|
|
|
388
388
|
if (typeof e[0] == "string") {
|
|
389
389
|
if (!e.every((i) => typeof i == "string"))
|
|
390
390
|
return !1;
|
|
391
|
-
} else if (!e.every((i) =>
|
|
391
|
+
} else if (!e.every((i) => tt(i)))
|
|
392
392
|
return !1;
|
|
393
393
|
continue;
|
|
394
394
|
}
|
|
@@ -396,7 +396,7 @@ const Ve = () => {
|
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
398
|
return !0;
|
|
399
|
-
},
|
|
399
|
+
}, st = (r) => typeof r != "string" ? {
|
|
400
400
|
valid: !1,
|
|
401
401
|
error: "Event name must be a string"
|
|
402
402
|
} : r.length === 0 ? {
|
|
@@ -412,8 +412,8 @@ const Ve = () => {
|
|
|
412
412
|
valid: !1,
|
|
413
413
|
error: "Event name cannot be a reserved word"
|
|
414
414
|
} : { valid: !0 }, Se = (r, e, t) => {
|
|
415
|
-
const s =
|
|
416
|
-
if (!
|
|
415
|
+
const s = Ye(e), n = `${t} "${r}" metadata error`;
|
|
416
|
+
if (!rt(s))
|
|
417
417
|
return {
|
|
418
418
|
valid: !1,
|
|
419
419
|
error: `${n}: object has invalid types. Valid types are string, number, boolean or string arrays.`
|
|
@@ -461,7 +461,7 @@ const Ve = () => {
|
|
|
461
461
|
valid: !0,
|
|
462
462
|
sanitizedMetadata: s
|
|
463
463
|
};
|
|
464
|
-
},
|
|
464
|
+
}, nt = (r, e, t) => {
|
|
465
465
|
if (Array.isArray(e)) {
|
|
466
466
|
const s = [], n = `${t} "${r}" metadata error`;
|
|
467
467
|
for (let i = 0; i < e.length; i++) {
|
|
@@ -485,8 +485,8 @@ const Ve = () => {
|
|
|
485
485
|
};
|
|
486
486
|
}
|
|
487
487
|
return Se(r, e, t);
|
|
488
|
-
},
|
|
489
|
-
const t =
|
|
488
|
+
}, it = (r, e) => {
|
|
489
|
+
const t = st(r);
|
|
490
490
|
if (!t.valid)
|
|
491
491
|
return o("error", "Event name validation failed", {
|
|
492
492
|
showToClient: !0,
|
|
@@ -494,7 +494,7 @@ const Ve = () => {
|
|
|
494
494
|
}), t;
|
|
495
495
|
if (!e)
|
|
496
496
|
return { valid: !0 };
|
|
497
|
-
const s =
|
|
497
|
+
const s = nt(r, e, "customEvent");
|
|
498
498
|
return s.valid || o("error", "Event metadata validation failed", {
|
|
499
499
|
showToClient: !0,
|
|
500
500
|
data: {
|
|
@@ -503,7 +503,7 @@ const Ve = () => {
|
|
|
503
503
|
}
|
|
504
504
|
}), s;
|
|
505
505
|
};
|
|
506
|
-
class
|
|
506
|
+
class at {
|
|
507
507
|
listeners = /* @__PURE__ */ new Map();
|
|
508
508
|
on(e, t) {
|
|
509
509
|
this.listeners.has(e) || this.listeners.set(e, []), this.listeners.get(e).push(t);
|
|
@@ -523,19 +523,19 @@ class ct {
|
|
|
523
523
|
this.listeners.clear();
|
|
524
524
|
}
|
|
525
525
|
}
|
|
526
|
-
const
|
|
526
|
+
const $ = {};
|
|
527
527
|
class f {
|
|
528
528
|
get(e) {
|
|
529
|
-
return
|
|
529
|
+
return $[e];
|
|
530
530
|
}
|
|
531
531
|
set(e, t) {
|
|
532
|
-
|
|
532
|
+
$[e] = t;
|
|
533
533
|
}
|
|
534
534
|
getState() {
|
|
535
|
-
return {
|
|
535
|
+
return { ...$ };
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
|
-
class
|
|
538
|
+
class ot extends f {
|
|
539
539
|
storeManager;
|
|
540
540
|
retryTimeoutId = null;
|
|
541
541
|
retryCount = 0;
|
|
@@ -545,12 +545,12 @@ class ut extends f {
|
|
|
545
545
|
}
|
|
546
546
|
getQueueStorageKey() {
|
|
547
547
|
const e = this.get("userId") || "anonymous";
|
|
548
|
-
return
|
|
548
|
+
return Ve(e);
|
|
549
549
|
}
|
|
550
550
|
sendEventsQueueSync(e) {
|
|
551
551
|
if (this.shouldSkipSend())
|
|
552
552
|
return this.resetRetryState(), !0;
|
|
553
|
-
if (this.get("config")?.integrations?.custom?.collectApiUrl ===
|
|
553
|
+
if (this.get("config")?.integrations?.custom?.collectApiUrl === j.Fail)
|
|
554
554
|
return o("warn", "Fail mode: simulating network failure (sync)", {
|
|
555
555
|
data: { events: e.events.length }
|
|
556
556
|
}), !1;
|
|
@@ -587,7 +587,7 @@ class ut extends f {
|
|
|
587
587
|
async send(e) {
|
|
588
588
|
if (this.shouldSkipSend())
|
|
589
589
|
return this.simulateSuccessfulSend();
|
|
590
|
-
if (this.get("config")?.integrations?.custom?.collectApiUrl ===
|
|
590
|
+
if (this.get("config")?.integrations?.custom?.collectApiUrl === j.Fail)
|
|
591
591
|
return o("warn", "Fail mode: simulating network failure", {
|
|
592
592
|
data: { events: e.events.length }
|
|
593
593
|
}), !1;
|
|
@@ -726,7 +726,7 @@ class ut extends f {
|
|
|
726
726
|
this.retryTimeoutId !== null && (clearTimeout(this.retryTimeoutId), this.retryTimeoutId = null);
|
|
727
727
|
}
|
|
728
728
|
}
|
|
729
|
-
class
|
|
729
|
+
class lt extends f {
|
|
730
730
|
googleAnalytics;
|
|
731
731
|
dataSender;
|
|
732
732
|
emitter;
|
|
@@ -738,7 +738,7 @@ class dt extends f {
|
|
|
738
738
|
rateLimitCounter = 0;
|
|
739
739
|
rateLimitWindowStart = 0;
|
|
740
740
|
constructor(e, t = null, s = null) {
|
|
741
|
-
super(), this.googleAnalytics = t, this.dataSender = new
|
|
741
|
+
super(), this.googleAnalytics = t, this.dataSender = new ot(e), this.emitter = s;
|
|
742
742
|
}
|
|
743
743
|
async recoverPersistedEvents() {
|
|
744
744
|
await this.dataSender.recoverPersistedEvents({
|
|
@@ -906,7 +906,7 @@ class dt extends f {
|
|
|
906
906
|
buildEventPayload(e) {
|
|
907
907
|
const t = e.type === d.SESSION_START, s = e.page_url ?? this.get("pageUrl");
|
|
908
908
|
return {
|
|
909
|
-
id:
|
|
909
|
+
id: Xe(),
|
|
910
910
|
type: e.type,
|
|
911
911
|
page_url: s,
|
|
912
912
|
timestamp: Date.now(),
|
|
@@ -977,13 +977,13 @@ class dt extends f {
|
|
|
977
977
|
this.eventsQueue = this.eventsQueue.filter((s) => !t.has(s.id));
|
|
978
978
|
}
|
|
979
979
|
emitEvent(e) {
|
|
980
|
-
this.emitter && this.emitter.emit(
|
|
980
|
+
this.emitter && this.emitter.emit(X.EVENT, e);
|
|
981
981
|
}
|
|
982
982
|
emitEventsQueue(e) {
|
|
983
|
-
this.emitter && this.emitter.emit(
|
|
983
|
+
this.emitter && this.emitter.emit(X.QUEUE, e);
|
|
984
984
|
}
|
|
985
985
|
}
|
|
986
|
-
class
|
|
986
|
+
class ct {
|
|
987
987
|
/**
|
|
988
988
|
* Gets or creates a unique user ID for the given project.
|
|
989
989
|
* The user ID is persisted in localStorage and reused across sessions.
|
|
@@ -993,14 +993,14 @@ class ht {
|
|
|
993
993
|
* @returns Persistent unique user ID
|
|
994
994
|
*/
|
|
995
995
|
static getId(e) {
|
|
996
|
-
const t =
|
|
996
|
+
const t = xe, s = e.getItem(t);
|
|
997
997
|
if (s)
|
|
998
998
|
return s;
|
|
999
|
-
const n =
|
|
999
|
+
const n = je();
|
|
1000
1000
|
return e.setItem(t, n), n;
|
|
1001
1001
|
}
|
|
1002
1002
|
}
|
|
1003
|
-
class
|
|
1003
|
+
class ut extends f {
|
|
1004
1004
|
storageManager;
|
|
1005
1005
|
eventManager;
|
|
1006
1006
|
projectId;
|
|
@@ -1019,7 +1019,7 @@ class ft extends f {
|
|
|
1019
1019
|
return;
|
|
1020
1020
|
}
|
|
1021
1021
|
const e = this.getProjectId();
|
|
1022
|
-
this.broadcastChannel = new BroadcastChannel(
|
|
1022
|
+
this.broadcastChannel = new BroadcastChannel(Ge(e)), this.broadcastChannel.onmessage = (t) => {
|
|
1023
1023
|
const { action: s, sessionId: n, timestamp: i, projectId: a } = t.data ?? {};
|
|
1024
1024
|
if (a === e) {
|
|
1025
1025
|
if (s === "session_end") {
|
|
@@ -1083,7 +1083,7 @@ class ft extends f {
|
|
|
1083
1083
|
this.storageManager.setItem(t, JSON.stringify(e));
|
|
1084
1084
|
}
|
|
1085
1085
|
getSessionStorageKey() {
|
|
1086
|
-
return
|
|
1086
|
+
return Fe(this.getProjectId());
|
|
1087
1087
|
}
|
|
1088
1088
|
getProjectId() {
|
|
1089
1089
|
return this.projectId;
|
|
@@ -1170,7 +1170,7 @@ class ft extends f {
|
|
|
1170
1170
|
this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupCrossTabSync(), this.cleanupLifecycleListeners(), this.isTracking = !1, this.set("hasStartSession", !1);
|
|
1171
1171
|
}
|
|
1172
1172
|
}
|
|
1173
|
-
class
|
|
1173
|
+
class dt extends f {
|
|
1174
1174
|
eventManager;
|
|
1175
1175
|
storageManager;
|
|
1176
1176
|
sessionManager = null;
|
|
@@ -1189,7 +1189,7 @@ class gt extends f {
|
|
|
1189
1189
|
if (!t)
|
|
1190
1190
|
throw new Error("Cannot start session tracking: config not available");
|
|
1191
1191
|
try {
|
|
1192
|
-
this.sessionManager = new
|
|
1192
|
+
this.sessionManager = new ut(this.storageManager, this.eventManager, t), await this.sessionManager.startTracking(), this.eventManager.flushPendingEvents();
|
|
1193
1193
|
} catch (s) {
|
|
1194
1194
|
if (this.sessionManager) {
|
|
1195
1195
|
try {
|
|
@@ -1214,7 +1214,7 @@ class gt extends f {
|
|
|
1214
1214
|
this.destroyed || (this.sessionManager && (this.sessionManager.destroy(), this.sessionManager = null), this.destroyed = !0, this.set("hasStartSession", !1));
|
|
1215
1215
|
}
|
|
1216
1216
|
}
|
|
1217
|
-
class
|
|
1217
|
+
class ht extends f {
|
|
1218
1218
|
eventManager;
|
|
1219
1219
|
onTrack;
|
|
1220
1220
|
originalPushState;
|
|
@@ -1268,7 +1268,7 @@ class St extends f {
|
|
|
1268
1268
|
};
|
|
1269
1269
|
}
|
|
1270
1270
|
}
|
|
1271
|
-
class
|
|
1271
|
+
class ft extends f {
|
|
1272
1272
|
eventManager;
|
|
1273
1273
|
clickHandler;
|
|
1274
1274
|
constructor(e) {
|
|
@@ -1387,7 +1387,7 @@ class Et extends f {
|
|
|
1387
1387
|
};
|
|
1388
1388
|
}
|
|
1389
1389
|
}
|
|
1390
|
-
class
|
|
1390
|
+
class gt extends f {
|
|
1391
1391
|
eventManager;
|
|
1392
1392
|
containers = [];
|
|
1393
1393
|
limitWarningLogged = !1;
|
|
@@ -1526,7 +1526,7 @@ class mt extends f {
|
|
|
1526
1526
|
}
|
|
1527
1527
|
}
|
|
1528
1528
|
}
|
|
1529
|
-
class
|
|
1529
|
+
class St extends f {
|
|
1530
1530
|
isInitialized = !1;
|
|
1531
1531
|
async initialize() {
|
|
1532
1532
|
if (this.isInitialized)
|
|
@@ -1578,7 +1578,7 @@ class pt extends f {
|
|
|
1578
1578
|
`, document.head.appendChild(s);
|
|
1579
1579
|
}
|
|
1580
1580
|
}
|
|
1581
|
-
class
|
|
1581
|
+
class Et {
|
|
1582
1582
|
storage;
|
|
1583
1583
|
sessionStorageRef;
|
|
1584
1584
|
fallbackStorage = /* @__PURE__ */ new Map();
|
|
@@ -1754,7 +1754,7 @@ class _t {
|
|
|
1754
1754
|
this.fallbackSessionStorage.delete(e);
|
|
1755
1755
|
}
|
|
1756
1756
|
}
|
|
1757
|
-
class
|
|
1757
|
+
class mt extends f {
|
|
1758
1758
|
eventManager;
|
|
1759
1759
|
reportedByNav = /* @__PURE__ */ new Map();
|
|
1760
1760
|
observers = [];
|
|
@@ -1825,7 +1825,7 @@ class Tt extends f {
|
|
|
1825
1825
|
}
|
|
1826
1826
|
async initWebVitals() {
|
|
1827
1827
|
try {
|
|
1828
|
-
const { onLCP: e, onCLS: t, onFCP: s, onTTFB: n, onINP: i } = await Promise.resolve().then(() =>
|
|
1828
|
+
const { onLCP: e, onCLS: t, onFCP: s, onTTFB: n, onINP: i } = await Promise.resolve().then(() => Ht), a = (l) => (c) => {
|
|
1829
1829
|
const u = Number(c.value.toFixed(2));
|
|
1830
1830
|
this.sendVital({ type: l, value: u });
|
|
1831
1831
|
};
|
|
@@ -1852,7 +1852,7 @@ class Tt extends f {
|
|
|
1852
1852
|
const t = e.getEntries();
|
|
1853
1853
|
for (const s of t) {
|
|
1854
1854
|
const n = Number(s.duration.toFixed(2)), i = Date.now();
|
|
1855
|
-
i - this.lastLongTaskSentAt >=
|
|
1855
|
+
i - this.lastLongTaskSentAt >= ze && (this.shouldSendVital("LONG_TASK", n) && this.trackWebVital("LONG_TASK", n), this.lastLongTaskSentAt = i);
|
|
1856
1856
|
}
|
|
1857
1857
|
},
|
|
1858
1858
|
{ type: "longtask", buffered: !0 }
|
|
@@ -1933,7 +1933,7 @@ class Tt extends f {
|
|
|
1933
1933
|
return !(typeof s == "number" && t <= s);
|
|
1934
1934
|
}
|
|
1935
1935
|
}
|
|
1936
|
-
class
|
|
1936
|
+
class pt extends f {
|
|
1937
1937
|
eventManager;
|
|
1938
1938
|
recentErrors = /* @__PURE__ */ new Map();
|
|
1939
1939
|
constructor(e) {
|
|
@@ -1999,7 +1999,7 @@ class vt extends f {
|
|
|
1999
1999
|
}
|
|
2000
2000
|
shouldSuppressError(e, t) {
|
|
2001
2001
|
const s = Date.now(), n = `${e}:${t}`, i = this.recentErrors.get(n);
|
|
2002
|
-
return i && s - i < ue ? (this.recentErrors.set(n, s), !0) : (this.recentErrors.set(n, s), this.recentErrors.size >
|
|
2002
|
+
return i && s - i < ue ? (this.recentErrors.set(n, s), !0) : (this.recentErrors.set(n, s), this.recentErrors.size > $e ? (this.recentErrors.clear(), this.recentErrors.set(n, s), !1) : (this.recentErrors.size > k && this.pruneOldErrors(), !1));
|
|
2003
2003
|
}
|
|
2004
2004
|
pruneOldErrors() {
|
|
2005
2005
|
const e = Date.now();
|
|
@@ -2014,10 +2014,10 @@ class vt extends f {
|
|
|
2014
2014
|
}
|
|
2015
2015
|
}
|
|
2016
2016
|
}
|
|
2017
|
-
class
|
|
2017
|
+
class _t extends f {
|
|
2018
2018
|
isInitialized = !1;
|
|
2019
2019
|
suppressNextScrollTimer = null;
|
|
2020
|
-
emitter = new
|
|
2020
|
+
emitter = new at();
|
|
2021
2021
|
managers = {};
|
|
2022
2022
|
handlers = {};
|
|
2023
2023
|
integrations = {};
|
|
@@ -2026,9 +2026,9 @@ class It extends f {
|
|
|
2026
2026
|
}
|
|
2027
2027
|
async init(e = {}) {
|
|
2028
2028
|
if (!this.isInitialized) {
|
|
2029
|
-
this.managers.storage = new
|
|
2029
|
+
this.managers.storage = new Et();
|
|
2030
2030
|
try {
|
|
2031
|
-
this.setupState(e), await this.setupIntegrations(), this.managers.event = new
|
|
2031
|
+
this.setupState(e), await this.setupIntegrations(), this.managers.event = new lt(this.managers.storage, this.integrations.googleAnalytics, this.emitter), await this.initializeHandlers(), await this.managers.event.recoverPersistedEvents().catch((t) => {
|
|
2032
2032
|
o("warn", "Failed to recover persisted events", { error: t });
|
|
2033
2033
|
}), this.isInitialized = !0;
|
|
2034
2034
|
} catch (t) {
|
|
@@ -2041,7 +2041,7 @@ class It extends f {
|
|
|
2041
2041
|
sendCustomEvent(e, t) {
|
|
2042
2042
|
if (!this.managers.event)
|
|
2043
2043
|
return;
|
|
2044
|
-
const { valid: s, error: n, sanitizedMetadata: i } =
|
|
2044
|
+
const { valid: s, error: n, sanitizedMetadata: i } = it(e, t);
|
|
2045
2045
|
if (!s) {
|
|
2046
2046
|
if (this.get("mode") === R.QA)
|
|
2047
2047
|
throw new Error(`[TraceLog] Custom event "${e}" validation failed: ${n}`);
|
|
@@ -2076,27 +2076,27 @@ class It extends f {
|
|
|
2076
2076
|
}
|
|
2077
2077
|
setupState(e = {}) {
|
|
2078
2078
|
this.set("config", e);
|
|
2079
|
-
const t =
|
|
2079
|
+
const t = ct.getId(this.managers.storage);
|
|
2080
2080
|
this.set("userId", t);
|
|
2081
|
-
const s =
|
|
2081
|
+
const s = We(e);
|
|
2082
2082
|
this.set("collectApiUrl", s);
|
|
2083
|
-
const n =
|
|
2083
|
+
const n = He();
|
|
2084
2084
|
this.set("device", n);
|
|
2085
2085
|
const i = Y(window.location.href, e.sensitiveQueryParams);
|
|
2086
2086
|
this.set("pageUrl", i);
|
|
2087
|
-
const a =
|
|
2087
|
+
const a = Be() ? R.QA : void 0;
|
|
2088
2088
|
a && this.set("mode", a);
|
|
2089
2089
|
}
|
|
2090
2090
|
async setupIntegrations() {
|
|
2091
2091
|
if (this.get("config").integrations?.googleAnalytics?.measurementId?.trim())
|
|
2092
2092
|
try {
|
|
2093
|
-
this.integrations.googleAnalytics = new
|
|
2093
|
+
this.integrations.googleAnalytics = new St(), await this.integrations.googleAnalytics.initialize();
|
|
2094
2094
|
} catch {
|
|
2095
2095
|
this.integrations.googleAnalytics = void 0;
|
|
2096
2096
|
}
|
|
2097
2097
|
}
|
|
2098
2098
|
async initializeHandlers() {
|
|
2099
|
-
this.handlers.session = new
|
|
2099
|
+
this.handlers.session = new dt(
|
|
2100
2100
|
this.managers.storage,
|
|
2101
2101
|
this.managers.event
|
|
2102
2102
|
), await this.handlers.session.startTracking();
|
|
@@ -2105,20 +2105,20 @@ class It extends f {
|
|
|
2105
2105
|
this.set("suppressNextScroll", !1);
|
|
2106
2106
|
}, 250 * 2);
|
|
2107
2107
|
};
|
|
2108
|
-
this.handlers.pageView = new
|
|
2108
|
+
this.handlers.pageView = new ht(this.managers.event, e), this.handlers.pageView.startTracking(), this.handlers.click = new ft(this.managers.event), this.handlers.click.startTracking(), this.handlers.scroll = new gt(this.managers.event), this.handlers.scroll.startTracking(), this.handlers.performance = new mt(this.managers.event), this.handlers.performance.startTracking().catch((t) => {
|
|
2109
2109
|
o("warn", "Failed to start performance tracking", { error: t });
|
|
2110
|
-
}), this.handlers.error = new
|
|
2110
|
+
}), this.handlers.error = new pt(this.managers.event), this.handlers.error.startTracking();
|
|
2111
2111
|
}
|
|
2112
2112
|
}
|
|
2113
2113
|
const I = [];
|
|
2114
2114
|
let h = null, w = !1, U = !1;
|
|
2115
|
-
const
|
|
2115
|
+
const Tt = async (r) => {
|
|
2116
2116
|
if (typeof window > "u" || typeof document > "u")
|
|
2117
2117
|
throw new Error("[TraceLog] This library can only be used in a browser environment");
|
|
2118
2118
|
if (!window.__traceLogDisabled && !h && !w) {
|
|
2119
2119
|
w = !0;
|
|
2120
2120
|
try {
|
|
2121
|
-
const e =
|
|
2121
|
+
const e = et(r ?? {}), t = new _t();
|
|
2122
2122
|
try {
|
|
2123
2123
|
I.forEach(({ event: i, callback: a }) => {
|
|
2124
2124
|
t.on(i, a);
|
|
@@ -2143,26 +2143,26 @@ const yt = async (r) => {
|
|
|
2143
2143
|
w = !1;
|
|
2144
2144
|
}
|
|
2145
2145
|
}
|
|
2146
|
-
},
|
|
2146
|
+
}, vt = (r, e) => {
|
|
2147
2147
|
if (!h)
|
|
2148
2148
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
2149
2149
|
if (U)
|
|
2150
2150
|
throw new Error("[TraceLog] Cannot send events while TraceLog is being destroyed");
|
|
2151
2151
|
h.sendCustomEvent(r, e);
|
|
2152
|
-
},
|
|
2152
|
+
}, It = (r, e) => {
|
|
2153
2153
|
if (!h || w) {
|
|
2154
2154
|
I.push({ event: r, callback: e });
|
|
2155
2155
|
return;
|
|
2156
2156
|
}
|
|
2157
2157
|
h.on(r, e);
|
|
2158
|
-
},
|
|
2158
|
+
}, yt = (r, e) => {
|
|
2159
2159
|
if (!h) {
|
|
2160
2160
|
const t = I.findIndex((s) => s.event === r && s.callback === e);
|
|
2161
2161
|
t !== -1 && I.splice(t, 1);
|
|
2162
2162
|
return;
|
|
2163
2163
|
}
|
|
2164
2164
|
h.off(r, e);
|
|
2165
|
-
},
|
|
2165
|
+
}, At = () => h !== null, wt = async () => {
|
|
2166
2166
|
if (!h)
|
|
2167
2167
|
throw new Error("[TraceLog] App not initialized");
|
|
2168
2168
|
if (U)
|
|
@@ -2175,13 +2175,13 @@ const yt = async (r) => {
|
|
|
2175
2175
|
} finally {
|
|
2176
2176
|
U = !1;
|
|
2177
2177
|
}
|
|
2178
|
-
},
|
|
2178
|
+
}, Vt = {
|
|
2179
2179
|
WEB_VITALS_THRESHOLDS: _e
|
|
2180
2180
|
// Business thresholds for performance analysis
|
|
2181
|
-
},
|
|
2181
|
+
}, Ft = {
|
|
2182
2182
|
PII_PATTERNS: Te
|
|
2183
2183
|
// Patterns for sensitive data protection
|
|
2184
|
-
},
|
|
2184
|
+
}, Gt = {
|
|
2185
2185
|
LOW_ACTIVITY_EVENT_COUNT: 50,
|
|
2186
2186
|
HIGH_ACTIVITY_EVENT_COUNT: 1e3,
|
|
2187
2187
|
MIN_EVENTS_FOR_DYNAMIC_CALCULATION: 100,
|
|
@@ -2191,7 +2191,7 @@ const yt = async (r) => {
|
|
|
2191
2191
|
MIN_ENGAGED_SESSION_DURATION_MS: 30 * 1e3,
|
|
2192
2192
|
MIN_SCROLL_DEPTH_ENGAGEMENT: 25
|
|
2193
2193
|
// 25% scroll depth for engagement
|
|
2194
|
-
},
|
|
2194
|
+
}, zt = {
|
|
2195
2195
|
INACTIVITY_TIMEOUT_MS: 30 * 60 * 1e3,
|
|
2196
2196
|
// 30min for analytics (vs 15min client)
|
|
2197
2197
|
SHORT_SESSION_THRESHOLD_MS: 30 * 1e3,
|
|
@@ -2199,20 +2199,20 @@ const yt = async (r) => {
|
|
|
2199
2199
|
LONG_SESSION_THRESHOLD_MS: 30 * 60 * 1e3,
|
|
2200
2200
|
MAX_REALISTIC_SESSION_DURATION_MS: 8 * 60 * 60 * 1e3
|
|
2201
2201
|
// Filter outliers
|
|
2202
|
-
},
|
|
2202
|
+
}, $t = {
|
|
2203
2203
|
MOBILE_MAX_WIDTH: 768,
|
|
2204
2204
|
TABLET_MAX_WIDTH: 1024,
|
|
2205
2205
|
MOBILE_PERFORMANCE_FACTOR: 1.5,
|
|
2206
2206
|
// Mobile typically 1.5x slower
|
|
2207
2207
|
TABLET_PERFORMANCE_FACTOR: 1.2
|
|
2208
|
-
},
|
|
2208
|
+
}, Qt = {
|
|
2209
2209
|
MIN_TEXT_LENGTH_FOR_ANALYSIS: 10,
|
|
2210
2210
|
MIN_CLICKS_FOR_HOT_ELEMENT: 10,
|
|
2211
2211
|
// Popular element threshold
|
|
2212
2212
|
MIN_SCROLL_COMPLETION_PERCENT: 80,
|
|
2213
2213
|
// Page consumption threshold
|
|
2214
2214
|
MIN_TIME_ON_PAGE_FOR_READ_MS: 15 * 1e3
|
|
2215
|
-
},
|
|
2215
|
+
}, Bt = {
|
|
2216
2216
|
SIGNIFICANT_CHANGE_PERCENT: 20,
|
|
2217
2217
|
MAJOR_CHANGE_PERCENT: 50,
|
|
2218
2218
|
MIN_EVENTS_FOR_INSIGHT: 100,
|
|
@@ -2222,19 +2222,19 @@ const yt = async (r) => {
|
|
|
2222
2222
|
LOW_ERROR_RATE_PERCENT: 1,
|
|
2223
2223
|
HIGH_ERROR_RATE_PERCENT: 5,
|
|
2224
2224
|
CRITICAL_ERROR_RATE_PERCENT: 10
|
|
2225
|
-
},
|
|
2225
|
+
}, jt = {
|
|
2226
2226
|
SHORT_TERM_TREND_HOURS: 24,
|
|
2227
2227
|
MEDIUM_TERM_TREND_DAYS: 7,
|
|
2228
2228
|
LONG_TERM_TREND_DAYS: 30,
|
|
2229
2229
|
MIN_DATA_POINTS_FOR_TREND: 5,
|
|
2230
2230
|
WEEKLY_PATTERN_MIN_WEEKS: 4,
|
|
2231
2231
|
DAILY_PATTERN_MIN_DAYS: 14
|
|
2232
|
-
},
|
|
2232
|
+
}, Xt = {
|
|
2233
2233
|
MIN_SEGMENT_SIZE: 10,
|
|
2234
2234
|
MIN_COHORT_SIZE: 5,
|
|
2235
2235
|
COHORT_ANALYSIS_DAYS: [1, 3, 7, 14, 30],
|
|
2236
2236
|
MIN_FUNNEL_EVENTS: 20
|
|
2237
|
-
},
|
|
2237
|
+
}, Wt = {
|
|
2238
2238
|
DEFAULT_EVENTS_LIMIT: 5,
|
|
2239
2239
|
DEFAULT_SESSIONS_LIMIT: 5,
|
|
2240
2240
|
DEFAULT_PAGES_LIMIT: 5,
|
|
@@ -2242,23 +2242,23 @@ const yt = async (r) => {
|
|
|
2242
2242
|
MAX_TIME_RANGE_DAYS: 365,
|
|
2243
2243
|
ANALYTICS_BATCH_SIZE: 1e3
|
|
2244
2244
|
// For historical analysis
|
|
2245
|
-
},
|
|
2245
|
+
}, Yt = {
|
|
2246
2246
|
ANOMALY_THRESHOLD_SIGMA: 2.5,
|
|
2247
2247
|
STRONG_ANOMALY_THRESHOLD_SIGMA: 3,
|
|
2248
2248
|
TRAFFIC_DROP_ALERT_PERCENT: -30,
|
|
2249
2249
|
TRAFFIC_SPIKE_ALERT_PERCENT: 200,
|
|
2250
2250
|
MIN_BASELINE_DAYS: 7,
|
|
2251
2251
|
MIN_EVENTS_FOR_ANOMALY_DETECTION: 50
|
|
2252
|
-
},
|
|
2252
|
+
}, Kt = {
|
|
2253
2253
|
PAGE_URL_EXCLUDED: "excluded",
|
|
2254
2254
|
PAGE_URL_UNKNOWN: "unknown"
|
|
2255
|
-
},
|
|
2256
|
-
init:
|
|
2257
|
-
event:
|
|
2258
|
-
on:
|
|
2259
|
-
off:
|
|
2260
|
-
isInitialized:
|
|
2261
|
-
destroy:
|
|
2255
|
+
}, qt = {
|
|
2256
|
+
init: Tt,
|
|
2257
|
+
event: vt,
|
|
2258
|
+
on: It,
|
|
2259
|
+
off: yt,
|
|
2260
|
+
isInitialized: At,
|
|
2261
|
+
destroy: wt
|
|
2262
2262
|
};
|
|
2263
2263
|
var q, ve = -1, M = function(r) {
|
|
2264
2264
|
addEventListener("pageshow", function(e) {
|
|
@@ -2310,10 +2310,10 @@ var q, ve = -1, M = function(r) {
|
|
|
2310
2310
|
}, A = -1, Ee = function() {
|
|
2311
2311
|
return document.visibilityState !== "hidden" || document.prerendering ? 1 / 0 : 0;
|
|
2312
2312
|
}, x = function(r) {
|
|
2313
|
-
document.visibilityState === "hidden" && A > -1 && (A = r.type === "visibilitychange" ? r.timeStamp : 0,
|
|
2313
|
+
document.visibilityState === "hidden" && A > -1 && (A = r.type === "visibilitychange" ? r.timeStamp : 0, Mt());
|
|
2314
2314
|
}, me = function() {
|
|
2315
2315
|
addEventListener("visibilitychange", x, !0), addEventListener("prerenderingchange", x, !0);
|
|
2316
|
-
},
|
|
2316
|
+
}, Mt = function() {
|
|
2317
2317
|
removeEventListener("visibilitychange", x, !0), removeEventListener("prerenderingchange", x, !0);
|
|
2318
2318
|
}, Ie = function() {
|
|
2319
2319
|
return A < 0 && (A = Ee(), me(), M(function() {
|
|
@@ -2340,7 +2340,7 @@ var q, ve = -1, M = function(r) {
|
|
|
2340
2340
|
});
|
|
2341
2341
|
}));
|
|
2342
2342
|
});
|
|
2343
|
-
}, J = [0.1, 0.25],
|
|
2343
|
+
}, J = [0.1, 0.25], Nt = function(r, e) {
|
|
2344
2344
|
e = e || {}, ye(ie(function() {
|
|
2345
2345
|
var t, s = S("CLS", 0), n = 0, i = [], a = function(c) {
|
|
2346
2346
|
c.forEach(function(u) {
|
|
@@ -2358,19 +2358,19 @@ var q, ve = -1, M = function(r) {
|
|
|
2358
2358
|
});
|
|
2359
2359
|
}), setTimeout(t, 0));
|
|
2360
2360
|
}));
|
|
2361
|
-
}, Ae = 0,
|
|
2361
|
+
}, Ae = 0, Q = 1 / 0, P = 0, Lt = function(r) {
|
|
2362
2362
|
r.forEach(function(e) {
|
|
2363
|
-
e.interactionId && (
|
|
2363
|
+
e.interactionId && (Q = Math.min(Q, e.interactionId), P = Math.max(P, e.interactionId), Ae = P ? (P - Q) / 7 + 1 : 0);
|
|
2364
2364
|
});
|
|
2365
2365
|
}, we = function() {
|
|
2366
2366
|
return q ? Ae : performance.interactionCount || 0;
|
|
2367
|
-
},
|
|
2368
|
-
"interactionCount" in performance || q || (q = b("event",
|
|
2369
|
-
}, g = [], H = /* @__PURE__ */ new Map(), Me = 0,
|
|
2367
|
+
}, Rt = function() {
|
|
2368
|
+
"interactionCount" in performance || q || (q = b("event", Lt, { type: "event", buffered: !0, durationThreshold: 0 }));
|
|
2369
|
+
}, g = [], H = /* @__PURE__ */ new Map(), Me = 0, Ct = function() {
|
|
2370
2370
|
var r = Math.min(g.length - 1, Math.floor((we() - Me) / 50));
|
|
2371
2371
|
return g[r];
|
|
2372
|
-
},
|
|
2373
|
-
if (
|
|
2372
|
+
}, bt = [], Ot = function(r) {
|
|
2373
|
+
if (bt.forEach(function(n) {
|
|
2374
2374
|
return n(r);
|
|
2375
2375
|
}), r.interactionId || r.entryType === "first-input") {
|
|
2376
2376
|
var e = g[g.length - 1], t = H.get(r.interactionId);
|
|
@@ -2390,14 +2390,14 @@ var q, ve = -1, M = function(r) {
|
|
|
2390
2390
|
}, Ne = function(r) {
|
|
2391
2391
|
var e = self.requestIdleCallback || self.setTimeout, t = -1;
|
|
2392
2392
|
return r = ie(r), document.visibilityState === "hidden" ? r() : (t = e(r), F(r)), t;
|
|
2393
|
-
}, ee = [200, 500],
|
|
2393
|
+
}, ee = [200, 500], Pt = function(r, e) {
|
|
2394
2394
|
"PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, G(function() {
|
|
2395
2395
|
var t;
|
|
2396
|
-
|
|
2396
|
+
Rt();
|
|
2397
2397
|
var s, n = S("INP"), i = function(l) {
|
|
2398
2398
|
Ne(function() {
|
|
2399
|
-
l.forEach(
|
|
2400
|
-
var c =
|
|
2399
|
+
l.forEach(Ot);
|
|
2400
|
+
var c = Ct();
|
|
2401
2401
|
c && c.latency !== n.value && (n.value = c.latency, n.entries = c.entries, s());
|
|
2402
2402
|
});
|
|
2403
2403
|
}, a = b("event", i, { durationThreshold: (t = e.durationThreshold) !== null && t !== void 0 ? t : 40 });
|
|
@@ -2407,7 +2407,7 @@ var q, ve = -1, M = function(r) {
|
|
|
2407
2407
|
Me = we(), g.length = 0, H.clear(), n = S("INP"), s = E(r, n, ee, e.reportAllChanges);
|
|
2408
2408
|
}));
|
|
2409
2409
|
}));
|
|
2410
|
-
}, te = [2500, 4e3], B = {},
|
|
2410
|
+
}, te = [2500, 4e3], B = {}, Dt = function(r, e) {
|
|
2411
2411
|
e = e || {}, G(function() {
|
|
2412
2412
|
var t, s = Ie(), n = S("LCP"), i = function(c) {
|
|
2413
2413
|
e.reportAllChanges || (c = c.slice(-1)), c.forEach(function(u) {
|
|
@@ -2430,63 +2430,60 @@ var q, ve = -1, M = function(r) {
|
|
|
2430
2430
|
});
|
|
2431
2431
|
}
|
|
2432
2432
|
});
|
|
2433
|
-
}, re = [800, 1800],
|
|
2433
|
+
}, re = [800, 1800], kt = function r(e) {
|
|
2434
2434
|
document.prerendering ? G(function() {
|
|
2435
2435
|
return r(e);
|
|
2436
2436
|
}) : document.readyState !== "complete" ? addEventListener("load", function() {
|
|
2437
2437
|
return r(e);
|
|
2438
2438
|
}, !0) : setTimeout(e, 0);
|
|
2439
|
-
},
|
|
2439
|
+
}, Ut = function(r, e) {
|
|
2440
2440
|
e = e || {};
|
|
2441
2441
|
var t = S("TTFB"), s = E(r, t, re, e.reportAllChanges);
|
|
2442
|
-
|
|
2442
|
+
kt(function() {
|
|
2443
2443
|
var n = se();
|
|
2444
2444
|
n && (t.value = Math.max(n.responseStart - V(), 0), t.entries = [n], s(!0), M(function() {
|
|
2445
2445
|
t = S("TTFB", 0), (s = E(r, t, re, e.reportAllChanges))(!0);
|
|
2446
2446
|
}));
|
|
2447
2447
|
});
|
|
2448
2448
|
};
|
|
2449
|
-
const
|
|
2449
|
+
const Ht = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2450
2450
|
__proto__: null,
|
|
2451
2451
|
CLSThresholds: J,
|
|
2452
2452
|
FCPThresholds: Z,
|
|
2453
2453
|
INPThresholds: ee,
|
|
2454
2454
|
LCPThresholds: te,
|
|
2455
2455
|
TTFBThresholds: re,
|
|
2456
|
-
onCLS:
|
|
2456
|
+
onCLS: Nt,
|
|
2457
2457
|
onFCP: ye,
|
|
2458
|
-
onINP:
|
|
2459
|
-
onLCP:
|
|
2460
|
-
onTTFB:
|
|
2458
|
+
onINP: Pt,
|
|
2459
|
+
onLCP: Dt,
|
|
2460
|
+
onTTFB: Ut
|
|
2461
2461
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2462
2462
|
export {
|
|
2463
|
-
|
|
2464
|
-
|
|
2463
|
+
Wt as ANALYTICS_QUERY_LIMITS,
|
|
2464
|
+
Yt as ANOMALY_DETECTION,
|
|
2465
2465
|
y as AppConfigValidationError,
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2466
|
+
Qt as CONTENT_ANALYTICS,
|
|
2467
|
+
Ft as DATA_PROTECTION,
|
|
2468
|
+
$t as DEVICE_ANALYTICS,
|
|
2469
2469
|
_ as DeviceType,
|
|
2470
|
-
|
|
2471
|
-
|
|
2470
|
+
Gt as ENGAGEMENT_THRESHOLDS,
|
|
2471
|
+
X as EmitterEvent,
|
|
2472
2472
|
L as ErrorType,
|
|
2473
2473
|
d as EventType,
|
|
2474
|
-
|
|
2475
|
-
|
|
2474
|
+
Bt as INSIGHT_THRESHOLDS,
|
|
2475
|
+
xt as InitializationTimeoutError,
|
|
2476
2476
|
v as IntegrationValidationError,
|
|
2477
2477
|
R as Mode,
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2478
|
+
Vt as PERFORMANCE_CONFIG,
|
|
2479
|
+
Xt as SEGMENTATION_ANALYTICS,
|
|
2480
|
+
zt as SESSION_ANALYTICS,
|
|
2481
|
+
Kt as SPECIAL_PAGE_URLS,
|
|
2482
2482
|
oe as SamplingRateValidationError,
|
|
2483
2483
|
D as ScrollDirection,
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
ke as TagConditionOperator,
|
|
2488
|
-
De as TagConditionType,
|
|
2489
|
-
Pe as TagLogicalOperator,
|
|
2484
|
+
Pe as SessionTimeoutValidationError,
|
|
2485
|
+
j as SpecialApiUrl,
|
|
2486
|
+
jt as TEMPORAL_ANALYSIS,
|
|
2490
2487
|
C as TraceLogValidationError,
|
|
2491
|
-
|
|
2488
|
+
qt as tracelog
|
|
2492
2489
|
};
|