@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,2772 @@
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
+ export declare const __testing: {
12
+ reset: () => void;
13
+ setHighlightObj: (obj: Partial<Highlight_2>) => void;
14
+ };
15
+
16
+ declare type addedNodeMutation = {
17
+ parentId: number;
18
+ previousId?: number | null;
19
+ nextId: number | null;
20
+ node: serializedNodeWithId;
21
+ };
22
+
23
+ declare type adoptedStyleSheetData = {
24
+ source: IncrementalSource.AdoptedStyleSheet;
25
+ } & adoptedStyleSheetParam;
26
+
27
+ declare type adoptedStyleSheetParam = {
28
+ id: number;
29
+ styles?: {
30
+ styleId: number;
31
+ rules: styleSheetAddRule[];
32
+ }[];
33
+ styleIds: number[];
34
+ };
35
+
36
+ declare const ALL_CONSOLE_METHODS: readonly ["assert", "count", "countReset", "debug", "dir", "dirxml", "error", "group", "groupCollapsed", "groupEnd", "info", "log", "table", "time", "timeEnd", "timeLog", "trace", "warn"];
37
+
38
+ declare interface AmplitudeIntegrationOptions extends DefaultIntegrationOptions {
39
+ apiKey?: string;
40
+ }
41
+
42
+ declare type assetEvent = {
43
+ type: EventType.Asset;
44
+ data: assetParam;
45
+ };
46
+
47
+ declare type assetParam = {
48
+ url: string;
49
+ payload: SerializedCanvasArg | SerializedCssTextArg;
50
+ timestamp?: number;
51
+ } | {
52
+ url: string;
53
+ failed: {
54
+ status?: number;
55
+ message: string;
56
+ };
57
+ };
58
+
59
+ declare type AsyncEventsMessage = {
60
+ type: MessageType.AsyncEvents;
61
+ id: number;
62
+ hasSessionUnloaded: boolean;
63
+ highlightLogs: string;
64
+ events: eventWithTime[];
65
+ messages: ConsoleMessage[];
66
+ errors: ErrorMessage[];
67
+ resourcesString: string;
68
+ webSocketEventsString: string;
69
+ };
70
+
71
+ declare type AsyncEventsResponse = {
72
+ type: MessageType.AsyncEvents;
73
+ id: number;
74
+ eventsSize: number;
75
+ compressedSize: number;
76
+ };
77
+
78
+ declare type attributeMutation = {
79
+ id: number;
80
+ attributes: {
81
+ [key: string]: string | styleOMValue | null;
82
+ };
83
+ };
84
+
85
+ /**
86
+ * Attributes is a map from string to attribute values.
87
+ *
88
+ * Note: only the own enumerable keys are counted as valid attribute keys.
89
+ */
90
+ declare interface Attributes {
91
+ [attributeKey: string]: AttributeValue | undefined;
92
+ }
93
+
94
+ declare type attributes = cssTextKeyAttr & {
95
+ [key: string]: string | number | true | null;
96
+ };
97
+
98
+ /**
99
+ * Attribute values may be any non-nullish primitive value except an object.
100
+ *
101
+ * null or undefined attribute values are invalid and will result in undefined behavior.
102
+ */
103
+ declare type AttributeValue = string | number | boolean | Array<null | undefined | string> | Array<null | undefined | number> | Array<null | undefined | boolean>;
104
+
105
+ declare class BufferedClass<T extends object> {
106
+ protected _sdk: T;
107
+ protected _isLoaded: boolean;
108
+ protected _callBuffer: Array<Event_2>;
109
+ protected _capacity: number;
110
+ protected _droppedEvents: number;
111
+ protected _exceededCapacity: boolean;
112
+ protected _logger: Logger;
113
+ protected _bufferCall(method: string, args: any[]): any;
114
+ protected _enqueue(event: Event_2): void;
115
+ load(sdk: T): void;
116
+ }
117
+
118
+ declare type CanvasArg = SerializedCanvasArg | string | number | boolean | null | CanvasArg[];
119
+
120
+ declare enum CanvasContext {
121
+ '2D' = 0,
122
+ WebGL = 1,
123
+ WebGL2 = 2
124
+ }
125
+
126
+ declare type canvasMutationCommand = {
127
+ property: string;
128
+ args: Array<unknown>;
129
+ setter?: true;
130
+ };
131
+
132
+ declare type canvasMutationData = {
133
+ source: IncrementalSource.CanvasMutation;
134
+ } & canvasMutationParam;
135
+
136
+ declare type canvasMutationParam = {
137
+ id: number;
138
+ type: CanvasContext;
139
+ commands: canvasMutationCommand[];
140
+ } | ({
141
+ id: number;
142
+ type: CanvasContext;
143
+ } & canvasMutationCommand);
144
+
145
+ declare type cdataNode = {
146
+ type: NodeType.CDATA;
147
+ textContent: '';
148
+ };
149
+
150
+ declare type commentNode = {
151
+ type: NodeType.Comment;
152
+ textContent: string;
153
+ };
154
+
155
+ declare type CommonOptions = {
156
+ /**
157
+ * Do not use this.
158
+ * @private
159
+ */
160
+ debug?: boolean | DebugOptions;
161
+ /**
162
+ * Specifies the name of the app.
163
+ */
164
+ serviceName?: string;
165
+ /**
166
+ * Specifies the version of your application.
167
+ * This is commonly a Git hash or a semantic version.
168
+ */
169
+ version?: string;
170
+ /**
171
+ * Specifies where to send Highlight session data.
172
+ * You should not have to set this unless you are running an on-premise instance.
173
+ */
174
+ backendUrl?: string;
175
+ /**
176
+ * Set to `sessionStorage` to bypass all `window.localStorage` usage.
177
+ * This can help with compliance for cookie-consent regulation.
178
+ * Using `sessionStorage` will cause app close+reopens to start a new highlight session,
179
+ * as the session ID will not persist.
180
+ */
181
+ storageMode?: 'sessionStorage' | 'localStorage';
182
+ /**
183
+ * By default, session data is stored in the `sessionStorage` of the browser.
184
+ * Set to `true` to store session data in a cookie instead.
185
+ * This can help with compliance for cookie-consent regulation.
186
+ */
187
+ sessionCookie?: boolean;
188
+ /**
189
+ * Specifies if Highlight should not automatically initialize when the class is created.
190
+ * This should be used with `.start()` and `.stop()` if you want to control when Highlight records.
191
+ * @default false
192
+ */
193
+ manualStart?: boolean;
194
+ /**
195
+ * Key to use to determine the sessionSecureID in order to override session generation logic.
196
+ * If a sessionKey is provided, the session will be combined with the previous session with the same key.
197
+ * Otherwise, the current session logic will be used to generate a sessionSecureID.
198
+ */
199
+ sessionKey?: string;
200
+ /**
201
+ * A function that returns a friendly name for a given context.
202
+ * This name will be used to identify the session in the observability UI.
203
+ * ```ts
204
+ * contextFriendlyName: (context: LDContext) => {
205
+ * if(context.kind === 'multi' && context.user?.email) {
206
+ * return context.user.email;
207
+ * } else if(context.kind === 'user') {
208
+ * return context.key;
209
+ * }
210
+ * // Use the default identifier for contexts which don't contain a user.
211
+ * return undefined;
212
+ * }
213
+ * ```
214
+ * @param context The context to get a friendly name for.
215
+ * @returns The friendly name for the context, or undefined to use the
216
+ * default identifier.
217
+ */
218
+ contextFriendlyName?: (context: LDContext) => string | undefined;
219
+ };
220
+
221
+ export declare function configureElectronHighlight(window: any): void;
222
+
223
+ declare type ConsoleMessage = {
224
+ value?: Array<string>;
225
+ attributes?: string;
226
+ time: number;
227
+ type: string;
228
+ trace?: StackFrame[];
229
+ };
230
+
231
+ declare type ConsoleMethods = ConsoleMethodsTuple[number];
232
+
233
+ declare type ConsoleMethodsTuple = typeof ALL_CONSOLE_METHODS;
234
+
235
+ declare interface Context {
236
+ /**
237
+ * Get a value from the context.
238
+ *
239
+ * @param key key which identifies a context value
240
+ */
241
+ getValue(key: symbol): unknown;
242
+ /**
243
+ * Create a new context which inherits from this context and has
244
+ * the given key set to the given value.
245
+ *
246
+ * @param key context key for which to set the value
247
+ * @param value value to set for the given key
248
+ */
249
+ setValue(key: symbol, value: unknown): Context;
250
+ /**
251
+ * Return a new context which inherits from this context but does
252
+ * not contain a value for the given key.
253
+ *
254
+ * @param key context key for which to clear a value
255
+ */
256
+ deleteValue(key: symbol): Context;
257
+ }
258
+
259
+ /**
260
+ * Counter is the most common synchronous instrument. This instrument supports
261
+ * an `Add(increment)` function for reporting a sum, and is restricted to
262
+ * non-negative increments. The default aggregation is Sum, as for any additive
263
+ * instrument.
264
+ *
265
+ * Example uses for Counter:
266
+ * <ol>
267
+ * <li> count the number of bytes received. </li>
268
+ * <li> count the number of requests completed. </li>
269
+ * <li> count the number of accounts created. </li>
270
+ * <li> count the number of checkpoints run. </li>
271
+ * <li> count the number of 5xx errors. </li>
272
+ * <ol>
273
+ */
274
+ declare interface Counter<AttributesTypes extends MetricAttributes = MetricAttributes> {
275
+ /**
276
+ * Increment value of counter by the input. Inputs must not be negative.
277
+ */
278
+ add(value: number, attributes?: AttributesTypes, context?: Context): void;
279
+ }
280
+
281
+ declare type cssTextKeyAttr = {
282
+ _cssText?: string;
283
+ };
284
+
285
+ declare type customElementData = {
286
+ source: IncrementalSource.CustomElement;
287
+ } & customElementParam;
288
+
289
+ declare type customElementParam = {
290
+ define?: {
291
+ name: string;
292
+ };
293
+ };
294
+
295
+ declare type customEvent<T = unknown> = {
296
+ type: EventType.Custom;
297
+ data: {
298
+ tag: string;
299
+ payload: T;
300
+ };
301
+ };
302
+
303
+ declare type CustomEventResponse = {
304
+ type: MessageType.CustomEvent;
305
+ tag: string;
306
+ payload: any;
307
+ };
308
+
309
+ declare type DebugOptions = {
310
+ clientInteractions?: boolean;
311
+ domRecording?: boolean;
312
+ };
313
+
314
+ declare type DefaultIntegrationOptions = {
315
+ disabled?: boolean;
316
+ };
317
+
318
+ declare type documentNode = {
319
+ type: NodeType.Document;
320
+ childNodes: serializedNodeWithId[];
321
+ compatMode?: string;
322
+ };
323
+
324
+ declare type documentTypeNode = {
325
+ type: NodeType.DocumentType;
326
+ name: string;
327
+ publicId: string;
328
+ systemId: string;
329
+ };
330
+
331
+ declare type domContentLoadedEvent = {
332
+ type: EventType.DomContentLoaded;
333
+ data: unknown;
334
+ };
335
+
336
+ declare type elementNode = {
337
+ type: NodeType.Element;
338
+ tagName: string;
339
+ attributes: attributes;
340
+ childNodes: serializedNodeWithId[];
341
+ isSVG?: true;
342
+ needBlock?: boolean;
343
+ needMask?: boolean;
344
+ isCustom?: true;
345
+ };
346
+
347
+ declare type ErrorMessage = {
348
+ event: string;
349
+ type: ErrorMessageType;
350
+ url: string;
351
+ source: string;
352
+ lineNumber: number;
353
+ columnNumber: number;
354
+ stackTrace: StackFrame[];
355
+ /** The Unix Time of when the error was thrown. */
356
+ timestamp: string;
357
+ payload?: string;
358
+ error?: Error;
359
+ id: string;
360
+ };
361
+
362
+ declare type ErrorMessageType = 'console.error' | 'window.onerror' | 'window.onunhandledrejection' | 'custom' | 'React.ErrorBoundary';
363
+
364
+ declare type Event_2 = {
365
+ method: string;
366
+ args: any[];
367
+ };
368
+
369
+ declare enum EventType {
370
+ DomContentLoaded = 0,
371
+ Load = 1,
372
+ FullSnapshot = 2,
373
+ IncrementalSnapshot = 3,
374
+ Meta = 4,
375
+ Custom = 5,
376
+ Plugin = 6,
377
+ Asset = 7
378
+ }
379
+
380
+ declare type eventWithoutTime = domContentLoadedEvent | loadedEvent | fullSnapshotEvent | incrementalSnapshotEvent | metaEvent | customEvent | pluginEvent | assetEvent;
381
+
382
+ declare type eventWithTime = eventWithoutTime & {
383
+ timestamp: number;
384
+ delay?: number;
385
+ };
386
+
387
+ declare type Exact<T extends {
388
+ [key: string]: unknown;
389
+ }> = {
390
+ [K in keyof T]: T[K];
391
+ };
392
+
393
+ /**
394
+ * Defines Exception.
395
+ *
396
+ * string or an object with one of (message or name or code) and optional stack
397
+ */
398
+ declare type Exception = ExceptionWithCode | ExceptionWithMessage | ExceptionWithName | string;
399
+
400
+ declare interface ExceptionWithCode {
401
+ code: string | number;
402
+ name?: string;
403
+ message?: string;
404
+ stack?: string;
405
+ }
406
+
407
+ declare interface ExceptionWithMessage {
408
+ code?: string | number;
409
+ message: string;
410
+ name?: string;
411
+ stack?: string;
412
+ }
413
+
414
+ declare interface ExceptionWithName {
415
+ code?: string | number;
416
+ message?: string;
417
+ name: string;
418
+ stack?: string;
419
+ }
420
+
421
+ declare type FeedbackMessage = {
422
+ type: MessageType.Feedback;
423
+ verbatim: string;
424
+ timestamp: string;
425
+ userName?: string;
426
+ userEmail?: string;
427
+ };
428
+
429
+ declare class FirstLoadListeners {
430
+ disableConsoleRecording: boolean;
431
+ reportConsoleErrors: boolean;
432
+ enablePromisePatch: boolean;
433
+ consoleMethodsToRecord: ConsoleMethods[];
434
+ listeners: (() => void)[];
435
+ errors: ErrorMessage[];
436
+ messages: ConsoleMessage[];
437
+ options: HighlightClassOptions;
438
+ hasNetworkRecording: boolean | undefined;
439
+ disableNetworkRecording: boolean;
440
+ enableRecordingNetworkContents: boolean;
441
+ xhrNetworkContents: RequestResponsePair[];
442
+ fetchNetworkContents: RequestResponsePair[];
443
+ disableRecordingWebSocketContents: boolean;
444
+ webSocketNetworkContents: WebSocketRequest[] | undefined;
445
+ webSocketEventContents: WebSocketEvent[];
446
+ tracingOrigins: boolean | (string | RegExp)[];
447
+ networkHeadersToRedact: string[];
448
+ networkBodyKeysToRedact: string[] | undefined;
449
+ networkBodyKeysToRecord: string[] | undefined;
450
+ networkHeaderKeysToRecord: string[] | undefined;
451
+ lastNetworkRequestTimestamp: number;
452
+ urlBlocklist: string[];
453
+ highlightEndpoints: string[];
454
+ requestResponseSanitizer?: (pair: RequestResponsePair) => RequestResponsePair | null;
455
+ constructor(options: HighlightClassOptions);
456
+ isListening(): boolean;
457
+ startListening(): void;
458
+ stopListening(): void;
459
+ static setupNetworkListener(sThis: FirstLoadListeners, options: HighlightClassOptions): void;
460
+ static getRecordedNetworkResources(sThis: FirstLoadListeners, recordingStartTime: number): Array<PerformanceResourceTiming | WebSocketRequest>;
461
+ static getRecordedWebSocketEvents(sThis: FirstLoadListeners): Array<WebSocketEvent>;
462
+ static clearRecordedNetworkResources(sThis: FirstLoadListeners): void;
463
+ }
464
+
465
+ declare type fontData = {
466
+ source: IncrementalSource.Font;
467
+ } & fontParam;
468
+
469
+ declare type fontParam = {
470
+ family: string;
471
+ fontSource: string;
472
+ buffer: boolean;
473
+ descriptors?: FontFaceDescriptors;
474
+ };
475
+
476
+ declare type fullSnapshotEvent = {
477
+ type: EventType.FullSnapshot;
478
+ data: {
479
+ node: serializedNodeWithId;
480
+ initialOffset: {
481
+ top: number;
482
+ left: number;
483
+ };
484
+ };
485
+ };
486
+
487
+ declare interface Gauge<AttributesTypes extends MetricAttributes = MetricAttributes> {
488
+ /**
489
+ * Records a measurement.
490
+ */
491
+ record(value: number, attributes?: AttributesTypes, context?: Context): void;
492
+ }
493
+
494
+ export declare const GenerateSecureID: (key?: string) => string;
495
+
496
+ declare type GetStatusMessage = {
497
+ type: MessageType.GetStatus;
498
+ };
499
+
500
+ export declare const H: HighlightPublicInterface;
501
+
502
+ declare interface Headers_2 {
503
+ [key: string]: any;
504
+ }
505
+
506
+ declare class Highlight_2 {
507
+ #private;
508
+ options: HighlightClassOptions;
509
+ /** Determines if the client is running on a Highlight property (e.g. frontend). */
510
+ isRunningOnHighlight: boolean;
511
+ /** Verbose project ID that is exposed to users. Legacy users may still be using ints. */
512
+ organizationID: string;
513
+ events: eventWithTime[];
514
+ sessionData: SessionData;
515
+ ready: boolean;
516
+ manualStopped: boolean;
517
+ state: 'NotRecording' | 'Recording';
518
+ logger: Logger;
519
+ enableSegmentIntegration: boolean;
520
+ privacySetting: PrivacySettingOption;
521
+ enableCanvasRecording: boolean;
522
+ enablePerformanceRecording: boolean;
523
+ samplingStrategy: SamplingStrategy;
524
+ inlineImages: boolean;
525
+ inlineVideos: boolean;
526
+ inlineStylesheet: boolean;
527
+ styleSheetResyncInterval: number;
528
+ debugOptions: DebugOptions;
529
+ listeners: listenerHandler[];
530
+ firstloadVersion: string;
531
+ environment: string;
532
+ sessionShortcut: SessionShortcutOptions;
533
+ /** The end-user's app version. This isn't Highlight's version. */
534
+ appVersion: string | undefined;
535
+ serviceName: string;
536
+ _worker: HighlightClientRequestWorker;
537
+ _optionsInternal: HighlightClassOptionsInternal;
538
+ _backendUrl: string;
539
+ _recordingStartTime: number;
540
+ _isOnLocalHost: boolean;
541
+ _onToggleFeedbackFormVisibility: () => void;
542
+ _firstLoadListeners: FirstLoadListeners;
543
+ _isCrossOriginIframe: boolean;
544
+ _eventBytesSinceSnapshot: number;
545
+ _lastSnapshotTime: number;
546
+ _lastVisibilityChangeTime: number;
547
+ pushPayloadTimerId: ReturnType<typeof setTimeout> | undefined;
548
+ hasSessionUnloaded: boolean;
549
+ hasPushedData: boolean;
550
+ reloaded: boolean;
551
+ _hasPreviouslyInitialized: boolean;
552
+ _recordStop: listenerHandler | undefined;
553
+ _gauges: Map<string, Gauge>;
554
+ _counters: Map<string, Counter>;
555
+ _histograms: Map<string, Histogram>;
556
+ _up_down_counters: Map<string, UpDownCounter>;
557
+ _integrations: IntegrationClient[];
558
+ static create(options: HighlightClassOptions): Highlight_2;
559
+ constructor(options: HighlightClassOptions, firstLoadListeners?: FirstLoadListeners);
560
+ _reset({ forceNew, sessionKey, }: {
561
+ forceNew?: boolean;
562
+ sessionKey?: string;
563
+ }): Promise<void>;
564
+ _initMembers(options: HighlightClassOptions): void;
565
+ identify(user_identifier: string, user_object?: {}, source?: Source): void;
566
+ log(message: any, level: string, metadata?: Attributes): void;
567
+ pushCustomError(message: string, payload?: string): void;
568
+ consumeCustomError(error: Error, message?: string, payload?: string): void;
569
+ consumeError(error: Error, { message, payload, source, type, }: {
570
+ message?: string;
571
+ payload?: object;
572
+ source?: string;
573
+ type?: ErrorMessageType;
574
+ }): void;
575
+ addProperties(properties_obj?: {}, typeArg?: PropertyType): void;
576
+ initialize(options?: StartOptions): Promise<undefined>;
577
+ private _productAnalyticsEvents;
578
+ _visibilityHandler(hidden: boolean): Promise<void>;
579
+ _setupCrossOriginIframe(): Promise<void>;
580
+ _setupCrossOriginIframeParent(): void;
581
+ _setupWindowListeners(): void;
582
+ submitViewportMetrics({ height, width, availHeight, availWidth, }: ViewportResizeListenerArgs): void;
583
+ recordGauge(metric: RecordMetric): void;
584
+ recordCount(metric: RecordMetric): void;
585
+ recordIncr(metric: Omit<RecordMetric, 'value'>): void;
586
+ recordHistogram(metric: RecordMetric): void;
587
+ recordUpDownCounter(metric: RecordMetric): void;
588
+ /**
589
+ * Stops Highlight from recording.
590
+ * @param manual The end user requested to stop recording.
591
+ */
592
+ stopRecording(manual?: boolean): void;
593
+ getCurrentSessionTimestamp(): number;
594
+ /**
595
+ * Returns the current timestamp for the current session.
596
+ */
597
+ getCurrentSessionURLWithTimestamp(): string;
598
+ getCurrentSessionURL(): string | null;
599
+ snapshot(element: HTMLCanvasElement): Promise<void>;
600
+ addSessionFeedback({ timestamp, verbatim, user_email, user_name, }: {
601
+ verbatim: string;
602
+ timestamp: string;
603
+ user_name?: string;
604
+ user_email?: string;
605
+ }): void;
606
+ _save(): Promise<void>;
607
+ /**
608
+ * This proxy should be used instead of rrweb's native addCustomEvent.
609
+ * The proxy makes sure recording has started before emitting a custom event.
610
+ */
611
+ addCustomEvent<T>(tag: string, payload: T): void;
612
+ _sendPayload({ sendFn, }: {
613
+ sendFn?: (payload: PushSessionEventsMutationVariables) => Promise<number>;
614
+ }): Promise<void>;
615
+ private takeFullSnapshot;
616
+ registerLD(client: LDClientMin): void;
617
+ }
618
+
619
+ declare type HighlightClassOptions = {
620
+ organizationID: number | string;
621
+ debug?: boolean | DebugOptions;
622
+ backendUrl?: string;
623
+ tracingOrigins?: boolean | (string | RegExp)[];
624
+ disableNetworkRecording?: boolean;
625
+ networkRecording?: boolean | NetworkRecordingOptions;
626
+ disableBackgroundRecording?: boolean;
627
+ disableConsoleRecording?: boolean;
628
+ disableSessionRecording?: boolean;
629
+ reportConsoleErrors?: boolean;
630
+ consoleMethodsToRecord?: ConsoleMethods[];
631
+ privacySetting?: PrivacySettingOption;
632
+ maskAllInputs?: boolean;
633
+ maskInputOptions?: MaskInputOptions;
634
+ maskTextClass?: string | RegExp;
635
+ maskTextSelector?: string;
636
+ blockClass?: string | RegExp;
637
+ blockSelector?: string;
638
+ ignoreClass?: string;
639
+ ignoreSelector?: string;
640
+ enableSegmentIntegration?: boolean;
641
+ enableCanvasRecording?: boolean;
642
+ enablePerformanceRecording?: boolean;
643
+ enablePromisePatch?: boolean;
644
+ samplingStrategy?: SamplingStrategy;
645
+ inlineImages?: boolean;
646
+ inlineVideos?: boolean;
647
+ inlineStylesheet?: boolean;
648
+ styleSheetResyncInterval?: number;
649
+ recordCrossOriginIframe?: boolean;
650
+ firstloadVersion?: string;
651
+ environment?: 'development' | 'production' | 'staging' | string;
652
+ appVersion?: string;
653
+ serviceName?: string;
654
+ sessionKey?: string;
655
+ sessionShortcut?: SessionShortcutOptions;
656
+ sessionSecureID: string;
657
+ storageMode?: 'sessionStorage' | 'localStorage';
658
+ sessionCookie?: boolean;
659
+ sendMode?: 'webworker' | 'local';
660
+ otlpEndpoint?: HighlightOptions['otlpEndpoint'];
661
+ otel?: HighlightOptions['otel'];
662
+ productAnalytics?: boolean | ProductAnalyticsEvents;
663
+ contextFriendlyName?: (context: LDContext) => string | undefined;
664
+ };
665
+
666
+ /**
667
+ * Subset of HighlightClassOptions that is stored with the session. These fields are stored for debugging purposes.
668
+ */
669
+ declare type HighlightClassOptionsInternal = Omit<HighlightClassOptions, 'firstloadVersion'>;
670
+
671
+ declare interface HighlightClientRequestWorker {
672
+ postMessage: (message: HighlightClientWorkerParams) => void;
673
+ onmessage: (message: MessageEvent<HighlightClientWorkerResponse>) => void;
674
+ }
675
+
676
+ declare type HighlightClientWorkerParams = {
677
+ message: InitializeMessage | ResetMessage | GetStatusMessage | AsyncEventsMessage | IdentifyMessage | PropertiesMessage | MetricsMessage | FeedbackMessage;
678
+ };
679
+
680
+ declare type HighlightClientWorkerResponse = {
681
+ response?: AsyncEventsResponse | CustomEventResponse | StopEventResponse | StatusResponse;
682
+ };
683
+
684
+ export declare type HighlightOptions = CommonOptions & {
685
+ /**
686
+ * Specifies where the backend of the app lives. If specified, Highlight will attach the
687
+ * X-Highlight-Request header to outgoing requests whose destination URLs match a substring
688
+ * or regexp from this list, so that backend errors can be linked back to the session.
689
+ * If 'true' is specified, all requests to the current domain will be matched.
690
+ * @example tracingOrigins: ['localhost', /^\//, 'backend.myapp.com']
691
+ */
692
+ tracingOrigins?: boolean | (string | RegExp)[];
693
+ /**
694
+ * This disables recording network requests.
695
+ * The data includes the URLs, the size of the request, and how long the request took.
696
+ * @default false
697
+ * @deprecated Use `networkRecording` instead.
698
+ */
699
+ disableNetworkRecording?: boolean;
700
+ /**
701
+ * Specifies how and what Highlight records from network requests and responses.
702
+ */
703
+ networkRecording?: boolean | NetworkRecordingOptions;
704
+ /**
705
+ * If set, Highlight will not record when your app is not visible (in the background).
706
+ * By default, Highlight will record in the background.
707
+ * @default false
708
+ */
709
+ disableBackgroundRecording?: boolean;
710
+ /**
711
+ * Specifies whether Highlight will record console messages.
712
+ * @default false
713
+ */
714
+ disableConsoleRecording?: boolean;
715
+ /**
716
+ * Specifies whether Highlight will record user session replays.
717
+ * Unless you are using Highlight only for error monitoring, you do not want to set this to true.
718
+ * @default false
719
+ */
720
+ disableSessionRecording?: boolean;
721
+ /**
722
+ * Specifies whether Highlight will report `console.error` invocations as Highlight Errors.
723
+ * @default false
724
+ */
725
+ reportConsoleErrors?: boolean;
726
+ /**
727
+ * Specifies which console methods to record.
728
+ * The value here will be ignored if `disabledConsoleRecording` is `true`.
729
+ * @default All console methods.
730
+ * @example consoleMethodsToRecord: ['log', 'info', 'error']
731
+ */
732
+ consoleMethodsToRecord?: ConsoleMethods[];
733
+ enableSegmentIntegration?: boolean;
734
+ /**
735
+ * Specifies the environment your application is running in.
736
+ * This is useful to distinguish whether your session was recorded on localhost or in production.
737
+ * @default 'production'
738
+ */
739
+ environment?: 'development' | 'staging' | 'production' | string;
740
+ /**
741
+ * Specifies how much data Highlight should redact during recording.
742
+ * strict - Highlight will redact all text data on the page.
743
+ * default - Highlight will redact text data on the page that is associated with personal identifiable data.
744
+ * none - Highlight will not redact any text data on the page.
745
+ * // Redacted text will be randomized. Instead of seeing "Hello World" in a recording, you will see "1fds1 j59a0".
746
+ * @see {@link https://docs.highlight.run/docs/privacy} for more information.
747
+ */
748
+ privacySetting?: PrivacySettingOption;
749
+ /**
750
+ * Specifies whether to record canvas elements or not.
751
+ * @default false
752
+ */
753
+ enableCanvasRecording?: boolean;
754
+ /**
755
+ * Specifies whether to record performance metrics (e.g. FPS, device memory).
756
+ * @default true
757
+ */
758
+ enablePerformanceRecording?: boolean;
759
+ /**
760
+ * Specifies whether window.Promise should be patched
761
+ * to record the stack trace of promise rejections.
762
+ * @default true
763
+ */
764
+ enablePromisePatch?: boolean;
765
+ /**
766
+ * Configure the recording sampling options, eg. how frequently we record canvas updates.
767
+ */
768
+ samplingStrategy?: SamplingStrategy;
769
+ /**
770
+ * Specifies whether to inline images into the recording.
771
+ * This means that images that are local to the client (eg. client-generated blob: urls)
772
+ * will be serialized into the recording and will be valid on replay.
773
+ * This will also use canvas snapshotting to inline <video> elements
774
+ * that use `src="blob:..."` data or webcam feeds (blank src) as <canvas> elements
775
+ * Only enable this if you are running into issues with client-local images.
776
+ * Will negatively affect performance.
777
+ * @default false
778
+ */
779
+ inlineImages?: boolean;
780
+ /**
781
+ * Specifies whether to inline <video> elements into the recording.
782
+ * This means that video that are not accessible at a later time
783
+ * (eg., a signed URL that is short lived)
784
+ * will be serialized into the recording and will be valid on replay.
785
+ * Only enable this if you are running into issues with the normal serialization.
786
+ * Will negatively affect performance.
787
+ * @default false
788
+ */
789
+ inlineVideos?: boolean;
790
+ /**
791
+ * Specifies whether to inline stylesheets into the recording.
792
+ * This means that stylesheets that are local to the client (eg. client-generated blob: urls)
793
+ * will be serialized into the recording and will be valid on replay.
794
+ * Only enable this if you are running into issues with client-local stylesheets.
795
+ * May negatively affect performance.
796
+ * @default true
797
+ */
798
+ inlineStylesheet?: boolean;
799
+ /**
800
+ * How often, in milliseconds, session replay checks that its CSSOM patches
801
+ * are still installed and re-sends CSS-in-JS rules another script on the
802
+ * page may have caused it to miss. Set to 0 to disable. Lower values recover
803
+ * styles faster; each check walks every stylesheet on the page.
804
+ * @default 2000
805
+ */
806
+ styleSheetResyncInterval?: number;
807
+ /**
808
+ * Enables recording of cross-origin iframes. Should be set in both the parent window and
809
+ * in the cross-origin iframe.
810
+ * @default false
811
+ */
812
+ recordCrossOriginIframe?: boolean;
813
+ /**
814
+ * Deprecated: this setting is now inferred automatically. Passing this option does nothing.
815
+ * @deprecated
816
+ */
817
+ isCrossOriginIframe?: boolean;
818
+ integrations?: IntegrationOptions;
819
+ /**
820
+ * Specifies the keyboard shortcut to open the current session in Highlight.
821
+ * @see {@link https://docs.highlight.run/session-shortcut} for more information.
822
+ */
823
+ sessionShortcut?: SessionShortcutOptions;
824
+ /**
825
+ * By default, data is serialized and send by the Web Worker. Set to `local` to force
826
+ * sending from the main js thread. Only use `local` for custom environments where Web Workers
827
+ * are not available (ie. Figma plugins).
828
+ */
829
+ sendMode?: 'webworker' | 'local';
830
+ /**
831
+ * OTLP endpoint for OpenTelemetry tracing.
832
+ */
833
+ otlpEndpoint?: string;
834
+ /**
835
+ * OTLP options for OpenTelemetry tracing. Instrumentations are enabled by default.
836
+ */
837
+ otel?: OtelOptions;
838
+ };
839
+
840
+ declare interface HighlightPublicInterface {
841
+ init: (projectID?: string | number, debug?: HighlightOptions) => {
842
+ sessionSecureID: string;
843
+ } | undefined;
844
+ /**
845
+ * Calling this will assign an identifier to the session.
846
+ * @example identify('teresa@acme.com', { accountAge: 3, cohort: 8 })
847
+ * @param identifier Is commonly set as an email or UUID.
848
+ * @param metadata Additional details you want to associate to the user.
849
+ */
850
+ identify: (identifier: string, metadata?: Metadata_2, source?: Source) => void;
851
+ /**
852
+ * Call this to record when you want to track a specific event happening in your application.
853
+ * @example track('startedCheckoutProcess', { cartSize: 10, value: 85 })
854
+ * @param event The name of the event.
855
+ * @param metadata Additional details you want to associate to the event.
856
+ */
857
+ track: (event: string, metadata?: Metadata_2) => void;
858
+ log: (message: any, level: string, metadata?: Attributes) => void;
859
+ /**
860
+ * @deprecated with replacement by `consumeError` for an in-app stacktrace.
861
+ */
862
+ error: (message: string, payload?: {
863
+ [key: string]: string;
864
+ }) => void;
865
+ /**
866
+ * Calling this method will report metrics to Highlight. You can graph metrics or configure
867
+ * alerts on metrics that exceed a threshold.
868
+ * @see {@link https://docs.highlight.run/frontend-observability} for more information.
869
+ */
870
+ metrics: (metrics: Metric[]) => void;
871
+ /**
872
+ * Record arbitrary metric values via as a Gauge.
873
+ * A Gauge records any point-in-time measurement, such as the current CPU utilization %.
874
+ * Values with the same metric name and attributes are aggregated via the OTel SDK.
875
+ * See https://opentelemetry.io/docs/specs/otel/metrics/data-model/ for more details.
876
+ */
877
+ recordMetric: (metric: Metric) => void;
878
+ /**
879
+ * Record arbitrary metric values via as a Counter.
880
+ * A Counter efficiently records an increment in a metric, such as number of cache hits.
881
+ * Values with the same metric name and attributes are aggregated via the OTel SDK.
882
+ * See https://opentelemetry.io/docs/specs/otel/metrics/data-model/ for more details.
883
+ */
884
+ recordCount: (metric: Metric) => void;
885
+ /**
886
+ * Record arbitrary metric values via as a Counter.
887
+ * A Counter efficiently records an increment in a metric, such as number of cache hits.
888
+ * Values with the same metric name and attributes are aggregated via the OTel SDK.
889
+ * See https://opentelemetry.io/docs/specs/otel/metrics/data-model/ for more details.
890
+ */
891
+ recordIncr: (metric: Omit<Metric, 'value'>) => void;
892
+ /**
893
+ * Record arbitrary metric values via as a Histogram.
894
+ * A Histogram efficiently records near-by point-in-time measurement into a bucketed aggregate.
895
+ * Values with the same metric name and attributes are aggregated via the OTel SDK.
896
+ * See https://opentelemetry.io/docs/specs/otel/metrics/data-model/ for more details.
897
+ */
898
+ recordHistogram: (metric: Metric) => void;
899
+ /**
900
+ * Record arbitrary metric values via as a UpDownCounter.
901
+ * A UpDownCounter efficiently records an increment or decrement in a metric, such as number of paying customers.
902
+ * Values with the same metric name and attributes are aggregated via the OTel SDK.
903
+ * See https://opentelemetry.io/docs/specs/otel/metrics/data-model/ for more details.
904
+ */
905
+ recordUpDownCounter: (metric: Metric) => void;
906
+ /**
907
+ * Starts a new span for tracing in Highlight. The span will be ended when the
908
+ * callback function returns.
909
+ *
910
+ * @example
911
+ * ```typescript
912
+ * H.startSpan('span-name', callbackFn)
913
+ * ```
914
+ * @example
915
+ * ```typescript
916
+ * H.startSpan('span-name', options, callbackFn)
917
+ * ```
918
+ * @example
919
+ * ```typescript
920
+ * H.startSpan('span-name', options, context, callbackFn)
921
+ * ```
922
+ * @example
923
+ * ```typescript
924
+ * H.startSpan('span-name', async (span) => {
925
+ * span.setAttribute('key', 'value')
926
+ * await someAsyncFunction()
927
+ * })
928
+ * ```
929
+ *
930
+ * @param name The name of the span.
931
+ * @param options Options for the span.
932
+ * @param context The context for the span.
933
+ * @param callbackFn The function to run in the span.
934
+ */
935
+ startSpan: {
936
+ <F extends (span?: Span) => ReturnType<F>>(name: string, fn: F): ReturnType<F>;
937
+ <F extends (span?: Span) => ReturnType<F>>(name: string, options: SpanOptions, fn: F): ReturnType<F>;
938
+ <F extends (span?: Span) => ReturnType<F>>(name: string, options: SpanOptions, context: Context, fn: F): ReturnType<F>;
939
+ };
940
+ /**
941
+ * Starts a new span for tracing in Highlight. The span will be ended when the
942
+ * `end()` is called on the span. It returns whatever is returned from the
943
+ * callback function.
944
+ *
945
+ * @example
946
+ * ```typescript
947
+ * H.startManualSpan('span-name', options, (span) => {
948
+ * span.addEvent('event-name', { key: 'value' })
949
+ * span.setAttribute('key', 'value')
950
+ * await someAsyncFunction()
951
+ * span.end()
952
+ * })
953
+ * ```
954
+ *
955
+ * @example
956
+ * ```typescript
957
+ * const span = H.startManualSpan('span-name', (s) => s)
958
+ * span.addEvent('event-name', { key: 'value' })
959
+ * await someAsyncFunction()
960
+ * span.end()
961
+ * ```
962
+ *
963
+ * @param name The name of the span.
964
+ * @param options Options for the span.
965
+ * @param context The context for the span.
966
+ * @param fn The function to run in the span.
967
+ */
968
+ startManualSpan: {
969
+ <F extends (span: Span) => ReturnType<F>>(name: string, fn: F): ReturnType<F>;
970
+ <F extends (span: Span) => ReturnType<F>>(name: string, options: SpanOptions, fn: F): ReturnType<F>;
971
+ <F extends (span: Span) => ReturnType<F>>(name: string, options: SpanOptions, context: Context, fn: F): ReturnType<F>;
972
+ };
973
+ /**
974
+ * Calling this method will report an error in Highlight and map it to the current session being recorded.
975
+ * A common use case for `H.error` is calling it right outside of an error boundary.
976
+ * @see {@link https://docs.highlight.run/grouping-errors} for more information.
977
+ */
978
+ consumeError: (error: Error, message?: string, payload?: {
979
+ [key: string]: string;
980
+ }) => void;
981
+ /**
982
+ * Calling this method will report an error in Highlight
983
+ * while allowing additional attributes to be sent over as metadata.
984
+ * @see {consumeError} for more information.
985
+ */
986
+ consume: (error: Error, opts: {
987
+ message?: string;
988
+ payload?: object;
989
+ source?: string;
990
+ type?: ErrorMessageType;
991
+ }) => void;
992
+ getSessionURL: () => Promise<string>;
993
+ getSessionDetails: () => Promise<SessionDetails>;
994
+ start: (options?: StartOptions) => void;
995
+ /** Stops the session and error recording. */
996
+ stop: (options?: StartOptions) => void;
997
+ onHighlightReady: (func: () => void | Promise<void>, options?: OnHighlightReadyOptions) => void;
998
+ getRecordingState: () => 'NotRecording' | 'Recording';
999
+ options: HighlightOptions | undefined;
1000
+ /**
1001
+ * Calling this will add a feedback comment to the session.
1002
+ */
1003
+ addSessionFeedback: (feedbackOptions: SessionFeedbackOptions) => void;
1004
+ snapshot: (element: HTMLCanvasElement) => Promise<void>;
1005
+ registerLD: (client: LDClientMin, metadata?: LDPluginEnvironmentMetadata) => void;
1006
+ }
1007
+
1008
+ export declare const HighlightSegmentMiddleware: ({ next, payload, }: SegmentContext) => void;
1009
+
1010
+ declare interface Histogram<AttributesTypes extends MetricAttributes = MetricAttributes> {
1011
+ /**
1012
+ * Records a measurement. Value of the measurement must not be negative.
1013
+ */
1014
+ record(value: number, attributes?: AttributesTypes, context?: Context): void;
1015
+ }
1016
+
1017
+ /**
1018
+ * Interface for extending SDK functionality via hooks.
1019
+ */
1020
+ declare type Hook = Omit<Hook_2, 'afterEvaluation'> & {
1021
+ /**
1022
+ * This method is called during the execution of the variation method
1023
+ * after the flag value has been determined. The method is executed synchronously.
1024
+ *
1025
+ * @param hookContext Contains read-only information about the evaluation
1026
+ * being performed.
1027
+ * @param data A record associated with each stage of hook invocations. Each
1028
+ * stage is called with the data of the previous stage for a series.
1029
+ * @param detail The result of the evaluation. This value should not be
1030
+ * modified.
1031
+ * @returns Data to use when executing the next state of the hook in the evaluation series. It is
1032
+ * recommended to expand the previous input into the return. This helps ensure your stage remains
1033
+ * compatible moving forward as more stages are added.
1034
+ * ```js
1035
+ * return {...data, "my-new-field": /*my data/*}
1036
+ * ```
1037
+ */
1038
+ afterEvaluation?(hookContext: EvaluationSeriesContext, data: EvaluationSeriesData, detail: {
1039
+ /**
1040
+ * The result of the flag evaluation. This will be either one of the flag's variations or
1041
+ * the default value that was passed to `LDClient.variationDetail`.
1042
+ */
1043
+ value: LDFlagValue;
1044
+ /**
1045
+ * The index of the returned value within the flag's list of variations, e.g. 0 for the
1046
+ * first variation-- or `null` if the default value was returned.
1047
+ */
1048
+ variationIndex?: number | null;
1049
+ /**
1050
+ * An object describing the main factor that influenced the flag evaluation value.
1051
+ */
1052
+ reason?: LDEvaluationReason | null;
1053
+ }): EvaluationSeriesData;
1054
+ };
1055
+
1056
+ /**
1057
+ * Defines High-Resolution Time.
1058
+ *
1059
+ * The first number, HrTime[0], is UNIX Epoch time in seconds since 00:00:00 UTC on 1 January 1970.
1060
+ * The second number, HrTime[1], represents the partial second elapsed since Unix Epoch time represented by first number in nanoseconds.
1061
+ * For example, 2021-01-01T12:30:10.150Z in UNIX Epoch time in milliseconds is represented as 1609504210150.
1062
+ * The first number is calculated by converting and truncating the Epoch time in milliseconds to seconds:
1063
+ * HrTime[0] = Math.trunc(1609504210150 / 1000) = 1609504210.
1064
+ * The second number is calculated by converting the digits after the decimal point of the subtraction, (1609504210150 / 1000) - HrTime[0], to nanoseconds:
1065
+ * HrTime[1] = Number((1609504210.150 - HrTime[0]).toFixed(9)) * 1e9 = 150000000.
1066
+ * This is represented in HrTime format as [1609504210, 150000000].
1067
+ */
1068
+ declare type HrTime = [number, number];
1069
+
1070
+ declare type IdentifyMessage = {
1071
+ type: MessageType.Identify;
1072
+ userIdentifier: string;
1073
+ userObject: any;
1074
+ source?: Source;
1075
+ };
1076
+
1077
+ declare type incrementalData = mutationData | mousemoveData | mouseInteractionData | scrollData | viewportResizeData | inputData | mediaInteractionData | styleSheetRuleData | canvasMutationData | fontData | selectionData | styleDeclarationData | adoptedStyleSheetData | customElementData;
1078
+
1079
+ declare type incrementalSnapshotEvent = {
1080
+ type: EventType.IncrementalSnapshot;
1081
+ data: incrementalData;
1082
+ };
1083
+
1084
+ declare enum IncrementalSource {
1085
+ Mutation = 0,
1086
+ MouseMove = 1,
1087
+ MouseInteraction = 2,
1088
+ Scroll = 3,
1089
+ ViewportResize = 4,
1090
+ Input = 5,
1091
+ TouchMove = 6,
1092
+ MediaInteraction = 7,
1093
+ StyleSheetRule = 8,
1094
+ CanvasMutation = 9,
1095
+ Font = 10,
1096
+ Log = 11,
1097
+ Drag = 12,
1098
+ StyleDeclaration = 13,
1099
+ Selection = 14,
1100
+ AdoptedStyleSheet = 15,
1101
+ CustomElement = 16
1102
+ }
1103
+
1104
+ declare type InitializeMessage = {
1105
+ type: MessageType.Initialize;
1106
+ backend: string;
1107
+ sessionSecureID: string;
1108
+ debug: boolean;
1109
+ recordingStartTime: number;
1110
+ };
1111
+
1112
+ declare type inputData = {
1113
+ source: IncrementalSource.Input;
1114
+ id: number;
1115
+ } & inputValue;
1116
+
1117
+ declare type inputValue = {
1118
+ text: string;
1119
+ isChecked: boolean;
1120
+ userTriggered?: boolean;
1121
+ };
1122
+
1123
+ declare interface IntegrationClient {
1124
+ init(sessionSecureID: string): void;
1125
+ identify(sessionSecureID: string, user_identifier: string, user_object: object, source?: Source): void;
1126
+ error(sessionSecureID: string, error: ErrorMessage): void;
1127
+ track(sessionSecureID: string, metadata: object): void;
1128
+ recordGauge(sessionSecureID: string, metric: RecordMetric): void;
1129
+ getHooks?(metadata: LDPluginEnvironmentMetadata): Hook[];
1130
+ }
1131
+
1132
+ declare type IntegrationOptions = {
1133
+ amplitude?: AmplitudeIntegrationOptions;
1134
+ intercom?: IntercomIntegrationOptions;
1135
+ mixpanel?: MixpanelIntegrationOptions;
1136
+ };
1137
+
1138
+ declare interface IntercomIntegrationOptions extends DefaultIntegrationOptions {
1139
+ }
1140
+
1141
+ declare interface LDClientMin {
1142
+ track(key: string, data?: any, metricValue?: number): void;
1143
+ identify(ctx: any): void;
1144
+ addHook(hook: Hook): void;
1145
+ }
1146
+
1147
+ export declare let LDObserve: _LDObserve;
1148
+
1149
+ declare class _LDObserve extends BufferedClass<Observe_2> implements Observe_2 {
1150
+ start(): Promise<void>;
1151
+ stop(): Promise<void>;
1152
+ recordGauge(metric: OTelMetric): any;
1153
+ recordCount(metric: OTelMetric): any;
1154
+ recordIncr(metric: Omit<OTelMetric, 'value'>): any;
1155
+ recordHistogram(metric: OTelMetric): any;
1156
+ recordUpDownCounter(metric: OTelMetric): any;
1157
+ startSpan(name: string, options: SpanOptions | ((span?: Span) => any), context?: Context | ((span?: Span) => any), fn?: (span?: Span) => any): any;
1158
+ startManualSpan(name: string, options: SpanOptions | ((span: Span) => any), context?: Context | ((span: Span) => any), fn?: (span: Span) => any): any;
1159
+ register(client: LDClientMin, environmentMetadata: LDPluginEnvironmentMetadata): any;
1160
+ recordLog(message: any, level: ConsoleMethods, metadata?: Attributes): any;
1161
+ recordError(error: Error, message?: string, payload?: {
1162
+ [key: string]: string;
1163
+ }, source?: string, type?: ErrorMessageType): any;
1164
+ setLDContextKeyAttributes(contextKeys: Attributes): any;
1165
+ getLDContextKeyAttributes(): Attributes | undefined;
1166
+ }
1167
+
1168
+ declare interface LDPlugin {
1169
+ getMetadata(): LDPluginMetadata;
1170
+ register(client: LDClientMin, environmentMetadata: LDPluginEnvironmentMetadata): void;
1171
+ getHooks?(metadata: LDPluginEnvironmentMetadata): Hook[];
1172
+ }
1173
+
1174
+ export declare let LDRecord: _LDRecord;
1175
+
1176
+ declare class _LDRecord extends BufferedClass<Record_3> implements Record_3 {
1177
+ getSession(): SessionDetails | null;
1178
+ start(options?: StartOptions): Promise<void>;
1179
+ stop(): void;
1180
+ addSessionProperties(properties: {
1181
+ [key: string]: any;
1182
+ }): any;
1183
+ getRecordingState(): any;
1184
+ snapshot(element: HTMLCanvasElement): any;
1185
+ register(client: LDClientMin, environmentMetadata: LDPluginEnvironmentMetadata): any;
1186
+ }
1187
+
1188
+ /**
1189
+ * A pointer from the current {@link Span} to another span in the same trace or
1190
+ * in a different trace.
1191
+ * Few examples of Link usage.
1192
+ * 1. Batch Processing: A batch of elements may contain elements associated
1193
+ * with one or more traces/spans. Since there can only be one parent
1194
+ * SpanContext, Link is used to keep reference to SpanContext of all
1195
+ * elements in the batch.
1196
+ * 2. Public Endpoint: A SpanContext in incoming client request on a public
1197
+ * endpoint is untrusted from service provider perspective. In such case it
1198
+ * is advisable to start a new trace with appropriate sampling decision.
1199
+ * However, it is desirable to associate incoming SpanContext to new trace
1200
+ * initiated on service provider side so two traces (from Client and from
1201
+ * Service Provider) can be correlated.
1202
+ */
1203
+ declare interface Link {
1204
+ /** The {@link SpanContext} of a linked span. */
1205
+ context: SpanContext;
1206
+ /** A set of {@link SpanAttributes} on the link. */
1207
+ attributes?: SpanAttributes;
1208
+ /** Count of attributes of the link that were dropped due to collection limits */
1209
+ droppedAttributesCount?: number;
1210
+ }
1211
+
1212
+ declare type listenerHandler = () => void;
1213
+
1214
+ declare type loadedEvent = {
1215
+ type: EventType.Load;
1216
+ data: unknown;
1217
+ };
1218
+
1219
+ declare class Logger {
1220
+ debug: boolean | undefined;
1221
+ name: string | undefined;
1222
+ constructor(debug?: boolean, name?: string);
1223
+ log(...data: any[]): void;
1224
+ warn(...data: any[]): void;
1225
+ }
1226
+
1227
+ declare type MaskInputOptions = Partial<{
1228
+ color: boolean;
1229
+ date: boolean;
1230
+ 'datetime-local': boolean;
1231
+ email: boolean;
1232
+ month: boolean;
1233
+ number: boolean;
1234
+ range: boolean;
1235
+ search: boolean;
1236
+ tel: boolean;
1237
+ text: boolean;
1238
+ time: boolean;
1239
+ url: boolean;
1240
+ week: boolean;
1241
+ textarea: boolean;
1242
+ select: boolean;
1243
+ password: boolean;
1244
+ }>;
1245
+
1246
+ declare type mediaInteractionData = {
1247
+ source: IncrementalSource.MediaInteraction;
1248
+ } & mediaInteractionParam;
1249
+
1250
+ declare type mediaInteractionParam = {
1251
+ type: MediaInteractions;
1252
+ id: number;
1253
+ currentTime?: number;
1254
+ volume?: number;
1255
+ muted?: boolean;
1256
+ loop?: boolean;
1257
+ playbackRate?: number;
1258
+ };
1259
+
1260
+ declare enum MediaInteractions {
1261
+ Play = 0,
1262
+ Pause = 1,
1263
+ Seeked = 2,
1264
+ VolumeChange = 3,
1265
+ RateChange = 4
1266
+ }
1267
+
1268
+ declare enum MessageType {
1269
+ Initialize = 0,
1270
+ Reset = 1,
1271
+ AsyncEvents = 2,
1272
+ Identify = 3,
1273
+ Properties = 4,
1274
+ Metrics = 5,
1275
+ Feedback = 6,
1276
+ CustomEvent = 7,
1277
+ Stop = 8,
1278
+ GetStatus = 9
1279
+ }
1280
+
1281
+ declare interface Metadata_2 {
1282
+ [key: string]: any;
1283
+ }
1284
+ export { Metadata_2 as Metadata }
1285
+
1286
+ declare type metaEvent = {
1287
+ type: EventType.Meta;
1288
+ data: {
1289
+ href: string;
1290
+ width: number;
1291
+ height: number;
1292
+ };
1293
+ };
1294
+
1295
+ declare interface Metric {
1296
+ name: string;
1297
+ value: number;
1298
+ /** UCUM / OTel unit for the instrument (e.g. `ms`, `By`). */
1299
+ unit?: string;
1300
+ tags?: {
1301
+ name: string;
1302
+ value: string;
1303
+ }[];
1304
+ }
1305
+
1306
+ /**
1307
+ * @deprecated please use {@link Attributes}
1308
+ */
1309
+ declare type MetricAttributes = Attributes;
1310
+
1311
+ export declare enum MetricCategory {
1312
+ Device = "Device",
1313
+ WebVital = "WebVital",
1314
+ Frontend = "Frontend",
1315
+ Backend = "Backend"
1316
+ }
1317
+
1318
+ declare enum MetricCategory_2 {
1319
+ Device = "Device",
1320
+ WebVital = "WebVital",
1321
+ Performance = "Performance",
1322
+ Frontend = "Frontend",
1323
+ Backend = "Backend"
1324
+ }
1325
+
1326
+ declare type MetricsMessage = {
1327
+ type: MessageType.Metrics;
1328
+ metrics: {
1329
+ name: string;
1330
+ value: number;
1331
+ category: MetricCategory_2;
1332
+ group: string;
1333
+ timestamp: Date;
1334
+ tags: {
1335
+ name: string;
1336
+ value: string;
1337
+ }[];
1338
+ }[];
1339
+ };
1340
+
1341
+ declare interface MixpanelIntegrationOptions extends DefaultIntegrationOptions {
1342
+ projectToken?: string;
1343
+ }
1344
+
1345
+ declare type mouseInteractionData = {
1346
+ source: IncrementalSource.MouseInteraction;
1347
+ } & mouseInteractionParam;
1348
+
1349
+ declare type mouseInteractionParam = {
1350
+ type: MouseInteractions;
1351
+ id: number;
1352
+ x?: number;
1353
+ y?: number;
1354
+ pointerType?: PointerTypes;
1355
+ };
1356
+
1357
+ declare enum MouseInteractions {
1358
+ MouseUp = 0,
1359
+ MouseDown = 1,
1360
+ Click = 2,
1361
+ ContextMenu = 3,
1362
+ DblClick = 4,
1363
+ Focus = 5,
1364
+ Blur = 6,
1365
+ TouchStart = 7,
1366
+ TouchMove_Departed = 8,
1367
+ TouchEnd = 9,
1368
+ TouchCancel = 10
1369
+ }
1370
+
1371
+ declare type mousemoveData = {
1372
+ source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag;
1373
+ positions: mousePosition[];
1374
+ };
1375
+
1376
+ declare type mousePosition = {
1377
+ x: number;
1378
+ y: number;
1379
+ id: number;
1380
+ timeOffset: number;
1381
+ };
1382
+
1383
+ declare type mutationCallbackParam = {
1384
+ texts: textMutation[];
1385
+ attributes: attributeMutation[];
1386
+ removes: removedNodeMutation[];
1387
+ adds: addedNodeMutation[];
1388
+ isAttachIframe?: true;
1389
+ };
1390
+
1391
+ declare type mutationData = {
1392
+ source: IncrementalSource.Mutation;
1393
+ } & mutationCallbackParam;
1394
+
1395
+ declare type NetworkRecordingOptions = {
1396
+ /**
1397
+ * Enables recording of network requests.
1398
+ * The data includes the URLs, the size of the request, and how long the request took.
1399
+ * @default true
1400
+ */
1401
+ enabled?: boolean;
1402
+ /**
1403
+ * This enables recording XMLHttpRequest and Fetch headers and bodies.
1404
+ * @default false
1405
+ */
1406
+ recordHeadersAndBody?: boolean;
1407
+ /**
1408
+ * This disables recording WebSocket events.
1409
+ * WebSocket events are recorded by default if recordHeadersAndBody is set.
1410
+ * @default false
1411
+ */
1412
+ disableWebSocketEventRecordings?: boolean;
1413
+ /**
1414
+ * Request and response headers where the value is not recorded.
1415
+ * The header value is replaced with '[REDACTED]'.
1416
+ * These headers are case-insensitive.
1417
+ * `recordHeadersAndBody` needs to be enabled.
1418
+ * This option will be ignored if `headerKeysToRecord` is set.
1419
+ * @example
1420
+ * networkHeadersToRedact: ['Secret-Header', 'Plain-Text-Password']
1421
+ */
1422
+ networkHeadersToRedact?: string[];
1423
+ /**
1424
+ * Specifies the keys for request/response JSON body that should not be recorded.
1425
+ * The body value is replaced with '[REDACTED]'.
1426
+ * These keys are case-insensitive.
1427
+ * `enabled` and `recordHeadersAndBody` need to be `true`. Otherwise this option will be ignored.
1428
+ * @example bodyKeysToRedact: ['secret-token', 'plain-text-password']
1429
+ * // Only `body.id` and `body.pageNumber` will be recorded.
1430
+ * body = {
1431
+ * 'id': '123',
1432
+ * 'pageNumber': '1',
1433
+ * 'secret-token': 'super-sensitive-value',
1434
+ * 'plain-text-password': 'password123',
1435
+ * }
1436
+ */
1437
+ networkBodyKeysToRedact?: string[];
1438
+ /**
1439
+ * URLs to not record headers and bodies for, and to not propagate trace
1440
+ * headers (e.g. `traceparent`) to. Each entry is matched as a
1441
+ * case-insensitive substring of the full request URL; a match suppresses
1442
+ * both recording and trace-header propagation for that request.
1443
+ * To disable recording headers and bodies for all URLs, set `recordHeadersAndBody` to `false`.
1444
+ * @default ['https://www.googleapis.com/identitytoolkit', 'https://securetoken.googleapis.com']
1445
+ */
1446
+ urlBlocklist?: string[];
1447
+ /**
1448
+ * Specifies the keys for request/response headers to record.
1449
+ * This option will override `networkHeadersToRedact` if specified.
1450
+ * `enabled` and `recordHeadersAndBody` need to be `true`. Otherwise this option will be ignored.
1451
+ * @example headerKeysToRecord: ['id', 'pageNumber']
1452
+ * // Only `headers.id` and `headers.pageNumber` will be recorded.
1453
+ * headers = {
1454
+ * 'id': '123',
1455
+ * 'pageNumber': '1',
1456
+ * 'secret-token': 'super-sensitive-value',
1457
+ * 'plain-text-password': 'password123',
1458
+ * }
1459
+ */
1460
+ headerKeysToRecord?: string[];
1461
+ /**
1462
+ * Specifies the keys for request/response JSON body to record.
1463
+ * This option will override `networkBodyKeysToRedact` if specified.
1464
+ * `enabled` and `recordHeadersAndBody` need to be `true`. Otherwise this option will be ignored.
1465
+ * @example bodyKeysToRecord: ['id', 'pageNumber']
1466
+ * // Only `body.id` and `body.pageNumber` will be recorded.
1467
+ * body = {
1468
+ * 'id': '123',
1469
+ * 'pageNumber': '1',
1470
+ * 'secret-token': 'super-sensitive-value',
1471
+ * 'plain-text-password': 'password123',
1472
+ * }
1473
+ */
1474
+ bodyKeysToRecord?: string[];
1475
+ /**
1476
+ * Record frontend network request metrics that are sent to
1477
+ * the following list of domains. A domain substring match is used to
1478
+ * determine if a network request matches one of the following values.
1479
+ * @example destinationDomains: ['backend.example.com']
1480
+ * // if your frontend makes requests to `backend.example.com` that you would like to record
1481
+ */
1482
+ destinationDomains?: string[];
1483
+ /**
1484
+ * Function to edit/remove data in request/response pairs or ignore the pair entirely.
1485
+ * @example
1486
+ * ```
1487
+ * requestResponseSanitizer: pair => {
1488
+ * if (pair.request.url.toLowerCase().indexOf('ignore') !== -1) {
1489
+ * // ignore the entire request/response pair (no network logs)
1490
+ * return null
1491
+ * }
1492
+ *
1493
+ * if (pair.response.body.indexOf('secret') !== -1) {
1494
+ * // remove the body in the response
1495
+ * delete pair.response.body;
1496
+ * }
1497
+ *
1498
+ * return pair
1499
+ * }
1500
+ * ```
1501
+ *
1502
+ */
1503
+ requestResponseSanitizer?: (pair: RequestResponsePair) => RequestResponsePair | null;
1504
+ };
1505
+
1506
+ declare enum NodeType {
1507
+ Document = 0,
1508
+ DocumentType = 1,
1509
+ Element = 2,
1510
+ Text = 3,
1511
+ CDATA = 4,
1512
+ Comment = 5
1513
+ }
1514
+
1515
+ export declare class Observe extends Plugin_2<ObserveOptions> implements LDPlugin {
1516
+ observe: Observe_2 | undefined;
1517
+ options: ObserveOptions | undefined;
1518
+ private readonly exposureDeduper;
1519
+ constructor(options?: ObserveOptions);
1520
+ private initialize;
1521
+ getMetadata(): {
1522
+ name: string;
1523
+ };
1524
+ register(client: LDClientMin, environmentMetadata: LDPluginEnvironmentMetadata): void;
1525
+ getHooks?(metadata: LDPluginEnvironmentMetadata): Hook[];
1526
+ }
1527
+
1528
+ declare interface Observe_2 {
1529
+ /**
1530
+ * Start the observability data capture when running in `manualStart` mode.
1531
+ */
1532
+ start: () => Promise<void>;
1533
+ /**
1534
+ * Stop the observability data capture.
1535
+ */
1536
+ stop: () => Promise<void>;
1537
+ /**
1538
+ * Record arbitrary metric values via as a Gauge.
1539
+ * A Gauge records any point-in-time measurement, such as the current CPU utilization %.
1540
+ * Values with the same metric name and attributes are aggregated via the OTel SDK.
1541
+ * See https://opentelemetry.io/docs/specs/otel/metrics/data-model/ for more details.
1542
+ */
1543
+ recordGauge: (metric: OTelMetric) => void;
1544
+ /**
1545
+ * Record arbitrary metric values via as a Counter.
1546
+ * A Counter efficiently records an increment in a metric, such as number of cache hits.
1547
+ * Values with the same metric name and attributes are aggregated via the OTel SDK.
1548
+ * See https://opentelemetry.io/docs/specs/otel/metrics/data-model/ for more details.
1549
+ */
1550
+ recordCount: (metric: OTelMetric) => void;
1551
+ /**
1552
+ * Record arbitrary metric values via as a Counter.
1553
+ * A Counter efficiently records an increment in a metric, such as number of cache hits.
1554
+ * Values with the same metric name and attributes are aggregated via the OTel SDK.
1555
+ * See https://opentelemetry.io/docs/specs/otel/metrics/data-model/ for more details.
1556
+ */
1557
+ recordIncr: (metric: Omit<OTelMetric, 'value'>) => void;
1558
+ /**
1559
+ * Record arbitrary metric values via as a Histogram.
1560
+ * A Histogram efficiently records near-by point-in-time measurement into a bucketed aggregate.
1561
+ * Values with the same metric name and attributes are aggregated via the OTel SDK.
1562
+ * See https://opentelemetry.io/docs/specs/otel/metrics/data-model/ for more details.
1563
+ */
1564
+ recordHistogram: (metric: OTelMetric) => void;
1565
+ /**
1566
+ * Record arbitrary metric values via as a UpDownCounter.
1567
+ * A UpDownCounter efficiently records an increment or decrement in a metric, such as number of paying customers.
1568
+ * Values with the same metric name and attributes are aggregated via the OTel SDK.
1569
+ * See https://opentelemetry.io/docs/specs/otel/metrics/data-model/ for more details.
1570
+ */
1571
+ recordUpDownCounter: (metric: OTelMetric) => void;
1572
+ /**
1573
+ * Starts a new span for tracing in Highlight. The span will be ended when the
1574
+ * callback function returns.
1575
+ *
1576
+ * @example
1577
+ * ```typescript
1578
+ * H.startSpan('span-name', callbackFn)
1579
+ * ```
1580
+ * @example
1581
+ * ```typescript
1582
+ * H.startSpan('span-name', options, callbackFn)
1583
+ * ```
1584
+ * @example
1585
+ * ```typescript
1586
+ * H.startSpan('span-name', options, context, callbackFn)
1587
+ * ```
1588
+ * @example
1589
+ * ```typescript
1590
+ * H.startSpan('span-name', async (span) => {
1591
+ * span.setAttribute('key', 'value')
1592
+ * await someAsyncFunction()
1593
+ * })
1594
+ * ```
1595
+ *
1596
+ * @param name The name of the span.
1597
+ * @param options Options for the span.
1598
+ * @param context The context for the span.
1599
+ * @param callbackFn The function to run in the span.
1600
+ */
1601
+ startSpan: {
1602
+ <F extends (span?: Span) => ReturnType<F>>(name: string, fn: F): ReturnType<F>;
1603
+ <F extends (span?: Span) => ReturnType<F>>(name: string, options: SpanOptions, fn: F): ReturnType<F>;
1604
+ <F extends (span?: Span) => ReturnType<F>>(name: string, options: SpanOptions, context: Context, fn: F): ReturnType<F>;
1605
+ };
1606
+ /**
1607
+ * Starts a new span for tracing in Highlight. The span will be ended when the
1608
+ * `end()` is called on the span. It returns whatever is returned from the
1609
+ * callback function.
1610
+ *
1611
+ * @example
1612
+ * ```typescript
1613
+ * H.startManualSpan('span-name', options, (span) => {
1614
+ * span.addEvent('event-name', { key: 'value' })
1615
+ * span.setAttribute('key', 'value')
1616
+ * await someAsyncFunction()
1617
+ * span.end()
1618
+ * })
1619
+ * ```
1620
+ *
1621
+ * @example
1622
+ * ```typescript
1623
+ * const span = H.startManualSpan('span-name', (s) => s)
1624
+ * span.addEvent('event-name', { key: 'value' })
1625
+ * await someAsyncFunction()
1626
+ * span.end()
1627
+ * ```
1628
+ *
1629
+ * @param name The name of the span.
1630
+ * @param options Options for the span.
1631
+ * @param context The context for the span.
1632
+ * @param fn The function to run in the span.
1633
+ */
1634
+ startManualSpan: {
1635
+ <F extends (span: Span) => ReturnType<F>>(name: string, fn: F): ReturnType<F>;
1636
+ <F extends (span: Span) => ReturnType<F>>(name: string, options: SpanOptions, fn: F): ReturnType<F>;
1637
+ <F extends (span: Span) => ReturnType<F>>(name: string, options: SpanOptions, context: Context, fn: F): ReturnType<F>;
1638
+ };
1639
+ /**
1640
+ * Calling this method will report an error in Highlight and map it to the current session being recorded.
1641
+ * A common use case for `H.error` is calling it right outside of an error boundary.
1642
+ * @see {@link https://docs.highlight.run/grouping-errors} for more information.
1643
+ */
1644
+ recordError: (error: any, message?: string, payload?: {
1645
+ [key: string]: string;
1646
+ }, source?: string, type?: ErrorMessageType) => void;
1647
+ /**
1648
+ * Record arbitrary logs from your own integrations or manual.
1649
+ * Useful when you don't want to emit a console log to the browser dev tools but still want to report a custom log.
1650
+ */
1651
+ recordLog: (message: any, level: ConsoleMethods, metadata?: Attributes) => void;
1652
+ register(client: LDClientMin, environmentMetadata: LDPluginEnvironmentMetadata): void;
1653
+ getHooks?(metadata: LDPluginEnvironmentMetadata): Hook[];
1654
+ setLDContextKeyAttributes(contextKeys: Attributes): void;
1655
+ getLDContextKeyAttributes(): Attributes | undefined;
1656
+ }
1657
+
1658
+ export declare type ObserveOptions = CommonOptions & {
1659
+ /**
1660
+ * Specifies where the backend of the app lives. If specified, the SDK will attach the
1661
+ * traceparent header to outgoing requests whose destination URLs match a substring
1662
+ * or regexp from this list, so that backend errors can be linked back to the session.
1663
+ * If 'true' is specified, all requests to the current domain will be matched.
1664
+ * @example tracingOrigins: ['localhost', /^\//, 'backend.myapp.com']
1665
+ */
1666
+ tracingOrigins?: boolean | (string | RegExp)[];
1667
+ /**
1668
+ * Specifies how and what the SDK records from network requests and responses.
1669
+ */
1670
+ networkRecording?: boolean | NetworkRecordingOptions;
1671
+ /**
1672
+ * Specifies whether the SDK will record console messages.
1673
+ * @default false
1674
+ */
1675
+ disableConsoleRecording?: boolean;
1676
+ /**
1677
+ * Specifies whether the SDK will report `console.error` invocations as Errors.
1678
+ * @default false
1679
+ */
1680
+ reportConsoleErrors?: boolean;
1681
+ /**
1682
+ * Specifies which console methods to record.
1683
+ * The value here will be ignored if `disabledConsoleRecording` is `true`.
1684
+ * @default All console methods.
1685
+ * @example consoleMethodsToRecord: ['log', 'info', 'error']
1686
+ */
1687
+ consoleMethodsToRecord?: ConsoleMethods[];
1688
+ /**
1689
+ * Specifies whether to record performance metrics (e.g. FPS, device memory).
1690
+ * @default true
1691
+ */
1692
+ enablePerformanceRecording?: boolean;
1693
+ /**
1694
+ * Specifies whether to record main-thread `longtask` entries (>50ms) as
1695
+ * `long_task.duration` histogram samples.
1696
+ * @default true
1697
+ */
1698
+ enableLongtaskRecording?: boolean;
1699
+ /**
1700
+ * Specifies whether to subscribe to the browser Reporting API and emit
1701
+ * CSP/intervention reports as errors and deprecation reports as warn logs.
1702
+ * @default true
1703
+ */
1704
+ enableReportingObserver?: boolean;
1705
+ /**
1706
+ * Specifies the environment your application is running in.
1707
+ * This is useful to distinguish whether your session was recorded on localhost or in production.
1708
+ * @default 'production'
1709
+ */
1710
+ environment?: 'development' | 'staging' | 'production' | string;
1711
+ /**
1712
+ * Specifies whether window.Promise should be patched
1713
+ * to record the stack trace of promise rejections.
1714
+ * @default true
1715
+ */
1716
+ enablePromisePatch?: boolean;
1717
+ /**
1718
+ * OTLP options for OpenTelemetry tracing. Instrumentations are enabled by default.
1719
+ */
1720
+ otel?: OtelOptions & {
1721
+ /**
1722
+ * OTLP HTTP endpoint for OpenTelemetry tracing.
1723
+ */
1724
+ otlpEndpoint?: string;
1725
+ };
1726
+ /**
1727
+ * Specifies whether to record product analytics events.
1728
+ * @default true
1729
+ */
1730
+ productAnalytics?: boolean | ProductAnalyticsEvents;
1731
+ /**
1732
+ * The time window, in milliseconds, during which repeated feature flag
1733
+ * evaluations that resolve to the same result are deduplicated, so that only
1734
+ * a single `feature_flag` exposure span is emitted per unique
1735
+ * (flag key, value, variation, reason, context) within the window.
1736
+ *
1737
+ * This is useful for reducing exposure volume caused by frequent
1738
+ * re-evaluations (for example, React re-renders).
1739
+ *
1740
+ * Set to `0` (the default) to disable deduplication and emit an exposure
1741
+ * for every evaluation. Set a positive value to enable it.
1742
+ *
1743
+ * @default 0 (disabled)
1744
+ */
1745
+ flagExposureDedupeWindowMillis?: number;
1746
+ /**
1747
+ * The maximum number of unique feature flag exposure keys tracked for
1748
+ * deduplication at once. When exceeded, the least recently recorded keys are
1749
+ * evicted to bound memory usage.
1750
+ *
1751
+ * @default 2000
1752
+ */
1753
+ flagExposureDedupeMaxSize?: number;
1754
+ };
1755
+
1756
+ declare interface OnHighlightReadyOptions {
1757
+ /**
1758
+ * Specifies whether to wait for recording to start
1759
+ */
1760
+ waitForReady?: boolean;
1761
+ }
1762
+
1763
+ declare type OtelInstrumentatonOptions = {
1764
+ '@opentelemetry/instrumentation-document-load'?: false;
1765
+ '@opentelemetry/instrumentation-fetch'?: false;
1766
+ '@opentelemetry/instrumentation-xml-http-request'?: false;
1767
+ '@opentelemetry/instrumentation-user-interaction'?: false;
1768
+ };
1769
+
1770
+ declare interface OTelMetric {
1771
+ name: string;
1772
+ value: number;
1773
+ /** UCUM / OTel unit for the instrument (e.g. `ms`, `By`). */
1774
+ unit?: string;
1775
+ attributes?: Attributes;
1776
+ }
1777
+
1778
+ declare type OtelOptions = {
1779
+ instrumentations?: OtelInstrumentatonOptions;
1780
+ };
1781
+
1782
+ declare class Plugin_2<T extends RecordOptions | ObserveOptions> {
1783
+ protected sessionSecureID: string;
1784
+ constructor(options?: T);
1785
+ configureSession(ldCredential: string, options?: T): void;
1786
+ }
1787
+
1788
+ declare type pluginEvent<T = unknown> = {
1789
+ type: EventType.Plugin;
1790
+ data: {
1791
+ plugin: string;
1792
+ payload: T;
1793
+ };
1794
+ };
1795
+
1796
+ declare enum PointerTypes {
1797
+ Mouse = 0,
1798
+ Pen = 1,
1799
+ Touch = 2
1800
+ }
1801
+
1802
+ declare type PrivacySettingOption = 'strict' | 'default' | 'none';
1803
+
1804
+ declare type ProductAnalyticsEvents = {
1805
+ /**
1806
+ * Specifies whether to record product analytics for clicks.
1807
+ * Requires the use of the @opentelemetry/instrumentation-user-interaction instrumentation.
1808
+ * @default true
1809
+ */
1810
+ clicks?: boolean;
1811
+ /**
1812
+ * Specifies whether to record product analytics for page views.
1813
+ * Requires the use of the @opentelemetry/instrumentation-document-load instrumentation.
1814
+ * @default true
1815
+ */
1816
+ pageViews?: boolean;
1817
+ /**
1818
+ * Specifies whether to record product analytics for custom events.
1819
+ * @default true
1820
+ */
1821
+ trackEvents?: boolean;
1822
+ };
1823
+
1824
+ declare type PropertiesMessage = {
1825
+ type: MessageType.Properties;
1826
+ propertiesObject: any;
1827
+ propertyType?: PropertyType;
1828
+ };
1829
+
1830
+ declare type PropertyType = {
1831
+ type?: 'track' | 'session';
1832
+ source?: Source;
1833
+ };
1834
+
1835
+ declare type PushSessionEventsMutationVariables = Exact<{
1836
+ session_secure_id: Scalars['String']['input'];
1837
+ payload_id: Scalars['Int64ID']['input'];
1838
+ data: Scalars['String']['input'];
1839
+ }>;
1840
+
1841
+ declare class Record_2 extends Plugin_2<RecordOptions> implements LDPlugin {
1842
+ record: RecordSDK | undefined;
1843
+ options: RecordOptions | undefined;
1844
+ constructor(options?: RecordOptions);
1845
+ private initialize;
1846
+ getMetadata(): {
1847
+ name: string;
1848
+ };
1849
+ register(client: LDClientMin, environmentMetadata: LDPluginEnvironmentMetadata): void;
1850
+ getHooks?(metadata: LDPluginEnvironmentMetadata): Hook[];
1851
+ }
1852
+ export { Record_2 as Record }
1853
+
1854
+ declare interface Record_3 {
1855
+ /**
1856
+ * Start the session when running in `manualStart` mode.
1857
+ * Can be used to force start a new session.
1858
+ * @param options the session start options.
1859
+ */
1860
+ start: (options?: StartOptions) => Promise<void>;
1861
+ /**
1862
+ * Stop the session recording.
1863
+ */
1864
+ stop: () => void;
1865
+ /**
1866
+ * Add custom session-level properties. These are attached to the current session
1867
+ * and are searchable, but do not create timeline Track events.
1868
+ */
1869
+ addSessionProperties: (properties: {
1870
+ [key: string]: any;
1871
+ }) => void;
1872
+ /**
1873
+ * Snapshot an HTML <canvas> element in WebGL manual snapshotting mode.
1874
+ * See {@link https://www.highlight.io/docs/getting-started/browser/replay-configuration/canvas#manual-snapshotting}
1875
+ * for more information.
1876
+ */
1877
+ snapshot: (element: HTMLCanvasElement) => Promise<void>;
1878
+ getSession: () => SessionDetails | null;
1879
+ getRecordingState: () => 'NotRecording' | 'Recording';
1880
+ register(client: LDClientMin, environmentMetadata: LDPluginEnvironmentMetadata): void;
1881
+ getHooks?(metadata: LDPluginEnvironmentMetadata): Hook[];
1882
+ }
1883
+
1884
+ declare interface RecordMetric {
1885
+ name: string;
1886
+ value: number;
1887
+ /** UCUM / OTel unit for the instrument (e.g. `ms`, `By`). */
1888
+ unit?: string;
1889
+ category?: MetricCategory_2;
1890
+ group?: string;
1891
+ tags?: {
1892
+ name: string;
1893
+ value: string;
1894
+ }[];
1895
+ }
1896
+
1897
+ export declare type RecordOptions = CommonOptions & {
1898
+ /**
1899
+ * Specifies where the backend of the app lives. If specified, the SDK will attach the
1900
+ * traceparent header to outgoing requests whose destination URLs match a substring
1901
+ * or regexp from this list, so that backend errors can be linked back to the session.
1902
+ * If 'true' is specified, all requests to the current domain will be matched.
1903
+ * @example tracingOrigins: ['localhost', /^\//, 'backend.myapp.com']
1904
+ */
1905
+ tracingOrigins?: boolean | (string | RegExp)[];
1906
+ /**
1907
+ * If set, the SDK will not record when your app is not visible (in the background).
1908
+ * By default, the SDK will record in the background.
1909
+ * @default false
1910
+ */
1911
+ disableBackgroundRecording?: boolean;
1912
+ enableSegmentIntegration?: boolean;
1913
+ /**
1914
+ * Specifies the environment your application is running in.
1915
+ * This is useful to distinguish whether your session was recorded on localhost or in production.
1916
+ * @default 'production'
1917
+ */
1918
+ environment?: 'development' | 'staging' | 'production' | string;
1919
+ /**
1920
+ * Specifies how much data the SDK should redact during recording.
1921
+ * strict - the SDK will redact all text data, input fields, images and videos on the page.
1922
+ * default - the SDK will redact text data on the page that resembles PII (based on regex patterns).
1923
+ * none - the SDK will not redact any text data on the page.
1924
+ * // Redacted text will be randomized. Instead of seeing "Hello World" in a recording, you will see "1fds1 j59a0".
1925
+ * @see {@link https://launchdarkly.com/docs/sdk/features/session-replay-config#privacy} for more information.
1926
+ */
1927
+ privacySetting?: PrivacySettingOption;
1928
+ /**
1929
+ * Enable masking all <input/> elements. Only applies if privacySetting is `none`.
1930
+ */
1931
+ maskAllInputs?: boolean;
1932
+ /**
1933
+ * Customize the input element types that are masked. Only applies if privacySetting is `none`.
1934
+ */
1935
+ maskInputOptions?: MaskInputOptions;
1936
+ /**
1937
+ * Customize which elements' text should be masked by specifying a CSS class name or RegExp.
1938
+ * Default class is 'highlight-mask'.
1939
+ */
1940
+ maskTextClass?: string | RegExp;
1941
+ /**
1942
+ * Customize which elements' text should be masked via a CSS selector that will match the element
1943
+ * and its descendants.
1944
+ */
1945
+ maskTextSelector?: string;
1946
+ /**
1947
+ * Customize which elements should be blocked (not recorded) by specifying a class name or RegExp.
1948
+ * Default is 'highlight-block'.
1949
+ */
1950
+ blockClass?: string | RegExp;
1951
+ /**
1952
+ * Customize which elements should be blocked via a CSS selector.
1953
+ */
1954
+ blockSelector?: string;
1955
+ /**
1956
+ * Customize which elements and their descendants should be ignored from DOM events by class.
1957
+ * Default is 'highlight-ignore'.
1958
+ */
1959
+ ignoreClass?: string;
1960
+ /**
1961
+ * Customize which elements should be ignored from DOM events via a CSS selector.
1962
+ */
1963
+ ignoreSelector?: string;
1964
+ /**
1965
+ * Specifies whether to record canvas elements or not.
1966
+ * @default false
1967
+ */
1968
+ enableCanvasRecording?: boolean;
1969
+ /**
1970
+ * Configure the recording sampling options, eg. how frequently we record canvas updates.
1971
+ */
1972
+ samplingStrategy?: SamplingStrategy;
1973
+ /**
1974
+ * Specifies whether to inline images into the recording.
1975
+ * This means that images that are local to the client (eg. client-generated blob: urls)
1976
+ * will be serialized into the recording and will be valid on replay.
1977
+ * This will also use canvas snapshotting to inline <video> elements
1978
+ * that use `src="blob:..."` data or webcam feeds (blank src) as <canvas> elements
1979
+ * Only enable this if you are running into issues with client-local images.
1980
+ * Will negatively affect performance.
1981
+ * @default false
1982
+ */
1983
+ inlineImages?: boolean;
1984
+ /**
1985
+ * Specifies whether to inline <video> elements into the recording.
1986
+ * This means that video that are not accessible at a later time
1987
+ * (eg., a signed URL that is short lived)
1988
+ * will be serialized into the recording and will be valid on replay.
1989
+ * Only enable this if you are running into issues with the normal serialization.
1990
+ * Will negatively affect performance.
1991
+ * @default false
1992
+ */
1993
+ inlineVideos?: boolean;
1994
+ /**
1995
+ * Specifies whether to inline stylesheets into the recording.
1996
+ * This means that stylesheets that are local to the client (eg. client-generated blob: urls)
1997
+ * will be serialized into the recording and will be valid on replay.
1998
+ * Only enable this if you are running into issues with client-local stylesheets.
1999
+ * May negatively affect performance.
2000
+ * @default true
2001
+ */
2002
+ inlineStylesheet?: boolean;
2003
+ /**
2004
+ * How often, in milliseconds, session replay checks that its CSSOM patches
2005
+ * are still installed and re-sends CSS-in-JS rules another script on the
2006
+ * page may have caused it to miss. Set to 0 to disable. Lower values recover
2007
+ * styles faster; each check walks every stylesheet on the page.
2008
+ * @default 2000
2009
+ */
2010
+ styleSheetResyncInterval?: number;
2011
+ /**
2012
+ * Enables recording of cross-origin iframes. Should be set in both the parent window and
2013
+ * in the cross-origin iframe.
2014
+ * @default false
2015
+ */
2016
+ recordCrossOriginIframe?: boolean;
2017
+ integrations?: IntegrationOptions;
2018
+ /**
2019
+ * Specifies the keyboard shortcut to open the current session replay.
2020
+ * @see {@link https://launchdarkly.com/docs/sdk/features/session-replay-config#retrieve-session-urls-on-the-client} for more information.
2021
+ */
2022
+ sessionShortcut?: SessionShortcutOptions;
2023
+ /**
2024
+ * By default, data is serialized and send by the Web Worker. Set to `local` to force
2025
+ * sending from the main js thread. Only use `local` for custom environments where Web Workers
2026
+ * are not available (ie. Figma plugins).
2027
+ */
2028
+ sendMode?: 'webworker' | 'local';
2029
+ };
2030
+
2031
+ declare class RecordSDK implements Record_3 {
2032
+ #private;
2033
+ options: HighlightClassOptions;
2034
+ /** Determines if the client is running on a Highlight property (e.g. frontend). */
2035
+ isRunningOnHighlight: boolean;
2036
+ /** Verbose project ID that is exposed to users. Legacy users may still be using ints. */
2037
+ organizationID: string;
2038
+ events: eventWithTime[];
2039
+ sessionData: SessionData;
2040
+ ready: boolean;
2041
+ manualStopped: boolean;
2042
+ state: 'NotRecording' | 'Recording';
2043
+ logger: Logger;
2044
+ enableSegmentIntegration: boolean;
2045
+ privacySetting: PrivacySettingOption;
2046
+ enableCanvasRecording: boolean;
2047
+ samplingStrategy: SamplingStrategy;
2048
+ inlineImages: boolean;
2049
+ inlineVideos: boolean;
2050
+ inlineStylesheet: boolean;
2051
+ styleSheetResyncInterval: number;
2052
+ debugOptions: DebugOptions;
2053
+ listeners: listenerHandler[];
2054
+ firstloadVersion: string;
2055
+ environment: string;
2056
+ sessionShortcut: SessionShortcutOptions;
2057
+ /** The end-user's app version. This isn't Highlight's version. */
2058
+ appVersion: string | undefined;
2059
+ serviceName: string;
2060
+ _worker: HighlightClientRequestWorker;
2061
+ _optionsInternal: Omit<RecordOptions, 'firstloadVersion'>;
2062
+ _backendUrl: string;
2063
+ _recordingStartTime: number;
2064
+ _isOnLocalHost: boolean;
2065
+ _onToggleFeedbackFormVisibility: () => void;
2066
+ _isCrossOriginIframe: boolean;
2067
+ _eventBytesSinceSnapshot: number;
2068
+ _lastSnapshotTime: number;
2069
+ _lastVisibilityChangeTime: number;
2070
+ pushPayloadTimerId: ReturnType<typeof setTimeout> | undefined;
2071
+ hasSessionUnloaded: boolean;
2072
+ hasPushedData: boolean;
2073
+ reloaded: boolean;
2074
+ _hasPreviouslyInitialized: boolean;
2075
+ _recordStop: listenerHandler | undefined;
2076
+ _integrations: IntegrationClient[];
2077
+ constructor(options: HighlightClassOptions);
2078
+ _reset({ forceNew, sessionKey, }: {
2079
+ forceNew?: boolean;
2080
+ sessionKey?: string;
2081
+ }): Promise<void>;
2082
+ _initMembers(options: HighlightClassOptions): void;
2083
+ identify(user_identifier: string, user_object?: {}, source?: Source): void;
2084
+ track(event: string, metadata?: Metadata_2): void;
2085
+ addProperties(properties_obj?: {}, typeArg?: PropertyType): void;
2086
+ /**
2087
+ * Add custom session-level properties. These are attached to the current session
2088
+ * and are searchable, but do not create timeline Track events.
2089
+ */
2090
+ addSessionProperties(properties: {
2091
+ [key: string]: any;
2092
+ }): void;
2093
+ start(options?: StartOptions): Promise<void>;
2094
+ _visibilityHandler(hidden: boolean): Promise<void>;
2095
+ _setupCrossOriginIframe(): Promise<void>;
2096
+ _setupCrossOriginIframeParent(): void;
2097
+ _setupWindowListeners(): void;
2098
+ /**
2099
+ * Stops Highlight from recording.
2100
+ * @param manual The end user requested to stop recording.
2101
+ */
2102
+ stop(manual?: boolean): void;
2103
+ /**
2104
+ * Returns the current timestamp for the current session.
2105
+ */
2106
+ getCurrentSessionURLWithTimestamp(): string;
2107
+ getCurrentSessionURL(): string | null;
2108
+ snapshot(element: HTMLCanvasElement): Promise<void>;
2109
+ addSessionFeedback({ timestamp, verbatim, user_email, user_name, }: {
2110
+ verbatim: string;
2111
+ timestamp: string;
2112
+ user_name?: string;
2113
+ user_email?: string;
2114
+ }): void;
2115
+ _save(): Promise<void>;
2116
+ /**
2117
+ * This proxy should be used instead of rrweb's native addCustomEvent.
2118
+ * The proxy makes sure recording has started before emitting a custom event.
2119
+ */
2120
+ addCustomEvent<T>(tag: string, payload: T): void;
2121
+ _sendPayload({ sendFn, }: {
2122
+ sendFn?: (payload: PushSessionEventsMutationVariables) => Promise<number>;
2123
+ }): Promise<void>;
2124
+ private takeFullSnapshot;
2125
+ register(client: LDClientMin, metadata: LDPluginEnvironmentMetadata): void;
2126
+ getHooks(metadata: LDPluginEnvironmentMetadata): Hook[];
2127
+ getRecordingState(): "NotRecording" | "Recording";
2128
+ getSession(): SessionDetails | null;
2129
+ private getFrontendUrl;
2130
+ }
2131
+
2132
+ declare type removedNodeMutation = {
2133
+ parentId: number;
2134
+ id: number;
2135
+ isShadow?: boolean;
2136
+ };
2137
+
2138
+ declare interface Request_2 {
2139
+ sessionSecureID: string;
2140
+ id: string;
2141
+ url: string;
2142
+ verb: string;
2143
+ headers?: Headers_2;
2144
+ body: any;
2145
+ }
2146
+
2147
+ export declare interface RequestResponsePair {
2148
+ request: Request_2;
2149
+ response: Response_2;
2150
+ /** Whether this URL matched a `urlToBlock` so the contents should not be recorded. */
2151
+ urlBlocked: boolean;
2152
+ }
2153
+
2154
+ declare type ResetMessage = {
2155
+ type: MessageType.Reset;
2156
+ };
2157
+
2158
+ declare interface Response_2 {
2159
+ status: number;
2160
+ headers?: {
2161
+ [k: string]: string;
2162
+ };
2163
+ body: any;
2164
+ /** Number of Bytes transferred over the network. */
2165
+ size?: number;
2166
+ }
2167
+
2168
+ declare type SamplingStrategy = {
2169
+ /**
2170
+ * 'all' will record every single canvas call.
2171
+ * a number will record an image snapshots in a web-worker a (maximum) number of times per second.
2172
+ * Number is only supported where [`OffscreenCanvas`](http://mdn.io/offscreencanvas) is supported.
2173
+ */
2174
+ canvas?: 'all' | number;
2175
+ /**
2176
+ * For manual usage of `H.snapshot(element) from your canvas rendering function.
2177
+ * See https://www.highlight.io/docs/getting-started/client-sdk/replay-configuration/canvas for setup.`
2178
+ * a number will record an image snapshots in a web-worker a (maximum) number of times per second.
2179
+ */
2180
+ canvasManualSnapshot?: number;
2181
+ /**
2182
+ * A quality at which to take canvas snapshots. See https://developer.mozilla.org/en-US/docs/Web/API/createImageBitmap
2183
+ * @deprecated This value is no longer used.
2184
+ */
2185
+ canvasQuality?: 'pixelated' | 'low' | 'medium' | 'high';
2186
+ /**
2187
+ * A multiplier resolution at which to take canvas snapshots.
2188
+ */
2189
+ canvasFactor?: number;
2190
+ /**
2191
+ * The maximum dimension to take canvas snapshots at.
2192
+ * This setting takes precedence over resizeFactor if the resulting image size
2193
+ * from the resizeFactor calculation is larger than this value.
2194
+ * Eg: set to 600 to ensure that the canvas is saved with images no larger than 600px
2195
+ * in either dimension (while preserving the original canvas aspect ratio).
2196
+ */
2197
+ canvasMaxSnapshotDimension?: number;
2198
+ /**
2199
+ * Default behavior for WebGL canvas elements with `preserveDrawingBuffer: false` is to clear the buffer to
2200
+ * load the canvas into memory to avoid getting a transparent bitmap.
2201
+ * Set to false to disable the clearing (in case there are visual glitches in the canvas).
2202
+ */
2203
+ canvasClearWebGLBuffer?: boolean;
2204
+ /**
2205
+ * Time (in milliseconds) to wait before the initial snapshot of canvas/video elements.
2206
+ */
2207
+ canvasInitialSnapshotDelay?: number;
2208
+ /**
2209
+ * Settings for canvas data serialization. Defaults to {"image/webp", 0.9} for browsers
2210
+ * that support WebP and {"image/jpeg", 0.6} for others. Can be overridden to any type
2211
+ * or quality value supported by [`toDataURL`](http://mdn.io/toDataURL).
2212
+ */
2213
+ dataUrlOptions?: Partial<{
2214
+ type: string;
2215
+ quality: number;
2216
+ }>;
2217
+ };
2218
+
2219
+ /** All built-in and custom scalars, mapped to their actual values */
2220
+ declare type Scalars = {
2221
+ ID: {
2222
+ input: string;
2223
+ output: string;
2224
+ };
2225
+ String: {
2226
+ input: string;
2227
+ output: string;
2228
+ };
2229
+ Boolean: {
2230
+ input: boolean;
2231
+ output: boolean;
2232
+ };
2233
+ Int: {
2234
+ input: number;
2235
+ output: number;
2236
+ };
2237
+ Float: {
2238
+ input: number;
2239
+ output: number;
2240
+ };
2241
+ Any: {
2242
+ input: any;
2243
+ output: any;
2244
+ };
2245
+ Int64: {
2246
+ input: any;
2247
+ output: any;
2248
+ };
2249
+ Int64ID: {
2250
+ input: any;
2251
+ output: any;
2252
+ };
2253
+ Timestamp: {
2254
+ input: any;
2255
+ output: any;
2256
+ };
2257
+ };
2258
+
2259
+ declare type scrollData = {
2260
+ source: IncrementalSource.Scroll;
2261
+ } & scrollPosition;
2262
+
2263
+ declare type scrollPosition = {
2264
+ id: number;
2265
+ x: number;
2266
+ y: number;
2267
+ };
2268
+
2269
+ declare interface SegmentContext {
2270
+ payload: any;
2271
+ next: any;
2272
+ integrations?: any;
2273
+ }
2274
+
2275
+ declare type selectionData = {
2276
+ source: IncrementalSource.Selection;
2277
+ } & selectionParam;
2278
+
2279
+ declare type selectionParam = {
2280
+ ranges: Array<SelectionRange>;
2281
+ };
2282
+
2283
+ declare type SelectionRange = {
2284
+ start: number;
2285
+ startOffset: number;
2286
+ end: number;
2287
+ endOffset: number;
2288
+ };
2289
+
2290
+ declare type SerializedBlobArg = {
2291
+ rr_type: 'Blob';
2292
+ data: Array<CanvasArg>;
2293
+ type?: string;
2294
+ };
2295
+
2296
+ declare type SerializedCanvasArg = {
2297
+ rr_type: 'ArrayBuffer';
2298
+ base64: string;
2299
+ } | SerializedBlobArg | {
2300
+ rr_type: string;
2301
+ src: string;
2302
+ } | {
2303
+ rr_type: string;
2304
+ args: Array<CanvasArg>;
2305
+ } | {
2306
+ rr_type: string;
2307
+ index: number;
2308
+ };
2309
+
2310
+ declare type SerializedCssTextArg = {
2311
+ rr_type: 'CssText';
2312
+ cssTexts: string[];
2313
+ };
2314
+
2315
+ declare type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & {
2316
+ rootId?: number;
2317
+ isShadowHost?: boolean;
2318
+ isShadow?: boolean;
2319
+ };
2320
+
2321
+ declare type serializedNodeWithId = serializedNode & {
2322
+ id: number;
2323
+ };
2324
+
2325
+ declare type SessionData = {
2326
+ sessionSecureID: string;
2327
+ sessionKey?: string;
2328
+ projectID: number;
2329
+ sessionStartTime?: number;
2330
+ lastPushTime?: number;
2331
+ userIdentifier?: string;
2332
+ userObject?: Object;
2333
+ };
2334
+
2335
+ declare interface SessionDetails {
2336
+ /** The URL to view the session. */
2337
+ url: string;
2338
+ /** The URL to view the session at the time getSessionDetails was called during the session recording. */
2339
+ urlWithTimestamp: string;
2340
+ /** The secure ID of the session. */
2341
+ sessionSecureID: string;
2342
+ }
2343
+
2344
+ declare interface SessionFeedbackOptions {
2345
+ verbatim: string;
2346
+ userName?: string;
2347
+ userEmail?: string;
2348
+ timestampOverride?: string;
2349
+ }
2350
+
2351
+ declare type SessionShortcutOptions = false | string;
2352
+
2353
+ declare type Source = 'segment' | 'LaunchDarkly' | undefined;
2354
+
2355
+ /**
2356
+ * An interface that represents a span. A span represents a single operation
2357
+ * within a trace. Examples of span might include remote procedure calls or a
2358
+ * in-process function calls to sub-components. A Trace has a single, top-level
2359
+ * "root" Span that in turn may have zero or more child Spans, which in turn
2360
+ * may have children.
2361
+ *
2362
+ * Spans are created by the {@link Tracer.startSpan} method.
2363
+ */
2364
+ declare interface Span {
2365
+ /**
2366
+ * Returns the {@link SpanContext} object associated with this Span.
2367
+ *
2368
+ * Get an immutable, serializable identifier for this span that can be used
2369
+ * to create new child spans. Returned SpanContext is usable even after the
2370
+ * span ends.
2371
+ *
2372
+ * @returns the SpanContext object associated with this Span.
2373
+ */
2374
+ spanContext(): SpanContext;
2375
+ /**
2376
+ * Sets an attribute to the span.
2377
+ *
2378
+ * Sets a single Attribute with the key and value passed as arguments.
2379
+ *
2380
+ * @param key the key for this attribute.
2381
+ * @param value the value for this attribute. Setting a value null or
2382
+ * undefined is invalid and will result in undefined behavior.
2383
+ */
2384
+ setAttribute(key: string, value: SpanAttributeValue): this;
2385
+ /**
2386
+ * Sets attributes to the span.
2387
+ *
2388
+ * @param attributes the attributes that will be added.
2389
+ * null or undefined attribute values
2390
+ * are invalid and will result in undefined behavior.
2391
+ */
2392
+ setAttributes(attributes: SpanAttributes): this;
2393
+ /**
2394
+ * Adds an event to the Span.
2395
+ *
2396
+ * @param name the name of the event.
2397
+ * @param [attributesOrStartTime] the attributes that will be added; these are
2398
+ * associated with this event. Can be also a start time
2399
+ * if type is {@type TimeInput} and 3rd param is undefined
2400
+ * @param [startTime] start time of the event.
2401
+ */
2402
+ addEvent(name: string, attributesOrStartTime?: SpanAttributes | TimeInput, startTime?: TimeInput): this;
2403
+ /**
2404
+ * Adds a single link to the span.
2405
+ *
2406
+ * Links added after the creation will not affect the sampling decision.
2407
+ * It is preferred span links be added at span creation.
2408
+ *
2409
+ * @param link the link to add.
2410
+ */
2411
+ addLink(link: Link): this;
2412
+ /**
2413
+ * Adds multiple links to the span.
2414
+ *
2415
+ * Links added after the creation will not affect the sampling decision.
2416
+ * It is preferred span links be added at span creation.
2417
+ *
2418
+ * @param links the links to add.
2419
+ */
2420
+ addLinks(links: Link[]): this;
2421
+ /**
2422
+ * Sets a status to the span. If used, this will override the default Span
2423
+ * status. Default is {@link SpanStatusCode.UNSET}. SetStatus overrides the value
2424
+ * of previous calls to SetStatus on the Span.
2425
+ *
2426
+ * @param status the SpanStatus to set.
2427
+ */
2428
+ setStatus(status: SpanStatus): this;
2429
+ /**
2430
+ * Updates the Span name.
2431
+ *
2432
+ * This will override the name provided via {@link Tracer.startSpan}.
2433
+ *
2434
+ * Upon this update, any sampling behavior based on Span name will depend on
2435
+ * the implementation.
2436
+ *
2437
+ * @param name the Span name.
2438
+ */
2439
+ updateName(name: string): this;
2440
+ /**
2441
+ * Marks the end of Span execution.
2442
+ *
2443
+ * Call to End of a Span MUST not have any effects on child spans. Those may
2444
+ * still be running and can be ended later.
2445
+ *
2446
+ * Do not return `this`. The Span generally should not be used after it
2447
+ * is ended so chaining is not desired in this context.
2448
+ *
2449
+ * @param [endTime] the time to set as Span's end time. If not provided,
2450
+ * use the current time as the span's end time.
2451
+ */
2452
+ end(endTime?: TimeInput): void;
2453
+ /**
2454
+ * Returns the flag whether this span will be recorded.
2455
+ *
2456
+ * @returns true if this Span is active and recording information like events
2457
+ * with the `AddEvent` operation and attributes using `setAttributes`.
2458
+ */
2459
+ isRecording(): boolean;
2460
+ /**
2461
+ * Sets exception as a span event
2462
+ * @param exception the exception the only accepted values are string or Error
2463
+ * @param [time] the time to set as Span's event time. If not provided,
2464
+ * use the current time.
2465
+ */
2466
+ recordException(exception: Exception, time?: TimeInput): void;
2467
+ }
2468
+
2469
+ /**
2470
+ * @deprecated please use {@link Attributes}
2471
+ */
2472
+ declare type SpanAttributes = Attributes;
2473
+
2474
+ /**
2475
+ * @deprecated please use {@link AttributeValue}
2476
+ */
2477
+ declare type SpanAttributeValue = AttributeValue;
2478
+
2479
+ /**
2480
+ * A SpanContext represents the portion of a {@link Span} which must be
2481
+ * serialized and propagated along side of a {@link Baggage}.
2482
+ */
2483
+ declare interface SpanContext {
2484
+ /**
2485
+ * The ID of the trace that this span belongs to. It is worldwide unique
2486
+ * with practically sufficient probability by being made as 16 randomly
2487
+ * generated bytes, encoded as a 32 lowercase hex characters corresponding to
2488
+ * 128 bits.
2489
+ */
2490
+ traceId: string;
2491
+ /**
2492
+ * The ID of the Span. It is globally unique with practically sufficient
2493
+ * probability by being made as 8 randomly generated bytes, encoded as a 16
2494
+ * lowercase hex characters corresponding to 64 bits.
2495
+ */
2496
+ spanId: string;
2497
+ /**
2498
+ * Only true if the SpanContext was propagated from a remote parent.
2499
+ */
2500
+ isRemote?: boolean;
2501
+ /**
2502
+ * Trace flags to propagate.
2503
+ *
2504
+ * It is represented as 1 byte (bitmap). Bit to represent whether trace is
2505
+ * sampled or not. When set, the least significant bit documents that the
2506
+ * caller may have recorded trace data. A caller who does not record trace
2507
+ * data out-of-band leaves this flag unset.
2508
+ *
2509
+ * see {@link TraceFlags} for valid flag values.
2510
+ */
2511
+ traceFlags: number;
2512
+ /**
2513
+ * Tracing-system-specific info to propagate.
2514
+ *
2515
+ * The tracestate field value is a `list` as defined below. The `list` is a
2516
+ * series of `list-members` separated by commas `,`, and a list-member is a
2517
+ * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs
2518
+ * surrounding `list-members` are ignored. There can be a maximum of 32
2519
+ * `list-members` in a `list`.
2520
+ * More Info: https://www.w3.org/TR/trace-context/#tracestate-field
2521
+ *
2522
+ * Examples:
2523
+ * Single tracing system (generic format):
2524
+ * tracestate: rojo=00f067aa0ba902b7
2525
+ * Multiple tracing systems (with different formatting):
2526
+ * tracestate: rojo=00f067aa0ba902b7,congo=t61rcWkgMzE
2527
+ */
2528
+ traceState?: TraceState;
2529
+ }
2530
+
2531
+ declare enum SpanKind {
2532
+ /** Default value. Indicates that the span is used internally. */
2533
+ INTERNAL = 0,
2534
+ /**
2535
+ * Indicates that the span covers server-side handling of an RPC or other
2536
+ * remote request.
2537
+ */
2538
+ SERVER = 1,
2539
+ /**
2540
+ * Indicates that the span covers the client-side wrapper around an RPC or
2541
+ * other remote request.
2542
+ */
2543
+ CLIENT = 2,
2544
+ /**
2545
+ * Indicates that the span describes producer sending a message to a
2546
+ * broker. Unlike client and server, there is no direct critical path latency
2547
+ * relationship between producer and consumer spans.
2548
+ */
2549
+ PRODUCER = 3,
2550
+ /**
2551
+ * Indicates that the span describes consumer receiving a message from a
2552
+ * broker. Unlike client and server, there is no direct critical path latency
2553
+ * relationship between producer and consumer spans.
2554
+ */
2555
+ CONSUMER = 4
2556
+ }
2557
+
2558
+ /**
2559
+ * Options needed for span creation
2560
+ */
2561
+ declare interface SpanOptions {
2562
+ /**
2563
+ * The SpanKind of a span
2564
+ * @default {@link SpanKind.INTERNAL}
2565
+ */
2566
+ kind?: SpanKind;
2567
+ /** A span's attributes */
2568
+ attributes?: SpanAttributes;
2569
+ /** {@link Link}s span to other spans */
2570
+ links?: Link[];
2571
+ /** A manually specified start time for the created `Span` object. */
2572
+ startTime?: TimeInput;
2573
+ /** The new span should be a root span. (Ignore parent from context). */
2574
+ root?: boolean;
2575
+ }
2576
+
2577
+ declare interface SpanStatus {
2578
+ /** The status code of this message. */
2579
+ code: SpanStatusCode;
2580
+ /** A developer-facing error message. */
2581
+ message?: string;
2582
+ }
2583
+
2584
+ /**
2585
+ * An enumeration of status codes.
2586
+ */
2587
+ declare enum SpanStatusCode {
2588
+ /**
2589
+ * The default status.
2590
+ */
2591
+ UNSET = 0,
2592
+ /**
2593
+ * The operation has been validated by an Application developer or
2594
+ * Operator to have completed successfully.
2595
+ */
2596
+ OK = 1,
2597
+ /**
2598
+ * The operation contains an error.
2599
+ */
2600
+ ERROR = 2
2601
+ }
2602
+
2603
+ declare interface StartOptions {
2604
+ /**
2605
+ * Specifies whether console warn messages should not be created.
2606
+ */
2607
+ silent?: boolean;
2608
+ /**
2609
+ * Starts a new recording session even if one was stopped recently.
2610
+ */
2611
+ forceNew?: boolean;
2612
+ /**
2613
+ * Key to use to determine the sessionSecureID in order to override session generation logic.
2614
+ * If a sessionKey is provided, the session will be combined with the previous session with the same key.
2615
+ * Otherwise, the current session logic will be used to generate a sessionSecureID.
2616
+ */
2617
+ sessionKey?: string;
2618
+ }
2619
+
2620
+ declare type StatusResponse = {
2621
+ type: MessageType.GetStatus;
2622
+ pendingCount: number;
2623
+ initialized: boolean;
2624
+ };
2625
+
2626
+ declare type StopEventResponse = {
2627
+ type: MessageType.Stop;
2628
+ requestStart: number;
2629
+ asyncEventsResponse: AsyncEventsResponse;
2630
+ };
2631
+
2632
+ declare type styleDeclarationData = {
2633
+ source: IncrementalSource.StyleDeclaration;
2634
+ } & styleDeclarationParam;
2635
+
2636
+ declare type styleDeclarationParam = {
2637
+ id?: number;
2638
+ styleId?: number;
2639
+ index: number[];
2640
+ set?: {
2641
+ property: string;
2642
+ value: string | null;
2643
+ priority: string | undefined;
2644
+ };
2645
+ remove?: {
2646
+ property: string;
2647
+ };
2648
+ };
2649
+
2650
+ declare type styleOMValue = {
2651
+ [key: string]: styleValueWithPriority | string | false;
2652
+ };
2653
+
2654
+ declare type styleSheetAddRule = {
2655
+ rule: string;
2656
+ index?: number | number[];
2657
+ };
2658
+
2659
+ declare type styleSheetDeleteRule = {
2660
+ index: number | number[];
2661
+ };
2662
+
2663
+ declare type styleSheetRuleData = {
2664
+ source: IncrementalSource.StyleSheetRule;
2665
+ } & styleSheetRuleParam;
2666
+
2667
+ declare type styleSheetRuleParam = {
2668
+ id?: number;
2669
+ styleId?: number;
2670
+ removes?: styleSheetDeleteRule[];
2671
+ adds?: styleSheetAddRule[];
2672
+ replace?: string;
2673
+ replaceSync?: string;
2674
+ };
2675
+
2676
+ declare type styleValueWithPriority = [string, string];
2677
+
2678
+ declare type textMutation = {
2679
+ id: number;
2680
+ value: string | null;
2681
+ };
2682
+
2683
+ declare type textNode = {
2684
+ type: NodeType.Text;
2685
+ textContent: string;
2686
+ isStyle?: true;
2687
+ };
2688
+
2689
+ /**
2690
+ * Defines TimeInput.
2691
+ *
2692
+ * hrtime, epoch milliseconds, performance.now() or Date
2693
+ */
2694
+ declare type TimeInput = HrTime | number | Date;
2695
+
2696
+ declare interface TraceState {
2697
+ /**
2698
+ * Create a new TraceState which inherits from this TraceState and has the
2699
+ * given key set.
2700
+ * The new entry will always be added in the front of the list of states.
2701
+ *
2702
+ * @param key key of the TraceState entry.
2703
+ * @param value value of the TraceState entry.
2704
+ */
2705
+ set(key: string, value: string): TraceState;
2706
+ /**
2707
+ * Return a new TraceState which inherits from this TraceState but does not
2708
+ * contain the given key.
2709
+ *
2710
+ * @param key the key for the TraceState entry to be removed.
2711
+ */
2712
+ unset(key: string): TraceState;
2713
+ /**
2714
+ * Returns the value to which the specified key is mapped, or `undefined` if
2715
+ * this map contains no mapping for the key.
2716
+ *
2717
+ * @param key with which the specified value is to be associated.
2718
+ * @returns the value to which the specified key is mapped, or `undefined` if
2719
+ * this map contains no mapping for the key.
2720
+ */
2721
+ get(key: string): string | undefined;
2722
+ /**
2723
+ * Serializes the TraceState to a `list` as defined below. The `list` is a
2724
+ * series of `list-members` separated by commas `,`, and a list-member is a
2725
+ * key/value pair separated by an equals sign `=`. Spaces and horizontal tabs
2726
+ * surrounding `list-members` are ignored. There can be a maximum of 32
2727
+ * `list-members` in a `list`.
2728
+ *
2729
+ * @returns the serialized string.
2730
+ */
2731
+ serialize(): string;
2732
+ }
2733
+
2734
+ declare interface UpDownCounter<AttributesTypes extends MetricAttributes = MetricAttributes> {
2735
+ /**
2736
+ * Increment value of counter by the input. Inputs may be negative.
2737
+ */
2738
+ add(value: number, attributes?: AttributesTypes, context?: Context): void;
2739
+ }
2740
+
2741
+ declare type viewportResizeData = {
2742
+ source: IncrementalSource.ViewportResize;
2743
+ } & viewportResizeDimension;
2744
+
2745
+ declare type viewportResizeDimension = {
2746
+ width: number;
2747
+ height: number;
2748
+ };
2749
+
2750
+ export declare type ViewportResizeListenerArgs = Omit<Screen, 'orientation'> & {
2751
+ orientation: number;
2752
+ };
2753
+
2754
+ declare interface WebSocketEvent {
2755
+ socketId: string;
2756
+ type: 'error' | 'received' | 'sent';
2757
+ name: string;
2758
+ timeStamp: number;
2759
+ size?: number;
2760
+ message?: string;
2761
+ }
2762
+
2763
+ declare interface WebSocketRequest {
2764
+ socketId: string;
2765
+ initiatorType: 'websocket';
2766
+ type: 'open' | 'close';
2767
+ name: string;
2768
+ startTimeAbs?: number;
2769
+ responseEndAbs?: number;
2770
+ }
2771
+
2772
+ export { }