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