@spotify-confidence/csr-common 0.18.3 → 0.18.5

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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.18.5](https://github.com/spotify/confidence-sdk-js/compare/csr-common-v0.18.4...csr-common-v0.18.5) (2026-08-12)
4
+
5
+
6
+ ### ✨ New Features
7
+
8
+ * **csr-common:** type incremental interaction data ([#430](https://github.com/spotify/confidence-sdk-js/issues/430)) ([43db5d9](https://github.com/spotify/confidence-sdk-js/commit/43db5d91f5368fab10eb5c97ba116575bc728672))
9
+
10
+ ## [0.18.4](https://github.com/spotify/confidence-sdk-js/compare/csr-common-v0.18.3...csr-common-v0.18.4) (2026-08-05)
11
+
12
+
13
+ ### ✨ New Features
14
+
15
+ * **csr-common:** optional eventId identity on custom event payloads ([#428](https://github.com/spotify/confidence-sdk-js/issues/428)) ([f49970a](https://github.com/spotify/confidence-sdk-js/commit/f49970a4ccd34cbfbdef7729df19a256f077fced))
16
+
3
17
  ## [0.18.3](https://github.com/spotify/confidence-sdk-js/compare/csr-common-v0.18.2...csr-common-v0.18.3) (2026-07-16)
4
18
 
5
19
 
package/dist/index.d.cts CHANGED
@@ -61,9 +61,43 @@ declare enum MouseInteractions {
61
61
  TouchEnd = 9,
62
62
  TouchCancel = 10
63
63
  }
64
+ /**
65
+ * Incremental mouse-interaction data emitted by rrweb.
66
+ */
67
+ type MouseInteractionData = {
68
+ source: IncrementalSource.MouseInteraction;
69
+ type: MouseInteractions;
70
+ id: number;
71
+ x?: number;
72
+ y?: number;
73
+ pointerType?: number;
74
+ };
75
+ type SelectionRange = {
76
+ start: number;
77
+ startOffset: number;
78
+ end: number;
79
+ endOffset: number;
80
+ };
81
+ /**
82
+ * Incremental text-selection data emitted by rrweb.
83
+ */
84
+ type SelectionData = {
85
+ source: IncrementalSource.Selection;
86
+ ranges: SelectionRange[];
87
+ };
88
+ /**
89
+ * Incremental sources that csr-common does not model yet. The source remains
90
+ * discriminated so consumers can narrow the known mouse and selection shapes.
91
+ */
92
+ type OpaqueIncrementalData = {
93
+ source: Exclude<IncrementalSource, IncrementalSource.MouseInteraction | IncrementalSource.Selection>;
94
+ [key: string]: unknown;
95
+ };
96
+ type IncrementalSnapshotData = MouseInteractionData | SelectionData | OpaqueIncrementalData;
64
97
  type RageClickCustomData = {
65
98
  tag: "csr:rageClick";
66
99
  payload: {
100
+ eventId?: string;
67
101
  targetId: number;
68
102
  clickCount: number;
69
103
  durationMs: number;
@@ -74,6 +108,7 @@ type RageClickCustomData = {
74
108
  type FormFieldReEditCustomData = {
75
109
  tag: "csr:formFieldReEdit";
76
110
  payload: {
111
+ eventId?: string;
77
112
  targetId: number;
78
113
  editCount: number;
79
114
  element?: ElementDescriptor;
@@ -83,6 +118,7 @@ type FormFieldReEditCustomData = {
83
118
  type ScrollBackCustomData = {
84
119
  tag: "csr:scrollBack";
85
120
  payload: {
121
+ eventId?: string;
86
122
  scrollBackPx: number;
87
123
  fromY: number;
88
124
  toY: number;
@@ -98,6 +134,7 @@ type ElementDescriptor = {
98
134
  type ClickCustomData = {
99
135
  tag: "csr:click";
100
136
  payload: {
137
+ eventId?: string;
101
138
  targetId: number;
102
139
  element?: ElementDescriptor;
103
140
  pathname?: string;
@@ -106,6 +143,7 @@ type ClickCustomData = {
106
143
  type InputCustomData = {
107
144
  tag: "csr:input";
108
145
  payload: {
146
+ eventId?: string;
109
147
  targetId: number;
110
148
  element?: ElementDescriptor;
111
149
  pathname?: string;
@@ -116,6 +154,7 @@ type InputCustomData = {
116
154
  type DeadClickCustomData = {
117
155
  tag: "csr:deadClick";
118
156
  payload: {
157
+ eventId?: string;
119
158
  targetId: number;
120
159
  element?: ElementDescriptor;
121
160
  pathname?: string;
@@ -124,12 +163,14 @@ type DeadClickCustomData = {
124
163
  type TabUnfocusCustomData = {
125
164
  tag: "csr:tabUnfocus";
126
165
  payload: {
166
+ eventId?: string;
127
167
  pathname?: string;
128
168
  };
129
169
  };
130
170
  type TabRefocusCustomData = {
131
171
  tag: "csr:tabRefocus";
132
172
  payload: {
173
+ eventId?: string;
133
174
  awayDurationMs: number;
134
175
  pathname?: string;
135
176
  };
@@ -142,7 +183,9 @@ type RouteChangePayload = {
142
183
  };
143
184
  type RouteChangeCustomData = {
144
185
  tag: "csr:routeChange";
145
- payload: RouteChangePayload;
186
+ payload: RouteChangePayload & {
187
+ eventId?: string;
188
+ };
146
189
  };
147
190
  /**
148
191
  * Plugin event data emitted by the recorder for tab visibility changes.
@@ -211,18 +254,21 @@ type FlagEvaluationPluginData = {
211
254
  type ErrorMessageCustomData = {
212
255
  tag: "csr:errorMessage";
213
256
  payload: {
257
+ eventId?: string;
214
258
  text: string;
215
259
  };
216
260
  };
217
261
  type DialogOpenedCustomData = {
218
262
  tag: "csr:dialogOpened";
219
263
  payload: {
264
+ eventId?: string;
220
265
  content: string[];
221
266
  };
222
267
  };
223
268
  type IdleGapCustomData = {
224
269
  tag: "csr:idleGap";
225
270
  payload: {
271
+ eventId?: string;
226
272
  visibleGapS: number;
227
273
  totalGapS: number;
228
274
  hiddenS: number;
@@ -232,6 +278,7 @@ type IdleGapCustomData = {
232
278
  type AwayGapCustomData = {
233
279
  tag: "csr:awayGap";
234
280
  payload: {
281
+ eventId?: string;
235
282
  totalGapS: number;
236
283
  hiddenS: number;
237
284
  };
@@ -239,6 +286,11 @@ type AwayGapCustomData = {
239
286
  /**
240
287
  * Closed union of every Custom event we emit. Add a new variant here when
241
288
  * introducing a new tag — emitting an unregistered tag is a TS error.
289
+ *
290
+ * Every payload carries an optional `eventId`: a per-event identity stamped
291
+ * at emission by the analyzer (uuid). It is inert metadata — players ignore
292
+ * it — and exists so downstream review tooling can reference and remove
293
+ * individual generated events without patching untyped data.
242
294
  */
243
295
  type CustomEventData = ClickCustomData | InputCustomData | RageClickCustomData | FormFieldReEditCustomData | ScrollBackCustomData | DeadClickCustomData | TabUnfocusCustomData | TabRefocusCustomData | RouteChangeCustomData | ErrorMessageCustomData | DialogOpenedCustomData | IdleGapCustomData | AwayGapCustomData;
244
296
  /**
@@ -253,7 +305,11 @@ type RecordingEvent = {
253
305
  timestamp: number;
254
306
  data: CustomEventData;
255
307
  } | {
256
- type: Exclude<RecordingEventType, RecordingEventType.Custom>;
308
+ type: RecordingEventType.IncrementalSnapshot;
309
+ timestamp: number;
310
+ data: IncrementalSnapshotData;
311
+ } | {
312
+ type: Exclude<RecordingEventType, RecordingEventType.Custom | RecordingEventType.IncrementalSnapshot>;
257
313
  timestamp: number;
258
314
  data: unknown;
259
315
  };
@@ -274,4 +330,4 @@ declare function validateKey(key: string): string | null;
274
330
  declare function validateTagValue(value: string | undefined): string | null;
275
331
  declare function validateMeasureValue(value: number | undefined): string | null;
276
332
  //#endregion
277
- export { type AwayGapCustomData, type ClickCustomData, type ClientContext, type ConsoleLogLevel, type ConsoleLogPluginData, type CustomEventData, type DeadClickCustomData, type DialogOpenedCustomData, type ElementDescriptor, type ErrorMessageCustomData, type FlagEvaluationPluginData, type FormFieldReEditCustomData, type Frame, type IdleGapCustomData, IncrementalSource, type InputCustomData, MAX_DISTINCT_KEYS, MAX_KEY_LENGTH, MAX_TAG_VALUE_LENGTH, MAX_VALUES_PER_KEY, type MeasurePluginData, MouseInteractions, type NetworkRequestInitiator, type NetworkRequestPluginData, type RageClickCustomData, type RecordingEvent, RecordingEventType, type RouteChangeCustomData, type RouteChangePayload, type RouteChangePluginData, type RouteChangeTrigger, type ScrollBackCustomData, SerializedNodeType, type TabRefocusCustomData, type TabUnfocusCustomData, type TabVisibilityPluginData, type TagPluginData, type UserAgentContext, stripUrl, validateKey, validateMeasureValue, validateTagValue };
333
+ export { type AwayGapCustomData, type ClickCustomData, type ClientContext, type ConsoleLogLevel, type ConsoleLogPluginData, type CustomEventData, type DeadClickCustomData, type DialogOpenedCustomData, type ElementDescriptor, type ErrorMessageCustomData, type FlagEvaluationPluginData, type FormFieldReEditCustomData, type Frame, type IdleGapCustomData, type IncrementalSnapshotData, IncrementalSource, type InputCustomData, MAX_DISTINCT_KEYS, MAX_KEY_LENGTH, MAX_TAG_VALUE_LENGTH, MAX_VALUES_PER_KEY, type MeasurePluginData, type MouseInteractionData, MouseInteractions, type NetworkRequestInitiator, type NetworkRequestPluginData, type OpaqueIncrementalData, type RageClickCustomData, type RecordingEvent, RecordingEventType, type RouteChangeCustomData, type RouteChangePayload, type RouteChangePluginData, type RouteChangeTrigger, type ScrollBackCustomData, type SelectionData, type SelectionRange, SerializedNodeType, type TabRefocusCustomData, type TabUnfocusCustomData, type TabVisibilityPluginData, type TagPluginData, type UserAgentContext, stripUrl, validateKey, validateMeasureValue, validateTagValue };
package/dist/index.d.ts CHANGED
@@ -61,9 +61,43 @@ declare enum MouseInteractions {
61
61
  TouchEnd = 9,
62
62
  TouchCancel = 10
63
63
  }
64
+ /**
65
+ * Incremental mouse-interaction data emitted by rrweb.
66
+ */
67
+ type MouseInteractionData = {
68
+ source: IncrementalSource.MouseInteraction;
69
+ type: MouseInteractions;
70
+ id: number;
71
+ x?: number;
72
+ y?: number;
73
+ pointerType?: number;
74
+ };
75
+ type SelectionRange = {
76
+ start: number;
77
+ startOffset: number;
78
+ end: number;
79
+ endOffset: number;
80
+ };
81
+ /**
82
+ * Incremental text-selection data emitted by rrweb.
83
+ */
84
+ type SelectionData = {
85
+ source: IncrementalSource.Selection;
86
+ ranges: SelectionRange[];
87
+ };
88
+ /**
89
+ * Incremental sources that csr-common does not model yet. The source remains
90
+ * discriminated so consumers can narrow the known mouse and selection shapes.
91
+ */
92
+ type OpaqueIncrementalData = {
93
+ source: Exclude<IncrementalSource, IncrementalSource.MouseInteraction | IncrementalSource.Selection>;
94
+ [key: string]: unknown;
95
+ };
96
+ type IncrementalSnapshotData = MouseInteractionData | SelectionData | OpaqueIncrementalData;
64
97
  type RageClickCustomData = {
65
98
  tag: "csr:rageClick";
66
99
  payload: {
100
+ eventId?: string;
67
101
  targetId: number;
68
102
  clickCount: number;
69
103
  durationMs: number;
@@ -74,6 +108,7 @@ type RageClickCustomData = {
74
108
  type FormFieldReEditCustomData = {
75
109
  tag: "csr:formFieldReEdit";
76
110
  payload: {
111
+ eventId?: string;
77
112
  targetId: number;
78
113
  editCount: number;
79
114
  element?: ElementDescriptor;
@@ -83,6 +118,7 @@ type FormFieldReEditCustomData = {
83
118
  type ScrollBackCustomData = {
84
119
  tag: "csr:scrollBack";
85
120
  payload: {
121
+ eventId?: string;
86
122
  scrollBackPx: number;
87
123
  fromY: number;
88
124
  toY: number;
@@ -98,6 +134,7 @@ type ElementDescriptor = {
98
134
  type ClickCustomData = {
99
135
  tag: "csr:click";
100
136
  payload: {
137
+ eventId?: string;
101
138
  targetId: number;
102
139
  element?: ElementDescriptor;
103
140
  pathname?: string;
@@ -106,6 +143,7 @@ type ClickCustomData = {
106
143
  type InputCustomData = {
107
144
  tag: "csr:input";
108
145
  payload: {
146
+ eventId?: string;
109
147
  targetId: number;
110
148
  element?: ElementDescriptor;
111
149
  pathname?: string;
@@ -116,6 +154,7 @@ type InputCustomData = {
116
154
  type DeadClickCustomData = {
117
155
  tag: "csr:deadClick";
118
156
  payload: {
157
+ eventId?: string;
119
158
  targetId: number;
120
159
  element?: ElementDescriptor;
121
160
  pathname?: string;
@@ -124,12 +163,14 @@ type DeadClickCustomData = {
124
163
  type TabUnfocusCustomData = {
125
164
  tag: "csr:tabUnfocus";
126
165
  payload: {
166
+ eventId?: string;
127
167
  pathname?: string;
128
168
  };
129
169
  };
130
170
  type TabRefocusCustomData = {
131
171
  tag: "csr:tabRefocus";
132
172
  payload: {
173
+ eventId?: string;
133
174
  awayDurationMs: number;
134
175
  pathname?: string;
135
176
  };
@@ -142,7 +183,9 @@ type RouteChangePayload = {
142
183
  };
143
184
  type RouteChangeCustomData = {
144
185
  tag: "csr:routeChange";
145
- payload: RouteChangePayload;
186
+ payload: RouteChangePayload & {
187
+ eventId?: string;
188
+ };
146
189
  };
147
190
  /**
148
191
  * Plugin event data emitted by the recorder for tab visibility changes.
@@ -211,18 +254,21 @@ type FlagEvaluationPluginData = {
211
254
  type ErrorMessageCustomData = {
212
255
  tag: "csr:errorMessage";
213
256
  payload: {
257
+ eventId?: string;
214
258
  text: string;
215
259
  };
216
260
  };
217
261
  type DialogOpenedCustomData = {
218
262
  tag: "csr:dialogOpened";
219
263
  payload: {
264
+ eventId?: string;
220
265
  content: string[];
221
266
  };
222
267
  };
223
268
  type IdleGapCustomData = {
224
269
  tag: "csr:idleGap";
225
270
  payload: {
271
+ eventId?: string;
226
272
  visibleGapS: number;
227
273
  totalGapS: number;
228
274
  hiddenS: number;
@@ -232,6 +278,7 @@ type IdleGapCustomData = {
232
278
  type AwayGapCustomData = {
233
279
  tag: "csr:awayGap";
234
280
  payload: {
281
+ eventId?: string;
235
282
  totalGapS: number;
236
283
  hiddenS: number;
237
284
  };
@@ -239,6 +286,11 @@ type AwayGapCustomData = {
239
286
  /**
240
287
  * Closed union of every Custom event we emit. Add a new variant here when
241
288
  * introducing a new tag — emitting an unregistered tag is a TS error.
289
+ *
290
+ * Every payload carries an optional `eventId`: a per-event identity stamped
291
+ * at emission by the analyzer (uuid). It is inert metadata — players ignore
292
+ * it — and exists so downstream review tooling can reference and remove
293
+ * individual generated events without patching untyped data.
242
294
  */
243
295
  type CustomEventData = ClickCustomData | InputCustomData | RageClickCustomData | FormFieldReEditCustomData | ScrollBackCustomData | DeadClickCustomData | TabUnfocusCustomData | TabRefocusCustomData | RouteChangeCustomData | ErrorMessageCustomData | DialogOpenedCustomData | IdleGapCustomData | AwayGapCustomData;
244
296
  /**
@@ -253,7 +305,11 @@ type RecordingEvent = {
253
305
  timestamp: number;
254
306
  data: CustomEventData;
255
307
  } | {
256
- type: Exclude<RecordingEventType, RecordingEventType.Custom>;
308
+ type: RecordingEventType.IncrementalSnapshot;
309
+ timestamp: number;
310
+ data: IncrementalSnapshotData;
311
+ } | {
312
+ type: Exclude<RecordingEventType, RecordingEventType.Custom | RecordingEventType.IncrementalSnapshot>;
257
313
  timestamp: number;
258
314
  data: unknown;
259
315
  };
@@ -274,4 +330,4 @@ declare function validateKey(key: string): string | null;
274
330
  declare function validateTagValue(value: string | undefined): string | null;
275
331
  declare function validateMeasureValue(value: number | undefined): string | null;
276
332
  //#endregion
277
- export { type AwayGapCustomData, type ClickCustomData, type ClientContext, type ConsoleLogLevel, type ConsoleLogPluginData, type CustomEventData, type DeadClickCustomData, type DialogOpenedCustomData, type ElementDescriptor, type ErrorMessageCustomData, type FlagEvaluationPluginData, type FormFieldReEditCustomData, type Frame, type IdleGapCustomData, IncrementalSource, type InputCustomData, MAX_DISTINCT_KEYS, MAX_KEY_LENGTH, MAX_TAG_VALUE_LENGTH, MAX_VALUES_PER_KEY, type MeasurePluginData, MouseInteractions, type NetworkRequestInitiator, type NetworkRequestPluginData, type RageClickCustomData, type RecordingEvent, RecordingEventType, type RouteChangeCustomData, type RouteChangePayload, type RouteChangePluginData, type RouteChangeTrigger, type ScrollBackCustomData, SerializedNodeType, type TabRefocusCustomData, type TabUnfocusCustomData, type TabVisibilityPluginData, type TagPluginData, type UserAgentContext, stripUrl, validateKey, validateMeasureValue, validateTagValue };
333
+ export { type AwayGapCustomData, type ClickCustomData, type ClientContext, type ConsoleLogLevel, type ConsoleLogPluginData, type CustomEventData, type DeadClickCustomData, type DialogOpenedCustomData, type ElementDescriptor, type ErrorMessageCustomData, type FlagEvaluationPluginData, type FormFieldReEditCustomData, type Frame, type IdleGapCustomData, type IncrementalSnapshotData, IncrementalSource, type InputCustomData, MAX_DISTINCT_KEYS, MAX_KEY_LENGTH, MAX_TAG_VALUE_LENGTH, MAX_VALUES_PER_KEY, type MeasurePluginData, type MouseInteractionData, MouseInteractions, type NetworkRequestInitiator, type NetworkRequestPluginData, type OpaqueIncrementalData, type RageClickCustomData, type RecordingEvent, RecordingEventType, type RouteChangeCustomData, type RouteChangePayload, type RouteChangePluginData, type RouteChangeTrigger, type ScrollBackCustomData, type SelectionData, type SelectionRange, SerializedNodeType, type TabRefocusCustomData, type TabUnfocusCustomData, type TabVisibilityPluginData, type TagPluginData, type UserAgentContext, stripUrl, validateKey, validateMeasureValue, validateTagValue };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@spotify-confidence/csr-common",
3
3
  "license": "Apache-2.0",
4
- "version": "0.18.3",
4
+ "version": "0.18.5",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/spotify/confidence-sdk-js.git",
package/src/events.ts CHANGED
@@ -62,9 +62,48 @@ export enum MouseInteractions {
62
62
  TouchCancel = 10,
63
63
  }
64
64
 
65
+ /**
66
+ * Incremental mouse-interaction data emitted by rrweb.
67
+ */
68
+ export type MouseInteractionData = {
69
+ source: IncrementalSource.MouseInteraction;
70
+ type: MouseInteractions;
71
+ id: number;
72
+ x?: number;
73
+ y?: number;
74
+ pointerType?: number;
75
+ };
76
+
77
+ export type SelectionRange = {
78
+ start: number;
79
+ startOffset: number;
80
+ end: number;
81
+ endOffset: number;
82
+ };
83
+
84
+ /**
85
+ * Incremental text-selection data emitted by rrweb.
86
+ */
87
+ export type SelectionData = {
88
+ source: IncrementalSource.Selection;
89
+ ranges: SelectionRange[];
90
+ };
91
+
92
+ /**
93
+ * Incremental sources that csr-common does not model yet. The source remains
94
+ * discriminated so consumers can narrow the known mouse and selection shapes.
95
+ */
96
+ export type OpaqueIncrementalData = {
97
+ source: Exclude<IncrementalSource, IncrementalSource.MouseInteraction | IncrementalSource.Selection>;
98
+ [key: string]: unknown;
99
+ };
100
+
101
+ export type IncrementalSnapshotData = MouseInteractionData | SelectionData | OpaqueIncrementalData;
102
+
65
103
  export type RageClickCustomData = {
66
104
  tag: 'csr:rageClick';
67
105
  payload: {
106
+ eventId?: string;
68
107
  targetId: number;
69
108
  clickCount: number;
70
109
  durationMs: number;
@@ -76,6 +115,7 @@ export type RageClickCustomData = {
76
115
  export type FormFieldReEditCustomData = {
77
116
  tag: 'csr:formFieldReEdit';
78
117
  payload: {
118
+ eventId?: string;
79
119
  targetId: number;
80
120
  editCount: number;
81
121
  element?: ElementDescriptor;
@@ -86,6 +126,7 @@ export type FormFieldReEditCustomData = {
86
126
  export type ScrollBackCustomData = {
87
127
  tag: 'csr:scrollBack';
88
128
  payload: {
129
+ eventId?: string;
89
130
  scrollBackPx: number;
90
131
  fromY: number;
91
132
  toY: number;
@@ -103,6 +144,7 @@ export type ElementDescriptor = {
103
144
  export type ClickCustomData = {
104
145
  tag: 'csr:click';
105
146
  payload: {
147
+ eventId?: string;
106
148
  targetId: number;
107
149
  element?: ElementDescriptor;
108
150
  pathname?: string;
@@ -112,6 +154,7 @@ export type ClickCustomData = {
112
154
  export type InputCustomData = {
113
155
  tag: 'csr:input';
114
156
  payload: {
157
+ eventId?: string;
115
158
  targetId: number;
116
159
  element?: ElementDescriptor;
117
160
  pathname?: string;
@@ -123,6 +166,7 @@ export type InputCustomData = {
123
166
  export type DeadClickCustomData = {
124
167
  tag: 'csr:deadClick';
125
168
  payload: {
169
+ eventId?: string;
126
170
  targetId: number;
127
171
  element?: ElementDescriptor;
128
172
  pathname?: string;
@@ -132,6 +176,7 @@ export type DeadClickCustomData = {
132
176
  export type TabUnfocusCustomData = {
133
177
  tag: 'csr:tabUnfocus';
134
178
  payload: {
179
+ eventId?: string;
135
180
  pathname?: string;
136
181
  };
137
182
  };
@@ -139,6 +184,7 @@ export type TabUnfocusCustomData = {
139
184
  export type TabRefocusCustomData = {
140
185
  tag: 'csr:tabRefocus';
141
186
  payload: {
187
+ eventId?: string;
142
188
  awayDurationMs: number;
143
189
  pathname?: string;
144
190
  };
@@ -154,7 +200,9 @@ export type RouteChangePayload = {
154
200
 
155
201
  export type RouteChangeCustomData = {
156
202
  tag: 'csr:routeChange';
157
- payload: RouteChangePayload;
203
+ // Intersected rather than added to RouteChangePayload so the plugin-event
204
+ // shape (RouteChangePluginData) stays free of analyzer identity.
205
+ payload: RouteChangePayload & { eventId?: string };
158
206
  };
159
207
 
160
208
  /**
@@ -231,6 +279,7 @@ export type FlagEvaluationPluginData = {
231
279
  export type ErrorMessageCustomData = {
232
280
  tag: 'csr:errorMessage';
233
281
  payload: {
282
+ eventId?: string;
234
283
  text: string;
235
284
  };
236
285
  };
@@ -238,6 +287,7 @@ export type ErrorMessageCustomData = {
238
287
  export type DialogOpenedCustomData = {
239
288
  tag: 'csr:dialogOpened';
240
289
  payload: {
290
+ eventId?: string;
241
291
  content: string[];
242
292
  };
243
293
  };
@@ -245,6 +295,7 @@ export type DialogOpenedCustomData = {
245
295
  export type IdleGapCustomData = {
246
296
  tag: 'csr:idleGap';
247
297
  payload: {
298
+ eventId?: string;
248
299
  visibleGapS: number;
249
300
  totalGapS: number;
250
301
  hiddenS: number;
@@ -255,6 +306,7 @@ export type IdleGapCustomData = {
255
306
  export type AwayGapCustomData = {
256
307
  tag: 'csr:awayGap';
257
308
  payload: {
309
+ eventId?: string;
258
310
  totalGapS: number;
259
311
  hiddenS: number;
260
312
  };
@@ -263,6 +315,11 @@ export type AwayGapCustomData = {
263
315
  /**
264
316
  * Closed union of every Custom event we emit. Add a new variant here when
265
317
  * introducing a new tag — emitting an unregistered tag is a TS error.
318
+ *
319
+ * Every payload carries an optional `eventId`: a per-event identity stamped
320
+ * at emission by the analyzer (uuid). It is inert metadata — players ignore
321
+ * it — and exists so downstream review tooling can reference and remove
322
+ * individual generated events without patching untyped data.
266
323
  */
267
324
  export type CustomEventData =
268
325
  | ClickCustomData
@@ -293,7 +350,12 @@ export type RecordingEvent =
293
350
  data: CustomEventData;
294
351
  }
295
352
  | {
296
- type: Exclude<RecordingEventType, RecordingEventType.Custom>;
353
+ type: RecordingEventType.IncrementalSnapshot;
354
+ timestamp: number;
355
+ data: IncrementalSnapshotData;
356
+ }
357
+ | {
358
+ type: Exclude<RecordingEventType, RecordingEventType.Custom | RecordingEventType.IncrementalSnapshot>;
297
359
  timestamp: number;
298
360
  data: unknown;
299
361
  };
package/src/index.ts CHANGED
@@ -4,6 +4,11 @@ export {
4
4
  IncrementalSource,
5
5
  MouseInteractions,
6
6
  type RecordingEvent,
7
+ type IncrementalSnapshotData,
8
+ type MouseInteractionData,
9
+ type OpaqueIncrementalData,
10
+ type SelectionData,
11
+ type SelectionRange,
7
12
  type CustomEventData,
8
13
  type ClickCustomData,
9
14
  type InputCustomData,