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