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