@tracelog/lib 0.8.1 → 0.8.3
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 +104 -79
- 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/app.constants.d.ts +1 -0
- package/dist/cjs/app.constants.d.ts.map +1 -1
- package/dist/cjs/app.constants.js +11 -1
- package/dist/cjs/app.constants.js.map +1 -1
- package/dist/cjs/constants/config.constants.d.ts +2 -0
- package/dist/cjs/constants/config.constants.d.ts.map +1 -1
- package/dist/cjs/constants/config.constants.js +4 -2
- package/dist/cjs/constants/config.constants.js.map +1 -1
- package/dist/cjs/handlers/scroll.handler.d.ts.map +1 -1
- package/dist/cjs/handlers/scroll.handler.js +3 -1
- package/dist/cjs/handlers/scroll.handler.js.map +1 -1
- package/dist/cjs/integrations/google-analytics.integration.d.ts.map +1 -1
- package/dist/cjs/integrations/google-analytics.integration.js +6 -2
- package/dist/cjs/integrations/google-analytics.integration.js.map +1 -1
- package/dist/cjs/managers/sender.manager.d.ts.map +1 -1
- package/dist/cjs/managers/sender.manager.js +3 -1
- package/dist/cjs/managers/sender.manager.js.map +1 -1
- package/dist/cjs/managers/session.manager.d.ts.map +1 -1
- package/dist/cjs/managers/session.manager.js +3 -1
- package/dist/cjs/managers/session.manager.js.map +1 -1
- package/dist/cjs/managers/storage.manager.d.ts.map +1 -1
- package/dist/cjs/managers/storage.manager.js +3 -1
- package/dist/cjs/managers/storage.manager.js.map +1 -1
- package/dist/cjs/utils/emitter.utils.d.ts.map +1 -1
- package/dist/cjs/utils/emitter.utils.js +3 -1
- package/dist/cjs/utils/emitter.utils.js.map +1 -1
- package/dist/cjs/utils/security/sanitize.utils.d.ts.map +1 -1
- package/dist/cjs/utils/security/sanitize.utils.js +1 -1
- package/dist/cjs/utils/security/sanitize.utils.js.map +1 -1
- package/dist/cjs/utils/validations/metadata-validations.utils.d.ts.map +1 -1
- package/dist/cjs/utils/validations/metadata-validations.utils.js +2 -2
- package/dist/cjs/utils/validations/metadata-validations.utils.js.map +1 -1
- package/dist/cjs/utils/validations/type-guards.utils.d.ts +1 -1
- package/dist/cjs/utils/validations/type-guards.utils.d.ts.map +1 -1
- package/dist/cjs/utils/validations/type-guards.utils.js +2 -3
- package/dist/cjs/utils/validations/type-guards.utils.js.map +1 -1
- package/dist/esm/app.constants.d.ts +1 -0
- package/dist/esm/app.constants.d.ts.map +1 -1
- package/dist/esm/app.constants.js +1 -0
- package/dist/esm/app.constants.js.map +1 -1
- package/dist/esm/constants/config.constants.d.ts +2 -0
- package/dist/esm/constants/config.constants.d.ts.map +1 -1
- package/dist/esm/constants/config.constants.js +2 -0
- package/dist/esm/constants/config.constants.js.map +1 -1
- package/dist/esm/handlers/scroll.handler.d.ts.map +1 -1
- package/dist/esm/handlers/scroll.handler.js +3 -1
- package/dist/esm/handlers/scroll.handler.js.map +1 -1
- package/dist/esm/integrations/google-analytics.integration.d.ts.map +1 -1
- package/dist/esm/integrations/google-analytics.integration.js +6 -2
- package/dist/esm/integrations/google-analytics.integration.js.map +1 -1
- package/dist/esm/managers/sender.manager.d.ts.map +1 -1
- package/dist/esm/managers/sender.manager.js +3 -1
- package/dist/esm/managers/sender.manager.js.map +1 -1
- package/dist/esm/managers/session.manager.d.ts.map +1 -1
- package/dist/esm/managers/session.manager.js +3 -1
- package/dist/esm/managers/session.manager.js.map +1 -1
- package/dist/esm/managers/storage.manager.d.ts.map +1 -1
- package/dist/esm/managers/storage.manager.js +3 -1
- package/dist/esm/managers/storage.manager.js.map +1 -1
- package/dist/esm/utils/emitter.utils.d.ts.map +1 -1
- package/dist/esm/utils/emitter.utils.js +3 -1
- package/dist/esm/utils/emitter.utils.js.map +1 -1
- package/dist/esm/utils/security/sanitize.utils.d.ts.map +1 -1
- package/dist/esm/utils/security/sanitize.utils.js +2 -2
- package/dist/esm/utils/security/sanitize.utils.js.map +1 -1
- package/dist/esm/utils/validations/metadata-validations.utils.d.ts.map +1 -1
- package/dist/esm/utils/validations/metadata-validations.utils.js +3 -3
- package/dist/esm/utils/validations/metadata-validations.utils.js.map +1 -1
- package/dist/esm/utils/validations/type-guards.utils.d.ts +1 -1
- package/dist/esm/utils/validations/type-guards.utils.d.ts.map +1 -1
- package/dist/esm/utils/validations/type-guards.utils.js +3 -4
- package/dist/esm/utils/validations/type-guards.utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
const Ft = 120, Gt = 8192, $t = 10, zt = 10, Qt = 20, Bt = 1;
|
|
2
|
+
const jt = 1e3, Xt = 500, Wt = 100;
|
|
1
3
|
const P = "data-tlog", Oe = [
|
|
2
4
|
"button",
|
|
3
5
|
"a",
|
|
@@ -49,13 +51,13 @@ const m = {
|
|
|
49
51
|
/<embed\b[^>]*>/gi,
|
|
50
52
|
/<object\b[^<]*(?:(?!<\/object>)<[^<]*)*<\/object>/gi
|
|
51
53
|
];
|
|
52
|
-
var
|
|
54
|
+
var X = /* @__PURE__ */ ((r) => (r.Localhost = "localhost:8080", r.Fail = "localhost:9999", r))(X || {}), _ = /* @__PURE__ */ ((r) => (r.Mobile = "mobile", r.Tablet = "tablet", r.Desktop = "desktop", r.Unknown = "unknown", r))(_ || {}), W = /* @__PURE__ */ ((r) => (r.EVENT = "event", r.QUEUE = "queue", r))(W || {});
|
|
53
55
|
class y extends Error {
|
|
54
56
|
constructor(e, t) {
|
|
55
57
|
super(e), this.statusCode = t, this.name = "PermanentError", Error.captureStackTrace && Error.captureStackTrace(this, y);
|
|
56
58
|
}
|
|
57
59
|
}
|
|
58
|
-
var 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 || {}), k = /* @__PURE__ */ ((r) => (r.UP = "up", r.DOWN = "down", r))(k || {}),
|
|
60
|
+
var 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 || {}), k = /* @__PURE__ */ ((r) => (r.UP = "up", r.DOWN = "down", r))(k || {}), R = /* @__PURE__ */ ((r) => (r.JS_ERROR = "js_error", r.PROMISE_REJECTION = "promise_rejection", r))(R || {}), C = /* @__PURE__ */ ((r) => (r.QA = "qa", r))(C || {});
|
|
59
61
|
class b extends Error {
|
|
60
62
|
constructor(e, t, s) {
|
|
61
63
|
super(e), this.errorCode = t, this.layer = s, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
|
|
@@ -81,7 +83,7 @@ class v extends b {
|
|
|
81
83
|
super(e, "INTEGRATION_INVALID", t);
|
|
82
84
|
}
|
|
83
85
|
}
|
|
84
|
-
class
|
|
86
|
+
class Yt extends b {
|
|
85
87
|
constructor(e, t, s = "runtime") {
|
|
86
88
|
super(e, "INITIALIZATION_TIMEOUT", s), this.timeoutMs = t;
|
|
87
89
|
}
|
|
@@ -146,10 +148,10 @@ const xe = () => {
|
|
|
146
148
|
/Bearer\s+[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?(?:\.[A-Za-z0-9_-]+)?/gi,
|
|
147
149
|
// Passwords in connection strings (protocol://user:password@host)
|
|
148
150
|
/:\/\/[^:/]+:([^@]+)@/gi
|
|
149
|
-
], ue = 500, de = 5e3, U = 50,
|
|
151
|
+
], ue = 500, de = 5e3, U = 50, Be = U * 2, je = 6e4, he = "tlog_mode", Xe = "qa", We = () => {
|
|
150
152
|
if (sessionStorage.getItem(ce) === "true")
|
|
151
153
|
return !0;
|
|
152
|
-
const e = new URLSearchParams(window.location.search), s = e.get(he) ===
|
|
154
|
+
const e = new URLSearchParams(window.location.search), s = e.get(he) === Xe;
|
|
153
155
|
if (s) {
|
|
154
156
|
sessionStorage.setItem(ce, "true"), e.delete(he);
|
|
155
157
|
const n = e.toString(), i = `${window.location.pathname}${n ? "?" + n : ""}${window.location.hash}`;
|
|
@@ -262,7 +264,7 @@ const xe = () => {
|
|
|
262
264
|
return t;
|
|
263
265
|
}
|
|
264
266
|
return null;
|
|
265
|
-
},
|
|
267
|
+
}, Je = (r) => {
|
|
266
268
|
if (typeof r != "object" || r === null)
|
|
267
269
|
return {};
|
|
268
270
|
try {
|
|
@@ -272,7 +274,7 @@ const xe = () => {
|
|
|
272
274
|
const t = e instanceof Error ? e.message : String(e);
|
|
273
275
|
throw new Error(`[TraceLog] Metadata sanitization failed: ${t}`);
|
|
274
276
|
}
|
|
275
|
-
},
|
|
277
|
+
}, Ze = (r) => {
|
|
276
278
|
if (r !== void 0 && (r === null || typeof r != "object"))
|
|
277
279
|
throw new A("Configuration must be an object", "config");
|
|
278
280
|
if (r) {
|
|
@@ -350,7 +352,7 @@ const xe = () => {
|
|
|
350
352
|
}
|
|
351
353
|
}
|
|
352
354
|
}, st = (r) => {
|
|
353
|
-
|
|
355
|
+
Ze(r);
|
|
354
356
|
const e = {
|
|
355
357
|
...r ?? {},
|
|
356
358
|
sessionTimeout: r?.sessionTimeout ?? 9e5,
|
|
@@ -423,7 +425,7 @@ const xe = () => {
|
|
|
423
425
|
valid: !1,
|
|
424
426
|
error: "Event name cannot be a reserved word"
|
|
425
427
|
} : { valid: !0 }, Se = (r, e, t) => {
|
|
426
|
-
const s =
|
|
428
|
+
const s = Je(e), n = `${t} "${r}" metadata error`;
|
|
427
429
|
if (!Ie(s))
|
|
428
430
|
return {
|
|
429
431
|
valid: !1,
|
|
@@ -528,7 +530,9 @@ class lt {
|
|
|
528
530
|
}
|
|
529
531
|
emit(e, t) {
|
|
530
532
|
const s = this.listeners.get(e);
|
|
531
|
-
s && s.forEach((n) =>
|
|
533
|
+
s && s.forEach((n) => {
|
|
534
|
+
n(t);
|
|
535
|
+
});
|
|
532
536
|
}
|
|
533
537
|
removeAllListeners() {
|
|
534
538
|
this.listeners.clear();
|
|
@@ -557,7 +561,7 @@ class ct extends f {
|
|
|
557
561
|
return Ge(e);
|
|
558
562
|
}
|
|
559
563
|
sendEventsQueueSync(e) {
|
|
560
|
-
return this.shouldSkipSend() ? !0 : this.get("config")?.integrations?.custom?.collectApiUrl ===
|
|
564
|
+
return this.shouldSkipSend() ? !0 : this.get("config")?.integrations?.custom?.collectApiUrl === X.Fail ? (o("warn", "Fail mode: simulating network failure (sync)", {
|
|
561
565
|
data: { events: e.events.length }
|
|
562
566
|
}), !1) : this.sendQueueSyncInternal(e);
|
|
563
567
|
}
|
|
@@ -591,7 +595,7 @@ class ct extends f {
|
|
|
591
595
|
async send(e) {
|
|
592
596
|
if (this.shouldSkipSend())
|
|
593
597
|
return this.simulateSuccessfulSend();
|
|
594
|
-
if (this.get("config")?.integrations?.custom?.collectApiUrl ===
|
|
598
|
+
if (this.get("config")?.integrations?.custom?.collectApiUrl === X.Fail)
|
|
595
599
|
return o("warn", "Fail mode: simulating network failure", {
|
|
596
600
|
data: { events: e.events.length }
|
|
597
601
|
}), !1;
|
|
@@ -611,7 +615,9 @@ class ct extends f {
|
|
|
611
615
|
}
|
|
612
616
|
}
|
|
613
617
|
async sendWithTimeout(e, t) {
|
|
614
|
-
const s = new AbortController(), n = setTimeout(() =>
|
|
618
|
+
const s = new AbortController(), n = setTimeout(() => {
|
|
619
|
+
s.abort();
|
|
620
|
+
}, 1e4);
|
|
615
621
|
try {
|
|
616
622
|
const i = await fetch(e, {
|
|
617
623
|
method: "POST",
|
|
@@ -707,7 +713,7 @@ class ct extends f {
|
|
|
707
713
|
}
|
|
708
714
|
logPermanentError(e, t) {
|
|
709
715
|
const s = Date.now();
|
|
710
|
-
(!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || s - this.lastPermanentErrorLog.timestamp >=
|
|
716
|
+
(!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || s - this.lastPermanentErrorLog.timestamp >= je) && (o("error", e, {
|
|
711
717
|
data: { status: t.statusCode, message: t.message }
|
|
712
718
|
}), this.lastPermanentErrorLog = { statusCode: t.statusCode, timestamp: s });
|
|
713
719
|
}
|
|
@@ -773,7 +779,7 @@ class ut extends f {
|
|
|
773
779
|
const p = e === d.SESSION_START || e === d.SESSION_END;
|
|
774
780
|
if (!p && !this.checkRateLimit())
|
|
775
781
|
return;
|
|
776
|
-
const L = e,
|
|
782
|
+
const L = e, Ce = L === d.SESSION_START, be = t || this.get("pageUrl"), z = this.buildEventPayload({
|
|
777
783
|
type: L,
|
|
778
784
|
page_url: be,
|
|
779
785
|
from_page_url: s,
|
|
@@ -785,7 +791,7 @@ class ut extends f {
|
|
|
785
791
|
session_end_reason: u
|
|
786
792
|
});
|
|
787
793
|
if (!(!p && !this.shouldSample())) {
|
|
788
|
-
if (
|
|
794
|
+
if (Ce) {
|
|
789
795
|
const oe = this.get("sessionId");
|
|
790
796
|
if (!oe) {
|
|
791
797
|
o("error", "Session start event requires sessionId - event will be ignored");
|
|
@@ -800,7 +806,7 @@ class ut extends f {
|
|
|
800
806
|
this.set("hasStartSession", !0);
|
|
801
807
|
}
|
|
802
808
|
if (!this.isDuplicateEvent(z)) {
|
|
803
|
-
if (this.get("mode") ===
|
|
809
|
+
if (this.get("mode") === C.QA && L === d.CUSTOM && a) {
|
|
804
810
|
console.log("[TraceLog] Event", {
|
|
805
811
|
name: a.name,
|
|
806
812
|
...a.metadata && { metadata: a.metadata }
|
|
@@ -945,7 +951,7 @@ class ut extends f {
|
|
|
945
951
|
}
|
|
946
952
|
handleGoogleAnalyticsIntegration(e) {
|
|
947
953
|
if (this.googleAnalytics && e.type === d.CUSTOM && e.custom_event) {
|
|
948
|
-
if (this.get("mode") ===
|
|
954
|
+
if (this.get("mode") === C.QA)
|
|
949
955
|
return;
|
|
950
956
|
this.googleAnalytics.trackEvent(e.custom_event.name, e.custom_event.metadata ?? {});
|
|
951
957
|
}
|
|
@@ -963,10 +969,10 @@ class ut extends f {
|
|
|
963
969
|
this.eventsQueue = this.eventsQueue.filter((s) => !t.has(s.id));
|
|
964
970
|
}
|
|
965
971
|
emitEvent(e) {
|
|
966
|
-
this.emitter && this.emitter.emit(
|
|
972
|
+
this.emitter && this.emitter.emit(W.EVENT, e);
|
|
967
973
|
}
|
|
968
974
|
emitEventsQueue(e) {
|
|
969
|
-
this.emitter && this.emitter.emit(
|
|
975
|
+
this.emitter && this.emitter.emit(W.QUEUE, e);
|
|
970
976
|
}
|
|
971
977
|
}
|
|
972
978
|
class dt {
|
|
@@ -1113,7 +1119,9 @@ class ht extends f {
|
|
|
1113
1119
|
this.sessionTimeoutId && (clearTimeout(this.sessionTimeoutId), this.sessionTimeoutId = null);
|
|
1114
1120
|
}
|
|
1115
1121
|
setupActivityListeners() {
|
|
1116
|
-
this.activityHandler = () =>
|
|
1122
|
+
this.activityHandler = () => {
|
|
1123
|
+
this.resetSessionTimeout();
|
|
1124
|
+
}, document.addEventListener("click", this.activityHandler, { passive: !0 }), document.addEventListener("keydown", this.activityHandler, { passive: !0 }), document.addEventListener("scroll", this.activityHandler, { passive: !0 });
|
|
1117
1125
|
}
|
|
1118
1126
|
cleanupActivityListeners() {
|
|
1119
1127
|
this.activityHandler && (document.removeEventListener("click", this.activityHandler), document.removeEventListener("keydown", this.activityHandler), document.removeEventListener("scroll", this.activityHandler), this.activityHandler = null);
|
|
@@ -1398,7 +1406,9 @@ class St extends f {
|
|
|
1398
1406
|
return;
|
|
1399
1407
|
}
|
|
1400
1408
|
if (t < 5) {
|
|
1401
|
-
setTimeout(() =>
|
|
1409
|
+
setTimeout(() => {
|
|
1410
|
+
this.trySetupContainers(e, t + 1);
|
|
1411
|
+
}, 200);
|
|
1402
1412
|
return;
|
|
1403
1413
|
}
|
|
1404
1414
|
this.containers.length === 0 && this.setupScrollContainer(window);
|
|
@@ -1544,7 +1554,11 @@ class mt extends f {
|
|
|
1544
1554
|
async loadScript(e) {
|
|
1545
1555
|
return new Promise((t, s) => {
|
|
1546
1556
|
const n = document.createElement("script");
|
|
1547
|
-
n.id = "tracelog-ga-script", n.async = !0, n.src = `https://www.googletagmanager.com/gtag/js?id=${e}`, n.onload = () =>
|
|
1557
|
+
n.id = "tracelog-ga-script", n.async = !0, n.src = `https://www.googletagmanager.com/gtag/js?id=${e}`, n.onload = () => {
|
|
1558
|
+
t();
|
|
1559
|
+
}, n.onerror = () => {
|
|
1560
|
+
s(new Error("Failed to load Google Analytics script"));
|
|
1561
|
+
}, document.head.appendChild(n);
|
|
1548
1562
|
});
|
|
1549
1563
|
}
|
|
1550
1564
|
configureGtag(e, t) {
|
|
@@ -1635,7 +1649,9 @@ class pt {
|
|
|
1635
1649
|
const s = this.storage.key(t);
|
|
1636
1650
|
s?.startsWith("tracelog_") && e.push(s);
|
|
1637
1651
|
}
|
|
1638
|
-
e.forEach((t) =>
|
|
1652
|
+
e.forEach((t) => {
|
|
1653
|
+
this.storage.removeItem(t);
|
|
1654
|
+
}), this.fallbackStorage.clear();
|
|
1639
1655
|
} catch (e) {
|
|
1640
1656
|
o("error", "Failed to clear storage", { error: e }), this.fallbackStorage.clear();
|
|
1641
1657
|
}
|
|
@@ -1934,10 +1950,10 @@ class Tt extends f {
|
|
|
1934
1950
|
if (!this.shouldSample())
|
|
1935
1951
|
return;
|
|
1936
1952
|
const t = this.sanitize(e.message || "Unknown error");
|
|
1937
|
-
this.shouldSuppressError(
|
|
1953
|
+
this.shouldSuppressError(R.JS_ERROR, t) || this.eventManager.track({
|
|
1938
1954
|
type: d.ERROR,
|
|
1939
1955
|
error_data: {
|
|
1940
|
-
type:
|
|
1956
|
+
type: R.JS_ERROR,
|
|
1941
1957
|
message: t,
|
|
1942
1958
|
...e.filename && { filename: e.filename },
|
|
1943
1959
|
...e.lineno && { line: e.lineno },
|
|
@@ -1949,10 +1965,10 @@ class Tt extends f {
|
|
|
1949
1965
|
if (!this.shouldSample())
|
|
1950
1966
|
return;
|
|
1951
1967
|
const t = this.extractRejectionMessage(e.reason), s = this.sanitize(t);
|
|
1952
|
-
this.shouldSuppressError(
|
|
1968
|
+
this.shouldSuppressError(R.PROMISE_REJECTION, s) || this.eventManager.track({
|
|
1953
1969
|
type: d.ERROR,
|
|
1954
1970
|
error_data: {
|
|
1955
|
-
type:
|
|
1971
|
+
type: R.PROMISE_REJECTION,
|
|
1956
1972
|
message: s
|
|
1957
1973
|
}
|
|
1958
1974
|
});
|
|
@@ -1980,7 +1996,7 @@ class Tt extends f {
|
|
|
1980
1996
|
}
|
|
1981
1997
|
shouldSuppressError(e, t) {
|
|
1982
1998
|
const s = Date.now(), n = `${e}:${t}`, i = this.recentErrors.get(n);
|
|
1983
|
-
return i && s - i < de ? (this.recentErrors.set(n, s), !0) : (this.recentErrors.set(n, s), this.recentErrors.size >
|
|
1999
|
+
return i && s - i < de ? (this.recentErrors.set(n, s), !0) : (this.recentErrors.set(n, s), this.recentErrors.size > Be ? (this.recentErrors.clear(), this.recentErrors.set(n, s), !1) : (this.recentErrors.size > U && this.pruneOldErrors(), !1));
|
|
1984
2000
|
}
|
|
1985
2001
|
pruneOldErrors() {
|
|
1986
2002
|
const e = Date.now();
|
|
@@ -2024,7 +2040,7 @@ class vt extends f {
|
|
|
2024
2040
|
return;
|
|
2025
2041
|
const { valid: s, error: n, sanitizedMetadata: i } = ot(e, t);
|
|
2026
2042
|
if (!s) {
|
|
2027
|
-
if (this.get("mode") ===
|
|
2043
|
+
if (this.get("mode") === C.QA)
|
|
2028
2044
|
throw new Error(`[TraceLog] Custom event "${e}" validation failed: ${n}`);
|
|
2029
2045
|
return;
|
|
2030
2046
|
}
|
|
@@ -2061,7 +2077,7 @@ class vt extends f {
|
|
|
2061
2077
|
this.set("device", n);
|
|
2062
2078
|
const i = K(window.location.href, e.sensitiveQueryParams);
|
|
2063
2079
|
this.set("pageUrl", i);
|
|
2064
|
-
const a =
|
|
2080
|
+
const a = We() ? C.QA : void 0;
|
|
2065
2081
|
a && this.set("mode", a);
|
|
2066
2082
|
}
|
|
2067
2083
|
async setupIntegrations() {
|
|
@@ -2152,13 +2168,13 @@ const It = async (r) => {
|
|
|
2152
2168
|
} finally {
|
|
2153
2169
|
H = !1;
|
|
2154
2170
|
}
|
|
2155
|
-
},
|
|
2171
|
+
}, Kt = {
|
|
2156
2172
|
WEB_VITALS_THRESHOLDS: Te
|
|
2157
2173
|
// Business thresholds for performance analysis
|
|
2158
|
-
},
|
|
2174
|
+
}, qt = {
|
|
2159
2175
|
PII_PATTERNS: ve
|
|
2160
2176
|
// Patterns for sensitive data protection
|
|
2161
|
-
},
|
|
2177
|
+
}, Jt = {
|
|
2162
2178
|
LOW_ACTIVITY_EVENT_COUNT: 50,
|
|
2163
2179
|
HIGH_ACTIVITY_EVENT_COUNT: 1e3,
|
|
2164
2180
|
MIN_EVENTS_FOR_DYNAMIC_CALCULATION: 100,
|
|
@@ -2168,7 +2184,7 @@ const It = async (r) => {
|
|
|
2168
2184
|
MIN_ENGAGED_SESSION_DURATION_MS: 30 * 1e3,
|
|
2169
2185
|
MIN_SCROLL_DEPTH_ENGAGEMENT: 25
|
|
2170
2186
|
// 25% scroll depth for engagement
|
|
2171
|
-
},
|
|
2187
|
+
}, Zt = {
|
|
2172
2188
|
INACTIVITY_TIMEOUT_MS: 30 * 60 * 1e3,
|
|
2173
2189
|
// 30min for analytics (vs 15min client)
|
|
2174
2190
|
SHORT_SESSION_THRESHOLD_MS: 30 * 1e3,
|
|
@@ -2176,20 +2192,20 @@ const It = async (r) => {
|
|
|
2176
2192
|
LONG_SESSION_THRESHOLD_MS: 30 * 60 * 1e3,
|
|
2177
2193
|
MAX_REALISTIC_SESSION_DURATION_MS: 8 * 60 * 60 * 1e3
|
|
2178
2194
|
// Filter outliers
|
|
2179
|
-
},
|
|
2195
|
+
}, er = {
|
|
2180
2196
|
MOBILE_MAX_WIDTH: 768,
|
|
2181
2197
|
TABLET_MAX_WIDTH: 1024,
|
|
2182
2198
|
MOBILE_PERFORMANCE_FACTOR: 1.5,
|
|
2183
2199
|
// Mobile typically 1.5x slower
|
|
2184
2200
|
TABLET_PERFORMANCE_FACTOR: 1.2
|
|
2185
|
-
},
|
|
2201
|
+
}, tr = {
|
|
2186
2202
|
MIN_TEXT_LENGTH_FOR_ANALYSIS: 10,
|
|
2187
2203
|
MIN_CLICKS_FOR_HOT_ELEMENT: 10,
|
|
2188
2204
|
// Popular element threshold
|
|
2189
2205
|
MIN_SCROLL_COMPLETION_PERCENT: 80,
|
|
2190
2206
|
// Page consumption threshold
|
|
2191
2207
|
MIN_TIME_ON_PAGE_FOR_READ_MS: 15 * 1e3
|
|
2192
|
-
},
|
|
2208
|
+
}, rr = {
|
|
2193
2209
|
SIGNIFICANT_CHANGE_PERCENT: 20,
|
|
2194
2210
|
MAJOR_CHANGE_PERCENT: 50,
|
|
2195
2211
|
MIN_EVENTS_FOR_INSIGHT: 100,
|
|
@@ -2199,19 +2215,19 @@ const It = async (r) => {
|
|
|
2199
2215
|
LOW_ERROR_RATE_PERCENT: 1,
|
|
2200
2216
|
HIGH_ERROR_RATE_PERCENT: 5,
|
|
2201
2217
|
CRITICAL_ERROR_RATE_PERCENT: 10
|
|
2202
|
-
},
|
|
2218
|
+
}, sr = {
|
|
2203
2219
|
SHORT_TERM_TREND_HOURS: 24,
|
|
2204
2220
|
MEDIUM_TERM_TREND_DAYS: 7,
|
|
2205
2221
|
LONG_TERM_TREND_DAYS: 30,
|
|
2206
2222
|
MIN_DATA_POINTS_FOR_TREND: 5,
|
|
2207
2223
|
WEEKLY_PATTERN_MIN_WEEKS: 4,
|
|
2208
2224
|
DAILY_PATTERN_MIN_DAYS: 14
|
|
2209
|
-
},
|
|
2225
|
+
}, nr = {
|
|
2210
2226
|
MIN_SEGMENT_SIZE: 10,
|
|
2211
2227
|
MIN_COHORT_SIZE: 5,
|
|
2212
2228
|
COHORT_ANALYSIS_DAYS: [1, 3, 7, 14, 30],
|
|
2213
2229
|
MIN_FUNNEL_EVENTS: 20
|
|
2214
|
-
},
|
|
2230
|
+
}, ir = {
|
|
2215
2231
|
DEFAULT_EVENTS_LIMIT: 5,
|
|
2216
2232
|
DEFAULT_SESSIONS_LIMIT: 5,
|
|
2217
2233
|
DEFAULT_PAGES_LIMIT: 5,
|
|
@@ -2219,17 +2235,17 @@ const It = async (r) => {
|
|
|
2219
2235
|
MAX_TIME_RANGE_DAYS: 365,
|
|
2220
2236
|
ANALYTICS_BATCH_SIZE: 1e3
|
|
2221
2237
|
// For historical analysis
|
|
2222
|
-
},
|
|
2238
|
+
}, ar = {
|
|
2223
2239
|
ANOMALY_THRESHOLD_SIGMA: 2.5,
|
|
2224
2240
|
STRONG_ANOMALY_THRESHOLD_SIGMA: 3,
|
|
2225
2241
|
TRAFFIC_DROP_ALERT_PERCENT: -30,
|
|
2226
2242
|
TRAFFIC_SPIKE_ALERT_PERCENT: 200,
|
|
2227
2243
|
MIN_BASELINE_DAYS: 7,
|
|
2228
2244
|
MIN_EVENTS_FOR_ANOMALY_DETECTION: 50
|
|
2229
|
-
},
|
|
2245
|
+
}, or = {
|
|
2230
2246
|
PAGE_URL_EXCLUDED: "excluded",
|
|
2231
2247
|
PAGE_URL_UNKNOWN: "unknown"
|
|
2232
|
-
},
|
|
2248
|
+
}, lr = {
|
|
2233
2249
|
init: It,
|
|
2234
2250
|
event: yt,
|
|
2235
2251
|
on: At,
|
|
@@ -2237,7 +2253,7 @@ const It = async (r) => {
|
|
|
2237
2253
|
isInitialized: Mt,
|
|
2238
2254
|
destroy: Nt
|
|
2239
2255
|
};
|
|
2240
|
-
var
|
|
2256
|
+
var J, ye = -1, N = function(r) {
|
|
2241
2257
|
addEventListener("pageshow", function(e) {
|
|
2242
2258
|
e.persisted && (ye = e.timeStamp, r(e));
|
|
2243
2259
|
}, !0);
|
|
@@ -2304,20 +2320,20 @@ var Z, ye = -1, N = function(r) {
|
|
|
2304
2320
|
document.prerendering ? addEventListener("prerenderingchange", function() {
|
|
2305
2321
|
return r();
|
|
2306
2322
|
}, !0) : r();
|
|
2307
|
-
},
|
|
2323
|
+
}, Z = [1800, 3e3], we = function(r, e) {
|
|
2308
2324
|
e = e || {}, $(function() {
|
|
2309
2325
|
var t, s = Ae(), n = E("FCP"), i = O("paint", function(a) {
|
|
2310
2326
|
a.forEach(function(l) {
|
|
2311
2327
|
l.name === "first-contentful-paint" && (i.disconnect(), l.startTime < s.firstHiddenTime && (n.value = Math.max(l.startTime - F(), 0), n.entries.push(l), t(!0)));
|
|
2312
2328
|
});
|
|
2313
2329
|
});
|
|
2314
|
-
i && (t = S(r, n,
|
|
2315
|
-
n = E("FCP"), t = S(r, n,
|
|
2330
|
+
i && (t = S(r, n, Z, e.reportAllChanges), N(function(a) {
|
|
2331
|
+
n = E("FCP"), t = S(r, n, Z, e.reportAllChanges), ie(function() {
|
|
2316
2332
|
n.value = performance.now() - a.timeStamp, t(!0);
|
|
2317
2333
|
});
|
|
2318
2334
|
}));
|
|
2319
2335
|
});
|
|
2320
|
-
}, ee = [0.1, 0.25],
|
|
2336
|
+
}, ee = [0.1, 0.25], Rt = function(r, e) {
|
|
2321
2337
|
e = e || {}, we(ae(function() {
|
|
2322
2338
|
var t, s = E("CLS", 0), n = 0, i = [], a = function(c) {
|
|
2323
2339
|
c.forEach(function(u) {
|
|
@@ -2335,14 +2351,14 @@ var Z, ye = -1, N = function(r) {
|
|
|
2335
2351
|
});
|
|
2336
2352
|
}), setTimeout(t, 0));
|
|
2337
2353
|
}));
|
|
2338
|
-
}, Me = 0,
|
|
2354
|
+
}, Me = 0, B = 1 / 0, D = 0, Ct = function(r) {
|
|
2339
2355
|
r.forEach(function(e) {
|
|
2340
|
-
e.interactionId && (
|
|
2356
|
+
e.interactionId && (B = Math.min(B, e.interactionId), D = Math.max(D, e.interactionId), Me = D ? (D - B) / 7 + 1 : 0);
|
|
2341
2357
|
});
|
|
2342
2358
|
}, Ne = function() {
|
|
2343
|
-
return
|
|
2359
|
+
return J ? Me : performance.interactionCount || 0;
|
|
2344
2360
|
}, bt = function() {
|
|
2345
|
-
"interactionCount" in performance ||
|
|
2361
|
+
"interactionCount" in performance || J || (J = O("event", Ct, { type: "event", buffered: !0, durationThreshold: 0 }));
|
|
2346
2362
|
}, g = [], x = /* @__PURE__ */ new Map(), Le = 0, Ot = function() {
|
|
2347
2363
|
var r = Math.min(g.length - 1, Math.floor((Ne() - Le) / 50));
|
|
2348
2364
|
return g[r];
|
|
@@ -2364,7 +2380,7 @@ var Z, ye = -1, N = function(r) {
|
|
|
2364
2380
|
});
|
|
2365
2381
|
}
|
|
2366
2382
|
}
|
|
2367
|
-
},
|
|
2383
|
+
}, Re = function(r) {
|
|
2368
2384
|
var e = self.requestIdleCallback || self.setTimeout, t = -1;
|
|
2369
2385
|
return r = ae(r), document.visibilityState === "hidden" ? r() : (t = e(r), G(r)), t;
|
|
2370
2386
|
}, te = [200, 500], kt = function(r, e) {
|
|
@@ -2372,7 +2388,7 @@ var Z, ye = -1, N = function(r) {
|
|
|
2372
2388
|
var t;
|
|
2373
2389
|
bt();
|
|
2374
2390
|
var s, n = E("INP"), i = function(l) {
|
|
2375
|
-
|
|
2391
|
+
Re(function() {
|
|
2376
2392
|
l.forEach(Dt);
|
|
2377
2393
|
var c = Ot();
|
|
2378
2394
|
c && c.latency !== n.value && (n.value = c.latency, n.entries = c.entries, s());
|
|
@@ -2384,7 +2400,7 @@ var Z, ye = -1, N = function(r) {
|
|
|
2384
2400
|
Le = Ne(), g.length = 0, x.clear(), n = E("INP"), s = S(r, n, te, e.reportAllChanges);
|
|
2385
2401
|
}));
|
|
2386
2402
|
}));
|
|
2387
|
-
}, re = [2500, 4e3],
|
|
2403
|
+
}, re = [2500, 4e3], j = {}, Ut = function(r, e) {
|
|
2388
2404
|
e = e || {}, $(function() {
|
|
2389
2405
|
var t, s = Ae(), n = E("LCP"), i = function(c) {
|
|
2390
2406
|
e.reportAllChanges || (c = c.slice(-1)), c.forEach(function(u) {
|
|
@@ -2394,15 +2410,15 @@ var Z, ye = -1, N = function(r) {
|
|
|
2394
2410
|
if (a) {
|
|
2395
2411
|
t = S(r, n, re, e.reportAllChanges);
|
|
2396
2412
|
var l = ae(function() {
|
|
2397
|
-
|
|
2413
|
+
j[n.id] || (i(a.takeRecords()), a.disconnect(), j[n.id] = !0, t(!0));
|
|
2398
2414
|
});
|
|
2399
2415
|
["keydown", "click"].forEach(function(c) {
|
|
2400
2416
|
addEventListener(c, function() {
|
|
2401
|
-
return
|
|
2417
|
+
return Re(l);
|
|
2402
2418
|
}, { once: !0, capture: !0 });
|
|
2403
2419
|
}), G(l), N(function(c) {
|
|
2404
2420
|
n = E("LCP"), t = S(r, n, re, e.reportAllChanges), ie(function() {
|
|
2405
|
-
n.value = performance.now() - c.timeStamp,
|
|
2421
|
+
n.value = performance.now() - c.timeStamp, j[n.id] = !0, t(!0);
|
|
2406
2422
|
});
|
|
2407
2423
|
});
|
|
2408
2424
|
}
|
|
@@ -2426,42 +2442,51 @@ var Z, ye = -1, N = function(r) {
|
|
|
2426
2442
|
const Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2427
2443
|
__proto__: null,
|
|
2428
2444
|
CLSThresholds: ee,
|
|
2429
|
-
FCPThresholds:
|
|
2445
|
+
FCPThresholds: Z,
|
|
2430
2446
|
INPThresholds: te,
|
|
2431
2447
|
LCPThresholds: re,
|
|
2432
2448
|
TTFBThresholds: se,
|
|
2433
|
-
onCLS:
|
|
2449
|
+
onCLS: Rt,
|
|
2434
2450
|
onFCP: we,
|
|
2435
2451
|
onINP: kt,
|
|
2436
2452
|
onLCP: Ut,
|
|
2437
2453
|
onTTFB: xt
|
|
2438
2454
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2439
2455
|
export {
|
|
2440
|
-
|
|
2441
|
-
|
|
2456
|
+
ir as ANALYTICS_QUERY_LIMITS,
|
|
2457
|
+
ar as ANOMALY_DETECTION,
|
|
2442
2458
|
A as AppConfigValidationError,
|
|
2443
|
-
|
|
2444
|
-
|
|
2445
|
-
|
|
2459
|
+
tr as CONTENT_ANALYTICS,
|
|
2460
|
+
qt as DATA_PROTECTION,
|
|
2461
|
+
er as DEVICE_ANALYTICS,
|
|
2446
2462
|
_ as DeviceType,
|
|
2447
|
-
|
|
2448
|
-
|
|
2449
|
-
|
|
2463
|
+
Jt as ENGAGEMENT_THRESHOLDS,
|
|
2464
|
+
W as EmitterEvent,
|
|
2465
|
+
R as ErrorType,
|
|
2450
2466
|
d as EventType,
|
|
2451
|
-
|
|
2452
|
-
|
|
2467
|
+
rr as INSIGHT_THRESHOLDS,
|
|
2468
|
+
Yt as InitializationTimeoutError,
|
|
2453
2469
|
v as IntegrationValidationError,
|
|
2454
|
-
|
|
2455
|
-
|
|
2470
|
+
Wt as MAX_ARRAY_LENGTH,
|
|
2471
|
+
zt as MAX_CUSTOM_EVENT_ARRAY_SIZE,
|
|
2472
|
+
$t as MAX_CUSTOM_EVENT_KEYS,
|
|
2473
|
+
Ft as MAX_CUSTOM_EVENT_NAME_LENGTH,
|
|
2474
|
+
Gt as MAX_CUSTOM_EVENT_STRING_SIZE,
|
|
2475
|
+
Bt as MAX_METADATA_NESTING_DEPTH,
|
|
2476
|
+
Qt as MAX_NESTED_OBJECT_KEYS,
|
|
2477
|
+
jt as MAX_STRING_LENGTH,
|
|
2478
|
+
Xt as MAX_STRING_LENGTH_IN_ARRAY,
|
|
2479
|
+
C as Mode,
|
|
2480
|
+
Kt as PERFORMANCE_CONFIG,
|
|
2456
2481
|
y as PermanentError,
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2482
|
+
nr as SEGMENTATION_ANALYTICS,
|
|
2483
|
+
Zt as SESSION_ANALYTICS,
|
|
2484
|
+
or as SPECIAL_PAGE_URLS,
|
|
2460
2485
|
le as SamplingRateValidationError,
|
|
2461
2486
|
k as ScrollDirection,
|
|
2462
2487
|
ke as SessionTimeoutValidationError,
|
|
2463
|
-
|
|
2464
|
-
|
|
2488
|
+
X as SpecialApiUrl,
|
|
2489
|
+
sr as TEMPORAL_ANALYSIS,
|
|
2465
2490
|
b as TraceLogValidationError,
|
|
2466
|
-
|
|
2491
|
+
lr as tracelog
|
|
2467
2492
|
};
|