@spotify-confidence/csr-common 0.18.3 → 0.18.4

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,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.18.4](https://github.com/spotify/confidence-sdk-js/compare/csr-common-v0.18.3...csr-common-v0.18.4) (2026-08-05)
4
+
5
+
6
+ ### ✨ New Features
7
+
8
+ * **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))
9
+
3
10
  ## [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
11
 
5
12
 
package/dist/index.d.cts CHANGED
@@ -64,6 +64,7 @@ declare enum MouseInteractions {
64
64
  type RageClickCustomData = {
65
65
  tag: "csr:rageClick";
66
66
  payload: {
67
+ eventId?: string;
67
68
  targetId: number;
68
69
  clickCount: number;
69
70
  durationMs: number;
@@ -74,6 +75,7 @@ type RageClickCustomData = {
74
75
  type FormFieldReEditCustomData = {
75
76
  tag: "csr:formFieldReEdit";
76
77
  payload: {
78
+ eventId?: string;
77
79
  targetId: number;
78
80
  editCount: number;
79
81
  element?: ElementDescriptor;
@@ -83,6 +85,7 @@ type FormFieldReEditCustomData = {
83
85
  type ScrollBackCustomData = {
84
86
  tag: "csr:scrollBack";
85
87
  payload: {
88
+ eventId?: string;
86
89
  scrollBackPx: number;
87
90
  fromY: number;
88
91
  toY: number;
@@ -98,6 +101,7 @@ type ElementDescriptor = {
98
101
  type ClickCustomData = {
99
102
  tag: "csr:click";
100
103
  payload: {
104
+ eventId?: string;
101
105
  targetId: number;
102
106
  element?: ElementDescriptor;
103
107
  pathname?: string;
@@ -106,6 +110,7 @@ type ClickCustomData = {
106
110
  type InputCustomData = {
107
111
  tag: "csr:input";
108
112
  payload: {
113
+ eventId?: string;
109
114
  targetId: number;
110
115
  element?: ElementDescriptor;
111
116
  pathname?: string;
@@ -116,6 +121,7 @@ type InputCustomData = {
116
121
  type DeadClickCustomData = {
117
122
  tag: "csr:deadClick";
118
123
  payload: {
124
+ eventId?: string;
119
125
  targetId: number;
120
126
  element?: ElementDescriptor;
121
127
  pathname?: string;
@@ -124,12 +130,14 @@ type DeadClickCustomData = {
124
130
  type TabUnfocusCustomData = {
125
131
  tag: "csr:tabUnfocus";
126
132
  payload: {
133
+ eventId?: string;
127
134
  pathname?: string;
128
135
  };
129
136
  };
130
137
  type TabRefocusCustomData = {
131
138
  tag: "csr:tabRefocus";
132
139
  payload: {
140
+ eventId?: string;
133
141
  awayDurationMs: number;
134
142
  pathname?: string;
135
143
  };
@@ -142,7 +150,9 @@ type RouteChangePayload = {
142
150
  };
143
151
  type RouteChangeCustomData = {
144
152
  tag: "csr:routeChange";
145
- payload: RouteChangePayload;
153
+ payload: RouteChangePayload & {
154
+ eventId?: string;
155
+ };
146
156
  };
147
157
  /**
148
158
  * Plugin event data emitted by the recorder for tab visibility changes.
@@ -211,18 +221,21 @@ type FlagEvaluationPluginData = {
211
221
  type ErrorMessageCustomData = {
212
222
  tag: "csr:errorMessage";
213
223
  payload: {
224
+ eventId?: string;
214
225
  text: string;
215
226
  };
216
227
  };
217
228
  type DialogOpenedCustomData = {
218
229
  tag: "csr:dialogOpened";
219
230
  payload: {
231
+ eventId?: string;
220
232
  content: string[];
221
233
  };
222
234
  };
223
235
  type IdleGapCustomData = {
224
236
  tag: "csr:idleGap";
225
237
  payload: {
238
+ eventId?: string;
226
239
  visibleGapS: number;
227
240
  totalGapS: number;
228
241
  hiddenS: number;
@@ -232,6 +245,7 @@ type IdleGapCustomData = {
232
245
  type AwayGapCustomData = {
233
246
  tag: "csr:awayGap";
234
247
  payload: {
248
+ eventId?: string;
235
249
  totalGapS: number;
236
250
  hiddenS: number;
237
251
  };
@@ -239,6 +253,11 @@ type AwayGapCustomData = {
239
253
  /**
240
254
  * Closed union of every Custom event we emit. Add a new variant here when
241
255
  * introducing a new tag — emitting an unregistered tag is a TS error.
256
+ *
257
+ * Every payload carries an optional `eventId`: a per-event identity stamped
258
+ * at emission by the analyzer (uuid). It is inert metadata — players ignore
259
+ * it — and exists so downstream review tooling can reference and remove
260
+ * individual generated events without patching untyped data.
242
261
  */
243
262
  type CustomEventData = ClickCustomData | InputCustomData | RageClickCustomData | FormFieldReEditCustomData | ScrollBackCustomData | DeadClickCustomData | TabUnfocusCustomData | TabRefocusCustomData | RouteChangeCustomData | ErrorMessageCustomData | DialogOpenedCustomData | IdleGapCustomData | AwayGapCustomData;
244
263
  /**
package/dist/index.d.ts CHANGED
@@ -64,6 +64,7 @@ declare enum MouseInteractions {
64
64
  type RageClickCustomData = {
65
65
  tag: "csr:rageClick";
66
66
  payload: {
67
+ eventId?: string;
67
68
  targetId: number;
68
69
  clickCount: number;
69
70
  durationMs: number;
@@ -74,6 +75,7 @@ type RageClickCustomData = {
74
75
  type FormFieldReEditCustomData = {
75
76
  tag: "csr:formFieldReEdit";
76
77
  payload: {
78
+ eventId?: string;
77
79
  targetId: number;
78
80
  editCount: number;
79
81
  element?: ElementDescriptor;
@@ -83,6 +85,7 @@ type FormFieldReEditCustomData = {
83
85
  type ScrollBackCustomData = {
84
86
  tag: "csr:scrollBack";
85
87
  payload: {
88
+ eventId?: string;
86
89
  scrollBackPx: number;
87
90
  fromY: number;
88
91
  toY: number;
@@ -98,6 +101,7 @@ type ElementDescriptor = {
98
101
  type ClickCustomData = {
99
102
  tag: "csr:click";
100
103
  payload: {
104
+ eventId?: string;
101
105
  targetId: number;
102
106
  element?: ElementDescriptor;
103
107
  pathname?: string;
@@ -106,6 +110,7 @@ type ClickCustomData = {
106
110
  type InputCustomData = {
107
111
  tag: "csr:input";
108
112
  payload: {
113
+ eventId?: string;
109
114
  targetId: number;
110
115
  element?: ElementDescriptor;
111
116
  pathname?: string;
@@ -116,6 +121,7 @@ type InputCustomData = {
116
121
  type DeadClickCustomData = {
117
122
  tag: "csr:deadClick";
118
123
  payload: {
124
+ eventId?: string;
119
125
  targetId: number;
120
126
  element?: ElementDescriptor;
121
127
  pathname?: string;
@@ -124,12 +130,14 @@ type DeadClickCustomData = {
124
130
  type TabUnfocusCustomData = {
125
131
  tag: "csr:tabUnfocus";
126
132
  payload: {
133
+ eventId?: string;
127
134
  pathname?: string;
128
135
  };
129
136
  };
130
137
  type TabRefocusCustomData = {
131
138
  tag: "csr:tabRefocus";
132
139
  payload: {
140
+ eventId?: string;
133
141
  awayDurationMs: number;
134
142
  pathname?: string;
135
143
  };
@@ -142,7 +150,9 @@ type RouteChangePayload = {
142
150
  };
143
151
  type RouteChangeCustomData = {
144
152
  tag: "csr:routeChange";
145
- payload: RouteChangePayload;
153
+ payload: RouteChangePayload & {
154
+ eventId?: string;
155
+ };
146
156
  };
147
157
  /**
148
158
  * Plugin event data emitted by the recorder for tab visibility changes.
@@ -211,18 +221,21 @@ type FlagEvaluationPluginData = {
211
221
  type ErrorMessageCustomData = {
212
222
  tag: "csr:errorMessage";
213
223
  payload: {
224
+ eventId?: string;
214
225
  text: string;
215
226
  };
216
227
  };
217
228
  type DialogOpenedCustomData = {
218
229
  tag: "csr:dialogOpened";
219
230
  payload: {
231
+ eventId?: string;
220
232
  content: string[];
221
233
  };
222
234
  };
223
235
  type IdleGapCustomData = {
224
236
  tag: "csr:idleGap";
225
237
  payload: {
238
+ eventId?: string;
226
239
  visibleGapS: number;
227
240
  totalGapS: number;
228
241
  hiddenS: number;
@@ -232,6 +245,7 @@ type IdleGapCustomData = {
232
245
  type AwayGapCustomData = {
233
246
  tag: "csr:awayGap";
234
247
  payload: {
248
+ eventId?: string;
235
249
  totalGapS: number;
236
250
  hiddenS: number;
237
251
  };
@@ -239,6 +253,11 @@ type AwayGapCustomData = {
239
253
  /**
240
254
  * Closed union of every Custom event we emit. Add a new variant here when
241
255
  * introducing a new tag — emitting an unregistered tag is a TS error.
256
+ *
257
+ * Every payload carries an optional `eventId`: a per-event identity stamped
258
+ * at emission by the analyzer (uuid). It is inert metadata — players ignore
259
+ * it — and exists so downstream review tooling can reference and remove
260
+ * individual generated events without patching untyped data.
242
261
  */
243
262
  type CustomEventData = ClickCustomData | InputCustomData | RageClickCustomData | FormFieldReEditCustomData | ScrollBackCustomData | DeadClickCustomData | TabUnfocusCustomData | TabRefocusCustomData | RouteChangeCustomData | ErrorMessageCustomData | DialogOpenedCustomData | IdleGapCustomData | AwayGapCustomData;
244
263
  /**
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.4",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/spotify/confidence-sdk-js.git",
package/src/events.ts CHANGED
@@ -65,6 +65,7 @@ export enum MouseInteractions {
65
65
  export type RageClickCustomData = {
66
66
  tag: 'csr:rageClick';
67
67
  payload: {
68
+ eventId?: string;
68
69
  targetId: number;
69
70
  clickCount: number;
70
71
  durationMs: number;
@@ -76,6 +77,7 @@ export type RageClickCustomData = {
76
77
  export type FormFieldReEditCustomData = {
77
78
  tag: 'csr:formFieldReEdit';
78
79
  payload: {
80
+ eventId?: string;
79
81
  targetId: number;
80
82
  editCount: number;
81
83
  element?: ElementDescriptor;
@@ -86,6 +88,7 @@ export type FormFieldReEditCustomData = {
86
88
  export type ScrollBackCustomData = {
87
89
  tag: 'csr:scrollBack';
88
90
  payload: {
91
+ eventId?: string;
89
92
  scrollBackPx: number;
90
93
  fromY: number;
91
94
  toY: number;
@@ -103,6 +106,7 @@ export type ElementDescriptor = {
103
106
  export type ClickCustomData = {
104
107
  tag: 'csr:click';
105
108
  payload: {
109
+ eventId?: string;
106
110
  targetId: number;
107
111
  element?: ElementDescriptor;
108
112
  pathname?: string;
@@ -112,6 +116,7 @@ export type ClickCustomData = {
112
116
  export type InputCustomData = {
113
117
  tag: 'csr:input';
114
118
  payload: {
119
+ eventId?: string;
115
120
  targetId: number;
116
121
  element?: ElementDescriptor;
117
122
  pathname?: string;
@@ -123,6 +128,7 @@ export type InputCustomData = {
123
128
  export type DeadClickCustomData = {
124
129
  tag: 'csr:deadClick';
125
130
  payload: {
131
+ eventId?: string;
126
132
  targetId: number;
127
133
  element?: ElementDescriptor;
128
134
  pathname?: string;
@@ -132,6 +138,7 @@ export type DeadClickCustomData = {
132
138
  export type TabUnfocusCustomData = {
133
139
  tag: 'csr:tabUnfocus';
134
140
  payload: {
141
+ eventId?: string;
135
142
  pathname?: string;
136
143
  };
137
144
  };
@@ -139,6 +146,7 @@ export type TabUnfocusCustomData = {
139
146
  export type TabRefocusCustomData = {
140
147
  tag: 'csr:tabRefocus';
141
148
  payload: {
149
+ eventId?: string;
142
150
  awayDurationMs: number;
143
151
  pathname?: string;
144
152
  };
@@ -154,7 +162,9 @@ export type RouteChangePayload = {
154
162
 
155
163
  export type RouteChangeCustomData = {
156
164
  tag: 'csr:routeChange';
157
- payload: RouteChangePayload;
165
+ // Intersected rather than added to RouteChangePayload so the plugin-event
166
+ // shape (RouteChangePluginData) stays free of analyzer identity.
167
+ payload: RouteChangePayload & { eventId?: string };
158
168
  };
159
169
 
160
170
  /**
@@ -231,6 +241,7 @@ export type FlagEvaluationPluginData = {
231
241
  export type ErrorMessageCustomData = {
232
242
  tag: 'csr:errorMessage';
233
243
  payload: {
244
+ eventId?: string;
234
245
  text: string;
235
246
  };
236
247
  };
@@ -238,6 +249,7 @@ export type ErrorMessageCustomData = {
238
249
  export type DialogOpenedCustomData = {
239
250
  tag: 'csr:dialogOpened';
240
251
  payload: {
252
+ eventId?: string;
241
253
  content: string[];
242
254
  };
243
255
  };
@@ -245,6 +257,7 @@ export type DialogOpenedCustomData = {
245
257
  export type IdleGapCustomData = {
246
258
  tag: 'csr:idleGap';
247
259
  payload: {
260
+ eventId?: string;
248
261
  visibleGapS: number;
249
262
  totalGapS: number;
250
263
  hiddenS: number;
@@ -255,6 +268,7 @@ export type IdleGapCustomData = {
255
268
  export type AwayGapCustomData = {
256
269
  tag: 'csr:awayGap';
257
270
  payload: {
271
+ eventId?: string;
258
272
  totalGapS: number;
259
273
  hiddenS: number;
260
274
  };
@@ -263,6 +277,11 @@ export type AwayGapCustomData = {
263
277
  /**
264
278
  * Closed union of every Custom event we emit. Add a new variant here when
265
279
  * introducing a new tag — emitting an unregistered tag is a TS error.
280
+ *
281
+ * Every payload carries an optional `eventId`: a per-event identity stamped
282
+ * at emission by the analyzer (uuid). It is inert metadata — players ignore
283
+ * it — and exists so downstream review tooling can reference and remove
284
+ * individual generated events without patching untyped data.
266
285
  */
267
286
  export type CustomEventData =
268
287
  | ClickCustomData