@devskin/browser-sdk 1.0.35 → 1.0.36

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.
@@ -13423,15 +13423,20 @@ record.takeFullSnapshot = (isCheckout) => {
13423
13423
  record.mirror = mirror;
13424
13424
 
13425
13425
  class RRWebRecorder {
13426
- constructor(sessionId, config, onEventsReady) {
13426
+ constructor(sessionId, config, onEventsReady, sessionStartTime = 0) {
13427
13427
  this.stopFn = null;
13428
13428
  this.events = [];
13429
13429
  this.onEventsReady = null;
13430
13430
  this.flushInterval = null;
13431
13431
  this.hasFullSnapshot = false;
13432
+ this.sessionStartTime = 0; // Session start time (for relative timestamps)
13433
+ this.recordingStartTime = 0; // When this recorder instance started
13432
13434
  this.sessionId = sessionId;
13433
13435
  this.config = config;
13434
13436
  this.onEventsReady = onEventsReady;
13437
+ this.sessionStartTime = sessionStartTime || Date.now();
13438
+ this.recordingStartTime = Date.now();
13439
+ console.log(`[RRWeb] Recording initialized - session started at ${this.sessionStartTime}, recording started at ${this.recordingStartTime}`);
13435
13440
  }
13436
13441
  start() {
13437
13442
  if (!this.config.enabled) {
@@ -13445,6 +13450,13 @@ class RRWebRecorder {
13445
13450
  try {
13446
13451
  this.stopFn = record({
13447
13452
  emit: (event) => {
13453
+ // Convert absolute timestamps to relative to session start
13454
+ // This ensures continuity across page navigations within same session
13455
+ const originalTimestamp = event.timestamp;
13456
+ event.timestamp = event.timestamp - this.sessionStartTime;
13457
+ if (this.config.enabled && event.type === 2) {
13458
+ console.log(`[RRWeb] FullSnapshot - original: ${originalTimestamp}, relative: ${event.timestamp}, session start: ${this.sessionStartTime}`);
13459
+ }
13448
13460
  this.events.push(event);
13449
13461
  // Check if this is a FullSnapshot (type 2)
13450
13462
  if (event.type === 2) {
@@ -13930,6 +13942,7 @@ class DevSkinSDK {
13930
13942
  // Initialize session recording with rrweb
13931
13943
  if ((_a = this.config.sessionRecording) === null || _a === void 0 ? void 0 : _a.enabled) {
13932
13944
  // Use RRWebRecorder for complete DOM recording
13945
+ // Pass sessionStartTime to ensure timestamp continuity across page navigations
13933
13946
  this.rrwebRecorder = new RRWebRecorder(this.sessionId, {
13934
13947
  enabled: true,
13935
13948
  sampleRate: this.config.sessionRecording.sampling || 0.5,
@@ -13952,7 +13965,8 @@ class DevSkinSDK {
13952
13965
  var _a;
13953
13966
  // Send rrweb events to backend
13954
13967
  (_a = this.transport) === null || _a === void 0 ? void 0 : _a.sendRecordingEvents(this.sessionId, events);
13955
- });
13968
+ }, this.sessionStartTime // Pass session start time for timestamp continuity
13969
+ );
13956
13970
  // Start recording immediately (session already created)
13957
13971
  this.rrwebRecorder.start();
13958
13972
  if ((_b = this.config) === null || _b === void 0 ? void 0 : _b.debug) {