humanbehavior-js 0.4.8 → 0.4.10
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.
- package/dist/cjs/angular/index.cjs +9 -8
- package/dist/cjs/angular/index.cjs.map +1 -1
- package/dist/cjs/index.cjs +10 -9
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/cjs/react/index.cjs +9 -8
- package/dist/cjs/react/index.cjs.map +1 -1
- package/dist/cjs/remix/index.cjs +9 -8
- package/dist/cjs/remix/index.cjs.map +1 -1
- package/dist/cjs/svelte/index.cjs +9 -8
- package/dist/cjs/svelte/index.cjs.map +1 -1
- package/dist/cjs/vue/index.cjs +9 -8
- package/dist/cjs/vue/index.cjs.map +1 -1
- package/dist/esm/angular/index.js +9 -8
- package/dist/esm/angular/index.js.map +1 -1
- package/dist/esm/index.js +10 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/react/index.js +9 -8
- package/dist/esm/react/index.js.map +1 -1
- package/dist/esm/remix/index.js +9 -8
- package/dist/esm/remix/index.js.map +1 -1
- package/dist/esm/svelte/index.js +9 -8
- package/dist/esm/svelte/index.js.map +1 -1
- package/dist/esm/vue/index.js +9 -8
- package/dist/esm/vue/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/package.json +1 -1
- package/src/api.ts +9 -9
- package/src/tracker.ts +3 -1
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
12476
|
+
logInfo('API init response status:', response.status);
|
|
12477
12477
|
if (!response.ok) {
|
|
12478
12478
|
const errorText = yield response.text();
|
|
12479
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
12593
|
+
logDebug('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
|
-
|
|
12606
|
+
logDebug('Server response:', result);
|
|
12607
12607
|
return result;
|
|
12608
12608
|
}
|
|
12609
12609
|
catch (error) {
|
|
@@ -13754,7 +13754,7 @@ class HumanBehaviorTracker {
|
|
|
13754
13754
|
viewLogs() {
|
|
13755
13755
|
try {
|
|
13756
13756
|
const logs = logger.getLogs();
|
|
13757
|
-
|
|
13757
|
+
logInfo('HumanBehavior Logs:', logs);
|
|
13758
13758
|
logger.clearLogs(); // Clear logs after viewing
|
|
13759
13759
|
}
|
|
13760
13760
|
catch (e) {
|
|
@@ -13772,6 +13772,7 @@ class HumanBehaviorTracker {
|
|
|
13772
13772
|
const originalEndUserId = this.endUserId;
|
|
13773
13773
|
// Store user properties
|
|
13774
13774
|
this.userProperties = userProperties;
|
|
13775
|
+
logDebug('Identifying user:', { userProperties, originalEndUserId, sessionId: this.sessionId });
|
|
13775
13776
|
// Send user data with the original endUserId
|
|
13776
13777
|
yield this.api.sendUserData(originalEndUserId, userProperties, this.sessionId);
|
|
13777
13778
|
// Don't update endUserId - keep it as the original UUID
|