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
@@ -12449,7 +12449,7 @@ class HumanBehaviorAPI {
12449
12449
  entryURL = window.location.href;
12450
12450
  referrer = document.referrer;
12451
12451
  }
12452
- console.log('API init called with:', { sessionId, userId, entryURL, referrer, baseUrl: this.baseUrl });
12452
+ logInfo('API init called with:', { sessionId, userId, entryURL, referrer, baseUrl: this.baseUrl });
12453
12453
  try {
12454
12454
  const response = yield fetch(`${this.baseUrl}/api/ingestion/init`, {
12455
12455
  method: 'POST',
@@ -12465,21 +12465,21 @@ class HumanBehaviorAPI {
12465
12465
  referrer: referrer
12466
12466
  })
12467
12467
  });
12468
- console.log('API init response status:', response.status);
12468
+ logInfo('API init response status:', response.status);
12469
12469
  if (!response.ok) {
12470
12470
  const errorText = yield response.text();
12471
- console.error('API init failed:', response.status, errorText);
12471
+ logError('API init failed:', response.status, errorText);
12472
12472
  throw new Error(`Failed to initialize ingestion: ${response.statusText} - ${errorText}`);
12473
12473
  }
12474
12474
  const responseJson = yield response.json();
12475
- console.log('API init success:', responseJson);
12475
+ logInfo('API init success:', responseJson);
12476
12476
  return {
12477
12477
  sessionId: responseJson.sessionId,
12478
12478
  endUserId: responseJson.endUserId
12479
12479
  };
12480
12480
  }
12481
12481
  catch (error) {
12482
- console.error('API init error:', error);
12482
+ logError('API init error:', error);
12483
12483
  throw error;
12484
12484
  }
12485
12485
  });
@@ -12582,7 +12582,7 @@ class HumanBehaviorAPI {
12582
12582
  sessionId: sessionId,
12583
12583
  posthogName: userData.email || userData.name || null // Update user name with email
12584
12584
  };
12585
- console.log('Sending user data to server:', payload);
12585
+ logInfo('Sending user data to server:', payload);
12586
12586
  const response = yield fetch(`${this.baseUrl}/api/ingestion/user`, {
12587
12587
  method: 'POST',
12588
12588
  headers: {
@@ -12595,7 +12595,7 @@ class HumanBehaviorAPI {
12595
12595
  throw new Error(`Failed to send user data: ${response.statusText} with API key: ${this.apiKey}`);
12596
12596
  }
12597
12597
  const result = yield response.json();
12598
- console.log('Server response:', result);
12598
+ logInfo('Server response:', result);
12599
12599
  return result;
12600
12600
  }
12601
12601
  catch (error) {
@@ -13337,7 +13337,7 @@ class HumanBehaviorTracker {
13337
13337
  this.originalPushState.apply(history, args);
13338
13338
  // Track navigation event
13339
13339
  this.trackNavigationEvent('pushState', this.previousUrl, this.currentUrl);
13340
- // Take FullSnapshot on navigation (like PostHog does)
13340
+ // Take FullSnapshot on navigation
13341
13341
  this.takeFullSnapshot();
13342
13342
  };
13343
13343
  // Override replaceState to capture programmatic navigation
@@ -13348,7 +13348,7 @@ class HumanBehaviorTracker {
13348
13348
  this.originalReplaceState.apply(history, args);
13349
13349
  // Track navigation event
13350
13350
  this.trackNavigationEvent('replaceState', this.previousUrl, this.currentUrl);
13351
- // Take FullSnapshot on navigation (like PostHog does)
13351
+ // Take FullSnapshot on navigation
13352
13352
  this.takeFullSnapshot();
13353
13353
  };
13354
13354
  // Listen for popstate events (back/forward navigation)
@@ -13356,7 +13356,7 @@ class HumanBehaviorTracker {
13356
13356
  this.previousUrl = this.currentUrl;
13357
13357
  this.currentUrl = window.location.href;
13358
13358
  this.trackNavigationEvent('popstate', this.previousUrl, this.currentUrl);
13359
- // Take FullSnapshot on navigation (like PostHog does)
13359
+ // Take FullSnapshot on navigation
13360
13360
  this.takeFullSnapshot();
13361
13361
  };
13362
13362
  window.addEventListener('popstate', popstateListener);
@@ -13746,7 +13746,7 @@ class HumanBehaviorTracker {
13746
13746
  viewLogs() {
13747
13747
  try {
13748
13748
  const logs = logger.getLogs();
13749
- console.log('HumanBehavior Logs:', logs);
13749
+ logInfo('HumanBehavior Logs:', logs);
13750
13750
  logger.clearLogs(); // Clear logs after viewing
13751
13751
  }
13752
13752
  catch (e) {
@@ -13814,9 +13814,8 @@ class HumanBehaviorTracker {
13814
13814
  recordCrossOriginIframes: false, // HumanBehavior default
13815
13815
  // ✅ CANVAS RECORDING - Disabled to prevent large data URIs
13816
13816
  recordCanvas: false, // Disabled to prevent large data URIs
13817
- // ✅ FULLSNAPSHOT GENERATION - Following PostHog's approach (no periodic snapshots)
13818
- // PostHog doesn't use checkoutEveryNms or checkoutEveryNth to avoid animation issues
13819
- // They rely on initial FullSnapshot + navigation-triggered ones only
13817
+ // ✅ FULLSNAPSHOT GENERATION - No periodic snapshots to avoid animation issues
13818
+ // Rely on initial FullSnapshot + navigation-triggered ones only
13820
13819
  });
13821
13820
  // Store the record instance for cleanup
13822
13821
  this.recordInstance = recordInstance || null;