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