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