@devskin/browser-sdk 1.0.7 → 1.0.9

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.
@@ -5003,13 +5003,14 @@ class RRWebRecorder {
5003
5003
  }
5004
5004
  try {
5005
5005
  console.log('[RRWeb] Starting session recording:', this.sessionId);
5006
+ console.log('[RRWeb] SDK Version: 1.0.9');
5006
5007
  this.stopFn = record({
5007
5008
  emit: (event) => {
5008
5009
  this.events.push(event);
5009
5010
  // Check if this is a FullSnapshot (type 2)
5010
5011
  if (event.type === 2) {
5011
5012
  this.hasFullSnapshot = true;
5012
- console.log('[RRWeb] FullSnapshot captured! Sending immediately...');
5013
+ console.log('[RRWeb] FullSnapshot captured! Sending immediately...');
5013
5014
  // Send immediately to ensure FullSnapshot reaches backend first
5014
5015
  this.flush();
5015
5016
  }
@@ -5089,6 +5090,12 @@ class RRWebRecorder {
5089
5090
  return;
5090
5091
  const eventsToSend = [...this.events];
5091
5092
  this.events = [];
5093
+ // Log event types being sent
5094
+ const typeCounts = {};
5095
+ eventsToSend.forEach(e => {
5096
+ typeCounts[e.type] = (typeCounts[e.type] || 0) + 1;
5097
+ });
5098
+ console.log('[RRWeb] Flushing events:', typeCounts);
5092
5099
  if (this.onEventsReady) {
5093
5100
  this.onEventsReady(eventsToSend);
5094
5101
  }
@@ -5145,18 +5152,26 @@ class Transport {
5145
5152
  this.enqueue('performance', metric);
5146
5153
  }
5147
5154
  sendRecordingEvents(sessionId, events) {
5148
- // DEBUG: Log event types being sent
5149
- const eventTypes = events.reduce((acc, e) => {
5150
- acc[e.type] = (acc[e.type] || 0) + 1;
5151
- return acc;
5152
- }, {});
5153
- console.log(`[DevSkin SDK] Sending ${events.length} recording events:`, eventTypes);
5154
- console.log(`[DevSkin SDK] First 3 events:`, events.slice(0, 3).map(e => ({ type: e.type, timestamp: e.timestamp })));
5155
- // Recording events can be large, send immediately
5156
- this.sendToBackend('/v1/rum/recordings', {
5157
- session_id: sessionId,
5158
- events,
5159
- timestamp: new Date().toISOString(),
5155
+ return __awaiter$1(this, void 0, void 0, function* () {
5156
+ // DEBUG: Log event types being sent
5157
+ const eventTypes = events.reduce((acc, e) => {
5158
+ acc[e.type] = (acc[e.type] || 0) + 1;
5159
+ return acc;
5160
+ }, {});
5161
+ console.log(`[DevSkin SDK] Sending ${events.length} recording events:`, eventTypes);
5162
+ console.log(`[DevSkin SDK] First 3 events:`, events.slice(0, 3).map(e => ({ type: e.type, timestamp: e.timestamp })));
5163
+ // Recording events can be large, send immediately
5164
+ try {
5165
+ yield this.sendToBackend('/v1/rum/recordings', {
5166
+ session_id: sessionId,
5167
+ events,
5168
+ timestamp: new Date().toISOString(),
5169
+ });
5170
+ console.log(`[DevSkin SDK] ✅ Recording events sent successfully`);
5171
+ }
5172
+ catch (error) {
5173
+ console.error(`[DevSkin SDK] ❌ Failed to send recording events:`, error);
5174
+ }
5160
5175
  });
5161
5176
  }
5162
5177
  sendHeatmapData(heatmapData) {
@@ -5250,6 +5265,8 @@ class Transport {
5250
5265
  keepalive: true,
5251
5266
  });
5252
5267
  if (!response.ok) {
5268
+ const errorText = yield response.text();
5269
+ console.error('[DevSkin] HTTP Error:', response.status, errorText);
5253
5270
  throw new Error(`HTTP ${response.status}: ${response.statusText}`);
5254
5271
  }
5255
5272
  if (this.config.debug) {
@@ -5257,11 +5274,9 @@ class Transport {
5257
5274
  }
5258
5275
  }
5259
5276
  catch (error) {
5260
- if (this.config.debug) {
5261
- console.error('[DevSkin] Failed to send data:', error);
5262
- }
5263
- // Retry logic could be added here
5264
- // For now, we'll just log the error
5277
+ console.error('[DevSkin] Failed to send data to', endpoint, ':', error);
5278
+ // Re-throw for caller to handle
5279
+ throw error;
5265
5280
  }
5266
5281
  });
5267
5282
  }