userlens-session-recorder 1.0.7 → 1.0.8
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/index.cjs.js
CHANGED
|
@@ -20634,7 +20634,7 @@ const uploadSessionEvents = async (userId, sessionUuid, events, chunkTimestamp)
|
|
|
20634
20634
|
return "ok";
|
|
20635
20635
|
};
|
|
20636
20636
|
|
|
20637
|
-
var _SessionRecorder_instances, _SessionRecorder_trackEventsThrottled, _SessionRecorder_initRecorder, _SessionRecorder_handleEvent, _SessionRecorder_resetSession, _SessionRecorder_createSession, _SessionRecorder_handleVisibilityChange, _SessionRecorder_initFocusListener, _SessionRecorder_throttle, _SessionRecorder_trackEvents, _SessionRecorder_clearEvents, _SessionRecorder_removeLocalSessionData;
|
|
20637
|
+
var _SessionRecorder_instances, _SessionRecorder_trackEventsThrottled, _SessionRecorder_initRecorder, _SessionRecorder_isUserInteraction, _SessionRecorder_handleEvent, _SessionRecorder_resetSession, _SessionRecorder_createSession, _SessionRecorder_handleVisibilityChange, _SessionRecorder_initFocusListener, _SessionRecorder_throttle, _SessionRecorder_trackEvents, _SessionRecorder_clearEvents, _SessionRecorder_removeLocalSessionData;
|
|
20638
20638
|
class SessionRecorder {
|
|
20639
20639
|
constructor({ WRITE_CODE, userId, recordingOptions = {}, }) {
|
|
20640
20640
|
_SessionRecorder_instances.add(this);
|
|
@@ -20701,6 +20701,13 @@ _SessionRecorder_trackEventsThrottled = new WeakMap(), _SessionRecorder_handleVi
|
|
|
20701
20701
|
});
|
|
20702
20702
|
}, 100);
|
|
20703
20703
|
__classPrivateFieldGet(this, _SessionRecorder_instances, "m", _SessionRecorder_initFocusListener).call(this);
|
|
20704
|
+
}, _SessionRecorder_isUserInteraction = function _SessionRecorder_isUserInteraction(event) {
|
|
20705
|
+
var _a;
|
|
20706
|
+
if (event.type === 3) {
|
|
20707
|
+
const source = (_a = event.data) === null || _a === void 0 ? void 0 : _a.source;
|
|
20708
|
+
return source === 2 || source === 5 || source === 6;
|
|
20709
|
+
}
|
|
20710
|
+
return false;
|
|
20704
20711
|
}, _SessionRecorder_handleEvent = function _SessionRecorder_handleEvent(event) {
|
|
20705
20712
|
var _a;
|
|
20706
20713
|
const now = Date.now();
|
|
@@ -20709,7 +20716,10 @@ _SessionRecorder_trackEventsThrottled = new WeakMap(), _SessionRecorder_handleVi
|
|
|
20709
20716
|
if (lastActive && now - lastActive > this.TIMEOUT) {
|
|
20710
20717
|
__classPrivateFieldGet(this, _SessionRecorder_instances, "m", _SessionRecorder_resetSession).call(this);
|
|
20711
20718
|
}
|
|
20712
|
-
|
|
20719
|
+
// only update lastActive on actual user interactions, not DOM mutations
|
|
20720
|
+
if (__classPrivateFieldGet(this, _SessionRecorder_instances, "m", _SessionRecorder_isUserInteraction).call(this, event)) {
|
|
20721
|
+
localStorage.setItem("userlensSessionLastActive", now.toString());
|
|
20722
|
+
}
|
|
20713
20723
|
this.sessionEvents.push(event);
|
|
20714
20724
|
if (this.sessionEvents.length >= this.BUFFER_SIZE) {
|
|
20715
20725
|
(_a = __classPrivateFieldGet(this, _SessionRecorder_trackEventsThrottled, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
|