humanbehavior-js 0.1.6 → 0.1.7
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/index.js +12 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +12 -6
- package/dist/esm/index.js.map +1 -1
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/api.ts +14 -6
package/dist/esm/index.js
CHANGED
|
@@ -4368,12 +4368,18 @@ class HumanBehaviorAPI {
|
|
|
4368
4368
|
});
|
|
4369
4369
|
}
|
|
4370
4370
|
sendBeaconEvents(events, sessionId) {
|
|
4371
|
-
|
|
4372
|
-
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
|
|
4376
|
-
|
|
4371
|
+
// Create JSON payload that matches the server's expected format
|
|
4372
|
+
const payload = {
|
|
4373
|
+
sessionId: sessionId,
|
|
4374
|
+
events: events,
|
|
4375
|
+
endUserId: null // Beacon doesn't have user context
|
|
4376
|
+
};
|
|
4377
|
+
// Convert to Blob for sendBeacon
|
|
4378
|
+
const blob = new Blob([JSON.stringify(payload)], {
|
|
4379
|
+
type: 'application/json'
|
|
4380
|
+
});
|
|
4381
|
+
const success = navigator.sendBeacon(`${this.baseUrl}/api/ingestion/events`, blob);
|
|
4382
|
+
return success;
|
|
4377
4383
|
}
|
|
4378
4384
|
sendCustomEvent(sessionId, eventName, eventProperties) {
|
|
4379
4385
|
return __awaiter$1(this, void 0, void 0, function* () {
|