@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.umd.js
CHANGED
|
@@ -13425,15 +13425,20 @@
|
|
|
13425
13425
|
record.mirror = mirror;
|
|
13426
13426
|
|
|
13427
13427
|
class RRWebRecorder {
|
|
13428
|
-
constructor(sessionId, config, onEventsReady) {
|
|
13428
|
+
constructor(sessionId, config, onEventsReady, sessionStartTime = 0) {
|
|
13429
13429
|
this.stopFn = null;
|
|
13430
13430
|
this.events = [];
|
|
13431
13431
|
this.onEventsReady = null;
|
|
13432
13432
|
this.flushInterval = null;
|
|
13433
13433
|
this.hasFullSnapshot = false;
|
|
13434
|
+
this.sessionStartTime = 0; // Session start time (for relative timestamps)
|
|
13435
|
+
this.recordingStartTime = 0; // When this recorder instance started
|
|
13434
13436
|
this.sessionId = sessionId;
|
|
13435
13437
|
this.config = config;
|
|
13436
13438
|
this.onEventsReady = onEventsReady;
|
|
13439
|
+
this.sessionStartTime = sessionStartTime || Date.now();
|
|
13440
|
+
this.recordingStartTime = Date.now();
|
|
13441
|
+
console.log(`[RRWeb] Recording initialized - session started at ${this.sessionStartTime}, recording started at ${this.recordingStartTime}`);
|
|
13437
13442
|
}
|
|
13438
13443
|
start() {
|
|
13439
13444
|
if (!this.config.enabled) {
|
|
@@ -13447,6 +13452,13 @@
|
|
|
13447
13452
|
try {
|
|
13448
13453
|
this.stopFn = record({
|
|
13449
13454
|
emit: (event) => {
|
|
13455
|
+
// Convert absolute timestamps to relative to session start
|
|
13456
|
+
// This ensures continuity across page navigations within same session
|
|
13457
|
+
const originalTimestamp = event.timestamp;
|
|
13458
|
+
event.timestamp = event.timestamp - this.sessionStartTime;
|
|
13459
|
+
if (this.config.enabled && event.type === 2) {
|
|
13460
|
+
console.log(`[RRWeb] FullSnapshot - original: ${originalTimestamp}, relative: ${event.timestamp}, session start: ${this.sessionStartTime}`);
|
|
13461
|
+
}
|
|
13450
13462
|
this.events.push(event);
|
|
13451
13463
|
// Check if this is a FullSnapshot (type 2)
|
|
13452
13464
|
if (event.type === 2) {
|
|
@@ -13925,13 +13937,15 @@
|
|
|
13925
13937
|
this.heatmapCollector.start();
|
|
13926
13938
|
// Initialize screenshot collector and capture page
|
|
13927
13939
|
this.screenshotCollector = new ScreenshotCollector(this.config, this.transport);
|
|
13928
|
-
|
|
13940
|
+
// Send only the pathname (not full URL) for consistent hashing
|
|
13941
|
+
this.screenshotCollector.captureAndSend(this.sessionId, window.location.pathname);
|
|
13929
13942
|
if (this.config.debug) {
|
|
13930
13943
|
console.log('[DevSkin] Heatmap collection enabled (always on)');
|
|
13931
13944
|
}
|
|
13932
13945
|
// Initialize session recording with rrweb
|
|
13933
13946
|
if ((_a = this.config.sessionRecording) === null || _a === void 0 ? void 0 : _a.enabled) {
|
|
13934
13947
|
// Use RRWebRecorder for complete DOM recording
|
|
13948
|
+
// Pass sessionStartTime to ensure timestamp continuity across page navigations
|
|
13935
13949
|
this.rrwebRecorder = new RRWebRecorder(this.sessionId, {
|
|
13936
13950
|
enabled: true,
|
|
13937
13951
|
sampleRate: this.config.sessionRecording.sampling || 0.5,
|
|
@@ -13954,7 +13968,8 @@
|
|
|
13954
13968
|
var _a;
|
|
13955
13969
|
// Send rrweb events to backend
|
|
13956
13970
|
(_a = this.transport) === null || _a === void 0 ? void 0 : _a.sendRecordingEvents(this.sessionId, events);
|
|
13957
|
-
}
|
|
13971
|
+
}, this.sessionStartTime // Pass session start time for timestamp continuity
|
|
13972
|
+
);
|
|
13958
13973
|
// Start recording immediately (session already created)
|
|
13959
13974
|
this.rrwebRecorder.start();
|
|
13960
13975
|
if ((_b = this.config) === null || _b === void 0 ? void 0 : _b.debug) {
|