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