@devskin/browser-sdk 1.0.35 → 1.0.37
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 +18 -3
- package/dist/devskin.cjs.js.map +1 -1
- package/dist/devskin.esm.js +18 -3
- package/dist/devskin.esm.js.map +1 -1
- package/dist/devskin.umd.js +18 -3
- 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/recorder/rrweb.d.ts +3 -1
- package/dist/recorder/rrweb.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/devskin.esm.js
CHANGED
|
@@ -13419,15 +13419,20 @@ record.takeFullSnapshot = (isCheckout) => {
|
|
|
13419
13419
|
record.mirror = mirror;
|
|
13420
13420
|
|
|
13421
13421
|
class RRWebRecorder {
|
|
13422
|
-
constructor(sessionId, config, onEventsReady) {
|
|
13422
|
+
constructor(sessionId, config, onEventsReady, sessionStartTime = 0) {
|
|
13423
13423
|
this.stopFn = null;
|
|
13424
13424
|
this.events = [];
|
|
13425
13425
|
this.onEventsReady = null;
|
|
13426
13426
|
this.flushInterval = null;
|
|
13427
13427
|
this.hasFullSnapshot = false;
|
|
13428
|
+
this.sessionStartTime = 0; // Session start time (for relative timestamps)
|
|
13429
|
+
this.recordingStartTime = 0; // When this recorder instance started
|
|
13428
13430
|
this.sessionId = sessionId;
|
|
13429
13431
|
this.config = config;
|
|
13430
13432
|
this.onEventsReady = onEventsReady;
|
|
13433
|
+
this.sessionStartTime = sessionStartTime || Date.now();
|
|
13434
|
+
this.recordingStartTime = Date.now();
|
|
13435
|
+
console.log(`[RRWeb] Recording initialized - session started at ${this.sessionStartTime}, recording started at ${this.recordingStartTime}`);
|
|
13431
13436
|
}
|
|
13432
13437
|
start() {
|
|
13433
13438
|
if (!this.config.enabled) {
|
|
@@ -13441,6 +13446,13 @@ class RRWebRecorder {
|
|
|
13441
13446
|
try {
|
|
13442
13447
|
this.stopFn = record({
|
|
13443
13448
|
emit: (event) => {
|
|
13449
|
+
// Convert absolute timestamps to relative to session start
|
|
13450
|
+
// This ensures continuity across page navigations within same session
|
|
13451
|
+
const originalTimestamp = event.timestamp;
|
|
13452
|
+
event.timestamp = event.timestamp - this.sessionStartTime;
|
|
13453
|
+
if (this.config.enabled && event.type === 2) {
|
|
13454
|
+
console.log(`[RRWeb] FullSnapshot - original: ${originalTimestamp}, relative: ${event.timestamp}, session start: ${this.sessionStartTime}`);
|
|
13455
|
+
}
|
|
13444
13456
|
this.events.push(event);
|
|
13445
13457
|
// Check if this is a FullSnapshot (type 2)
|
|
13446
13458
|
if (event.type === 2) {
|
|
@@ -13919,13 +13931,15 @@ class DevSkinSDK {
|
|
|
13919
13931
|
this.heatmapCollector.start();
|
|
13920
13932
|
// Initialize screenshot collector and capture page
|
|
13921
13933
|
this.screenshotCollector = new ScreenshotCollector(this.config, this.transport);
|
|
13922
|
-
|
|
13934
|
+
// Send only the pathname (not full URL) for consistent hashing
|
|
13935
|
+
this.screenshotCollector.captureAndSend(this.sessionId, window.location.pathname);
|
|
13923
13936
|
if (this.config.debug) {
|
|
13924
13937
|
console.log('[DevSkin] Heatmap collection enabled (always on)');
|
|
13925
13938
|
}
|
|
13926
13939
|
// Initialize session recording with rrweb
|
|
13927
13940
|
if ((_a = this.config.sessionRecording) === null || _a === void 0 ? void 0 : _a.enabled) {
|
|
13928
13941
|
// Use RRWebRecorder for complete DOM recording
|
|
13942
|
+
// Pass sessionStartTime to ensure timestamp continuity across page navigations
|
|
13929
13943
|
this.rrwebRecorder = new RRWebRecorder(this.sessionId, {
|
|
13930
13944
|
enabled: true,
|
|
13931
13945
|
sampleRate: this.config.sessionRecording.sampling || 0.5,
|
|
@@ -13948,7 +13962,8 @@ class DevSkinSDK {
|
|
|
13948
13962
|
var _a;
|
|
13949
13963
|
// Send rrweb events to backend
|
|
13950
13964
|
(_a = this.transport) === null || _a === void 0 ? void 0 : _a.sendRecordingEvents(this.sessionId, events);
|
|
13951
|
-
}
|
|
13965
|
+
}, this.sessionStartTime // Pass session start time for timestamp continuity
|
|
13966
|
+
);
|
|
13952
13967
|
// Start recording immediately (session already created)
|
|
13953
13968
|
this.rrwebRecorder.start();
|
|
13954
13969
|
if ((_b = this.config) === null || _b === void 0 ? void 0 : _b.debug) {
|