@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/dist/index.js CHANGED
@@ -1,69 +1,4 @@
1
- //#region src/events.ts
2
- /**
3
- * Mirrors rrweb's serialized-node types but decoupled — we own the enum.
4
- */
5
- let SerializedNodeType = /* @__PURE__ */ function(SerializedNodeType) {
6
- SerializedNodeType[SerializedNodeType["Document"] = 0] = "Document";
7
- SerializedNodeType[SerializedNodeType["DocumentType"] = 1] = "DocumentType";
8
- SerializedNodeType[SerializedNodeType["Element"] = 2] = "Element";
9
- SerializedNodeType[SerializedNodeType["Text"] = 3] = "Text";
10
- SerializedNodeType[SerializedNodeType["CDATA"] = 4] = "CDATA";
11
- SerializedNodeType[SerializedNodeType["Comment"] = 5] = "Comment";
12
- return SerializedNodeType;
13
- }({});
14
- /**
15
- * Mirrors rrweb event types but decoupled — we own the enum.
16
- */
17
- let RecordingEventType = /* @__PURE__ */ function(RecordingEventType) {
18
- RecordingEventType[RecordingEventType["DomContentLoaded"] = 0] = "DomContentLoaded";
19
- RecordingEventType[RecordingEventType["Load"] = 1] = "Load";
20
- RecordingEventType[RecordingEventType["FullSnapshot"] = 2] = "FullSnapshot";
21
- RecordingEventType[RecordingEventType["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
22
- RecordingEventType[RecordingEventType["Meta"] = 4] = "Meta";
23
- RecordingEventType[RecordingEventType["Custom"] = 5] = "Custom";
24
- RecordingEventType[RecordingEventType["Plugin"] = 6] = "Plugin";
25
- return RecordingEventType;
26
- }({});
27
- /**
28
- * Incremental snapshot sub-types.
29
- */
30
- let IncrementalSource = /* @__PURE__ */ function(IncrementalSource) {
31
- IncrementalSource[IncrementalSource["Mutation"] = 0] = "Mutation";
32
- IncrementalSource[IncrementalSource["MouseMove"] = 1] = "MouseMove";
33
- IncrementalSource[IncrementalSource["MouseInteraction"] = 2] = "MouseInteraction";
34
- IncrementalSource[IncrementalSource["Scroll"] = 3] = "Scroll";
35
- IncrementalSource[IncrementalSource["ViewportResize"] = 4] = "ViewportResize";
36
- IncrementalSource[IncrementalSource["Input"] = 5] = "Input";
37
- IncrementalSource[IncrementalSource["TouchMove"] = 6] = "TouchMove";
38
- IncrementalSource[IncrementalSource["MediaInteraction"] = 7] = "MediaInteraction";
39
- IncrementalSource[IncrementalSource["StyleSheetRule"] = 8] = "StyleSheetRule";
40
- IncrementalSource[IncrementalSource["CanvasMutation"] = 9] = "CanvasMutation";
41
- IncrementalSource[IncrementalSource["Font"] = 10] = "Font";
42
- IncrementalSource[IncrementalSource["Log"] = 11] = "Log";
43
- IncrementalSource[IncrementalSource["Drag"] = 12] = "Drag";
44
- IncrementalSource[IncrementalSource["StyleDeclaration"] = 13] = "StyleDeclaration";
45
- IncrementalSource[IncrementalSource["Selection"] = 14] = "Selection";
46
- IncrementalSource[IncrementalSource["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet";
47
- return IncrementalSource;
48
- }({});
49
- /**
50
- * From rrweb MouseInteractions.
51
- */
52
- let MouseInteractions = /* @__PURE__ */ function(MouseInteractions) {
53
- MouseInteractions[MouseInteractions["MouseUp"] = 0] = "MouseUp";
54
- MouseInteractions[MouseInteractions["MouseDown"] = 1] = "MouseDown";
55
- MouseInteractions[MouseInteractions["Click"] = 2] = "Click";
56
- MouseInteractions[MouseInteractions["ContextMenu"] = 3] = "ContextMenu";
57
- MouseInteractions[MouseInteractions["DblClick"] = 4] = "DblClick";
58
- MouseInteractions[MouseInteractions["Focus"] = 5] = "Focus";
59
- MouseInteractions[MouseInteractions["Blur"] = 6] = "Blur";
60
- MouseInteractions[MouseInteractions["TouchStart"] = 7] = "TouchStart";
61
- MouseInteractions[MouseInteractions["TouchMove_Departed"] = 8] = "TouchMove_Departed";
62
- MouseInteractions[MouseInteractions["TouchEnd"] = 9] = "TouchEnd";
63
- MouseInteractions[MouseInteractions["TouchCancel"] = 10] = "TouchCancel";
64
- return MouseInteractions;
65
- }({});
66
- //#endregion
1
+ import { a as IncrementalSource, c as RecordingEventType, i as RecordingMetricKey, l as RecordingPluginName, n as isUserInteractionEvent, o as MouseInteractions, r as isUserInteractionMetric, s as RecordingCustomEventTag, t as isSessionActivityEvent, u as SerializedNodeType } from "./session-activity-CJ1wae06.js";
67
2
  //#region src/url.ts
68
3
  /**
69
4
  * Extract only the pathname from a URL, stripping origin, query string, and
@@ -101,4 +36,4 @@ function validateMeasureValue(value) {
101
36
  return null;
102
37
  }
103
38
  //#endregion
104
- export { IncrementalSource, MAX_DISTINCT_KEYS, MAX_KEY_LENGTH, MAX_TAG_VALUE_LENGTH, MAX_VALUES_PER_KEY, MouseInteractions, RecordingEventType, SerializedNodeType, stripUrl, validateKey, validateMeasureValue, validateTagValue };
39
+ export { IncrementalSource, MAX_DISTINCT_KEYS, MAX_KEY_LENGTH, MAX_TAG_VALUE_LENGTH, MAX_VALUES_PER_KEY, MouseInteractions, RecordingCustomEventTag, RecordingEventType, RecordingMetricKey, RecordingPluginName, SerializedNodeType, isSessionActivityEvent, isUserInteractionEvent, isUserInteractionMetric, stripUrl, validateKey, validateMeasureValue, validateTagValue };
@@ -0,0 +1,153 @@
1
+ //#region src/events.ts
2
+ /**
3
+ * Mirrors rrweb's serialized-node types but decoupled — we own the enum.
4
+ */
5
+ let SerializedNodeType = /* @__PURE__ */ function(SerializedNodeType) {
6
+ SerializedNodeType[SerializedNodeType["Document"] = 0] = "Document";
7
+ SerializedNodeType[SerializedNodeType["DocumentType"] = 1] = "DocumentType";
8
+ SerializedNodeType[SerializedNodeType["Element"] = 2] = "Element";
9
+ SerializedNodeType[SerializedNodeType["Text"] = 3] = "Text";
10
+ SerializedNodeType[SerializedNodeType["CDATA"] = 4] = "CDATA";
11
+ SerializedNodeType[SerializedNodeType["Comment"] = 5] = "Comment";
12
+ return SerializedNodeType;
13
+ }({});
14
+ /**
15
+ * Mirrors rrweb event types but decoupled — we own the enum.
16
+ */
17
+ let RecordingEventType = /* @__PURE__ */ function(RecordingEventType) {
18
+ RecordingEventType[RecordingEventType["DomContentLoaded"] = 0] = "DomContentLoaded";
19
+ RecordingEventType[RecordingEventType["Load"] = 1] = "Load";
20
+ RecordingEventType[RecordingEventType["FullSnapshot"] = 2] = "FullSnapshot";
21
+ RecordingEventType[RecordingEventType["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
22
+ RecordingEventType[RecordingEventType["Meta"] = 4] = "Meta";
23
+ RecordingEventType[RecordingEventType["Custom"] = 5] = "Custom";
24
+ RecordingEventType[RecordingEventType["Plugin"] = 6] = "Plugin";
25
+ return RecordingEventType;
26
+ }({});
27
+ const RecordingCustomEventTag = {
28
+ RageClick: "csr:rageClick",
29
+ FormFieldReEdit: "csr:formFieldReEdit",
30
+ ScrollBack: "csr:scrollBack",
31
+ Click: "csr:click",
32
+ Input: "csr:input",
33
+ DeadClick: "csr:deadClick",
34
+ TabUnfocus: "csr:tabUnfocus",
35
+ TabRefocus: "csr:tabRefocus",
36
+ RouteChange: "csr:routeChange",
37
+ ErrorMessage: "csr:errorMessage",
38
+ DialogOpened: "csr:dialogOpened",
39
+ IdleGap: "csr:idleGap",
40
+ AwayGap: "csr:awayGap"
41
+ };
42
+ const RecordingPluginName = {
43
+ BlockedElementLabels: "csr/blocked-element-labels@1",
44
+ Clipboard: "csr/clipboard@1",
45
+ ClickModifiers: "csr/click-modifiers@1",
46
+ TabVisibility: "csr:tabVisibility",
47
+ ConsoleLog: "rrweb/console@1",
48
+ NetworkRequest: "csr:networkRequest",
49
+ RouteChange: "csr:routeChange",
50
+ Tag: "csr:tag",
51
+ Measure: "csr:measure",
52
+ FlagEvaluation: "csr:flagEvaluation"
53
+ };
54
+ /**
55
+ * Incremental snapshot sub-types.
56
+ */
57
+ let IncrementalSource = /* @__PURE__ */ function(IncrementalSource) {
58
+ IncrementalSource[IncrementalSource["Mutation"] = 0] = "Mutation";
59
+ IncrementalSource[IncrementalSource["MouseMove"] = 1] = "MouseMove";
60
+ IncrementalSource[IncrementalSource["MouseInteraction"] = 2] = "MouseInteraction";
61
+ IncrementalSource[IncrementalSource["Scroll"] = 3] = "Scroll";
62
+ IncrementalSource[IncrementalSource["ViewportResize"] = 4] = "ViewportResize";
63
+ IncrementalSource[IncrementalSource["Input"] = 5] = "Input";
64
+ IncrementalSource[IncrementalSource["TouchMove"] = 6] = "TouchMove";
65
+ IncrementalSource[IncrementalSource["MediaInteraction"] = 7] = "MediaInteraction";
66
+ IncrementalSource[IncrementalSource["StyleSheetRule"] = 8] = "StyleSheetRule";
67
+ IncrementalSource[IncrementalSource["CanvasMutation"] = 9] = "CanvasMutation";
68
+ IncrementalSource[IncrementalSource["Font"] = 10] = "Font";
69
+ IncrementalSource[IncrementalSource["Log"] = 11] = "Log";
70
+ IncrementalSource[IncrementalSource["Drag"] = 12] = "Drag";
71
+ IncrementalSource[IncrementalSource["StyleDeclaration"] = 13] = "StyleDeclaration";
72
+ IncrementalSource[IncrementalSource["Selection"] = 14] = "Selection";
73
+ IncrementalSource[IncrementalSource["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet";
74
+ return IncrementalSource;
75
+ }({});
76
+ /**
77
+ * From rrweb MouseInteractions.
78
+ */
79
+ let MouseInteractions = /* @__PURE__ */ function(MouseInteractions) {
80
+ MouseInteractions[MouseInteractions["MouseUp"] = 0] = "MouseUp";
81
+ MouseInteractions[MouseInteractions["MouseDown"] = 1] = "MouseDown";
82
+ MouseInteractions[MouseInteractions["Click"] = 2] = "Click";
83
+ MouseInteractions[MouseInteractions["ContextMenu"] = 3] = "ContextMenu";
84
+ MouseInteractions[MouseInteractions["DblClick"] = 4] = "DblClick";
85
+ MouseInteractions[MouseInteractions["Focus"] = 5] = "Focus";
86
+ MouseInteractions[MouseInteractions["Blur"] = 6] = "Blur";
87
+ MouseInteractions[MouseInteractions["TouchStart"] = 7] = "TouchStart";
88
+ MouseInteractions[MouseInteractions["TouchMove_Departed"] = 8] = "TouchMove_Departed";
89
+ MouseInteractions[MouseInteractions["TouchEnd"] = 9] = "TouchEnd";
90
+ MouseInteractions[MouseInteractions["TouchCancel"] = 10] = "TouchCancel";
91
+ return MouseInteractions;
92
+ }({});
93
+ //#endregion
94
+ //#region src/metrics.ts
95
+ const RecordingMetricKey = {
96
+ Click: "clicks",
97
+ Input: "inputs",
98
+ RageClick: "rageClicks",
99
+ DeadClick: "deadClicks",
100
+ ScrollBack: "scrollBacks",
101
+ TabUnfocus: "tabUnfocuses",
102
+ ErrorMessage: "errorMessages",
103
+ FailedNetworkRequest: "networkRequestsFailed",
104
+ NetworkRequest: "networkRequests",
105
+ ConsoleLog: "consoleLogs",
106
+ ConsoleWarning: "consoleWarnings",
107
+ ConsoleError: "consoleErrors",
108
+ RouteChange: "routeChanges"
109
+ };
110
+ //#endregion
111
+ //#region src/session-activity.ts
112
+ const USER_INTERACTION_SOURCES = new Set([
113
+ 1,
114
+ 2,
115
+ 3,
116
+ 5,
117
+ 6,
118
+ 7,
119
+ 12,
120
+ 14
121
+ ]);
122
+ const USER_INTERACTION_TAGS = new Set([
123
+ RecordingCustomEventTag.Click,
124
+ RecordingCustomEventTag.Input,
125
+ RecordingCustomEventTag.RageClick,
126
+ RecordingCustomEventTag.DeadClick,
127
+ RecordingCustomEventTag.ScrollBack,
128
+ RecordingCustomEventTag.TabUnfocus,
129
+ RecordingCustomEventTag.TabRefocus,
130
+ RecordingCustomEventTag.FormFieldReEdit,
131
+ RecordingCustomEventTag.RouteChange
132
+ ]);
133
+ const USER_INTERACTION_PLUGINS = new Set([RecordingPluginName.RouteChange]);
134
+ const USER_INTERACTION_METRIC_KEYS = new Set([
135
+ RecordingMetricKey.Click,
136
+ RecordingMetricKey.Input,
137
+ RecordingMetricKey.RageClick,
138
+ RecordingMetricKey.DeadClick,
139
+ RecordingMetricKey.ScrollBack,
140
+ RecordingMetricKey.TabUnfocus,
141
+ RecordingMetricKey.RouteChange
142
+ ]);
143
+ const isObject = (value) => typeof value === "object" && value !== null;
144
+ const isUserInteractionEvent = (event) => {
145
+ if (!isObject(event) || !isObject(event.data)) return false;
146
+ if (event.type === 3) return typeof event.data.source === "number" && USER_INTERACTION_SOURCES.has(event.data.source);
147
+ if (event.type === 5) return typeof event.data.tag === "string" && USER_INTERACTION_TAGS.has(event.data.tag);
148
+ return event.type === 6 && typeof event.data.plugin === "string" && USER_INTERACTION_PLUGINS.has(event.data.plugin);
149
+ };
150
+ const isUserInteractionMetric = (metricKey) => USER_INTERACTION_METRIC_KEYS.has(metricKey);
151
+ const isSessionActivityEvent = (event) => isObject(event) && event.type === 4 || isUserInteractionEvent(event);
152
+ //#endregion
153
+ export { IncrementalSource as a, RecordingEventType as c, RecordingMetricKey as i, RecordingPluginName as l, isUserInteractionEvent as n, MouseInteractions as o, isUserInteractionMetric as r, RecordingCustomEventTag as s, isSessionActivityEvent as t, SerializedNodeType as u };
@@ -0,0 +1,212 @@
1
+ //#region src/events.ts
2
+ /**
3
+ * Mirrors rrweb's serialized-node types but decoupled — we own the enum.
4
+ */
5
+ let SerializedNodeType = /* @__PURE__ */ function(SerializedNodeType) {
6
+ SerializedNodeType[SerializedNodeType["Document"] = 0] = "Document";
7
+ SerializedNodeType[SerializedNodeType["DocumentType"] = 1] = "DocumentType";
8
+ SerializedNodeType[SerializedNodeType["Element"] = 2] = "Element";
9
+ SerializedNodeType[SerializedNodeType["Text"] = 3] = "Text";
10
+ SerializedNodeType[SerializedNodeType["CDATA"] = 4] = "CDATA";
11
+ SerializedNodeType[SerializedNodeType["Comment"] = 5] = "Comment";
12
+ return SerializedNodeType;
13
+ }({});
14
+ /**
15
+ * Mirrors rrweb event types but decoupled — we own the enum.
16
+ */
17
+ let RecordingEventType = /* @__PURE__ */ function(RecordingEventType) {
18
+ RecordingEventType[RecordingEventType["DomContentLoaded"] = 0] = "DomContentLoaded";
19
+ RecordingEventType[RecordingEventType["Load"] = 1] = "Load";
20
+ RecordingEventType[RecordingEventType["FullSnapshot"] = 2] = "FullSnapshot";
21
+ RecordingEventType[RecordingEventType["IncrementalSnapshot"] = 3] = "IncrementalSnapshot";
22
+ RecordingEventType[RecordingEventType["Meta"] = 4] = "Meta";
23
+ RecordingEventType[RecordingEventType["Custom"] = 5] = "Custom";
24
+ RecordingEventType[RecordingEventType["Plugin"] = 6] = "Plugin";
25
+ return RecordingEventType;
26
+ }({});
27
+ const RecordingCustomEventTag = {
28
+ RageClick: "csr:rageClick",
29
+ FormFieldReEdit: "csr:formFieldReEdit",
30
+ ScrollBack: "csr:scrollBack",
31
+ Click: "csr:click",
32
+ Input: "csr:input",
33
+ DeadClick: "csr:deadClick",
34
+ TabUnfocus: "csr:tabUnfocus",
35
+ TabRefocus: "csr:tabRefocus",
36
+ RouteChange: "csr:routeChange",
37
+ ErrorMessage: "csr:errorMessage",
38
+ DialogOpened: "csr:dialogOpened",
39
+ IdleGap: "csr:idleGap",
40
+ AwayGap: "csr:awayGap"
41
+ };
42
+ const RecordingPluginName = {
43
+ BlockedElementLabels: "csr/blocked-element-labels@1",
44
+ Clipboard: "csr/clipboard@1",
45
+ ClickModifiers: "csr/click-modifiers@1",
46
+ TabVisibility: "csr:tabVisibility",
47
+ ConsoleLog: "rrweb/console@1",
48
+ NetworkRequest: "csr:networkRequest",
49
+ RouteChange: "csr:routeChange",
50
+ Tag: "csr:tag",
51
+ Measure: "csr:measure",
52
+ FlagEvaluation: "csr:flagEvaluation"
53
+ };
54
+ /**
55
+ * Incremental snapshot sub-types.
56
+ */
57
+ let IncrementalSource = /* @__PURE__ */ function(IncrementalSource) {
58
+ IncrementalSource[IncrementalSource["Mutation"] = 0] = "Mutation";
59
+ IncrementalSource[IncrementalSource["MouseMove"] = 1] = "MouseMove";
60
+ IncrementalSource[IncrementalSource["MouseInteraction"] = 2] = "MouseInteraction";
61
+ IncrementalSource[IncrementalSource["Scroll"] = 3] = "Scroll";
62
+ IncrementalSource[IncrementalSource["ViewportResize"] = 4] = "ViewportResize";
63
+ IncrementalSource[IncrementalSource["Input"] = 5] = "Input";
64
+ IncrementalSource[IncrementalSource["TouchMove"] = 6] = "TouchMove";
65
+ IncrementalSource[IncrementalSource["MediaInteraction"] = 7] = "MediaInteraction";
66
+ IncrementalSource[IncrementalSource["StyleSheetRule"] = 8] = "StyleSheetRule";
67
+ IncrementalSource[IncrementalSource["CanvasMutation"] = 9] = "CanvasMutation";
68
+ IncrementalSource[IncrementalSource["Font"] = 10] = "Font";
69
+ IncrementalSource[IncrementalSource["Log"] = 11] = "Log";
70
+ IncrementalSource[IncrementalSource["Drag"] = 12] = "Drag";
71
+ IncrementalSource[IncrementalSource["StyleDeclaration"] = 13] = "StyleDeclaration";
72
+ IncrementalSource[IncrementalSource["Selection"] = 14] = "Selection";
73
+ IncrementalSource[IncrementalSource["AdoptedStyleSheet"] = 15] = "AdoptedStyleSheet";
74
+ return IncrementalSource;
75
+ }({});
76
+ /**
77
+ * From rrweb MouseInteractions.
78
+ */
79
+ let MouseInteractions = /* @__PURE__ */ function(MouseInteractions) {
80
+ MouseInteractions[MouseInteractions["MouseUp"] = 0] = "MouseUp";
81
+ MouseInteractions[MouseInteractions["MouseDown"] = 1] = "MouseDown";
82
+ MouseInteractions[MouseInteractions["Click"] = 2] = "Click";
83
+ MouseInteractions[MouseInteractions["ContextMenu"] = 3] = "ContextMenu";
84
+ MouseInteractions[MouseInteractions["DblClick"] = 4] = "DblClick";
85
+ MouseInteractions[MouseInteractions["Focus"] = 5] = "Focus";
86
+ MouseInteractions[MouseInteractions["Blur"] = 6] = "Blur";
87
+ MouseInteractions[MouseInteractions["TouchStart"] = 7] = "TouchStart";
88
+ MouseInteractions[MouseInteractions["TouchMove_Departed"] = 8] = "TouchMove_Departed";
89
+ MouseInteractions[MouseInteractions["TouchEnd"] = 9] = "TouchEnd";
90
+ MouseInteractions[MouseInteractions["TouchCancel"] = 10] = "TouchCancel";
91
+ return MouseInteractions;
92
+ }({});
93
+ //#endregion
94
+ //#region src/metrics.ts
95
+ const RecordingMetricKey = {
96
+ Click: "clicks",
97
+ Input: "inputs",
98
+ RageClick: "rageClicks",
99
+ DeadClick: "deadClicks",
100
+ ScrollBack: "scrollBacks",
101
+ TabUnfocus: "tabUnfocuses",
102
+ ErrorMessage: "errorMessages",
103
+ FailedNetworkRequest: "networkRequestsFailed",
104
+ NetworkRequest: "networkRequests",
105
+ ConsoleLog: "consoleLogs",
106
+ ConsoleWarning: "consoleWarnings",
107
+ ConsoleError: "consoleErrors",
108
+ RouteChange: "routeChanges"
109
+ };
110
+ //#endregion
111
+ //#region src/session-activity.ts
112
+ const USER_INTERACTION_SOURCES = new Set([
113
+ 1,
114
+ 2,
115
+ 3,
116
+ 5,
117
+ 6,
118
+ 7,
119
+ 12,
120
+ 14
121
+ ]);
122
+ const USER_INTERACTION_TAGS = new Set([
123
+ RecordingCustomEventTag.Click,
124
+ RecordingCustomEventTag.Input,
125
+ RecordingCustomEventTag.RageClick,
126
+ RecordingCustomEventTag.DeadClick,
127
+ RecordingCustomEventTag.ScrollBack,
128
+ RecordingCustomEventTag.TabUnfocus,
129
+ RecordingCustomEventTag.TabRefocus,
130
+ RecordingCustomEventTag.FormFieldReEdit,
131
+ RecordingCustomEventTag.RouteChange
132
+ ]);
133
+ const USER_INTERACTION_PLUGINS = new Set([RecordingPluginName.RouteChange]);
134
+ const USER_INTERACTION_METRIC_KEYS = new Set([
135
+ RecordingMetricKey.Click,
136
+ RecordingMetricKey.Input,
137
+ RecordingMetricKey.RageClick,
138
+ RecordingMetricKey.DeadClick,
139
+ RecordingMetricKey.ScrollBack,
140
+ RecordingMetricKey.TabUnfocus,
141
+ RecordingMetricKey.RouteChange
142
+ ]);
143
+ const isObject = (value) => typeof value === "object" && value !== null;
144
+ const isUserInteractionEvent = (event) => {
145
+ if (!isObject(event) || !isObject(event.data)) return false;
146
+ if (event.type === 3) return typeof event.data.source === "number" && USER_INTERACTION_SOURCES.has(event.data.source);
147
+ if (event.type === 5) return typeof event.data.tag === "string" && USER_INTERACTION_TAGS.has(event.data.tag);
148
+ return event.type === 6 && typeof event.data.plugin === "string" && USER_INTERACTION_PLUGINS.has(event.data.plugin);
149
+ };
150
+ const isUserInteractionMetric = (metricKey) => USER_INTERACTION_METRIC_KEYS.has(metricKey);
151
+ const isSessionActivityEvent = (event) => isObject(event) && event.type === 4 || isUserInteractionEvent(event);
152
+ //#endregion
153
+ Object.defineProperty(exports, "IncrementalSource", {
154
+ enumerable: true,
155
+ get: function() {
156
+ return IncrementalSource;
157
+ }
158
+ });
159
+ Object.defineProperty(exports, "MouseInteractions", {
160
+ enumerable: true,
161
+ get: function() {
162
+ return MouseInteractions;
163
+ }
164
+ });
165
+ Object.defineProperty(exports, "RecordingCustomEventTag", {
166
+ enumerable: true,
167
+ get: function() {
168
+ return RecordingCustomEventTag;
169
+ }
170
+ });
171
+ Object.defineProperty(exports, "RecordingEventType", {
172
+ enumerable: true,
173
+ get: function() {
174
+ return RecordingEventType;
175
+ }
176
+ });
177
+ Object.defineProperty(exports, "RecordingMetricKey", {
178
+ enumerable: true,
179
+ get: function() {
180
+ return RecordingMetricKey;
181
+ }
182
+ });
183
+ Object.defineProperty(exports, "RecordingPluginName", {
184
+ enumerable: true,
185
+ get: function() {
186
+ return RecordingPluginName;
187
+ }
188
+ });
189
+ Object.defineProperty(exports, "SerializedNodeType", {
190
+ enumerable: true,
191
+ get: function() {
192
+ return SerializedNodeType;
193
+ }
194
+ });
195
+ Object.defineProperty(exports, "isSessionActivityEvent", {
196
+ enumerable: true,
197
+ get: function() {
198
+ return isSessionActivityEvent;
199
+ }
200
+ });
201
+ Object.defineProperty(exports, "isUserInteractionEvent", {
202
+ enumerable: true,
203
+ get: function() {
204
+ return isUserInteractionEvent;
205
+ }
206
+ });
207
+ Object.defineProperty(exports, "isUserInteractionMetric", {
208
+ enumerable: true,
209
+ get: function() {
210
+ return isUserInteractionMetric;
211
+ }
212
+ });
@@ -102,6 +102,8 @@ interface Frame {
102
102
  eventCounter: number;
103
103
  /** Opaque payload from the recorder. */
104
104
  data: unknown;
105
+ /** Whether the frame should refresh the backend's session inactivity timeout. */
106
+ userActivity?: boolean;
105
107
  /** Set only on the first frame emitted after the tab was adopted into a different session. */
106
108
  adoptedFromSessionId?: string;
107
109
  /** Epoch millis of the adoption event. */
@@ -102,6 +102,8 @@ interface Frame {
102
102
  eventCounter: number;
103
103
  /** Opaque payload from the recorder. */
104
104
  data: unknown;
105
+ /** Whether the frame should refresh the backend's session inactivity timeout. */
106
+ userActivity?: boolean;
105
107
  /** Set only on the first frame emitted after the tab was adopted into a different session. */
106
108
  adoptedFromSessionId?: string;
107
109
  /** Epoch millis of the adoption event. */
@@ -21,6 +21,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
21
21
  enumerable: true
22
22
  }) : target, mod));
23
23
  //#endregion
24
+ const require_session_activity = require("../session-activity-HfuXKqGd.cjs");
24
25
  let bowser = require("bowser");
25
26
  bowser = __toESM(bowser, 1);
26
27
  //#region src/uploader/client-context.ts
@@ -184,6 +185,7 @@ async function createUploader(opts) {
184
185
  tabId: effectiveTabId,
185
186
  eventCounter: counter,
186
187
  data: event,
188
+ userActivity: require_session_activity.isSessionActivityEvent(event),
187
189
  ...nextAdoptionMeta ?? {}
188
190
  };
189
191
  counter += 1;
@@ -1,4 +1,4 @@
1
- import { a as ContextValue, i as ClientContext, o as UserAgentContext, r as Uploader, s as collectUserAgentContext, t as CreateUploaderOptions } from "../types-CtBIVgp2.cjs";
1
+ import { a as ContextValue, i as ClientContext, o as UserAgentContext, r as Uploader, s as collectUserAgentContext, t as CreateUploaderOptions } from "../types-Bg0UKTVQ.cjs";
2
2
 
3
3
  //#region src/uploader/create-uploader.d.ts
4
4
  declare function createUploader(opts: CreateUploaderOptions): Promise<Uploader | null>;
@@ -1,4 +1,4 @@
1
- import { a as ContextValue, i as ClientContext, o as UserAgentContext, r as Uploader, s as collectUserAgentContext, t as CreateUploaderOptions } from "../types-CtBIVgp2.js";
1
+ import { a as ContextValue, i as ClientContext, o as UserAgentContext, r as Uploader, s as collectUserAgentContext, t as CreateUploaderOptions } from "../types-Bg0UKTVQ.js";
2
2
 
3
3
  //#region src/uploader/create-uploader.d.ts
4
4
  declare function createUploader(opts: CreateUploaderOptions): Promise<Uploader | null>;
@@ -1,3 +1,4 @@
1
+ import { t as isSessionActivityEvent } from "../session-activity-CJ1wae06.js";
1
2
  import Bowser from "bowser";
2
3
  //#region src/uploader/client-context.ts
3
4
  function collectUserAgentContext() {
@@ -160,6 +161,7 @@ async function createUploader(opts) {
160
161
  tabId: effectiveTabId,
161
162
  eventCounter: counter,
162
163
  data: event,
164
+ userActivity: isSessionActivityEvent(event),
163
165
  ...nextAdoptionMeta ?? {}
164
166
  };
165
167
  counter += 1;
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.7",
4
+ "version": "0.18.9",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/spotify/confidence-sdk-js.git",