@spotify-confidence/csr-common 0.18.8 → 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,12 @@
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
+
3
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)
4
11
 
5
12
 
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;
@@ -164,14 +191,14 @@ type InputCustomData = {
164
191
  };
165
192
  type ClipboardAction = "copy" | "cut" | "paste";
166
193
  type ClipboardPluginData = {
167
- plugin: "csr/clipboard@1";
194
+ plugin: typeof RecordingPluginName.Clipboard;
168
195
  payload: {
169
196
  action: ClipboardAction;
170
197
  targetId: number;
171
198
  };
172
199
  };
173
200
  type DeadClickCustomData = {
174
- tag: "csr:deadClick";
201
+ tag: typeof RecordingCustomEventTag.DeadClick;
175
202
  payload: {
176
203
  eventId?: string;
177
204
  targetId: number;
@@ -180,14 +207,14 @@ type DeadClickCustomData = {
180
207
  };
181
208
  };
182
209
  type TabUnfocusCustomData = {
183
- tag: "csr:tabUnfocus";
210
+ tag: typeof RecordingCustomEventTag.TabUnfocus;
184
211
  payload: {
185
212
  eventId?: string;
186
213
  pathname?: string;
187
214
  };
188
215
  };
189
216
  type TabRefocusCustomData = {
190
- tag: "csr:tabRefocus";
217
+ tag: typeof RecordingCustomEventTag.TabRefocus;
191
218
  payload: {
192
219
  eventId?: string;
193
220
  awayDurationMs: number;
@@ -201,7 +228,7 @@ type RouteChangePayload = {
201
228
  trigger: RouteChangeTrigger;
202
229
  };
203
230
  type RouteChangeCustomData = {
204
- tag: "csr:routeChange";
231
+ tag: typeof RecordingCustomEventTag.RouteChange;
205
232
  payload: RouteChangePayload & {
206
233
  eventId?: string;
207
234
  };
@@ -210,7 +237,7 @@ type RouteChangeCustomData = {
210
237
  * Plugin event data emitted by the recorder for tab visibility changes.
211
238
  */
212
239
  type TabVisibilityPluginData = {
213
- plugin: "csr:tabVisibility";
240
+ plugin: typeof RecordingPluginName.TabVisibility;
214
241
  payload: {
215
242
  hidden: boolean;
216
243
  };
@@ -221,7 +248,7 @@ type ConsoleLogLevel = "log" | "warn" | "error" | "debug" | "info";
221
248
  * Shape matches `@rrweb/rrweb-plugin-console-record` LogData.
222
249
  */
223
250
  type ConsoleLogPluginData = {
224
- plugin: "rrweb/console@1";
251
+ plugin: typeof RecordingPluginName.ConsoleLog;
225
252
  payload: {
226
253
  level: ConsoleLogLevel;
227
254
  payload: string[];
@@ -236,7 +263,7 @@ type GraphQLRequestMetadata = {
236
263
  * Plugin event data emitted by the recorder for network requests.
237
264
  */
238
265
  type NetworkRequestPluginData = {
239
- plugin: "csr:networkRequest";
266
+ plugin: typeof RecordingPluginName.NetworkRequest;
240
267
  payload: {
241
268
  initiator: NetworkRequestInitiator;
242
269
  method: string;
@@ -249,47 +276,48 @@ type NetworkRequestPluginData = {
249
276
  };
250
277
  };
251
278
  type RouteChangePluginData = {
252
- plugin: "csr:routeChange";
279
+ plugin: typeof RecordingPluginName.RouteChange;
253
280
  payload: RouteChangePayload;
254
281
  };
255
282
  type TagPluginData = {
256
- plugin: "csr:tag";
283
+ plugin: typeof RecordingPluginName.Tag;
257
284
  payload: {
258
285
  key: string;
259
286
  value?: string;
260
287
  };
261
288
  };
262
289
  type MeasurePluginData = {
263
- plugin: "csr:measure";
290
+ plugin: typeof RecordingPluginName.Measure;
264
291
  payload: {
265
292
  key: string;
266
293
  value?: number;
267
294
  };
268
295
  };
269
296
  type FlagEvaluationPluginData = {
270
- plugin: "csr:flagEvaluation";
297
+ plugin: typeof RecordingPluginName.FlagEvaluation;
271
298
  payload: {
272
299
  flagKey: string;
273
300
  variant: string;
274
301
  assignmentOrigin: string;
275
302
  };
276
303
  };
304
+ type PluginEventData = ClipboardPluginData | TabVisibilityPluginData | ConsoleLogPluginData | NetworkRequestPluginData | RouteChangePluginData | TagPluginData | MeasurePluginData | FlagEvaluationPluginData;
277
305
  type ErrorMessageCustomData = {
278
- tag: "csr:errorMessage";
306
+ tag: typeof RecordingCustomEventTag.ErrorMessage;
279
307
  payload: {
280
308
  eventId?: string;
281
309
  text: string;
282
310
  };
283
311
  };
284
312
  type DialogOpenedCustomData = {
285
- tag: "csr:dialogOpened";
313
+ tag: typeof RecordingCustomEventTag.DialogOpened;
286
314
  payload: {
287
315
  eventId?: string;
288
316
  content: string[];
289
317
  };
290
318
  };
291
319
  type IdleGapCustomData = {
292
- tag: "csr:idleGap";
320
+ tag: typeof RecordingCustomEventTag.IdleGap;
293
321
  payload: {
294
322
  eventId?: string;
295
323
  visibleGapS: number;
@@ -299,7 +327,7 @@ type IdleGapCustomData = {
299
327
  };
300
328
  };
301
329
  type AwayGapCustomData = {
302
- tag: "csr:awayGap";
330
+ tag: typeof RecordingCustomEventTag.AwayGap;
303
331
  payload: {
304
332
  eventId?: string;
305
333
  totalGapS: number;
@@ -332,7 +360,11 @@ type RecordingEvent = {
332
360
  timestamp: number;
333
361
  data: IncrementalSnapshotData;
334
362
  } | {
335
- 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>;
336
368
  timestamp: number;
337
369
  data: unknown;
338
370
  };
@@ -344,6 +376,28 @@ type RecordingEvent = {
344
376
  */
345
377
  declare function stripUrl(url: string): string;
346
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
347
401
  //#region src/custom-event-limits.d.ts
348
402
  declare const MAX_KEY_LENGTH = 128;
349
403
  declare const MAX_TAG_VALUE_LENGTH = 256;
@@ -353,4 +407,4 @@ declare function validateKey(key: string): string | null;
353
407
  declare function validateTagValue(value: string | undefined): string | null;
354
408
  declare function validateMeasureValue(value: number | undefined): string | null;
355
409
  //#endregion
356
- 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 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;
@@ -164,14 +191,14 @@ type InputCustomData = {
164
191
  };
165
192
  type ClipboardAction = "copy" | "cut" | "paste";
166
193
  type ClipboardPluginData = {
167
- plugin: "csr/clipboard@1";
194
+ plugin: typeof RecordingPluginName.Clipboard;
168
195
  payload: {
169
196
  action: ClipboardAction;
170
197
  targetId: number;
171
198
  };
172
199
  };
173
200
  type DeadClickCustomData = {
174
- tag: "csr:deadClick";
201
+ tag: typeof RecordingCustomEventTag.DeadClick;
175
202
  payload: {
176
203
  eventId?: string;
177
204
  targetId: number;
@@ -180,14 +207,14 @@ type DeadClickCustomData = {
180
207
  };
181
208
  };
182
209
  type TabUnfocusCustomData = {
183
- tag: "csr:tabUnfocus";
210
+ tag: typeof RecordingCustomEventTag.TabUnfocus;
184
211
  payload: {
185
212
  eventId?: string;
186
213
  pathname?: string;
187
214
  };
188
215
  };
189
216
  type TabRefocusCustomData = {
190
- tag: "csr:tabRefocus";
217
+ tag: typeof RecordingCustomEventTag.TabRefocus;
191
218
  payload: {
192
219
  eventId?: string;
193
220
  awayDurationMs: number;
@@ -201,7 +228,7 @@ type RouteChangePayload = {
201
228
  trigger: RouteChangeTrigger;
202
229
  };
203
230
  type RouteChangeCustomData = {
204
- tag: "csr:routeChange";
231
+ tag: typeof RecordingCustomEventTag.RouteChange;
205
232
  payload: RouteChangePayload & {
206
233
  eventId?: string;
207
234
  };
@@ -210,7 +237,7 @@ type RouteChangeCustomData = {
210
237
  * Plugin event data emitted by the recorder for tab visibility changes.
211
238
  */
212
239
  type TabVisibilityPluginData = {
213
- plugin: "csr:tabVisibility";
240
+ plugin: typeof RecordingPluginName.TabVisibility;
214
241
  payload: {
215
242
  hidden: boolean;
216
243
  };
@@ -221,7 +248,7 @@ type ConsoleLogLevel = "log" | "warn" | "error" | "debug" | "info";
221
248
  * Shape matches `@rrweb/rrweb-plugin-console-record` LogData.
222
249
  */
223
250
  type ConsoleLogPluginData = {
224
- plugin: "rrweb/console@1";
251
+ plugin: typeof RecordingPluginName.ConsoleLog;
225
252
  payload: {
226
253
  level: ConsoleLogLevel;
227
254
  payload: string[];
@@ -236,7 +263,7 @@ type GraphQLRequestMetadata = {
236
263
  * Plugin event data emitted by the recorder for network requests.
237
264
  */
238
265
  type NetworkRequestPluginData = {
239
- plugin: "csr:networkRequest";
266
+ plugin: typeof RecordingPluginName.NetworkRequest;
240
267
  payload: {
241
268
  initiator: NetworkRequestInitiator;
242
269
  method: string;
@@ -249,47 +276,48 @@ type NetworkRequestPluginData = {
249
276
  };
250
277
  };
251
278
  type RouteChangePluginData = {
252
- plugin: "csr:routeChange";
279
+ plugin: typeof RecordingPluginName.RouteChange;
253
280
  payload: RouteChangePayload;
254
281
  };
255
282
  type TagPluginData = {
256
- plugin: "csr:tag";
283
+ plugin: typeof RecordingPluginName.Tag;
257
284
  payload: {
258
285
  key: string;
259
286
  value?: string;
260
287
  };
261
288
  };
262
289
  type MeasurePluginData = {
263
- plugin: "csr:measure";
290
+ plugin: typeof RecordingPluginName.Measure;
264
291
  payload: {
265
292
  key: string;
266
293
  value?: number;
267
294
  };
268
295
  };
269
296
  type FlagEvaluationPluginData = {
270
- plugin: "csr:flagEvaluation";
297
+ plugin: typeof RecordingPluginName.FlagEvaluation;
271
298
  payload: {
272
299
  flagKey: string;
273
300
  variant: string;
274
301
  assignmentOrigin: string;
275
302
  };
276
303
  };
304
+ type PluginEventData = ClipboardPluginData | TabVisibilityPluginData | ConsoleLogPluginData | NetworkRequestPluginData | RouteChangePluginData | TagPluginData | MeasurePluginData | FlagEvaluationPluginData;
277
305
  type ErrorMessageCustomData = {
278
- tag: "csr:errorMessage";
306
+ tag: typeof RecordingCustomEventTag.ErrorMessage;
279
307
  payload: {
280
308
  eventId?: string;
281
309
  text: string;
282
310
  };
283
311
  };
284
312
  type DialogOpenedCustomData = {
285
- tag: "csr:dialogOpened";
313
+ tag: typeof RecordingCustomEventTag.DialogOpened;
286
314
  payload: {
287
315
  eventId?: string;
288
316
  content: string[];
289
317
  };
290
318
  };
291
319
  type IdleGapCustomData = {
292
- tag: "csr:idleGap";
320
+ tag: typeof RecordingCustomEventTag.IdleGap;
293
321
  payload: {
294
322
  eventId?: string;
295
323
  visibleGapS: number;
@@ -299,7 +327,7 @@ type IdleGapCustomData = {
299
327
  };
300
328
  };
301
329
  type AwayGapCustomData = {
302
- tag: "csr:awayGap";
330
+ tag: typeof RecordingCustomEventTag.AwayGap;
303
331
  payload: {
304
332
  eventId?: string;
305
333
  totalGapS: number;
@@ -332,7 +360,11 @@ type RecordingEvent = {
332
360
  timestamp: number;
333
361
  data: IncrementalSnapshotData;
334
362
  } | {
335
- 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>;
336
368
  timestamp: number;
337
369
  data: unknown;
338
370
  };
@@ -344,6 +376,28 @@ type RecordingEvent = {
344
376
  */
345
377
  declare function stripUrl(url: string): string;
346
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
347
401
  //#region src/custom-event-limits.d.ts
348
402
  declare const MAX_KEY_LENGTH = 128;
349
403
  declare const MAX_TAG_VALUE_LENGTH = 256;
@@ -353,4 +407,4 @@ declare function validateKey(key: string): string | null;
353
407
  declare function validateTagValue(value: string | undefined): string | null;
354
408
  declare function validateMeasureValue(value: number | undefined): string | null;
355
409
  //#endregion
356
- 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 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 };