userlens-session-recorder 1.0.4 → 1.0.6
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
|
@@ -20642,18 +20642,19 @@ class SessionRecorder {
|
|
|
20642
20642
|
this.rrwebStop = null;
|
|
20643
20643
|
_SessionRecorder_trackEventsThrottled.set(this, void 0);
|
|
20644
20644
|
_SessionRecorder_handleVisibilityChange.set(this, () => {
|
|
20645
|
-
if (document.visibilityState) {
|
|
20645
|
+
if (document.visibilityState === "visible") {
|
|
20646
20646
|
takeFullSnapshot();
|
|
20647
20647
|
}
|
|
20648
20648
|
});
|
|
20649
20649
|
if (typeof window === "undefined") {
|
|
20650
|
-
|
|
20650
|
+
return;
|
|
20651
20651
|
}
|
|
20652
20652
|
if (!(WRITE_CODE === null || WRITE_CODE === void 0 ? void 0 : WRITE_CODE.trim())) {
|
|
20653
20653
|
throw new Error("Userlens SDK Error: WRITE_CODE is required and must be a string");
|
|
20654
20654
|
}
|
|
20655
20655
|
if (!(userId === null || userId === void 0 ? void 0 : userId.trim())) {
|
|
20656
20656
|
console.error("Userlens SDK Error: userId is required to identify session user.");
|
|
20657
|
+
return;
|
|
20657
20658
|
}
|
|
20658
20659
|
const { TIMEOUT = 30 * 60 * 1000, BUFFER_SIZE = 10, maskingOptions = ["passwords"], } = recordingOptions;
|
|
20659
20660
|
if (typeof WRITE_CODE === "string") {
|
|
@@ -20673,13 +20674,10 @@ class SessionRecorder {
|
|
|
20673
20674
|
__classPrivateFieldGet(this, _SessionRecorder_instances, "m", _SessionRecorder_initRecorder).call(this);
|
|
20674
20675
|
}
|
|
20675
20676
|
stop() {
|
|
20676
|
-
console.log("stop() called, rrwebStop is:", typeof this.rrwebStop);
|
|
20677
20677
|
if (!this.rrwebStop) {
|
|
20678
20678
|
return;
|
|
20679
20679
|
}
|
|
20680
|
-
console.log("Stopping recorder...");
|
|
20681
20680
|
this.rrwebStop();
|
|
20682
|
-
console.log("Recorder stopped, rrwebStop is now:", typeof this.rrwebStop);
|
|
20683
20681
|
this.rrwebStop = null;
|
|
20684
20682
|
__classPrivateFieldGet(this, _SessionRecorder_instances, "m", _SessionRecorder_clearEvents).call(this);
|
|
20685
20683
|
__classPrivateFieldGet(this, _SessionRecorder_instances, "m", _SessionRecorder_removeLocalSessionData).call(this);
|
|
@@ -20704,6 +20702,7 @@ _SessionRecorder_trackEventsThrottled = new WeakMap(), _SessionRecorder_handleVi
|
|
|
20704
20702
|
}, 100);
|
|
20705
20703
|
__classPrivateFieldGet(this, _SessionRecorder_instances, "m", _SessionRecorder_initFocusListener).call(this);
|
|
20706
20704
|
}, _SessionRecorder_handleEvent = function _SessionRecorder_handleEvent(event) {
|
|
20705
|
+
var _a;
|
|
20707
20706
|
const now = Date.now();
|
|
20708
20707
|
const lastActive = Number(localStorage.getItem("userlensSessionLastActive"));
|
|
20709
20708
|
// check inactivity timeout
|
|
@@ -20713,7 +20712,7 @@ _SessionRecorder_trackEventsThrottled = new WeakMap(), _SessionRecorder_handleVi
|
|
|
20713
20712
|
localStorage.setItem("userlensSessionLastActive", now.toString());
|
|
20714
20713
|
this.sessionEvents.push(event);
|
|
20715
20714
|
if (this.sessionEvents.length >= this.BUFFER_SIZE) {
|
|
20716
|
-
__classPrivateFieldGet(this, _SessionRecorder_trackEventsThrottled, "f").call(this);
|
|
20715
|
+
(_a = __classPrivateFieldGet(this, _SessionRecorder_trackEventsThrottled, "f")) === null || _a === void 0 ? void 0 : _a.call(this);
|
|
20717
20716
|
}
|
|
20718
20717
|
}, _SessionRecorder_resetSession = function _SessionRecorder_resetSession() {
|
|
20719
20718
|
__classPrivateFieldGet(this, _SessionRecorder_instances, "m", _SessionRecorder_removeLocalSessionData).call(this);
|