@statsig/session-replay 3.8.1 → 3.8.2

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,9 +1,9 @@
1
1
  {
2
2
  "name": "@statsig/session-replay",
3
- "version": "3.8.1",
3
+ "version": "3.8.2",
4
4
  "dependencies": {
5
5
  "rrweb": "2.0.0-alpha.12",
6
- "@statsig/client-core": "3.8.1"
6
+ "@statsig/client-core": "3.8.2"
7
7
  },
8
8
  "devDependencies": {
9
9
  "@rrweb/types": "2.0.0-alpha.12"
@@ -1,7 +1,9 @@
1
1
  import type { eventWithTime } from '@rrweb/types';
2
2
  import * as rrweb from 'rrweb';
3
3
  import { Flatten } from '@statsig/client-core';
4
- export type ReplayEvent = Flatten<eventWithTime>;
4
+ export type ReplayEvent = Flatten<eventWithTime & {
5
+ eventIndex: number;
6
+ }>;
5
7
  export type RRWebConfig = Omit<rrweb.recordOptions<unknown>, 'emit'>;
6
8
  export type ReplaySessionData = {
7
9
  startTime: number;
@@ -14,6 +16,7 @@ export declare class SessionReplayClient {
14
16
  private _startTimestamp;
15
17
  private _endTimestamp;
16
18
  private _clickCount;
19
+ private _eventCounter;
17
20
  record(callback: (latest: ReplayEvent, data: ReplaySessionData) => void, config: RRWebConfig, stopCallback?: () => void): void;
18
21
  stop(): void;
19
22
  isRecording(): boolean;
@@ -9,6 +9,7 @@ class SessionReplayClient {
9
9
  this._startTimestamp = null;
10
10
  this._endTimestamp = null;
11
11
  this._clickCount = 0;
12
+ this._eventCounter = 0;
12
13
  }
13
14
  record(callback, config, stopCallback) {
14
15
  if ((0, client_core_1._getDocumentSafe)() == null) {
@@ -18,6 +19,7 @@ class SessionReplayClient {
18
19
  this._startTimestamp = null;
19
20
  this._endTimestamp = null;
20
21
  this._clickCount = 0;
22
+ this._eventCounter = 0;
21
23
  this._stopCallback = stopCallback;
22
24
  if (this._stopFn) {
23
25
  return;
@@ -32,7 +34,7 @@ class SessionReplayClient {
32
34
  if (_isClickEvent(event)) {
33
35
  this._clickCount++;
34
36
  }
35
- callback(event, {
37
+ callback(Object.assign(Object.assign({}, event), { eventIndex: this._eventCounter++ }), {
36
38
  startTime: this._startTimestamp,
37
39
  endTime: this._endTimestamp,
38
40
  clickCount: this._clickCount,