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