@statsig/session-replay 3.14.1 → 3.15.0
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/package.json +9 -2
- package/src/SessionReplay.js +9 -17
package/package.json
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statsig/session-replay",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.0",
|
|
4
|
+
"license": "ISC",
|
|
5
|
+
"homepage": "https://github.com/statsig-io/js-client-monorepo",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "github:statsig-io/js-client-monorepo",
|
|
9
|
+
"directory": "packages/session-replay"
|
|
10
|
+
},
|
|
4
11
|
"dependencies": {
|
|
5
12
|
"rrweb": "2.0.0-alpha.14",
|
|
6
|
-
"@statsig/client-core": "3.
|
|
13
|
+
"@statsig/client-core": "3.15.0"
|
|
7
14
|
},
|
|
8
15
|
"devDependencies": {
|
|
9
16
|
"@rrweb/types": "2.0.0-alpha.14"
|
package/src/SessionReplay.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.SessionReplay = exports.runStatsigSessionReplay = exports.StatsigSessionReplayPlugin = void 0;
|
|
13
4
|
const client_core_1 = require("@statsig/client-core");
|
|
@@ -81,6 +72,13 @@ class SessionReplay {
|
|
|
81
72
|
});
|
|
82
73
|
}
|
|
83
74
|
_onRecordingEvent(event, data) {
|
|
75
|
+
// The session has expired so we should stop recording
|
|
76
|
+
if (this._currentSessionID !== this._getSessionIdFromClient()) {
|
|
77
|
+
this._replayer.stop();
|
|
78
|
+
client_core_1.StatsigMetadataProvider.add({ isRecordingSession: 'false' });
|
|
79
|
+
this._logRecording('session_expired');
|
|
80
|
+
return;
|
|
81
|
+
}
|
|
84
82
|
this._sessionData = data;
|
|
85
83
|
const eventApproxSize = (0, SizeOf_1._fastApproxSizeOf)(event, MAX_INDIVIDUAL_EVENT_BYTES);
|
|
86
84
|
if (eventApproxSize > MAX_INDIVIDUAL_EVENT_BYTES) {
|
|
@@ -126,11 +124,7 @@ class SessionReplay {
|
|
|
126
124
|
return;
|
|
127
125
|
}
|
|
128
126
|
endReason = (0, client_core_1._isUnloading)() ? 'is_leaving_page' : endReason;
|
|
129
|
-
this._currentSessionID
|
|
130
|
-
.then((sessionID) => this._logRecordingWithSessionID(sessionID, endReason))
|
|
131
|
-
.catch((err) => {
|
|
132
|
-
this._errorBoundary.logError('SR::flush', err);
|
|
133
|
-
});
|
|
127
|
+
this._logRecordingWithSessionID(this._currentSessionID, endReason);
|
|
134
128
|
}
|
|
135
129
|
_logRecordingWithSessionID(sessionID, endReason) {
|
|
136
130
|
const data = this._sessionData;
|
|
@@ -163,9 +157,7 @@ class SessionReplay {
|
|
|
163
157
|
this._logRecording();
|
|
164
158
|
}
|
|
165
159
|
_getSessionIdFromClient() {
|
|
166
|
-
return
|
|
167
|
-
return this._client.getContext().session.data.sessionID;
|
|
168
|
-
});
|
|
160
|
+
return this._client.getContext().session.data.sessionID;
|
|
169
161
|
}
|
|
170
162
|
}
|
|
171
163
|
exports.SessionReplay = SessionReplay;
|