@statsig/session-replay 0.0.1-beta.34 → 0.0.1-beta.35
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 +2 -2
- package/src/SessionReplay.d.ts +1 -0
- package/src/SessionReplay.js +7 -2
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statsig/session-replay",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.35",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"rrweb": "2.0.0-alpha.12",
|
|
6
|
-
"@statsig/client-core": "0.0.1-beta.
|
|
6
|
+
"@statsig/client-core": "0.0.1-beta.35"
|
|
7
7
|
},
|
|
8
8
|
"devDependencies": {
|
|
9
9
|
"@rrweb/types": "2.0.0-alpha.12"
|
package/src/SessionReplay.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export declare class SessionReplay {
|
|
|
8
8
|
private _currentSessionID;
|
|
9
9
|
private _errorBoundary;
|
|
10
10
|
constructor(_client: PrecomputedEvaluationsInterface);
|
|
11
|
+
private _subscribeToVisibilityChanged;
|
|
11
12
|
private _onVisibilityChanged;
|
|
12
13
|
private _onRecordingEvent;
|
|
13
14
|
private _attemptToStartRecording;
|
package/src/SessionReplay.js
CHANGED
|
@@ -33,12 +33,18 @@ class SessionReplay {
|
|
|
33
33
|
this._replayer = new SessionReplayClient_1.SessionReplayClient();
|
|
34
34
|
this._client.__on('pre_shutdown', () => this._shutdown());
|
|
35
35
|
this._client.__on('values_updated', () => this._attemptToStartRecording());
|
|
36
|
-
_client.on('session_expired', () => {
|
|
36
|
+
this._client.on('session_expired', () => {
|
|
37
37
|
this._replayer.stop();
|
|
38
38
|
client_core_1.StatsigMetadataProvider.add({ isRecordingSession: 'false' });
|
|
39
39
|
this._logRecording();
|
|
40
40
|
this._currentSessionID = this._getSessionIdFromClient();
|
|
41
41
|
});
|
|
42
|
+
this._subscribeToVisibilityChanged();
|
|
43
|
+
this._attemptToStartRecording();
|
|
44
|
+
}
|
|
45
|
+
_subscribeToVisibilityChanged() {
|
|
46
|
+
// Note: this exists as a separate function to ensure closure scope only contains `sdkKey`
|
|
47
|
+
const { sdkKey } = this._client.getContext();
|
|
42
48
|
(0, client_core_1._subscribeToVisiblityChanged)((vis) => {
|
|
43
49
|
var _a;
|
|
44
50
|
const inst = (_a = __STATSIG__ === null || __STATSIG__ === void 0 ? void 0 : __STATSIG__.srInstances) === null || _a === void 0 ? void 0 : _a[sdkKey];
|
|
@@ -46,7 +52,6 @@ class SessionReplay {
|
|
|
46
52
|
inst._onVisibilityChanged(vis);
|
|
47
53
|
}
|
|
48
54
|
});
|
|
49
|
-
this._attemptToStartRecording();
|
|
50
55
|
}
|
|
51
56
|
_onVisibilityChanged(visibility) {
|
|
52
57
|
if (visibility === 'background') {
|