@tracelog/lib 2.6.1 → 2.6.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.
@@ -290,7 +290,7 @@ const Ot = () => {
290
290
  default:
291
291
  return We;
292
292
  }
293
- }, Bt = 1e3, Wt = 50, Gt = "2.6.0", Xt = Gt, nt = () => typeof window < "u" && typeof sessionStorage < "u", Qt = () => {
293
+ }, Bt = 1e3, Wt = 50, Gt = "2.6.1", Xt = Gt, nt = () => typeof window < "u" && typeof sessionStorage < "u", Qt = () => {
294
294
  try {
295
295
  const s = new URLSearchParams(window.location.search);
296
296
  s.delete(Je);
@@ -2543,11 +2543,15 @@ class fr extends w {
2543
2543
  const r = Math.round((e.click_data.x || 0) / 10) * 10, n = Math.round((e.click_data.y || 0) / 10) * 10;
2544
2544
  t += `_click_${r}_${n}`;
2545
2545
  }
2546
- 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;
2546
+ return e.scroll_data && (t += `_scroll_${e.scroll_data.depth}_${e.scroll_data.direction}`), e.custom_event && (t += `_custom_${e.custom_event.name}`, e.custom_event.metadata && (t += `_${this.stableStringify(e.custom_event.metadata)}`)), e.web_vitals && (t += `_vitals_${e.web_vitals.type}`), e.error_data && (t += `_error_${e.error_data.type}_${e.error_data.message}`), t;
2547
2547
  }
2548
2548
  createEventSignature(e) {
2549
2549
  return this.createEventFingerprint(e);
2550
2550
  }
2551
+ /** Deterministic JSON string with sorted keys to ensure consistent fingerprints regardless of property insertion order */
2552
+ stableStringify(e) {
2553
+ return JSON.stringify(e, (t, r) => r && typeof r == "object" && !Array.isArray(r) ? Object.keys(r).sort().reduce((n, i) => (n[i] = r[i], n), {}) : r);
2554
+ }
2551
2555
  addToQueue(e) {
2552
2556
  if (this.emitEvent(e), this.eventsQueue.push(e), this.eventsQueue.length > 100) {
2553
2557
  const t = this.eventsQueue.findIndex((n) => n.type !== d.SESSION_START), r = t >= 0 ? this.eventsQueue.splice(t, 1)[0] : this.eventsQueue.shift();