@devskin/browser-sdk 1.0.12 → 1.0.14

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.
@@ -5568,7 +5568,7 @@
5568
5568
  }
5569
5569
  try {
5570
5570
  console.log('[RRWeb] Starting session recording:', this.sessionId);
5571
- console.log('[RRWeb] SDK Version: 1.0.12');
5571
+ console.log('[RRWeb] SDK Version: 1.0.14');
5572
5572
  this.stopFn = record({
5573
5573
  emit: (event) => {
5574
5574
  // DEBUG: Log ALL event types to diagnose issue
@@ -5635,34 +5635,31 @@
5635
5635
  this.flush();
5636
5636
  }
5637
5637
  }, 10000);
5638
- // Safety check: After 5 seconds, force a full snapshot if none captured
5638
+ // Safety check: After 2 seconds, force a full snapshot if none captured
5639
5639
  setTimeout(() => {
5640
5640
  if (!this.hasFullSnapshot) {
5641
- console.warn('[RRWeb] ⚠️ No FullSnapshot captured after 5 seconds!');
5641
+ console.warn('[RRWeb] ⚠️ No FullSnapshot captured after 2 seconds!');
5642
5642
  console.warn('[RRWeb] Events captured so far:', this.events.length);
5643
5643
  console.warn('[RRWeb] Event types:', this.events.map(e => e.type));
5644
- console.warn('[RRWeb] Forcing a full snapshot via takeFullSnapshot()...');
5645
- // Try to force a full snapshot
5644
+ console.warn('[RRWeb] Forcing a full snapshot via record.takeFullSnapshot()...');
5645
+ // Try to force a full snapshot using rrweb's API
5646
5646
  try {
5647
- // rrweb's record function returns an object with takeFullSnapshot method
5648
- if (this.stopFn && typeof this.stopFn === 'function') {
5649
- // In rrweb 2.0, the stopFn itself might not have takeFullSnapshot
5650
- // We need to trigger a checkout which will create a new full snapshot
5651
- console.warn('[RRWeb] Triggering manual checkout...');
5652
- // If we have events but no FullSnapshot, flush anyway to not lose data
5653
- // But warn that replay may not work correctly
5654
- if (this.events.length > 0) {
5655
- console.warn('[RRWeb] Flushing existing events...');
5656
- this.hasFullSnapshot = true; // Set to true to allow flushing
5657
- this.flush();
5658
- }
5659
- }
5647
+ // Call record.takeFullSnapshot() to force a full snapshot
5648
+ record.takeFullSnapshot();
5649
+ console.log('[RRWeb] Manual FullSnapshot triggered!');
5660
5650
  }
5661
5651
  catch (error) {
5662
5652
  console.error('[RRWeb] Failed to force snapshot:', error);
5653
+ // If we have events but no FullSnapshot, flush anyway to not lose data
5654
+ // But warn that replay may not work correctly
5655
+ if (this.events.length > 0) {
5656
+ console.warn('[RRWeb] Flushing existing events WITHOUT FullSnapshot...');
5657
+ this.hasFullSnapshot = true; // Set to true to allow flushing
5658
+ this.flush();
5659
+ }
5663
5660
  }
5664
5661
  }
5665
- }, 5000);
5662
+ }, 2000);
5666
5663
  console.log('[RRWeb] Recording started successfully');
5667
5664
  }
5668
5665
  catch (error) {
@@ -5760,7 +5757,18 @@
5760
5757
  acc[e.type] = (acc[e.type] || 0) + 1;
5761
5758
  return acc;
5762
5759
  }, {});
5760
+ // Calculate payload size
5761
+ const payload = {
5762
+ session_id: sessionId,
5763
+ events,
5764
+ timestamp: new Date().toISOString(),
5765
+ apiKey: this.config.apiKey,
5766
+ appId: this.config.appId,
5767
+ };
5768
+ const payloadSize = new Blob([JSON.stringify(payload)]).size;
5769
+ const payloadSizeMB = (payloadSize / 1024 / 1024).toFixed(2);
5763
5770
  console.log(`[DevSkin SDK] Sending ${events.length} recording events:`, eventTypes);
5771
+ console.log(`[DevSkin SDK] Payload size: ${payloadSizeMB} MB (${payloadSize} bytes)`);
5764
5772
  console.log(`[DevSkin SDK] First 3 events:`, events.slice(0, 3).map(e => ({ type: e.type, timestamp: e.timestamp })));
5765
5773
  // Check if this batch contains FullSnapshot (type 2)
5766
5774
  const hasFullSnapshot = events.some(e => e.type === 2);