@tamsensedev/dataclient 0.1.10 → 0.2.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/README.md +33 -1
- package/dist/index.cjs +143 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.global.js +143 -23
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +143 -23
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -330,6 +330,8 @@ var RrwebTracker = class {
|
|
|
330
330
|
sender;
|
|
331
331
|
stopFn = null;
|
|
332
332
|
start() {
|
|
333
|
+
const scoped = this.config.scoped;
|
|
334
|
+
const blockSelector = scoped ? `:not([${scoped}]):not([${scoped}] *):not(:has([${scoped}]))` : void 0;
|
|
333
335
|
this.stopFn = record({
|
|
334
336
|
emit: (event) => {
|
|
335
337
|
const rrwebEvent = {
|
|
@@ -344,6 +346,7 @@ var RrwebTracker = class {
|
|
|
344
346
|
maskTextSelector: MASK_SELECTOR,
|
|
345
347
|
maskInputOptions: { password: true },
|
|
346
348
|
maskTextFn: (text) => "*".repeat(text.length),
|
|
349
|
+
blockSelector,
|
|
347
350
|
sampling: {
|
|
348
351
|
mousemove: false,
|
|
349
352
|
mouseInteraction: true,
|
|
@@ -367,26 +370,33 @@ var RrwebTracker = class {
|
|
|
367
370
|
|
|
368
371
|
// src/trackers/action.ts
|
|
369
372
|
var ActionTracker = class {
|
|
370
|
-
constructor(config, sender) {
|
|
373
|
+
constructor(config, sender, root) {
|
|
371
374
|
this.config = config;
|
|
372
375
|
this.sender = sender;
|
|
376
|
+
this.root = root;
|
|
373
377
|
}
|
|
374
378
|
config;
|
|
375
379
|
sender;
|
|
380
|
+
root;
|
|
376
381
|
inputTimers = /* @__PURE__ */ new WeakMap();
|
|
377
382
|
pendingInputs = /* @__PURE__ */ new Set();
|
|
378
383
|
handleClick = (e) => this.onClick(e);
|
|
379
384
|
handleInput = (e) => this.onInput(e);
|
|
380
385
|
handleChange = (e) => this.onChange(e);
|
|
386
|
+
get listenerTarget() {
|
|
387
|
+
return this.config.scoped ? this.root : document;
|
|
388
|
+
}
|
|
381
389
|
start() {
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
390
|
+
const target = this.listenerTarget;
|
|
391
|
+
target.addEventListener("click", this.handleClick, true);
|
|
392
|
+
target.addEventListener("input", this.handleInput, true);
|
|
393
|
+
target.addEventListener("change", this.handleChange, true);
|
|
385
394
|
}
|
|
386
395
|
stop() {
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
396
|
+
const target = this.listenerTarget;
|
|
397
|
+
target.removeEventListener("click", this.handleClick, true);
|
|
398
|
+
target.removeEventListener("input", this.handleInput, true);
|
|
399
|
+
target.removeEventListener("change", this.handleChange, true);
|
|
390
400
|
}
|
|
391
401
|
beforeUnload() {
|
|
392
402
|
for (const el of this.pendingInputs) {
|
|
@@ -540,7 +550,7 @@ var ActionTracker = class {
|
|
|
540
550
|
}
|
|
541
551
|
findMeaningfulElement(el) {
|
|
542
552
|
let current = el;
|
|
543
|
-
while (current && current !== document.body) {
|
|
553
|
+
while (current && current !== this.root && current !== document.body) {
|
|
544
554
|
if (INTERACTIVE_TAGS.has(current.tagName?.toLowerCase())) {
|
|
545
555
|
return current;
|
|
546
556
|
}
|
|
@@ -556,13 +566,15 @@ var ActionTracker = class {
|
|
|
556
566
|
|
|
557
567
|
// src/trackers/mutation.ts
|
|
558
568
|
var MutationTracker = class {
|
|
559
|
-
constructor(config, sender, onMutation) {
|
|
569
|
+
constructor(config, sender, root, onMutation) {
|
|
560
570
|
this.config = config;
|
|
561
571
|
this.sender = sender;
|
|
572
|
+
this.root = root;
|
|
562
573
|
this.onMutation = onMutation;
|
|
563
574
|
}
|
|
564
575
|
config;
|
|
565
576
|
sender;
|
|
577
|
+
root;
|
|
566
578
|
onMutation;
|
|
567
579
|
observer = null;
|
|
568
580
|
debounceTimer = null;
|
|
@@ -572,7 +584,7 @@ var MutationTracker = class {
|
|
|
572
584
|
pendingAttrChanges = [];
|
|
573
585
|
start() {
|
|
574
586
|
this.observer = new MutationObserver((mutations) => this.handleMutations(mutations));
|
|
575
|
-
this.observer.observe(
|
|
587
|
+
this.observer.observe(this.root, {
|
|
576
588
|
childList: true,
|
|
577
589
|
subtree: true,
|
|
578
590
|
characterData: true,
|
|
@@ -677,12 +689,14 @@ var MutationTracker = class {
|
|
|
677
689
|
|
|
678
690
|
// src/trackers/snapshot.ts
|
|
679
691
|
var SnapshotTracker = class {
|
|
680
|
-
constructor(config, sender) {
|
|
692
|
+
constructor(config, sender, root) {
|
|
681
693
|
this.config = config;
|
|
682
694
|
this.sender = sender;
|
|
695
|
+
this.root = root;
|
|
683
696
|
}
|
|
684
697
|
config;
|
|
685
698
|
sender;
|
|
699
|
+
root;
|
|
686
700
|
lastUrl = "";
|
|
687
701
|
urlPollTimer = null;
|
|
688
702
|
checkpointTimer = null;
|
|
@@ -716,7 +730,7 @@ var SnapshotTracker = class {
|
|
|
716
730
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
717
731
|
url: location.href,
|
|
718
732
|
title: document.title,
|
|
719
|
-
tree: serializeTree(
|
|
733
|
+
tree: serializeTree(this.root),
|
|
720
734
|
viewport: getViewport()
|
|
721
735
|
};
|
|
722
736
|
if (this.config.debug) {
|
|
@@ -889,8 +903,10 @@ var defaults = {
|
|
|
889
903
|
inputDebounce: 1e3,
|
|
890
904
|
sessionIdKey: "sc2_sid",
|
|
891
905
|
deviceIdKey: "sc2_did",
|
|
892
|
-
apiKey: ""
|
|
906
|
+
apiKey: "",
|
|
907
|
+
scoped: ""
|
|
893
908
|
};
|
|
909
|
+
var VALID_ATTR_NAME = /^[a-z][\w-]*$/i;
|
|
894
910
|
var DataClient = class {
|
|
895
911
|
sender = null;
|
|
896
912
|
trackers = [];
|
|
@@ -898,13 +914,21 @@ var DataClient = class {
|
|
|
898
914
|
deviceId;
|
|
899
915
|
idleTimer = null;
|
|
900
916
|
userId = null;
|
|
917
|
+
rootEl = null;
|
|
918
|
+
scopeObserver = null;
|
|
919
|
+
scopeCheckScheduled = false;
|
|
920
|
+
activityHandler = null;
|
|
921
|
+
activityTarget = null;
|
|
901
922
|
constructor(options) {
|
|
902
923
|
this.config = { ...defaults, ...options };
|
|
924
|
+
this.config.scoped = this.normalizeScoped(this.config.scoped);
|
|
903
925
|
this.deviceId = getDeviceId(this.config.deviceIdKey);
|
|
904
|
-
this.
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
926
|
+
if (this.config.scoped) {
|
|
927
|
+
this.startScopedMode();
|
|
928
|
+
} else {
|
|
929
|
+
this.startSession(document.body);
|
|
930
|
+
this.attachActivityListeners(document);
|
|
931
|
+
}
|
|
908
932
|
}
|
|
909
933
|
setUser(userId) {
|
|
910
934
|
this.userId = userId;
|
|
@@ -913,10 +937,86 @@ var DataClient = class {
|
|
|
913
937
|
excludeSession(reason = "") {
|
|
914
938
|
this.sender?.add({ event: "exclude", timestamp: (/* @__PURE__ */ new Date()).toISOString(), reason });
|
|
915
939
|
this.stopSession();
|
|
940
|
+
if (this.scopeObserver) {
|
|
941
|
+
this.scopeObserver.disconnect();
|
|
942
|
+
this.scopeObserver = null;
|
|
943
|
+
}
|
|
944
|
+
this.detachActivityListeners();
|
|
945
|
+
}
|
|
946
|
+
normalizeScoped(value) {
|
|
947
|
+
if (!value) {
|
|
948
|
+
return "";
|
|
949
|
+
}
|
|
950
|
+
if (!VALID_ATTR_NAME.test(value)) {
|
|
951
|
+
if (this.config.debug) {
|
|
952
|
+
console.warn(`[dataclient] invalid "scoped" attribute name: ${JSON.stringify(value)}. Falling back to non-scoped mode.`);
|
|
953
|
+
}
|
|
954
|
+
return "";
|
|
955
|
+
}
|
|
956
|
+
return value;
|
|
957
|
+
}
|
|
958
|
+
startScopedMode() {
|
|
959
|
+
const initial = this.findRoot();
|
|
960
|
+
if (initial) {
|
|
961
|
+
this.onRootAppeared(initial);
|
|
962
|
+
}
|
|
963
|
+
this.scopeObserver = new MutationObserver(() => this.scheduleScopeCheck());
|
|
964
|
+
this.scopeObserver.observe(document.body, { childList: true, subtree: true });
|
|
965
|
+
if (this.config.debug) {
|
|
966
|
+
console.log(`[dataclient] scoped mode: watching for [${this.config.scoped}]`);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
findRoot() {
|
|
970
|
+
return document.querySelector(`[${this.config.scoped}]`);
|
|
971
|
+
}
|
|
972
|
+
scheduleScopeCheck() {
|
|
973
|
+
if (this.scopeCheckScheduled) {
|
|
974
|
+
return;
|
|
975
|
+
}
|
|
976
|
+
this.scopeCheckScheduled = true;
|
|
977
|
+
queueMicrotask(() => {
|
|
978
|
+
this.scopeCheckScheduled = false;
|
|
979
|
+
this.handleScopeChange();
|
|
980
|
+
});
|
|
981
|
+
}
|
|
982
|
+
handleScopeChange() {
|
|
983
|
+
const current = this.findRoot();
|
|
984
|
+
if (current === this.rootEl) {
|
|
985
|
+
return;
|
|
986
|
+
}
|
|
987
|
+
if (this.rootEl) {
|
|
988
|
+
this.onRootDisappeared();
|
|
989
|
+
}
|
|
990
|
+
if (current) {
|
|
991
|
+
this.onRootAppeared(current);
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
onRootAppeared(root) {
|
|
995
|
+
this.rootEl = root;
|
|
996
|
+
this.attachActivityListeners(root);
|
|
997
|
+
this.startSession(root);
|
|
998
|
+
if (this.config.debug) {
|
|
999
|
+
console.log(`[dataclient] root [${this.config.scoped}] appeared`);
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
onRootDisappeared() {
|
|
1003
|
+
if (this.config.debug) {
|
|
1004
|
+
console.log(`[dataclient] root [${this.config.scoped}] removed`);
|
|
1005
|
+
}
|
|
1006
|
+
this.detachActivityListeners();
|
|
1007
|
+
this.stopSession();
|
|
1008
|
+
this.rootEl = null;
|
|
916
1009
|
}
|
|
917
1010
|
onActivity() {
|
|
918
1011
|
if (!this.sender) {
|
|
919
|
-
this.
|
|
1012
|
+
if (this.config.scoped) {
|
|
1013
|
+
if (!this.rootEl) {
|
|
1014
|
+
return;
|
|
1015
|
+
}
|
|
1016
|
+
this.startSession(this.rootEl);
|
|
1017
|
+
} else {
|
|
1018
|
+
this.startSession(document.body);
|
|
1019
|
+
}
|
|
920
1020
|
}
|
|
921
1021
|
this.resetIdleTimer();
|
|
922
1022
|
}
|
|
@@ -925,7 +1025,26 @@ var DataClient = class {
|
|
|
925
1025
|
clearTimeout(this.idleTimer);
|
|
926
1026
|
this.idleTimer = setTimeout(() => this.stopSession(), this.config.idleTimeout);
|
|
927
1027
|
}
|
|
928
|
-
|
|
1028
|
+
attachActivityListeners(target) {
|
|
1029
|
+
this.detachActivityListeners();
|
|
1030
|
+
const handler = () => this.onActivity();
|
|
1031
|
+
target.addEventListener("click", handler, true);
|
|
1032
|
+
target.addEventListener("input", handler, true);
|
|
1033
|
+
target.addEventListener("change", handler, true);
|
|
1034
|
+
this.activityHandler = handler;
|
|
1035
|
+
this.activityTarget = target;
|
|
1036
|
+
}
|
|
1037
|
+
detachActivityListeners() {
|
|
1038
|
+
if (!this.activityHandler || !this.activityTarget) {
|
|
1039
|
+
return;
|
|
1040
|
+
}
|
|
1041
|
+
this.activityTarget.removeEventListener("click", this.activityHandler, true);
|
|
1042
|
+
this.activityTarget.removeEventListener("input", this.activityHandler, true);
|
|
1043
|
+
this.activityTarget.removeEventListener("change", this.activityHandler, true);
|
|
1044
|
+
this.activityHandler = null;
|
|
1045
|
+
this.activityTarget = null;
|
|
1046
|
+
}
|
|
1047
|
+
startSession(root) {
|
|
929
1048
|
const sessionId = generateId();
|
|
930
1049
|
this.sender = new Sender(
|
|
931
1050
|
this.config.endpoint,
|
|
@@ -935,9 +1054,9 @@ var DataClient = class {
|
|
|
935
1054
|
this.deviceId,
|
|
936
1055
|
this.config.flushInterval
|
|
937
1056
|
);
|
|
938
|
-
const snapshotTracker = new SnapshotTracker(this.config, this.sender);
|
|
939
|
-
const mutationTracker = new MutationTracker(this.config, this.sender, () => snapshotTracker.markMutation());
|
|
940
|
-
const actionTracker = new ActionTracker(this.config, this.sender);
|
|
1057
|
+
const snapshotTracker = new SnapshotTracker(this.config, this.sender, root);
|
|
1058
|
+
const mutationTracker = new MutationTracker(this.config, this.sender, root, () => snapshotTracker.markMutation());
|
|
1059
|
+
const actionTracker = new ActionTracker(this.config, this.sender, root);
|
|
941
1060
|
const rrwebTracker = new RrwebTracker(this.config, this.sender);
|
|
942
1061
|
this.trackers = [snapshotTracker, mutationTracker, actionTracker, rrwebTracker];
|
|
943
1062
|
this.trackers.forEach((t) => t.start());
|
|
@@ -963,6 +1082,7 @@ var DataClient = class {
|
|
|
963
1082
|
clearTimeout(this.idleTimer);
|
|
964
1083
|
this.idleTimer = null;
|
|
965
1084
|
}
|
|
1085
|
+
this.trackers.forEach((t) => t.beforeUnload?.());
|
|
966
1086
|
this.trackers.forEach((t) => t.stop());
|
|
967
1087
|
this.trackers = [];
|
|
968
1088
|
if (this.sender) {
|
|
@@ -970,7 +1090,7 @@ var DataClient = class {
|
|
|
970
1090
|
this.sender = null;
|
|
971
1091
|
}
|
|
972
1092
|
if (this.config.debug) {
|
|
973
|
-
console.log("[dataclient] Session stopped
|
|
1093
|
+
console.log("[dataclient] Session stopped");
|
|
974
1094
|
}
|
|
975
1095
|
}
|
|
976
1096
|
};
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/constants.ts","../src/dom/mask.ts","../src/dom/icon.ts","../src/dom/serializer.ts","../src/dom/viewport.ts","../src/trackers/rrweb.ts","../src/trackers/action.ts","../src/trackers/mutation.ts","../src/trackers/snapshot.ts","../src/utils/identity.ts","../src/utils/sender.ts","../src/index.ts"],"sourcesContent":["export const MASK_ATTR = 'dataclient-mask'\nexport const MASK_SELECTOR = `[${MASK_ATTR}]`\n\nexport const SKIP_TAGS = new Set(['script', 'style', 'noscript', 'svg', 'link', 'meta', 'head'])\n\nexport const RECORD_ATTRS = new Set([\n 'class',\n 'role',\n 'href',\n 'type',\n 'placeholder',\n 'disabled',\n 'hidden',\n 'aria-label',\n 'aria-selected',\n 'aria-expanded',\n 'aria-invalid',\n 'aria-busy',\n 'aria-checked',\n 'aria-hidden',\n 'value',\n 'name',\n 'id',\n 'for',\n 'target',\n 'data-state',\n MASK_ATTR,\n])\n\nexport const WATCH_ATTRS = [\n 'class',\n 'role',\n 'href',\n 'disabled',\n 'hidden',\n 'placeholder',\n 'aria-label',\n 'aria-selected',\n 'aria-expanded',\n 'aria-invalid',\n 'aria-busy',\n 'aria-checked',\n 'aria-hidden',\n 'data-state',\n 'value',\n]\n\nexport const TEXT_INPUT_TYPES = new Set(['text', 'email', 'password', 'search', 'tel', 'url', 'number'])\n\nexport const INTERACTIVE_TAGS = new Set(['button', 'a', 'input', 'select', 'textarea'])\nexport const INTERACTIVE_ROLES = new Set(['button', 'link', 'tab', 'menuitem', 'checkbox', 'radio', 'switch', 'option'])\n","import { MASK_SELECTOR } from '../constants'\n\nexport function isMasked(el: Element | Node | null): boolean {\n if (!el)\n return false\n const element = el.nodeType === Node.ELEMENT_NODE\n ? el as Element\n : el.parentElement\n return !!element?.closest(MASK_SELECTOR)\n}\n\nexport function maskText(text: string): string {\n if (!text) {\n return text\n }\n const visible = Math.max(1, Math.ceil(text.length * 0.2))\n return text.slice(0, visible) + '*'.repeat(text.length - visible)\n}\n\nexport function maskValue(el: Element | null, value: string): string {\n return isMasked(el) ? maskText(value) : value\n}\n","const ICON_CLASS_PATTERNS = [\n /\\bfa-([a-z0-9-]+)\\b/,\n /\\bmdi-([a-z0-9-]+)\\b/,\n /\\bbi-([a-z0-9-]+)\\b/,\n /\\bicon-([a-z0-9-]+)\\b/,\n /\\blucide-([a-z0-9-]+)\\b/,\n /\\bri-([a-z0-9-]+)\\b/,\n /\\btabler-icon-([a-z0-9-]+)\\b/,\n /\\bi-[a-z0-9-]+[:/]([a-z0-9-]+)\\b/,\n]\n\nconst MATERIAL_CLASS_PATTERN = /\\b(?:material-icons|material-symbols-[a-z]+)\\b/\nconst SVG_USE_HREF_PATTERN = /#(.+)/\n\nconst MAX_ICON_IMG_SIZE = 48\n\nexport function getElementIcon(el: HTMLElement): string | null {\n if (!el) {\n return null\n }\n\n const direct = detectIcon(el)\n if (direct) {\n return direct\n }\n\n for (const child of el.children) {\n const icon = detectIcon(child as HTMLElement)\n if (icon) {\n return icon\n }\n }\n\n return null\n}\n\nfunction detectIcon(el: HTMLElement): string | null {\n if (!el?.tagName) {\n return null\n }\n\n const tag = el.tagName.toLowerCase()\n\n if (tag === 'svg') {\n return detectSvgIcon(el)\n }\n\n if (tag === 'i' || tag === 'span' || el.classList.contains('iconify')) {\n return detectFontIcon(el)\n }\n\n if (tag === 'img') {\n return detectImgIcon(el as HTMLImageElement)\n }\n\n const svg = el.querySelector('svg')\n if (svg) {\n return detectSvgIcon(svg)\n }\n\n return null\n}\n\nfunction detectSvgIcon(svg: Element): string | null {\n const lucide = svg.getAttribute('data-lucide')\n if (lucide) {\n return lucide\n }\n\n const dataIcon = svg.getAttribute('data-icon')\n if (dataIcon) {\n return dataIcon\n }\n\n const use = svg.querySelector('use')\n if (use) {\n const href = use.getAttribute('href') || use.getAttribute('xlink:href')\n if (href) {\n const match = href.match(SVG_USE_HREF_PATTERN)\n if (match) {\n return match[1]\n }\n }\n }\n\n const ariaLabel = svg.getAttribute('aria-label')\n if (ariaLabel) {\n return ariaLabel\n }\n\n const cls = typeof svg.className === 'string' ? svg.className : svg.getAttribute('class') || ''\n const fromClass = extractIconNameFromClass(cls)\n if (fromClass) {\n return fromClass\n }\n\n return null\n}\n\nfunction detectFontIcon(el: HTMLElement): string | null {\n const cls = typeof el.className === 'string' ? el.className : el.getAttribute('class') || ''\n\n if (MATERIAL_CLASS_PATTERN.test(cls)) {\n const text = el.textContent?.trim()\n if (text) {\n return text\n }\n }\n\n return extractIconNameFromClass(cls)\n}\n\nfunction detectImgIcon(img: HTMLImageElement): string | null {\n if (img.width > MAX_ICON_IMG_SIZE || img.height > MAX_ICON_IMG_SIZE) {\n return null\n }\n\n if (img.naturalWidth > MAX_ICON_IMG_SIZE || img.naturalHeight > MAX_ICON_IMG_SIZE) {\n return null\n }\n\n const alt = img.alt?.trim()\n if (alt) {\n return alt\n }\n\n const src = img.getAttribute('src')\n if (src) {\n const filename = src.split('/').pop()?.split('?')[0]?.split('.')[0]\n if (filename) {\n return filename\n }\n }\n\n return null\n}\n\nfunction extractIconNameFromClass(cls: string): string | null {\n for (const pattern of ICON_CLASS_PATTERNS) {\n const match = cls.match(pattern)\n if (match) {\n return match[1]\n }\n }\n return null\n}\n","import type { SerializedNode } from '../types'\nimport { RECORD_ATTRS, SKIP_TAGS } from '../constants'\nimport { getElementIcon } from './icon'\nimport { isMasked, maskText } from './mask'\n\nlet nextId = 1\nconst nodeToId = new WeakMap<Node, number>()\nconst idToNode = new Map<number, Node>()\n\nexport function resetIds() {\n nextId = 1\n idToNode.clear()\n}\n\nexport function assignId(node: Node): number {\n const existing = nodeToId.get(node)\n if (existing) {\n return existing\n }\n const id = nextId++\n nodeToId.set(node, id)\n idToNode.set(id, node)\n return id\n}\n\nexport function getNodeId(node: Node): number | null {\n return nodeToId.get(node) ?? null\n}\n\nexport function getNodeById(id: number): Node | null {\n return idToNode.get(id) ?? null\n}\n\nexport function removeNodeId(id: number) {\n const node = idToNode.get(id)\n if (node) {\n nodeToId.delete(node)\n idToNode.delete(id)\n }\n}\n\nfunction isVisible(el: HTMLElement): boolean {\n if (el.hidden)\n return false\n if (el.getAttribute('aria-hidden') === 'true')\n return false\n if (!el.offsetParent && el.tagName !== 'BODY' && getComputedStyle(el).position !== 'fixed') {\n return false\n }\n return true\n}\n\nfunction getDirectText(el: HTMLElement): string {\n let text = ''\n for (const child of el.childNodes) {\n if (child.nodeType === Node.TEXT_NODE) {\n const t = child.textContent?.trim()\n if (t) {\n text += (text ? ' ' : '') + t\n }\n }\n }\n const truncated = text.slice(0, 200)\n return isMasked(el) ? maskText(truncated) : truncated\n}\n\nfunction getAttrs(el: HTMLElement): Record<string, string> | undefined {\n const attrs: Record<string, string> = {}\n let hasAttrs = false\n const masked = isMasked(el)\n\n for (const name of RECORD_ATTRS) {\n const value = el.getAttribute(name)\n if (value !== null && value !== '') {\n let v = value.slice(0, 200)\n if (masked && (name === 'value' || name === 'placeholder')) {\n v = maskText(v)\n }\n attrs[name] = v\n hasAttrs = true\n }\n }\n\n return hasAttrs ? attrs : undefined\n}\n\nfunction getRect(el: HTMLElement): SerializedNode['rect'] {\n const r = el.getBoundingClientRect()\n if (r.width === 0 && r.height === 0) {\n return undefined\n }\n return {\n x: Math.round(r.left + window.scrollX),\n y: Math.round(r.top + window.scrollY),\n w: Math.round(r.width),\n h: Math.round(r.height),\n }\n}\n\nfunction collectNode(el: HTMLElement, out: SerializedNode[]): SerializedNode | null {\n const tag = el.tagName?.toLowerCase()\n if (!tag || SKIP_TAGS.has(tag)) {\n return null\n }\n if (!isVisible(el)) {\n return null\n }\n\n const id = assignId(el)\n const text = getDirectText(el)\n const icon = getElementIcon(el)\n const attrs = getAttrs(el)\n const rect = getRect(el)\n\n const node: SerializedNode = { id, tag }\n if (text) {\n node.text = text\n }\n if (icon) {\n node.icon = icon\n }\n if (attrs) {\n node.attrs = attrs\n }\n if (rect) {\n node.rect = rect\n }\n\n out.push(node)\n\n const childrenIds: number[] = []\n for (const child of el.children) {\n const childNode = collectNode(child as HTMLElement, out)\n if (childNode) {\n childrenIds.push(childNode.id)\n }\n }\n if (childrenIds.length > 0) {\n node.children = childrenIds\n }\n\n return node\n}\n\nexport function serializeSubtree(el: HTMLElement): SerializedNode[] {\n const nodes: SerializedNode[] = []\n collectNode(el, nodes)\n return nodes\n}\n\nexport function serializeTree(root: HTMLElement): SerializedNode[] {\n return serializeSubtree(root)\n}\n","import type { Viewport } from '../types'\n\nexport function getViewport(): Viewport {\n return {\n scrollX: Math.round(window.scrollX),\n scrollY: Math.round(window.scrollY),\n width: window.innerWidth,\n height: window.innerHeight,\n }\n}\n","import type { Config, RrwebEvent, Tracker } from '../types'\nimport type { Sender } from '../utils/sender'\nimport { record } from 'rrweb'\nimport { MASK_SELECTOR } from '../constants'\n\nexport class RrwebTracker implements Tracker {\n private stopFn: (() => void) | null = null\n\n constructor(\n private config: Config,\n private sender: Sender,\n ) {}\n\n start() {\n this.stopFn = record({\n emit: (event) => {\n const rrwebEvent: RrwebEvent = {\n event: 'rrweb',\n timestamp: new Date().toISOString(),\n rrwebEvent: event,\n }\n this.sender.add(rrwebEvent)\n },\n recordCrossOriginIframes: false,\n recordCanvas: false,\n maskTextSelector: MASK_SELECTOR,\n maskInputOptions: { password: true },\n maskTextFn: text => '*'.repeat(text.length),\n sampling: {\n mousemove: false,\n mouseInteraction: true,\n scroll: 500,\n input: 'last',\n },\n }) ?? null\n\n if (this.config.debug)\n console.log('[dataclient] rrweb recording started')\n }\n\n stop() {\n if (this.stopFn) {\n this.stopFn()\n this.stopFn = null\n }\n }\n\n static addMarker(tag: string, payload: unknown) {\n record.addCustomEvent(tag, payload)\n }\n}\n","import type { ActionEvent, Config, Tracker } from '../types'\nimport type { Sender } from '../utils/sender'\nimport { INTERACTIVE_ROLES, INTERACTIVE_TAGS, TEXT_INPUT_TYPES } from '../constants'\nimport { isMasked, maskText } from '../dom/mask'\nimport { getNodeId } from '../dom/serializer'\nimport { getViewport } from '../dom/viewport'\nimport { RrwebTracker } from './rrweb'\n\nexport class ActionTracker implements Tracker {\n private inputTimers = new WeakMap<HTMLElement, ReturnType<typeof setTimeout>>()\n private pendingInputs = new Set<HTMLElement>()\n\n private handleClick = (e: Event) => this.onClick(e)\n private handleInput = (e: Event) => this.onInput(e)\n private handleChange = (e: Event) => this.onChange(e)\n\n constructor(\n private config: Config,\n private sender: Sender,\n ) {}\n\n start() {\n document.addEventListener('click', this.handleClick, true)\n document.addEventListener('input', this.handleInput, true)\n document.addEventListener('change', this.handleChange, true)\n }\n\n stop() {\n document.removeEventListener('click', this.handleClick, true)\n document.removeEventListener('input', this.handleInput, true)\n document.removeEventListener('change', this.handleChange, true)\n }\n\n beforeUnload() {\n for (const el of this.pendingInputs) {\n const timer = this.inputTimers.get(el)\n if (timer) {\n clearTimeout(timer)\n }\n this.inputTimers.delete(el)\n this.recordInput(el)\n }\n this.pendingInputs.clear()\n }\n\n private onClick(e: Event) {\n const raw = e.target as HTMLElement\n if (!raw) {\n return\n }\n\n const tag = raw.tagName?.toLowerCase()\n if (tag === 'body' || tag === 'html') {\n return\n }\n\n const el = this.findMeaningfulElement(raw)\n const info = this.getElementInfo(el)\n\n const action: ActionEvent = {\n event: 'action',\n timestamp: new Date().toISOString(),\n type: 'click',\n targetId: info.targetId,\n tag: info.tag,\n text: info.text,\n url: location.href,\n state: info.state,\n viewport: getViewport(),\n }\n\n if (this.config.debug) {\n console.log(`[dataclient] click: ${info.tag} \"${info.text}\"`)\n }\n\n this.sender.add(action)\n RrwebTracker.addMarker('click', { tag: info.tag, text: info.text, label: `Click: ${info.text || info.tag}` })\n }\n\n private onInput(e: Event) {\n const target = e.target as HTMLElement\n if (!target) {\n return\n }\n\n const tag = target.tagName?.toLowerCase()\n if (tag === 'input') {\n const type = (target as HTMLInputElement).type?.toLowerCase() || 'text'\n if (!TEXT_INPUT_TYPES.has(type)) {\n return\n }\n }\n else if (tag !== 'textarea') {\n return\n }\n\n this.pendingInputs.add(target)\n\n const prev = this.inputTimers.get(target)\n if (prev) {\n clearTimeout(prev)\n }\n\n this.inputTimers.set(target, setTimeout(() => {\n this.inputTimers.delete(target)\n this.pendingInputs.delete(target)\n this.recordInput(target)\n }, this.config.inputDebounce))\n }\n\n private recordInput(target: HTMLElement) {\n const rawValue = (target as HTMLInputElement).value || ''\n if (!rawValue) {\n return\n }\n\n const info = this.getElementInfo(target)\n const type = (target as HTMLInputElement).type?.toLowerCase() || ''\n const value = (info.masked || type === 'password') ? maskText(rawValue) : rawValue\n\n const action: ActionEvent = {\n event: 'action',\n timestamp: new Date().toISOString(),\n type: 'input',\n targetId: info.targetId,\n tag: info.tag,\n text: info.text,\n url: location.href,\n value,\n length: rawValue.length,\n viewport: getViewport(),\n }\n\n if (this.config.debug) {\n console.log(`[dataclient] input: ${info.tag} \"${info.text}\" → ${value.length} chars`)\n }\n\n this.sender.add(action)\n RrwebTracker.addMarker('input', { tag: info.tag, text: info.text, label: `Input: ${info.text || info.tag}` })\n }\n\n private onChange(e: Event) {\n const target = e.target as HTMLElement\n if (!target) {\n return\n }\n\n const info = this.getElementInfo(target)\n const tag = target.tagName?.toLowerCase()\n\n const action: ActionEvent = {\n event: 'action',\n timestamp: new Date().toISOString(),\n type: 'change',\n targetId: info.targetId,\n tag: info.tag,\n text: info.text,\n url: location.href,\n viewport: getViewport(),\n }\n\n if (tag === 'select') {\n const selectValue = (target as HTMLSelectElement).value\n action.value = info.masked ? maskText(selectValue) : selectValue\n }\n else if (tag === 'input') {\n const type = (target as HTMLInputElement).type\n if (type === 'checkbox' || type === 'radio') {\n action.checked = (target as HTMLInputElement).checked\n }\n }\n\n if (this.config.debug) {\n console.log(`[dataclient] change: ${info.tag} \"${info.text}\"`)\n }\n\n this.sender.add(action)\n RrwebTracker.addMarker('change', { tag: info.tag, text: info.text, label: `Change: ${info.text || info.tag}` })\n }\n\n private getElementInfo(el: HTMLElement) {\n const tag = el.tagName?.toLowerCase() || ''\n let text = ''\n\n if (tag === 'input' || tag === 'textarea') {\n text = (el as HTMLInputElement).placeholder || el.getAttribute('aria-label') || ''\n }\n else {\n for (const child of el.childNodes) {\n if (child.nodeType === Node.TEXT_NODE) {\n const t = child.textContent?.trim()\n if (t) {\n text += (text ? ' ' : '') + t\n }\n }\n }\n if (!text) {\n text = el.textContent?.trim().slice(0, 100) || ''\n }\n }\n\n const masked = isMasked(el)\n const finalText = masked ? maskText(text) : text\n\n return {\n tag,\n text: finalText.slice(0, 100),\n targetId: getNodeId(el),\n state: (el as HTMLButtonElement).disabled ? 'disabled' : 'enabled',\n masked,\n }\n }\n\n private findMeaningfulElement(el: HTMLElement): HTMLElement {\n let current: HTMLElement | null = el\n while (current && current !== document.body) {\n if (INTERACTIVE_TAGS.has(current.tagName?.toLowerCase())) {\n return current\n }\n const role = current.getAttribute('role')\n if (role && INTERACTIVE_ROLES.has(role)) {\n return current\n }\n current = current.parentElement\n }\n return el\n }\n}\n","import type { AttrChange, Config, MutationAdd, MutationEvent, TextChange, Tracker } from '../types'\nimport type { Sender } from '../utils/sender'\nimport { WATCH_ATTRS } from '../constants'\nimport { getNodeId, removeNodeId, serializeSubtree } from '../dom/serializer'\n\nexport class MutationTracker implements Tracker {\n private observer: MutationObserver | null = null\n private debounceTimer: ReturnType<typeof setTimeout> | null = null\n\n private pendingAdds: MutationAdd[] = []\n private pendingRemoves: number[] = []\n private pendingTextChanges: TextChange[] = []\n private pendingAttrChanges: AttrChange[] = []\n\n constructor(\n private config: Config,\n private sender: Sender,\n private onMutation: () => void,\n ) {}\n\n start() {\n this.observer = new MutationObserver(mutations => this.handleMutations(mutations))\n this.observer.observe(document.body, {\n childList: true,\n subtree: true,\n characterData: true,\n attributes: true,\n attributeFilter: WATCH_ATTRS,\n })\n }\n\n stop() {\n this.observer?.disconnect()\n this.observer = null\n if (this.debounceTimer) {\n clearTimeout(this.debounceTimer)\n }\n }\n\n beforeUnload() {\n if (this.debounceTimer) {\n clearTimeout(this.debounceTimer)\n this.flush()\n }\n }\n\n private flush() {\n this.debounceTimer = null\n\n if (\n this.pendingAdds.length === 0\n && this.pendingRemoves.length === 0\n && this.pendingTextChanges.length === 0\n && this.pendingAttrChanges.length === 0\n ) {\n return\n }\n\n const mutation: MutationEvent = {\n event: 'mutation',\n timestamp: new Date().toISOString(),\n url: window.location.href,\n adds: this.pendingAdds,\n removes: this.pendingRemoves,\n text_changes: this.pendingTextChanges,\n attr_changes: this.pendingAttrChanges,\n }\n\n if (this.config.debug) {\n console.log(`[dataclient] mutation: +${this.pendingAdds.length} -${this.pendingRemoves.length} text:${this.pendingTextChanges.length} attr:${this.pendingAttrChanges.length}`)\n }\n\n this.sender.add(mutation)\n this.onMutation()\n\n this.pendingAdds = []\n this.pendingRemoves = []\n this.pendingTextChanges = []\n this.pendingAttrChanges = []\n }\n\n private scheduleFlush() {\n if (this.debounceTimer) {\n clearTimeout(this.debounceTimer)\n }\n this.debounceTimer = setTimeout(() => this.flush(), this.config.mutationDebounce)\n }\n\n private handleMutations(mutations: MutationRecord[]) {\n for (const m of mutations) {\n for (const node of m.addedNodes) {\n if (node.nodeType !== Node.ELEMENT_NODE) {\n continue\n }\n const el = node as HTMLElement\n const nodes = serializeSubtree(el)\n if (nodes.length === 0) {\n continue\n }\n\n const parentId = getNodeId(el.parentElement!)\n if (parentId === null) {\n continue\n }\n\n this.pendingAdds.push({ parentId, nodes })\n }\n\n for (const node of m.removedNodes) {\n if (node.nodeType !== Node.ELEMENT_NODE) {\n continue\n }\n const id = getNodeId(node)\n if (id !== null) {\n this.pendingRemoves.push(id)\n removeNodeId(id)\n }\n }\n\n if (m.type === 'characterData' && m.target.parentElement) {\n const parentId = getNodeId(m.target.parentElement)\n if (parentId !== null) {\n const text = m.target.textContent?.trim().slice(0, 200) || ''\n this.pendingTextChanges.push({ id: parentId, text })\n }\n }\n\n if (m.type === 'attributes' && m.attributeName) {\n const id = getNodeId(m.target)\n if (id !== null) {\n const value = (m.target as HTMLElement).getAttribute(m.attributeName)\n this.pendingAttrChanges.push({\n id,\n attr: m.attributeName,\n value: value?.slice(0, 200) ?? null,\n })\n }\n }\n }\n\n if (\n this.pendingAdds.length > 0\n || this.pendingRemoves.length > 0\n || this.pendingTextChanges.length > 0\n || this.pendingAttrChanges.length > 0\n ) {\n this.scheduleFlush()\n }\n }\n}\n","import type { Config, SnapshotEvent, Tracker } from '../types'\nimport type { Sender } from '../utils/sender'\nimport { resetIds, serializeTree } from '../dom/serializer'\nimport { getViewport } from '../dom/viewport'\n\nexport class SnapshotTracker implements Tracker {\n private lastUrl = ''\n private urlPollTimer: ReturnType<typeof setInterval> | null = null\n private checkpointTimer: ReturnType<typeof setInterval> | null = null\n private hasMutations = false\n\n constructor(\n private config: Config,\n private sender: Sender,\n ) {}\n\n start() {\n this.lastUrl = location.href\n this.recordSnapshot()\n\n this.urlPollTimer = setInterval(() => this.pollUrl(), 500)\n this.checkpointTimer = setInterval(() => this.checkpoint(), this.config.checkpointInterval)\n }\n\n stop() {\n if (this.urlPollTimer) {\n clearInterval(this.urlPollTimer)\n }\n if (this.checkpointTimer) {\n clearInterval(this.checkpointTimer)\n }\n }\n\n beforeUnload() {\n if (this.hasMutations) {\n this.recordSnapshot()\n }\n }\n\n markMutation() {\n this.hasMutations = true\n }\n\n private recordSnapshot() {\n resetIds()\n\n const snapshot: SnapshotEvent = {\n event: 'snapshot',\n timestamp: new Date().toISOString(),\n url: location.href,\n title: document.title,\n tree: serializeTree(document.body),\n viewport: getViewport(),\n }\n\n if (this.config.debug) {\n console.log(`[dataclient] snapshot: ${location.href} (${snapshot.tree.length} nodes)`)\n }\n\n this.sender.add(snapshot)\n this.sender.flush()\n this.hasMutations = false\n }\n\n private pollUrl() {\n if (location.href !== this.lastUrl) {\n const prev = this.lastUrl\n this.lastUrl = location.href\n if (prev) {\n if (this.config.debug) {\n console.log(`[dataclient] URL changed: ${prev} → ${location.href}`)\n }\n this.recordSnapshot()\n }\n }\n }\n\n private checkpoint() {\n if (this.hasMutations) {\n if (this.config.debug) {\n console.log('[dataclient] checkpoint snapshot')\n }\n this.recordSnapshot()\n }\n }\n}\n","export function getDeviceId(key: string): string {\n let id = localStorage.getItem(key)\n if (!id) {\n id = generateId()\n localStorage.setItem(key, id)\n }\n return id\n}\n\nexport function generateId(): string {\n const ts = Date.now().toString(36)\n const rand = Math.random().toString(36).substring(2, 12)\n return `${ts}-${rand}`\n}\n","import type { SceneBatch, SceneEvent } from '../types'\n\nconst MAX_RETRIES = 2\nconst BEACON_MAX_SIZE = 60000\n\nexport class Sender {\n private queue: SceneEvent[] = []\n private timer: ReturnType<typeof setInterval> | null = null\n private flushPromise: Promise<void> = Promise.resolve()\n\n constructor(\n private endpoint: string,\n private apiKey: string,\n private batchSize: number,\n private sessionId: string,\n private deviceId: string,\n flushInterval: number,\n ) {\n this.timer = setInterval(() => this.flush(), flushInterval)\n }\n\n add(event: SceneEvent) {\n this.queue.push(event)\n\n const isRrwebSnapshot = event.event === 'rrweb'\n && event.rrwebEvent.type === 2\n\n if (isRrwebSnapshot || this.queue.length >= this.batchSize) {\n this.flush()\n }\n }\n\n flush() {\n this.flushPromise = this.flushPromise.then(() => this.doFlush())\n }\n\n flushSync() {\n if (this.queue.length === 0)\n return\n\n const events = this.queue.splice(0)\n const url = this.buildUrl()\n\n let chunk: SceneEvent[] = []\n let chunkSize = 0\n\n for (const event of events) {\n const eventJson = JSON.stringify(event)\n if (chunkSize + eventJson.length > BEACON_MAX_SIZE && chunk.length > 0) {\n this.sendBeacon(chunk, url)\n chunk = []\n chunkSize = 0\n }\n chunk.push(event)\n chunkSize += eventJson.length\n }\n\n if (chunk.length > 0) {\n this.sendBeacon(chunk, url)\n }\n }\n\n destroy() {\n if (this.timer) {\n clearInterval(this.timer)\n }\n this.flushSync()\n }\n\n private async doFlush() {\n if (this.queue.length === 0)\n return\n\n const events = this.queue.splice(0)\n const batch = this.buildBatch(events)\n const json = JSON.stringify(batch)\n const url = this.buildUrl()\n\n const success = await this.send(json, url)\n\n if (!success) {\n this.queue.unshift(...events)\n }\n }\n\n private sendBeacon(events: SceneEvent[], url: string) {\n const batch = this.buildBatch(events)\n const json = JSON.stringify(batch)\n const blob = new Blob([json], { type: 'application/json' })\n navigator.sendBeacon(url, blob)\n }\n\n private buildUrl(): string {\n return `${this.endpoint}?key=${encodeURIComponent(this.apiKey)}`\n }\n\n private buildBatch(events: SceneEvent[]): SceneBatch {\n return {\n session_id: this.sessionId,\n device_id: this.deviceId,\n events,\n sent_at: new Date().toISOString(),\n page_url: location.href,\n user_agent: navigator.userAgent,\n screen: {\n width: screen.width,\n height: screen.height,\n viewport_width: window.innerWidth,\n viewport_height: window.innerHeight,\n },\n }\n }\n\n private async send(json: string, url: string): Promise<boolean> {\n for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {\n try {\n const response = await fetch(url, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: json,\n })\n if (response.ok)\n return true\n }\n catch {}\n\n if (attempt < MAX_RETRIES) {\n await new Promise(r => setTimeout(r, (attempt + 1) * 200))\n }\n }\n return false\n }\n}\n","import type { Config, Tracker } from './types'\nimport { ActionTracker } from './trackers/action'\nimport { MutationTracker } from './trackers/mutation'\nimport { RrwebTracker } from './trackers/rrweb'\nimport { SnapshotTracker } from './trackers/snapshot'\nimport { generateId, getDeviceId } from './utils/identity'\nimport { Sender } from './utils/sender'\n\nexport type * from './types'\n\nconst defaults: Config = {\n endpoint: 'https://my.tamsense.com/api/events',\n debug: false,\n batchSize: 5,\n flushInterval: 5000,\n checkpointInterval: 30000,\n idleTimeout: 60 * 60 * 1000,\n mutationDebounce: 200,\n inputDebounce: 1000,\n sessionIdKey: 'sc2_sid',\n deviceIdKey: 'sc2_did',\n apiKey: '',\n}\n\nexport class DataClient {\n private sender: Sender | null = null\n private trackers: Tracker[] = []\n private config: Config\n private deviceId: string\n private idleTimer: ReturnType<typeof setTimeout> | null = null\n private userId: string | null = null\n\n constructor(options?: Partial<Config>) {\n this.config = { ...defaults, ...options }\n this.deviceId = getDeviceId(this.config.deviceIdKey)\n\n this.startSession()\n\n document.addEventListener('click', () => this.onActivity(), true)\n document.addEventListener('input', () => this.onActivity(), true)\n document.addEventListener('change', () => this.onActivity(), true)\n }\n\n setUser(userId: string) {\n this.userId = userId\n this.sender?.add({ event: 'identify', timestamp: new Date().toISOString(), user_id: userId })\n }\n\n excludeSession(reason = '') {\n this.sender?.add({ event: 'exclude', timestamp: new Date().toISOString(), reason })\n this.stopSession()\n }\n\n private onActivity() {\n if (!this.sender) {\n this.startSession()\n }\n this.resetIdleTimer()\n }\n\n private resetIdleTimer() {\n if (this.idleTimer)\n clearTimeout(this.idleTimer)\n this.idleTimer = setTimeout(() => this.stopSession(), this.config.idleTimeout)\n }\n\n private startSession() {\n const sessionId = generateId()\n\n this.sender = new Sender(\n this.config.endpoint,\n this.config.apiKey,\n this.config.batchSize,\n sessionId,\n this.deviceId,\n this.config.flushInterval,\n )\n\n const snapshotTracker = new SnapshotTracker(this.config, this.sender)\n const mutationTracker = new MutationTracker(this.config, this.sender, () => snapshotTracker.markMutation())\n const actionTracker = new ActionTracker(this.config, this.sender)\n const rrwebTracker = new RrwebTracker(this.config, this.sender)\n\n this.trackers = [snapshotTracker, mutationTracker, actionTracker, rrwebTracker]\n this.trackers.forEach(t => t.start())\n\n if (this.userId) {\n this.sender.add({ event: 'identify', timestamp: new Date().toISOString(), user_id: this.userId })\n }\n\n this.resetIdleTimer()\n\n const onLeave = () => {\n this.trackers.forEach(t => t.beforeUnload?.())\n this.sender?.flushSync()\n }\n\n document.addEventListener('visibilitychange', () => {\n if (document.visibilityState === 'hidden')\n onLeave()\n })\n window.addEventListener('pagehide', onLeave)\n\n if (this.config.debug) {\n console.log(`[dataclient] Session started: ${sessionId}`)\n }\n }\n\n private stopSession() {\n if (this.idleTimer) {\n clearTimeout(this.idleTimer)\n this.idleTimer = null\n }\n this.trackers.forEach(t => t.stop())\n this.trackers = []\n if (this.sender) {\n this.sender.destroy()\n this.sender = null\n }\n\n if (this.config.debug) {\n console.log('[dataclient] Session stopped (idle timeout)')\n }\n }\n}\n"],"mappings":";AAAO,IAAM,YAAY;AAClB,IAAM,gBAAgB,IAAI,SAAS;AAEnC,IAAM,YAAY,oBAAI,IAAI,CAAC,UAAU,SAAS,YAAY,OAAO,QAAQ,QAAQ,MAAM,CAAC;AAExF,IAAM,eAAe,oBAAI,IAAI;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;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,OAAO,OAAO;AACnB,cAAQ,IAAI,iCAAiC,SAAS,EAAE;AAAA,IAC5D;AAAA,EACJ;AAAA,EAEQ,cAAc;AAClB,QAAI,KAAK,WAAW;AAChB,mBAAa,KAAK,SAAS;AAC3B,WAAK,YAAY;AAAA,IACrB;AACA,SAAK,SAAS,QAAQ,OAAK,EAAE,KAAK,CAAC;AACnC,SAAK,WAAW,CAAC;AACjB,QAAI,KAAK,QAAQ;AACb,WAAK,OAAO,QAAQ;AACpB,WAAK,SAAS;AAAA,IAClB;AAEA,QAAI,KAAK,OAAO,OAAO;AACnB,cAAQ,IAAI,6CAA6C;AAAA,IAC7D;AAAA,EACJ;AACJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/constants.ts","../src/dom/mask.ts","../src/dom/icon.ts","../src/dom/serializer.ts","../src/dom/viewport.ts","../src/trackers/rrweb.ts","../src/trackers/action.ts","../src/trackers/mutation.ts","../src/trackers/snapshot.ts","../src/utils/identity.ts","../src/utils/sender.ts","../src/index.ts"],"sourcesContent":["export const MASK_ATTR = 'dataclient-mask'\nexport const MASK_SELECTOR = `[${MASK_ATTR}]`\n\nexport const SKIP_TAGS = new Set(['script', 'style', 'noscript', 'svg', 'link', 'meta', 'head'])\n\nexport const RECORD_ATTRS = new Set([\n 'class',\n 'role',\n 'href',\n 'type',\n 'placeholder',\n 'disabled',\n 'hidden',\n 'aria-label',\n 'aria-selected',\n 'aria-expanded',\n 'aria-invalid',\n 'aria-busy',\n 'aria-checked',\n 'aria-hidden',\n 'value',\n 'name',\n 'id',\n 'for',\n 'target',\n 'data-state',\n MASK_ATTR,\n])\n\nexport const WATCH_ATTRS = [\n 'class',\n 'role',\n 'href',\n 'disabled',\n 'hidden',\n 'placeholder',\n 'aria-label',\n 'aria-selected',\n 'aria-expanded',\n 'aria-invalid',\n 'aria-busy',\n 'aria-checked',\n 'aria-hidden',\n 'data-state',\n 'value',\n]\n\nexport const TEXT_INPUT_TYPES = new Set(['text', 'email', 'password', 'search', 'tel', 'url', 'number'])\n\nexport const INTERACTIVE_TAGS = new Set(['button', 'a', 'input', 'select', 'textarea'])\nexport const INTERACTIVE_ROLES = new Set(['button', 'link', 'tab', 'menuitem', 'checkbox', 'radio', 'switch', 'option'])\n","import { MASK_SELECTOR } from '../constants'\n\nexport function isMasked(el: Element | Node | null): boolean {\n if (!el)\n return false\n const element = el.nodeType === Node.ELEMENT_NODE\n ? el as Element\n : el.parentElement\n return !!element?.closest(MASK_SELECTOR)\n}\n\nexport function maskText(text: string): string {\n if (!text) {\n return text\n }\n const visible = Math.max(1, Math.ceil(text.length * 0.2))\n return text.slice(0, visible) + '*'.repeat(text.length - visible)\n}\n\nexport function maskValue(el: Element | null, value: string): string {\n return isMasked(el) ? maskText(value) : value\n}\n","const ICON_CLASS_PATTERNS = [\n /\\bfa-([a-z0-9-]+)\\b/,\n /\\bmdi-([a-z0-9-]+)\\b/,\n /\\bbi-([a-z0-9-]+)\\b/,\n /\\bicon-([a-z0-9-]+)\\b/,\n /\\blucide-([a-z0-9-]+)\\b/,\n /\\bri-([a-z0-9-]+)\\b/,\n /\\btabler-icon-([a-z0-9-]+)\\b/,\n /\\bi-[a-z0-9-]+[:/]([a-z0-9-]+)\\b/,\n]\n\nconst MATERIAL_CLASS_PATTERN = /\\b(?:material-icons|material-symbols-[a-z]+)\\b/\nconst SVG_USE_HREF_PATTERN = /#(.+)/\n\nconst MAX_ICON_IMG_SIZE = 48\n\nexport function getElementIcon(el: HTMLElement): string | null {\n if (!el) {\n return null\n }\n\n const direct = detectIcon(el)\n if (direct) {\n return direct\n }\n\n for (const child of el.children) {\n const icon = detectIcon(child as HTMLElement)\n if (icon) {\n return icon\n }\n }\n\n return null\n}\n\nfunction detectIcon(el: HTMLElement): string | null {\n if (!el?.tagName) {\n return null\n }\n\n const tag = el.tagName.toLowerCase()\n\n if (tag === 'svg') {\n return detectSvgIcon(el)\n }\n\n if (tag === 'i' || tag === 'span' || el.classList.contains('iconify')) {\n return detectFontIcon(el)\n }\n\n if (tag === 'img') {\n return detectImgIcon(el as HTMLImageElement)\n }\n\n const svg = el.querySelector('svg')\n if (svg) {\n return detectSvgIcon(svg)\n }\n\n return null\n}\n\nfunction detectSvgIcon(svg: Element): string | null {\n const lucide = svg.getAttribute('data-lucide')\n if (lucide) {\n return lucide\n }\n\n const dataIcon = svg.getAttribute('data-icon')\n if (dataIcon) {\n return dataIcon\n }\n\n const use = svg.querySelector('use')\n if (use) {\n const href = use.getAttribute('href') || use.getAttribute('xlink:href')\n if (href) {\n const match = href.match(SVG_USE_HREF_PATTERN)\n if (match) {\n return match[1]\n }\n }\n }\n\n const ariaLabel = svg.getAttribute('aria-label')\n if (ariaLabel) {\n return ariaLabel\n }\n\n const cls = typeof svg.className === 'string' ? svg.className : svg.getAttribute('class') || ''\n const fromClass = extractIconNameFromClass(cls)\n if (fromClass) {\n return fromClass\n }\n\n return null\n}\n\nfunction detectFontIcon(el: HTMLElement): string | null {\n const cls = typeof el.className === 'string' ? el.className : el.getAttribute('class') || ''\n\n if (MATERIAL_CLASS_PATTERN.test(cls)) {\n const text = el.textContent?.trim()\n if (text) {\n return text\n }\n }\n\n return extractIconNameFromClass(cls)\n}\n\nfunction detectImgIcon(img: HTMLImageElement): string | null {\n if (img.width > MAX_ICON_IMG_SIZE || img.height > MAX_ICON_IMG_SIZE) {\n return null\n }\n\n if (img.naturalWidth > MAX_ICON_IMG_SIZE || img.naturalHeight > MAX_ICON_IMG_SIZE) {\n return null\n }\n\n const alt = img.alt?.trim()\n if (alt) {\n return alt\n }\n\n const src = img.getAttribute('src')\n if (src) {\n const filename = src.split('/').pop()?.split('?')[0]?.split('.')[0]\n if (filename) {\n return filename\n }\n }\n\n return null\n}\n\nfunction extractIconNameFromClass(cls: string): string | null {\n for (const pattern of ICON_CLASS_PATTERNS) {\n const match = cls.match(pattern)\n if (match) {\n return match[1]\n }\n }\n return null\n}\n","import type { SerializedNode } from '../types'\nimport { RECORD_ATTRS, SKIP_TAGS } from '../constants'\nimport { getElementIcon } from './icon'\nimport { isMasked, maskText } from './mask'\n\nlet nextId = 1\nconst nodeToId = new WeakMap<Node, number>()\nconst idToNode = new Map<number, Node>()\n\nexport function resetIds() {\n nextId = 1\n idToNode.clear()\n}\n\nexport function assignId(node: Node): number {\n const existing = nodeToId.get(node)\n if (existing) {\n return existing\n }\n const id = nextId++\n nodeToId.set(node, id)\n idToNode.set(id, node)\n return id\n}\n\nexport function getNodeId(node: Node): number | null {\n return nodeToId.get(node) ?? null\n}\n\nexport function getNodeById(id: number): Node | null {\n return idToNode.get(id) ?? null\n}\n\nexport function removeNodeId(id: number) {\n const node = idToNode.get(id)\n if (node) {\n nodeToId.delete(node)\n idToNode.delete(id)\n }\n}\n\nfunction isVisible(el: HTMLElement): boolean {\n if (el.hidden)\n return false\n if (el.getAttribute('aria-hidden') === 'true')\n return false\n if (!el.offsetParent && el.tagName !== 'BODY' && getComputedStyle(el).position !== 'fixed') {\n return false\n }\n return true\n}\n\nfunction getDirectText(el: HTMLElement): string {\n let text = ''\n for (const child of el.childNodes) {\n if (child.nodeType === Node.TEXT_NODE) {\n const t = child.textContent?.trim()\n if (t) {\n text += (text ? ' ' : '') + t\n }\n }\n }\n const truncated = text.slice(0, 200)\n return isMasked(el) ? maskText(truncated) : truncated\n}\n\nfunction getAttrs(el: HTMLElement): Record<string, string> | undefined {\n const attrs: Record<string, string> = {}\n let hasAttrs = false\n const masked = isMasked(el)\n\n for (const name of RECORD_ATTRS) {\n const value = el.getAttribute(name)\n if (value !== null && value !== '') {\n let v = value.slice(0, 200)\n if (masked && (name === 'value' || name === 'placeholder')) {\n v = maskText(v)\n }\n attrs[name] = v\n hasAttrs = true\n }\n }\n\n return hasAttrs ? attrs : undefined\n}\n\nfunction getRect(el: HTMLElement): SerializedNode['rect'] {\n const r = el.getBoundingClientRect()\n if (r.width === 0 && r.height === 0) {\n return undefined\n }\n return {\n x: Math.round(r.left + window.scrollX),\n y: Math.round(r.top + window.scrollY),\n w: Math.round(r.width),\n h: Math.round(r.height),\n }\n}\n\nfunction collectNode(el: HTMLElement, out: SerializedNode[]): SerializedNode | null {\n const tag = el.tagName?.toLowerCase()\n if (!tag || SKIP_TAGS.has(tag)) {\n return null\n }\n if (!isVisible(el)) {\n return null\n }\n\n const id = assignId(el)\n const text = getDirectText(el)\n const icon = getElementIcon(el)\n const attrs = getAttrs(el)\n const rect = getRect(el)\n\n const node: SerializedNode = { id, tag }\n if (text) {\n node.text = text\n }\n if (icon) {\n node.icon = icon\n }\n if (attrs) {\n node.attrs = attrs\n }\n if (rect) {\n node.rect = rect\n }\n\n out.push(node)\n\n const childrenIds: number[] = []\n for (const child of el.children) {\n const childNode = collectNode(child as HTMLElement, out)\n if (childNode) {\n childrenIds.push(childNode.id)\n }\n }\n if (childrenIds.length > 0) {\n node.children = childrenIds\n }\n\n return node\n}\n\nexport function serializeSubtree(el: HTMLElement): SerializedNode[] {\n const nodes: SerializedNode[] = []\n collectNode(el, nodes)\n return nodes\n}\n\nexport function serializeTree(root: HTMLElement): SerializedNode[] {\n return serializeSubtree(root)\n}\n","import type { Viewport } from '../types'\n\nexport function getViewport(): Viewport {\n return {\n scrollX: Math.round(window.scrollX),\n scrollY: Math.round(window.scrollY),\n width: window.innerWidth,\n height: window.innerHeight,\n }\n}\n","import type { Config, RrwebEvent, Tracker } from '../types'\nimport type { Sender } from '../utils/sender'\nimport { record } from 'rrweb'\nimport { MASK_SELECTOR } from '../constants'\n\nexport class RrwebTracker implements Tracker {\n private stopFn: (() => void) | null = null\n\n constructor(\n private config: Config,\n private sender: Sender,\n ) {}\n\n start() {\n const scoped = this.config.scoped\n const blockSelector = scoped\n ? `:not([${scoped}]):not([${scoped}] *):not(:has([${scoped}]))`\n : undefined\n\n this.stopFn = record({\n emit: (event) => {\n const rrwebEvent: RrwebEvent = {\n event: 'rrweb',\n timestamp: new Date().toISOString(),\n rrwebEvent: event,\n }\n this.sender.add(rrwebEvent)\n },\n recordCrossOriginIframes: false,\n recordCanvas: false,\n maskTextSelector: MASK_SELECTOR,\n maskInputOptions: { password: true },\n maskTextFn: text => '*'.repeat(text.length),\n blockSelector,\n sampling: {\n mousemove: false,\n mouseInteraction: true,\n scroll: 500,\n input: 'last',\n },\n }) ?? null\n\n if (this.config.debug)\n console.log('[dataclient] rrweb recording started')\n }\n\n stop() {\n if (this.stopFn) {\n this.stopFn()\n this.stopFn = null\n }\n }\n\n static addMarker(tag: string, payload: unknown) {\n record.addCustomEvent(tag, payload)\n }\n}\n","import type { ActionEvent, Config, Tracker } from '../types'\nimport type { Sender } from '../utils/sender'\nimport { INTERACTIVE_ROLES, INTERACTIVE_TAGS, TEXT_INPUT_TYPES } from '../constants'\nimport { isMasked, maskText } from '../dom/mask'\nimport { getNodeId } from '../dom/serializer'\nimport { getViewport } from '../dom/viewport'\nimport { RrwebTracker } from './rrweb'\n\nexport class ActionTracker implements Tracker {\n private inputTimers = new WeakMap<HTMLElement, ReturnType<typeof setTimeout>>()\n private pendingInputs = new Set<HTMLElement>()\n\n private handleClick = (e: Event) => this.onClick(e)\n private handleInput = (e: Event) => this.onInput(e)\n private handleChange = (e: Event) => this.onChange(e)\n\n constructor(\n private config: Config,\n private sender: Sender,\n private root: HTMLElement,\n ) {}\n\n private get listenerTarget(): EventTarget {\n return this.config.scoped ? this.root : document\n }\n\n start() {\n const target = this.listenerTarget\n target.addEventListener('click', this.handleClick, true)\n target.addEventListener('input', this.handleInput, true)\n target.addEventListener('change', this.handleChange, true)\n }\n\n stop() {\n const target = this.listenerTarget\n target.removeEventListener('click', this.handleClick, true)\n target.removeEventListener('input', this.handleInput, true)\n target.removeEventListener('change', this.handleChange, true)\n }\n\n beforeUnload() {\n for (const el of this.pendingInputs) {\n const timer = this.inputTimers.get(el)\n if (timer) {\n clearTimeout(timer)\n }\n this.inputTimers.delete(el)\n this.recordInput(el)\n }\n this.pendingInputs.clear()\n }\n\n private onClick(e: Event) {\n const raw = e.target as HTMLElement\n if (!raw) {\n return\n }\n\n const tag = raw.tagName?.toLowerCase()\n if (tag === 'body' || tag === 'html') {\n return\n }\n\n const el = this.findMeaningfulElement(raw)\n const info = this.getElementInfo(el)\n\n const action: ActionEvent = {\n event: 'action',\n timestamp: new Date().toISOString(),\n type: 'click',\n targetId: info.targetId,\n tag: info.tag,\n text: info.text,\n url: location.href,\n state: info.state,\n viewport: getViewport(),\n }\n\n if (this.config.debug) {\n console.log(`[dataclient] click: ${info.tag} \"${info.text}\"`)\n }\n\n this.sender.add(action)\n RrwebTracker.addMarker('click', { tag: info.tag, text: info.text, label: `Click: ${info.text || info.tag}` })\n }\n\n private onInput(e: Event) {\n const target = e.target as HTMLElement\n if (!target) {\n return\n }\n\n const tag = target.tagName?.toLowerCase()\n if (tag === 'input') {\n const type = (target as HTMLInputElement).type?.toLowerCase() || 'text'\n if (!TEXT_INPUT_TYPES.has(type)) {\n return\n }\n }\n else if (tag !== 'textarea') {\n return\n }\n\n this.pendingInputs.add(target)\n\n const prev = this.inputTimers.get(target)\n if (prev) {\n clearTimeout(prev)\n }\n\n this.inputTimers.set(target, setTimeout(() => {\n this.inputTimers.delete(target)\n this.pendingInputs.delete(target)\n this.recordInput(target)\n }, this.config.inputDebounce))\n }\n\n private recordInput(target: HTMLElement) {\n const rawValue = (target as HTMLInputElement).value || ''\n if (!rawValue) {\n return\n }\n\n const info = this.getElementInfo(target)\n const type = (target as HTMLInputElement).type?.toLowerCase() || ''\n const value = (info.masked || type === 'password') ? maskText(rawValue) : rawValue\n\n const action: ActionEvent = {\n event: 'action',\n timestamp: new Date().toISOString(),\n type: 'input',\n targetId: info.targetId,\n tag: info.tag,\n text: info.text,\n url: location.href,\n value,\n length: rawValue.length,\n viewport: getViewport(),\n }\n\n if (this.config.debug) {\n console.log(`[dataclient] input: ${info.tag} \"${info.text}\" → ${value.length} chars`)\n }\n\n this.sender.add(action)\n RrwebTracker.addMarker('input', { tag: info.tag, text: info.text, label: `Input: ${info.text || info.tag}` })\n }\n\n private onChange(e: Event) {\n const target = e.target as HTMLElement\n if (!target) {\n return\n }\n\n const info = this.getElementInfo(target)\n const tag = target.tagName?.toLowerCase()\n\n const action: ActionEvent = {\n event: 'action',\n timestamp: new Date().toISOString(),\n type: 'change',\n targetId: info.targetId,\n tag: info.tag,\n text: info.text,\n url: location.href,\n viewport: getViewport(),\n }\n\n if (tag === 'select') {\n const selectValue = (target as HTMLSelectElement).value\n action.value = info.masked ? maskText(selectValue) : selectValue\n }\n else if (tag === 'input') {\n const type = (target as HTMLInputElement).type\n if (type === 'checkbox' || type === 'radio') {\n action.checked = (target as HTMLInputElement).checked\n }\n }\n\n if (this.config.debug) {\n console.log(`[dataclient] change: ${info.tag} \"${info.text}\"`)\n }\n\n this.sender.add(action)\n RrwebTracker.addMarker('change', { tag: info.tag, text: info.text, label: `Change: ${info.text || info.tag}` })\n }\n\n private getElementInfo(el: HTMLElement) {\n const tag = el.tagName?.toLowerCase() || ''\n let text = ''\n\n if (tag === 'input' || tag === 'textarea') {\n text = (el as HTMLInputElement).placeholder || el.getAttribute('aria-label') || ''\n }\n else {\n for (const child of el.childNodes) {\n if (child.nodeType === Node.TEXT_NODE) {\n const t = child.textContent?.trim()\n if (t) {\n text += (text ? ' ' : '') + t\n }\n }\n }\n if (!text) {\n text = el.textContent?.trim().slice(0, 100) || ''\n }\n }\n\n const masked = isMasked(el)\n const finalText = masked ? maskText(text) : text\n\n return {\n tag,\n text: finalText.slice(0, 100),\n targetId: getNodeId(el),\n state: (el as HTMLButtonElement).disabled ? 'disabled' : 'enabled',\n masked,\n }\n }\n\n private findMeaningfulElement(el: HTMLElement): HTMLElement {\n let current: HTMLElement | null = el\n while (current && current !== this.root && current !== document.body) {\n if (INTERACTIVE_TAGS.has(current.tagName?.toLowerCase())) {\n return current\n }\n const role = current.getAttribute('role')\n if (role && INTERACTIVE_ROLES.has(role)) {\n return current\n }\n current = current.parentElement\n }\n return el\n }\n}\n","import type { AttrChange, Config, MutationAdd, MutationEvent, TextChange, Tracker } from '../types'\nimport type { Sender } from '../utils/sender'\nimport { WATCH_ATTRS } from '../constants'\nimport { getNodeId, removeNodeId, serializeSubtree } from '../dom/serializer'\n\nexport class MutationTracker implements Tracker {\n private observer: MutationObserver | null = null\n private debounceTimer: ReturnType<typeof setTimeout> | null = null\n\n private pendingAdds: MutationAdd[] = []\n private pendingRemoves: number[] = []\n private pendingTextChanges: TextChange[] = []\n private pendingAttrChanges: AttrChange[] = []\n\n constructor(\n private config: Config,\n private sender: Sender,\n private root: HTMLElement,\n private onMutation: () => void,\n ) {}\n\n start() {\n this.observer = new MutationObserver(mutations => this.handleMutations(mutations))\n this.observer.observe(this.root, {\n childList: true,\n subtree: true,\n characterData: true,\n attributes: true,\n attributeFilter: WATCH_ATTRS,\n })\n }\n\n stop() {\n this.observer?.disconnect()\n this.observer = null\n if (this.debounceTimer) {\n clearTimeout(this.debounceTimer)\n }\n }\n\n beforeUnload() {\n if (this.debounceTimer) {\n clearTimeout(this.debounceTimer)\n this.flush()\n }\n }\n\n private flush() {\n this.debounceTimer = null\n\n if (\n this.pendingAdds.length === 0\n && this.pendingRemoves.length === 0\n && this.pendingTextChanges.length === 0\n && this.pendingAttrChanges.length === 0\n ) {\n return\n }\n\n const mutation: MutationEvent = {\n event: 'mutation',\n timestamp: new Date().toISOString(),\n url: window.location.href,\n adds: this.pendingAdds,\n removes: this.pendingRemoves,\n text_changes: this.pendingTextChanges,\n attr_changes: this.pendingAttrChanges,\n }\n\n if (this.config.debug) {\n console.log(`[dataclient] mutation: +${this.pendingAdds.length} -${this.pendingRemoves.length} text:${this.pendingTextChanges.length} attr:${this.pendingAttrChanges.length}`)\n }\n\n this.sender.add(mutation)\n this.onMutation()\n\n this.pendingAdds = []\n this.pendingRemoves = []\n this.pendingTextChanges = []\n this.pendingAttrChanges = []\n }\n\n private scheduleFlush() {\n if (this.debounceTimer) {\n clearTimeout(this.debounceTimer)\n }\n this.debounceTimer = setTimeout(() => this.flush(), this.config.mutationDebounce)\n }\n\n private handleMutations(mutations: MutationRecord[]) {\n for (const m of mutations) {\n for (const node of m.addedNodes) {\n if (node.nodeType !== Node.ELEMENT_NODE) {\n continue\n }\n const el = node as HTMLElement\n const nodes = serializeSubtree(el)\n if (nodes.length === 0) {\n continue\n }\n\n const parentId = getNodeId(el.parentElement!)\n if (parentId === null) {\n continue\n }\n\n this.pendingAdds.push({ parentId, nodes })\n }\n\n for (const node of m.removedNodes) {\n if (node.nodeType !== Node.ELEMENT_NODE) {\n continue\n }\n const id = getNodeId(node)\n if (id !== null) {\n this.pendingRemoves.push(id)\n removeNodeId(id)\n }\n }\n\n if (m.type === 'characterData' && m.target.parentElement) {\n const parentId = getNodeId(m.target.parentElement)\n if (parentId !== null) {\n const text = m.target.textContent?.trim().slice(0, 200) || ''\n this.pendingTextChanges.push({ id: parentId, text })\n }\n }\n\n if (m.type === 'attributes' && m.attributeName) {\n const id = getNodeId(m.target)\n if (id !== null) {\n const value = (m.target as HTMLElement).getAttribute(m.attributeName)\n this.pendingAttrChanges.push({\n id,\n attr: m.attributeName,\n value: value?.slice(0, 200) ?? null,\n })\n }\n }\n }\n\n if (\n this.pendingAdds.length > 0\n || this.pendingRemoves.length > 0\n || this.pendingTextChanges.length > 0\n || this.pendingAttrChanges.length > 0\n ) {\n this.scheduleFlush()\n }\n }\n}\n","import type { Config, SnapshotEvent, Tracker } from '../types'\nimport type { Sender } from '../utils/sender'\nimport { resetIds, serializeTree } from '../dom/serializer'\nimport { getViewport } from '../dom/viewport'\n\nexport class SnapshotTracker implements Tracker {\n private lastUrl = ''\n private urlPollTimer: ReturnType<typeof setInterval> | null = null\n private checkpointTimer: ReturnType<typeof setInterval> | null = null\n private hasMutations = false\n\n constructor(\n private config: Config,\n private sender: Sender,\n private root: HTMLElement,\n ) {}\n\n start() {\n this.lastUrl = location.href\n this.recordSnapshot()\n\n this.urlPollTimer = setInterval(() => this.pollUrl(), 500)\n this.checkpointTimer = setInterval(() => this.checkpoint(), this.config.checkpointInterval)\n }\n\n stop() {\n if (this.urlPollTimer) {\n clearInterval(this.urlPollTimer)\n }\n if (this.checkpointTimer) {\n clearInterval(this.checkpointTimer)\n }\n }\n\n beforeUnload() {\n if (this.hasMutations) {\n this.recordSnapshot()\n }\n }\n\n markMutation() {\n this.hasMutations = true\n }\n\n private recordSnapshot() {\n resetIds()\n\n const snapshot: SnapshotEvent = {\n event: 'snapshot',\n timestamp: new Date().toISOString(),\n url: location.href,\n title: document.title,\n tree: serializeTree(this.root),\n viewport: getViewport(),\n }\n\n if (this.config.debug) {\n console.log(`[dataclient] snapshot: ${location.href} (${snapshot.tree.length} nodes)`)\n }\n\n this.sender.add(snapshot)\n this.sender.flush()\n this.hasMutations = false\n }\n\n private pollUrl() {\n if (location.href !== this.lastUrl) {\n const prev = this.lastUrl\n this.lastUrl = location.href\n if (prev) {\n if (this.config.debug) {\n console.log(`[dataclient] URL changed: ${prev} → ${location.href}`)\n }\n this.recordSnapshot()\n }\n }\n }\n\n private checkpoint() {\n if (this.hasMutations) {\n if (this.config.debug) {\n console.log('[dataclient] checkpoint snapshot')\n }\n this.recordSnapshot()\n }\n }\n}\n","export function getDeviceId(key: string): string {\n let id = localStorage.getItem(key)\n if (!id) {\n id = generateId()\n localStorage.setItem(key, id)\n }\n return id\n}\n\nexport function generateId(): string {\n const ts = Date.now().toString(36)\n const rand = Math.random().toString(36).substring(2, 12)\n return `${ts}-${rand}`\n}\n","import type { SceneBatch, SceneEvent } from '../types'\n\nconst MAX_RETRIES = 2\nconst BEACON_MAX_SIZE = 60000\n\nexport class Sender {\n private queue: SceneEvent[] = []\n private timer: ReturnType<typeof setInterval> | null = null\n private flushPromise: Promise<void> = Promise.resolve()\n\n constructor(\n private endpoint: string,\n private apiKey: string,\n private batchSize: number,\n private sessionId: string,\n private deviceId: string,\n flushInterval: number,\n ) {\n this.timer = setInterval(() => this.flush(), flushInterval)\n }\n\n add(event: SceneEvent) {\n this.queue.push(event)\n\n const isRrwebSnapshot = event.event === 'rrweb'\n && event.rrwebEvent.type === 2\n\n if (isRrwebSnapshot || this.queue.length >= this.batchSize) {\n this.flush()\n }\n }\n\n flush() {\n this.flushPromise = this.flushPromise.then(() => this.doFlush())\n }\n\n flushSync() {\n if (this.queue.length === 0)\n return\n\n const events = this.queue.splice(0)\n const url = this.buildUrl()\n\n let chunk: SceneEvent[] = []\n let chunkSize = 0\n\n for (const event of events) {\n const eventJson = JSON.stringify(event)\n if (chunkSize + eventJson.length > BEACON_MAX_SIZE && chunk.length > 0) {\n this.sendBeacon(chunk, url)\n chunk = []\n chunkSize = 0\n }\n chunk.push(event)\n chunkSize += eventJson.length\n }\n\n if (chunk.length > 0) {\n this.sendBeacon(chunk, url)\n }\n }\n\n destroy() {\n if (this.timer) {\n clearInterval(this.timer)\n }\n this.flushSync()\n }\n\n private async doFlush() {\n if (this.queue.length === 0)\n return\n\n const events = this.queue.splice(0)\n const batch = this.buildBatch(events)\n const json = JSON.stringify(batch)\n const url = this.buildUrl()\n\n const success = await this.send(json, url)\n\n if (!success) {\n this.queue.unshift(...events)\n }\n }\n\n private sendBeacon(events: SceneEvent[], url: string) {\n const batch = this.buildBatch(events)\n const json = JSON.stringify(batch)\n const blob = new Blob([json], { type: 'application/json' })\n navigator.sendBeacon(url, blob)\n }\n\n private buildUrl(): string {\n return `${this.endpoint}?key=${encodeURIComponent(this.apiKey)}`\n }\n\n private buildBatch(events: SceneEvent[]): SceneBatch {\n return {\n session_id: this.sessionId,\n device_id: this.deviceId,\n events,\n sent_at: new Date().toISOString(),\n page_url: location.href,\n user_agent: navigator.userAgent,\n screen: {\n width: screen.width,\n height: screen.height,\n viewport_width: window.innerWidth,\n viewport_height: window.innerHeight,\n },\n }\n }\n\n private async send(json: string, url: string): Promise<boolean> {\n for (let attempt = 0; attempt <= MAX_RETRIES; attempt++) {\n try {\n const response = await fetch(url, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: json,\n })\n if (response.ok)\n return true\n }\n catch {}\n\n if (attempt < MAX_RETRIES) {\n await new Promise(r => setTimeout(r, (attempt + 1) * 200))\n }\n }\n return false\n }\n}\n","import type { Config, Tracker } from './types'\nimport { ActionTracker } from './trackers/action'\nimport { MutationTracker } from './trackers/mutation'\nimport { RrwebTracker } from './trackers/rrweb'\nimport { SnapshotTracker } from './trackers/snapshot'\nimport { generateId, getDeviceId } from './utils/identity'\nimport { Sender } from './utils/sender'\n\nexport type * from './types'\n\nconst defaults: Config = {\n endpoint: 'https://my.tamsense.com/api/events',\n debug: false,\n batchSize: 5,\n flushInterval: 5000,\n checkpointInterval: 30000,\n idleTimeout: 60 * 60 * 1000,\n mutationDebounce: 200,\n inputDebounce: 1000,\n sessionIdKey: 'sc2_sid',\n deviceIdKey: 'sc2_did',\n apiKey: '',\n scoped: '',\n}\n\nconst VALID_ATTR_NAME = /^[a-z][\\w-]*$/i\n\nexport class DataClient {\n private sender: Sender | null = null\n private trackers: Tracker[] = []\n private config: Config\n private deviceId: string\n private idleTimer: ReturnType<typeof setTimeout> | null = null\n private userId: string | null = null\n private rootEl: HTMLElement | null = null\n private scopeObserver: MutationObserver | null = null\n private scopeCheckScheduled = false\n private activityHandler: (() => void) | null = null\n private activityTarget: EventTarget | null = null\n\n constructor(options?: Partial<Config>) {\n this.config = { ...defaults, ...options }\n this.config.scoped = this.normalizeScoped(this.config.scoped)\n this.deviceId = getDeviceId(this.config.deviceIdKey)\n\n if (this.config.scoped) {\n this.startScopedMode()\n }\n else {\n this.startSession(document.body)\n this.attachActivityListeners(document)\n }\n }\n\n setUser(userId: string) {\n this.userId = userId\n this.sender?.add({ event: 'identify', timestamp: new Date().toISOString(), user_id: userId })\n }\n\n excludeSession(reason = '') {\n this.sender?.add({ event: 'exclude', timestamp: new Date().toISOString(), reason })\n this.stopSession()\n if (this.scopeObserver) {\n this.scopeObserver.disconnect()\n this.scopeObserver = null\n }\n this.detachActivityListeners()\n }\n\n private normalizeScoped(value: string): string {\n if (!value) {\n return ''\n }\n if (!VALID_ATTR_NAME.test(value)) {\n if (this.config.debug) {\n console.warn(`[dataclient] invalid \"scoped\" attribute name: ${JSON.stringify(value)}. Falling back to non-scoped mode.`)\n }\n return ''\n }\n return value\n }\n\n private startScopedMode() {\n const initial = this.findRoot()\n if (initial) {\n this.onRootAppeared(initial)\n }\n this.scopeObserver = new MutationObserver(() => this.scheduleScopeCheck())\n this.scopeObserver.observe(document.body, { childList: true, subtree: true })\n\n if (this.config.debug) {\n console.log(`[dataclient] scoped mode: watching for [${this.config.scoped}]`)\n }\n }\n\n private findRoot(): HTMLElement | null {\n return document.querySelector<HTMLElement>(`[${this.config.scoped}]`)\n }\n\n private scheduleScopeCheck() {\n if (this.scopeCheckScheduled) {\n return\n }\n this.scopeCheckScheduled = true\n queueMicrotask(() => {\n this.scopeCheckScheduled = false\n this.handleScopeChange()\n })\n }\n\n private handleScopeChange() {\n const current = this.findRoot()\n if (current === this.rootEl) {\n return\n }\n if (this.rootEl) {\n this.onRootDisappeared()\n }\n if (current) {\n this.onRootAppeared(current)\n }\n }\n\n private onRootAppeared(root: HTMLElement) {\n this.rootEl = root\n this.attachActivityListeners(root)\n this.startSession(root)\n if (this.config.debug) {\n console.log(`[dataclient] root [${this.config.scoped}] appeared`)\n }\n }\n\n private onRootDisappeared() {\n if (this.config.debug) {\n console.log(`[dataclient] root [${this.config.scoped}] removed`)\n }\n this.detachActivityListeners()\n this.stopSession()\n this.rootEl = null\n }\n\n private onActivity() {\n if (!this.sender) {\n if (this.config.scoped) {\n if (!this.rootEl) {\n return\n }\n this.startSession(this.rootEl)\n }\n else {\n this.startSession(document.body)\n }\n }\n this.resetIdleTimer()\n }\n\n private resetIdleTimer() {\n if (this.idleTimer)\n clearTimeout(this.idleTimer)\n this.idleTimer = setTimeout(() => this.stopSession(), this.config.idleTimeout)\n }\n\n private attachActivityListeners(target: EventTarget) {\n this.detachActivityListeners()\n const handler = () => this.onActivity()\n target.addEventListener('click', handler, true)\n target.addEventListener('input', handler, true)\n target.addEventListener('change', handler, true)\n this.activityHandler = handler\n this.activityTarget = target\n }\n\n private detachActivityListeners() {\n if (!this.activityHandler || !this.activityTarget) {\n return\n }\n this.activityTarget.removeEventListener('click', this.activityHandler, true)\n this.activityTarget.removeEventListener('input', this.activityHandler, true)\n this.activityTarget.removeEventListener('change', this.activityHandler, true)\n this.activityHandler = null\n this.activityTarget = null\n }\n\n private startSession(root: HTMLElement) {\n const sessionId = generateId()\n\n this.sender = new Sender(\n this.config.endpoint,\n this.config.apiKey,\n this.config.batchSize,\n sessionId,\n this.deviceId,\n this.config.flushInterval,\n )\n\n const snapshotTracker = new SnapshotTracker(this.config, this.sender, root)\n const mutationTracker = new MutationTracker(this.config, this.sender, root, () => snapshotTracker.markMutation())\n const actionTracker = new ActionTracker(this.config, this.sender, root)\n const rrwebTracker = new RrwebTracker(this.config, this.sender)\n\n this.trackers = [snapshotTracker, mutationTracker, actionTracker, rrwebTracker]\n this.trackers.forEach(t => t.start())\n\n if (this.userId) {\n this.sender.add({ event: 'identify', timestamp: new Date().toISOString(), user_id: this.userId })\n }\n\n this.resetIdleTimer()\n\n const onLeave = () => {\n this.trackers.forEach(t => t.beforeUnload?.())\n this.sender?.flushSync()\n }\n\n document.addEventListener('visibilitychange', () => {\n if (document.visibilityState === 'hidden')\n onLeave()\n })\n window.addEventListener('pagehide', onLeave)\n\n if (this.config.debug) {\n console.log(`[dataclient] Session started: ${sessionId}`)\n }\n }\n\n private stopSession() {\n if (this.idleTimer) {\n clearTimeout(this.idleTimer)\n this.idleTimer = null\n }\n this.trackers.forEach(t => t.beforeUnload?.())\n this.trackers.forEach(t => t.stop())\n this.trackers = []\n if (this.sender) {\n this.sender.destroy()\n this.sender = null\n }\n\n if (this.config.debug) {\n console.log('[dataclient] Session stopped')\n }\n }\n}\n"],"mappings":";AAAO,IAAM,YAAY;AAClB,IAAM,gBAAgB,IAAI,SAAS;AAEnC,IAAM,YAAY,oBAAI,IAAI,CAAC,UAAU,SAAS,YAAY,OAAO,QAAQ,QAAQ,MAAM,CAAC;AAExF,IAAM,eAAe,oBAAI,IAAI;AAAA,EAChC;AAAA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