@statsig/session-replay 3.29.0 → 3.30.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@statsig/session-replay",
3
- "version": "3.29.0",
3
+ "version": "3.30.0",
4
4
  "license": "ISC",
5
5
  "homepage": "https://github.com/statsig-io/js-client-monorepo",
6
6
  "repository": {
@@ -11,7 +11,7 @@
11
11
  "dependencies": {
12
12
  "rrweb": "2.0.0-alpha.17",
13
13
  "@rrweb/record": "2.0.0-alpha.17",
14
- "@statsig/client-core": "3.29.0"
14
+ "@statsig/client-core": "3.30.0"
15
15
  },
16
16
  "devDependencies": {
17
17
  "@rrweb/types": "2.0.0-alpha.16"
@@ -15,6 +15,10 @@ class StatsigSessionReplayPlugin {
15
15
  }
16
16
  exports.StatsigSessionReplayPlugin = StatsigSessionReplayPlugin;
17
17
  function runStatsigSessionReplay(client, options) {
18
+ // Early exit for server-side rendering - plugins should only run in browser
19
+ if ((0, client_core_1._isServerEnv)()) {
20
+ return;
21
+ }
18
22
  new SessionReplay(client, options);
19
23
  }
20
24
  exports.runStatsigSessionReplay = runStatsigSessionReplay;
@@ -83,16 +83,16 @@ class TriggeredSessionReplay extends SessionReplayBase_1.SessionReplayBase {
83
83
  }
84
84
  _subscribeToGateEvaluation() {
85
85
  this._client.$on('gate_evaluation', (event) => {
86
- this._tryStartExposureRecording(event.gate.name, String(event.gate.value));
86
+ this._tryStartExposureRecording(event.gate.name, String(event.gate.value), 'gate');
87
87
  });
88
88
  }
89
89
  _subscribeToExperimentEvaluation() {
90
90
  this._client.$on('experiment_evaluation', (event) => {
91
91
  var _a;
92
- this._tryStartExposureRecording(event.experiment.name, (_a = event.experiment.groupName) !== null && _a !== void 0 ? _a : '');
92
+ this._tryStartExposureRecording(event.experiment.name, (_a = event.experiment.groupName) !== null && _a !== void 0 ? _a : '', 'experiment');
93
93
  });
94
94
  }
95
- _tryStartExposureRecording(name, value) {
95
+ _tryStartExposureRecording(name, value, type) {
96
96
  var _a;
97
97
  if (this._wasStopped) {
98
98
  return;
@@ -103,6 +103,11 @@ class TriggeredSessionReplay extends SessionReplayBase_1.SessionReplayBase {
103
103
  (values === null || values === void 0 ? void 0 : values.session_recording_exposure_triggers) == null) {
104
104
  return;
105
105
  }
106
+ if ((type === 'gate' && values.record_on_gate_check === true) ||
107
+ (type === 'experiment' && values.record_on_experiment_check === true)) {
108
+ this._attemptToStartRecording(true);
109
+ return;
110
+ }
106
111
  const trigger = (_a = values.session_recording_exposure_triggers[name]) !== null && _a !== void 0 ? _a : values.session_recording_exposure_triggers[(0, client_core_1._DJB2)(name)];
107
112
  if (trigger == null) {
108
113
  return;