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/vue/index.js
CHANGED
|
@@ -13226,6 +13226,8 @@ class HumanBehaviorTracker {
|
|
|
13226
13226
|
this._connectionBlocked = false;
|
|
13227
13227
|
this.recordInstance = null;
|
|
13228
13228
|
this.sessionStartTime = Date.now();
|
|
13229
|
+
this.rrwebRecord = null;
|
|
13230
|
+
this.fullSnapshotTimeout = null;
|
|
13229
13231
|
if (!apiKey) {
|
|
13230
13232
|
throw new Error('Human Behavior API Key is required');
|
|
13231
13233
|
}
|
|
@@ -13333,6 +13335,8 @@ class HumanBehaviorTracker {
|
|
|
13333
13335
|
this.originalPushState.apply(history, args);
|
|
13334
13336
|
// Track navigation event
|
|
13335
13337
|
this.trackNavigationEvent('pushState', this.previousUrl, this.currentUrl);
|
|
13338
|
+
// Take FullSnapshot on navigation
|
|
13339
|
+
this.takeFullSnapshot();
|
|
13336
13340
|
};
|
|
13337
13341
|
// Override replaceState to capture programmatic navigation
|
|
13338
13342
|
history.replaceState = (...args) => {
|
|
@@ -13342,12 +13346,16 @@ class HumanBehaviorTracker {
|
|
|
13342
13346
|
this.originalReplaceState.apply(history, args);
|
|
13343
13347
|
// Track navigation event
|
|
13344
13348
|
this.trackNavigationEvent('replaceState', this.previousUrl, this.currentUrl);
|
|
13349
|
+
// Take FullSnapshot on navigation
|
|
13350
|
+
this.takeFullSnapshot();
|
|
13345
13351
|
};
|
|
13346
13352
|
// Listen for popstate events (back/forward navigation)
|
|
13347
13353
|
const popstateListener = () => {
|
|
13348
13354
|
this.previousUrl = this.currentUrl;
|
|
13349
13355
|
this.currentUrl = window.location.href;
|
|
13350
13356
|
this.trackNavigationEvent('popstate', this.previousUrl, this.currentUrl);
|
|
13357
|
+
// Take FullSnapshot on navigation
|
|
13358
|
+
this.takeFullSnapshot();
|
|
13351
13359
|
};
|
|
13352
13360
|
window.addEventListener('popstate', popstateListener);
|
|
13353
13361
|
this.navigationListeners.push(() => {
|
|
@@ -13775,13 +13783,14 @@ class HumanBehaviorTracker {
|
|
|
13775
13783
|
this.flushInterval = window.setInterval(() => {
|
|
13776
13784
|
this.flush();
|
|
13777
13785
|
}, this.FLUSH_INTERVAL_MS);
|
|
13778
|
-
//
|
|
13779
|
-
this.enableConsoleTracking();
|
|
13786
|
+
// Disable console tracking to reduce event pollution
|
|
13787
|
+
// this.enableConsoleTracking();
|
|
13780
13788
|
// ✅ DOM READY DETECTION
|
|
13781
13789
|
// Wait for DOM to be ready before starting recording
|
|
13782
13790
|
const startRecording = () => {
|
|
13783
13791
|
logDebug('🎯 DOM ready, starting session recording');
|
|
13784
13792
|
// ✅ HUMANBEHAVIOR RRWEB CONFIGURATION
|
|
13793
|
+
this.rrwebRecord = record;
|
|
13785
13794
|
const recordInstance = record({
|
|
13786
13795
|
emit: (event) => {
|
|
13787
13796
|
// ✅ DIRECT EVENT HANDLING - Let rrweb handle events natively
|
|
@@ -13803,12 +13812,11 @@ class HumanBehaviorTracker {
|
|
|
13803
13812
|
recordCrossOriginIframes: false, // HumanBehavior default
|
|
13804
13813
|
// ✅ CANVAS RECORDING - Disabled to prevent large data URIs
|
|
13805
13814
|
recordCanvas: false, // Disabled to prevent large data URIs
|
|
13806
|
-
// ✅ FULLSNAPSHOT GENERATION -
|
|
13807
|
-
//
|
|
13808
|
-
// checkoutEveryNth: 1000, // Take FullSnapshot every 1000 events
|
|
13815
|
+
// ✅ FULLSNAPSHOT GENERATION - No periodic snapshots to avoid animation issues
|
|
13816
|
+
// Rely on initial FullSnapshot + navigation-triggered ones only
|
|
13809
13817
|
});
|
|
13810
|
-
// Store the record instance for cleanup
|
|
13811
|
-
this.recordInstance = recordInstance;
|
|
13818
|
+
// Store the record instance for cleanup
|
|
13819
|
+
this.recordInstance = recordInstance || null;
|
|
13812
13820
|
};
|
|
13813
13821
|
// ✅ DOM READY DETECTION
|
|
13814
13822
|
logDebug(`🎯 DOM ready state: ${document.readyState}`);
|
|
@@ -13827,6 +13835,37 @@ class HumanBehaviorTracker {
|
|
|
13827
13835
|
}
|
|
13828
13836
|
});
|
|
13829
13837
|
}
|
|
13838
|
+
/**
|
|
13839
|
+
* Manually trigger a FullSnapshot (for navigation events)
|
|
13840
|
+
* Delays snapshot to avoid capturing mid-animation states
|
|
13841
|
+
*/
|
|
13842
|
+
takeFullSnapshot() {
|
|
13843
|
+
// Clear any existing timeout to avoid multiple snapshots
|
|
13844
|
+
if (this.fullSnapshotTimeout) {
|
|
13845
|
+
clearTimeout(this.fullSnapshotTimeout);
|
|
13846
|
+
}
|
|
13847
|
+
// Delay FullSnapshot to let animations settle
|
|
13848
|
+
this.fullSnapshotTimeout = window.setTimeout(() => {
|
|
13849
|
+
try {
|
|
13850
|
+
// Wait for any pending animations/transitions to complete
|
|
13851
|
+
requestAnimationFrame(() => {
|
|
13852
|
+
requestAnimationFrame(() => {
|
|
13853
|
+
// Access takeFullSnapshot from the rrweb record function
|
|
13854
|
+
if (this.rrwebRecord && typeof this.rrwebRecord.takeFullSnapshot === 'function') {
|
|
13855
|
+
this.rrwebRecord.takeFullSnapshot();
|
|
13856
|
+
logDebug('✅ FullSnapshot taken for navigation (delayed for animations)');
|
|
13857
|
+
}
|
|
13858
|
+
else {
|
|
13859
|
+
logWarn('⚠️ takeFullSnapshot not available on record function');
|
|
13860
|
+
}
|
|
13861
|
+
});
|
|
13862
|
+
});
|
|
13863
|
+
}
|
|
13864
|
+
catch (error) {
|
|
13865
|
+
logError('❌ Failed to take FullSnapshot for navigation:', error);
|
|
13866
|
+
}
|
|
13867
|
+
}, 1000); // Wait 1 second for animations to settle
|
|
13868
|
+
}
|
|
13830
13869
|
stop() {
|
|
13831
13870
|
return __awaiter(this, void 0, void 0, function* () {
|
|
13832
13871
|
yield this.ensureInitialized();
|
|
@@ -13841,6 +13880,12 @@ class HumanBehaviorTracker {
|
|
|
13841
13880
|
this.recordInstance();
|
|
13842
13881
|
this.recordInstance = null;
|
|
13843
13882
|
}
|
|
13883
|
+
// Clear any pending FullSnapshot timeouts
|
|
13884
|
+
if (this.fullSnapshotTimeout) {
|
|
13885
|
+
clearTimeout(this.fullSnapshotTimeout);
|
|
13886
|
+
this.fullSnapshotTimeout = null;
|
|
13887
|
+
}
|
|
13888
|
+
this.rrwebRecord = null;
|
|
13844
13889
|
// Disable console tracking
|
|
13845
13890
|
this.disableConsoleTracking();
|
|
13846
13891
|
// Cleanup navigation tracking
|