@devskin/browser-sdk 1.0.10 → 1.0.11
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 +35 -16
- package/dist/devskin.cjs.js.map +1 -1
- package/dist/devskin.esm.js +35 -16
- package/dist/devskin.esm.js.map +1 -1
- package/dist/devskin.umd.js +35 -16
- package/dist/devskin.umd.js.map +1 -1
- package/dist/devskin.umd.min.js +1 -1
- package/dist/devskin.umd.min.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/transport.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/devskin.cjs.js
CHANGED
|
@@ -13246,7 +13246,7 @@ class RRWebRecorder {
|
|
|
13246
13246
|
}
|
|
13247
13247
|
try {
|
|
13248
13248
|
console.log('[RRWeb] Starting session recording:', this.sessionId);
|
|
13249
|
-
console.log('[RRWeb] SDK Version: 1.0.
|
|
13249
|
+
console.log('[RRWeb] SDK Version: 1.0.11');
|
|
13250
13250
|
this.stopFn = record({
|
|
13251
13251
|
emit: (event) => {
|
|
13252
13252
|
// DEBUG: Log ALL event types to diagnose issue
|
|
@@ -13428,18 +13428,32 @@ class Transport {
|
|
|
13428
13428
|
}, {});
|
|
13429
13429
|
console.log(`[DevSkin SDK] Sending ${events.length} recording events:`, eventTypes);
|
|
13430
13430
|
console.log(`[DevSkin SDK] First 3 events:`, events.slice(0, 3).map(e => ({ type: e.type, timestamp: e.timestamp })));
|
|
13431
|
-
//
|
|
13432
|
-
|
|
13433
|
-
|
|
13434
|
-
|
|
13435
|
-
|
|
13436
|
-
|
|
13437
|
-
|
|
13438
|
-
|
|
13439
|
-
|
|
13440
|
-
|
|
13441
|
-
|
|
13431
|
+
// Check if this batch contains FullSnapshot (type 2)
|
|
13432
|
+
const hasFullSnapshot = events.some(e => e.type === 2);
|
|
13433
|
+
const maxRetries = hasFullSnapshot ? 3 : 1; // Retry FullSnapshot batches up to 3 times
|
|
13434
|
+
// Recording events can be large, send immediately with retry logic
|
|
13435
|
+
let lastError = null;
|
|
13436
|
+
for (let attempt = 1; attempt <= maxRetries; attempt++) {
|
|
13437
|
+
try {
|
|
13438
|
+
yield this.sendToBackend('/v1/rum/recordings', {
|
|
13439
|
+
session_id: sessionId,
|
|
13440
|
+
events,
|
|
13441
|
+
timestamp: new Date().toISOString(),
|
|
13442
|
+
});
|
|
13443
|
+
console.log(`[DevSkin SDK] ✅ Recording events sent successfully${attempt > 1 ? ` (attempt ${attempt})` : ''}`);
|
|
13444
|
+
return; // Success, exit
|
|
13445
|
+
}
|
|
13446
|
+
catch (error) {
|
|
13447
|
+
lastError = error;
|
|
13448
|
+
if (attempt < maxRetries) {
|
|
13449
|
+
const delay = attempt * 1000; // 1s, 2s, 3s...
|
|
13450
|
+
console.warn(`[DevSkin SDK] ⚠️ Failed to send recording events (attempt ${attempt}/${maxRetries}), retrying in ${delay}ms...`);
|
|
13451
|
+
yield new Promise(resolve => setTimeout(resolve, delay));
|
|
13452
|
+
}
|
|
13453
|
+
}
|
|
13442
13454
|
}
|
|
13455
|
+
// All retries failed
|
|
13456
|
+
console.error(`[DevSkin SDK] ❌ Failed to send recording events after ${maxRetries} attempts:`, lastError);
|
|
13443
13457
|
});
|
|
13444
13458
|
}
|
|
13445
13459
|
sendHeatmapData(heatmapData) {
|
|
@@ -13643,10 +13657,15 @@ class DevSkinSDK {
|
|
|
13643
13657
|
// Send rrweb events to backend
|
|
13644
13658
|
(_a = this.transport) === null || _a === void 0 ? void 0 : _a.sendRecordingEvents(this.sessionId, events);
|
|
13645
13659
|
});
|
|
13646
|
-
|
|
13647
|
-
|
|
13648
|
-
|
|
13649
|
-
|
|
13660
|
+
// Wait 500ms before starting recording to ensure session is created in backend
|
|
13661
|
+
// This prevents race condition where FullSnapshot is sent before session exists
|
|
13662
|
+
setTimeout(() => {
|
|
13663
|
+
var _a, _b;
|
|
13664
|
+
(_a = this.rrwebRecorder) === null || _a === void 0 ? void 0 : _a.start();
|
|
13665
|
+
if ((_b = this.config) === null || _b === void 0 ? void 0 : _b.debug) {
|
|
13666
|
+
console.log('[DevSkin] RRWeb recording started for session:', this.sessionId);
|
|
13667
|
+
}
|
|
13668
|
+
}, 500);
|
|
13650
13669
|
}
|
|
13651
13670
|
// Track initial page view
|
|
13652
13671
|
this.trackPageView();
|