humanbehavior-js 0.3.3 → 0.3.4
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/cjs/index.js +11 -4
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +11 -4
- package/dist/esm/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/tracker.ts +13 -4
package/dist/types/index.d.ts
CHANGED
|
@@ -262,7 +262,7 @@ declare class HumanBehaviorTracker {
|
|
|
262
262
|
getCurrentUrl(): string;
|
|
263
263
|
/**
|
|
264
264
|
* Get current snapshot frequency info
|
|
265
|
-
* Uses
|
|
265
|
+
* Uses configured values (5 minutes, 1000 events) - PostHog-style
|
|
266
266
|
*/
|
|
267
267
|
getSnapshotFrequencyInfo(): {
|
|
268
268
|
sessionDuration: number;
|
package/package.json
CHANGED
package/src/tracker.ts
CHANGED
|
@@ -760,6 +760,11 @@ export class HumanBehaviorTracker {
|
|
|
760
760
|
emit: (event) => {
|
|
761
761
|
// ✅ DIRECT EVENT HANDLING - Let rrweb handle events natively
|
|
762
762
|
this.addEvent(event);
|
|
763
|
+
|
|
764
|
+
// ✅ DEBUG FULLSNAPSHOT GENERATION
|
|
765
|
+
if (event.type === 2) { // FullSnapshot
|
|
766
|
+
logDebug(`🎯 FullSnapshot generated at ${new Date().toISOString()}`);
|
|
767
|
+
}
|
|
763
768
|
},
|
|
764
769
|
inlineStylesheet: true,
|
|
765
770
|
recordCanvas: true,
|
|
@@ -773,6 +778,10 @@ export class HumanBehaviorTracker {
|
|
|
773
778
|
maskAllInputs: false, // Let users control this via selectors
|
|
774
779
|
maskTextSelector: this.redactionManager.getMaskTextSelector() || undefined,
|
|
775
780
|
|
|
781
|
+
// ✅ FULLSNAPSHOT GENERATION - Use reasonable intervals (PostHog-style)
|
|
782
|
+
checkoutEveryNms: 300000, // Take FullSnapshot every 5 minutes (like PostHog)
|
|
783
|
+
checkoutEveryNth: 1000, // Take FullSnapshot every 1000 events
|
|
784
|
+
|
|
776
785
|
// ✅ SELECTOR-BASED REDACTION - Users control via CSS selectors
|
|
777
786
|
// No custom masking functions needed - rrweb handles this natively
|
|
778
787
|
});
|
|
@@ -1063,7 +1072,7 @@ export class HumanBehaviorTracker {
|
|
|
1063
1072
|
|
|
1064
1073
|
/**
|
|
1065
1074
|
* Get current snapshot frequency info
|
|
1066
|
-
* Uses
|
|
1075
|
+
* Uses configured values (5 minutes, 1000 events) - PostHog-style
|
|
1067
1076
|
*/
|
|
1068
1077
|
public getSnapshotFrequencyInfo(): {
|
|
1069
1078
|
sessionDuration: number;
|
|
@@ -1075,9 +1084,9 @@ export class HumanBehaviorTracker {
|
|
|
1075
1084
|
|
|
1076
1085
|
return {
|
|
1077
1086
|
sessionDuration,
|
|
1078
|
-
currentInterval:
|
|
1079
|
-
currentThreshold:
|
|
1080
|
-
phase: '
|
|
1087
|
+
currentInterval: 300000, // Configured - 5 minutes (PostHog-style)
|
|
1088
|
+
currentThreshold: 1000, // Configured - 1000 events
|
|
1089
|
+
phase: 'configured' // Using explicit configuration
|
|
1081
1090
|
};
|
|
1082
1091
|
}
|
|
1083
1092
|
|