@spotify-confidence/csr-common 0.18.7 → 0.18.9

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.9](https://github.com/spotify/confidence-sdk-js/compare/csr-common-v0.18.8...csr-common-v0.18.9) (2026-09-07)
4
+
5
+
6
+ ### 🐛 Bug Fixes
7
+
8
+ * stop passive recording frames extending sessions ([#449](https://github.com/spotify/confidence-sdk-js/issues/449)) ([df763a1](https://github.com/spotify/confidence-sdk-js/commit/df763a10d6f16ce5b871530ca3fe8b5c153c16d7))
9
+
10
+ ## [0.18.8](https://github.com/spotify/confidence-sdk-js/compare/csr-common-v0.18.7...csr-common-v0.18.8) (2026-08-28)
11
+
12
+
13
+ ### ✨ New Features
14
+
15
+ * expose clipboard input provenance types ([#446](https://github.com/spotify/confidence-sdk-js/issues/446)) ([c955079](https://github.com/spotify/confidence-sdk-js/commit/c9550793998c8f2e043d926b9e5ec1690304da91))
16
+
3
17
  ## [0.18.7](https://github.com/spotify/confidence-sdk-js/compare/csr-common-v0.18.6...csr-common-v0.18.7) (2026-08-18)
4
18
 
5
19
 
package/dist/index.cjs CHANGED
@@ -1,70 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- //#region src/events.ts
3
- /**
4
- * Mirrors rrweb's serialized-node types but decoupled — we own the enum.
5
- */
6
- let SerializedNodeType = /* @__PURE__ */ function(SerializedNodeType) {
7
- SerializedNodeType[SerializedNodeType["Document"] = 0] = "Document";
8
- SerializedNodeType[SerializedNodeType["DocumentType"] = 1] = "DocumentType";
9
- SerializedNodeType[SerializedNodeType["Element"] = 2] = "Element";
10
- SerializedNodeType[SerializedNodeType["Text"] = 3] = "Text";
11
- SerializedNodeType[SerializedNodeType["CDATA"] = 4] = "CDATA";
12
- SerializedNodeType[SerializedNodeType["Comment"] = 5] = "Comment";
13
- return SerializedNodeType;
14
- }({});
15
- /**
16
- * Mirrors rrweb event types but decoupled — we own the enum.
17
- */
18
- let RecordingEventType = /* @__PURE__ */ function(RecordingEventType) {
19
- RecordingEventType[RecordingEventType["DomContentLoaded"] = 0] = "DomContentLoaded";
20
- RecordingEventType[RecordingEventType["Load"] = 1] = "Load";
21
- RecordingEventType[RecordingEventType["FullSnapshot"] = 2] = "FullSnapshot";
22
- RecordingEventType[RecordingEventType["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
23
- RecordingEventType[RecordingEventType["Meta"] = 4] = "Meta";
24
- RecordingEventType[RecordingEventType["Custom"] = 5] = "Custom";
25
- RecordingEventType[RecordingEventType["Plugin"] = 6] = "Plugin";
26
- return RecordingEventType;
27
- }({});
28
- /**
29
- * Incremental snapshot sub-types.
30
- */
31
- let IncrementalSource = /* @__PURE__ */ function(IncrementalSource) {
32
- IncrementalSource[IncrementalSource["Mutation"] = 0] = "Mutation";
33
- IncrementalSource[IncrementalSource["MouseMove"] = 1] = "MouseMove";
34
- IncrementalSource[IncrementalSource["MouseInteraction"] = 2] = "MouseInteraction";
35
- IncrementalSource[IncrementalSource["Scroll"] = 3] = "Scroll";
36
- IncrementalSource[IncrementalSource["ViewportResize"] = 4] = "ViewportResize";
37
- IncrementalSource[IncrementalSource["Input"] = 5] = "Input";
38
- IncrementalSource[IncrementalSource["TouchMove"] = 6] = "TouchMove";
39
- IncrementalSource[IncrementalSource["MediaInteraction"] = 7] = "MediaInteraction";
40
- IncrementalSource[IncrementalSource["StyleSheetRule"] = 8] = "StyleSheetRule";
41
- IncrementalSource[IncrementalSource["CanvasMutation"] = 9] = "CanvasMutation";
42
- IncrementalSource[IncrementalSource["Font"] = 10] = "Font";
43
- IncrementalSource[IncrementalSource["Log"] = 11] = "Log";
44
- IncrementalSource[IncrementalSource["Drag"] = 12] = "Drag";
45
- IncrementalSource[IncrementalSource["StyleDeclaration"] = 13] = "StyleDeclaration";
46
- IncrementalSource[IncrementalSource["Selection"] = 14] = "Selection";
47
- IncrementalSource[IncrementalSource["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet";
48
- return IncrementalSource;
49
- }({});
50
- /**
51
- * From rrweb MouseInteractions.
52
- */
53
- let MouseInteractions = /* @__PURE__ */ function(MouseInteractions) {
54
- MouseInteractions[MouseInteractions["MouseUp"] = 0] = "MouseUp";
55
- MouseInteractions[MouseInteractions["MouseDown"] = 1] = "MouseDown";
56
- MouseInteractions[MouseInteractions["Click"] = 2] = "Click";
57
- MouseInteractions[MouseInteractions["ContextMenu"] = 3] = "ContextMenu";
58
- MouseInteractions[MouseInteractions["DblClick"] = 4] = "DblClick";
59
- MouseInteractions[MouseInteractions["Focus"] = 5] = "Focus";
60
- MouseInteractions[MouseInteractions["Blur"] = 6] = "Blur";
61
- MouseInteractions[MouseInteractions["TouchStart"] = 7] = "TouchStart";
62
- MouseInteractions[MouseInteractions["TouchMove_Departed"] = 8] = "TouchMove_Departed";
63
- MouseInteractions[MouseInteractions["TouchEnd"] = 9] = "TouchEnd";
64
- MouseInteractions[MouseInteractions["TouchCancel"] = 10] = "TouchCancel";
65
- return MouseInteractions;
66
- }({});
67
- //#endregion
2
+ const require_session_activity = require("./session-activity-HfuXKqGd.cjs");
68
3
  //#region src/url.ts
69
4
  /**
70
5
  * Extract only the pathname from a URL, stripping origin, query string, and
@@ -102,14 +37,20 @@ function validateMeasureValue(value) {
102
37
  return null;
103
38
  }
104
39
  //#endregion
105
- exports.IncrementalSource = IncrementalSource;
40
+ exports.IncrementalSource = require_session_activity.IncrementalSource;
106
41
  exports.MAX_DISTINCT_KEYS = MAX_DISTINCT_KEYS;
107
42
  exports.MAX_KEY_LENGTH = MAX_KEY_LENGTH;
108
43
  exports.MAX_TAG_VALUE_LENGTH = MAX_TAG_VALUE_LENGTH;
109
44
  exports.MAX_VALUES_PER_KEY = MAX_VALUES_PER_KEY;
110
- exports.MouseInteractions = MouseInteractions;
111
- exports.RecordingEventType = RecordingEventType;
112
- exports.SerializedNodeType = SerializedNodeType;
45
+ exports.MouseInteractions = require_session_activity.MouseInteractions;
46
+ exports.RecordingCustomEventTag = require_session_activity.RecordingCustomEventTag;
47
+ exports.RecordingEventType = require_session_activity.RecordingEventType;
48
+ exports.RecordingMetricKey = require_session_activity.RecordingMetricKey;
49
+ exports.RecordingPluginName = require_session_activity.RecordingPluginName;
50
+ exports.SerializedNodeType = require_session_activity.SerializedNodeType;
51
+ exports.isSessionActivityEvent = require_session_activity.isSessionActivityEvent;
52
+ exports.isUserInteractionEvent = require_session_activity.isUserInteractionEvent;
53
+ exports.isUserInteractionMetric = require_session_activity.isUserInteractionMetric;
113
54
  exports.stripUrl = stripUrl;
114
55
  exports.validateKey = validateKey;
115
56
  exports.validateMeasureValue = validateMeasureValue;
package/dist/index.d.cts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as ClientContext, n as Frame, o as UserAgentContext } from "./types-CtBIVgp2.cjs";
1
+ import { i as ClientContext, n as Frame, o as UserAgentContext } from "./types-Bg0UKTVQ.cjs";
2
2
 
3
3
  //#region src/events.d.ts
4
4
  /**
@@ -24,6 +24,33 @@ declare enum RecordingEventType {
24
24
  Custom = 5,
25
25
  Plugin = 6
26
26
  }
27
+ declare const RecordingCustomEventTag: {
28
+ readonly RageClick: "csr:rageClick";
29
+ readonly FormFieldReEdit: "csr:formFieldReEdit";
30
+ readonly ScrollBack: "csr:scrollBack";
31
+ readonly Click: "csr:click";
32
+ readonly Input: "csr:input";
33
+ readonly DeadClick: "csr:deadClick";
34
+ readonly TabUnfocus: "csr:tabUnfocus";
35
+ readonly TabRefocus: "csr:tabRefocus";
36
+ readonly RouteChange: "csr:routeChange";
37
+ readonly ErrorMessage: "csr:errorMessage";
38
+ readonly DialogOpened: "csr:dialogOpened";
39
+ readonly IdleGap: "csr:idleGap";
40
+ readonly AwayGap: "csr:awayGap";
41
+ };
42
+ declare const RecordingPluginName: {
43
+ readonly BlockedElementLabels: "csr/blocked-element-labels@1";
44
+ readonly Clipboard: "csr/clipboard@1";
45
+ readonly ClickModifiers: "csr/click-modifiers@1";
46
+ readonly TabVisibility: "csr:tabVisibility";
47
+ readonly ConsoleLog: "rrweb/console@1";
48
+ readonly NetworkRequest: "csr:networkRequest";
49
+ readonly RouteChange: "csr:routeChange";
50
+ readonly Tag: "csr:tag";
51
+ readonly Measure: "csr:measure";
52
+ readonly FlagEvaluation: "csr:flagEvaluation";
53
+ };
27
54
  /**
28
55
  * Incremental snapshot sub-types.
29
56
  */
@@ -100,7 +127,7 @@ type OpaqueIncrementalData = {
100
127
  };
101
128
  type IncrementalSnapshotData = MouseInteractionData | SelectionData | OpaqueIncrementalData;
102
129
  type RageClickCustomData = {
103
- tag: "csr:rageClick";
130
+ tag: typeof RecordingCustomEventTag.RageClick;
104
131
  payload: {
105
132
  eventId?: string;
106
133
  targetId: number;
@@ -111,7 +138,7 @@ type RageClickCustomData = {
111
138
  };
112
139
  };
113
140
  type FormFieldReEditCustomData = {
114
- tag: "csr:formFieldReEdit";
141
+ tag: typeof RecordingCustomEventTag.FormFieldReEdit;
115
142
  payload: {
116
143
  eventId?: string;
117
144
  targetId: number;
@@ -121,7 +148,7 @@ type FormFieldReEditCustomData = {
121
148
  };
122
149
  };
123
150
  type ScrollBackCustomData = {
124
- tag: "csr:scrollBack";
151
+ tag: typeof RecordingCustomEventTag.ScrollBack;
125
152
  payload: {
126
153
  eventId?: string;
127
154
  scrollBackPx: number;
@@ -137,7 +164,7 @@ type ElementDescriptor = {
137
164
  attributes?: Record<string, string>;
138
165
  };
139
166
  type ClickCustomData = {
140
- tag: "csr:click";
167
+ tag: typeof RecordingCustomEventTag.Click;
141
168
  payload: {
142
169
  eventId?: string;
143
170
  targetId: number;
@@ -151,7 +178,7 @@ type ClickCustomData = {
151
178
  };
152
179
  };
153
180
  type InputCustomData = {
154
- tag: "csr:input";
181
+ tag: typeof RecordingCustomEventTag.Input;
155
182
  payload: {
156
183
  eventId?: string;
157
184
  targetId: number;
@@ -159,10 +186,19 @@ type InputCustomData = {
159
186
  pathname?: string;
160
187
  fieldType?: string;
161
188
  hasValue?: boolean;
189
+ source?: "paste";
190
+ };
191
+ };
192
+ type ClipboardAction = "copy" | "cut" | "paste";
193
+ type ClipboardPluginData = {
194
+ plugin: typeof RecordingPluginName.Clipboard;
195
+ payload: {
196
+ action: ClipboardAction;
197
+ targetId: number;
162
198
  };
163
199
  };
164
200
  type DeadClickCustomData = {
165
- tag: "csr:deadClick";
201
+ tag: typeof RecordingCustomEventTag.DeadClick;
166
202
  payload: {
167
203
  eventId?: string;
168
204
  targetId: number;
@@ -171,14 +207,14 @@ type DeadClickCustomData = {
171
207
  };
172
208
  };
173
209
  type TabUnfocusCustomData = {
174
- tag: "csr:tabUnfocus";
210
+ tag: typeof RecordingCustomEventTag.TabUnfocus;
175
211
  payload: {
176
212
  eventId?: string;
177
213
  pathname?: string;
178
214
  };
179
215
  };
180
216
  type TabRefocusCustomData = {
181
- tag: "csr:tabRefocus";
217
+ tag: typeof RecordingCustomEventTag.TabRefocus;
182
218
  payload: {
183
219
  eventId?: string;
184
220
  awayDurationMs: number;
@@ -192,7 +228,7 @@ type RouteChangePayload = {
192
228
  trigger: RouteChangeTrigger;
193
229
  };
194
230
  type RouteChangeCustomData = {
195
- tag: "csr:routeChange";
231
+ tag: typeof RecordingCustomEventTag.RouteChange;
196
232
  payload: RouteChangePayload & {
197
233
  eventId?: string;
198
234
  };
@@ -201,7 +237,7 @@ type RouteChangeCustomData = {
201
237
  * Plugin event data emitted by the recorder for tab visibility changes.
202
238
  */
203
239
  type TabVisibilityPluginData = {
204
- plugin: "csr:tabVisibility";
240
+ plugin: typeof RecordingPluginName.TabVisibility;
205
241
  payload: {
206
242
  hidden: boolean;
207
243
  };
@@ -212,7 +248,7 @@ type ConsoleLogLevel = "log" | "warn" | "error" | "debug" | "info";
212
248
  * Shape matches `@rrweb/rrweb-plugin-console-record` LogData.
213
249
  */
214
250
  type ConsoleLogPluginData = {
215
- plugin: "rrweb/console@1";
251
+ plugin: typeof RecordingPluginName.ConsoleLog;
216
252
  payload: {
217
253
  level: ConsoleLogLevel;
218
254
  payload: string[];
@@ -227,7 +263,7 @@ type GraphQLRequestMetadata = {
227
263
  * Plugin event data emitted by the recorder for network requests.
228
264
  */
229
265
  type NetworkRequestPluginData = {
230
- plugin: "csr:networkRequest";
266
+ plugin: typeof RecordingPluginName.NetworkRequest;
231
267
  payload: {
232
268
  initiator: NetworkRequestInitiator;
233
269
  method: string;
@@ -240,47 +276,48 @@ type NetworkRequestPluginData = {
240
276
  };
241
277
  };
242
278
  type RouteChangePluginData = {
243
- plugin: "csr:routeChange";
279
+ plugin: typeof RecordingPluginName.RouteChange;
244
280
  payload: RouteChangePayload;
245
281
  };
246
282
  type TagPluginData = {
247
- plugin: "csr:tag";
283
+ plugin: typeof RecordingPluginName.Tag;
248
284
  payload: {
249
285
  key: string;
250
286
  value?: string;
251
287
  };
252
288
  };
253
289
  type MeasurePluginData = {
254
- plugin: "csr:measure";
290
+ plugin: typeof RecordingPluginName.Measure;
255
291
  payload: {
256
292
  key: string;
257
293
  value?: number;
258
294
  };
259
295
  };
260
296
  type FlagEvaluationPluginData = {
261
- plugin: "csr:flagEvaluation";
297
+ plugin: typeof RecordingPluginName.FlagEvaluation;
262
298
  payload: {
263
299
  flagKey: string;
264
300
  variant: string;
265
301
  assignmentOrigin: string;
266
302
  };
267
303
  };
304
+ type PluginEventData = ClipboardPluginData | TabVisibilityPluginData | ConsoleLogPluginData | NetworkRequestPluginData | RouteChangePluginData | TagPluginData | MeasurePluginData | FlagEvaluationPluginData;
268
305
  type ErrorMessageCustomData = {
269
- tag: "csr:errorMessage";
306
+ tag: typeof RecordingCustomEventTag.ErrorMessage;
270
307
  payload: {
271
308
  eventId?: string;
272
309
  text: string;
273
310
  };
274
311
  };
275
312
  type DialogOpenedCustomData = {
276
- tag: "csr:dialogOpened";
313
+ tag: typeof RecordingCustomEventTag.DialogOpened;
277
314
  payload: {
278
315
  eventId?: string;
279
316
  content: string[];
280
317
  };
281
318
  };
282
319
  type IdleGapCustomData = {
283
- tag: "csr:idleGap";
320
+ tag: typeof RecordingCustomEventTag.IdleGap;
284
321
  payload: {
285
322
  eventId?: string;
286
323
  visibleGapS: number;
@@ -290,7 +327,7 @@ type IdleGapCustomData = {
290
327
  };
291
328
  };
292
329
  type AwayGapCustomData = {
293
- tag: "csr:awayGap";
330
+ tag: typeof RecordingCustomEventTag.AwayGap;
294
331
  payload: {
295
332
  eventId?: string;
296
333
  totalGapS: number;
@@ -323,7 +360,11 @@ type RecordingEvent = {
323
360
  timestamp: number;
324
361
  data: IncrementalSnapshotData;
325
362
  } | {
326
- type: Exclude<RecordingEventType, RecordingEventType.Custom | RecordingEventType.IncrementalSnapshot>;
363
+ type: RecordingEventType.Plugin;
364
+ timestamp: number;
365
+ data: PluginEventData;
366
+ } | {
367
+ type: Exclude<RecordingEventType, RecordingEventType.Custom | RecordingEventType.IncrementalSnapshot | RecordingEventType.Plugin>;
327
368
  timestamp: number;
328
369
  data: unknown;
329
370
  };
@@ -335,6 +376,28 @@ type RecordingEvent = {
335
376
  */
336
377
  declare function stripUrl(url: string): string;
337
378
  //#endregion
379
+ //#region src/metrics.d.ts
380
+ declare const RecordingMetricKey: {
381
+ readonly Click: "clicks";
382
+ readonly Input: "inputs";
383
+ readonly RageClick: "rageClicks";
384
+ readonly DeadClick: "deadClicks";
385
+ readonly ScrollBack: "scrollBacks";
386
+ readonly TabUnfocus: "tabUnfocuses";
387
+ readonly ErrorMessage: "errorMessages";
388
+ readonly FailedNetworkRequest: "networkRequestsFailed";
389
+ readonly NetworkRequest: "networkRequests";
390
+ readonly ConsoleLog: "consoleLogs";
391
+ readonly ConsoleWarning: "consoleWarnings";
392
+ readonly ConsoleError: "consoleErrors";
393
+ readonly RouteChange: "routeChanges";
394
+ };
395
+ //#endregion
396
+ //#region src/session-activity.d.ts
397
+ declare const isUserInteractionEvent: (event: unknown) => boolean;
398
+ declare const isUserInteractionMetric: (metricKey: string) => boolean;
399
+ declare const isSessionActivityEvent: (event: unknown) => boolean;
400
+ //#endregion
338
401
  //#region src/custom-event-limits.d.ts
339
402
  declare const MAX_KEY_LENGTH = 128;
340
403
  declare const MAX_TAG_VALUE_LENGTH = 256;
@@ -344,4 +407,4 @@ declare function validateKey(key: string): string | null;
344
407
  declare function validateTagValue(value: string | undefined): string | null;
345
408
  declare function validateMeasureValue(value: number | undefined): string | null;
346
409
  //#endregion
347
- 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 GraphQLRequestMetadata, 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 };
410
+ export { type AwayGapCustomData, type ClickCustomData, type ClientContext, type ClipboardAction, type ClipboardPluginData, type ConsoleLogLevel, type ConsoleLogPluginData, type CustomEventData, type DeadClickCustomData, type DialogOpenedCustomData, type ElementDescriptor, type ErrorMessageCustomData, type FlagEvaluationPluginData, type FormFieldReEditCustomData, type Frame, type GraphQLRequestMetadata, 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 PluginEventData, type RageClickCustomData, RecordingCustomEventTag, type RecordingEvent, RecordingEventType, RecordingMetricKey, RecordingPluginName, 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, isSessionActivityEvent, isUserInteractionEvent, isUserInteractionMetric, stripUrl, validateKey, validateMeasureValue, validateTagValue };
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { i as ClientContext, n as Frame, o as UserAgentContext } from "./types-CtBIVgp2.js";
1
+ import { i as ClientContext, n as Frame, o as UserAgentContext } from "./types-Bg0UKTVQ.js";
2
2
 
3
3
  //#region src/events.d.ts
4
4
  /**
@@ -24,6 +24,33 @@ declare enum RecordingEventType {
24
24
  Custom = 5,
25
25
  Plugin = 6
26
26
  }
27
+ declare const RecordingCustomEventTag: {
28
+ readonly RageClick: "csr:rageClick";
29
+ readonly FormFieldReEdit: "csr:formFieldReEdit";
30
+ readonly ScrollBack: "csr:scrollBack";
31
+ readonly Click: "csr:click";
32
+ readonly Input: "csr:input";
33
+ readonly DeadClick: "csr:deadClick";
34
+ readonly TabUnfocus: "csr:tabUnfocus";
35
+ readonly TabRefocus: "csr:tabRefocus";
36
+ readonly RouteChange: "csr:routeChange";
37
+ readonly ErrorMessage: "csr:errorMessage";
38
+ readonly DialogOpened: "csr:dialogOpened";
39
+ readonly IdleGap: "csr:idleGap";
40
+ readonly AwayGap: "csr:awayGap";
41
+ };
42
+ declare const RecordingPluginName: {
43
+ readonly BlockedElementLabels: "csr/blocked-element-labels@1";
44
+ readonly Clipboard: "csr/clipboard@1";
45
+ readonly ClickModifiers: "csr/click-modifiers@1";
46
+ readonly TabVisibility: "csr:tabVisibility";
47
+ readonly ConsoleLog: "rrweb/console@1";
48
+ readonly NetworkRequest: "csr:networkRequest";
49
+ readonly RouteChange: "csr:routeChange";
50
+ readonly Tag: "csr:tag";
51
+ readonly Measure: "csr:measure";
52
+ readonly FlagEvaluation: "csr:flagEvaluation";
53
+ };
27
54
  /**
28
55
  * Incremental snapshot sub-types.
29
56
  */
@@ -100,7 +127,7 @@ type OpaqueIncrementalData = {
100
127
  };
101
128
  type IncrementalSnapshotData = MouseInteractionData | SelectionData | OpaqueIncrementalData;
102
129
  type RageClickCustomData = {
103
- tag: "csr:rageClick";
130
+ tag: typeof RecordingCustomEventTag.RageClick;
104
131
  payload: {
105
132
  eventId?: string;
106
133
  targetId: number;
@@ -111,7 +138,7 @@ type RageClickCustomData = {
111
138
  };
112
139
  };
113
140
  type FormFieldReEditCustomData = {
114
- tag: "csr:formFieldReEdit";
141
+ tag: typeof RecordingCustomEventTag.FormFieldReEdit;
115
142
  payload: {
116
143
  eventId?: string;
117
144
  targetId: number;
@@ -121,7 +148,7 @@ type FormFieldReEditCustomData = {
121
148
  };
122
149
  };
123
150
  type ScrollBackCustomData = {
124
- tag: "csr:scrollBack";
151
+ tag: typeof RecordingCustomEventTag.ScrollBack;
125
152
  payload: {
126
153
  eventId?: string;
127
154
  scrollBackPx: number;
@@ -137,7 +164,7 @@ type ElementDescriptor = {
137
164
  attributes?: Record<string, string>;
138
165
  };
139
166
  type ClickCustomData = {
140
- tag: "csr:click";
167
+ tag: typeof RecordingCustomEventTag.Click;
141
168
  payload: {
142
169
  eventId?: string;
143
170
  targetId: number;
@@ -151,7 +178,7 @@ type ClickCustomData = {
151
178
  };
152
179
  };
153
180
  type InputCustomData = {
154
- tag: "csr:input";
181
+ tag: typeof RecordingCustomEventTag.Input;
155
182
  payload: {
156
183
  eventId?: string;
157
184
  targetId: number;
@@ -159,10 +186,19 @@ type InputCustomData = {
159
186
  pathname?: string;
160
187
  fieldType?: string;
161
188
  hasValue?: boolean;
189
+ source?: "paste";
190
+ };
191
+ };
192
+ type ClipboardAction = "copy" | "cut" | "paste";
193
+ type ClipboardPluginData = {
194
+ plugin: typeof RecordingPluginName.Clipboard;
195
+ payload: {
196
+ action: ClipboardAction;
197
+ targetId: number;
162
198
  };
163
199
  };
164
200
  type DeadClickCustomData = {
165
- tag: "csr:deadClick";
201
+ tag: typeof RecordingCustomEventTag.DeadClick;
166
202
  payload: {
167
203
  eventId?: string;
168
204
  targetId: number;
@@ -171,14 +207,14 @@ type DeadClickCustomData = {
171
207
  };
172
208
  };
173
209
  type TabUnfocusCustomData = {
174
- tag: "csr:tabUnfocus";
210
+ tag: typeof RecordingCustomEventTag.TabUnfocus;
175
211
  payload: {
176
212
  eventId?: string;
177
213
  pathname?: string;
178
214
  };
179
215
  };
180
216
  type TabRefocusCustomData = {
181
- tag: "csr:tabRefocus";
217
+ tag: typeof RecordingCustomEventTag.TabRefocus;
182
218
  payload: {
183
219
  eventId?: string;
184
220
  awayDurationMs: number;
@@ -192,7 +228,7 @@ type RouteChangePayload = {
192
228
  trigger: RouteChangeTrigger;
193
229
  };
194
230
  type RouteChangeCustomData = {
195
- tag: "csr:routeChange";
231
+ tag: typeof RecordingCustomEventTag.RouteChange;
196
232
  payload: RouteChangePayload & {
197
233
  eventId?: string;
198
234
  };
@@ -201,7 +237,7 @@ type RouteChangeCustomData = {
201
237
  * Plugin event data emitted by the recorder for tab visibility changes.
202
238
  */
203
239
  type TabVisibilityPluginData = {
204
- plugin: "csr:tabVisibility";
240
+ plugin: typeof RecordingPluginName.TabVisibility;
205
241
  payload: {
206
242
  hidden: boolean;
207
243
  };
@@ -212,7 +248,7 @@ type ConsoleLogLevel = "log" | "warn" | "error" | "debug" | "info";
212
248
  * Shape matches `@rrweb/rrweb-plugin-console-record` LogData.
213
249
  */
214
250
  type ConsoleLogPluginData = {
215
- plugin: "rrweb/console@1";
251
+ plugin: typeof RecordingPluginName.ConsoleLog;
216
252
  payload: {
217
253
  level: ConsoleLogLevel;
218
254
  payload: string[];
@@ -227,7 +263,7 @@ type GraphQLRequestMetadata = {
227
263
  * Plugin event data emitted by the recorder for network requests.
228
264
  */
229
265
  type NetworkRequestPluginData = {
230
- plugin: "csr:networkRequest";
266
+ plugin: typeof RecordingPluginName.NetworkRequest;
231
267
  payload: {
232
268
  initiator: NetworkRequestInitiator;
233
269
  method: string;
@@ -240,47 +276,48 @@ type NetworkRequestPluginData = {
240
276
  };
241
277
  };
242
278
  type RouteChangePluginData = {
243
- plugin: "csr:routeChange";
279
+ plugin: typeof RecordingPluginName.RouteChange;
244
280
  payload: RouteChangePayload;
245
281
  };
246
282
  type TagPluginData = {
247
- plugin: "csr:tag";
283
+ plugin: typeof RecordingPluginName.Tag;
248
284
  payload: {
249
285
  key: string;
250
286
  value?: string;
251
287
  };
252
288
  };
253
289
  type MeasurePluginData = {
254
- plugin: "csr:measure";
290
+ plugin: typeof RecordingPluginName.Measure;
255
291
  payload: {
256
292
  key: string;
257
293
  value?: number;
258
294
  };
259
295
  };
260
296
  type FlagEvaluationPluginData = {
261
- plugin: "csr:flagEvaluation";
297
+ plugin: typeof RecordingPluginName.FlagEvaluation;
262
298
  payload: {
263
299
  flagKey: string;
264
300
  variant: string;
265
301
  assignmentOrigin: string;
266
302
  };
267
303
  };
304
+ type PluginEventData = ClipboardPluginData | TabVisibilityPluginData | ConsoleLogPluginData | NetworkRequestPluginData | RouteChangePluginData | TagPluginData | MeasurePluginData | FlagEvaluationPluginData;
268
305
  type ErrorMessageCustomData = {
269
- tag: "csr:errorMessage";
306
+ tag: typeof RecordingCustomEventTag.ErrorMessage;
270
307
  payload: {
271
308
  eventId?: string;
272
309
  text: string;
273
310
  };
274
311
  };
275
312
  type DialogOpenedCustomData = {
276
- tag: "csr:dialogOpened";
313
+ tag: typeof RecordingCustomEventTag.DialogOpened;
277
314
  payload: {
278
315
  eventId?: string;
279
316
  content: string[];
280
317
  };
281
318
  };
282
319
  type IdleGapCustomData = {
283
- tag: "csr:idleGap";
320
+ tag: typeof RecordingCustomEventTag.IdleGap;
284
321
  payload: {
285
322
  eventId?: string;
286
323
  visibleGapS: number;
@@ -290,7 +327,7 @@ type IdleGapCustomData = {
290
327
  };
291
328
  };
292
329
  type AwayGapCustomData = {
293
- tag: "csr:awayGap";
330
+ tag: typeof RecordingCustomEventTag.AwayGap;
294
331
  payload: {
295
332
  eventId?: string;
296
333
  totalGapS: number;
@@ -323,7 +360,11 @@ type RecordingEvent = {
323
360
  timestamp: number;
324
361
  data: IncrementalSnapshotData;
325
362
  } | {
326
- type: Exclude<RecordingEventType, RecordingEventType.Custom | RecordingEventType.IncrementalSnapshot>;
363
+ type: RecordingEventType.Plugin;
364
+ timestamp: number;
365
+ data: PluginEventData;
366
+ } | {
367
+ type: Exclude<RecordingEventType, RecordingEventType.Custom | RecordingEventType.IncrementalSnapshot | RecordingEventType.Plugin>;
327
368
  timestamp: number;
328
369
  data: unknown;
329
370
  };
@@ -335,6 +376,28 @@ type RecordingEvent = {
335
376
  */
336
377
  declare function stripUrl(url: string): string;
337
378
  //#endregion
379
+ //#region src/metrics.d.ts
380
+ declare const RecordingMetricKey: {
381
+ readonly Click: "clicks";
382
+ readonly Input: "inputs";
383
+ readonly RageClick: "rageClicks";
384
+ readonly DeadClick: "deadClicks";
385
+ readonly ScrollBack: "scrollBacks";
386
+ readonly TabUnfocus: "tabUnfocuses";
387
+ readonly ErrorMessage: "errorMessages";
388
+ readonly FailedNetworkRequest: "networkRequestsFailed";
389
+ readonly NetworkRequest: "networkRequests";
390
+ readonly ConsoleLog: "consoleLogs";
391
+ readonly ConsoleWarning: "consoleWarnings";
392
+ readonly ConsoleError: "consoleErrors";
393
+ readonly RouteChange: "routeChanges";
394
+ };
395
+ //#endregion
396
+ //#region src/session-activity.d.ts
397
+ declare const isUserInteractionEvent: (event: unknown) => boolean;
398
+ declare const isUserInteractionMetric: (metricKey: string) => boolean;
399
+ declare const isSessionActivityEvent: (event: unknown) => boolean;
400
+ //#endregion
338
401
  //#region src/custom-event-limits.d.ts
339
402
  declare const MAX_KEY_LENGTH = 128;
340
403
  declare const MAX_TAG_VALUE_LENGTH = 256;
@@ -344,4 +407,4 @@ declare function validateKey(key: string): string | null;
344
407
  declare function validateTagValue(value: string | undefined): string | null;
345
408
  declare function validateMeasureValue(value: number | undefined): string | null;
346
409
  //#endregion
347
- 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 GraphQLRequestMetadata, 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 };
410
+ export { type AwayGapCustomData, type ClickCustomData, type ClientContext, type ClipboardAction, type ClipboardPluginData, type ConsoleLogLevel, type ConsoleLogPluginData, type CustomEventData, type DeadClickCustomData, type DialogOpenedCustomData, type ElementDescriptor, type ErrorMessageCustomData, type FlagEvaluationPluginData, type FormFieldReEditCustomData, type Frame, type GraphQLRequestMetadata, 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 PluginEventData, type RageClickCustomData, RecordingCustomEventTag, type RecordingEvent, RecordingEventType, RecordingMetricKey, RecordingPluginName, 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, isSessionActivityEvent, isUserInteractionEvent, isUserInteractionMetric, stripUrl, validateKey, validateMeasureValue, validateTagValue };