@launchdarkly/o11y 0.0.0-stage → 1.2.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.
@@ -0,0 +1,1725 @@
1
+ import { EvaluationSeriesContext } from '@launchdarkly/js-client-sdk';
2
+ import { EvaluationSeriesData } from '@launchdarkly/js-client-sdk';
3
+ import { Hook as Hook_2 } from '@launchdarkly/js-client-sdk';
4
+ import { LDContext } from '@launchdarkly/js-client-sdk';
5
+ import { LDEvaluationReason } from '@launchdarkly/js-client-sdk';
6
+ import { LDFlagValue } from '@launchdarkly/js-client-sdk';
7
+ import { LDPluginEnvironmentMetadata } from '@launchdarkly/js-client-sdk';
8
+ import { LDPluginMetadata } from '@launchdarkly/js-client-sdk';
9
+ import { StackFrame } from 'stacktrace-js';
10
+
11
+ declare type addedNodeMutation = {
12
+ parentId: number;
13
+ previousId?: number | null;
14
+ nextId: number | null;
15
+ node: serializedNodeWithId;
16
+ };
17
+
18
+ declare type adoptedStyleSheetData = {
19
+ source: IncrementalSource.AdoptedStyleSheet;
20
+ } & adoptedStyleSheetParam;
21
+
22
+ declare type adoptedStyleSheetParam = {
23
+ id: number;
24
+ styles?: {
25
+ styleId: number;
26
+ rules: styleSheetAddRule[];
27
+ }[];
28
+ styleIds: number[];
29
+ };
30
+
31
+ declare const ALL_CONSOLE_METHODS: readonly ["assert", "count", "countReset", "debug", "dir", "dirxml", "error", "group", "groupCollapsed", "groupEnd", "info", "log", "table", "time", "timeEnd", "timeLog", "trace", "warn"];
32
+
33
+ declare interface AmplitudeIntegrationOptions extends DefaultIntegrationOptions {
34
+ apiKey?: string;
35
+ }
36
+
37
+ declare type assetEvent = {
38
+ type: EventType.Asset;
39
+ data: assetParam;
40
+ };
41
+
42
+ declare type assetParam = {
43
+ url: string;
44
+ payload: SerializedCanvasArg | SerializedCssTextArg;
45
+ timestamp?: number;
46
+ } | {
47
+ url: string;
48
+ failed: {
49
+ status?: number;
50
+ message: string;
51
+ };
52
+ };
53
+
54
+ declare type AsyncEventsMessage = {
55
+ type: MessageType.AsyncEvents;
56
+ id: number;
57
+ hasSessionUnloaded: boolean;
58
+ highlightLogs: string;
59
+ events: eventWithTime[];
60
+ messages: ConsoleMessage[];
61
+ errors: ErrorMessage[];
62
+ resourcesString: string;
63
+ webSocketEventsString: string;
64
+ };
65
+
66
+ declare type AsyncEventsResponse = {
67
+ type: MessageType.AsyncEvents;
68
+ id: number;
69
+ eventsSize: number;
70
+ compressedSize: number;
71
+ };
72
+
73
+ declare type attributeMutation = {
74
+ id: number;
75
+ attributes: {
76
+ [key: string]: string | styleOMValue | null;
77
+ };
78
+ };
79
+
80
+ declare type attributes = cssTextKeyAttr & {
81
+ [key: string]: string | number | true | null;
82
+ };
83
+
84
+ declare type CanvasArg = SerializedCanvasArg | string | number | boolean | null | CanvasArg[];
85
+
86
+ declare enum CanvasContext {
87
+ '2D' = 0,
88
+ WebGL = 1,
89
+ WebGL2 = 2
90
+ }
91
+
92
+ declare type canvasMutationCommand = {
93
+ property: string;
94
+ args: Array<unknown>;
95
+ setter?: true;
96
+ };
97
+
98
+ declare type canvasMutationData = {
99
+ source: IncrementalSource.CanvasMutation;
100
+ } & canvasMutationParam;
101
+
102
+ declare type canvasMutationParam = {
103
+ id: number;
104
+ type: CanvasContext;
105
+ commands: canvasMutationCommand[];
106
+ } | ({
107
+ id: number;
108
+ type: CanvasContext;
109
+ } & canvasMutationCommand);
110
+
111
+ declare type cdataNode = {
112
+ type: NodeType.CDATA;
113
+ textContent: '';
114
+ };
115
+
116
+ declare type commentNode = {
117
+ type: NodeType.Comment;
118
+ textContent: string;
119
+ };
120
+
121
+ declare type CommonOptions = {
122
+ /**
123
+ * Do not use this.
124
+ * @private
125
+ */
126
+ debug?: boolean | DebugOptions;
127
+ /**
128
+ * Specifies the name of the app.
129
+ */
130
+ serviceName?: string;
131
+ /**
132
+ * Specifies the version of your application.
133
+ * This is commonly a Git hash or a semantic version.
134
+ */
135
+ version?: string;
136
+ /**
137
+ * Specifies where to send Highlight session data.
138
+ * You should not have to set this unless you are running an on-premise instance.
139
+ */
140
+ backendUrl?: string;
141
+ /**
142
+ * Set to `sessionStorage` to bypass all `window.localStorage` usage.
143
+ * This can help with compliance for cookie-consent regulation.
144
+ * Using `sessionStorage` will cause app close+reopens to start a new highlight session,
145
+ * as the session ID will not persist.
146
+ */
147
+ storageMode?: 'sessionStorage' | 'localStorage';
148
+ /**
149
+ * By default, session data is stored in the `sessionStorage` of the browser.
150
+ * Set to `true` to store session data in a cookie instead.
151
+ * This can help with compliance for cookie-consent regulation.
152
+ */
153
+ sessionCookie?: boolean;
154
+ /**
155
+ * Specifies if Highlight should not automatically initialize when the class is created.
156
+ * This should be used with `.start()` and `.stop()` if you want to control when Highlight records.
157
+ * @default false
158
+ */
159
+ manualStart?: boolean;
160
+ /**
161
+ * Key to use to determine the sessionSecureID in order to override session generation logic.
162
+ * If a sessionKey is provided, the session will be combined with the previous session with the same key.
163
+ * Otherwise, the current session logic will be used to generate a sessionSecureID.
164
+ */
165
+ sessionKey?: string;
166
+ /**
167
+ * A function that returns a friendly name for a given context.
168
+ * This name will be used to identify the session in the observability UI.
169
+ * ```ts
170
+ * contextFriendlyName: (context: LDContext) => {
171
+ * if(context.kind === 'multi' && context.user?.email) {
172
+ * return context.user.email;
173
+ * } else if(context.kind === 'user') {
174
+ * return context.key;
175
+ * }
176
+ * // Use the default identifier for contexts which don't contain a user.
177
+ * return undefined;
178
+ * }
179
+ * ```
180
+ * @param context The context to get a friendly name for.
181
+ * @returns The friendly name for the context, or undefined to use the
182
+ * default identifier.
183
+ */
184
+ contextFriendlyName?: (context: LDContext) => string | undefined;
185
+ };
186
+
187
+ declare type ConsoleMessage = {
188
+ value?: Array<string>;
189
+ attributes?: string;
190
+ time: number;
191
+ type: string;
192
+ trace?: StackFrame[];
193
+ };
194
+
195
+ declare type ConsoleMethods = ConsoleMethodsTuple[number];
196
+
197
+ declare type ConsoleMethodsTuple = typeof ALL_CONSOLE_METHODS;
198
+
199
+ declare type cssTextKeyAttr = {
200
+ _cssText?: string;
201
+ };
202
+
203
+ declare type customElementData = {
204
+ source: IncrementalSource.CustomElement;
205
+ } & customElementParam;
206
+
207
+ declare type customElementParam = {
208
+ define?: {
209
+ name: string;
210
+ };
211
+ };
212
+
213
+ declare type customEvent<T = unknown> = {
214
+ type: EventType.Custom;
215
+ data: {
216
+ tag: string;
217
+ payload: T;
218
+ };
219
+ };
220
+
221
+ declare type CustomEventResponse = {
222
+ type: MessageType.CustomEvent;
223
+ tag: string;
224
+ payload: any;
225
+ };
226
+
227
+ declare type DebugOptions = {
228
+ clientInteractions?: boolean;
229
+ domRecording?: boolean;
230
+ };
231
+
232
+ declare type DefaultIntegrationOptions = {
233
+ disabled?: boolean;
234
+ };
235
+
236
+ declare type documentNode = {
237
+ type: NodeType.Document;
238
+ childNodes: serializedNodeWithId[];
239
+ compatMode?: string;
240
+ };
241
+
242
+ declare type documentTypeNode = {
243
+ type: NodeType.DocumentType;
244
+ name: string;
245
+ publicId: string;
246
+ systemId: string;
247
+ };
248
+
249
+ declare type domContentLoadedEvent = {
250
+ type: EventType.DomContentLoaded;
251
+ data: unknown;
252
+ };
253
+
254
+ declare type elementNode = {
255
+ type: NodeType.Element;
256
+ tagName: string;
257
+ attributes: attributes;
258
+ childNodes: serializedNodeWithId[];
259
+ isSVG?: true;
260
+ needBlock?: boolean;
261
+ needMask?: boolean;
262
+ isCustom?: true;
263
+ };
264
+
265
+ declare type ErrorMessage = {
266
+ event: string;
267
+ type: ErrorMessageType;
268
+ url: string;
269
+ source: string;
270
+ lineNumber: number;
271
+ columnNumber: number;
272
+ stackTrace: StackFrame[];
273
+ /** The Unix Time of when the error was thrown. */
274
+ timestamp: string;
275
+ payload?: string;
276
+ error?: Error;
277
+ id: string;
278
+ };
279
+
280
+ declare type ErrorMessageType = 'console.error' | 'window.onerror' | 'window.onunhandledrejection' | 'custom' | 'React.ErrorBoundary';
281
+
282
+ declare enum EventType {
283
+ DomContentLoaded = 0,
284
+ Load = 1,
285
+ FullSnapshot = 2,
286
+ IncrementalSnapshot = 3,
287
+ Meta = 4,
288
+ Custom = 5,
289
+ Plugin = 6,
290
+ Asset = 7
291
+ }
292
+
293
+ declare type eventWithoutTime = domContentLoadedEvent | loadedEvent | fullSnapshotEvent | incrementalSnapshotEvent | metaEvent | customEvent | pluginEvent | assetEvent;
294
+
295
+ declare type eventWithTime = eventWithoutTime & {
296
+ timestamp: number;
297
+ delay?: number;
298
+ };
299
+
300
+ declare type Exact<T extends {
301
+ [key: string]: unknown;
302
+ }> = {
303
+ [K in keyof T]: T[K];
304
+ };
305
+
306
+ declare type FeedbackMessage = {
307
+ type: MessageType.Feedback;
308
+ verbatim: string;
309
+ timestamp: string;
310
+ userName?: string;
311
+ userEmail?: string;
312
+ };
313
+
314
+ declare type fontData = {
315
+ source: IncrementalSource.Font;
316
+ } & fontParam;
317
+
318
+ declare type fontParam = {
319
+ family: string;
320
+ fontSource: string;
321
+ buffer: boolean;
322
+ descriptors?: FontFaceDescriptors;
323
+ };
324
+
325
+ declare type fullSnapshotEvent = {
326
+ type: EventType.FullSnapshot;
327
+ data: {
328
+ node: serializedNodeWithId;
329
+ initialOffset: {
330
+ top: number;
331
+ left: number;
332
+ };
333
+ };
334
+ };
335
+
336
+ declare type GetStatusMessage = {
337
+ type: MessageType.GetStatus;
338
+ };
339
+
340
+ declare interface Headers_2 {
341
+ [key: string]: any;
342
+ }
343
+
344
+ declare type HighlightClassOptions = {
345
+ organizationID: number | string;
346
+ debug?: boolean | DebugOptions;
347
+ backendUrl?: string;
348
+ tracingOrigins?: boolean | (string | RegExp)[];
349
+ disableNetworkRecording?: boolean;
350
+ networkRecording?: boolean | NetworkRecordingOptions;
351
+ disableBackgroundRecording?: boolean;
352
+ disableConsoleRecording?: boolean;
353
+ disableSessionRecording?: boolean;
354
+ reportConsoleErrors?: boolean;
355
+ consoleMethodsToRecord?: ConsoleMethods[];
356
+ privacySetting?: PrivacySettingOption;
357
+ maskAllInputs?: boolean;
358
+ maskInputOptions?: MaskInputOptions;
359
+ maskTextClass?: string | RegExp;
360
+ maskTextSelector?: string;
361
+ blockClass?: string | RegExp;
362
+ blockSelector?: string;
363
+ ignoreClass?: string;
364
+ ignoreSelector?: string;
365
+ enableSegmentIntegration?: boolean;
366
+ enableCanvasRecording?: boolean;
367
+ enablePerformanceRecording?: boolean;
368
+ enablePromisePatch?: boolean;
369
+ samplingStrategy?: SamplingStrategy;
370
+ inlineImages?: boolean;
371
+ inlineVideos?: boolean;
372
+ inlineStylesheet?: boolean;
373
+ styleSheetResyncInterval?: number;
374
+ recordCrossOriginIframe?: boolean;
375
+ firstloadVersion?: string;
376
+ environment?: 'development' | 'production' | 'staging' | string;
377
+ appVersion?: string;
378
+ serviceName?: string;
379
+ sessionKey?: string;
380
+ sessionShortcut?: SessionShortcutOptions;
381
+ sessionSecureID: string;
382
+ storageMode?: 'sessionStorage' | 'localStorage';
383
+ sessionCookie?: boolean;
384
+ sendMode?: 'webworker' | 'local';
385
+ otlpEndpoint?: HighlightOptions['otlpEndpoint'];
386
+ otel?: HighlightOptions['otel'];
387
+ productAnalytics?: boolean | ProductAnalyticsEvents;
388
+ contextFriendlyName?: (context: LDContext) => string | undefined;
389
+ };
390
+
391
+ declare interface HighlightClientRequestWorker {
392
+ postMessage: (message: HighlightClientWorkerParams) => void;
393
+ onmessage: (message: MessageEvent<HighlightClientWorkerResponse>) => void;
394
+ }
395
+
396
+ declare type HighlightClientWorkerParams = {
397
+ message: InitializeMessage | ResetMessage | GetStatusMessage | AsyncEventsMessage | IdentifyMessage | PropertiesMessage | MetricsMessage | FeedbackMessage;
398
+ };
399
+
400
+ declare type HighlightClientWorkerResponse = {
401
+ response?: AsyncEventsResponse | CustomEventResponse | StopEventResponse | StatusResponse;
402
+ };
403
+
404
+ declare type HighlightOptions = CommonOptions & {
405
+ /**
406
+ * Specifies where the backend of the app lives. If specified, Highlight will attach the
407
+ * X-Highlight-Request header to outgoing requests whose destination URLs match a substring
408
+ * or regexp from this list, so that backend errors can be linked back to the session.
409
+ * If 'true' is specified, all requests to the current domain will be matched.
410
+ * @example tracingOrigins: ['localhost', /^\//, 'backend.myapp.com']
411
+ */
412
+ tracingOrigins?: boolean | (string | RegExp)[];
413
+ /**
414
+ * This disables recording network requests.
415
+ * The data includes the URLs, the size of the request, and how long the request took.
416
+ * @default false
417
+ * @deprecated Use `networkRecording` instead.
418
+ */
419
+ disableNetworkRecording?: boolean;
420
+ /**
421
+ * Specifies how and what Highlight records from network requests and responses.
422
+ */
423
+ networkRecording?: boolean | NetworkRecordingOptions;
424
+ /**
425
+ * If set, Highlight will not record when your app is not visible (in the background).
426
+ * By default, Highlight will record in the background.
427
+ * @default false
428
+ */
429
+ disableBackgroundRecording?: boolean;
430
+ /**
431
+ * Specifies whether Highlight will record console messages.
432
+ * @default false
433
+ */
434
+ disableConsoleRecording?: boolean;
435
+ /**
436
+ * Specifies whether Highlight will record user session replays.
437
+ * Unless you are using Highlight only for error monitoring, you do not want to set this to true.
438
+ * @default false
439
+ */
440
+ disableSessionRecording?: boolean;
441
+ /**
442
+ * Specifies whether Highlight will report `console.error` invocations as Highlight Errors.
443
+ * @default false
444
+ */
445
+ reportConsoleErrors?: boolean;
446
+ /**
447
+ * Specifies which console methods to record.
448
+ * The value here will be ignored if `disabledConsoleRecording` is `true`.
449
+ * @default All console methods.
450
+ * @example consoleMethodsToRecord: ['log', 'info', 'error']
451
+ */
452
+ consoleMethodsToRecord?: ConsoleMethods[];
453
+ enableSegmentIntegration?: boolean;
454
+ /**
455
+ * Specifies the environment your application is running in.
456
+ * This is useful to distinguish whether your session was recorded on localhost or in production.
457
+ * @default 'production'
458
+ */
459
+ environment?: 'development' | 'staging' | 'production' | string;
460
+ /**
461
+ * Specifies how much data Highlight should redact during recording.
462
+ * strict - Highlight will redact all text data on the page.
463
+ * default - Highlight will redact text data on the page that is associated with personal identifiable data.
464
+ * none - Highlight will not redact any text data on the page.
465
+ * // Redacted text will be randomized. Instead of seeing "Hello World" in a recording, you will see "1fds1 j59a0".
466
+ * @see {@link https://docs.highlight.run/docs/privacy} for more information.
467
+ */
468
+ privacySetting?: PrivacySettingOption;
469
+ /**
470
+ * Specifies whether to record canvas elements or not.
471
+ * @default false
472
+ */
473
+ enableCanvasRecording?: boolean;
474
+ /**
475
+ * Specifies whether to record performance metrics (e.g. FPS, device memory).
476
+ * @default true
477
+ */
478
+ enablePerformanceRecording?: boolean;
479
+ /**
480
+ * Specifies whether window.Promise should be patched
481
+ * to record the stack trace of promise rejections.
482
+ * @default true
483
+ */
484
+ enablePromisePatch?: boolean;
485
+ /**
486
+ * Configure the recording sampling options, eg. how frequently we record canvas updates.
487
+ */
488
+ samplingStrategy?: SamplingStrategy;
489
+ /**
490
+ * Specifies whether to inline images into the recording.
491
+ * This means that images that are local to the client (eg. client-generated blob: urls)
492
+ * will be serialized into the recording and will be valid on replay.
493
+ * This will also use canvas snapshotting to inline <video> elements
494
+ * that use `src="blob:..."` data or webcam feeds (blank src) as <canvas> elements
495
+ * Only enable this if you are running into issues with client-local images.
496
+ * Will negatively affect performance.
497
+ * @default false
498
+ */
499
+ inlineImages?: boolean;
500
+ /**
501
+ * Specifies whether to inline <video> elements into the recording.
502
+ * This means that video that are not accessible at a later time
503
+ * (eg., a signed URL that is short lived)
504
+ * will be serialized into the recording and will be valid on replay.
505
+ * Only enable this if you are running into issues with the normal serialization.
506
+ * Will negatively affect performance.
507
+ * @default false
508
+ */
509
+ inlineVideos?: boolean;
510
+ /**
511
+ * Specifies whether to inline stylesheets into the recording.
512
+ * This means that stylesheets that are local to the client (eg. client-generated blob: urls)
513
+ * will be serialized into the recording and will be valid on replay.
514
+ * Only enable this if you are running into issues with client-local stylesheets.
515
+ * May negatively affect performance.
516
+ * @default true
517
+ */
518
+ inlineStylesheet?: boolean;
519
+ /**
520
+ * How often, in milliseconds, session replay checks that its CSSOM patches
521
+ * are still installed and re-sends CSS-in-JS rules another script on the
522
+ * page may have caused it to miss. Set to 0 to disable. Lower values recover
523
+ * styles faster; each check walks every stylesheet on the page.
524
+ * @default 2000
525
+ */
526
+ styleSheetResyncInterval?: number;
527
+ /**
528
+ * Enables recording of cross-origin iframes. Should be set in both the parent window and
529
+ * in the cross-origin iframe.
530
+ * @default false
531
+ */
532
+ recordCrossOriginIframe?: boolean;
533
+ /**
534
+ * Deprecated: this setting is now inferred automatically. Passing this option does nothing.
535
+ * @deprecated
536
+ */
537
+ isCrossOriginIframe?: boolean;
538
+ integrations?: IntegrationOptions;
539
+ /**
540
+ * Specifies the keyboard shortcut to open the current session in Highlight.
541
+ * @see {@link https://docs.highlight.run/session-shortcut} for more information.
542
+ */
543
+ sessionShortcut?: SessionShortcutOptions;
544
+ /**
545
+ * By default, data is serialized and send by the Web Worker. Set to `local` to force
546
+ * sending from the main js thread. Only use `local` for custom environments where Web Workers
547
+ * are not available (ie. Figma plugins).
548
+ */
549
+ sendMode?: 'webworker' | 'local';
550
+ /**
551
+ * OTLP endpoint for OpenTelemetry tracing.
552
+ */
553
+ otlpEndpoint?: string;
554
+ /**
555
+ * OTLP options for OpenTelemetry tracing. Instrumentations are enabled by default.
556
+ */
557
+ otel?: OtelOptions;
558
+ };
559
+
560
+ /**
561
+ * Interface for extending SDK functionality via hooks.
562
+ */
563
+ declare type Hook = Omit<Hook_2, 'afterEvaluation'> & {
564
+ /**
565
+ * This method is called during the execution of the variation method
566
+ * after the flag value has been determined. The method is executed synchronously.
567
+ *
568
+ * @param hookContext Contains read-only information about the evaluation
569
+ * being performed.
570
+ * @param data A record associated with each stage of hook invocations. Each
571
+ * stage is called with the data of the previous stage for a series.
572
+ * @param detail The result of the evaluation. This value should not be
573
+ * modified.
574
+ * @returns Data to use when executing the next state of the hook in the evaluation series. It is
575
+ * recommended to expand the previous input into the return. This helps ensure your stage remains
576
+ * compatible moving forward as more stages are added.
577
+ * ```js
578
+ * return {...data, "my-new-field": /*my data/*}
579
+ * ```
580
+ */
581
+ afterEvaluation?(hookContext: EvaluationSeriesContext, data: EvaluationSeriesData, detail: {
582
+ /**
583
+ * The result of the flag evaluation. This will be either one of the flag's variations or
584
+ * the default value that was passed to `LDClient.variationDetail`.
585
+ */
586
+ value: LDFlagValue;
587
+ /**
588
+ * The index of the returned value within the flag's list of variations, e.g. 0 for the
589
+ * first variation-- or `null` if the default value was returned.
590
+ */
591
+ variationIndex?: number | null;
592
+ /**
593
+ * An object describing the main factor that influenced the flag evaluation value.
594
+ */
595
+ reason?: LDEvaluationReason | null;
596
+ }): EvaluationSeriesData;
597
+ };
598
+
599
+ declare type IdentifyMessage = {
600
+ type: MessageType.Identify;
601
+ userIdentifier: string;
602
+ userObject: any;
603
+ source?: Source;
604
+ };
605
+
606
+ declare type incrementalData = mutationData | mousemoveData | mouseInteractionData | scrollData | viewportResizeData | inputData | mediaInteractionData | styleSheetRuleData | canvasMutationData | fontData | selectionData | styleDeclarationData | adoptedStyleSheetData | customElementData;
607
+
608
+ declare type incrementalSnapshotEvent = {
609
+ type: EventType.IncrementalSnapshot;
610
+ data: incrementalData;
611
+ };
612
+
613
+ declare enum IncrementalSource {
614
+ Mutation = 0,
615
+ MouseMove = 1,
616
+ MouseInteraction = 2,
617
+ Scroll = 3,
618
+ ViewportResize = 4,
619
+ Input = 5,
620
+ TouchMove = 6,
621
+ MediaInteraction = 7,
622
+ StyleSheetRule = 8,
623
+ CanvasMutation = 9,
624
+ Font = 10,
625
+ Log = 11,
626
+ Drag = 12,
627
+ StyleDeclaration = 13,
628
+ Selection = 14,
629
+ AdoptedStyleSheet = 15,
630
+ CustomElement = 16
631
+ }
632
+
633
+ declare type InitializeMessage = {
634
+ type: MessageType.Initialize;
635
+ backend: string;
636
+ sessionSecureID: string;
637
+ debug: boolean;
638
+ recordingStartTime: number;
639
+ };
640
+
641
+ declare type inputData = {
642
+ source: IncrementalSource.Input;
643
+ id: number;
644
+ } & inputValue;
645
+
646
+ declare type inputValue = {
647
+ text: string;
648
+ isChecked: boolean;
649
+ userTriggered?: boolean;
650
+ };
651
+
652
+ declare interface IntegrationClient {
653
+ init(sessionSecureID: string): void;
654
+ identify(sessionSecureID: string, user_identifier: string, user_object: object, source?: Source): void;
655
+ error(sessionSecureID: string, error: ErrorMessage): void;
656
+ track(sessionSecureID: string, metadata: object): void;
657
+ recordGauge(sessionSecureID: string, metric: RecordMetric): void;
658
+ getHooks?(metadata: LDPluginEnvironmentMetadata): Hook[];
659
+ }
660
+
661
+ declare type IntegrationOptions = {
662
+ amplitude?: AmplitudeIntegrationOptions;
663
+ intercom?: IntercomIntegrationOptions;
664
+ mixpanel?: MixpanelIntegrationOptions;
665
+ };
666
+
667
+ declare interface IntercomIntegrationOptions extends DefaultIntegrationOptions {
668
+ }
669
+
670
+ declare interface LDClientMin {
671
+ track(key: string, data?: any, metricValue?: number): void;
672
+ identify(ctx: any): void;
673
+ addHook(hook: Hook): void;
674
+ }
675
+
676
+ declare interface LDPlugin {
677
+ getMetadata(): LDPluginMetadata;
678
+ register(client: LDClientMin, environmentMetadata: LDPluginEnvironmentMetadata): void;
679
+ getHooks?(metadata: LDPluginEnvironmentMetadata): Hook[];
680
+ }
681
+
682
+ declare type listenerHandler = () => void;
683
+
684
+ declare type loadedEvent = {
685
+ type: EventType.Load;
686
+ data: unknown;
687
+ };
688
+
689
+ declare class Logger {
690
+ debug: boolean | undefined;
691
+ name: string | undefined;
692
+ constructor(debug?: boolean, name?: string);
693
+ log(...data: any[]): void;
694
+ warn(...data: any[]): void;
695
+ }
696
+
697
+ declare type MaskInputOptions = Partial<{
698
+ color: boolean;
699
+ date: boolean;
700
+ 'datetime-local': boolean;
701
+ email: boolean;
702
+ month: boolean;
703
+ number: boolean;
704
+ range: boolean;
705
+ search: boolean;
706
+ tel: boolean;
707
+ text: boolean;
708
+ time: boolean;
709
+ url: boolean;
710
+ week: boolean;
711
+ textarea: boolean;
712
+ select: boolean;
713
+ password: boolean;
714
+ }>;
715
+
716
+ declare type mediaInteractionData = {
717
+ source: IncrementalSource.MediaInteraction;
718
+ } & mediaInteractionParam;
719
+
720
+ declare type mediaInteractionParam = {
721
+ type: MediaInteractions;
722
+ id: number;
723
+ currentTime?: number;
724
+ volume?: number;
725
+ muted?: boolean;
726
+ loop?: boolean;
727
+ playbackRate?: number;
728
+ };
729
+
730
+ declare enum MediaInteractions {
731
+ Play = 0,
732
+ Pause = 1,
733
+ Seeked = 2,
734
+ VolumeChange = 3,
735
+ RateChange = 4
736
+ }
737
+
738
+ declare enum MessageType {
739
+ Initialize = 0,
740
+ Reset = 1,
741
+ AsyncEvents = 2,
742
+ Identify = 3,
743
+ Properties = 4,
744
+ Metrics = 5,
745
+ Feedback = 6,
746
+ CustomEvent = 7,
747
+ Stop = 8,
748
+ GetStatus = 9
749
+ }
750
+
751
+ declare interface Metadata_2 {
752
+ [key: string]: any;
753
+ }
754
+
755
+ declare type metaEvent = {
756
+ type: EventType.Meta;
757
+ data: {
758
+ href: string;
759
+ width: number;
760
+ height: number;
761
+ };
762
+ };
763
+
764
+ declare enum MetricCategory {
765
+ Device = "Device",
766
+ WebVital = "WebVital",
767
+ Performance = "Performance",
768
+ Frontend = "Frontend",
769
+ Backend = "Backend"
770
+ }
771
+
772
+ declare type MetricsMessage = {
773
+ type: MessageType.Metrics;
774
+ metrics: {
775
+ name: string;
776
+ value: number;
777
+ category: MetricCategory;
778
+ group: string;
779
+ timestamp: Date;
780
+ tags: {
781
+ name: string;
782
+ value: string;
783
+ }[];
784
+ }[];
785
+ };
786
+
787
+ declare interface MixpanelIntegrationOptions extends DefaultIntegrationOptions {
788
+ projectToken?: string;
789
+ }
790
+
791
+ declare type mouseInteractionData = {
792
+ source: IncrementalSource.MouseInteraction;
793
+ } & mouseInteractionParam;
794
+
795
+ declare type mouseInteractionParam = {
796
+ type: MouseInteractions;
797
+ id: number;
798
+ x?: number;
799
+ y?: number;
800
+ pointerType?: PointerTypes;
801
+ };
802
+
803
+ declare enum MouseInteractions {
804
+ MouseUp = 0,
805
+ MouseDown = 1,
806
+ Click = 2,
807
+ ContextMenu = 3,
808
+ DblClick = 4,
809
+ Focus = 5,
810
+ Blur = 6,
811
+ TouchStart = 7,
812
+ TouchMove_Departed = 8,
813
+ TouchEnd = 9,
814
+ TouchCancel = 10
815
+ }
816
+
817
+ declare type mousemoveData = {
818
+ source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag;
819
+ positions: mousePosition[];
820
+ };
821
+
822
+ declare type mousePosition = {
823
+ x: number;
824
+ y: number;
825
+ id: number;
826
+ timeOffset: number;
827
+ };
828
+
829
+ declare type mutationCallbackParam = {
830
+ texts: textMutation[];
831
+ attributes: attributeMutation[];
832
+ removes: removedNodeMutation[];
833
+ adds: addedNodeMutation[];
834
+ isAttachIframe?: true;
835
+ };
836
+
837
+ declare type mutationData = {
838
+ source: IncrementalSource.Mutation;
839
+ } & mutationCallbackParam;
840
+
841
+ declare type NetworkRecordingOptions = {
842
+ /**
843
+ * Enables recording of network requests.
844
+ * The data includes the URLs, the size of the request, and how long the request took.
845
+ * @default true
846
+ */
847
+ enabled?: boolean;
848
+ /**
849
+ * This enables recording XMLHttpRequest and Fetch headers and bodies.
850
+ * @default false
851
+ */
852
+ recordHeadersAndBody?: boolean;
853
+ /**
854
+ * This disables recording WebSocket events.
855
+ * WebSocket events are recorded by default if recordHeadersAndBody is set.
856
+ * @default false
857
+ */
858
+ disableWebSocketEventRecordings?: boolean;
859
+ /**
860
+ * Request and response headers where the value is not recorded.
861
+ * The header value is replaced with '[REDACTED]'.
862
+ * These headers are case-insensitive.
863
+ * `recordHeadersAndBody` needs to be enabled.
864
+ * This option will be ignored if `headerKeysToRecord` is set.
865
+ * @example
866
+ * networkHeadersToRedact: ['Secret-Header', 'Plain-Text-Password']
867
+ */
868
+ networkHeadersToRedact?: string[];
869
+ /**
870
+ * Specifies the keys for request/response JSON body that should not be recorded.
871
+ * The body value is replaced with '[REDACTED]'.
872
+ * These keys are case-insensitive.
873
+ * `enabled` and `recordHeadersAndBody` need to be `true`. Otherwise this option will be ignored.
874
+ * @example bodyKeysToRedact: ['secret-token', 'plain-text-password']
875
+ * // Only `body.id` and `body.pageNumber` will be recorded.
876
+ * body = {
877
+ * 'id': '123',
878
+ * 'pageNumber': '1',
879
+ * 'secret-token': 'super-sensitive-value',
880
+ * 'plain-text-password': 'password123',
881
+ * }
882
+ */
883
+ networkBodyKeysToRedact?: string[];
884
+ /**
885
+ * URLs to not record headers and bodies for, and to not propagate trace
886
+ * headers (e.g. `traceparent`) to. Each entry is matched as a
887
+ * case-insensitive substring of the full request URL; a match suppresses
888
+ * both recording and trace-header propagation for that request.
889
+ * To disable recording headers and bodies for all URLs, set `recordHeadersAndBody` to `false`.
890
+ * @default ['https://www.googleapis.com/identitytoolkit', 'https://securetoken.googleapis.com']
891
+ */
892
+ urlBlocklist?: string[];
893
+ /**
894
+ * Specifies the keys for request/response headers to record.
895
+ * This option will override `networkHeadersToRedact` if specified.
896
+ * `enabled` and `recordHeadersAndBody` need to be `true`. Otherwise this option will be ignored.
897
+ * @example headerKeysToRecord: ['id', 'pageNumber']
898
+ * // Only `headers.id` and `headers.pageNumber` will be recorded.
899
+ * headers = {
900
+ * 'id': '123',
901
+ * 'pageNumber': '1',
902
+ * 'secret-token': 'super-sensitive-value',
903
+ * 'plain-text-password': 'password123',
904
+ * }
905
+ */
906
+ headerKeysToRecord?: string[];
907
+ /**
908
+ * Specifies the keys for request/response JSON body to record.
909
+ * This option will override `networkBodyKeysToRedact` if specified.
910
+ * `enabled` and `recordHeadersAndBody` need to be `true`. Otherwise this option will be ignored.
911
+ * @example bodyKeysToRecord: ['id', 'pageNumber']
912
+ * // Only `body.id` and `body.pageNumber` will be recorded.
913
+ * body = {
914
+ * 'id': '123',
915
+ * 'pageNumber': '1',
916
+ * 'secret-token': 'super-sensitive-value',
917
+ * 'plain-text-password': 'password123',
918
+ * }
919
+ */
920
+ bodyKeysToRecord?: string[];
921
+ /**
922
+ * Record frontend network request metrics that are sent to
923
+ * the following list of domains. A domain substring match is used to
924
+ * determine if a network request matches one of the following values.
925
+ * @example destinationDomains: ['backend.example.com']
926
+ * // if your frontend makes requests to `backend.example.com` that you would like to record
927
+ */
928
+ destinationDomains?: string[];
929
+ /**
930
+ * Function to edit/remove data in request/response pairs or ignore the pair entirely.
931
+ * @example
932
+ * ```
933
+ * requestResponseSanitizer: pair => {
934
+ * if (pair.request.url.toLowerCase().indexOf('ignore') !== -1) {
935
+ * // ignore the entire request/response pair (no network logs)
936
+ * return null
937
+ * }
938
+ *
939
+ * if (pair.response.body.indexOf('secret') !== -1) {
940
+ * // remove the body in the response
941
+ * delete pair.response.body;
942
+ * }
943
+ *
944
+ * return pair
945
+ * }
946
+ * ```
947
+ *
948
+ */
949
+ requestResponseSanitizer?: (pair: RequestResponsePair) => RequestResponsePair | null;
950
+ };
951
+
952
+ declare enum NodeType {
953
+ Document = 0,
954
+ DocumentType = 1,
955
+ Element = 2,
956
+ Text = 3,
957
+ CDATA = 4,
958
+ Comment = 5
959
+ }
960
+
961
+ declare type ObserveOptions = CommonOptions & {
962
+ /**
963
+ * Specifies where the backend of the app lives. If specified, the SDK will attach the
964
+ * traceparent header to outgoing requests whose destination URLs match a substring
965
+ * or regexp from this list, so that backend errors can be linked back to the session.
966
+ * If 'true' is specified, all requests to the current domain will be matched.
967
+ * @example tracingOrigins: ['localhost', /^\//, 'backend.myapp.com']
968
+ */
969
+ tracingOrigins?: boolean | (string | RegExp)[];
970
+ /**
971
+ * Specifies how and what the SDK records from network requests and responses.
972
+ */
973
+ networkRecording?: boolean | NetworkRecordingOptions;
974
+ /**
975
+ * Specifies whether the SDK will record console messages.
976
+ * @default false
977
+ */
978
+ disableConsoleRecording?: boolean;
979
+ /**
980
+ * Specifies whether the SDK will report `console.error` invocations as Errors.
981
+ * @default false
982
+ */
983
+ reportConsoleErrors?: boolean;
984
+ /**
985
+ * Specifies which console methods to record.
986
+ * The value here will be ignored if `disabledConsoleRecording` is `true`.
987
+ * @default All console methods.
988
+ * @example consoleMethodsToRecord: ['log', 'info', 'error']
989
+ */
990
+ consoleMethodsToRecord?: ConsoleMethods[];
991
+ /**
992
+ * Specifies whether to record performance metrics (e.g. FPS, device memory).
993
+ * @default true
994
+ */
995
+ enablePerformanceRecording?: boolean;
996
+ /**
997
+ * Specifies whether to record main-thread `longtask` entries (>50ms) as
998
+ * `long_task.duration` histogram samples.
999
+ * @default true
1000
+ */
1001
+ enableLongtaskRecording?: boolean;
1002
+ /**
1003
+ * Specifies whether to subscribe to the browser Reporting API and emit
1004
+ * CSP/intervention reports as errors and deprecation reports as warn logs.
1005
+ * @default true
1006
+ */
1007
+ enableReportingObserver?: boolean;
1008
+ /**
1009
+ * Specifies the environment your application is running in.
1010
+ * This is useful to distinguish whether your session was recorded on localhost or in production.
1011
+ * @default 'production'
1012
+ */
1013
+ environment?: 'development' | 'staging' | 'production' | string;
1014
+ /**
1015
+ * Specifies whether window.Promise should be patched
1016
+ * to record the stack trace of promise rejections.
1017
+ * @default true
1018
+ */
1019
+ enablePromisePatch?: boolean;
1020
+ /**
1021
+ * OTLP options for OpenTelemetry tracing. Instrumentations are enabled by default.
1022
+ */
1023
+ otel?: OtelOptions & {
1024
+ /**
1025
+ * OTLP HTTP endpoint for OpenTelemetry tracing.
1026
+ */
1027
+ otlpEndpoint?: string;
1028
+ };
1029
+ /**
1030
+ * Specifies whether to record product analytics events.
1031
+ * @default true
1032
+ */
1033
+ productAnalytics?: boolean | ProductAnalyticsEvents;
1034
+ /**
1035
+ * The time window, in milliseconds, during which repeated feature flag
1036
+ * evaluations that resolve to the same result are deduplicated, so that only
1037
+ * a single `feature_flag` exposure span is emitted per unique
1038
+ * (flag key, value, variation, reason, context) within the window.
1039
+ *
1040
+ * This is useful for reducing exposure volume caused by frequent
1041
+ * re-evaluations (for example, React re-renders).
1042
+ *
1043
+ * Set to `0` (the default) to disable deduplication and emit an exposure
1044
+ * for every evaluation. Set a positive value to enable it.
1045
+ *
1046
+ * @default 0 (disabled)
1047
+ */
1048
+ flagExposureDedupeWindowMillis?: number;
1049
+ /**
1050
+ * The maximum number of unique feature flag exposure keys tracked for
1051
+ * deduplication at once. When exceeded, the least recently recorded keys are
1052
+ * evicted to bound memory usage.
1053
+ *
1054
+ * @default 2000
1055
+ */
1056
+ flagExposureDedupeMaxSize?: number;
1057
+ };
1058
+
1059
+ declare type OtelInstrumentatonOptions = {
1060
+ '@opentelemetry/instrumentation-document-load'?: false;
1061
+ '@opentelemetry/instrumentation-fetch'?: false;
1062
+ '@opentelemetry/instrumentation-xml-http-request'?: false;
1063
+ '@opentelemetry/instrumentation-user-interaction'?: false;
1064
+ };
1065
+
1066
+ declare type OtelOptions = {
1067
+ instrumentations?: OtelInstrumentatonOptions;
1068
+ };
1069
+
1070
+ declare class Plugin_2<T extends RecordOptions | ObserveOptions> {
1071
+ protected sessionSecureID: string;
1072
+ constructor(options?: T);
1073
+ configureSession(ldCredential: string, options?: T): void;
1074
+ }
1075
+
1076
+ declare type pluginEvent<T = unknown> = {
1077
+ type: EventType.Plugin;
1078
+ data: {
1079
+ plugin: string;
1080
+ payload: T;
1081
+ };
1082
+ };
1083
+
1084
+ declare enum PointerTypes {
1085
+ Mouse = 0,
1086
+ Pen = 1,
1087
+ Touch = 2
1088
+ }
1089
+
1090
+ declare type PrivacySettingOption = 'strict' | 'default' | 'none';
1091
+
1092
+ declare type ProductAnalyticsEvents = {
1093
+ /**
1094
+ * Specifies whether to record product analytics for clicks.
1095
+ * Requires the use of the @opentelemetry/instrumentation-user-interaction instrumentation.
1096
+ * @default true
1097
+ */
1098
+ clicks?: boolean;
1099
+ /**
1100
+ * Specifies whether to record product analytics for page views.
1101
+ * Requires the use of the @opentelemetry/instrumentation-document-load instrumentation.
1102
+ * @default true
1103
+ */
1104
+ pageViews?: boolean;
1105
+ /**
1106
+ * Specifies whether to record product analytics for custom events.
1107
+ * @default true
1108
+ */
1109
+ trackEvents?: boolean;
1110
+ };
1111
+
1112
+ declare type PropertiesMessage = {
1113
+ type: MessageType.Properties;
1114
+ propertiesObject: any;
1115
+ propertyType?: PropertyType;
1116
+ };
1117
+
1118
+ declare type PropertyType = {
1119
+ type?: 'track' | 'session';
1120
+ source?: Source;
1121
+ };
1122
+
1123
+ declare type PushSessionEventsMutationVariables = Exact<{
1124
+ session_secure_id: Scalars['String']['input'];
1125
+ payload_id: Scalars['Int64ID']['input'];
1126
+ data: Scalars['String']['input'];
1127
+ }>;
1128
+
1129
+ declare class Record_2 extends Plugin_2<RecordOptions> implements LDPlugin {
1130
+ record: RecordSDK | undefined;
1131
+ options: RecordOptions | undefined;
1132
+ constructor(options?: RecordOptions);
1133
+ private initialize;
1134
+ getMetadata(): {
1135
+ name: string;
1136
+ };
1137
+ register(client: LDClientMin, environmentMetadata: LDPluginEnvironmentMetadata): void;
1138
+ getHooks?(metadata: LDPluginEnvironmentMetadata): Hook[];
1139
+ }
1140
+ export { Record_2 as Record }
1141
+
1142
+ declare interface Record_3 {
1143
+ /**
1144
+ * Start the session when running in `manualStart` mode.
1145
+ * Can be used to force start a new session.
1146
+ * @param options the session start options.
1147
+ */
1148
+ start: (options?: StartOptions) => Promise<void>;
1149
+ /**
1150
+ * Stop the session recording.
1151
+ */
1152
+ stop: () => void;
1153
+ /**
1154
+ * Add custom session-level properties. These are attached to the current session
1155
+ * and are searchable, but do not create timeline Track events.
1156
+ */
1157
+ addSessionProperties: (properties: {
1158
+ [key: string]: any;
1159
+ }) => void;
1160
+ /**
1161
+ * Snapshot an HTML <canvas> element in WebGL manual snapshotting mode.
1162
+ * See {@link https://www.highlight.io/docs/getting-started/browser/replay-configuration/canvas#manual-snapshotting}
1163
+ * for more information.
1164
+ */
1165
+ snapshot: (element: HTMLCanvasElement) => Promise<void>;
1166
+ getSession: () => SessionDetails | null;
1167
+ getRecordingState: () => 'NotRecording' | 'Recording';
1168
+ register(client: LDClientMin, environmentMetadata: LDPluginEnvironmentMetadata): void;
1169
+ getHooks?(metadata: LDPluginEnvironmentMetadata): Hook[];
1170
+ }
1171
+
1172
+ declare interface RecordMetric {
1173
+ name: string;
1174
+ value: number;
1175
+ /** UCUM / OTel unit for the instrument (e.g. `ms`, `By`). */
1176
+ unit?: string;
1177
+ category?: MetricCategory;
1178
+ group?: string;
1179
+ tags?: {
1180
+ name: string;
1181
+ value: string;
1182
+ }[];
1183
+ }
1184
+
1185
+ declare type RecordOptions = CommonOptions & {
1186
+ /**
1187
+ * Specifies where the backend of the app lives. If specified, the SDK will attach the
1188
+ * traceparent header to outgoing requests whose destination URLs match a substring
1189
+ * or regexp from this list, so that backend errors can be linked back to the session.
1190
+ * If 'true' is specified, all requests to the current domain will be matched.
1191
+ * @example tracingOrigins: ['localhost', /^\//, 'backend.myapp.com']
1192
+ */
1193
+ tracingOrigins?: boolean | (string | RegExp)[];
1194
+ /**
1195
+ * If set, the SDK will not record when your app is not visible (in the background).
1196
+ * By default, the SDK will record in the background.
1197
+ * @default false
1198
+ */
1199
+ disableBackgroundRecording?: boolean;
1200
+ enableSegmentIntegration?: boolean;
1201
+ /**
1202
+ * Specifies the environment your application is running in.
1203
+ * This is useful to distinguish whether your session was recorded on localhost or in production.
1204
+ * @default 'production'
1205
+ */
1206
+ environment?: 'development' | 'staging' | 'production' | string;
1207
+ /**
1208
+ * Specifies how much data the SDK should redact during recording.
1209
+ * strict - the SDK will redact all text data, input fields, images and videos on the page.
1210
+ * default - the SDK will redact text data on the page that resembles PII (based on regex patterns).
1211
+ * none - the SDK will not redact any text data on the page.
1212
+ * // Redacted text will be randomized. Instead of seeing "Hello World" in a recording, you will see "1fds1 j59a0".
1213
+ * @see {@link https://launchdarkly.com/docs/sdk/features/session-replay-config#privacy} for more information.
1214
+ */
1215
+ privacySetting?: PrivacySettingOption;
1216
+ /**
1217
+ * Enable masking all <input/> elements. Only applies if privacySetting is `none`.
1218
+ */
1219
+ maskAllInputs?: boolean;
1220
+ /**
1221
+ * Customize the input element types that are masked. Only applies if privacySetting is `none`.
1222
+ */
1223
+ maskInputOptions?: MaskInputOptions;
1224
+ /**
1225
+ * Customize which elements' text should be masked by specifying a CSS class name or RegExp.
1226
+ * Default class is 'highlight-mask'.
1227
+ */
1228
+ maskTextClass?: string | RegExp;
1229
+ /**
1230
+ * Customize which elements' text should be masked via a CSS selector that will match the element
1231
+ * and its descendants.
1232
+ */
1233
+ maskTextSelector?: string;
1234
+ /**
1235
+ * Customize which elements should be blocked (not recorded) by specifying a class name or RegExp.
1236
+ * Default is 'highlight-block'.
1237
+ */
1238
+ blockClass?: string | RegExp;
1239
+ /**
1240
+ * Customize which elements should be blocked via a CSS selector.
1241
+ */
1242
+ blockSelector?: string;
1243
+ /**
1244
+ * Customize which elements and their descendants should be ignored from DOM events by class.
1245
+ * Default is 'highlight-ignore'.
1246
+ */
1247
+ ignoreClass?: string;
1248
+ /**
1249
+ * Customize which elements should be ignored from DOM events via a CSS selector.
1250
+ */
1251
+ ignoreSelector?: string;
1252
+ /**
1253
+ * Specifies whether to record canvas elements or not.
1254
+ * @default false
1255
+ */
1256
+ enableCanvasRecording?: boolean;
1257
+ /**
1258
+ * Configure the recording sampling options, eg. how frequently we record canvas updates.
1259
+ */
1260
+ samplingStrategy?: SamplingStrategy;
1261
+ /**
1262
+ * Specifies whether to inline images into the recording.
1263
+ * This means that images that are local to the client (eg. client-generated blob: urls)
1264
+ * will be serialized into the recording and will be valid on replay.
1265
+ * This will also use canvas snapshotting to inline <video> elements
1266
+ * that use `src="blob:..."` data or webcam feeds (blank src) as <canvas> elements
1267
+ * Only enable this if you are running into issues with client-local images.
1268
+ * Will negatively affect performance.
1269
+ * @default false
1270
+ */
1271
+ inlineImages?: boolean;
1272
+ /**
1273
+ * Specifies whether to inline <video> elements into the recording.
1274
+ * This means that video that are not accessible at a later time
1275
+ * (eg., a signed URL that is short lived)
1276
+ * will be serialized into the recording and will be valid on replay.
1277
+ * Only enable this if you are running into issues with the normal serialization.
1278
+ * Will negatively affect performance.
1279
+ * @default false
1280
+ */
1281
+ inlineVideos?: boolean;
1282
+ /**
1283
+ * Specifies whether to inline stylesheets into the recording.
1284
+ * This means that stylesheets that are local to the client (eg. client-generated blob: urls)
1285
+ * will be serialized into the recording and will be valid on replay.
1286
+ * Only enable this if you are running into issues with client-local stylesheets.
1287
+ * May negatively affect performance.
1288
+ * @default true
1289
+ */
1290
+ inlineStylesheet?: boolean;
1291
+ /**
1292
+ * How often, in milliseconds, session replay checks that its CSSOM patches
1293
+ * are still installed and re-sends CSS-in-JS rules another script on the
1294
+ * page may have caused it to miss. Set to 0 to disable. Lower values recover
1295
+ * styles faster; each check walks every stylesheet on the page.
1296
+ * @default 2000
1297
+ */
1298
+ styleSheetResyncInterval?: number;
1299
+ /**
1300
+ * Enables recording of cross-origin iframes. Should be set in both the parent window and
1301
+ * in the cross-origin iframe.
1302
+ * @default false
1303
+ */
1304
+ recordCrossOriginIframe?: boolean;
1305
+ integrations?: IntegrationOptions;
1306
+ /**
1307
+ * Specifies the keyboard shortcut to open the current session replay.
1308
+ * @see {@link https://launchdarkly.com/docs/sdk/features/session-replay-config#retrieve-session-urls-on-the-client} for more information.
1309
+ */
1310
+ sessionShortcut?: SessionShortcutOptions;
1311
+ /**
1312
+ * By default, data is serialized and send by the Web Worker. Set to `local` to force
1313
+ * sending from the main js thread. Only use `local` for custom environments where Web Workers
1314
+ * are not available (ie. Figma plugins).
1315
+ */
1316
+ sendMode?: 'webworker' | 'local';
1317
+ };
1318
+
1319
+ declare class RecordSDK implements Record_3 {
1320
+ #private;
1321
+ options: HighlightClassOptions;
1322
+ /** Determines if the client is running on a Highlight property (e.g. frontend). */
1323
+ isRunningOnHighlight: boolean;
1324
+ /** Verbose project ID that is exposed to users. Legacy users may still be using ints. */
1325
+ organizationID: string;
1326
+ events: eventWithTime[];
1327
+ sessionData: SessionData;
1328
+ ready: boolean;
1329
+ manualStopped: boolean;
1330
+ state: 'NotRecording' | 'Recording';
1331
+ logger: Logger;
1332
+ enableSegmentIntegration: boolean;
1333
+ privacySetting: PrivacySettingOption;
1334
+ enableCanvasRecording: boolean;
1335
+ samplingStrategy: SamplingStrategy;
1336
+ inlineImages: boolean;
1337
+ inlineVideos: boolean;
1338
+ inlineStylesheet: boolean;
1339
+ styleSheetResyncInterval: number;
1340
+ debugOptions: DebugOptions;
1341
+ listeners: listenerHandler[];
1342
+ firstloadVersion: string;
1343
+ environment: string;
1344
+ sessionShortcut: SessionShortcutOptions;
1345
+ /** The end-user's app version. This isn't Highlight's version. */
1346
+ appVersion: string | undefined;
1347
+ serviceName: string;
1348
+ _worker: HighlightClientRequestWorker;
1349
+ _optionsInternal: Omit<RecordOptions, 'firstloadVersion'>;
1350
+ _backendUrl: string;
1351
+ _recordingStartTime: number;
1352
+ _isOnLocalHost: boolean;
1353
+ _onToggleFeedbackFormVisibility: () => void;
1354
+ _isCrossOriginIframe: boolean;
1355
+ _eventBytesSinceSnapshot: number;
1356
+ _lastSnapshotTime: number;
1357
+ _lastVisibilityChangeTime: number;
1358
+ pushPayloadTimerId: ReturnType<typeof setTimeout> | undefined;
1359
+ hasSessionUnloaded: boolean;
1360
+ hasPushedData: boolean;
1361
+ reloaded: boolean;
1362
+ _hasPreviouslyInitialized: boolean;
1363
+ _recordStop: listenerHandler | undefined;
1364
+ _integrations: IntegrationClient[];
1365
+ constructor(options: HighlightClassOptions);
1366
+ _reset({ forceNew, sessionKey, }: {
1367
+ forceNew?: boolean;
1368
+ sessionKey?: string;
1369
+ }): Promise<void>;
1370
+ _initMembers(options: HighlightClassOptions): void;
1371
+ identify(user_identifier: string, user_object?: {}, source?: Source): void;
1372
+ track(event: string, metadata?: Metadata_2): void;
1373
+ addProperties(properties_obj?: {}, typeArg?: PropertyType): void;
1374
+ /**
1375
+ * Add custom session-level properties. These are attached to the current session
1376
+ * and are searchable, but do not create timeline Track events.
1377
+ */
1378
+ addSessionProperties(properties: {
1379
+ [key: string]: any;
1380
+ }): void;
1381
+ start(options?: StartOptions): Promise<void>;
1382
+ _visibilityHandler(hidden: boolean): Promise<void>;
1383
+ _setupCrossOriginIframe(): Promise<void>;
1384
+ _setupCrossOriginIframeParent(): void;
1385
+ _setupWindowListeners(): void;
1386
+ /**
1387
+ * Stops Highlight from recording.
1388
+ * @param manual The end user requested to stop recording.
1389
+ */
1390
+ stop(manual?: boolean): void;
1391
+ /**
1392
+ * Returns the current timestamp for the current session.
1393
+ */
1394
+ getCurrentSessionURLWithTimestamp(): string;
1395
+ getCurrentSessionURL(): string | null;
1396
+ snapshot(element: HTMLCanvasElement): Promise<void>;
1397
+ addSessionFeedback({ timestamp, verbatim, user_email, user_name, }: {
1398
+ verbatim: string;
1399
+ timestamp: string;
1400
+ user_name?: string;
1401
+ user_email?: string;
1402
+ }): void;
1403
+ _save(): Promise<void>;
1404
+ /**
1405
+ * This proxy should be used instead of rrweb's native addCustomEvent.
1406
+ * The proxy makes sure recording has started before emitting a custom event.
1407
+ */
1408
+ addCustomEvent<T>(tag: string, payload: T): void;
1409
+ _sendPayload({ sendFn, }: {
1410
+ sendFn?: (payload: PushSessionEventsMutationVariables) => Promise<number>;
1411
+ }): Promise<void>;
1412
+ private takeFullSnapshot;
1413
+ register(client: LDClientMin, metadata: LDPluginEnvironmentMetadata): void;
1414
+ getHooks(metadata: LDPluginEnvironmentMetadata): Hook[];
1415
+ getRecordingState(): "NotRecording" | "Recording";
1416
+ getSession(): SessionDetails | null;
1417
+ private getFrontendUrl;
1418
+ }
1419
+
1420
+ declare type removedNodeMutation = {
1421
+ parentId: number;
1422
+ id: number;
1423
+ isShadow?: boolean;
1424
+ };
1425
+
1426
+ declare interface Request_2 {
1427
+ sessionSecureID: string;
1428
+ id: string;
1429
+ url: string;
1430
+ verb: string;
1431
+ headers?: Headers_2;
1432
+ body: any;
1433
+ }
1434
+
1435
+ declare interface RequestResponsePair {
1436
+ request: Request_2;
1437
+ response: Response_2;
1438
+ /** Whether this URL matched a `urlToBlock` so the contents should not be recorded. */
1439
+ urlBlocked: boolean;
1440
+ }
1441
+
1442
+ declare type ResetMessage = {
1443
+ type: MessageType.Reset;
1444
+ };
1445
+
1446
+ declare interface Response_2 {
1447
+ status: number;
1448
+ headers?: {
1449
+ [k: string]: string;
1450
+ };
1451
+ body: any;
1452
+ /** Number of Bytes transferred over the network. */
1453
+ size?: number;
1454
+ }
1455
+
1456
+ declare type SamplingStrategy = {
1457
+ /**
1458
+ * 'all' will record every single canvas call.
1459
+ * a number will record an image snapshots in a web-worker a (maximum) number of times per second.
1460
+ * Number is only supported where [`OffscreenCanvas`](http://mdn.io/offscreencanvas) is supported.
1461
+ */
1462
+ canvas?: 'all' | number;
1463
+ /**
1464
+ * For manual usage of `H.snapshot(element) from your canvas rendering function.
1465
+ * See https://www.highlight.io/docs/getting-started/client-sdk/replay-configuration/canvas for setup.`
1466
+ * a number will record an image snapshots in a web-worker a (maximum) number of times per second.
1467
+ */
1468
+ canvasManualSnapshot?: number;
1469
+ /**
1470
+ * A quality at which to take canvas snapshots. See https://developer.mozilla.org/en-US/docs/Web/API/createImageBitmap
1471
+ * @deprecated This value is no longer used.
1472
+ */
1473
+ canvasQuality?: 'pixelated' | 'low' | 'medium' | 'high';
1474
+ /**
1475
+ * A multiplier resolution at which to take canvas snapshots.
1476
+ */
1477
+ canvasFactor?: number;
1478
+ /**
1479
+ * The maximum dimension to take canvas snapshots at.
1480
+ * This setting takes precedence over resizeFactor if the resulting image size
1481
+ * from the resizeFactor calculation is larger than this value.
1482
+ * Eg: set to 600 to ensure that the canvas is saved with images no larger than 600px
1483
+ * in either dimension (while preserving the original canvas aspect ratio).
1484
+ */
1485
+ canvasMaxSnapshotDimension?: number;
1486
+ /**
1487
+ * Default behavior for WebGL canvas elements with `preserveDrawingBuffer: false` is to clear the buffer to
1488
+ * load the canvas into memory to avoid getting a transparent bitmap.
1489
+ * Set to false to disable the clearing (in case there are visual glitches in the canvas).
1490
+ */
1491
+ canvasClearWebGLBuffer?: boolean;
1492
+ /**
1493
+ * Time (in milliseconds) to wait before the initial snapshot of canvas/video elements.
1494
+ */
1495
+ canvasInitialSnapshotDelay?: number;
1496
+ /**
1497
+ * Settings for canvas data serialization. Defaults to {"image/webp", 0.9} for browsers
1498
+ * that support WebP and {"image/jpeg", 0.6} for others. Can be overridden to any type
1499
+ * or quality value supported by [`toDataURL`](http://mdn.io/toDataURL).
1500
+ */
1501
+ dataUrlOptions?: Partial<{
1502
+ type: string;
1503
+ quality: number;
1504
+ }>;
1505
+ };
1506
+
1507
+ /** All built-in and custom scalars, mapped to their actual values */
1508
+ declare type Scalars = {
1509
+ ID: {
1510
+ input: string;
1511
+ output: string;
1512
+ };
1513
+ String: {
1514
+ input: string;
1515
+ output: string;
1516
+ };
1517
+ Boolean: {
1518
+ input: boolean;
1519
+ output: boolean;
1520
+ };
1521
+ Int: {
1522
+ input: number;
1523
+ output: number;
1524
+ };
1525
+ Float: {
1526
+ input: number;
1527
+ output: number;
1528
+ };
1529
+ Any: {
1530
+ input: any;
1531
+ output: any;
1532
+ };
1533
+ Int64: {
1534
+ input: any;
1535
+ output: any;
1536
+ };
1537
+ Int64ID: {
1538
+ input: any;
1539
+ output: any;
1540
+ };
1541
+ Timestamp: {
1542
+ input: any;
1543
+ output: any;
1544
+ };
1545
+ };
1546
+
1547
+ declare type scrollData = {
1548
+ source: IncrementalSource.Scroll;
1549
+ } & scrollPosition;
1550
+
1551
+ declare type scrollPosition = {
1552
+ id: number;
1553
+ x: number;
1554
+ y: number;
1555
+ };
1556
+
1557
+ declare type selectionData = {
1558
+ source: IncrementalSource.Selection;
1559
+ } & selectionParam;
1560
+
1561
+ declare type selectionParam = {
1562
+ ranges: Array<SelectionRange>;
1563
+ };
1564
+
1565
+ declare type SelectionRange = {
1566
+ start: number;
1567
+ startOffset: number;
1568
+ end: number;
1569
+ endOffset: number;
1570
+ };
1571
+
1572
+ declare type SerializedBlobArg = {
1573
+ rr_type: 'Blob';
1574
+ data: Array<CanvasArg>;
1575
+ type?: string;
1576
+ };
1577
+
1578
+ declare type SerializedCanvasArg = {
1579
+ rr_type: 'ArrayBuffer';
1580
+ base64: string;
1581
+ } | SerializedBlobArg | {
1582
+ rr_type: string;
1583
+ src: string;
1584
+ } | {
1585
+ rr_type: string;
1586
+ args: Array<CanvasArg>;
1587
+ } | {
1588
+ rr_type: string;
1589
+ index: number;
1590
+ };
1591
+
1592
+ declare type SerializedCssTextArg = {
1593
+ rr_type: 'CssText';
1594
+ cssTexts: string[];
1595
+ };
1596
+
1597
+ declare type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & {
1598
+ rootId?: number;
1599
+ isShadowHost?: boolean;
1600
+ isShadow?: boolean;
1601
+ };
1602
+
1603
+ declare type serializedNodeWithId = serializedNode & {
1604
+ id: number;
1605
+ };
1606
+
1607
+ declare type SessionData = {
1608
+ sessionSecureID: string;
1609
+ sessionKey?: string;
1610
+ projectID: number;
1611
+ sessionStartTime?: number;
1612
+ lastPushTime?: number;
1613
+ userIdentifier?: string;
1614
+ userObject?: Object;
1615
+ };
1616
+
1617
+ declare interface SessionDetails {
1618
+ /** The URL to view the session. */
1619
+ url: string;
1620
+ /** The URL to view the session at the time getSessionDetails was called during the session recording. */
1621
+ urlWithTimestamp: string;
1622
+ /** The secure ID of the session. */
1623
+ sessionSecureID: string;
1624
+ }
1625
+
1626
+ declare type SessionShortcutOptions = false | string;
1627
+
1628
+ declare type Source = 'segment' | 'LaunchDarkly' | undefined;
1629
+
1630
+ declare interface StartOptions {
1631
+ /**
1632
+ * Specifies whether console warn messages should not be created.
1633
+ */
1634
+ silent?: boolean;
1635
+ /**
1636
+ * Starts a new recording session even if one was stopped recently.
1637
+ */
1638
+ forceNew?: boolean;
1639
+ /**
1640
+ * Key to use to determine the sessionSecureID in order to override session generation logic.
1641
+ * If a sessionKey is provided, the session will be combined with the previous session with the same key.
1642
+ * Otherwise, the current session logic will be used to generate a sessionSecureID.
1643
+ */
1644
+ sessionKey?: string;
1645
+ }
1646
+
1647
+ declare type StatusResponse = {
1648
+ type: MessageType.GetStatus;
1649
+ pendingCount: number;
1650
+ initialized: boolean;
1651
+ };
1652
+
1653
+ declare type StopEventResponse = {
1654
+ type: MessageType.Stop;
1655
+ requestStart: number;
1656
+ asyncEventsResponse: AsyncEventsResponse;
1657
+ };
1658
+
1659
+ declare type styleDeclarationData = {
1660
+ source: IncrementalSource.StyleDeclaration;
1661
+ } & styleDeclarationParam;
1662
+
1663
+ declare type styleDeclarationParam = {
1664
+ id?: number;
1665
+ styleId?: number;
1666
+ index: number[];
1667
+ set?: {
1668
+ property: string;
1669
+ value: string | null;
1670
+ priority: string | undefined;
1671
+ };
1672
+ remove?: {
1673
+ property: string;
1674
+ };
1675
+ };
1676
+
1677
+ declare type styleOMValue = {
1678
+ [key: string]: styleValueWithPriority | string | false;
1679
+ };
1680
+
1681
+ declare type styleSheetAddRule = {
1682
+ rule: string;
1683
+ index?: number | number[];
1684
+ };
1685
+
1686
+ declare type styleSheetDeleteRule = {
1687
+ index: number | number[];
1688
+ };
1689
+
1690
+ declare type styleSheetRuleData = {
1691
+ source: IncrementalSource.StyleSheetRule;
1692
+ } & styleSheetRuleParam;
1693
+
1694
+ declare type styleSheetRuleParam = {
1695
+ id?: number;
1696
+ styleId?: number;
1697
+ removes?: styleSheetDeleteRule[];
1698
+ adds?: styleSheetAddRule[];
1699
+ replace?: string;
1700
+ replaceSync?: string;
1701
+ };
1702
+
1703
+ declare type styleValueWithPriority = [string, string];
1704
+
1705
+ declare type textMutation = {
1706
+ id: number;
1707
+ value: string | null;
1708
+ };
1709
+
1710
+ declare type textNode = {
1711
+ type: NodeType.Text;
1712
+ textContent: string;
1713
+ isStyle?: true;
1714
+ };
1715
+
1716
+ declare type viewportResizeData = {
1717
+ source: IncrementalSource.ViewportResize;
1718
+ } & viewportResizeDimension;
1719
+
1720
+ declare type viewportResizeDimension = {
1721
+ width: number;
1722
+ height: number;
1723
+ };
1724
+
1725
+ export { }