@devskin/browser-sdk 1.0.32 → 1.0.33

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.
@@ -13585,11 +13585,12 @@ class Transport {
13585
13585
  // Send user identification immediately (don't queue)
13586
13586
  this.sendToBackend('/v1/analytics/identify', user);
13587
13587
  }
13588
- startSession(session) {
13589
- return __awaiter$1(this, void 0, void 0, function* () {
13588
+ startSession(session_1) {
13589
+ return __awaiter$1(this, arguments, void 0, function* (session, useBeacon = false) {
13590
13590
  // Send session start immediately to RUM endpoint
13591
13591
  // MUST await to ensure session is created before other requests
13592
- yield this.sendToBackend('/v1/rum/sessions', session);
13592
+ // Use beacon for page unload events (more reliable)
13593
+ yield this.sendToBackend('/v1/rum/sessions', session, useBeacon);
13593
13594
  });
13594
13595
  }
13595
13596
  sendError(error) {
@@ -14193,7 +14194,8 @@ class DevSkinSDK {
14193
14194
  if (this.sessionId && this.sessionStartTime) {
14194
14195
  const endedAt = new Date();
14195
14196
  const durationMs = Date.now() - this.sessionStartTime;
14196
- (_a = this.transport) === null || _a === void 0 ? void 0 : _a.startSession(Object.assign({ sessionId: this.sessionId, userId: this.userId || undefined, anonymousId: this.anonymousId, endedAt: endedAt.toISOString(), durationMs: durationMs, platform: 'web' }, this.getContextData()));
14197
+ // Use beacon for reliable delivery during page unload
14198
+ (_a = this.transport) === null || _a === void 0 ? void 0 : _a.startSession(Object.assign({ sessionId: this.sessionId, userId: this.userId || undefined, anonymousId: this.anonymousId, endedAt: endedAt.toISOString(), durationMs: durationMs, platform: 'web' }, this.getContextData()), true); // true = use sendBeacon
14197
14199
  // Clear session storage since session is ending
14198
14200
  sessionStorage.removeItem('devskin_session_id');
14199
14201
  sessionStorage.removeItem('devskin_session_start');