@elu-labs/analytics-browser 1.410.3 → 1.411.0

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,11 +70,96 @@ interface V1JsonObject {
21
70
  interface PerformanceCaptureConfig {
22
71
  readonly memory?: boolean;
23
72
  readonly long_tasks?: boolean;
73
+ /**
74
+ * Core Web Vitals (LCP, FCP, CLS, INP) reported as `$web_vitals`, which the ELU project's
75
+ * setting grants. `false` turns them off for this page; `true` does not turn them on.
76
+ */
77
+ readonly web_vitals?: boolean;
24
78
  /** Milliseconds between visible-page samples. Defaults to 30,000; minimum 5,000. */
25
79
  readonly sample_interval_ms?: number;
26
80
  }
27
81
  type EluPerformanceCaptureOptions = boolean | Readonly<PerformanceCaptureConfig>;
28
82
 
83
+ /**
84
+ * The `session_recording` members a page may set: the full-snapshot cadence, the replay network
85
+ * narrowing and the masking members below. Every other member is ignored.
86
+ */
87
+ interface EluSessionRecordingOptions {
88
+ /**
89
+ * Milliseconds of activity between full snapshots of the page. The recorder takes one when it
90
+ * starts and another at the first change after this long, so a replay can always be rebuilt
91
+ * from a recent checkpoint: seeking lands on one, and a player that cannot apply an
92
+ * incremental change recovers at the next. Default 300 000 (five minutes); a value is kept
93
+ * between 10 000 and 1 800 000. The earlier script's `0` no longer turns checkpoints off.
94
+ */
95
+ readonly full_snapshot_interval_millis?: number;
96
+ /** `false` keeps request and response headers out of replay network capture. */
97
+ readonly recordHeaders?: boolean;
98
+ /** `false` keeps request and response bodies out of replay network capture. */
99
+ readonly recordBody?: boolean;
100
+ /** `true` masks every input value. `false` cannot unmask what the site's profile masks. */
101
+ readonly maskAllInputs?: boolean;
102
+ /** rrweb input kinds set to `true` are masked in addition to the site's rule; passwords always are. */
103
+ readonly maskInputOptions?: Readonly<Partial<Record<string, boolean>>>;
104
+ /** Text under matching elements is masked, in addition to the site's rules. */
105
+ readonly maskTextSelector?: string | null;
106
+ /**
107
+ * A class name whose elements' text is masked; `ph-mask` and `elu-mask` always are. A RegExp
108
+ * is read only in the earlier bundle's exact-class shape, `/^(a|b)$/`, as `.a, .b`.
109
+ */
110
+ readonly maskTextClass?: string | RegExp;
111
+ /** Matching elements are recorded as placeholders, in addition to the site's rules. */
112
+ readonly blockSelector?: string | null;
113
+ /**
114
+ * A class name whose elements are blocked; `ph-no-capture` and `elu-no-capture` always are. A
115
+ * RegExp is read as for `maskTextClass`, so the earlier bundle's own default,
116
+ * `/^(ph-no-capture|elu-no-capture)$/`, is honoured.
117
+ */
118
+ readonly blockClass?: string | RegExp;
119
+ /**
120
+ * A class name whose input changes are not recorded; `ph-ignore-input` and `elu-ignore-input`
121
+ * always are. A RegExp is read as for `maskTextClass`.
122
+ */
123
+ readonly ignoreClass?: string | RegExp;
124
+ /** Inputs matching it have their changes left out of the recording. */
125
+ readonly ignoreSelector?: string | null;
126
+ /** The earlier bundle's other members (`captureCanvas`, `collectFonts`, ...) are accepted and ignored. */
127
+ readonly [member: string]: unknown;
128
+ }
129
+
130
+ /**
131
+ * The page's own scrubbing hooks, as the 1.409.5 bundle ran them on every event: `capture`,
132
+ * `captureException` and each automatic collector alike. They run once per event, in the
133
+ * bundle's order, right before the event is queued:
134
+ *
135
+ * 1. `property_denylist` (and its `property_blacklist` alias) deletes those keys from the
136
+ * event properties;
137
+ * 2. `sanitize_properties(properties, eventName)` replaces the event properties;
138
+ * 3. `before_send`, a function or an array called in order, receives the event and returns it
139
+ * (edited in place or replaced) or `null` to drop it.
140
+ *
141
+ * The bundle let a hook's exception escape from `capture`, so the event was never sent. The
142
+ * native client keeps that outcome without the exception: a hook that throws, or returns
143
+ * something that is not an event, drops the event with one console error, and the caller's
144
+ * page never sees the error. A scrubber that fails must not leak what it was written to remove.
145
+ */
146
+ /**
147
+ * The event as `before_send` sees it: the bundle's `CaptureResult` without `uuid`, because the
148
+ * durable stream assigns event ids after the hooks. `$set` and `$set_once` are present when the
149
+ * capture call passed them; `timestamp` is the caller's, or the time the hook runs.
150
+ */
151
+ interface EluCaptureResult {
152
+ event: string;
153
+ properties: Record<string, unknown>;
154
+ $set?: Record<string, unknown>;
155
+ $set_once?: Record<string, unknown>;
156
+ timestamp: Date;
157
+ }
158
+ /** Returns the event to send, edited in place or replaced, or `null` to drop it. */
159
+ type EluBeforeSendFn = (result: EluCaptureResult) => EluCaptureResult | null | undefined;
160
+ /** @deprecated The bundle deprecated it in favour of `before_send`; it still runs before `before_send`. */
161
+ type EluSanitizePropertiesFn = (properties: Record<string, unknown>, eventName: string) => Record<string, unknown>;
162
+
29
163
  type V1FacadeProperties = Readonly<Record<string, unknown>>;
30
164
  interface V1FacadeCaptureOptions {
31
165
  readonly $set?: V1FacadeProperties;
@@ -114,7 +248,18 @@ interface EluInitializationOptions {
114
248
  readonly assets_host?: string;
115
249
  readonly legacy_storage?: LegacyStorageOptions;
116
250
  readonly capture_pageview?: EluPageviewMode;
117
- readonly autocapture?: boolean;
251
+ /** `true` or omitted: on; `false`: off; an object: on, narrowed by the 1.409.5 `AutocaptureConfig` lists. */
252
+ readonly autocapture?: boolean | EluAutocaptureConfigInput;
253
+ /**
254
+ * `$copy_autocapture` with the selected text when a visitor copies or cuts, as the 1.409.5
255
+ * bundle sent it for `autocapture.capture_copied_text`; the ELU Cloud loader passes it here.
256
+ * Off unless `true`. `autocapture.capture_copied_text`, when it is a boolean, decides first.
257
+ */
258
+ readonly capture_copied_text?: boolean;
259
+ /**
260
+ * Automatic unhandled errors and rejections, which the ELU project grants. `false` turns them
261
+ * off for this page; `true` does not turn them on.
262
+ */
118
263
  readonly capture_exceptions?: boolean;
119
264
  /**
120
265
  * Report each fetch/XHR as `$network_request` (method, status, timing and a
@@ -122,7 +267,56 @@ interface EluInitializationOptions {
122
267
  */
123
268
  readonly capture_network_requests?: boolean;
124
269
  readonly capture_performance?: EluPerformanceCaptureOptions;
270
+ /**
271
+ * Click, rage-click, dead-click and mouse-move positions as `$$heatmap` events, which the
272
+ * project's heatmap setting in ELU grants. `false` turns them off for this page and
273
+ * `{ flush_interval_milliseconds }` sets their interval; `true` does not turn them on.
274
+ */
275
+ readonly capture_heatmaps?: boolean | Readonly<{
276
+ flush_interval_milliseconds?: number;
277
+ }>;
278
+ /** The older spelling of `capture_heatmaps: true | false`, read only when that is omitted. */
279
+ readonly enable_heatmaps?: boolean;
280
+ /**
281
+ * The page's console calls in session replay, which the ELU project's setting
282
+ * grants. `false` never records them; `true` does not record them when the
283
+ * project does not ask for it. Replay itself still comes from ELU.
284
+ */
285
+ readonly enable_recording_console_log?: boolean;
286
+ /**
287
+ * `true` keeps session replay off on this page even when ELU's configuration grants it. There
288
+ * is no `startSessionRecording()` on this client, so it stays off until a page initializes
289
+ * without it. Events are unaffected.
290
+ */
291
+ readonly disable_session_recording?: boolean;
292
+ /**
293
+ * The earlier script's `session_recording` options. `full_snapshot_interval_millis` sets the
294
+ * activity between full snapshots of the page, and `recordHeaders` or `recordBody: false` narrow
295
+ * replay network capture. Page-level masking is applied on top of the site's masking profile and
296
+ * is only ever stricter than it: `maskAllInputs: true`, `maskInputOptions`, `maskTextSelector`,
297
+ * `maskTextClass`, `blockSelector`, `blockClass`, `ignoreClass` and `ignoreSelector`. Other
298
+ * members are ignored; a masking member the recorder cannot honour keeps replay off on this page.
299
+ */
300
+ readonly session_recording?: EluSessionRecordingOptions;
301
+ /** `true` masks every text node in replay and keeps element text out of interaction events. */
302
+ readonly mask_all_text?: boolean;
303
+ /** `true` keeps element attributes out of interaction events. */
304
+ readonly mask_all_element_attributes?: boolean;
125
305
  readonly loaded?: (client: EluClient) => unknown;
306
+ /**
307
+ * Runs on every event before it is queued — `capture`, `captureException` and the automatic
308
+ * events alike — after `property_denylist` and `sanitize_properties`. A function, or an
309
+ * array of functions called in order, receives the event and returns it (edited in place or
310
+ * replaced) or `null` to drop it. A hook that throws drops the event and never reaches the
311
+ * page. Replay data does not pass through it.
312
+ */
313
+ readonly before_send?: EluBeforeSendFn | readonly EluBeforeSendFn[] | null;
314
+ /** @deprecated Use `before_send`. Still runs before it: `(properties, eventName)` returns the properties to send. */
315
+ readonly sanitize_properties?: EluSanitizePropertiesFn | null;
316
+ /** Property names removed from every event before `sanitize_properties` and `before_send`. */
317
+ readonly property_denylist?: readonly string[];
318
+ /** @deprecated Use `property_denylist`; both lists apply when given. */
319
+ readonly property_blacklist?: readonly string[];
126
320
  }
127
321
 
128
322
  /**