@statsig/session-replay 3.24.3 → 3.25.0-beta.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.24.3",
3
+ "version": "3.25.0-beta.1",
4
4
  "license": "ISC",
5
5
  "homepage": "https://github.com/statsig-io/js-client-monorepo",
6
6
  "repository": {
@@ -9,11 +9,12 @@
9
9
  "directory": "packages/session-replay"
10
10
  },
11
11
  "dependencies": {
12
- "rrweb": "2.0.0-alpha.14",
13
- "@statsig/client-core": "3.24.3"
12
+ "rrweb": "2.0.0-alpha.17",
13
+ "@rrweb/record": "2.0.0-alpha.17",
14
+ "@statsig/client-core": "3.25.0-beta.1"
14
15
  },
15
16
  "devDependencies": {
16
- "@rrweb/types": "2.0.0-alpha.14"
17
+ "@rrweb/types": "2.0.0-alpha.16"
17
18
  },
18
19
  "type": "commonjs",
19
20
  "main": "./src/index.js",
@@ -140,7 +140,11 @@ class SessionReplayBase {
140
140
  _shutdownImpl(endReason) {
141
141
  if (this._replayer.isRecording()) {
142
142
  this._replayer.stop();
143
- client_core_1.StatsigMetadataProvider.add({ isRecordingSession: 'false' });
143
+ const handler = () => {
144
+ client_core_1.StatsigMetadataProvider.add({ isRecordingSession: 'false' });
145
+ this._client.off('logs_flushed', handler);
146
+ };
147
+ this._client.$on('logs_flushed', handler);
144
148
  }
145
149
  if (this._events.length === 0) {
146
150
  // only reset if session expired otherwise we might start recording again
@@ -1,10 +1,10 @@
1
1
  import type { eventWithTime } from '@rrweb/types';
2
- import * as rrweb from 'rrweb';
2
+ import type { recordOptions } from 'rrweb';
3
3
  import { Flatten } from '@statsig/client-core';
4
4
  export type ReplayEvent = Flatten<eventWithTime & {
5
5
  eventIndex: number;
6
6
  }>;
7
- export type RRWebConfig = Omit<rrweb.recordOptions<unknown>, 'emit'>;
7
+ export type RRWebConfig = Omit<recordOptions<unknown>, 'emit'>;
8
8
  export type ReplaySessionData = {
9
9
  startTime: number;
10
10
  endTime: number;
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SessionReplayClient = void 0;
4
- const rrweb = require("rrweb");
4
+ const record_1 = require("@rrweb/record");
5
5
  const client_core_1 = require("@statsig/client-core");
6
6
  const TIMEOUT_MS = 1000 * 60 * 60 * 4; // 4 hours
7
7
  const CHECKOUT_WINDOW_MS = 1000 * 30; // 30 seconds
@@ -70,12 +70,11 @@ exports.SessionReplayClient = SessionReplayClient;
70
70
  * This function ensures we handle both "npm" and "<script ..>" install options.
71
71
  */
72
72
  function _minifiedAwareRecord(emit, config, keepRollingWindow) {
73
- const record = typeof rrweb === 'function' ? rrweb : rrweb.record;
74
73
  if (keepRollingWindow) {
75
- return record(Object.assign(Object.assign({}, config), { emit, checkoutEveryNms: CHECKOUT_WINDOW_MS }));
74
+ return (0, record_1.record)(Object.assign(Object.assign({}, config), { emit, checkoutEveryNms: CHECKOUT_WINDOW_MS }));
76
75
  }
77
76
  else {
78
- return record(Object.assign(Object.assign({}, config), { emit }));
77
+ return (0, record_1.record)(Object.assign(Object.assign({}, config), { emit }));
79
78
  }
80
79
  }
81
80
  function _isClickEvent(event) {