@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.
@@ -13581,11 +13581,12 @@ class Transport {
13581
13581
  // Send user identification immediately (don't queue)
13582
13582
  this.sendToBackend('/v1/analytics/identify', user);
13583
13583
  }
13584
- startSession(session) {
13585
- return __awaiter$1(this, void 0, void 0, function* () {
13584
+ startSession(session_1) {
13585
+ return __awaiter$1(this, arguments, void 0, function* (session, useBeacon = false) {
13586
13586
  // Send session start immediately to RUM endpoint
13587
13587
  // MUST await to ensure session is created before other requests
13588
- yield this.sendToBackend('/v1/rum/sessions', session);
13588
+ // Use beacon for page unload events (more reliable)
13589
+ yield this.sendToBackend('/v1/rum/sessions', session, useBeacon);
13589
13590
  });
13590
13591
  }
13591
13592
  sendError(error) {
@@ -14189,7 +14190,8 @@ class DevSkinSDK {
14189
14190
  if (this.sessionId && this.sessionStartTime) {
14190
14191
  const endedAt = new Date();
14191
14192
  const durationMs = Date.now() - this.sessionStartTime;
14192
- (_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()));
14193
+ // Use beacon for reliable delivery during page unload
14194
+ (_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
14193
14195
  // Clear session storage since session is ending
14194
14196
  sessionStorage.removeItem('devskin_session_id');
14195
14197
  sessionStorage.removeItem('devskin_session_start');