@devskin/browser-sdk 1.0.3 → 1.0.4
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.
- package/dist/devskin.cjs.js +22 -4
- package/dist/devskin.cjs.js.map +1 -1
- package/dist/devskin.esm.js +22 -4
- package/dist/devskin.esm.js.map +1 -1
- package/dist/devskin.umd.js +22 -4
- package/dist/devskin.umd.js.map +1 -1
- package/dist/devskin.umd.min.js +2 -2
- package/dist/devskin.umd.min.js.map +1 -1
- package/dist/recorder/rrweb.d.ts +1 -0
- package/dist/recorder/rrweb.d.ts.map +1 -1
- package/dist/transport.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/devskin.cjs.js
CHANGED
|
@@ -4987,6 +4987,7 @@ class RRWebRecorder {
|
|
|
4987
4987
|
this.events = [];
|
|
4988
4988
|
this.onEventsReady = null;
|
|
4989
4989
|
this.flushInterval = null;
|
|
4990
|
+
this.hasFullSnapshot = false;
|
|
4990
4991
|
this.sessionId = sessionId;
|
|
4991
4992
|
this.config = config;
|
|
4992
4993
|
this.onEventsReady = onEventsReady;
|
|
@@ -5004,9 +5005,15 @@ class RRWebRecorder {
|
|
|
5004
5005
|
console.log('[RRWeb] Starting session recording:', this.sessionId);
|
|
5005
5006
|
this.stopFn = record({
|
|
5006
5007
|
emit: (event) => {
|
|
5008
|
+
// Check if this is a FullSnapshot (type 2)
|
|
5009
|
+
if (event.type === 2) {
|
|
5010
|
+
this.hasFullSnapshot = true;
|
|
5011
|
+
console.log('[RRWeb] FullSnapshot captured! Recording is ready.');
|
|
5012
|
+
}
|
|
5007
5013
|
this.events.push(event);
|
|
5008
|
-
//
|
|
5009
|
-
|
|
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) {
|
|
5010
5017
|
this.flush();
|
|
5011
5018
|
}
|
|
5012
5019
|
},
|
|
@@ -5046,8 +5053,9 @@ class RRWebRecorder {
|
|
|
5046
5053
|
recordCrossOriginIframes: false, // Security: don't record cross-origin iframes
|
|
5047
5054
|
});
|
|
5048
5055
|
// Set up periodic flush (every 10 seconds)
|
|
5056
|
+
// Only flush if we have FullSnapshot to ensure first batch is complete
|
|
5049
5057
|
this.flushInterval = window.setInterval(() => {
|
|
5050
|
-
if (this.events.length > 0) {
|
|
5058
|
+
if (this.hasFullSnapshot && this.events.length > 0) {
|
|
5051
5059
|
this.flush();
|
|
5052
5060
|
}
|
|
5053
5061
|
}, 10000);
|
|
@@ -5067,8 +5075,11 @@ class RRWebRecorder {
|
|
|
5067
5075
|
clearInterval(this.flushInterval);
|
|
5068
5076
|
this.flushInterval = null;
|
|
5069
5077
|
}
|
|
5070
|
-
// Flush remaining events
|
|
5078
|
+
// Flush remaining events (even without FullSnapshot, to not lose data)
|
|
5071
5079
|
if (this.events.length > 0) {
|
|
5080
|
+
if (!this.hasFullSnapshot) {
|
|
5081
|
+
console.warn('[RRWeb] Flushing events without FullSnapshot - recording may not replay correctly');
|
|
5082
|
+
}
|
|
5072
5083
|
this.flush();
|
|
5073
5084
|
}
|
|
5074
5085
|
}
|
|
@@ -5133,6 +5144,13 @@ class Transport {
|
|
|
5133
5144
|
this.enqueue('performance', metric);
|
|
5134
5145
|
}
|
|
5135
5146
|
sendRecordingEvents(sessionId, events) {
|
|
5147
|
+
// DEBUG: Log event types being sent
|
|
5148
|
+
const eventTypes = events.reduce((acc, e) => {
|
|
5149
|
+
acc[e.type] = (acc[e.type] || 0) + 1;
|
|
5150
|
+
return acc;
|
|
5151
|
+
}, {});
|
|
5152
|
+
console.log(`[DevSkin SDK] Sending ${events.length} recording events:`, eventTypes);
|
|
5153
|
+
console.log(`[DevSkin SDK] First 3 events:`, events.slice(0, 3).map(e => ({ type: e.type, timestamp: e.timestamp })));
|
|
5136
5154
|
// Recording events can be large, send immediately
|
|
5137
5155
|
this.sendToBackend('/v1/rum/recordings', {
|
|
5138
5156
|
session_id: sessionId,
|