userlens-session-recorder 2.2.0 → 2.2.1

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.
@@ -20861,7 +20861,7 @@
20861
20861
  writeWindowState({ window_id: this._windowId, chunk_seq: 0 });
20862
20862
  };
20863
20863
 
20864
- var _SessionRecorder_instances, _SessionRecorder_uploading, _SessionRecorder_uploadingMaxTs, _SessionRecorder_bufferTimer, _SessionRecorder_log, _SessionRecorder_initRecorder, _SessionRecorder_isUserInteraction, _SessionRecorder_handleEvent, _SessionRecorder_armBufferTimer, _SessionRecorder_flushBuffer, _SessionRecorder_handlePageHide, _SessionRecorder_handleVisibilityChange, _SessionRecorder_initListeners, _SessionRecorder_trackEvents, _SessionRecorder_clearEvents;
20864
+ var _SessionRecorder_instances, _SessionRecorder_uploading, _SessionRecorder_uploadingMaxTs, _SessionRecorder_bufferTimer, _SessionRecorder_log, _SessionRecorder_initRecorder, _SessionRecorder_isUserInteraction, _SessionRecorder_isVisibilityMarker, _SessionRecorder_handleEvent, _SessionRecorder_armBufferTimer, _SessionRecorder_flushBuffer, _SessionRecorder_handlePageHide, _SessionRecorder_handleVisibilityChange, _SessionRecorder_initListeners, _SessionRecorder_trackEvents, _SessionRecorder_clearEvents;
20865
20865
  const BUFFER_TIMEOUT_MS = 2000;
20866
20866
  const MAX_BUFFER_BYTES = 900 * 1024;
20867
20867
  function estimateEventSize(event) {
@@ -21058,16 +21058,32 @@
21058
21058
  return source === 2 || source === 5 || source === 6;
21059
21059
  }
21060
21060
  return false;
21061
+ }, _SessionRecorder_isVisibilityMarker = function _SessionRecorder_isVisibilityMarker(event) {
21062
+ var _a;
21063
+ if (event.type !== 5)
21064
+ return false;
21065
+ const tag = (_a = event.data) === null || _a === void 0 ? void 0 : _a.tag;
21066
+ return tag === "window visible" || tag === "window hidden";
21061
21067
  }, _SessionRecorder_handleEvent = function _SessionRecorder_handleEvent(event, _isCheckout) {
21062
21068
  try {
21063
21069
  const now = Date.now();
21064
21070
  const change = this.sessionManager.syncWithSharedState(now);
21071
+ // A rotated session starts mid-page: no recorder construction and no
21072
+ // visibilitychange fires, so without the marker emit below the new
21073
+ // session has no visibility marker and the player can't attribute
21074
+ // windows. Skip it when the triggering event IS a visibility marker
21075
+ // (refocus after idle) — that event lands right after the snapshot
21076
+ // anyway, and emitting another would double it.
21065
21077
  if (change === "expired") {
21066
21078
  __classPrivateFieldGet(this, _SessionRecorder_instances, "m", _SessionRecorder_clearEvents).call(this);
21067
21079
  takeFullSnapshot(true);
21080
+ if (!__classPrivateFieldGet(this, _SessionRecorder_instances, "m", _SessionRecorder_isVisibilityMarker).call(this, event))
21081
+ __classPrivateFieldGet(this, _SessionRecorder_handleVisibilityChange, "f").call(this);
21068
21082
  }
21069
21083
  else if (change === "rotated") {
21070
21084
  takeFullSnapshot(true);
21085
+ if (!__classPrivateFieldGet(this, _SessionRecorder_instances, "m", _SessionRecorder_isVisibilityMarker).call(this, event))
21086
+ __classPrivateFieldGet(this, _SessionRecorder_handleVisibilityChange, "f").call(this);
21071
21087
  }
21072
21088
  if (__classPrivateFieldGet(this, _SessionRecorder_instances, "m", _SessionRecorder_isUserInteraction).call(this, event)) {
21073
21089
  this.sessionManager.bumpActivity(now);