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