@tracelog/lib 0.9.0 → 0.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +46 -0
- package/dist/browser/tracelog.esm.js +671 -640
- 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/constants/config.constants.d.ts +1 -0
- package/dist/cjs/constants/config.constants.d.ts.map +1 -1
- package/dist/cjs/constants/config.constants.js +19 -2
- package/dist/cjs/constants/config.constants.js.map +1 -1
- package/dist/cjs/handlers/click.handler.d.ts +2 -0
- package/dist/cjs/handlers/click.handler.d.ts.map +1 -1
- package/dist/cjs/handlers/click.handler.js +27 -5
- package/dist/cjs/handlers/click.handler.js.map +1 -1
- package/dist/cjs/utils/network/url.utils.d.ts +2 -1
- package/dist/cjs/utils/network/url.utils.d.ts.map +1 -1
- package/dist/cjs/utils/network/url.utils.js +6 -2
- package/dist/cjs/utils/network/url.utils.js.map +1 -1
- package/dist/esm/constants/config.constants.d.ts +1 -0
- package/dist/esm/constants/config.constants.d.ts.map +1 -1
- package/dist/esm/constants/config.constants.js +17 -0
- package/dist/esm/constants/config.constants.js.map +1 -1
- package/dist/esm/handlers/click.handler.d.ts +2 -0
- package/dist/esm/handlers/click.handler.d.ts.map +1 -1
- package/dist/esm/handlers/click.handler.js +28 -6
- package/dist/esm/handlers/click.handler.js.map +1 -1
- package/dist/esm/utils/network/url.utils.d.ts +2 -1
- package/dist/esm/utils/network/url.utils.d.ts.map +1 -1
- package/dist/esm/utils/network/url.utils.js +6 -2
- package/dist/esm/utils/network/url.utils.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const
|
|
2
|
-
const
|
|
3
|
-
const
|
|
1
|
+
const Ft = 120, Gt = 8192, $t = 10, zt = 10, Qt = 20, Bt = 1;
|
|
2
|
+
const jt = 1e3, Xt = 500, Wt = 100;
|
|
3
|
+
const A = "data-tlog", Pe = [
|
|
4
4
|
"button",
|
|
5
5
|
"a",
|
|
6
6
|
'input[type="button"]',
|
|
@@ -32,7 +32,22 @@ const D = "data-tlog", Pe = [
|
|
|
32
32
|
".menu-item",
|
|
33
33
|
"[data-testid]",
|
|
34
34
|
'[tabindex="0"]'
|
|
35
|
-
], De = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"]
|
|
35
|
+
], De = ["utm_source", "utm_medium", "utm_campaign", "utm_term", "utm_content"], ke = [
|
|
36
|
+
"token",
|
|
37
|
+
"auth",
|
|
38
|
+
"key",
|
|
39
|
+
"session",
|
|
40
|
+
"reset",
|
|
41
|
+
"password",
|
|
42
|
+
"api_key",
|
|
43
|
+
"apikey",
|
|
44
|
+
"secret",
|
|
45
|
+
"access_token",
|
|
46
|
+
"refresh_token",
|
|
47
|
+
"verification",
|
|
48
|
+
"code",
|
|
49
|
+
"otp"
|
|
50
|
+
];
|
|
36
51
|
const S = {
|
|
37
52
|
INVALID_SESSION_TIMEOUT: "Session timeout must be between 30000ms (30 seconds) and 86400000ms (24 hours)",
|
|
38
53
|
INVALID_SAMPLING_RATE: "Sampling rate must be between 0 and 1",
|
|
@@ -44,7 +59,7 @@ const S = {
|
|
|
44
59
|
INVALID_SENSITIVE_QUERY_PARAMS: "Sensitive query params must be an array of strings",
|
|
45
60
|
INVALID_PRIMARY_SCROLL_SELECTOR: "Primary scroll selector must be a non-empty string",
|
|
46
61
|
INVALID_PRIMARY_SCROLL_SELECTOR_SYNTAX: "Invalid CSS selector syntax for primaryScrollSelector"
|
|
47
|
-
},
|
|
62
|
+
}, Ue = [
|
|
48
63
|
/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
|
|
49
64
|
/javascript:/gi,
|
|
50
65
|
/on\w+\s*=/gi,
|
|
@@ -52,96 +67,96 @@ const S = {
|
|
|
52
67
|
/<embed\b[^>]*>/gi,
|
|
53
68
|
/<object\b[^<]*(?:(?!<\/object>)<[^<]*)*<\/object>/gi
|
|
54
69
|
];
|
|
55
|
-
var Y = /* @__PURE__ */ ((
|
|
56
|
-
class
|
|
70
|
+
var Y = /* @__PURE__ */ ((s) => (s.Localhost = "localhost:8080", s.Fail = "localhost:9999", s))(Y || {}), T = /* @__PURE__ */ ((s) => (s.Mobile = "mobile", s.Tablet = "tablet", s.Desktop = "desktop", s.Unknown = "unknown", s))(T || {}), K = /* @__PURE__ */ ((s) => (s.EVENT = "event", s.QUEUE = "queue", s))(K || {});
|
|
71
|
+
class M extends Error {
|
|
57
72
|
constructor(e, t) {
|
|
58
|
-
super(e), this.statusCode = t, this.name = "PermanentError", Error.captureStackTrace && Error.captureStackTrace(this,
|
|
73
|
+
super(e), this.statusCode = t, this.name = "PermanentError", Error.captureStackTrace && Error.captureStackTrace(this, M);
|
|
59
74
|
}
|
|
60
75
|
}
|
|
61
|
-
var d = /* @__PURE__ */ ((
|
|
62
|
-
function
|
|
63
|
-
return
|
|
76
|
+
var d = /* @__PURE__ */ ((s) => (s.PAGE_VIEW = "page_view", s.CLICK = "click", s.SCROLL = "scroll", s.SESSION_START = "session_start", s.SESSION_END = "session_end", s.CUSTOM = "custom", s.WEB_VITALS = "web_vitals", s.ERROR = "error", s))(d || {}), U = /* @__PURE__ */ ((s) => (s.UP = "up", s.DOWN = "down", s))(U || {}), b = /* @__PURE__ */ ((s) => (s.JS_ERROR = "js_error", s.PROMISE_REJECTION = "promise_rejection", s))(b || {});
|
|
77
|
+
function Yt(s) {
|
|
78
|
+
return s.type === "scroll" && "scroll_data" in s && s.scroll_data.is_primary === !0;
|
|
64
79
|
}
|
|
65
|
-
function
|
|
66
|
-
return
|
|
80
|
+
function Kt(s) {
|
|
81
|
+
return s.type === "scroll" && "scroll_data" in s && s.scroll_data.is_primary === !1;
|
|
67
82
|
}
|
|
68
|
-
var
|
|
69
|
-
class
|
|
70
|
-
constructor(e, t,
|
|
71
|
-
super(e), this.errorCode = t, this.layer =
|
|
83
|
+
var C = /* @__PURE__ */ ((s) => (s.QA = "qa", s))(C || {});
|
|
84
|
+
class O extends Error {
|
|
85
|
+
constructor(e, t, r) {
|
|
86
|
+
super(e), this.errorCode = t, this.layer = r, this.name = this.constructor.name, Error.captureStackTrace && Error.captureStackTrace(this, this.constructor);
|
|
72
87
|
}
|
|
73
88
|
}
|
|
74
|
-
class
|
|
89
|
+
class w extends O {
|
|
75
90
|
constructor(e, t = "config") {
|
|
76
91
|
super(e, "APP_CONFIG_INVALID", t);
|
|
77
92
|
}
|
|
78
93
|
}
|
|
79
|
-
class
|
|
94
|
+
class He extends O {
|
|
80
95
|
constructor(e, t = "config") {
|
|
81
96
|
super(e, "SESSION_TIMEOUT_INVALID", t);
|
|
82
97
|
}
|
|
83
98
|
}
|
|
84
|
-
class
|
|
99
|
+
class de extends O {
|
|
85
100
|
constructor(e, t = "config") {
|
|
86
101
|
super(e, "SAMPLING_RATE_INVALID", t);
|
|
87
102
|
}
|
|
88
103
|
}
|
|
89
|
-
class v extends
|
|
104
|
+
class v extends O {
|
|
90
105
|
constructor(e, t = "config") {
|
|
91
106
|
super(e, "INTEGRATION_INVALID", t);
|
|
92
107
|
}
|
|
93
108
|
}
|
|
94
|
-
class
|
|
95
|
-
constructor(e, t,
|
|
96
|
-
super(e, "INITIALIZATION_TIMEOUT",
|
|
109
|
+
class qt extends O {
|
|
110
|
+
constructor(e, t, r = "runtime") {
|
|
111
|
+
super(e, "INITIALIZATION_TIMEOUT", r), this.timeoutMs = t;
|
|
97
112
|
}
|
|
98
113
|
}
|
|
99
|
-
const
|
|
114
|
+
const xe = (s, e) => {
|
|
100
115
|
if (e) {
|
|
101
116
|
if (e instanceof Error) {
|
|
102
117
|
const t = e.message.replace(/\s+at\s+.*$/gm, "").replace(/\(.*?:\d+:\d+\)/g, "");
|
|
103
|
-
return `[TraceLog] ${
|
|
118
|
+
return `[TraceLog] ${s}: ${t}`;
|
|
104
119
|
}
|
|
105
|
-
return `[TraceLog] ${
|
|
120
|
+
return `[TraceLog] ${s}: ${e instanceof Error ? e.message : "Unknown error"}`;
|
|
106
121
|
}
|
|
107
|
-
return `[TraceLog] ${
|
|
108
|
-
}, l = (
|
|
109
|
-
const { error:
|
|
110
|
-
if (!(
|
|
122
|
+
return `[TraceLog] ${s}`;
|
|
123
|
+
}, l = (s, e, t) => {
|
|
124
|
+
const { error: r, data: n, showToClient: i = !1 } = t ?? {}, a = r ? xe(e, r) : `[TraceLog] ${e}`, o = s === "error" ? "error" : s === "warn" ? "warn" : "log";
|
|
125
|
+
if (!(s === "debug" || s === "info" && !i))
|
|
111
126
|
if (n !== void 0) {
|
|
112
|
-
const c =
|
|
127
|
+
const c = Ve(n);
|
|
113
128
|
console[o](a, c);
|
|
114
129
|
} else n !== void 0 ? console[o](a, n) : console[o](a);
|
|
115
|
-
},
|
|
130
|
+
}, Ve = (s) => {
|
|
116
131
|
const e = {}, t = ["token", "password", "secret", "key", "apikey", "api_key", "sessionid", "session_id"];
|
|
117
|
-
for (const [
|
|
118
|
-
const i =
|
|
119
|
-
t.some((a) => i.includes(a)) ? e[
|
|
132
|
+
for (const [r, n] of Object.entries(s)) {
|
|
133
|
+
const i = r.toLowerCase();
|
|
134
|
+
t.some((a) => i.includes(a)) ? e[r] = "[REDACTED]" : e[r] = n;
|
|
120
135
|
}
|
|
121
136
|
return e;
|
|
122
137
|
};
|
|
123
|
-
let q,
|
|
124
|
-
const
|
|
125
|
-
typeof window < "u" && !q && (q = window.matchMedia("(pointer: coarse)"),
|
|
126
|
-
},
|
|
138
|
+
let q, ve;
|
|
139
|
+
const Fe = () => {
|
|
140
|
+
typeof window < "u" && !q && (q = window.matchMedia("(pointer: coarse)"), ve = window.matchMedia("(hover: none)"));
|
|
141
|
+
}, Ge = () => {
|
|
127
142
|
try {
|
|
128
|
-
const
|
|
129
|
-
if (
|
|
130
|
-
return
|
|
131
|
-
|
|
132
|
-
const e = window.innerWidth, t = q?.matches ?? !1,
|
|
133
|
-
return e <= 767 || a && n ? T.Mobile : e >= 768 && e <= 1024 || o || t &&
|
|
134
|
-
} catch (
|
|
135
|
-
return l("warn", "Device detection failed, defaulting to desktop", { error:
|
|
136
|
-
}
|
|
137
|
-
}, I = "tlog",
|
|
143
|
+
const s = navigator;
|
|
144
|
+
if (s.userAgentData && typeof s.userAgentData.mobile == "boolean")
|
|
145
|
+
return s.userAgentData.platform && /ipad|tablet/i.test(s.userAgentData.platform) ? T.Tablet : s.userAgentData.mobile ? T.Mobile : T.Desktop;
|
|
146
|
+
Fe();
|
|
147
|
+
const e = window.innerWidth, t = q?.matches ?? !1, r = ve?.matches ?? !1, n = "ontouchstart" in window || navigator.maxTouchPoints > 0, i = navigator.userAgent.toLowerCase(), a = /mobile|android|iphone|ipod|blackberry|iemobile|opera mini/.test(i), o = /tablet|ipad|android(?!.*mobile)/.test(i);
|
|
148
|
+
return e <= 767 || a && n ? T.Mobile : e >= 768 && e <= 1024 || o || t && r && n ? T.Tablet : T.Desktop;
|
|
149
|
+
} catch (s) {
|
|
150
|
+
return l("warn", "Device detection failed, defaulting to desktop", { error: s }), T.Desktop;
|
|
151
|
+
}
|
|
152
|
+
}, I = "tlog", he = `${I}:qa_mode`, $e = `${I}:uid`, ze = (s) => s ? `${I}:${s}:queue` : `${I}:queue`, Qe = (s) => s ? `${I}:${s}:session` : `${I}:session`, Be = (s) => s ? `${I}:${s}:broadcast` : `${I}:broadcast`, ye = {
|
|
138
153
|
LCP: 4e3,
|
|
139
154
|
FCP: 1800,
|
|
140
155
|
CLS: 0.25,
|
|
141
156
|
INP: 200,
|
|
142
157
|
TTFB: 800,
|
|
143
158
|
LONG_TASK: 50
|
|
144
|
-
},
|
|
159
|
+
}, je = 1e3, ae = [
|
|
145
160
|
// Email addresses
|
|
146
161
|
/\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Z|a-z]{2,}\b/gi,
|
|
147
162
|
// US Phone numbers (various formats)
|
|
@@ -156,12 +171,12 @@ const Ve = () => {
|
|
|
156
171
|
/Bearer\s+[A-Za-z0-9_-]+(?:\.[A-Za-z0-9_-]+)?(?:\.[A-Za-z0-9_-]+)?/gi,
|
|
157
172
|
// Passwords in connection strings (protocol://user:password@host)
|
|
158
173
|
/:\/\/[^:/]+:([^@]+)@/gi
|
|
159
|
-
],
|
|
160
|
-
if (sessionStorage.getItem(
|
|
174
|
+
], fe = 500, ge = 5e3, H = 50, Xe = H * 2, Ae = 1, We = 6e4, Se = "tlog_mode", Ye = "qa", Ke = () => {
|
|
175
|
+
if (sessionStorage.getItem(he) === "true")
|
|
161
176
|
return !0;
|
|
162
|
-
const e = new URLSearchParams(window.location.search),
|
|
163
|
-
if (
|
|
164
|
-
sessionStorage.setItem(
|
|
177
|
+
const e = new URLSearchParams(window.location.search), r = e.get(Se) === Ye;
|
|
178
|
+
if (r) {
|
|
179
|
+
sessionStorage.setItem(he, "true"), e.delete(Se);
|
|
165
180
|
const n = e.toString(), i = `${window.location.pathname}${n ? "?" + n : ""}${window.location.hash}`;
|
|
166
181
|
try {
|
|
167
182
|
window.history.replaceState({}, "", i);
|
|
@@ -173,97 +188,97 @@ const Ve = () => {
|
|
|
173
188
|
"background: #ff9800; color: white; font-weight: bold; padding: 2px 8px; border-radius: 3px;"
|
|
174
189
|
);
|
|
175
190
|
}
|
|
176
|
-
return
|
|
177
|
-
},
|
|
178
|
-
const
|
|
179
|
-
return De.forEach((
|
|
180
|
-
const n =
|
|
191
|
+
return r;
|
|
192
|
+
}, Ee = () => {
|
|
193
|
+
const s = new URLSearchParams(window.location.search), e = {};
|
|
194
|
+
return De.forEach((r) => {
|
|
195
|
+
const n = s.get(r);
|
|
181
196
|
if (n) {
|
|
182
|
-
const i =
|
|
197
|
+
const i = r.split("utm_")[1];
|
|
183
198
|
e[i] = n;
|
|
184
199
|
}
|
|
185
200
|
}), Object.keys(e).length ? e : void 0;
|
|
186
|
-
},
|
|
201
|
+
}, qe = () => typeof crypto < "u" && crypto.randomUUID ? crypto.randomUUID() : "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (s) => {
|
|
187
202
|
const e = Math.random() * 16 | 0;
|
|
188
|
-
return (
|
|
189
|
-
}),
|
|
190
|
-
const
|
|
203
|
+
return (s === "x" ? e : e & 3 | 8).toString(16);
|
|
204
|
+
}), Je = () => {
|
|
205
|
+
const s = Date.now();
|
|
191
206
|
let e = "";
|
|
192
207
|
try {
|
|
193
208
|
if (typeof crypto < "u" && crypto.getRandomValues) {
|
|
194
209
|
const t = crypto.getRandomValues(new Uint8Array(4));
|
|
195
|
-
t && (e = Array.from(t, (
|
|
210
|
+
t && (e = Array.from(t, (r) => r.toString(16).padStart(2, "0")).join(""));
|
|
196
211
|
}
|
|
197
212
|
} catch {
|
|
198
213
|
}
|
|
199
|
-
return e || (e = Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")), `${
|
|
200
|
-
},
|
|
214
|
+
return e || (e = Math.floor(Math.random() * 4294967295).toString(16).padStart(8, "0")), `${s}-${e}`;
|
|
215
|
+
}, me = (s, e = !1) => {
|
|
201
216
|
try {
|
|
202
|
-
const t = new URL(
|
|
203
|
-
return
|
|
217
|
+
const t = new URL(s), r = t.protocol === "https:", n = t.protocol === "http:";
|
|
218
|
+
return r || e && n;
|
|
204
219
|
} catch {
|
|
205
220
|
return !1;
|
|
206
221
|
}
|
|
207
|
-
},
|
|
208
|
-
if (
|
|
222
|
+
}, Ze = (s) => {
|
|
223
|
+
if (s.integrations?.tracelog?.projectId) {
|
|
209
224
|
const n = new URL(window.location.href).hostname.split(".");
|
|
210
225
|
if (n.length === 0)
|
|
211
226
|
throw new Error("Invalid URL");
|
|
212
|
-
const i =
|
|
213
|
-
if (!
|
|
227
|
+
const i = s.integrations.tracelog.projectId, a = n.slice(-2).join("."), o = `https://${i}.${a}/collect`;
|
|
228
|
+
if (!me(o))
|
|
214
229
|
throw new Error("Invalid URL");
|
|
215
230
|
return o;
|
|
216
231
|
}
|
|
217
|
-
const e =
|
|
232
|
+
const e = s.integrations?.custom?.collectApiUrl;
|
|
218
233
|
if (e) {
|
|
219
|
-
const t =
|
|
220
|
-
if (!
|
|
234
|
+
const t = s.integrations?.custom?.allowHttp ?? !1;
|
|
235
|
+
if (!me(e, t))
|
|
221
236
|
throw new Error("Invalid URL");
|
|
222
237
|
return e;
|
|
223
238
|
}
|
|
224
239
|
return "";
|
|
225
|
-
}, J = (
|
|
240
|
+
}, J = (s, e = []) => {
|
|
226
241
|
try {
|
|
227
|
-
const t = new URL(
|
|
228
|
-
let
|
|
229
|
-
const
|
|
230
|
-
return
|
|
231
|
-
|
|
232
|
-
}), !
|
|
242
|
+
const t = new URL(s), r = t.searchParams, n = [.../* @__PURE__ */ new Set([...ke, ...e])];
|
|
243
|
+
let i = !1;
|
|
244
|
+
const a = [];
|
|
245
|
+
return n.forEach((c) => {
|
|
246
|
+
r.has(c) && (r.delete(c), i = !0, a.push(c));
|
|
247
|
+
}), !i && s.includes("?") ? s : (t.search = r.toString(), t.toString());
|
|
233
248
|
} catch (t) {
|
|
234
|
-
return l("warn", "URL normalization failed, returning original", { error: t, data: { url:
|
|
249
|
+
return l("warn", "URL normalization failed, returning original", { error: t, data: { url: s.slice(0, 100) } }), s;
|
|
235
250
|
}
|
|
236
|
-
},
|
|
237
|
-
if (!
|
|
251
|
+
}, pe = (s) => {
|
|
252
|
+
if (!s || typeof s != "string" || s.trim().length === 0)
|
|
238
253
|
return "";
|
|
239
|
-
let e =
|
|
240
|
-
|
|
254
|
+
let e = s;
|
|
255
|
+
s.length > 1e3 && (e = s.slice(0, Math.max(0, 1e3)));
|
|
241
256
|
let t = 0;
|
|
242
|
-
for (const n of
|
|
257
|
+
for (const n of Ue) {
|
|
243
258
|
const i = e;
|
|
244
259
|
e = e.replace(n, ""), i !== e && t++;
|
|
245
260
|
}
|
|
246
261
|
return t > 0 && l("warn", "XSS patterns detected and removed", {
|
|
247
262
|
data: {
|
|
248
263
|
patternMatches: t,
|
|
249
|
-
originalValue:
|
|
264
|
+
originalValue: s.slice(0, 100)
|
|
250
265
|
}
|
|
251
266
|
}), e = e.replaceAll("&", "&").replaceAll("<", "<").replaceAll(">", ">").replaceAll('"', """).replaceAll("'", "'").replaceAll("/", "/"), e.trim();
|
|
252
|
-
}, Z = (
|
|
253
|
-
if (e > 3 ||
|
|
267
|
+
}, Z = (s, e = 0) => {
|
|
268
|
+
if (e > 3 || s == null)
|
|
254
269
|
return null;
|
|
255
|
-
if (typeof
|
|
256
|
-
return
|
|
257
|
-
if (typeof
|
|
258
|
-
return !Number.isFinite(
|
|
259
|
-
if (typeof
|
|
260
|
-
return
|
|
261
|
-
if (Array.isArray(
|
|
262
|
-
return
|
|
263
|
-
if (typeof
|
|
264
|
-
const t = {}, n = Object.entries(
|
|
270
|
+
if (typeof s == "string")
|
|
271
|
+
return pe(s);
|
|
272
|
+
if (typeof s == "number")
|
|
273
|
+
return !Number.isFinite(s) || s < -Number.MAX_SAFE_INTEGER || s > Number.MAX_SAFE_INTEGER ? 0 : s;
|
|
274
|
+
if (typeof s == "boolean")
|
|
275
|
+
return s;
|
|
276
|
+
if (Array.isArray(s))
|
|
277
|
+
return s.slice(0, 100).map((n) => Z(n, e + 1)).filter((n) => n !== null);
|
|
278
|
+
if (typeof s == "object") {
|
|
279
|
+
const t = {}, n = Object.entries(s).slice(0, 20);
|
|
265
280
|
for (const [i, a] of n) {
|
|
266
|
-
const o =
|
|
281
|
+
const o = pe(i);
|
|
267
282
|
if (o) {
|
|
268
283
|
const c = Z(a, e + 1);
|
|
269
284
|
c !== null && (t[o] = c);
|
|
@@ -272,124 +287,124 @@ const Ve = () => {
|
|
|
272
287
|
return t;
|
|
273
288
|
}
|
|
274
289
|
return null;
|
|
275
|
-
},
|
|
276
|
-
if (typeof
|
|
290
|
+
}, et = (s) => {
|
|
291
|
+
if (typeof s != "object" || s === null)
|
|
277
292
|
return {};
|
|
278
293
|
try {
|
|
279
|
-
const e = Z(
|
|
294
|
+
const e = Z(s);
|
|
280
295
|
return typeof e == "object" && e !== null ? e : {};
|
|
281
296
|
} catch (e) {
|
|
282
297
|
const t = e instanceof Error ? e.message : String(e);
|
|
283
298
|
throw new Error(`[TraceLog] Metadata sanitization failed: ${t}`);
|
|
284
299
|
}
|
|
285
|
-
},
|
|
286
|
-
if (
|
|
287
|
-
throw new
|
|
288
|
-
if (
|
|
289
|
-
if (
|
|
290
|
-
throw new
|
|
291
|
-
if (
|
|
292
|
-
throw new
|
|
293
|
-
if (
|
|
294
|
-
if (!Array.isArray(
|
|
295
|
-
throw new
|
|
296
|
-
for (const e of
|
|
300
|
+
}, tt = (s) => {
|
|
301
|
+
if (s !== void 0 && (s === null || typeof s != "object"))
|
|
302
|
+
throw new w("Configuration must be an object", "config");
|
|
303
|
+
if (s) {
|
|
304
|
+
if (s.sessionTimeout !== void 0 && (typeof s.sessionTimeout != "number" || s.sessionTimeout < 3e4 || s.sessionTimeout > 864e5))
|
|
305
|
+
throw new He(S.INVALID_SESSION_TIMEOUT, "config");
|
|
306
|
+
if (s.globalMetadata !== void 0 && (typeof s.globalMetadata != "object" || s.globalMetadata === null))
|
|
307
|
+
throw new w(S.INVALID_GLOBAL_METADATA, "config");
|
|
308
|
+
if (s.integrations && rt(s.integrations), s.sensitiveQueryParams !== void 0) {
|
|
309
|
+
if (!Array.isArray(s.sensitiveQueryParams))
|
|
310
|
+
throw new w(S.INVALID_SENSITIVE_QUERY_PARAMS, "config");
|
|
311
|
+
for (const e of s.sensitiveQueryParams)
|
|
297
312
|
if (typeof e != "string")
|
|
298
|
-
throw new
|
|
299
|
-
}
|
|
300
|
-
if (
|
|
301
|
-
throw new
|
|
302
|
-
if (
|
|
303
|
-
throw new
|
|
304
|
-
if (
|
|
305
|
-
if (typeof
|
|
306
|
-
throw new
|
|
307
|
-
if (
|
|
313
|
+
throw new w("All sensitive query params must be strings", "config");
|
|
314
|
+
}
|
|
315
|
+
if (s.errorSampling !== void 0 && (typeof s.errorSampling != "number" || s.errorSampling < 0 || s.errorSampling > 1))
|
|
316
|
+
throw new de(S.INVALID_ERROR_SAMPLING_RATE, "config");
|
|
317
|
+
if (s.samplingRate !== void 0 && (typeof s.samplingRate != "number" || s.samplingRate < 0 || s.samplingRate > 1))
|
|
318
|
+
throw new de(S.INVALID_SAMPLING_RATE, "config");
|
|
319
|
+
if (s.primaryScrollSelector !== void 0) {
|
|
320
|
+
if (typeof s.primaryScrollSelector != "string" || !s.primaryScrollSelector.trim())
|
|
321
|
+
throw new w(S.INVALID_PRIMARY_SCROLL_SELECTOR, "config");
|
|
322
|
+
if (s.primaryScrollSelector !== "window")
|
|
308
323
|
try {
|
|
309
|
-
document.querySelector(
|
|
324
|
+
document.querySelector(s.primaryScrollSelector);
|
|
310
325
|
} catch {
|
|
311
|
-
throw new
|
|
312
|
-
`${S.INVALID_PRIMARY_SCROLL_SELECTOR_SYNTAX}: "${
|
|
326
|
+
throw new w(
|
|
327
|
+
`${S.INVALID_PRIMARY_SCROLL_SELECTOR_SYNTAX}: "${s.primaryScrollSelector}"`,
|
|
313
328
|
"config"
|
|
314
329
|
);
|
|
315
330
|
}
|
|
316
331
|
}
|
|
317
332
|
}
|
|
318
|
-
},
|
|
319
|
-
if (
|
|
320
|
-
if (
|
|
333
|
+
}, rt = (s) => {
|
|
334
|
+
if (s) {
|
|
335
|
+
if (s.tracelog && (!s.tracelog.projectId || typeof s.tracelog.projectId != "string" || s.tracelog.projectId.trim() === ""))
|
|
321
336
|
throw new v(S.INVALID_TRACELOG_PROJECT_ID, "config");
|
|
322
|
-
if (
|
|
323
|
-
if (!
|
|
337
|
+
if (s.custom) {
|
|
338
|
+
if (!s.custom.collectApiUrl || typeof s.custom.collectApiUrl != "string" || s.custom.collectApiUrl.trim() === "")
|
|
324
339
|
throw new v(S.INVALID_CUSTOM_API_URL, "config");
|
|
325
|
-
if (
|
|
340
|
+
if (s.custom.allowHttp !== void 0 && typeof s.custom.allowHttp != "boolean")
|
|
326
341
|
throw new v("allowHttp must be a boolean", "config");
|
|
327
|
-
const e =
|
|
342
|
+
const e = s.custom.collectApiUrl.trim();
|
|
328
343
|
if (!e.startsWith("http://") && !e.startsWith("https://"))
|
|
329
344
|
throw new v('Custom API URL must start with "http://" or "https://"', "config");
|
|
330
|
-
if (!(
|
|
345
|
+
if (!(s.custom.allowHttp ?? !1) && e.startsWith("http://"))
|
|
331
346
|
throw new v(
|
|
332
347
|
"Custom API URL must use HTTPS in production. Set allowHttp: true in integration config to allow HTTP (not recommended)",
|
|
333
348
|
"config"
|
|
334
349
|
);
|
|
335
350
|
}
|
|
336
|
-
if (
|
|
337
|
-
if (!
|
|
351
|
+
if (s.googleAnalytics) {
|
|
352
|
+
if (!s.googleAnalytics.measurementId || typeof s.googleAnalytics.measurementId != "string" || s.googleAnalytics.measurementId.trim() === "")
|
|
338
353
|
throw new v(S.INVALID_GOOGLE_ANALYTICS_ID, "config");
|
|
339
|
-
if (!
|
|
354
|
+
if (!s.googleAnalytics.measurementId.trim().match(/^(G-|UA-)/))
|
|
340
355
|
throw new v('Google Analytics measurement ID must start with "G-" or "UA-"', "config");
|
|
341
356
|
}
|
|
342
357
|
}
|
|
343
|
-
},
|
|
344
|
-
|
|
358
|
+
}, st = (s) => {
|
|
359
|
+
tt(s);
|
|
345
360
|
const e = {
|
|
346
|
-
...
|
|
347
|
-
sessionTimeout:
|
|
348
|
-
globalMetadata:
|
|
349
|
-
sensitiveQueryParams:
|
|
350
|
-
errorSampling:
|
|
351
|
-
samplingRate:
|
|
361
|
+
...s ?? {},
|
|
362
|
+
sessionTimeout: s?.sessionTimeout ?? 9e5,
|
|
363
|
+
globalMetadata: s?.globalMetadata ?? {},
|
|
364
|
+
sensitiveQueryParams: s?.sensitiveQueryParams ?? [],
|
|
365
|
+
errorSampling: s?.errorSampling ?? Ae,
|
|
366
|
+
samplingRate: s?.samplingRate ?? 1
|
|
352
367
|
};
|
|
353
368
|
return e.integrations?.custom && (e.integrations.custom = {
|
|
354
369
|
...e.integrations.custom,
|
|
355
370
|
allowHttp: e.integrations.custom.allowHttp ?? !1
|
|
356
371
|
}), e;
|
|
357
|
-
},
|
|
358
|
-
if (typeof
|
|
372
|
+
}, nt = (s) => {
|
|
373
|
+
if (typeof s == "string")
|
|
359
374
|
return !0;
|
|
360
|
-
if (typeof
|
|
361
|
-
const e = Object.entries(
|
|
375
|
+
if (typeof s == "object" && s !== null && !Array.isArray(s)) {
|
|
376
|
+
const e = Object.entries(s);
|
|
362
377
|
if (e.length > 20)
|
|
363
378
|
return !1;
|
|
364
379
|
for (const [, t] of e) {
|
|
365
380
|
if (t == null)
|
|
366
381
|
continue;
|
|
367
|
-
const
|
|
368
|
-
if (
|
|
382
|
+
const r = typeof t;
|
|
383
|
+
if (r !== "string" && r !== "number" && r !== "boolean")
|
|
369
384
|
return !1;
|
|
370
385
|
}
|
|
371
386
|
return !0;
|
|
372
387
|
}
|
|
373
388
|
return !1;
|
|
374
|
-
}, we = (
|
|
375
|
-
if (typeof
|
|
389
|
+
}, we = (s, e = 0) => {
|
|
390
|
+
if (typeof s != "object" || s === null || e > 1)
|
|
376
391
|
return !1;
|
|
377
|
-
for (const t of Object.values(
|
|
392
|
+
for (const t of Object.values(s)) {
|
|
378
393
|
if (t == null)
|
|
379
394
|
continue;
|
|
380
|
-
const
|
|
381
|
-
if (!(
|
|
395
|
+
const r = typeof t;
|
|
396
|
+
if (!(r === "string" || r === "number" || r === "boolean")) {
|
|
382
397
|
if (Array.isArray(t)) {
|
|
383
398
|
if (t.length === 0)
|
|
384
399
|
continue;
|
|
385
400
|
if (typeof t[0] == "string") {
|
|
386
401
|
if (!t.every((a) => typeof a == "string"))
|
|
387
402
|
return !1;
|
|
388
|
-
} else if (!t.every((a) =>
|
|
403
|
+
} else if (!t.every((a) => nt(a)))
|
|
389
404
|
return !1;
|
|
390
405
|
continue;
|
|
391
406
|
}
|
|
392
|
-
if (
|
|
407
|
+
if (r === "object" && e === 0) {
|
|
393
408
|
if (!we(t, e + 1))
|
|
394
409
|
return !1;
|
|
395
410
|
continue;
|
|
@@ -398,31 +413,31 @@ const Ve = () => {
|
|
|
398
413
|
}
|
|
399
414
|
}
|
|
400
415
|
return !0;
|
|
401
|
-
},
|
|
416
|
+
}, it = (s) => typeof s != "string" ? {
|
|
402
417
|
valid: !1,
|
|
403
418
|
error: "Event name must be a string"
|
|
404
|
-
} :
|
|
419
|
+
} : s.length === 0 ? {
|
|
405
420
|
valid: !1,
|
|
406
421
|
error: "Event name cannot be empty"
|
|
407
|
-
} :
|
|
422
|
+
} : s.length > 120 ? {
|
|
408
423
|
valid: !1,
|
|
409
424
|
error: "Event name is too long (max 120 characters)"
|
|
410
|
-
} :
|
|
425
|
+
} : s.includes("<") || s.includes(">") || s.includes("&") ? {
|
|
411
426
|
valid: !1,
|
|
412
427
|
error: "Event name contains invalid characters"
|
|
413
|
-
} : ["constructor", "prototype", "__proto__", "eval", "function", "var", "let", "const"].includes(
|
|
428
|
+
} : ["constructor", "prototype", "__proto__", "eval", "function", "var", "let", "const"].includes(s.toLowerCase()) ? {
|
|
414
429
|
valid: !1,
|
|
415
430
|
error: "Event name cannot be a reserved word"
|
|
416
|
-
} : { valid: !0 },
|
|
417
|
-
const
|
|
418
|
-
if (!we(
|
|
431
|
+
} : { valid: !0 }, _e = (s, e, t) => {
|
|
432
|
+
const r = et(e), n = `${t} "${s}" metadata error`;
|
|
433
|
+
if (!we(r))
|
|
419
434
|
return {
|
|
420
435
|
valid: !1,
|
|
421
436
|
error: `${n}: object has invalid types. Valid types are string, number, boolean or string arrays.`
|
|
422
437
|
};
|
|
423
438
|
let i;
|
|
424
439
|
try {
|
|
425
|
-
i = JSON.stringify(
|
|
440
|
+
i = JSON.stringify(r);
|
|
426
441
|
} catch {
|
|
427
442
|
return {
|
|
428
443
|
valid: !1,
|
|
@@ -434,12 +449,12 @@ const Ve = () => {
|
|
|
434
449
|
valid: !1,
|
|
435
450
|
error: `${n}: object is too large (max ${8192 / 1024} KB).`
|
|
436
451
|
};
|
|
437
|
-
if (Object.keys(
|
|
452
|
+
if (Object.keys(r).length > 10)
|
|
438
453
|
return {
|
|
439
454
|
valid: !1,
|
|
440
455
|
error: `${n}: object has too many keys (max 10 keys).`
|
|
441
456
|
};
|
|
442
|
-
for (const [o, c] of Object.entries(
|
|
457
|
+
for (const [o, c] of Object.entries(r)) {
|
|
443
458
|
if (Array.isArray(c)) {
|
|
444
459
|
if (c.length > 10)
|
|
445
460
|
return {
|
|
@@ -461,11 +476,11 @@ const Ve = () => {
|
|
|
461
476
|
}
|
|
462
477
|
return {
|
|
463
478
|
valid: !0,
|
|
464
|
-
sanitizedMetadata:
|
|
479
|
+
sanitizedMetadata: r
|
|
465
480
|
};
|
|
466
|
-
},
|
|
481
|
+
}, at = (s, e, t) => {
|
|
467
482
|
if (Array.isArray(e)) {
|
|
468
|
-
const
|
|
483
|
+
const r = [], n = `${t} "${s}" metadata error`;
|
|
469
484
|
for (let i = 0; i < e.length; i++) {
|
|
470
485
|
const a = e[i];
|
|
471
486
|
if (typeof a != "object" || a === null || Array.isArray(a))
|
|
@@ -473,53 +488,53 @@ const Ve = () => {
|
|
|
473
488
|
valid: !1,
|
|
474
489
|
error: `${n}: array item at index ${i} must be an object.`
|
|
475
490
|
};
|
|
476
|
-
const o =
|
|
491
|
+
const o = _e(s, a, t);
|
|
477
492
|
if (!o.valid)
|
|
478
493
|
return {
|
|
479
494
|
valid: !1,
|
|
480
495
|
error: `${n}: array item at index ${i} is invalid: ${o.error}`
|
|
481
496
|
};
|
|
482
|
-
o.sanitizedMetadata &&
|
|
497
|
+
o.sanitizedMetadata && r.push(o.sanitizedMetadata);
|
|
483
498
|
}
|
|
484
499
|
return {
|
|
485
500
|
valid: !0,
|
|
486
|
-
sanitizedMetadata:
|
|
501
|
+
sanitizedMetadata: r
|
|
487
502
|
};
|
|
488
503
|
}
|
|
489
|
-
return
|
|
490
|
-
},
|
|
491
|
-
const t =
|
|
504
|
+
return _e(s, e, t);
|
|
505
|
+
}, ot = (s, e) => {
|
|
506
|
+
const t = it(s);
|
|
492
507
|
if (!t.valid)
|
|
493
508
|
return l("error", "Event name validation failed", {
|
|
494
509
|
showToClient: !0,
|
|
495
|
-
data: { eventName:
|
|
510
|
+
data: { eventName: s, error: t.error }
|
|
496
511
|
}), t;
|
|
497
512
|
if (!e)
|
|
498
513
|
return { valid: !0 };
|
|
499
|
-
const
|
|
500
|
-
return
|
|
514
|
+
const r = at(s, e, "customEvent");
|
|
515
|
+
return r.valid || l("error", "Event metadata validation failed", {
|
|
501
516
|
showToClient: !0,
|
|
502
517
|
data: {
|
|
503
|
-
eventName:
|
|
504
|
-
error:
|
|
518
|
+
eventName: s,
|
|
519
|
+
error: r.error
|
|
505
520
|
}
|
|
506
|
-
}),
|
|
521
|
+
}), r;
|
|
507
522
|
};
|
|
508
|
-
class
|
|
523
|
+
class lt {
|
|
509
524
|
listeners = /* @__PURE__ */ new Map();
|
|
510
525
|
on(e, t) {
|
|
511
526
|
this.listeners.has(e) || this.listeners.set(e, []), this.listeners.get(e).push(t);
|
|
512
527
|
}
|
|
513
528
|
off(e, t) {
|
|
514
|
-
const
|
|
515
|
-
if (
|
|
516
|
-
const n =
|
|
517
|
-
n > -1 &&
|
|
529
|
+
const r = this.listeners.get(e);
|
|
530
|
+
if (r) {
|
|
531
|
+
const n = r.indexOf(t);
|
|
532
|
+
n > -1 && r.splice(n, 1);
|
|
518
533
|
}
|
|
519
534
|
}
|
|
520
535
|
emit(e, t) {
|
|
521
|
-
const
|
|
522
|
-
|
|
536
|
+
const r = this.listeners.get(e);
|
|
537
|
+
r && r.forEach((n) => {
|
|
523
538
|
n(t);
|
|
524
539
|
});
|
|
525
540
|
}
|
|
@@ -539,7 +554,7 @@ class g {
|
|
|
539
554
|
return { ...j };
|
|
540
555
|
}
|
|
541
556
|
}
|
|
542
|
-
class
|
|
557
|
+
class ct extends g {
|
|
543
558
|
storeManager;
|
|
544
559
|
lastPermanentErrorLog = null;
|
|
545
560
|
constructor(e) {
|
|
@@ -547,7 +562,7 @@ class lt extends g {
|
|
|
547
562
|
}
|
|
548
563
|
getQueueStorageKey() {
|
|
549
564
|
const e = this.get("userId") || "anonymous";
|
|
550
|
-
return
|
|
565
|
+
return ze(e);
|
|
551
566
|
}
|
|
552
567
|
sendEventsQueueSync(e) {
|
|
553
568
|
return this.shouldSkipSend() ? !0 : this.get("config")?.integrations?.custom?.collectApiUrl === Y.Fail ? (l("warn", "Fail mode: simulating network failure (sync)", {
|
|
@@ -556,10 +571,10 @@ class lt extends g {
|
|
|
556
571
|
}
|
|
557
572
|
async sendEventsQueue(e, t) {
|
|
558
573
|
try {
|
|
559
|
-
const
|
|
560
|
-
return
|
|
561
|
-
} catch (
|
|
562
|
-
return
|
|
574
|
+
const r = await this.send(e);
|
|
575
|
+
return r ? (this.clearPersistedEvents(), t?.onSuccess?.(e.events.length, e.events, e)) : (this.persistEvents(e), t?.onFailure?.()), r;
|
|
576
|
+
} catch (r) {
|
|
577
|
+
return r instanceof M ? (this.logPermanentError("Permanent error, not retrying", r), this.clearPersistedEvents(), t?.onFailure?.(), !1) : (this.persistEvents(e), t?.onFailure?.(), !1);
|
|
563
578
|
}
|
|
564
579
|
}
|
|
565
580
|
async recoverPersistedEvents(e) {
|
|
@@ -569,10 +584,10 @@ class lt extends g {
|
|
|
569
584
|
this.clearPersistedEvents();
|
|
570
585
|
return;
|
|
571
586
|
}
|
|
572
|
-
const
|
|
573
|
-
await this.send(
|
|
587
|
+
const r = this.createRecoveryBody(t);
|
|
588
|
+
await this.send(r) ? (this.clearPersistedEvents(), e?.onSuccess?.(t.events.length, t.events, r)) : e?.onFailure?.();
|
|
574
589
|
} catch (t) {
|
|
575
|
-
if (t instanceof
|
|
590
|
+
if (t instanceof M) {
|
|
576
591
|
this.logPermanentError("Permanent error during recovery, clearing persisted events", t), this.clearPersistedEvents(), e?.onFailure?.();
|
|
577
592
|
return;
|
|
578
593
|
}
|
|
@@ -588,24 +603,24 @@ class lt extends g {
|
|
|
588
603
|
return l("warn", "Fail mode: simulating network failure", {
|
|
589
604
|
data: { events: e.events.length }
|
|
590
605
|
}), !1;
|
|
591
|
-
const { url:
|
|
606
|
+
const { url: r, payload: n } = this.prepareRequest(e);
|
|
592
607
|
try {
|
|
593
|
-
return (await this.sendWithTimeout(
|
|
608
|
+
return (await this.sendWithTimeout(r, n)).ok;
|
|
594
609
|
} catch (i) {
|
|
595
|
-
if (i instanceof
|
|
610
|
+
if (i instanceof M)
|
|
596
611
|
throw i;
|
|
597
612
|
return l("error", "Send request failed", {
|
|
598
613
|
error: i,
|
|
599
614
|
data: {
|
|
600
615
|
events: e.events.length,
|
|
601
|
-
url:
|
|
616
|
+
url: r.replace(/\/\/[^/]+/, "//[DOMAIN]")
|
|
602
617
|
}
|
|
603
618
|
}), !1;
|
|
604
619
|
}
|
|
605
620
|
}
|
|
606
621
|
async sendWithTimeout(e, t) {
|
|
607
|
-
const
|
|
608
|
-
|
|
622
|
+
const r = new AbortController(), n = setTimeout(() => {
|
|
623
|
+
r.abort();
|
|
609
624
|
}, 1e4);
|
|
610
625
|
try {
|
|
611
626
|
const i = await fetch(e, {
|
|
@@ -613,20 +628,20 @@ class lt extends g {
|
|
|
613
628
|
body: t,
|
|
614
629
|
keepalive: !0,
|
|
615
630
|
credentials: "include",
|
|
616
|
-
signal:
|
|
631
|
+
signal: r.signal,
|
|
617
632
|
headers: {
|
|
618
633
|
"Content-Type": "application/json"
|
|
619
634
|
}
|
|
620
635
|
});
|
|
621
636
|
if (!i.ok)
|
|
622
|
-
throw i.status >= 400 && i.status < 500 ? new
|
|
637
|
+
throw i.status >= 400 && i.status < 500 ? new M(`HTTP ${i.status}: ${i.statusText}`, i.status) : new Error(`HTTP ${i.status}: ${i.statusText}`);
|
|
623
638
|
return i;
|
|
624
639
|
} finally {
|
|
625
640
|
clearTimeout(n);
|
|
626
641
|
}
|
|
627
642
|
}
|
|
628
643
|
sendQueueSyncInternal(e) {
|
|
629
|
-
const { url: t, payload:
|
|
644
|
+
const { url: t, payload: r } = this.prepareRequest(e), n = new Blob([r], { type: "application/json" });
|
|
630
645
|
if (!this.isSendBeaconAvailable())
|
|
631
646
|
return l("warn", "sendBeacon not available, persisting events for recovery"), this.persistEvents(e), !1;
|
|
632
647
|
const i = navigator.sendBeacon(t, n);
|
|
@@ -676,8 +691,8 @@ class lt extends g {
|
|
|
676
691
|
events: e.events,
|
|
677
692
|
timestamp: Date.now(),
|
|
678
693
|
...e.global_metadata && { global_metadata: e.global_metadata }
|
|
679
|
-
},
|
|
680
|
-
return this.storeManager.setItem(
|
|
694
|
+
}, r = this.getQueueStorageKey();
|
|
695
|
+
return this.storeManager.setItem(r, JSON.stringify(t)), !!this.storeManager.getItem(r);
|
|
681
696
|
} catch (t) {
|
|
682
697
|
return l("warn", "Failed to persist events", { error: t }), !1;
|
|
683
698
|
}
|
|
@@ -701,13 +716,13 @@ class lt extends g {
|
|
|
701
716
|
return typeof navigator < "u" && typeof navigator.sendBeacon == "function";
|
|
702
717
|
}
|
|
703
718
|
logPermanentError(e, t) {
|
|
704
|
-
const
|
|
705
|
-
(!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode ||
|
|
719
|
+
const r = Date.now();
|
|
720
|
+
(!this.lastPermanentErrorLog || this.lastPermanentErrorLog.statusCode !== t.statusCode || r - this.lastPermanentErrorLog.timestamp >= We) && (l("error", e, {
|
|
706
721
|
data: { status: t.statusCode, message: t.message }
|
|
707
|
-
}), this.lastPermanentErrorLog = { statusCode: t.statusCode, timestamp:
|
|
722
|
+
}), this.lastPermanentErrorLog = { statusCode: t.statusCode, timestamp: r });
|
|
708
723
|
}
|
|
709
724
|
}
|
|
710
|
-
class
|
|
725
|
+
class ut extends g {
|
|
711
726
|
googleAnalytics;
|
|
712
727
|
dataSender;
|
|
713
728
|
emitter;
|
|
@@ -718,15 +733,15 @@ class ct extends g {
|
|
|
718
733
|
sendIntervalId = null;
|
|
719
734
|
rateLimitCounter = 0;
|
|
720
735
|
rateLimitWindowStart = 0;
|
|
721
|
-
constructor(e, t = null,
|
|
722
|
-
super(), this.googleAnalytics = t, this.dataSender = new
|
|
736
|
+
constructor(e, t = null, r = null) {
|
|
737
|
+
super(), this.googleAnalytics = t, this.dataSender = new ct(e), this.emitter = r;
|
|
723
738
|
}
|
|
724
739
|
async recoverPersistedEvents() {
|
|
725
740
|
await this.dataSender.recoverPersistedEvents({
|
|
726
|
-
onSuccess: (e, t,
|
|
741
|
+
onSuccess: (e, t, r) => {
|
|
727
742
|
if (t && t.length > 0) {
|
|
728
743
|
const n = t.map((i) => i.id);
|
|
729
|
-
this.removeProcessedEvents(n),
|
|
744
|
+
this.removeProcessedEvents(n), r && this.emitEventsQueue(r);
|
|
730
745
|
}
|
|
731
746
|
},
|
|
732
747
|
onFailure: () => {
|
|
@@ -737,7 +752,7 @@ class ct extends g {
|
|
|
737
752
|
track({
|
|
738
753
|
type: e,
|
|
739
754
|
page_url: t,
|
|
740
|
-
from_page_url:
|
|
755
|
+
from_page_url: r,
|
|
741
756
|
scroll_data: n,
|
|
742
757
|
click_data: i,
|
|
743
758
|
custom_event: a,
|
|
@@ -755,7 +770,7 @@ class ct extends g {
|
|
|
755
770
|
})), this.pendingEventsBuffer.push({
|
|
756
771
|
type: e,
|
|
757
772
|
page_url: t,
|
|
758
|
-
from_page_url:
|
|
773
|
+
from_page_url: r,
|
|
759
774
|
scroll_data: n,
|
|
760
775
|
click_data: i,
|
|
761
776
|
custom_event: a,
|
|
@@ -768,10 +783,10 @@ class ct extends g {
|
|
|
768
783
|
const f = e === d.SESSION_START || e === d.SESSION_END;
|
|
769
784
|
if (!f && !this.checkRateLimit())
|
|
770
785
|
return;
|
|
771
|
-
const _ = e,
|
|
786
|
+
const _ = e, D = _ === d.SESSION_START, Q = t || this.get("pageUrl"), B = this.buildEventPayload({
|
|
772
787
|
type: _,
|
|
773
788
|
page_url: Q,
|
|
774
|
-
from_page_url:
|
|
789
|
+
from_page_url: r,
|
|
775
790
|
scroll_data: n,
|
|
776
791
|
click_data: i,
|
|
777
792
|
custom_event: a,
|
|
@@ -780,22 +795,22 @@ class ct extends g {
|
|
|
780
795
|
session_end_reason: u
|
|
781
796
|
});
|
|
782
797
|
if (!(!f && !this.shouldSample())) {
|
|
783
|
-
if (
|
|
784
|
-
const
|
|
785
|
-
if (!
|
|
798
|
+
if (D) {
|
|
799
|
+
const ue = this.get("sessionId");
|
|
800
|
+
if (!ue) {
|
|
786
801
|
l("error", "Session start event requires sessionId - event will be ignored");
|
|
787
802
|
return;
|
|
788
803
|
}
|
|
789
804
|
if (this.get("hasStartSession")) {
|
|
790
805
|
l("warn", "Duplicate session_start detected", {
|
|
791
|
-
data: { sessionId:
|
|
806
|
+
data: { sessionId: ue }
|
|
792
807
|
});
|
|
793
808
|
return;
|
|
794
809
|
}
|
|
795
810
|
this.set("hasStartSession", !0);
|
|
796
811
|
}
|
|
797
812
|
if (!this.isDuplicateEvent(B)) {
|
|
798
|
-
if (this.get("mode") ===
|
|
813
|
+
if (this.get("mode") === C.QA && _ === d.CUSTOM && a) {
|
|
799
814
|
console.log("[TraceLog] Event", {
|
|
800
815
|
name: a.name,
|
|
801
816
|
...a.metadata && { metadata: a.metadata }
|
|
@@ -828,8 +843,8 @@ class ct extends g {
|
|
|
828
843
|
return;
|
|
829
844
|
}
|
|
830
845
|
const t = [...this.pendingEventsBuffer];
|
|
831
|
-
this.pendingEventsBuffer = [], t.forEach((
|
|
832
|
-
this.track(
|
|
846
|
+
this.pendingEventsBuffer = [], t.forEach((r) => {
|
|
847
|
+
this.track(r);
|
|
833
848
|
});
|
|
834
849
|
}
|
|
835
850
|
clearSendInterval() {
|
|
@@ -838,7 +853,7 @@ class ct extends g {
|
|
|
838
853
|
flushEvents(e) {
|
|
839
854
|
if (this.eventsQueue.length === 0)
|
|
840
855
|
return e ? !0 : Promise.resolve(!0);
|
|
841
|
-
const t = this.buildEventsPayload(),
|
|
856
|
+
const t = this.buildEventsPayload(), r = [...this.eventsQueue], n = r.map((i) => i.id);
|
|
842
857
|
if (e) {
|
|
843
858
|
const i = this.dataSender.sendEventsQueueSync(t);
|
|
844
859
|
return i && (this.removeProcessedEvents(n), this.clearSendInterval(), this.emitEventsQueue(t)), i;
|
|
@@ -849,7 +864,7 @@ class ct extends g {
|
|
|
849
864
|
},
|
|
850
865
|
onFailure: () => {
|
|
851
866
|
l("warn", "Async flush failed", {
|
|
852
|
-
data: { eventCount:
|
|
867
|
+
data: { eventCount: r.length }
|
|
853
868
|
});
|
|
854
869
|
}
|
|
855
870
|
});
|
|
@@ -857,10 +872,10 @@ class ct extends g {
|
|
|
857
872
|
async sendEventsQueue() {
|
|
858
873
|
if (!this.get("sessionId") || this.eventsQueue.length === 0)
|
|
859
874
|
return;
|
|
860
|
-
const e = this.buildEventsPayload(), t = [...this.eventsQueue],
|
|
875
|
+
const e = this.buildEventsPayload(), t = [...this.eventsQueue], r = t.map((n) => n.id);
|
|
861
876
|
await this.dataSender.sendEventsQueue(e, {
|
|
862
877
|
onSuccess: () => {
|
|
863
|
-
this.removeProcessedEvents(
|
|
878
|
+
this.removeProcessedEvents(r), this.emitEventsQueue(e);
|
|
864
879
|
},
|
|
865
880
|
onFailure: () => {
|
|
866
881
|
l("warn", "Events send failed, keeping in queue", {
|
|
@@ -875,21 +890,21 @@ class ct extends g {
|
|
|
875
890
|
const i = this.createEventSignature(n);
|
|
876
891
|
e.has(i) || t.push(i), e.set(i, n);
|
|
877
892
|
}
|
|
878
|
-
const
|
|
893
|
+
const r = t.map((n) => e.get(n)).filter((n) => !!n).sort((n, i) => n.timestamp - i.timestamp);
|
|
879
894
|
return {
|
|
880
895
|
user_id: this.get("userId"),
|
|
881
896
|
session_id: this.get("sessionId"),
|
|
882
897
|
device: this.get("device"),
|
|
883
|
-
events:
|
|
898
|
+
events: r,
|
|
884
899
|
...this.get("config")?.globalMetadata && { global_metadata: this.get("config")?.globalMetadata }
|
|
885
900
|
};
|
|
886
901
|
}
|
|
887
902
|
buildEventPayload(e) {
|
|
888
|
-
const t = e.type === d.SESSION_START,
|
|
903
|
+
const t = e.type === d.SESSION_START, r = e.page_url ?? this.get("pageUrl");
|
|
889
904
|
return {
|
|
890
|
-
id:
|
|
905
|
+
id: Je(),
|
|
891
906
|
type: e.type,
|
|
892
|
-
page_url:
|
|
907
|
+
page_url: r,
|
|
893
908
|
timestamp: Date.now(),
|
|
894
909
|
...t && { referrer: document.referrer || "Direct" },
|
|
895
910
|
...e.from_page_url && { from_page_url: e.from_page_url },
|
|
@@ -899,18 +914,18 @@ class ct extends g {
|
|
|
899
914
|
...e.web_vitals && { web_vitals: e.web_vitals },
|
|
900
915
|
...e.error_data && { error_data: e.error_data },
|
|
901
916
|
...e.session_end_reason && { session_end_reason: e.session_end_reason },
|
|
902
|
-
...t &&
|
|
917
|
+
...t && Ee() && { utm: Ee() }
|
|
903
918
|
};
|
|
904
919
|
}
|
|
905
920
|
isDuplicateEvent(e) {
|
|
906
|
-
const t = Date.now(),
|
|
907
|
-
return this.lastEventFingerprint ===
|
|
921
|
+
const t = Date.now(), r = this.createEventFingerprint(e);
|
|
922
|
+
return this.lastEventFingerprint === r && t - this.lastEventTime < 500 ? !0 : (this.lastEventFingerprint = r, this.lastEventTime = t, !1);
|
|
908
923
|
}
|
|
909
924
|
createEventFingerprint(e) {
|
|
910
925
|
let t = `${e.type}_${e.page_url}`;
|
|
911
926
|
if (e.click_data) {
|
|
912
|
-
const
|
|
913
|
-
t += `_click_${
|
|
927
|
+
const r = Math.round((e.click_data.x || 0) / 10) * 10, n = Math.round((e.click_data.y || 0) / 10) * 10;
|
|
928
|
+
t += `_click_${r}_${n}`;
|
|
914
929
|
}
|
|
915
930
|
return e.scroll_data && (t += `_scroll_${e.scroll_data.depth}_${e.scroll_data.direction}`), e.custom_event && (t += `_custom_${e.custom_event.name}`), e.web_vitals && (t += `_vitals_${e.web_vitals.type}`), e.error_data && (t += `_error_${e.error_data.type}_${e.error_data.message}`), t;
|
|
916
931
|
}
|
|
@@ -921,13 +936,13 @@ class ct extends g {
|
|
|
921
936
|
if (this.eventsQueue.push(e), this.emitEvent(e), this.eventsQueue.length > 100) {
|
|
922
937
|
const t = this.eventsQueue.findIndex(
|
|
923
938
|
(n) => n.type !== d.SESSION_START && n.type !== d.SESSION_END
|
|
924
|
-
),
|
|
939
|
+
), r = t >= 0 ? this.eventsQueue.splice(t, 1)[0] : this.eventsQueue.shift();
|
|
925
940
|
l("warn", "Event queue overflow, oldest non-critical event removed", {
|
|
926
941
|
data: {
|
|
927
942
|
maxLength: 100,
|
|
928
943
|
currentLength: this.eventsQueue.length,
|
|
929
|
-
removedEventType:
|
|
930
|
-
wasCritical:
|
|
944
|
+
removedEventType: r?.type,
|
|
945
|
+
wasCritical: r?.type === d.SESSION_START || r?.type === d.SESSION_END
|
|
931
946
|
}
|
|
932
947
|
});
|
|
933
948
|
}
|
|
@@ -940,7 +955,7 @@ class ct extends g {
|
|
|
940
955
|
}
|
|
941
956
|
handleGoogleAnalyticsIntegration(e) {
|
|
942
957
|
if (this.googleAnalytics && e.type === d.CUSTOM && e.custom_event) {
|
|
943
|
-
if (this.get("mode") ===
|
|
958
|
+
if (this.get("mode") === C.QA)
|
|
944
959
|
return;
|
|
945
960
|
this.googleAnalytics.trackEvent(e.custom_event.name, e.custom_event.metadata ?? {});
|
|
946
961
|
}
|
|
@@ -955,7 +970,7 @@ class ct extends g {
|
|
|
955
970
|
}
|
|
956
971
|
removeProcessedEvents(e) {
|
|
957
972
|
const t = new Set(e);
|
|
958
|
-
this.eventsQueue = this.eventsQueue.filter((
|
|
973
|
+
this.eventsQueue = this.eventsQueue.filter((r) => !t.has(r.id));
|
|
959
974
|
}
|
|
960
975
|
emitEvent(e) {
|
|
961
976
|
this.emitter && this.emitter.emit(K.EVENT, e);
|
|
@@ -964,7 +979,7 @@ class ct extends g {
|
|
|
964
979
|
this.emitter && this.emitter.emit(K.QUEUE, e);
|
|
965
980
|
}
|
|
966
981
|
}
|
|
967
|
-
class
|
|
982
|
+
class dt {
|
|
968
983
|
/**
|
|
969
984
|
* Gets or creates a unique user ID for the given project.
|
|
970
985
|
* The user ID is persisted in localStorage and reused across sessions.
|
|
@@ -974,14 +989,14 @@ class ut {
|
|
|
974
989
|
* @returns Persistent unique user ID
|
|
975
990
|
*/
|
|
976
991
|
static getId(e) {
|
|
977
|
-
const t =
|
|
978
|
-
if (
|
|
979
|
-
return
|
|
980
|
-
const n =
|
|
992
|
+
const t = $e, r = e.getItem(t);
|
|
993
|
+
if (r)
|
|
994
|
+
return r;
|
|
995
|
+
const n = qe();
|
|
981
996
|
return e.setItem(t, n), n;
|
|
982
997
|
}
|
|
983
998
|
}
|
|
984
|
-
class
|
|
999
|
+
class ht extends g {
|
|
985
1000
|
storageManager;
|
|
986
1001
|
eventManager;
|
|
987
1002
|
projectId;
|
|
@@ -991,8 +1006,8 @@ class dt extends g {
|
|
|
991
1006
|
visibilityChangeHandler = null;
|
|
992
1007
|
beforeUnloadHandler = null;
|
|
993
1008
|
isTracking = !1;
|
|
994
|
-
constructor(e, t,
|
|
995
|
-
super(), this.storageManager = e, this.eventManager = t, this.projectId =
|
|
1009
|
+
constructor(e, t, r) {
|
|
1010
|
+
super(), this.storageManager = e, this.eventManager = t, this.projectId = r;
|
|
996
1011
|
}
|
|
997
1012
|
initCrossTabSync() {
|
|
998
1013
|
if (typeof BroadcastChannel > "u") {
|
|
@@ -1000,10 +1015,10 @@ class dt extends g {
|
|
|
1000
1015
|
return;
|
|
1001
1016
|
}
|
|
1002
1017
|
const e = this.getProjectId();
|
|
1003
|
-
this.broadcastChannel = new BroadcastChannel(
|
|
1004
|
-
const { action:
|
|
1018
|
+
this.broadcastChannel = new BroadcastChannel(Be(e)), this.broadcastChannel.onmessage = (t) => {
|
|
1019
|
+
const { action: r, sessionId: n, timestamp: i, projectId: a } = t.data ?? {};
|
|
1005
1020
|
if (a === e) {
|
|
1006
|
-
if (
|
|
1021
|
+
if (r === "session_end") {
|
|
1007
1022
|
this.resetSessionState();
|
|
1008
1023
|
return;
|
|
1009
1024
|
}
|
|
@@ -1029,8 +1044,8 @@ class dt extends g {
|
|
|
1029
1044
|
reason: t,
|
|
1030
1045
|
timestamp: Date.now()
|
|
1031
1046
|
});
|
|
1032
|
-
} catch (
|
|
1033
|
-
l("warn", "Failed to broadcast session end", { error:
|
|
1047
|
+
} catch (r) {
|
|
1048
|
+
l("warn", "Failed to broadcast session end", { error: r, data: { sessionId: e, reason: t } });
|
|
1034
1049
|
}
|
|
1035
1050
|
}
|
|
1036
1051
|
cleanupCrossTabSync() {
|
|
@@ -1058,8 +1073,8 @@ class dt extends g {
|
|
|
1058
1073
|
if (!t)
|
|
1059
1074
|
return null;
|
|
1060
1075
|
try {
|
|
1061
|
-
const
|
|
1062
|
-
return !
|
|
1076
|
+
const r = JSON.parse(t);
|
|
1077
|
+
return !r.id || typeof r.lastActivity != "number" ? null : r;
|
|
1063
1078
|
} catch {
|
|
1064
1079
|
return this.storageManager.removeItem(e), null;
|
|
1065
1080
|
}
|
|
@@ -1069,7 +1084,7 @@ class dt extends g {
|
|
|
1069
1084
|
this.storageManager.setItem(t, JSON.stringify(e));
|
|
1070
1085
|
}
|
|
1071
1086
|
getSessionStorageKey() {
|
|
1072
|
-
return
|
|
1087
|
+
return Qe(this.getProjectId());
|
|
1073
1088
|
}
|
|
1074
1089
|
getProjectId() {
|
|
1075
1090
|
return this.projectId;
|
|
@@ -1079,10 +1094,10 @@ class dt extends g {
|
|
|
1079
1094
|
l("warn", "Session tracking already active");
|
|
1080
1095
|
return;
|
|
1081
1096
|
}
|
|
1082
|
-
const e = this.recoverSession(), t = e ?? this.generateSessionId(),
|
|
1097
|
+
const e = this.recoverSession(), t = e ?? this.generateSessionId(), r = !!e;
|
|
1083
1098
|
this.isTracking = !0;
|
|
1084
1099
|
try {
|
|
1085
|
-
this.set("sessionId", t), this.persistSession(t),
|
|
1100
|
+
this.set("sessionId", t), this.persistSession(t), r || this.eventManager.track({
|
|
1086
1101
|
type: d.SESSION_START
|
|
1087
1102
|
}), this.initCrossTabSync(), this.shareSession(t), this.setupSessionTimeout(), this.setupActivityListeners(), this.setupLifecycleListeners();
|
|
1088
1103
|
} catch (n) {
|
|
@@ -1148,7 +1163,7 @@ class dt extends g {
|
|
|
1148
1163
|
this.clearSessionTimeout(), this.cleanupActivityListeners(), this.cleanupCrossTabSync(), this.cleanupLifecycleListeners(), this.isTracking = !1, this.set("hasStartSession", !1);
|
|
1149
1164
|
}
|
|
1150
1165
|
}
|
|
1151
|
-
class
|
|
1166
|
+
class ft extends g {
|
|
1152
1167
|
eventManager;
|
|
1153
1168
|
storageManager;
|
|
1154
1169
|
sessionManager = null;
|
|
@@ -1167,8 +1182,8 @@ class ht extends g {
|
|
|
1167
1182
|
if (!t)
|
|
1168
1183
|
throw new Error("Cannot start session tracking: config not available");
|
|
1169
1184
|
try {
|
|
1170
|
-
this.sessionManager = new
|
|
1171
|
-
} catch (
|
|
1185
|
+
this.sessionManager = new ht(this.storageManager, this.eventManager, t), this.sessionManager.startTracking(), this.eventManager.flushPendingEvents();
|
|
1186
|
+
} catch (r) {
|
|
1172
1187
|
if (this.sessionManager) {
|
|
1173
1188
|
try {
|
|
1174
1189
|
this.sessionManager.destroy();
|
|
@@ -1176,7 +1191,7 @@ class ht extends g {
|
|
|
1176
1191
|
}
|
|
1177
1192
|
this.sessionManager = null;
|
|
1178
1193
|
}
|
|
1179
|
-
throw l("error", "Failed to start session tracking", { error:
|
|
1194
|
+
throw l("error", "Failed to start session tracking", { error: r }), r;
|
|
1180
1195
|
}
|
|
1181
1196
|
}
|
|
1182
1197
|
isActive() {
|
|
@@ -1192,7 +1207,7 @@ class ht extends g {
|
|
|
1192
1207
|
this.destroyed || (this.sessionManager && (this.sessionManager.destroy(), this.sessionManager = null), this.destroyed = !0, this.set("hasStartSession", !1));
|
|
1193
1208
|
}
|
|
1194
1209
|
}
|
|
1195
|
-
class
|
|
1210
|
+
class gt extends g {
|
|
1196
1211
|
eventManager;
|
|
1197
1212
|
onTrack;
|
|
1198
1213
|
originalPushState;
|
|
@@ -1208,8 +1223,8 @@ class ft extends g {
|
|
|
1208
1223
|
}
|
|
1209
1224
|
patchHistory(e) {
|
|
1210
1225
|
const t = window.history[e];
|
|
1211
|
-
e === "pushState" && !this.originalPushState ? this.originalPushState = t : e === "replaceState" && !this.originalReplaceState && (this.originalReplaceState = t), window.history[e] = (...
|
|
1212
|
-
t.apply(window.history,
|
|
1226
|
+
e === "pushState" && !this.originalPushState ? this.originalPushState = t : e === "replaceState" && !this.originalReplaceState && (this.originalReplaceState = t), window.history[e] = (...r) => {
|
|
1227
|
+
t.apply(window.history, r), this.trackCurrentPage();
|
|
1213
1228
|
};
|
|
1214
1229
|
}
|
|
1215
1230
|
trackCurrentPage = () => {
|
|
@@ -1217,13 +1232,13 @@ class ft extends g {
|
|
|
1217
1232
|
if (this.get("pageUrl") === t)
|
|
1218
1233
|
return;
|
|
1219
1234
|
this.onTrack();
|
|
1220
|
-
const
|
|
1235
|
+
const r = this.get("pageUrl");
|
|
1221
1236
|
this.set("pageUrl", t);
|
|
1222
1237
|
const n = this.extractPageViewData();
|
|
1223
1238
|
this.eventManager.track({
|
|
1224
1239
|
type: d.PAGE_VIEW,
|
|
1225
1240
|
page_url: this.get("pageUrl"),
|
|
1226
|
-
from_page_url:
|
|
1241
|
+
from_page_url: r,
|
|
1227
1242
|
...n && { page_view: n }
|
|
1228
1243
|
});
|
|
1229
1244
|
};
|
|
@@ -1236,17 +1251,17 @@ class ft extends g {
|
|
|
1236
1251
|
}), this.onTrack();
|
|
1237
1252
|
}
|
|
1238
1253
|
extractPageViewData() {
|
|
1239
|
-
const { pathname: e, search: t, hash:
|
|
1240
|
-
return !n && !i && !e && !t && !
|
|
1254
|
+
const { pathname: e, search: t, hash: r } = window.location, { referrer: n } = document, { title: i } = document;
|
|
1255
|
+
return !n && !i && !e && !t && !r ? void 0 : {
|
|
1241
1256
|
...n && { referrer: n },
|
|
1242
1257
|
...i && { title: i },
|
|
1243
1258
|
...e && { pathname: e },
|
|
1244
1259
|
...t && { search: t },
|
|
1245
|
-
...
|
|
1260
|
+
...r && { hash: r }
|
|
1246
1261
|
};
|
|
1247
1262
|
}
|
|
1248
1263
|
}
|
|
1249
|
-
class
|
|
1264
|
+
class St extends g {
|
|
1250
1265
|
eventManager;
|
|
1251
1266
|
clickHandler;
|
|
1252
1267
|
constructor(e) {
|
|
@@ -1254,11 +1269,13 @@ class gt extends g {
|
|
|
1254
1269
|
}
|
|
1255
1270
|
startTracking() {
|
|
1256
1271
|
this.clickHandler || (this.clickHandler = (e) => {
|
|
1257
|
-
const t = e,
|
|
1272
|
+
const t = e, r = t.target, n = typeof HTMLElement < "u" && r instanceof HTMLElement ? r : typeof HTMLElement < "u" && r instanceof Node && r.parentElement instanceof HTMLElement ? r.parentElement : null;
|
|
1258
1273
|
if (!n) {
|
|
1259
1274
|
l("warn", "Click target not found or not an element");
|
|
1260
1275
|
return;
|
|
1261
1276
|
}
|
|
1277
|
+
if (this.shouldIgnoreElement(n))
|
|
1278
|
+
return;
|
|
1262
1279
|
const i = this.findTrackingElement(n), a = this.getRelevantClickElement(n), o = this.calculateClickCoordinates(t, n);
|
|
1263
1280
|
if (i) {
|
|
1264
1281
|
const u = this.extractTrackingData(i);
|
|
@@ -1283,19 +1300,22 @@ class gt extends g {
|
|
|
1283
1300
|
stopTracking() {
|
|
1284
1301
|
this.clickHandler && (window.removeEventListener("click", this.clickHandler, !0), this.clickHandler = void 0);
|
|
1285
1302
|
}
|
|
1303
|
+
shouldIgnoreElement(e) {
|
|
1304
|
+
return e.hasAttribute(`${A}-ignore`) ? !0 : e.closest(`[${A}-ignore]`) !== null;
|
|
1305
|
+
}
|
|
1286
1306
|
findTrackingElement(e) {
|
|
1287
|
-
return e.hasAttribute(`${
|
|
1307
|
+
return e.hasAttribute(`${A}-name`) ? e : e.closest(`[${A}-name]`);
|
|
1288
1308
|
}
|
|
1289
1309
|
getRelevantClickElement(e) {
|
|
1290
1310
|
for (const t of Pe)
|
|
1291
1311
|
try {
|
|
1292
1312
|
if (e.matches(t))
|
|
1293
1313
|
return e;
|
|
1294
|
-
const
|
|
1295
|
-
if (
|
|
1296
|
-
return
|
|
1297
|
-
} catch (
|
|
1298
|
-
l("warn", "Invalid selector in element search", { error:
|
|
1314
|
+
const r = e.closest(t);
|
|
1315
|
+
if (r)
|
|
1316
|
+
return r;
|
|
1317
|
+
} catch (r) {
|
|
1318
|
+
l("warn", "Invalid selector in element search", { error: r, data: { selector: t } });
|
|
1299
1319
|
continue;
|
|
1300
1320
|
}
|
|
1301
1321
|
return e;
|
|
@@ -1304,20 +1324,20 @@ class gt extends g {
|
|
|
1304
1324
|
return Math.max(0, Math.min(1, Number(e.toFixed(3))));
|
|
1305
1325
|
}
|
|
1306
1326
|
calculateClickCoordinates(e, t) {
|
|
1307
|
-
const
|
|
1327
|
+
const r = t.getBoundingClientRect(), n = e.clientX, i = e.clientY, a = r.width > 0 ? this.clamp((n - r.left) / r.width) : 0, o = r.height > 0 ? this.clamp((i - r.top) / r.height) : 0;
|
|
1308
1328
|
return { x: n, y: i, relativeX: a, relativeY: o };
|
|
1309
1329
|
}
|
|
1310
1330
|
extractTrackingData(e) {
|
|
1311
|
-
const t = e.getAttribute(`${
|
|
1331
|
+
const t = e.getAttribute(`${A}-name`), r = e.getAttribute(`${A}-value`);
|
|
1312
1332
|
if (t)
|
|
1313
1333
|
return {
|
|
1314
1334
|
element: e,
|
|
1315
1335
|
name: t,
|
|
1316
|
-
...
|
|
1336
|
+
...r && { value: r }
|
|
1317
1337
|
};
|
|
1318
1338
|
}
|
|
1319
|
-
generateClickData(e, t,
|
|
1320
|
-
const { x: n, y: i, relativeX: a, relativeY: o } =
|
|
1339
|
+
generateClickData(e, t, r) {
|
|
1340
|
+
const { x: n, y: i, relativeX: a, relativeY: o } = r, c = this.getRelevantText(e, t), u = this.extractElementAttributes(t);
|
|
1321
1341
|
return {
|
|
1322
1342
|
x: n,
|
|
1323
1343
|
y: i,
|
|
@@ -1335,9 +1355,20 @@ class gt extends g {
|
|
|
1335
1355
|
...Object.keys(u).length > 0 && { dataAttributes: u }
|
|
1336
1356
|
};
|
|
1337
1357
|
}
|
|
1358
|
+
sanitizeText(e) {
|
|
1359
|
+
let t = e;
|
|
1360
|
+
for (const r of ae) {
|
|
1361
|
+
const n = new RegExp(r.source, r.flags);
|
|
1362
|
+
t = t.replace(n, "[REDACTED]");
|
|
1363
|
+
}
|
|
1364
|
+
return t;
|
|
1365
|
+
}
|
|
1338
1366
|
getRelevantText(e, t) {
|
|
1339
|
-
const
|
|
1340
|
-
|
|
1367
|
+
const r = e.textContent?.trim() ?? "", n = t.textContent?.trim() ?? "";
|
|
1368
|
+
if (!r && !n)
|
|
1369
|
+
return "";
|
|
1370
|
+
let i = "";
|
|
1371
|
+
return r && r.length <= 255 ? i = r : n.length <= 255 ? i = n : i = n.slice(0, 252) + "...", this.sanitizeText(i);
|
|
1341
1372
|
}
|
|
1342
1373
|
extractElementAttributes(e) {
|
|
1343
1374
|
const t = [
|
|
@@ -1351,12 +1382,12 @@ class gt extends g {
|
|
|
1351
1382
|
"name",
|
|
1352
1383
|
"alt",
|
|
1353
1384
|
"role"
|
|
1354
|
-
],
|
|
1385
|
+
], r = {};
|
|
1355
1386
|
for (const n of t) {
|
|
1356
1387
|
const i = e.getAttribute(n);
|
|
1357
|
-
i && (
|
|
1388
|
+
i && (r[n] = i);
|
|
1358
1389
|
}
|
|
1359
|
-
return
|
|
1390
|
+
return r;
|
|
1360
1391
|
}
|
|
1361
1392
|
createCustomEventData(e) {
|
|
1362
1393
|
return {
|
|
@@ -1365,7 +1396,7 @@ class gt extends g {
|
|
|
1365
1396
|
};
|
|
1366
1397
|
}
|
|
1367
1398
|
}
|
|
1368
|
-
class
|
|
1399
|
+
class Et extends g {
|
|
1369
1400
|
eventManager;
|
|
1370
1401
|
containers = [];
|
|
1371
1402
|
limitWarningLogged = !1;
|
|
@@ -1389,9 +1420,9 @@ class St extends g {
|
|
|
1389
1420
|
tryDetectScrollContainers(e) {
|
|
1390
1421
|
const t = this.findScrollableElements();
|
|
1391
1422
|
if (t.length > 0) {
|
|
1392
|
-
for (const
|
|
1393
|
-
const n = this.getElementSelector(
|
|
1394
|
-
this.setupScrollContainer(
|
|
1423
|
+
for (const r of t) {
|
|
1424
|
+
const n = this.getElementSelector(r);
|
|
1425
|
+
this.setupScrollContainer(r, n);
|
|
1395
1426
|
}
|
|
1396
1427
|
this.applyPrimaryScrollSelectorIfConfigured();
|
|
1397
1428
|
return;
|
|
@@ -1420,9 +1451,9 @@ class St extends g {
|
|
|
1420
1451
|
return a.overflowY === "auto" || a.overflowY === "scroll" || a.overflow === "auto" || a.overflow === "scroll" ? NodeFilter.FILTER_ACCEPT : NodeFilter.FILTER_SKIP;
|
|
1421
1452
|
}
|
|
1422
1453
|
});
|
|
1423
|
-
let
|
|
1424
|
-
for (; (
|
|
1425
|
-
const n =
|
|
1454
|
+
let r;
|
|
1455
|
+
for (; (r = t.nextNode()) && e.length < 10; ) {
|
|
1456
|
+
const n = r;
|
|
1426
1457
|
this.isElementScrollable(n) && e.push(n);
|
|
1427
1458
|
}
|
|
1428
1459
|
return e;
|
|
@@ -1434,9 +1465,9 @@ class St extends g {
|
|
|
1434
1465
|
if (t.id)
|
|
1435
1466
|
return `#${t.id}`;
|
|
1436
1467
|
if (t.className && typeof t.className == "string") {
|
|
1437
|
-
const
|
|
1438
|
-
if (
|
|
1439
|
-
return `.${
|
|
1468
|
+
const r = t.className.split(" ").filter((n) => n.trim())[0];
|
|
1469
|
+
if (r)
|
|
1470
|
+
return `.${r}`;
|
|
1440
1471
|
}
|
|
1441
1472
|
return t.tagName.toLowerCase();
|
|
1442
1473
|
}
|
|
@@ -1473,10 +1504,10 @@ class St extends g {
|
|
|
1473
1504
|
};
|
|
1474
1505
|
this.containers.push(c), e instanceof Window ? window.addEventListener("scroll", n, { passive: !0 }) : e.addEventListener("scroll", n, { passive: !0 });
|
|
1475
1506
|
}
|
|
1476
|
-
processScrollEvent(e, t,
|
|
1477
|
-
if (!this.shouldEmitScrollEvent(e, t,
|
|
1507
|
+
processScrollEvent(e, t, r) {
|
|
1508
|
+
if (!this.shouldEmitScrollEvent(e, t, r))
|
|
1478
1509
|
return;
|
|
1479
|
-
e.lastEventTime =
|
|
1510
|
+
e.lastEventTime = r, e.lastDepth = t.depth, e.lastDirection = t.direction;
|
|
1480
1511
|
const n = this.get("scrollEventCount") ?? 0;
|
|
1481
1512
|
this.set("scrollEventCount", n + 1), this.eventManager.track({
|
|
1482
1513
|
type: d.SCROLL,
|
|
@@ -1487,8 +1518,8 @@ class St extends g {
|
|
|
1487
1518
|
}
|
|
1488
1519
|
});
|
|
1489
1520
|
}
|
|
1490
|
-
shouldEmitScrollEvent(e, t,
|
|
1491
|
-
return this.hasReachedSessionLimit() ? (this.logLimitOnce(), !1) : !(!this.hasElapsedMinimumInterval(e,
|
|
1521
|
+
shouldEmitScrollEvent(e, t, r) {
|
|
1522
|
+
return this.hasReachedSessionLimit() ? (this.logLimitOnce(), !1) : !(!this.hasElapsedMinimumInterval(e, r) || !this.hasSignificantDepthChange(e, t.depth));
|
|
1492
1523
|
}
|
|
1493
1524
|
hasReachedSessionLimit() {
|
|
1494
1525
|
return (this.get("scrollEventCount") ?? 0) >= this.maxEventsPerSession;
|
|
@@ -1516,17 +1547,17 @@ class St extends g {
|
|
|
1516
1547
|
getScrollDirection(e, t) {
|
|
1517
1548
|
return e > t ? U.DOWN : U.UP;
|
|
1518
1549
|
}
|
|
1519
|
-
calculateScrollDepth(e, t,
|
|
1520
|
-
if (t <=
|
|
1550
|
+
calculateScrollDepth(e, t, r) {
|
|
1551
|
+
if (t <= r)
|
|
1521
1552
|
return 0;
|
|
1522
|
-
const n = t -
|
|
1553
|
+
const n = t - r;
|
|
1523
1554
|
return Math.min(100, Math.max(0, Math.floor(e / n * 100)));
|
|
1524
1555
|
}
|
|
1525
1556
|
calculateScrollData(e) {
|
|
1526
|
-
const { element: t, lastScrollPos:
|
|
1557
|
+
const { element: t, lastScrollPos: r, lastEventTime: n } = e, i = this.getScrollTop(t), a = Date.now(), o = Math.abs(i - r);
|
|
1527
1558
|
if (o < 10 || t === window && !this.isWindowScrollable())
|
|
1528
1559
|
return null;
|
|
1529
|
-
const c = this.getViewportHeight(t), u = this.getScrollHeight(t), f = this.getScrollDirection(i,
|
|
1560
|
+
const c = this.getViewportHeight(t), u = this.getScrollHeight(t), f = this.getScrollDirection(i, r), _ = this.calculateScrollDepth(i, u, c), D = n > 0 ? a - n : 0, Q = D > 0 ? Math.round(o / D * 1e3) : 0;
|
|
1530
1561
|
return _ > e.maxDepthReached && (e.maxDepthReached = _), e.lastScrollPos = i, {
|
|
1531
1562
|
depth: _,
|
|
1532
1563
|
direction: f,
|
|
@@ -1544,8 +1575,8 @@ class St extends g {
|
|
|
1544
1575
|
return e instanceof Window ? document.documentElement.scrollHeight : e.scrollHeight;
|
|
1545
1576
|
}
|
|
1546
1577
|
isElementScrollable(e) {
|
|
1547
|
-
const t = getComputedStyle(e),
|
|
1548
|
-
return
|
|
1578
|
+
const t = getComputedStyle(e), r = t.overflowY === "auto" || t.overflowY === "scroll" || t.overflowX === "auto" || t.overflowX === "scroll" || t.overflow === "auto" || t.overflow === "scroll", n = e.scrollHeight > e.clientHeight || e.scrollWidth > e.clientWidth;
|
|
1579
|
+
return r && n;
|
|
1549
1580
|
}
|
|
1550
1581
|
applyPrimaryScrollSelector(e) {
|
|
1551
1582
|
let t;
|
|
@@ -1567,7 +1598,7 @@ class St extends g {
|
|
|
1567
1598
|
e.isPrimary = t;
|
|
1568
1599
|
}
|
|
1569
1600
|
}
|
|
1570
|
-
class
|
|
1601
|
+
class mt extends g {
|
|
1571
1602
|
isInitialized = !1;
|
|
1572
1603
|
async initialize() {
|
|
1573
1604
|
if (this.isInitialized)
|
|
@@ -1580,17 +1611,17 @@ class Et extends g {
|
|
|
1580
1611
|
return;
|
|
1581
1612
|
}
|
|
1582
1613
|
await this.loadScript(e), this.configureGtag(e, t), this.isInitialized = !0;
|
|
1583
|
-
} catch (
|
|
1584
|
-
l("error", "Google Analytics initialization failed", { error:
|
|
1614
|
+
} catch (r) {
|
|
1615
|
+
l("error", "Google Analytics initialization failed", { error: r });
|
|
1585
1616
|
}
|
|
1586
1617
|
}
|
|
1587
1618
|
trackEvent(e, t) {
|
|
1588
1619
|
if (!(!e?.trim() || !this.isInitialized || typeof window.gtag != "function"))
|
|
1589
1620
|
try {
|
|
1590
|
-
const
|
|
1591
|
-
window.gtag("event", e,
|
|
1592
|
-
} catch (
|
|
1593
|
-
l("error", "Google Analytics event tracking failed", { error:
|
|
1621
|
+
const r = Array.isArray(t) ? { items: t } : t;
|
|
1622
|
+
window.gtag("event", e, r);
|
|
1623
|
+
} catch (r) {
|
|
1624
|
+
l("error", "Google Analytics event tracking failed", { error: r });
|
|
1594
1625
|
}
|
|
1595
1626
|
}
|
|
1596
1627
|
cleanup() {
|
|
@@ -1602,28 +1633,28 @@ class Et extends g {
|
|
|
1602
1633
|
return document.getElementById("tracelog-ga-script") ? !0 : !!document.querySelector('script[src*="googletagmanager.com/gtag/js"]');
|
|
1603
1634
|
}
|
|
1604
1635
|
async loadScript(e) {
|
|
1605
|
-
return new Promise((t,
|
|
1636
|
+
return new Promise((t, r) => {
|
|
1606
1637
|
const n = document.createElement("script");
|
|
1607
1638
|
n.id = "tracelog-ga-script", n.async = !0, n.src = `https://www.googletagmanager.com/gtag/js?id=${e}`, n.onload = () => {
|
|
1608
1639
|
t();
|
|
1609
1640
|
}, n.onerror = () => {
|
|
1610
|
-
|
|
1641
|
+
r(new Error("Failed to load Google Analytics script"));
|
|
1611
1642
|
}, document.head.appendChild(n);
|
|
1612
1643
|
});
|
|
1613
1644
|
}
|
|
1614
1645
|
configureGtag(e, t) {
|
|
1615
|
-
const
|
|
1616
|
-
|
|
1646
|
+
const r = document.createElement("script");
|
|
1647
|
+
r.innerHTML = `
|
|
1617
1648
|
window.dataLayer = window.dataLayer || [];
|
|
1618
1649
|
function gtag(){dataLayer.push(arguments);}
|
|
1619
1650
|
gtag('js', new Date());
|
|
1620
1651
|
gtag('config', '${e}', {
|
|
1621
1652
|
'user_id': '${t}'
|
|
1622
1653
|
});
|
|
1623
|
-
`, document.head.appendChild(
|
|
1654
|
+
`, document.head.appendChild(r);
|
|
1624
1655
|
}
|
|
1625
1656
|
}
|
|
1626
|
-
class
|
|
1657
|
+
class pt {
|
|
1627
1658
|
storage;
|
|
1628
1659
|
sessionStorageRef;
|
|
1629
1660
|
fallbackStorage = /* @__PURE__ */ new Map();
|
|
@@ -1652,8 +1683,8 @@ class mt {
|
|
|
1652
1683
|
this.storage.setItem(e, t);
|
|
1653
1684
|
return;
|
|
1654
1685
|
}
|
|
1655
|
-
} catch (
|
|
1656
|
-
if (
|
|
1686
|
+
} catch (r) {
|
|
1687
|
+
if (r instanceof DOMException && r.name === "QuotaExceededError")
|
|
1657
1688
|
if (this.hasQuotaExceededError = !0, l("warn", "localStorage quota exceeded, attempting cleanup", {
|
|
1658
1689
|
data: { key: e, valueSize: t.length }
|
|
1659
1690
|
}), this.cleanupOldData())
|
|
@@ -1670,7 +1701,7 @@ class mt {
|
|
|
1670
1701
|
}
|
|
1671
1702
|
else
|
|
1672
1703
|
l("error", "localStorage quota exceeded and no data to cleanup - data will not persist", {
|
|
1673
|
-
error:
|
|
1704
|
+
error: r,
|
|
1674
1705
|
data: { key: e, valueSize: t.length }
|
|
1675
1706
|
});
|
|
1676
1707
|
}
|
|
@@ -1696,8 +1727,8 @@ class mt {
|
|
|
1696
1727
|
try {
|
|
1697
1728
|
const e = [];
|
|
1698
1729
|
for (let t = 0; t < this.storage.length; t++) {
|
|
1699
|
-
const
|
|
1700
|
-
|
|
1730
|
+
const r = this.storage.key(t);
|
|
1731
|
+
r?.startsWith("tracelog_") && e.push(r);
|
|
1701
1732
|
}
|
|
1702
1733
|
e.forEach((t) => {
|
|
1703
1734
|
this.storage.removeItem(t);
|
|
@@ -1739,7 +1770,7 @@ class mt {
|
|
|
1739
1770
|
} catch {
|
|
1740
1771
|
}
|
|
1741
1772
|
}), !0;
|
|
1742
|
-
const
|
|
1773
|
+
const r = ["tracelog_session_", "tracelog_user_id", "tracelog_device_id", "tracelog_config"], n = e.filter((i) => !r.some((a) => i.startsWith(a)));
|
|
1743
1774
|
return n.length > 0 ? (n.slice(0, 5).forEach((a) => {
|
|
1744
1775
|
try {
|
|
1745
1776
|
this.storage.removeItem(a);
|
|
@@ -1757,8 +1788,8 @@ class mt {
|
|
|
1757
1788
|
if (typeof window > "u")
|
|
1758
1789
|
return null;
|
|
1759
1790
|
try {
|
|
1760
|
-
const t = e === "localStorage" ? window.localStorage : window.sessionStorage,
|
|
1761
|
-
return t.setItem(
|
|
1791
|
+
const t = e === "localStorage" ? window.localStorage : window.sessionStorage, r = "__tracelog_test__";
|
|
1792
|
+
return t.setItem(r, "test"), t.removeItem(r), t;
|
|
1762
1793
|
} catch {
|
|
1763
1794
|
return null;
|
|
1764
1795
|
}
|
|
@@ -1783,9 +1814,9 @@ class mt {
|
|
|
1783
1814
|
this.sessionStorageRef.setItem(e, t);
|
|
1784
1815
|
return;
|
|
1785
1816
|
}
|
|
1786
|
-
} catch (
|
|
1787
|
-
|
|
1788
|
-
error:
|
|
1817
|
+
} catch (r) {
|
|
1818
|
+
r instanceof DOMException && r.name === "QuotaExceededError" && l("error", "sessionStorage quota exceeded - data will not persist", {
|
|
1819
|
+
error: r,
|
|
1789
1820
|
data: { key: e, valueSize: t.length }
|
|
1790
1821
|
});
|
|
1791
1822
|
}
|
|
@@ -1801,12 +1832,12 @@ class mt {
|
|
|
1801
1832
|
this.fallbackSessionStorage.delete(e);
|
|
1802
1833
|
}
|
|
1803
1834
|
}
|
|
1804
|
-
class
|
|
1835
|
+
class _t extends g {
|
|
1805
1836
|
eventManager;
|
|
1806
1837
|
reportedByNav = /* @__PURE__ */ new Map();
|
|
1807
1838
|
observers = [];
|
|
1808
1839
|
lastLongTaskSentAt = 0;
|
|
1809
|
-
vitalThresholds =
|
|
1840
|
+
vitalThresholds = ye;
|
|
1810
1841
|
constructor(e) {
|
|
1811
1842
|
super(), this.eventManager = e;
|
|
1812
1843
|
}
|
|
@@ -1817,16 +1848,16 @@ class pt extends g {
|
|
|
1817
1848
|
this.observers.forEach((e, t) => {
|
|
1818
1849
|
try {
|
|
1819
1850
|
e.disconnect();
|
|
1820
|
-
} catch (
|
|
1821
|
-
l("warn", "Failed to disconnect performance observer", { error:
|
|
1851
|
+
} catch (r) {
|
|
1852
|
+
l("warn", "Failed to disconnect performance observer", { error: r, data: { observerIndex: t } });
|
|
1822
1853
|
}
|
|
1823
1854
|
}), this.observers.length = 0, this.reportedByNav.clear();
|
|
1824
1855
|
}
|
|
1825
1856
|
observeWebVitalsFallback() {
|
|
1826
1857
|
this.reportTTFB(), this.safeObserve(
|
|
1827
1858
|
"largest-contentful-paint",
|
|
1828
|
-
(
|
|
1829
|
-
const n =
|
|
1859
|
+
(r) => {
|
|
1860
|
+
const n = r.getEntries(), i = n[n.length - 1];
|
|
1830
1861
|
i && this.sendVital({ type: "LCP", value: Number(i.startTime.toFixed(2)) });
|
|
1831
1862
|
},
|
|
1832
1863
|
{ type: "largest-contentful-paint", buffered: !0 },
|
|
@@ -1835,10 +1866,10 @@ class pt extends g {
|
|
|
1835
1866
|
let e = 0, t = this.getNavigationId();
|
|
1836
1867
|
this.safeObserve(
|
|
1837
1868
|
"layout-shift",
|
|
1838
|
-
(
|
|
1869
|
+
(r) => {
|
|
1839
1870
|
const n = this.getNavigationId();
|
|
1840
1871
|
n !== t && (e = 0, t = n);
|
|
1841
|
-
const i =
|
|
1872
|
+
const i = r.getEntries();
|
|
1842
1873
|
for (const a of i) {
|
|
1843
1874
|
if (a.hadRecentInput === !0)
|
|
1844
1875
|
continue;
|
|
@@ -1850,17 +1881,17 @@ class pt extends g {
|
|
|
1850
1881
|
{ type: "layout-shift", buffered: !0 }
|
|
1851
1882
|
), this.safeObserve(
|
|
1852
1883
|
"paint",
|
|
1853
|
-
(
|
|
1854
|
-
for (const n of
|
|
1884
|
+
(r) => {
|
|
1885
|
+
for (const n of r.getEntries())
|
|
1855
1886
|
n.name === "first-contentful-paint" && this.sendVital({ type: "FCP", value: Number(n.startTime.toFixed(2)) });
|
|
1856
1887
|
},
|
|
1857
1888
|
{ type: "paint", buffered: !0 },
|
|
1858
1889
|
!0
|
|
1859
1890
|
), this.safeObserve(
|
|
1860
1891
|
"event",
|
|
1861
|
-
(
|
|
1892
|
+
(r) => {
|
|
1862
1893
|
let n = 0;
|
|
1863
|
-
const i =
|
|
1894
|
+
const i = r.getEntries();
|
|
1864
1895
|
for (const a of i) {
|
|
1865
1896
|
const o = (a.processingEnd ?? 0) - (a.startTime ?? 0);
|
|
1866
1897
|
n = Math.max(n, o);
|
|
@@ -1872,11 +1903,11 @@ class pt extends g {
|
|
|
1872
1903
|
}
|
|
1873
1904
|
async initWebVitals() {
|
|
1874
1905
|
try {
|
|
1875
|
-
const { onLCP: e, onCLS: t, onFCP:
|
|
1906
|
+
const { onLCP: e, onCLS: t, onFCP: r, onTTFB: n, onINP: i } = await Promise.resolve().then(() => Vt), a = (o) => (c) => {
|
|
1876
1907
|
const u = Number(c.value.toFixed(2));
|
|
1877
1908
|
this.sendVital({ type: o, value: u });
|
|
1878
1909
|
};
|
|
1879
|
-
e(a("LCP")), t(a("CLS")),
|
|
1910
|
+
e(a("LCP")), t(a("CLS")), r(a("FCP")), n(a("TTFB")), i(a("INP"));
|
|
1880
1911
|
} catch (e) {
|
|
1881
1912
|
l("warn", "Failed to load web-vitals library, using fallback", { error: e }), this.observeWebVitalsFallback();
|
|
1882
1913
|
}
|
|
@@ -1897,9 +1928,9 @@ class pt extends g {
|
|
|
1897
1928
|
"longtask",
|
|
1898
1929
|
(e) => {
|
|
1899
1930
|
const t = e.getEntries();
|
|
1900
|
-
for (const
|
|
1901
|
-
const n = Number(
|
|
1902
|
-
i - this.lastLongTaskSentAt >=
|
|
1931
|
+
for (const r of t) {
|
|
1932
|
+
const n = Number(r.duration.toFixed(2)), i = Date.now();
|
|
1933
|
+
i - this.lastLongTaskSentAt >= je && (this.shouldSendVital("LONG_TASK", n) && this.trackWebVital("LONG_TASK", n), this.lastLongTaskSentAt = i);
|
|
1903
1934
|
}
|
|
1904
1935
|
},
|
|
1905
1936
|
{ type: "longtask", buffered: !0 }
|
|
@@ -1910,10 +1941,10 @@ class pt extends g {
|
|
|
1910
1941
|
return;
|
|
1911
1942
|
const t = this.getNavigationId();
|
|
1912
1943
|
if (t) {
|
|
1913
|
-
const
|
|
1914
|
-
if (
|
|
1944
|
+
const r = this.reportedByNav.get(t);
|
|
1945
|
+
if (r?.has(e.type))
|
|
1915
1946
|
return;
|
|
1916
|
-
|
|
1947
|
+
r ? r.add(e.type) : this.reportedByNav.set(t, /* @__PURE__ */ new Set([e.type]));
|
|
1917
1948
|
}
|
|
1918
1949
|
this.trackWebVital(e.type, e.value);
|
|
1919
1950
|
}
|
|
@@ -1935,8 +1966,8 @@ class pt extends g {
|
|
|
1935
1966
|
const e = performance.getEntriesByType("navigation")[0];
|
|
1936
1967
|
if (!e)
|
|
1937
1968
|
return null;
|
|
1938
|
-
const t = e.startTime || performance.now(),
|
|
1939
|
-
return `${t.toFixed(2)}_${window.location.pathname}_${
|
|
1969
|
+
const t = e.startTime || performance.now(), r = Math.random().toString(36).substr(2, 5);
|
|
1970
|
+
return `${t.toFixed(2)}_${window.location.pathname}_${r}`;
|
|
1940
1971
|
} catch (e) {
|
|
1941
1972
|
return l("warn", "Failed to get navigation ID", { error: e }), null;
|
|
1942
1973
|
}
|
|
@@ -1946,7 +1977,7 @@ class pt extends g {
|
|
|
1946
1977
|
const t = PerformanceObserver.supportedEntryTypes;
|
|
1947
1978
|
return !t || t.includes(e);
|
|
1948
1979
|
}
|
|
1949
|
-
safeObserve(e, t,
|
|
1980
|
+
safeObserve(e, t, r, n = !1) {
|
|
1950
1981
|
try {
|
|
1951
1982
|
if (!this.isObserverSupported(e))
|
|
1952
1983
|
return !1;
|
|
@@ -1965,7 +1996,7 @@ class pt extends g {
|
|
|
1965
1996
|
} catch {
|
|
1966
1997
|
}
|
|
1967
1998
|
});
|
|
1968
|
-
return i.observe(
|
|
1999
|
+
return i.observe(r ?? { type: e, buffered: !0 }), n || this.observers.push(i), !0;
|
|
1969
2000
|
} catch (i) {
|
|
1970
2001
|
return l("warn", "Failed to create performance observer", {
|
|
1971
2002
|
error: i,
|
|
@@ -1976,11 +2007,11 @@ class pt extends g {
|
|
|
1976
2007
|
shouldSendVital(e, t) {
|
|
1977
2008
|
if (typeof t != "number" || !Number.isFinite(t))
|
|
1978
2009
|
return l("warn", "Invalid web vital value", { data: { type: e, value: t } }), !1;
|
|
1979
|
-
const
|
|
1980
|
-
return !(typeof
|
|
2010
|
+
const r = this.vitalThresholds[e];
|
|
2011
|
+
return !(typeof r == "number" && t <= r);
|
|
1981
2012
|
}
|
|
1982
2013
|
}
|
|
1983
|
-
class
|
|
2014
|
+
class Tt extends g {
|
|
1984
2015
|
eventManager;
|
|
1985
2016
|
recentErrors = /* @__PURE__ */ new Map();
|
|
1986
2017
|
constructor(e) {
|
|
@@ -2000,10 +2031,10 @@ class _t extends g {
|
|
|
2000
2031
|
if (!this.shouldSample())
|
|
2001
2032
|
return;
|
|
2002
2033
|
const t = this.sanitize(e.message || "Unknown error");
|
|
2003
|
-
this.shouldSuppressError(
|
|
2034
|
+
this.shouldSuppressError(b.JS_ERROR, t) || this.eventManager.track({
|
|
2004
2035
|
type: d.ERROR,
|
|
2005
2036
|
error_data: {
|
|
2006
|
-
type:
|
|
2037
|
+
type: b.JS_ERROR,
|
|
2007
2038
|
message: t,
|
|
2008
2039
|
...e.filename && { filename: e.filename },
|
|
2009
2040
|
...e.lineno && { line: e.lineno },
|
|
@@ -2014,12 +2045,12 @@ class _t extends g {
|
|
|
2014
2045
|
handleRejection = (e) => {
|
|
2015
2046
|
if (!this.shouldSample())
|
|
2016
2047
|
return;
|
|
2017
|
-
const t = this.extractRejectionMessage(e.reason),
|
|
2018
|
-
this.shouldSuppressError(
|
|
2048
|
+
const t = this.extractRejectionMessage(e.reason), r = this.sanitize(t);
|
|
2049
|
+
this.shouldSuppressError(b.PROMISE_REJECTION, r) || this.eventManager.track({
|
|
2019
2050
|
type: d.ERROR,
|
|
2020
2051
|
error_data: {
|
|
2021
|
-
type:
|
|
2022
|
-
message:
|
|
2052
|
+
type: b.PROMISE_REJECTION,
|
|
2053
|
+
message: r
|
|
2023
2054
|
}
|
|
2024
2055
|
});
|
|
2025
2056
|
};
|
|
@@ -2037,34 +2068,34 @@ class _t extends g {
|
|
|
2037
2068
|
}
|
|
2038
2069
|
}
|
|
2039
2070
|
sanitize(e) {
|
|
2040
|
-
let t = e.length >
|
|
2041
|
-
for (const
|
|
2042
|
-
const n = new RegExp(
|
|
2071
|
+
let t = e.length > fe ? e.slice(0, fe) + "..." : e;
|
|
2072
|
+
for (const r of ae) {
|
|
2073
|
+
const n = new RegExp(r.source, r.flags);
|
|
2043
2074
|
t = t.replace(n, "[REDACTED]");
|
|
2044
2075
|
}
|
|
2045
2076
|
return t;
|
|
2046
2077
|
}
|
|
2047
2078
|
shouldSuppressError(e, t) {
|
|
2048
|
-
const
|
|
2049
|
-
return i &&
|
|
2079
|
+
const r = Date.now(), n = `${e}:${t}`, i = this.recentErrors.get(n);
|
|
2080
|
+
return i && r - i < ge ? (this.recentErrors.set(n, r), !0) : (this.recentErrors.set(n, r), this.recentErrors.size > Xe ? (this.recentErrors.clear(), this.recentErrors.set(n, r), !1) : (this.recentErrors.size > H && this.pruneOldErrors(), !1));
|
|
2050
2081
|
}
|
|
2051
2082
|
pruneOldErrors() {
|
|
2052
2083
|
const e = Date.now();
|
|
2053
2084
|
for (const [n, i] of this.recentErrors.entries())
|
|
2054
|
-
e - i >
|
|
2085
|
+
e - i > ge && this.recentErrors.delete(n);
|
|
2055
2086
|
if (this.recentErrors.size <= H)
|
|
2056
2087
|
return;
|
|
2057
|
-
const t = Array.from(this.recentErrors.entries()).sort((n, i) => n[1] - i[1]),
|
|
2058
|
-
for (let n = 0; n <
|
|
2088
|
+
const t = Array.from(this.recentErrors.entries()).sort((n, i) => n[1] - i[1]), r = this.recentErrors.size - H;
|
|
2089
|
+
for (let n = 0; n < r; n += 1) {
|
|
2059
2090
|
const i = t[n];
|
|
2060
2091
|
i && this.recentErrors.delete(i[0]);
|
|
2061
2092
|
}
|
|
2062
2093
|
}
|
|
2063
2094
|
}
|
|
2064
|
-
class
|
|
2095
|
+
class It extends g {
|
|
2065
2096
|
isInitialized = !1;
|
|
2066
2097
|
suppressNextScrollTimer = null;
|
|
2067
|
-
emitter = new
|
|
2098
|
+
emitter = new lt();
|
|
2068
2099
|
managers = {};
|
|
2069
2100
|
handlers = {};
|
|
2070
2101
|
integrations = {};
|
|
@@ -2073,24 +2104,24 @@ class Tt extends g {
|
|
|
2073
2104
|
}
|
|
2074
2105
|
async init(e = {}) {
|
|
2075
2106
|
if (!this.isInitialized) {
|
|
2076
|
-
this.managers.storage = new
|
|
2107
|
+
this.managers.storage = new pt();
|
|
2077
2108
|
try {
|
|
2078
|
-
this.setupState(e), await this.setupIntegrations(), this.managers.event = new
|
|
2109
|
+
this.setupState(e), await this.setupIntegrations(), this.managers.event = new ut(this.managers.storage, this.integrations.googleAnalytics, this.emitter), this.initializeHandlers(), await this.managers.event.recoverPersistedEvents().catch((t) => {
|
|
2079
2110
|
l("warn", "Failed to recover persisted events", { error: t });
|
|
2080
2111
|
}), this.isInitialized = !0;
|
|
2081
2112
|
} catch (t) {
|
|
2082
2113
|
this.destroy(!0);
|
|
2083
|
-
const
|
|
2084
|
-
throw new Error(`[TraceLog] TraceLog initialization failed: ${
|
|
2114
|
+
const r = t instanceof Error ? t.message : String(t);
|
|
2115
|
+
throw new Error(`[TraceLog] TraceLog initialization failed: ${r}`);
|
|
2085
2116
|
}
|
|
2086
2117
|
}
|
|
2087
2118
|
}
|
|
2088
2119
|
sendCustomEvent(e, t) {
|
|
2089
2120
|
if (!this.managers.event)
|
|
2090
2121
|
return;
|
|
2091
|
-
const { valid:
|
|
2092
|
-
if (!
|
|
2093
|
-
if (this.get("mode") ===
|
|
2122
|
+
const { valid: r, error: n, sanitizedMetadata: i } = ot(e, t);
|
|
2123
|
+
if (!r) {
|
|
2124
|
+
if (this.get("mode") === C.QA)
|
|
2094
2125
|
throw new Error(`[TraceLog] Custom event "${e}" validation failed: ${n}`);
|
|
2095
2126
|
return;
|
|
2096
2127
|
}
|
|
@@ -2112,119 +2143,119 @@ class Tt extends g {
|
|
|
2112
2143
|
!this.isInitialized && !e || (this.integrations.googleAnalytics?.cleanup(), Object.values(this.handlers).filter(Boolean).forEach((t) => {
|
|
2113
2144
|
try {
|
|
2114
2145
|
t.stopTracking();
|
|
2115
|
-
} catch (
|
|
2116
|
-
l("warn", "Failed to stop tracking", { error:
|
|
2146
|
+
} catch (r) {
|
|
2147
|
+
l("warn", "Failed to stop tracking", { error: r });
|
|
2117
2148
|
}
|
|
2118
2149
|
}), this.suppressNextScrollTimer && (clearTimeout(this.suppressNextScrollTimer), this.suppressNextScrollTimer = null), this.managers.event?.flushImmediatelySync(), this.managers.event?.stop(), this.emitter.removeAllListeners(), this.set("hasStartSession", !1), this.set("suppressNextScroll", !1), this.set("sessionId", null), this.isInitialized = !1, this.handlers = {});
|
|
2119
2150
|
}
|
|
2120
2151
|
setupState(e = {}) {
|
|
2121
2152
|
this.set("config", e);
|
|
2122
|
-
const t =
|
|
2153
|
+
const t = dt.getId(this.managers.storage);
|
|
2123
2154
|
this.set("userId", t);
|
|
2124
|
-
const
|
|
2125
|
-
this.set("collectApiUrl",
|
|
2126
|
-
const n =
|
|
2155
|
+
const r = Ze(e);
|
|
2156
|
+
this.set("collectApiUrl", r);
|
|
2157
|
+
const n = Ge();
|
|
2127
2158
|
this.set("device", n);
|
|
2128
2159
|
const i = J(window.location.href, e.sensitiveQueryParams);
|
|
2129
2160
|
this.set("pageUrl", i);
|
|
2130
|
-
const a =
|
|
2161
|
+
const a = Ke() ? C.QA : void 0;
|
|
2131
2162
|
a && this.set("mode", a);
|
|
2132
2163
|
}
|
|
2133
2164
|
async setupIntegrations() {
|
|
2134
2165
|
if (this.get("config").integrations?.googleAnalytics?.measurementId?.trim())
|
|
2135
2166
|
try {
|
|
2136
|
-
this.integrations.googleAnalytics = new
|
|
2167
|
+
this.integrations.googleAnalytics = new mt(), await this.integrations.googleAnalytics.initialize();
|
|
2137
2168
|
} catch {
|
|
2138
2169
|
this.integrations.googleAnalytics = void 0;
|
|
2139
2170
|
}
|
|
2140
2171
|
}
|
|
2141
2172
|
initializeHandlers() {
|
|
2142
|
-
this.handlers.session = new
|
|
2173
|
+
this.handlers.session = new ft(
|
|
2143
2174
|
this.managers.storage,
|
|
2144
2175
|
this.managers.event
|
|
2145
2176
|
), this.handlers.session.startTracking();
|
|
2146
2177
|
const e = () => {
|
|
2147
2178
|
this.set("suppressNextScroll", !0), this.suppressNextScrollTimer && clearTimeout(this.suppressNextScrollTimer), this.suppressNextScrollTimer = window.setTimeout(() => {
|
|
2148
2179
|
this.set("suppressNextScroll", !1);
|
|
2149
|
-
},
|
|
2180
|
+
}, 500);
|
|
2150
2181
|
};
|
|
2151
|
-
this.handlers.pageView = new
|
|
2182
|
+
this.handlers.pageView = new gt(this.managers.event, e), this.handlers.pageView.startTracking(), this.handlers.click = new St(this.managers.event), this.handlers.click.startTracking(), this.handlers.scroll = new Et(this.managers.event), this.handlers.scroll.startTracking(), this.handlers.performance = new _t(this.managers.event), this.handlers.performance.startTracking().catch((t) => {
|
|
2152
2183
|
l("warn", "Failed to start performance tracking", { error: t });
|
|
2153
|
-
}), this.handlers.error = new
|
|
2184
|
+
}), this.handlers.error = new Tt(this.managers.event), this.handlers.error.startTracking();
|
|
2154
2185
|
}
|
|
2155
2186
|
}
|
|
2156
2187
|
const y = [];
|
|
2157
|
-
let h = null,
|
|
2158
|
-
const
|
|
2188
|
+
let h = null, L = !1, x = !1;
|
|
2189
|
+
const vt = async (s) => {
|
|
2159
2190
|
if (typeof window > "u" || typeof document > "u")
|
|
2160
2191
|
throw new Error("[TraceLog] This library can only be used in a browser environment");
|
|
2161
|
-
if (!window.__traceLogDisabled && !h && !
|
|
2162
|
-
|
|
2192
|
+
if (!window.__traceLogDisabled && !h && !L) {
|
|
2193
|
+
L = !0;
|
|
2163
2194
|
try {
|
|
2164
|
-
const e =
|
|
2195
|
+
const e = st(s ?? {}), t = new It();
|
|
2165
2196
|
try {
|
|
2166
2197
|
y.forEach(({ event: i, callback: a }) => {
|
|
2167
2198
|
t.on(i, a);
|
|
2168
2199
|
}), y.length = 0;
|
|
2169
|
-
const
|
|
2200
|
+
const r = t.init(e), n = new Promise((i, a) => {
|
|
2170
2201
|
setTimeout(() => {
|
|
2171
2202
|
a(new Error("[TraceLog] Initialization timeout after 10000ms"));
|
|
2172
2203
|
}, 1e4);
|
|
2173
2204
|
});
|
|
2174
|
-
await Promise.race([
|
|
2175
|
-
} catch (
|
|
2205
|
+
await Promise.race([r, n]), h = t;
|
|
2206
|
+
} catch (r) {
|
|
2176
2207
|
try {
|
|
2177
2208
|
t.destroy(!0);
|
|
2178
2209
|
} catch (n) {
|
|
2179
2210
|
l("error", "Failed to cleanup partially initialized app", { error: n });
|
|
2180
2211
|
}
|
|
2181
|
-
throw
|
|
2212
|
+
throw r;
|
|
2182
2213
|
}
|
|
2183
2214
|
} catch (e) {
|
|
2184
2215
|
throw h = null, e;
|
|
2185
2216
|
} finally {
|
|
2186
|
-
|
|
2217
|
+
L = !1;
|
|
2187
2218
|
}
|
|
2188
2219
|
}
|
|
2189
|
-
},
|
|
2220
|
+
}, yt = (s, e) => {
|
|
2190
2221
|
if (!h)
|
|
2191
2222
|
throw new Error("[TraceLog] TraceLog not initialized. Please call init() first.");
|
|
2192
2223
|
if (x)
|
|
2193
2224
|
throw new Error("[TraceLog] Cannot send events while TraceLog is being destroyed");
|
|
2194
|
-
h.sendCustomEvent(
|
|
2195
|
-
},
|
|
2196
|
-
if (!h ||
|
|
2197
|
-
y.push({ event:
|
|
2225
|
+
h.sendCustomEvent(s, e);
|
|
2226
|
+
}, At = (s, e) => {
|
|
2227
|
+
if (!h || L) {
|
|
2228
|
+
y.push({ event: s, callback: e });
|
|
2198
2229
|
return;
|
|
2199
2230
|
}
|
|
2200
|
-
h.on(
|
|
2201
|
-
},
|
|
2231
|
+
h.on(s, e);
|
|
2232
|
+
}, wt = (s, e) => {
|
|
2202
2233
|
if (!h) {
|
|
2203
|
-
const t = y.findIndex((
|
|
2234
|
+
const t = y.findIndex((r) => r.event === s && r.callback === e);
|
|
2204
2235
|
t !== -1 && y.splice(t, 1);
|
|
2205
2236
|
return;
|
|
2206
2237
|
}
|
|
2207
|
-
h.off(
|
|
2208
|
-
},
|
|
2238
|
+
h.off(s, e);
|
|
2239
|
+
}, Mt = () => h !== null, Nt = () => {
|
|
2209
2240
|
if (x)
|
|
2210
2241
|
throw new Error("[TraceLog] Destroy operation already in progress");
|
|
2211
2242
|
if (!h)
|
|
2212
2243
|
throw new Error("[TraceLog] App not initialized");
|
|
2213
2244
|
x = !0;
|
|
2214
2245
|
try {
|
|
2215
|
-
h.destroy(), h = null,
|
|
2216
|
-
} catch (
|
|
2217
|
-
h = null,
|
|
2246
|
+
h.destroy(), h = null, L = !1, y.length = 0;
|
|
2247
|
+
} catch (s) {
|
|
2248
|
+
h = null, L = !1, y.length = 0, l("warn", "Error during destroy, forced cleanup completed", { error: s });
|
|
2218
2249
|
} finally {
|
|
2219
2250
|
x = !1;
|
|
2220
2251
|
}
|
|
2221
|
-
}, qt = {
|
|
2222
|
-
WEB_VITALS_THRESHOLDS: ve
|
|
2223
|
-
// Business thresholds for performance analysis
|
|
2224
2252
|
}, Jt = {
|
|
2225
|
-
|
|
2226
|
-
//
|
|
2253
|
+
WEB_VITALS_THRESHOLDS: ye
|
|
2254
|
+
// Business thresholds for performance analysis
|
|
2227
2255
|
}, Zt = {
|
|
2256
|
+
PII_PATTERNS: ae
|
|
2257
|
+
// Patterns for sensitive data protection
|
|
2258
|
+
}, er = {
|
|
2228
2259
|
LOW_ACTIVITY_EVENT_COUNT: 50,
|
|
2229
2260
|
HIGH_ACTIVITY_EVENT_COUNT: 1e3,
|
|
2230
2261
|
MIN_EVENTS_FOR_DYNAMIC_CALCULATION: 100,
|
|
@@ -2234,28 +2265,28 @@ const It = async (r) => {
|
|
|
2234
2265
|
MIN_ENGAGED_SESSION_DURATION_MS: 30 * 1e3,
|
|
2235
2266
|
MIN_SCROLL_DEPTH_ENGAGEMENT: 25
|
|
2236
2267
|
// 25% scroll depth for engagement
|
|
2237
|
-
},
|
|
2238
|
-
INACTIVITY_TIMEOUT_MS:
|
|
2268
|
+
}, tr = {
|
|
2269
|
+
INACTIVITY_TIMEOUT_MS: 1800 * 1e3,
|
|
2239
2270
|
// 30min for analytics (vs 15min client)
|
|
2240
2271
|
SHORT_SESSION_THRESHOLD_MS: 30 * 1e3,
|
|
2241
|
-
MEDIUM_SESSION_THRESHOLD_MS:
|
|
2242
|
-
LONG_SESSION_THRESHOLD_MS:
|
|
2243
|
-
MAX_REALISTIC_SESSION_DURATION_MS:
|
|
2272
|
+
MEDIUM_SESSION_THRESHOLD_MS: 300 * 1e3,
|
|
2273
|
+
LONG_SESSION_THRESHOLD_MS: 1800 * 1e3,
|
|
2274
|
+
MAX_REALISTIC_SESSION_DURATION_MS: 480 * 60 * 1e3
|
|
2244
2275
|
// Filter outliers
|
|
2245
|
-
},
|
|
2276
|
+
}, rr = {
|
|
2246
2277
|
MOBILE_MAX_WIDTH: 768,
|
|
2247
2278
|
TABLET_MAX_WIDTH: 1024,
|
|
2248
2279
|
MOBILE_PERFORMANCE_FACTOR: 1.5,
|
|
2249
2280
|
// Mobile typically 1.5x slower
|
|
2250
2281
|
TABLET_PERFORMANCE_FACTOR: 1.2
|
|
2251
|
-
},
|
|
2282
|
+
}, sr = {
|
|
2252
2283
|
MIN_TEXT_LENGTH_FOR_ANALYSIS: 10,
|
|
2253
2284
|
MIN_CLICKS_FOR_HOT_ELEMENT: 10,
|
|
2254
2285
|
// Popular element threshold
|
|
2255
2286
|
MIN_SCROLL_COMPLETION_PERCENT: 80,
|
|
2256
2287
|
// Page consumption threshold
|
|
2257
2288
|
MIN_TIME_ON_PAGE_FOR_READ_MS: 15 * 1e3
|
|
2258
|
-
},
|
|
2289
|
+
}, nr = {
|
|
2259
2290
|
SIGNIFICANT_CHANGE_PERCENT: 20,
|
|
2260
2291
|
MAJOR_CHANGE_PERCENT: 50,
|
|
2261
2292
|
MIN_EVENTS_FOR_INSIGHT: 100,
|
|
@@ -2265,19 +2296,19 @@ const It = async (r) => {
|
|
|
2265
2296
|
LOW_ERROR_RATE_PERCENT: 1,
|
|
2266
2297
|
HIGH_ERROR_RATE_PERCENT: 5,
|
|
2267
2298
|
CRITICAL_ERROR_RATE_PERCENT: 10
|
|
2268
|
-
},
|
|
2299
|
+
}, ir = {
|
|
2269
2300
|
SHORT_TERM_TREND_HOURS: 24,
|
|
2270
2301
|
MEDIUM_TERM_TREND_DAYS: 7,
|
|
2271
2302
|
LONG_TERM_TREND_DAYS: 30,
|
|
2272
2303
|
MIN_DATA_POINTS_FOR_TREND: 5,
|
|
2273
2304
|
WEEKLY_PATTERN_MIN_WEEKS: 4,
|
|
2274
2305
|
DAILY_PATTERN_MIN_DAYS: 14
|
|
2275
|
-
},
|
|
2306
|
+
}, ar = {
|
|
2276
2307
|
MIN_SEGMENT_SIZE: 10,
|
|
2277
2308
|
MIN_COHORT_SIZE: 5,
|
|
2278
2309
|
COHORT_ANALYSIS_DAYS: [1, 3, 7, 14, 30],
|
|
2279
2310
|
MIN_FUNNEL_EVENTS: 20
|
|
2280
|
-
},
|
|
2311
|
+
}, or = {
|
|
2281
2312
|
DEFAULT_EVENTS_LIMIT: 5,
|
|
2282
2313
|
DEFAULT_SESSIONS_LIMIT: 5,
|
|
2283
2314
|
DEFAULT_PAGES_LIMIT: 5,
|
|
@@ -2285,260 +2316,260 @@ const It = async (r) => {
|
|
|
2285
2316
|
MAX_TIME_RANGE_DAYS: 365,
|
|
2286
2317
|
ANALYTICS_BATCH_SIZE: 1e3
|
|
2287
2318
|
// For historical analysis
|
|
2288
|
-
},
|
|
2319
|
+
}, lr = {
|
|
2289
2320
|
ANOMALY_THRESHOLD_SIGMA: 2.5,
|
|
2290
2321
|
STRONG_ANOMALY_THRESHOLD_SIGMA: 3,
|
|
2291
2322
|
TRAFFIC_DROP_ALERT_PERCENT: -30,
|
|
2292
2323
|
TRAFFIC_SPIKE_ALERT_PERCENT: 200,
|
|
2293
2324
|
MIN_BASELINE_DAYS: 7,
|
|
2294
2325
|
MIN_EVENTS_FOR_ANOMALY_DETECTION: 50
|
|
2295
|
-
},
|
|
2326
|
+
}, cr = {
|
|
2296
2327
|
PAGE_URL_EXCLUDED: "excluded",
|
|
2297
2328
|
PAGE_URL_UNKNOWN: "unknown"
|
|
2298
|
-
},
|
|
2299
|
-
init:
|
|
2300
|
-
event:
|
|
2301
|
-
on:
|
|
2302
|
-
off:
|
|
2303
|
-
isInitialized:
|
|
2304
|
-
destroy:
|
|
2329
|
+
}, ur = {
|
|
2330
|
+
init: vt,
|
|
2331
|
+
event: yt,
|
|
2332
|
+
on: At,
|
|
2333
|
+
off: wt,
|
|
2334
|
+
isInitialized: Mt,
|
|
2335
|
+
destroy: Nt
|
|
2305
2336
|
};
|
|
2306
|
-
var ee, Me = -1,
|
|
2307
|
-
addEventListener("pageshow", function(e) {
|
|
2308
|
-
e.persisted && (Me = e.timeStamp,
|
|
2309
|
-
}, !0);
|
|
2310
|
-
},
|
|
2311
|
-
var
|
|
2312
|
-
if (
|
|
2337
|
+
var ee, Me = -1, R = function(s) {
|
|
2338
|
+
addEventListener("pageshow", (function(e) {
|
|
2339
|
+
e.persisted && (Me = e.timeStamp, s(e));
|
|
2340
|
+
}), !0);
|
|
2341
|
+
}, oe = function() {
|
|
2342
|
+
var s = self.performance && performance.getEntriesByType && performance.getEntriesByType("navigation")[0];
|
|
2343
|
+
if (s && s.responseStart > 0 && s.responseStart < performance.now()) return s;
|
|
2313
2344
|
}, G = function() {
|
|
2314
|
-
var
|
|
2315
|
-
return
|
|
2316
|
-
}, m = function(
|
|
2317
|
-
var t =
|
|
2318
|
-
return Me >= 0 ?
|
|
2319
|
-
},
|
|
2345
|
+
var s = oe();
|
|
2346
|
+
return s && s.activationStart || 0;
|
|
2347
|
+
}, m = function(s, e) {
|
|
2348
|
+
var t = oe(), r = "navigate";
|
|
2349
|
+
return Me >= 0 ? r = "back-forward-cache" : t && (document.prerendering || G() > 0 ? r = "prerender" : document.wasDiscarded ? r = "restore" : t.type && (r = t.type.replace(/_/g, "-"))), { name: s, value: e === void 0 ? -1 : e, rating: "good", delta: 0, entries: [], id: "v4-".concat(Date.now(), "-").concat(Math.floor(8999999999999 * Math.random()) + 1e12), navigationType: r };
|
|
2350
|
+
}, P = function(s, e, t) {
|
|
2320
2351
|
try {
|
|
2321
|
-
if (PerformanceObserver.supportedEntryTypes.includes(
|
|
2322
|
-
var
|
|
2323
|
-
Promise.resolve().then(function() {
|
|
2352
|
+
if (PerformanceObserver.supportedEntryTypes.includes(s)) {
|
|
2353
|
+
var r = new PerformanceObserver((function(n) {
|
|
2354
|
+
Promise.resolve().then((function() {
|
|
2324
2355
|
e(n.getEntries());
|
|
2325
|
-
});
|
|
2326
|
-
});
|
|
2327
|
-
return
|
|
2356
|
+
}));
|
|
2357
|
+
}));
|
|
2358
|
+
return r.observe(Object.assign({ type: s, buffered: !0 }, t || {})), r;
|
|
2328
2359
|
}
|
|
2329
2360
|
} catch {
|
|
2330
2361
|
}
|
|
2331
|
-
}, p = function(
|
|
2362
|
+
}, p = function(s, e, t, r) {
|
|
2332
2363
|
var n, i;
|
|
2333
2364
|
return function(a) {
|
|
2334
|
-
e.value >= 0 && (a ||
|
|
2365
|
+
e.value >= 0 && (a || r) && ((i = e.value - (n || 0)) || n === void 0) && (n = e.value, e.delta = i, e.rating = (function(o, c) {
|
|
2335
2366
|
return o > c[1] ? "poor" : o > c[0] ? "needs-improvement" : "good";
|
|
2336
|
-
}(e.value, t),
|
|
2367
|
+
})(e.value, t), s(e));
|
|
2337
2368
|
};
|
|
2338
|
-
},
|
|
2339
|
-
requestAnimationFrame(function() {
|
|
2340
|
-
return requestAnimationFrame(function() {
|
|
2341
|
-
return
|
|
2342
|
-
});
|
|
2343
|
-
});
|
|
2344
|
-
}, $ = function(
|
|
2345
|
-
document.addEventListener("visibilitychange", function() {
|
|
2346
|
-
document.visibilityState === "hidden" &&
|
|
2347
|
-
});
|
|
2348
|
-
},
|
|
2369
|
+
}, le = function(s) {
|
|
2370
|
+
requestAnimationFrame((function() {
|
|
2371
|
+
return requestAnimationFrame((function() {
|
|
2372
|
+
return s();
|
|
2373
|
+
}));
|
|
2374
|
+
}));
|
|
2375
|
+
}, $ = function(s) {
|
|
2376
|
+
document.addEventListener("visibilitychange", (function() {
|
|
2377
|
+
document.visibilityState === "hidden" && s();
|
|
2378
|
+
}));
|
|
2379
|
+
}, ce = function(s) {
|
|
2349
2380
|
var e = !1;
|
|
2350
2381
|
return function() {
|
|
2351
|
-
e || (
|
|
2382
|
+
e || (s(), e = !0);
|
|
2352
2383
|
};
|
|
2353
|
-
},
|
|
2384
|
+
}, N = -1, Te = function() {
|
|
2354
2385
|
return document.visibilityState !== "hidden" || document.prerendering ? 1 / 0 : 0;
|
|
2355
|
-
}, F = function(
|
|
2356
|
-
document.visibilityState === "hidden" &&
|
|
2357
|
-
},
|
|
2386
|
+
}, F = function(s) {
|
|
2387
|
+
document.visibilityState === "hidden" && N > -1 && (N = s.type === "visibilitychange" ? s.timeStamp : 0, Lt());
|
|
2388
|
+
}, Ie = function() {
|
|
2358
2389
|
addEventListener("visibilitychange", F, !0), addEventListener("prerenderingchange", F, !0);
|
|
2359
|
-
},
|
|
2390
|
+
}, Lt = function() {
|
|
2360
2391
|
removeEventListener("visibilitychange", F, !0), removeEventListener("prerenderingchange", F, !0);
|
|
2361
2392
|
}, Ne = function() {
|
|
2362
|
-
return
|
|
2363
|
-
setTimeout(function() {
|
|
2364
|
-
|
|
2365
|
-
}, 0);
|
|
2366
|
-
})), { get firstHiddenTime() {
|
|
2367
|
-
return
|
|
2393
|
+
return N < 0 && (N = Te(), Ie(), R((function() {
|
|
2394
|
+
setTimeout((function() {
|
|
2395
|
+
N = Te(), Ie();
|
|
2396
|
+
}), 0);
|
|
2397
|
+
}))), { get firstHiddenTime() {
|
|
2398
|
+
return N;
|
|
2368
2399
|
} };
|
|
2369
|
-
}, z = function(
|
|
2370
|
-
document.prerendering ? addEventListener("prerenderingchange", function() {
|
|
2371
|
-
return
|
|
2372
|
-
}, !0) :
|
|
2373
|
-
}, te = [1800, 3e3], Le = function(
|
|
2374
|
-
e = e || {}, z(function() {
|
|
2375
|
-
var t,
|
|
2376
|
-
a.forEach(function(o) {
|
|
2377
|
-
o.name === "first-contentful-paint" && (i.disconnect(), o.startTime <
|
|
2378
|
-
});
|
|
2379
|
-
});
|
|
2380
|
-
i && (t = p(r, n, te, e.reportAllChanges), L(function(a) {
|
|
2381
|
-
n = m("FCP"), t = p(r, n, te, e.reportAllChanges), oe(function() {
|
|
2382
|
-
n.value = performance.now() - a.timeStamp, t(!0);
|
|
2383
|
-
});
|
|
2400
|
+
}, z = function(s) {
|
|
2401
|
+
document.prerendering ? addEventListener("prerenderingchange", (function() {
|
|
2402
|
+
return s();
|
|
2403
|
+
}), !0) : s();
|
|
2404
|
+
}, te = [1800, 3e3], Le = function(s, e) {
|
|
2405
|
+
e = e || {}, z((function() {
|
|
2406
|
+
var t, r = Ne(), n = m("FCP"), i = P("paint", (function(a) {
|
|
2407
|
+
a.forEach((function(o) {
|
|
2408
|
+
o.name === "first-contentful-paint" && (i.disconnect(), o.startTime < r.firstHiddenTime && (n.value = Math.max(o.startTime - G(), 0), n.entries.push(o), t(!0)));
|
|
2409
|
+
}));
|
|
2384
2410
|
}));
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2389
|
-
|
|
2411
|
+
i && (t = p(s, n, te, e.reportAllChanges), R((function(a) {
|
|
2412
|
+
n = m("FCP"), t = p(s, n, te, e.reportAllChanges), le((function() {
|
|
2413
|
+
n.value = performance.now() - a.timeStamp, t(!0);
|
|
2414
|
+
}));
|
|
2415
|
+
})));
|
|
2416
|
+
}));
|
|
2417
|
+
}, re = [0.1, 0.25], Rt = function(s, e) {
|
|
2418
|
+
e = e || {}, Le(ce((function() {
|
|
2419
|
+
var t, r = m("CLS", 0), n = 0, i = [], a = function(c) {
|
|
2420
|
+
c.forEach((function(u) {
|
|
2390
2421
|
if (!u.hadRecentInput) {
|
|
2391
2422
|
var f = i[0], _ = i[i.length - 1];
|
|
2392
2423
|
n && u.startTime - _.startTime < 1e3 && u.startTime - f.startTime < 5e3 ? (n += u.value, i.push(u)) : (n = u.value, i = [u]);
|
|
2393
2424
|
}
|
|
2394
|
-
}), n >
|
|
2395
|
-
}, o =
|
|
2396
|
-
o && (t = p(
|
|
2425
|
+
})), n > r.value && (r.value = n, r.entries = i, t());
|
|
2426
|
+
}, o = P("layout-shift", a);
|
|
2427
|
+
o && (t = p(s, r, re, e.reportAllChanges), $((function() {
|
|
2397
2428
|
a(o.takeRecords()), t(!0);
|
|
2398
|
-
}),
|
|
2399
|
-
n = 0,
|
|
2429
|
+
})), R((function() {
|
|
2430
|
+
n = 0, r = m("CLS", 0), t = p(s, r, re, e.reportAllChanges), le((function() {
|
|
2400
2431
|
return t();
|
|
2401
|
-
});
|
|
2402
|
-
}), setTimeout(t, 0));
|
|
2403
|
-
}));
|
|
2404
|
-
}, Re = 0, X = 1 / 0, k = 0,
|
|
2405
|
-
|
|
2432
|
+
}));
|
|
2433
|
+
})), setTimeout(t, 0));
|
|
2434
|
+
})));
|
|
2435
|
+
}, Re = 0, X = 1 / 0, k = 0, bt = function(s) {
|
|
2436
|
+
s.forEach((function(e) {
|
|
2406
2437
|
e.interactionId && (X = Math.min(X, e.interactionId), k = Math.max(k, e.interactionId), Re = k ? (k - X) / 7 + 1 : 0);
|
|
2407
|
-
});
|
|
2438
|
+
}));
|
|
2408
2439
|
}, be = function() {
|
|
2409
2440
|
return ee ? Re : performance.interactionCount || 0;
|
|
2410
|
-
},
|
|
2411
|
-
"interactionCount" in performance || ee || (ee =
|
|
2412
|
-
}, E = [], V = /* @__PURE__ */ new Map(), Ce = 0,
|
|
2413
|
-
var
|
|
2414
|
-
return E[
|
|
2415
|
-
},
|
|
2416
|
-
if (
|
|
2417
|
-
return n(
|
|
2418
|
-
}),
|
|
2419
|
-
var e = E[E.length - 1], t = V.get(
|
|
2420
|
-
if (t || E.length < 10 ||
|
|
2421
|
-
if (t)
|
|
2441
|
+
}, Ct = function() {
|
|
2442
|
+
"interactionCount" in performance || ee || (ee = P("event", bt, { type: "event", buffered: !0, durationThreshold: 0 }));
|
|
2443
|
+
}, E = [], V = /* @__PURE__ */ new Map(), Ce = 0, Ot = function() {
|
|
2444
|
+
var s = Math.min(E.length - 1, Math.floor((be() - Ce) / 50));
|
|
2445
|
+
return E[s];
|
|
2446
|
+
}, Pt = [], Dt = function(s) {
|
|
2447
|
+
if (Pt.forEach((function(n) {
|
|
2448
|
+
return n(s);
|
|
2449
|
+
})), s.interactionId || s.entryType === "first-input") {
|
|
2450
|
+
var e = E[E.length - 1], t = V.get(s.interactionId);
|
|
2451
|
+
if (t || E.length < 10 || s.duration > e.latency) {
|
|
2452
|
+
if (t) s.duration > t.latency ? (t.entries = [s], t.latency = s.duration) : s.duration === t.latency && s.startTime === t.entries[0].startTime && t.entries.push(s);
|
|
2422
2453
|
else {
|
|
2423
|
-
var
|
|
2424
|
-
V.set(
|
|
2454
|
+
var r = { id: s.interactionId, latency: s.duration, entries: [s] };
|
|
2455
|
+
V.set(r.id, r), E.push(r);
|
|
2425
2456
|
}
|
|
2426
|
-
E.sort(function(n, i) {
|
|
2457
|
+
E.sort((function(n, i) {
|
|
2427
2458
|
return i.latency - n.latency;
|
|
2428
|
-
}), E.length > 10 && E.splice(10).forEach(function(n) {
|
|
2459
|
+
})), E.length > 10 && E.splice(10).forEach((function(n) {
|
|
2429
2460
|
return V.delete(n.id);
|
|
2430
|
-
});
|
|
2461
|
+
}));
|
|
2431
2462
|
}
|
|
2432
2463
|
}
|
|
2433
|
-
}, Oe = function(
|
|
2464
|
+
}, Oe = function(s) {
|
|
2434
2465
|
var e = self.requestIdleCallback || self.setTimeout, t = -1;
|
|
2435
|
-
return
|
|
2436
|
-
}, se = [200, 500],
|
|
2437
|
-
"PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, z(function() {
|
|
2466
|
+
return s = ce(s), document.visibilityState === "hidden" ? s() : (t = e(s), $(s)), t;
|
|
2467
|
+
}, se = [200, 500], kt = function(s, e) {
|
|
2468
|
+
"PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, z((function() {
|
|
2438
2469
|
var t;
|
|
2439
|
-
|
|
2440
|
-
var
|
|
2441
|
-
Oe(function() {
|
|
2442
|
-
o.forEach(
|
|
2443
|
-
var c =
|
|
2444
|
-
c && c.latency !== n.value && (n.value = c.latency, n.entries = c.entries,
|
|
2445
|
-
});
|
|
2446
|
-
}, a =
|
|
2447
|
-
|
|
2448
|
-
i(a.takeRecords()),
|
|
2449
|
-
}),
|
|
2450
|
-
Ce = be(), E.length = 0, V.clear(), n = m("INP"),
|
|
2451
|
-
}));
|
|
2452
|
-
}));
|
|
2453
|
-
}, ne = [2500, 4e3], W = {},
|
|
2454
|
-
e = e || {}, z(function() {
|
|
2455
|
-
var t,
|
|
2456
|
-
e.reportAllChanges || (c = c.slice(-1)), c.forEach(function(u) {
|
|
2457
|
-
u.startTime <
|
|
2458
|
-
});
|
|
2459
|
-
}, a =
|
|
2470
|
+
Ct();
|
|
2471
|
+
var r, n = m("INP"), i = function(o) {
|
|
2472
|
+
Oe((function() {
|
|
2473
|
+
o.forEach(Dt);
|
|
2474
|
+
var c = Ot();
|
|
2475
|
+
c && c.latency !== n.value && (n.value = c.latency, n.entries = c.entries, r());
|
|
2476
|
+
}));
|
|
2477
|
+
}, a = P("event", i, { durationThreshold: (t = e.durationThreshold) !== null && t !== void 0 ? t : 40 });
|
|
2478
|
+
r = p(s, n, se, e.reportAllChanges), a && (a.observe({ type: "first-input", buffered: !0 }), $((function() {
|
|
2479
|
+
i(a.takeRecords()), r(!0);
|
|
2480
|
+
})), R((function() {
|
|
2481
|
+
Ce = be(), E.length = 0, V.clear(), n = m("INP"), r = p(s, n, se, e.reportAllChanges);
|
|
2482
|
+
})));
|
|
2483
|
+
})));
|
|
2484
|
+
}, ne = [2500, 4e3], W = {}, Ut = function(s, e) {
|
|
2485
|
+
e = e || {}, z((function() {
|
|
2486
|
+
var t, r = Ne(), n = m("LCP"), i = function(c) {
|
|
2487
|
+
e.reportAllChanges || (c = c.slice(-1)), c.forEach((function(u) {
|
|
2488
|
+
u.startTime < r.firstHiddenTime && (n.value = Math.max(u.startTime - G(), 0), n.entries = [u], t());
|
|
2489
|
+
}));
|
|
2490
|
+
}, a = P("largest-contentful-paint", i);
|
|
2460
2491
|
if (a) {
|
|
2461
|
-
t = p(
|
|
2462
|
-
var o =
|
|
2492
|
+
t = p(s, n, ne, e.reportAllChanges);
|
|
2493
|
+
var o = ce((function() {
|
|
2463
2494
|
W[n.id] || (i(a.takeRecords()), a.disconnect(), W[n.id] = !0, t(!0));
|
|
2464
|
-
});
|
|
2465
|
-
["keydown", "click"].forEach(function(c) {
|
|
2466
|
-
addEventListener(c, function() {
|
|
2495
|
+
}));
|
|
2496
|
+
["keydown", "click"].forEach((function(c) {
|
|
2497
|
+
addEventListener(c, (function() {
|
|
2467
2498
|
return Oe(o);
|
|
2468
|
-
}, { once: !0, capture: !0 });
|
|
2469
|
-
}), $(o),
|
|
2470
|
-
n = m("LCP"), t = p(
|
|
2499
|
+
}), { once: !0, capture: !0 });
|
|
2500
|
+
})), $(o), R((function(c) {
|
|
2501
|
+
n = m("LCP"), t = p(s, n, ne, e.reportAllChanges), le((function() {
|
|
2471
2502
|
n.value = performance.now() - c.timeStamp, W[n.id] = !0, t(!0);
|
|
2472
|
-
});
|
|
2473
|
-
});
|
|
2503
|
+
}));
|
|
2504
|
+
}));
|
|
2474
2505
|
}
|
|
2475
|
-
});
|
|
2476
|
-
}, ie = [800, 1800],
|
|
2477
|
-
document.prerendering ? z(function() {
|
|
2478
|
-
return
|
|
2479
|
-
}) : document.readyState !== "complete" ? addEventListener("load", function() {
|
|
2480
|
-
return
|
|
2481
|
-
}, !0) : setTimeout(e, 0);
|
|
2482
|
-
},
|
|
2506
|
+
}));
|
|
2507
|
+
}, ie = [800, 1800], Ht = function s(e) {
|
|
2508
|
+
document.prerendering ? z((function() {
|
|
2509
|
+
return s(e);
|
|
2510
|
+
})) : document.readyState !== "complete" ? addEventListener("load", (function() {
|
|
2511
|
+
return s(e);
|
|
2512
|
+
}), !0) : setTimeout(e, 0);
|
|
2513
|
+
}, xt = function(s, e) {
|
|
2483
2514
|
e = e || {};
|
|
2484
|
-
var t = m("TTFB"),
|
|
2485
|
-
|
|
2486
|
-
var n =
|
|
2487
|
-
n && (t.value = Math.max(n.responseStart - G(), 0), t.entries = [n],
|
|
2488
|
-
t = m("TTFB", 0), (
|
|
2489
|
-
}));
|
|
2490
|
-
});
|
|
2515
|
+
var t = m("TTFB"), r = p(s, t, ie, e.reportAllChanges);
|
|
2516
|
+
Ht((function() {
|
|
2517
|
+
var n = oe();
|
|
2518
|
+
n && (t.value = Math.max(n.responseStart - G(), 0), t.entries = [n], r(!0), R((function() {
|
|
2519
|
+
t = m("TTFB", 0), (r = p(s, t, ie, e.reportAllChanges))(!0);
|
|
2520
|
+
})));
|
|
2521
|
+
}));
|
|
2491
2522
|
};
|
|
2492
|
-
const
|
|
2523
|
+
const Vt = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
2493
2524
|
__proto__: null,
|
|
2494
2525
|
CLSThresholds: re,
|
|
2495
2526
|
FCPThresholds: te,
|
|
2496
2527
|
INPThresholds: se,
|
|
2497
2528
|
LCPThresholds: ne,
|
|
2498
2529
|
TTFBThresholds: ie,
|
|
2499
|
-
onCLS:
|
|
2530
|
+
onCLS: Rt,
|
|
2500
2531
|
onFCP: Le,
|
|
2501
|
-
onINP:
|
|
2502
|
-
onLCP:
|
|
2503
|
-
onTTFB:
|
|
2532
|
+
onINP: kt,
|
|
2533
|
+
onLCP: Ut,
|
|
2534
|
+
onTTFB: xt
|
|
2504
2535
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
2505
2536
|
export {
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2537
|
+
or as ANALYTICS_QUERY_LIMITS,
|
|
2538
|
+
lr as ANOMALY_DETECTION,
|
|
2539
|
+
w as AppConfigValidationError,
|
|
2540
|
+
sr as CONTENT_ANALYTICS,
|
|
2541
|
+
Zt as DATA_PROTECTION,
|
|
2542
|
+
rr as DEVICE_ANALYTICS,
|
|
2512
2543
|
T as DeviceType,
|
|
2513
|
-
|
|
2544
|
+
er as ENGAGEMENT_THRESHOLDS,
|
|
2514
2545
|
K as EmitterEvent,
|
|
2515
|
-
|
|
2546
|
+
b as ErrorType,
|
|
2516
2547
|
d as EventType,
|
|
2517
|
-
|
|
2518
|
-
|
|
2548
|
+
nr as INSIGHT_THRESHOLDS,
|
|
2549
|
+
qt as InitializationTimeoutError,
|
|
2519
2550
|
v as IntegrationValidationError,
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2551
|
+
Wt as MAX_ARRAY_LENGTH,
|
|
2552
|
+
zt as MAX_CUSTOM_EVENT_ARRAY_SIZE,
|
|
2553
|
+
$t as MAX_CUSTOM_EVENT_KEYS,
|
|
2554
|
+
Ft as MAX_CUSTOM_EVENT_NAME_LENGTH,
|
|
2555
|
+
Gt as MAX_CUSTOM_EVENT_STRING_SIZE,
|
|
2556
|
+
Bt as MAX_METADATA_NESTING_DEPTH,
|
|
2557
|
+
Qt as MAX_NESTED_OBJECT_KEYS,
|
|
2558
|
+
jt as MAX_STRING_LENGTH,
|
|
2559
|
+
Xt as MAX_STRING_LENGTH_IN_ARRAY,
|
|
2560
|
+
C as Mode,
|
|
2561
|
+
Jt as PERFORMANCE_CONFIG,
|
|
2562
|
+
M as PermanentError,
|
|
2563
|
+
ar as SEGMENTATION_ANALYTICS,
|
|
2564
|
+
tr as SESSION_ANALYTICS,
|
|
2565
|
+
cr as SPECIAL_PAGE_URLS,
|
|
2566
|
+
de as SamplingRateValidationError,
|
|
2536
2567
|
U as ScrollDirection,
|
|
2537
|
-
|
|
2568
|
+
He as SessionTimeoutValidationError,
|
|
2538
2569
|
Y as SpecialApiUrl,
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2570
|
+
ir as TEMPORAL_ANALYSIS,
|
|
2571
|
+
O as TraceLogValidationError,
|
|
2572
|
+
Yt as isPrimaryScrollEvent,
|
|
2573
|
+
Kt as isSecondaryScrollEvent,
|
|
2574
|
+
ur as tracelog
|
|
2544
2575
|
};
|