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
package/dist/esm/index.js CHANGED
@@ -12404,7 +12404,7 @@ function validateSingleEventSize(event, sessionId) {
12404
12404
  })).length;
12405
12405
  if (singleEventSize > MAX_CHUNK_SIZE_BYTES) {
12406
12406
  // Instead of throwing, log a warning and suggest reducing event size
12407
- console.warn(`Single event size (${singleEventSize} bytes) exceeds maximum chunk size (${MAX_CHUNK_SIZE_BYTES} bytes). Consider reducing event data size.`);
12407
+ logWarn(`Single event size (${singleEventSize} bytes) exceeds maximum chunk size (${MAX_CHUNK_SIZE_BYTES} bytes). Consider reducing event data size.`);
12408
12408
  }
12409
12409
  }
12410
12410
  function splitLargeEvent(event, sessionId) {
@@ -12457,7 +12457,7 @@ class HumanBehaviorAPI {
12457
12457
  entryURL = window.location.href;
12458
12458
  referrer = document.referrer;
12459
12459
  }
12460
- console.log('API init called with:', { sessionId, userId, entryURL, referrer, baseUrl: this.baseUrl });
12460
+ logInfo('API init called with:', { sessionId, userId, entryURL, referrer, baseUrl: this.baseUrl });
12461
12461
  try {
12462
12462
  const response = yield fetch(`${this.baseUrl}/api/ingestion/init`, {
12463
12463
  method: 'POST',
@@ -12473,21 +12473,21 @@ class HumanBehaviorAPI {
12473
12473
  referrer: referrer
12474
12474
  })
12475
12475
  });
12476
- console.log('API init response status:', response.status);
12476
+ logInfo('API init response status:', response.status);
12477
12477
  if (!response.ok) {
12478
12478
  const errorText = yield response.text();
12479
- console.error('API init failed:', response.status, errorText);
12479
+ logError('API init failed:', response.status, errorText);
12480
12480
  throw new Error(`Failed to initialize ingestion: ${response.statusText} - ${errorText}`);
12481
12481
  }
12482
12482
  const responseJson = yield response.json();
12483
- console.log('API init success:', responseJson);
12483
+ logInfo('API init success:', responseJson);
12484
12484
  return {
12485
12485
  sessionId: responseJson.sessionId,
12486
12486
  endUserId: responseJson.endUserId
12487
12487
  };
12488
12488
  }
12489
12489
  catch (error) {
12490
- console.error('API init error:', error);
12490
+ logError('API init error:', error);
12491
12491
  throw error;
12492
12492
  }
12493
12493
  });
@@ -12590,7 +12590,7 @@ class HumanBehaviorAPI {
12590
12590
  sessionId: sessionId,
12591
12591
  posthogName: userData.email || userData.name || null // Update user name with email
12592
12592
  };
12593
- console.log('Sending user data to server:', payload);
12593
+ logInfo('Sending user data to server:', payload);
12594
12594
  const response = yield fetch(`${this.baseUrl}/api/ingestion/user`, {
12595
12595
  method: 'POST',
12596
12596
  headers: {
@@ -12603,7 +12603,7 @@ class HumanBehaviorAPI {
12603
12603
  throw new Error(`Failed to send user data: ${response.statusText} with API key: ${this.apiKey}`);
12604
12604
  }
12605
12605
  const result = yield response.json();
12606
- console.log('Server response:', result);
12606
+ logInfo('Server response:', result);
12607
12607
  return result;
12608
12608
  }
12609
12609
  catch (error) {
@@ -13345,7 +13345,7 @@ class HumanBehaviorTracker {
13345
13345
  this.originalPushState.apply(history, args);
13346
13346
  // Track navigation event
13347
13347
  this.trackNavigationEvent('pushState', this.previousUrl, this.currentUrl);
13348
- // Take FullSnapshot on navigation (like PostHog does)
13348
+ // Take FullSnapshot on navigation
13349
13349
  this.takeFullSnapshot();
13350
13350
  };
13351
13351
  // Override replaceState to capture programmatic navigation
@@ -13356,7 +13356,7 @@ class HumanBehaviorTracker {
13356
13356
  this.originalReplaceState.apply(history, args);
13357
13357
  // Track navigation event
13358
13358
  this.trackNavigationEvent('replaceState', 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
  // Listen for popstate events (back/forward navigation)
@@ -13364,7 +13364,7 @@ class HumanBehaviorTracker {
13364
13364
  this.previousUrl = this.currentUrl;
13365
13365
  this.currentUrl = window.location.href;
13366
13366
  this.trackNavigationEvent('popstate', this.previousUrl, this.currentUrl);
13367
- // Take FullSnapshot on navigation (like PostHog does)
13367
+ // Take FullSnapshot on navigation
13368
13368
  this.takeFullSnapshot();
13369
13369
  };
13370
13370
  window.addEventListener('popstate', popstateListener);
@@ -13754,7 +13754,7 @@ class HumanBehaviorTracker {
13754
13754
  viewLogs() {
13755
13755
  try {
13756
13756
  const logs = logger.getLogs();
13757
- console.log('HumanBehavior Logs:', logs);
13757
+ logInfo('HumanBehavior Logs:', logs);
13758
13758
  logger.clearLogs(); // Clear logs after viewing
13759
13759
  }
13760
13760
  catch (e) {
@@ -13822,9 +13822,8 @@ class HumanBehaviorTracker {
13822
13822
  recordCrossOriginIframes: false, // HumanBehavior default
13823
13823
  // ✅ CANVAS RECORDING - Disabled to prevent large data URIs
13824
13824
  recordCanvas: false, // Disabled to prevent large data URIs
13825
- // ✅ FULLSNAPSHOT GENERATION - Following PostHog's approach (no periodic snapshots)
13826
- // PostHog doesn't use checkoutEveryNms or checkoutEveryNth to avoid animation issues
13827
- // They rely on initial FullSnapshot + navigation-triggered ones only
13825
+ // ✅ FULLSNAPSHOT GENERATION - No periodic snapshots to avoid animation issues
13826
+ // Rely on initial FullSnapshot + navigation-triggered ones only
13828
13827
  });
13829
13828
  // Store the record instance for cleanup
13830
13829
  this.recordInstance = recordInstance || null;