@tracelog/lib 0.12.1 → 0.12.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/tracelog.esm.js +22 -20
- 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/public-api.cjs +7 -1
- package/dist/public-api.cjs.map +1 -1
- package/dist/public-api.js +7 -1
- package/dist/public-api.js.map +1 -1
- package/package.json +1 -1
|
@@ -72,7 +72,7 @@ const f = {
|
|
|
72
72
|
INVALID_VIEWPORT_MIN_DWELL_TIME: "Viewport minDwellTime must be a non-negative number",
|
|
73
73
|
INVALID_VIEWPORT_COOLDOWN_PERIOD: "Viewport cooldownPeriod must be a non-negative number",
|
|
74
74
|
INVALID_VIEWPORT_MAX_TRACKED_ELEMENTS: "Viewport maxTrackedElements must be a positive number"
|
|
75
|
-
},
|
|
75
|
+
}, je = [
|
|
76
76
|
/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
|
|
77
77
|
/javascript:/gi,
|
|
78
78
|
/on\w+\s*=/gi,
|
|
@@ -98,7 +98,7 @@ class h extends k {
|
|
|
98
98
|
super(e, "APP_CONFIG_INVALID", t);
|
|
99
99
|
}
|
|
100
100
|
}
|
|
101
|
-
class
|
|
101
|
+
class Qe extends k {
|
|
102
102
|
constructor(e, t = "config") {
|
|
103
103
|
super(e, "SESSION_TIMEOUT_INVALID", t);
|
|
104
104
|
}
|
|
@@ -351,7 +351,7 @@ const Ye = () => {
|
|
|
351
351
|
let e = s;
|
|
352
352
|
s.length > 1e3 && (e = s.slice(0, Math.max(0, 1e3)));
|
|
353
353
|
let t = 0;
|
|
354
|
-
for (const n of
|
|
354
|
+
for (const n of je) {
|
|
355
355
|
const i = e;
|
|
356
356
|
e = e.replace(n, ""), i !== e && t++;
|
|
357
357
|
}
|
|
@@ -399,7 +399,7 @@ const Ye = () => {
|
|
|
399
399
|
throw new h("Configuration must be an object", "config");
|
|
400
400
|
if (s) {
|
|
401
401
|
if (s.sessionTimeout !== void 0 && (typeof s.sessionTimeout != "number" || s.sessionTimeout < 3e4 || s.sessionTimeout > 864e5))
|
|
402
|
-
throw new
|
|
402
|
+
throw new Qe(f.INVALID_SESSION_TIMEOUT, "config");
|
|
403
403
|
if (s.globalMetadata !== void 0 && (typeof s.globalMetadata != "object" || s.globalMetadata === null))
|
|
404
404
|
throw new h(f.INVALID_GLOBAL_METADATA, "config");
|
|
405
405
|
if (s.integrations && St(s.integrations), s.sensitiveQueryParams !== void 0) {
|
|
@@ -1006,12 +1006,12 @@ class At extends T {
|
|
|
1006
1006
|
}
|
|
1007
1007
|
const y = this.getTypeLimitForEvent(S);
|
|
1008
1008
|
if (y) {
|
|
1009
|
-
const
|
|
1010
|
-
if (
|
|
1009
|
+
const Q = this.sessionEventCounts[S];
|
|
1010
|
+
if (Q !== void 0 && Q >= y) {
|
|
1011
1011
|
a("warn", "Session event type limit reached", {
|
|
1012
1012
|
data: {
|
|
1013
1013
|
type: S,
|
|
1014
|
-
count:
|
|
1014
|
+
count: Q,
|
|
1015
1015
|
limit: y
|
|
1016
1016
|
}
|
|
1017
1017
|
});
|
|
@@ -1024,7 +1024,7 @@ class At extends T {
|
|
|
1024
1024
|
if (!this.checkPerEventRateLimit(o.name, y))
|
|
1025
1025
|
return;
|
|
1026
1026
|
}
|
|
1027
|
-
const We = S === u.SESSION_START, Be = t || this.get("pageUrl"),
|
|
1027
|
+
const We = S === u.SESSION_START, Be = t || this.get("pageUrl"), j = this.buildEventPayload({
|
|
1028
1028
|
type: S,
|
|
1029
1029
|
page_url: Be,
|
|
1030
1030
|
from_page_url: r,
|
|
@@ -1051,7 +1051,7 @@ class At extends T {
|
|
|
1051
1051
|
}
|
|
1052
1052
|
this.set("hasStartSession", !0);
|
|
1053
1053
|
}
|
|
1054
|
-
if (!this.isDuplicateEvent(
|
|
1054
|
+
if (!this.isDuplicateEvent(j)) {
|
|
1055
1055
|
if (this.get("mode") === V.QA && S === u.CUSTOM && o) {
|
|
1056
1056
|
a("info", "Event", {
|
|
1057
1057
|
showToClient: !0,
|
|
@@ -1059,10 +1059,10 @@ class At extends T {
|
|
|
1059
1059
|
name: o.name,
|
|
1060
1060
|
...o.metadata && { metadata: o.metadata }
|
|
1061
1061
|
}
|
|
1062
|
-
}), this.emitEvent(
|
|
1062
|
+
}), this.emitEvent(j);
|
|
1063
1063
|
return;
|
|
1064
1064
|
}
|
|
1065
|
-
this.addToQueue(
|
|
1065
|
+
this.addToQueue(j), v || (this.sessionEventCounts.total++, this.sessionEventCounts[S] !== void 0 && this.sessionEventCounts[S]++);
|
|
1066
1066
|
}
|
|
1067
1067
|
}
|
|
1068
1068
|
}
|
|
@@ -2685,17 +2685,19 @@ class Ut extends T {
|
|
|
2685
2685
|
sendCustomEvent(e, t) {
|
|
2686
2686
|
if (!this.managers.event)
|
|
2687
2687
|
return;
|
|
2688
|
-
|
|
2689
|
-
|
|
2688
|
+
let r = t;
|
|
2689
|
+
t && typeof t == "object" && !Array.isArray(t) && Object.getPrototypeOf(t) !== Object.prototype && (r = Object.assign({}, t));
|
|
2690
|
+
const { valid: n, error: i, sanitizedMetadata: o } = vt(e, r);
|
|
2691
|
+
if (!n) {
|
|
2690
2692
|
if (this.get("mode") === V.QA)
|
|
2691
|
-
throw new Error(`[TraceLog] Custom event "${e}" validation failed: ${
|
|
2693
|
+
throw new Error(`[TraceLog] Custom event "${e}" validation failed: ${i}`);
|
|
2692
2694
|
return;
|
|
2693
2695
|
}
|
|
2694
2696
|
this.managers.event.track({
|
|
2695
2697
|
type: u.CUSTOM,
|
|
2696
2698
|
custom_event: {
|
|
2697
2699
|
name: e,
|
|
2698
|
-
...
|
|
2700
|
+
...o && { metadata: o }
|
|
2699
2701
|
}
|
|
2700
2702
|
});
|
|
2701
2703
|
}
|
|
@@ -2971,14 +2973,14 @@ var ie, Ve = -1, O = function(s) {
|
|
|
2971
2973
|
}));
|
|
2972
2974
|
})), setTimeout(t, 0));
|
|
2973
2975
|
})));
|
|
2974
|
-
}, He = 0, Y = 1 / 0, H = 0,
|
|
2976
|
+
}, He = 0, Y = 1 / 0, H = 0, jt = function(s) {
|
|
2975
2977
|
s.forEach((function(e) {
|
|
2976
2978
|
e.interactionId && (Y = Math.min(Y, e.interactionId), H = Math.max(H, e.interactionId), He = H ? (H - Y) / 7 + 1 : 0);
|
|
2977
2979
|
}));
|
|
2978
2980
|
}, xe = function() {
|
|
2979
2981
|
return ie ? He : performance.interactionCount || 0;
|
|
2980
|
-
},
|
|
2981
|
-
"interactionCount" in performance || ie || (ie = U("event",
|
|
2982
|
+
}, Qt = function() {
|
|
2983
|
+
"interactionCount" in performance || ie || (ie = U("event", jt, { type: "event", buffered: !0, durationThreshold: 0 }));
|
|
2982
2984
|
}, p = [], W = /* @__PURE__ */ new Map(), Fe = 0, Kt = function() {
|
|
2983
2985
|
var s = Math.min(p.length - 1, Math.floor((xe() - Fe) / 50));
|
|
2984
2986
|
return p[s];
|
|
@@ -3006,7 +3008,7 @@ var ie, Ve = -1, O = function(s) {
|
|
|
3006
3008
|
}, le = [200, 500], Zt = function(s, e) {
|
|
3007
3009
|
"PerformanceEventTiming" in self && "interactionId" in PerformanceEventTiming.prototype && (e = e || {}, z((function() {
|
|
3008
3010
|
var t;
|
|
3009
|
-
|
|
3011
|
+
Qt();
|
|
3010
3012
|
var r, n = _("INP"), i = function(l) {
|
|
3011
3013
|
Ge((function() {
|
|
3012
3014
|
l.forEach(qt);
|
|
@@ -3101,7 +3103,7 @@ export {
|
|
|
3101
3103
|
Ir as SPECIAL_PAGE_URLS,
|
|
3102
3104
|
Ee as SamplingRateValidationError,
|
|
3103
3105
|
x as ScrollDirection,
|
|
3104
|
-
|
|
3106
|
+
Qe as SessionTimeoutValidationError,
|
|
3105
3107
|
Z as SpecialApiUrl,
|
|
3106
3108
|
k as TraceLogValidationError,
|
|
3107
3109
|
mr as WEB_VITALS_GOOD_THRESHOLDS,
|