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