humanbehavior-js 0.4.6 → 0.4.8
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/angular/index.cjs +52 -7
- package/dist/cjs/angular/index.cjs.map +1 -1
- package/dist/cjs/index.cjs +52 -7
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/install-wizard.cjs +4 -2
- package/dist/cjs/install-wizard.cjs.map +1 -1
- package/dist/cjs/react/index.cjs +52 -7
- package/dist/cjs/react/index.cjs.map +1 -1
- package/dist/cjs/remix/index.cjs +52 -7
- package/dist/cjs/remix/index.cjs.map +1 -1
- package/dist/cjs/svelte/index.cjs +52 -7
- package/dist/cjs/svelte/index.cjs.map +1 -1
- package/dist/cjs/vue/index.cjs +52 -7
- package/dist/cjs/vue/index.cjs.map +1 -1
- package/dist/cjs/wizard/index.cjs +3208 -0
- package/dist/cjs/wizard/index.cjs.map +1 -0
- package/dist/cli/ai-auto-install.js +2024 -0
- package/dist/cli/ai-auto-install.js.map +1 -0
- package/dist/cli/auto-install.js +4 -2
- package/dist/cli/auto-install.js.map +1 -1
- package/dist/esm/angular/index.js +52 -7
- package/dist/esm/angular/index.js.map +1 -1
- package/dist/esm/index.js +52 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/install-wizard.js +4 -2
- package/dist/esm/install-wizard.js.map +1 -1
- package/dist/esm/react/index.js +52 -7
- package/dist/esm/react/index.js.map +1 -1
- package/dist/esm/remix/index.js +52 -7
- package/dist/esm/remix/index.js.map +1 -1
- package/dist/esm/svelte/index.js +52 -7
- package/dist/esm/svelte/index.js.map +1 -1
- package/dist/esm/vue/index.js +52 -7
- package/dist/esm/vue/index.js.map +1 -1
- package/dist/esm/wizard/index.js +3178 -0
- package/dist/esm/wizard/index.js.map +1 -0
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/types/angular/index.d.ts +7 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/install-wizard.d.ts +8 -8
- package/dist/types/react/index.d.ts +7 -0
- package/dist/types/remix/index.d.ts +7 -0
- package/dist/types/svelte/index.d.ts +7 -0
- package/dist/types/wizard/index.d.ts +489 -0
- package/package.json +14 -8
- package/rollup.config.js +65 -3
- package/src/react/AutoInstallWizard.tsx +1 -1
- package/src/tracker.ts +59 -8
- package/src/wizard/README.md +114 -0
- package/src/wizard/ai/ai-install-wizard.ts +894 -0
- package/src/wizard/ai/manual-framework-wizard.ts +236 -0
- package/src/wizard/cli/ai-auto-install.ts +369 -0
- package/src/{cli → wizard/cli}/auto-install.ts +1 -1
- package/src/{install-wizard.ts → wizard/core/install-wizard.ts} +12 -10
- package/src/wizard/index.ts +23 -0
- package/src/wizard/services/centralized-ai-service.ts +668 -0
- package/src/wizard/services/remote-ai-service.ts +224 -0
package/dist/esm/index.js
CHANGED
|
@@ -13236,6 +13236,8 @@ class HumanBehaviorTracker {
|
|
|
13236
13236
|
this._connectionBlocked = false;
|
|
13237
13237
|
this.recordInstance = null;
|
|
13238
13238
|
this.sessionStartTime = Date.now();
|
|
13239
|
+
this.rrwebRecord = null;
|
|
13240
|
+
this.fullSnapshotTimeout = null;
|
|
13239
13241
|
if (!apiKey) {
|
|
13240
13242
|
throw new Error('Human Behavior API Key is required');
|
|
13241
13243
|
}
|
|
@@ -13343,6 +13345,8 @@ class HumanBehaviorTracker {
|
|
|
13343
13345
|
this.originalPushState.apply(history, args);
|
|
13344
13346
|
// Track navigation event
|
|
13345
13347
|
this.trackNavigationEvent('pushState', this.previousUrl, this.currentUrl);
|
|
13348
|
+
// Take FullSnapshot on navigation
|
|
13349
|
+
this.takeFullSnapshot();
|
|
13346
13350
|
};
|
|
13347
13351
|
// Override replaceState to capture programmatic navigation
|
|
13348
13352
|
history.replaceState = (...args) => {
|
|
@@ -13352,12 +13356,16 @@ class HumanBehaviorTracker {
|
|
|
13352
13356
|
this.originalReplaceState.apply(history, args);
|
|
13353
13357
|
// Track navigation event
|
|
13354
13358
|
this.trackNavigationEvent('replaceState', this.previousUrl, this.currentUrl);
|
|
13359
|
+
// Take FullSnapshot on navigation
|
|
13360
|
+
this.takeFullSnapshot();
|
|
13355
13361
|
};
|
|
13356
13362
|
// Listen for popstate events (back/forward navigation)
|
|
13357
13363
|
const popstateListener = () => {
|
|
13358
13364
|
this.previousUrl = this.currentUrl;
|
|
13359
13365
|
this.currentUrl = window.location.href;
|
|
13360
13366
|
this.trackNavigationEvent('popstate', this.previousUrl, this.currentUrl);
|
|
13367
|
+
// Take FullSnapshot on navigation
|
|
13368
|
+
this.takeFullSnapshot();
|
|
13361
13369
|
};
|
|
13362
13370
|
window.addEventListener('popstate', popstateListener);
|
|
13363
13371
|
this.navigationListeners.push(() => {
|
|
@@ -13785,13 +13793,14 @@ class HumanBehaviorTracker {
|
|
|
13785
13793
|
this.flushInterval = window.setInterval(() => {
|
|
13786
13794
|
this.flush();
|
|
13787
13795
|
}, this.FLUSH_INTERVAL_MS);
|
|
13788
|
-
//
|
|
13789
|
-
this.enableConsoleTracking();
|
|
13796
|
+
// Disable console tracking to reduce event pollution
|
|
13797
|
+
// this.enableConsoleTracking();
|
|
13790
13798
|
// ✅ DOM READY DETECTION
|
|
13791
13799
|
// Wait for DOM to be ready before starting recording
|
|
13792
13800
|
const startRecording = () => {
|
|
13793
13801
|
logDebug('🎯 DOM ready, starting session recording');
|
|
13794
13802
|
// ✅ HUMANBEHAVIOR RRWEB CONFIGURATION
|
|
13803
|
+
this.rrwebRecord = record;
|
|
13795
13804
|
const recordInstance = record({
|
|
13796
13805
|
emit: (event) => {
|
|
13797
13806
|
// ✅ DIRECT EVENT HANDLING - Let rrweb handle events natively
|
|
@@ -13813,12 +13822,11 @@ class HumanBehaviorTracker {
|
|
|
13813
13822
|
recordCrossOriginIframes: false, // HumanBehavior default
|
|
13814
13823
|
// ✅ CANVAS RECORDING - Disabled to prevent large data URIs
|
|
13815
13824
|
recordCanvas: false, // Disabled to prevent large data URIs
|
|
13816
|
-
// ✅ FULLSNAPSHOT GENERATION -
|
|
13817
|
-
//
|
|
13818
|
-
// checkoutEveryNth: 1000, // Take FullSnapshot every 1000 events
|
|
13825
|
+
// ✅ FULLSNAPSHOT GENERATION - No periodic snapshots to avoid animation issues
|
|
13826
|
+
// Rely on initial FullSnapshot + navigation-triggered ones only
|
|
13819
13827
|
});
|
|
13820
|
-
// Store the record instance for cleanup
|
|
13821
|
-
this.recordInstance = recordInstance;
|
|
13828
|
+
// Store the record instance for cleanup
|
|
13829
|
+
this.recordInstance = recordInstance || null;
|
|
13822
13830
|
};
|
|
13823
13831
|
// ✅ DOM READY DETECTION
|
|
13824
13832
|
logDebug(`🎯 DOM ready state: ${document.readyState}`);
|
|
@@ -13837,6 +13845,37 @@ class HumanBehaviorTracker {
|
|
|
13837
13845
|
}
|
|
13838
13846
|
});
|
|
13839
13847
|
}
|
|
13848
|
+
/**
|
|
13849
|
+
* Manually trigger a FullSnapshot (for navigation events)
|
|
13850
|
+
* Delays snapshot to avoid capturing mid-animation states
|
|
13851
|
+
*/
|
|
13852
|
+
takeFullSnapshot() {
|
|
13853
|
+
// Clear any existing timeout to avoid multiple snapshots
|
|
13854
|
+
if (this.fullSnapshotTimeout) {
|
|
13855
|
+
clearTimeout(this.fullSnapshotTimeout);
|
|
13856
|
+
}
|
|
13857
|
+
// Delay FullSnapshot to let animations settle
|
|
13858
|
+
this.fullSnapshotTimeout = window.setTimeout(() => {
|
|
13859
|
+
try {
|
|
13860
|
+
// Wait for any pending animations/transitions to complete
|
|
13861
|
+
requestAnimationFrame(() => {
|
|
13862
|
+
requestAnimationFrame(() => {
|
|
13863
|
+
// Access takeFullSnapshot from the rrweb record function
|
|
13864
|
+
if (this.rrwebRecord && typeof this.rrwebRecord.takeFullSnapshot === 'function') {
|
|
13865
|
+
this.rrwebRecord.takeFullSnapshot();
|
|
13866
|
+
logDebug('✅ FullSnapshot taken for navigation (delayed for animations)');
|
|
13867
|
+
}
|
|
13868
|
+
else {
|
|
13869
|
+
logWarn('⚠️ takeFullSnapshot not available on record function');
|
|
13870
|
+
}
|
|
13871
|
+
});
|
|
13872
|
+
});
|
|
13873
|
+
}
|
|
13874
|
+
catch (error) {
|
|
13875
|
+
logError('❌ Failed to take FullSnapshot for navigation:', error);
|
|
13876
|
+
}
|
|
13877
|
+
}, 1000); // Wait 1 second for animations to settle
|
|
13878
|
+
}
|
|
13840
13879
|
stop() {
|
|
13841
13880
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13842
13881
|
yield this.ensureInitialized();
|
|
@@ -13851,6 +13890,12 @@ class HumanBehaviorTracker {
|
|
|
13851
13890
|
this.recordInstance();
|
|
13852
13891
|
this.recordInstance = null;
|
|
13853
13892
|
}
|
|
13893
|
+
// Clear any pending FullSnapshot timeouts
|
|
13894
|
+
if (this.fullSnapshotTimeout) {
|
|
13895
|
+
clearTimeout(this.fullSnapshotTimeout);
|
|
13896
|
+
this.fullSnapshotTimeout = null;
|
|
13897
|
+
}
|
|
13898
|
+
this.rrwebRecord = null;
|
|
13854
13899
|
// Disable console tracking
|
|
13855
13900
|
this.disableConsoleTracking();
|
|
13856
13901
|
// Cleanup navigation tracking
|