@spotify-confidence/csr-common 0.18.4 → 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,12 @@
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
+
3
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)
4
11
 
5
12
 
package/dist/index.d.cts CHANGED
@@ -61,6 +61,39 @@ 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: {
@@ -272,7 +305,11 @@ type RecordingEvent = {
272
305
  timestamp: number;
273
306
  data: CustomEventData;
274
307
  } | {
275
- type: Exclude<RecordingEventType, RecordingEventType.Custom>;
308
+ type: RecordingEventType.IncrementalSnapshot;
309
+ timestamp: number;
310
+ data: IncrementalSnapshotData;
311
+ } | {
312
+ type: Exclude<RecordingEventType, RecordingEventType.Custom | RecordingEventType.IncrementalSnapshot>;
276
313
  timestamp: number;
277
314
  data: unknown;
278
315
  };
@@ -293,4 +330,4 @@ declare function validateKey(key: string): string | null;
293
330
  declare function validateTagValue(value: string | undefined): string | null;
294
331
  declare function validateMeasureValue(value: number | undefined): string | null;
295
332
  //#endregion
296
- 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,6 +61,39 @@ 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: {
@@ -272,7 +305,11 @@ type RecordingEvent = {
272
305
  timestamp: number;
273
306
  data: CustomEventData;
274
307
  } | {
275
- type: Exclude<RecordingEventType, RecordingEventType.Custom>;
308
+ type: RecordingEventType.IncrementalSnapshot;
309
+ timestamp: number;
310
+ data: IncrementalSnapshotData;
311
+ } | {
312
+ type: Exclude<RecordingEventType, RecordingEventType.Custom | RecordingEventType.IncrementalSnapshot>;
276
313
  timestamp: number;
277
314
  data: unknown;
278
315
  };
@@ -293,4 +330,4 @@ declare function validateKey(key: string): string | null;
293
330
  declare function validateTagValue(value: string | undefined): string | null;
294
331
  declare function validateMeasureValue(value: number | undefined): string | null;
295
332
  //#endregion
296
- 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.4",
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,6 +62,44 @@ 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: {
@@ -312,7 +350,12 @@ export type RecordingEvent =
312
350
  data: CustomEventData;
313
351
  }
314
352
  | {
315
- 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>;
316
359
  timestamp: number;
317
360
  data: unknown;
318
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,