@statsig/session-replay 3.29.1 → 3.30.1

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.1",
3
+ "version": "3.30.1",
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.1"
14
+ "@statsig/client-core": "3.30.1"
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;
@@ -4,6 +4,8 @@ exports.TriggeredSessionReplay = exports.runStatsigTriggeredSessionReplay = expo
4
4
  const client_core_1 = require("@statsig/client-core");
5
5
  const SessionReplayBase_1 = require("./SessionReplayBase");
6
6
  const SessionReplayUtils_1 = require("./SessionReplayUtils");
7
+ const ALL_GATES_TRIGGER_ID = 'statsig::session_recording_all_gates';
8
+ const ALL_EXPERIMENTS_TRIGGER_ID = 'statsig::session_recording_all_experiments';
7
9
  class StatsigTriggeredSessionReplayPlugin {
8
10
  constructor(options) {
9
11
  this.options = options;
@@ -83,16 +85,16 @@ class TriggeredSessionReplay extends SessionReplayBase_1.SessionReplayBase {
83
85
  }
84
86
  _subscribeToGateEvaluation() {
85
87
  this._client.$on('gate_evaluation', (event) => {
86
- this._tryStartExposureRecording(event.gate.name, String(event.gate.value));
88
+ this._tryStartExposureRecording(event.gate.name, String(event.gate.value), 'gate');
87
89
  });
88
90
  }
89
91
  _subscribeToExperimentEvaluation() {
90
92
  this._client.$on('experiment_evaluation', (event) => {
91
93
  var _a;
92
- this._tryStartExposureRecording(event.experiment.name, (_a = event.experiment.groupName) !== null && _a !== void 0 ? _a : '');
94
+ this._tryStartExposureRecording(event.experiment.name, (_a = event.experiment.groupName) !== null && _a !== void 0 ? _a : '', 'experiment');
93
95
  });
94
96
  }
95
- _tryStartExposureRecording(name, value) {
97
+ _tryStartExposureRecording(name, value, type) {
96
98
  var _a;
97
99
  if (this._wasStopped) {
98
100
  return;
@@ -103,7 +105,15 @@ class TriggeredSessionReplay extends SessionReplayBase_1.SessionReplayBase {
103
105
  (values === null || values === void 0 ? void 0 : values.session_recording_exposure_triggers) == null) {
104
106
  return;
105
107
  }
106
- 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)];
108
+ let trigger = (_a = values.session_recording_exposure_triggers[name]) !== null && _a !== void 0 ? _a : values.session_recording_exposure_triggers[(0, client_core_1._DJB2)(name)];
109
+ if (trigger == null && type === 'gate') {
110
+ trigger =
111
+ values.session_recording_exposure_triggers[ALL_GATES_TRIGGER_ID];
112
+ }
113
+ if (trigger == null && type === 'experiment') {
114
+ trigger =
115
+ values.session_recording_exposure_triggers[ALL_EXPERIMENTS_TRIGGER_ID];
116
+ }
107
117
  if (trigger == null) {
108
118
  return;
109
119
  }