humanbehavior-js 0.4.8 → 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.
@@ -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) {
@@ -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) {