@devskin/browser-sdk 1.0.6 → 1.0.8

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,17 +4999,20 @@ 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.7');
5002
5003
  this.stopFn = record({
5003
5004
  emit: (event) => {
5005
+ console.log('[RRWeb] Event emitted:', { type: event.type, timestamp: event.timestamp });
5006
+ this.events.push(event);
5004
5007
  // Check if this is a FullSnapshot (type 2)
5005
5008
  if (event.type === 2) {
5006
5009
  this.hasFullSnapshot = true;
5007
- console.log('[RRWeb] FullSnapshot captured! Recording is ready.');
5010
+ console.log('[RRWeb] FullSnapshot captured! Sending immediately...');
5011
+ // Send immediately to ensure FullSnapshot reaches backend first
5012
+ this.flush();
5008
5013
  }
5009
- this.events.push(event);
5010
- // Only flush if we have the FullSnapshot
5011
- // This ensures the first batch always contains the full DOM
5012
- if (this.hasFullSnapshot && this.events.length >= 50) {
5014
+ else if (this.hasFullSnapshot && this.events.length >= 50) {
5015
+ // After FullSnapshot, batch other events
5013
5016
  this.flush();
5014
5017
  }
5015
5018
  },
@@ -5084,6 +5087,12 @@ class RRWebRecorder {
5084
5087
  return;
5085
5088
  const eventsToSend = [...this.events];
5086
5089
  this.events = [];
5090
+ // Log event types being sent
5091
+ const typeCounts = {};
5092
+ eventsToSend.forEach(e => {
5093
+ typeCounts[e.type] = (typeCounts[e.type] || 0) + 1;
5094
+ });
5095
+ console.log('[RRWeb] Flushing events:', typeCounts);
5087
5096
  if (this.onEventsReady) {
5088
5097
  this.onEventsReady(eventsToSend);
5089
5098
  }