@elu-labs/analytics-browser 1.410.4 → 1.411.1

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.d.ts CHANGED
@@ -1,3 +1,52 @@
1
+ /**
2
+ * The `autocapture` initialization option as the 1.409.5 bundle read it: `true` or omitted turns
3
+ * interaction capture on, `false` turns it off, and an object turns it on narrowed by its lists.
4
+ * A page written for that bundle passes the object; before this reader an object counted as
5
+ * `false` and silently switched autocapture off.
6
+ *
7
+ * Only own data values are read, never accessors or inherited keys. A list the bundle could not
8
+ * have used either (not an array, an unreadable entry, a URL pattern that does not compile) turns
9
+ * autocapture off: the bundle threw on every event under such a configuration and captured
10
+ * nothing, and a filter that cannot be applied must not widen capture.
11
+ *
12
+ * The object's `capture_copied_text` is read here as well, so the option has one reader: a boolean
13
+ * in the object decides for the copied-text collector before the page's top-level
14
+ * `capture_copied_text`, and an object autocapture cannot run under never asks for copied text.
15
+ *
16
+ * `element_attribute_ignorelist` names attributes that must not leave the page when an element-content
17
+ * grant sends attributes; `createEluAttributeAdmission` judges one attribute name by it exactly as the
18
+ * bundle did. At this base every chain is structural (tag and position only), so the admission has
19
+ * no attribute to refuse yet; the element-content reader that sends attributes consults it.
20
+ */
21
+ /**
22
+ * The event types the 1.409.5 `DomAutocaptureEvents` named. As in that bundle, a `dom_event_allowlist`
23
+ * is applied to `copy` and `cut` as well: a list that does not name them refuses copied text.
24
+ */
25
+ type EluAutocaptureDomEvent = 'click' | 'change' | 'submit';
26
+ /** The 1.409.5 `AutocaptureConfig` object. `capture_copied_text` is accepted here; its collector is separate. */
27
+ interface EluAutocaptureConfigInput {
28
+ /** Capture only on pages whose URL matches one entry (a regular expression, or a string compiled as one). */
29
+ readonly url_allowlist?: readonly (string | RegExp)[];
30
+ /** Never capture on pages whose URL matches an entry; checked after the allowlist. */
31
+ readonly url_ignorelist?: readonly (string | RegExp)[];
32
+ /** Capture only these DOM events. */
33
+ readonly dom_event_allowlist?: readonly EluAutocaptureDomEvent[];
34
+ /** Capture only when the target or an ancestor has one of these lower-case tag names. */
35
+ readonly element_allowlist?: readonly string[];
36
+ /** Capture only when the target or an ancestor matches one of these selectors; `[]` captures nothing. */
37
+ readonly css_selector_allowlist?: readonly string[];
38
+ /** Never capture when the target or an ancestor matches one of these selectors. The SDK's own no-capture markers always apply. */
39
+ readonly css_selector_ignorelist?: readonly string[];
40
+ /**
41
+ * Attribute names an element-content grant must not send, matched by exact name as the bundle
42
+ * matched them (`data-user-email` does not cover `data-User-Email`). Judged through
43
+ * `createEluAttributeAdmission` wherever attributes are read; a structural chain carries none.
44
+ */
45
+ readonly element_attribute_ignorelist?: readonly string[];
46
+ /** Asks for `$copy_autocapture`; a boolean here decides before the page's top-level `capture_copied_text`. */
47
+ readonly capture_copied_text?: boolean;
48
+ }
49
+
1
50
  /** Exact declared source configuration; source key/token inference across sites is forbidden. */
2
51
  interface LegacyStorageOptions {
3
52
  readonly sourceArtifactSha256: string;
@@ -21,13 +70,108 @@ interface V1JsonObject {
21
70
  interface PerformanceCaptureConfig {
22
71
  readonly memory?: boolean;
23
72
  readonly long_tasks?: boolean;
24
- /** Core Web Vitals (LCP, FCP, CLS, INP) reported as `$web_vitals`. On when omitted or `true`; any other value turns them off. */
73
+ /**
74
+ * Core Web Vitals (LCP, FCP, CLS, INP) reported as `$web_vitals`. `true` turns them on for this
75
+ * page and `false` off; omitted, the ELU project's `captureWebVitals` decides. A boolean
76
+ * `capture_performance` decides the same way.
77
+ */
25
78
  readonly web_vitals?: boolean;
26
79
  /** Milliseconds between visible-page samples. Defaults to 30,000; minimum 5,000. */
27
80
  readonly sample_interval_ms?: number;
28
81
  }
29
82
  type EluPerformanceCaptureOptions = boolean | Readonly<PerformanceCaptureConfig>;
30
83
 
84
+ /**
85
+ * The `session_recording` members a page may set: the full-snapshot cadence, the replay network
86
+ * narrowing and the masking members below. Every other member is ignored.
87
+ */
88
+ interface EluSessionRecordingOptions {
89
+ /**
90
+ * Milliseconds of activity between full snapshots of the page. The recorder takes one when it
91
+ * starts and another at the first change after this long, so a replay can always be rebuilt
92
+ * from a recent checkpoint: seeking lands on one, and a player that cannot apply an
93
+ * incremental change recovers at the next. Default 300 000 (five minutes); a value is kept
94
+ * between 10 000 and 1 800 000. The earlier script's `0` no longer turns checkpoints off.
95
+ */
96
+ readonly full_snapshot_interval_millis?: number;
97
+ /** Request and response headers in replay network capture: `true` records them, `false` never does; omitted, the instance decides. */
98
+ readonly recordHeaders?: boolean;
99
+ /** Request and response bodies in replay network capture: `true` records them, `false` never does; omitted, the instance decides. */
100
+ readonly recordBody?: boolean;
101
+ /**
102
+ * Canvas pixels in replay, as the earlier bundle read it: `recordCanvas` decides for the page
103
+ * (omitted, the instance decides), `canvasFps` (1 to 12) and `canvasQuality` (above 0, at most 1)
104
+ * replace the instance's rate and WebP quality. Pixels are recorded only while the instance's
105
+ * masking allows images.
106
+ */
107
+ readonly captureCanvas?: Readonly<{
108
+ recordCanvas?: boolean;
109
+ canvasFps?: number;
110
+ canvasQuality?: number;
111
+ }>;
112
+ /** `true` masks every input value. `false` cannot unmask what the site's profile masks. */
113
+ readonly maskAllInputs?: boolean;
114
+ /** rrweb input kinds set to `true` are masked in addition to the site's rule; passwords always are. */
115
+ readonly maskInputOptions?: Readonly<Partial<Record<string, boolean>>>;
116
+ /** Text under matching elements is masked, in addition to the site's rules. */
117
+ readonly maskTextSelector?: string | null;
118
+ /**
119
+ * A class name whose elements' text is masked; `ph-mask` and `elu-mask` always are. A RegExp
120
+ * is read only in the earlier bundle's exact-class shape, `/^(a|b)$/`, as `.a, .b`.
121
+ */
122
+ readonly maskTextClass?: string | RegExp;
123
+ /** Matching elements are recorded as placeholders, in addition to the site's rules. */
124
+ readonly blockSelector?: string | null;
125
+ /**
126
+ * A class name whose elements are blocked; `ph-no-capture` and `elu-no-capture` always are. A
127
+ * RegExp is read as for `maskTextClass`, so the earlier bundle's own default,
128
+ * `/^(ph-no-capture|elu-no-capture)$/`, is honoured.
129
+ */
130
+ readonly blockClass?: string | RegExp;
131
+ /**
132
+ * A class name whose input changes are not recorded; `ph-ignore-input` and `elu-ignore-input`
133
+ * always are. A RegExp is read as for `maskTextClass`.
134
+ */
135
+ readonly ignoreClass?: string | RegExp;
136
+ /** Inputs matching it have their changes left out of the recording. */
137
+ readonly ignoreSelector?: string | null;
138
+ /** The earlier bundle's other members (`collectFonts`, `inlineStylesheet`, ...) are accepted and ignored. */
139
+ readonly [member: string]: unknown;
140
+ }
141
+
142
+ /**
143
+ * The page's own scrubbing hooks, as the 1.409.5 bundle ran them on every event: `capture`,
144
+ * `captureException` and each automatic collector alike. They run once per event, in the
145
+ * bundle's order, right before the event is queued:
146
+ *
147
+ * 1. `property_denylist` (and its `property_blacklist` alias) deletes those keys from the
148
+ * event properties;
149
+ * 2. `sanitize_properties(properties, eventName)` replaces the event properties;
150
+ * 3. `before_send`, a function or an array called in order, receives the event and returns it
151
+ * (edited in place or replaced) or `null` to drop it.
152
+ *
153
+ * The bundle let a hook's exception escape from `capture`, so the event was never sent. The
154
+ * native client keeps that outcome without the exception: a hook that throws, or returns
155
+ * something that is not an event, drops the event with one console error, and the caller's
156
+ * page never sees the error. A scrubber that fails must not leak what it was written to remove.
157
+ */
158
+ /**
159
+ * The event as `before_send` sees it: the bundle's `CaptureResult` without `uuid`, because the
160
+ * durable stream assigns event ids after the hooks. `$set` and `$set_once` are present when the
161
+ * capture call passed them; `timestamp` is the caller's, or the time the hook runs.
162
+ */
163
+ interface EluCaptureResult {
164
+ event: string;
165
+ properties: Record<string, unknown>;
166
+ $set?: Record<string, unknown>;
167
+ $set_once?: Record<string, unknown>;
168
+ timestamp: Date;
169
+ }
170
+ /** Returns the event to send, edited in place or replaced, or `null` to drop it. */
171
+ type EluBeforeSendFn = (result: EluCaptureResult) => EluCaptureResult | null | undefined;
172
+ /** @deprecated The bundle deprecated it in favour of `before_send`; it still runs before `before_send`. */
173
+ type EluSanitizePropertiesFn = (properties: Record<string, unknown>, eventName: string) => Record<string, unknown>;
174
+
31
175
  type V1FacadeProperties = Readonly<Record<string, unknown>>;
32
176
  interface V1FacadeCaptureOptions {
33
177
  readonly $set?: V1FacadeProperties;
@@ -116,7 +260,22 @@ interface EluInitializationOptions {
116
260
  readonly assets_host?: string;
117
261
  readonly legacy_storage?: LegacyStorageOptions;
118
262
  readonly capture_pageview?: EluPageviewMode;
119
- readonly autocapture?: boolean;
263
+ /** `true` or omitted: on; `false`: off; an object: on, narrowed by the 1.409.5 `AutocaptureConfig` lists. */
264
+ readonly autocapture?: boolean | EluAutocaptureConfigInput;
265
+ /**
266
+ * `$copy_autocapture` with the selected text when a visitor copies or cuts, as the 1.409.5
267
+ * bundle sent it for `autocapture.capture_copied_text`; the ELU Cloud loader passes it here.
268
+ * `true` turns it on for this page and `false` keeps it off, whatever ELU's configuration
269
+ * grants; a page that says nothing leaves it to the configuration's `captureCopiedText`. Always
270
+ * off under `mask_all_text`, and every copy is judged under the configuration's masking.
271
+ * `autocapture.capture_copied_text`, when it is a boolean, decides first.
272
+ */
273
+ readonly capture_copied_text?: boolean;
274
+ /**
275
+ * Automatic unhandled errors and rejections. `true` turns them on for this page and `false`
276
+ * off; omitted, the ELU project's `captureExceptions` grant decides, as the 1.409.5 bundle read
277
+ * it. The project's suppression rules apply whenever it grants exceptions.
278
+ */
120
279
  readonly capture_exceptions?: boolean;
121
280
  /**
122
281
  * Report each fetch/XHR as `$network_request` (method, status, timing and a
@@ -124,7 +283,58 @@ interface EluInitializationOptions {
124
283
  */
125
284
  readonly capture_network_requests?: boolean;
126
285
  readonly capture_performance?: EluPerformanceCaptureOptions;
286
+ /**
287
+ * Click, rage-click, dead-click and mouse-move positions as `$$heatmap` events. `true` or
288
+ * `{ flush_interval_milliseconds }` turns them on for this page and `false` off; omitted, the
289
+ * project's heatmap setting in ELU decides.
290
+ */
291
+ readonly capture_heatmaps?: boolean | Readonly<{
292
+ flush_interval_milliseconds?: number;
293
+ }>;
294
+ /** The older spelling of `capture_heatmaps: true | false`, read only when that is omitted. */
295
+ readonly enable_heatmaps?: boolean;
296
+ /**
297
+ * The page's console calls in session replay. `true` records them on this page and
298
+ * `false` never does; omitted, the ELU project's setting decides. Replay itself
299
+ * still comes from ELU.
300
+ */
301
+ readonly enable_recording_console_log?: boolean;
302
+ /**
303
+ * `true` keeps session replay off on this page even when ELU's configuration grants it. There
304
+ * is no `startSessionRecording()` on this client, so it stays off until a page initializes
305
+ * without it. Events are unaffected.
306
+ */
307
+ readonly disable_session_recording?: boolean;
308
+ /**
309
+ * The earlier script's `session_recording` options. `full_snapshot_interval_millis` sets the
310
+ * activity between full snapshots of the page; `recordHeaders` and `recordBody` decide replay
311
+ * network capture for the page (`true` records without the project's grant, `false` never does),
312
+ * as does `captureCanvas` (`{ recordCanvas, canvasFps, canvasQuality }`) for canvas pixels,
313
+ * within the site's masking profile. Page-level masking is applied on top of the site's masking profile and
314
+ * is only ever stricter than it: `maskAllInputs: true`, `maskInputOptions`, `maskTextSelector`,
315
+ * `maskTextClass`, `blockSelector`, `blockClass`, `ignoreClass` and `ignoreSelector`. Other
316
+ * members are ignored; a masking member the recorder cannot honour keeps replay off on this page.
317
+ */
318
+ readonly session_recording?: EluSessionRecordingOptions;
319
+ /** `true` masks every text node in replay and keeps element text out of interaction events. */
320
+ readonly mask_all_text?: boolean;
321
+ /** `true` keeps element attributes out of interaction events. */
322
+ readonly mask_all_element_attributes?: boolean;
127
323
  readonly loaded?: (client: EluClient) => unknown;
324
+ /**
325
+ * Runs on every event before it is queued — `capture`, `captureException` and the automatic
326
+ * events alike — after `property_denylist` and `sanitize_properties`. A function, or an
327
+ * array of functions called in order, receives the event and returns it (edited in place or
328
+ * replaced) or `null` to drop it. A hook that throws drops the event and never reaches the
329
+ * page. Replay data does not pass through it.
330
+ */
331
+ readonly before_send?: EluBeforeSendFn | readonly EluBeforeSendFn[] | null;
332
+ /** @deprecated Use `before_send`. Still runs before it: `(properties, eventName)` returns the properties to send. */
333
+ readonly sanitize_properties?: EluSanitizePropertiesFn | null;
334
+ /** Property names removed from every event before `sanitize_properties` and `before_send`. */
335
+ readonly property_denylist?: readonly string[];
336
+ /** @deprecated Use `property_denylist`; both lists apply when given. */
337
+ readonly property_blacklist?: readonly string[];
128
338
  }
129
339
 
130
340
  /**