humanbehavior-js 0.4.7 → 0.4.9

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.
Files changed (54) hide show
  1. package/dist/cjs/angular/index.cjs +13 -14
  2. package/dist/cjs/angular/index.cjs.map +1 -1
  3. package/dist/cjs/index.cjs +14 -15
  4. package/dist/cjs/index.cjs.map +1 -1
  5. package/dist/cjs/install-wizard.cjs +4 -2
  6. package/dist/cjs/install-wizard.cjs.map +1 -1
  7. package/dist/cjs/react/index.cjs +13 -14
  8. package/dist/cjs/react/index.cjs.map +1 -1
  9. package/dist/cjs/remix/index.cjs +13 -14
  10. package/dist/cjs/remix/index.cjs.map +1 -1
  11. package/dist/cjs/svelte/index.cjs +13 -14
  12. package/dist/cjs/svelte/index.cjs.map +1 -1
  13. package/dist/cjs/vue/index.cjs +13 -14
  14. package/dist/cjs/vue/index.cjs.map +1 -1
  15. package/dist/cjs/wizard/index.cjs +3208 -0
  16. package/dist/cjs/wizard/index.cjs.map +1 -0
  17. package/dist/cli/ai-auto-install.js +2024 -0
  18. package/dist/cli/ai-auto-install.js.map +1 -0
  19. package/dist/cli/auto-install.js +4 -2
  20. package/dist/cli/auto-install.js.map +1 -1
  21. package/dist/esm/angular/index.js +13 -14
  22. package/dist/esm/angular/index.js.map +1 -1
  23. package/dist/esm/index.js +14 -15
  24. package/dist/esm/index.js.map +1 -1
  25. package/dist/esm/install-wizard.js +4 -2
  26. package/dist/esm/install-wizard.js.map +1 -1
  27. package/dist/esm/react/index.js +13 -14
  28. package/dist/esm/react/index.js.map +1 -1
  29. package/dist/esm/remix/index.js +13 -14
  30. package/dist/esm/remix/index.js.map +1 -1
  31. package/dist/esm/svelte/index.js +13 -14
  32. package/dist/esm/svelte/index.js.map +1 -1
  33. package/dist/esm/vue/index.js +13 -14
  34. package/dist/esm/vue/index.js.map +1 -1
  35. package/dist/esm/wizard/index.js +3178 -0
  36. package/dist/esm/wizard/index.js.map +1 -0
  37. package/dist/index.min.js +1 -1
  38. package/dist/index.min.js.map +1 -1
  39. package/dist/types/install-wizard.d.ts +8 -8
  40. package/dist/types/wizard/index.d.ts +489 -0
  41. package/package.json +14 -8
  42. package/rollup.config.js +65 -3
  43. package/src/api.ts +9 -9
  44. package/src/react/AutoInstallWizard.tsx +1 -1
  45. package/src/tracker.ts +6 -7
  46. package/src/wizard/README.md +114 -0
  47. package/src/wizard/ai/ai-install-wizard.ts +894 -0
  48. package/src/wizard/ai/manual-framework-wizard.ts +236 -0
  49. package/src/wizard/cli/ai-auto-install.ts +369 -0
  50. package/src/{cli → wizard/cli}/auto-install.ts +1 -1
  51. package/src/{install-wizard.ts → wizard/core/install-wizard.ts} +12 -10
  52. package/src/wizard/index.ts +23 -0
  53. package/src/wizard/services/centralized-ai-service.ts +668 -0
  54. package/src/wizard/services/remote-ai-service.ts +224 -0
@@ -12451,7 +12451,7 @@ class HumanBehaviorAPI {
12451
12451
  entryURL = window.location.href;
12452
12452
  referrer = document.referrer;
12453
12453
  }
12454
- console.log('API init called with:', { sessionId, userId, entryURL, referrer, baseUrl: this.baseUrl });
12454
+ logInfo('API init called with:', { sessionId, userId, entryURL, referrer, baseUrl: this.baseUrl });
12455
12455
  try {
12456
12456
  const response = yield fetch(`${this.baseUrl}/api/ingestion/init`, {
12457
12457
  method: 'POST',
@@ -12467,21 +12467,21 @@ class HumanBehaviorAPI {
12467
12467
  referrer: referrer
12468
12468
  })
12469
12469
  });
12470
- console.log('API init response status:', response.status);
12470
+ logInfo('API init response status:', response.status);
12471
12471
  if (!response.ok) {
12472
12472
  const errorText = yield response.text();
12473
- console.error('API init failed:', response.status, errorText);
12473
+ logError('API init failed:', response.status, errorText);
12474
12474
  throw new Error(`Failed to initialize ingestion: ${response.statusText} - ${errorText}`);
12475
12475
  }
12476
12476
  const responseJson = yield response.json();
12477
- console.log('API init success:', responseJson);
12477
+ logInfo('API init success:', responseJson);
12478
12478
  return {
12479
12479
  sessionId: responseJson.sessionId,
12480
12480
  endUserId: responseJson.endUserId
12481
12481
  };
12482
12482
  }
12483
12483
  catch (error) {
12484
- console.error('API init error:', error);
12484
+ logError('API init error:', error);
12485
12485
  throw error;
12486
12486
  }
12487
12487
  });
@@ -12584,7 +12584,7 @@ class HumanBehaviorAPI {
12584
12584
  sessionId: sessionId,
12585
12585
  posthogName: userData.email || userData.name || null // Update user name with email
12586
12586
  };
12587
- console.log('Sending user data to server:', payload);
12587
+ logInfo('Sending user data to server:', payload);
12588
12588
  const response = yield fetch(`${this.baseUrl}/api/ingestion/user`, {
12589
12589
  method: 'POST',
12590
12590
  headers: {
@@ -12597,7 +12597,7 @@ class HumanBehaviorAPI {
12597
12597
  throw new Error(`Failed to send user data: ${response.statusText} with API key: ${this.apiKey}`);
12598
12598
  }
12599
12599
  const result = yield response.json();
12600
- console.log('Server response:', result);
12600
+ logInfo('Server response:', result);
12601
12601
  return result;
12602
12602
  }
12603
12603
  catch (error) {
@@ -13339,7 +13339,7 @@ class HumanBehaviorTracker {
13339
13339
  this.originalPushState.apply(history, args);
13340
13340
  // Track navigation event
13341
13341
  this.trackNavigationEvent('pushState', this.previousUrl, this.currentUrl);
13342
- // Take FullSnapshot on navigation (like PostHog does)
13342
+ // Take FullSnapshot on navigation
13343
13343
  this.takeFullSnapshot();
13344
13344
  };
13345
13345
  // Override replaceState to capture programmatic navigation
@@ -13350,7 +13350,7 @@ class HumanBehaviorTracker {
13350
13350
  this.originalReplaceState.apply(history, args);
13351
13351
  // Track navigation event
13352
13352
  this.trackNavigationEvent('replaceState', this.previousUrl, this.currentUrl);
13353
- // Take FullSnapshot on navigation (like PostHog does)
13353
+ // Take FullSnapshot on navigation
13354
13354
  this.takeFullSnapshot();
13355
13355
  };
13356
13356
  // Listen for popstate events (back/forward navigation)
@@ -13358,7 +13358,7 @@ class HumanBehaviorTracker {
13358
13358
  this.previousUrl = this.currentUrl;
13359
13359
  this.currentUrl = window.location.href;
13360
13360
  this.trackNavigationEvent('popstate', this.previousUrl, this.currentUrl);
13361
- // Take FullSnapshot on navigation (like PostHog does)
13361
+ // Take FullSnapshot on navigation
13362
13362
  this.takeFullSnapshot();
13363
13363
  };
13364
13364
  window.addEventListener('popstate', popstateListener);
@@ -13748,7 +13748,7 @@ class HumanBehaviorTracker {
13748
13748
  viewLogs() {
13749
13749
  try {
13750
13750
  const logs = logger.getLogs();
13751
- console.log('HumanBehavior Logs:', logs);
13751
+ logInfo('HumanBehavior Logs:', logs);
13752
13752
  logger.clearLogs(); // Clear logs after viewing
13753
13753
  }
13754
13754
  catch (e) {
@@ -13816,9 +13816,8 @@ class HumanBehaviorTracker {
13816
13816
  recordCrossOriginIframes: false, // HumanBehavior default
13817
13817
  // ✅ CANVAS RECORDING - Disabled to prevent large data URIs
13818
13818
  recordCanvas: false, // Disabled to prevent large data URIs
13819
- // ✅ FULLSNAPSHOT GENERATION - Following PostHog's approach (no periodic snapshots)
13820
- // PostHog doesn't use checkoutEveryNms or checkoutEveryNth to avoid animation issues
13821
- // They rely on initial FullSnapshot + navigation-triggered ones only
13819
+ // ✅ FULLSNAPSHOT GENERATION - No periodic snapshots to avoid animation issues
13820
+ // Rely on initial FullSnapshot + navigation-triggered ones only
13822
13821
  });
13823
13822
  // Store the record instance for cleanup
13824
13823
  this.recordInstance = recordInstance || null;