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