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