import { FontFaceDescriptors } from 'css-font-loading-module'; declare type addedNodeMutation = { parentId: number; previousId?: number | null; nextId: number | null; node: serializedNodeWithId; }; declare interface AnalyticsTrackerOptions { metricName: string; data: TimingOpt | number | NavigatorOpt; eventProperties: object | undefined; navigatorInformation: unknown; vitalsScore: VitalsScore; } declare enum AskLevel { URGENT = 1, IDLE = 2 } declare type attributeMutation = { id: number; attributes: { [key: string]: string | null; }; }; declare type attributes = { [key: string]: string | number | boolean; }; declare type blockClass = string | RegExp; declare type canvasMutationCallback = (p: canvasMutationParam) => void; declare type canvasMutationData = { source: IncrementalSource.CanvasMutation; } & canvasMutationParam; declare type canvasMutationParam = { id: number; property: string; args: Array; setter?: true; }; declare type cdataNode = { type: NodeType.CDATA; textContent: ''; }; declare type commentNode = { type: NodeType.Comment; textContent: string; }; declare type customEvent = { type: EventType.Custom; data: { tag: string; payload: T; }; }; declare type documentNode = { type: NodeType.Document; childNodes: serializedNodeWithId[]; }; declare type documentTypeNode = { type: NodeType.DocumentType; name: string; publicId: string; systemId: string; }; declare type domContentLoadedEvent = { type: EventType.DomContentLoaded; data: {}; }; declare type EffectiveType = '2g' | '3g' | '4g' | '5g' | 'slow-2g' | 'lte'; declare type elementNode = { type: NodeType.Element; tagName: string; attributes: attributes; childNodes: serializedNodeWithId[]; isSVG?: true; needBlock?: boolean; }; declare type event_2 = domContentLoadedEvent | loadedEvent | fullSnapshotEvent | incrementalSnapshotEvent | metaEvent | logEvent | customEvent; declare enum EventType { DomContentLoaded = 0, Load = 1, FullSnapshot = 2, IncrementalSnapshot = 3, Meta = 4, Custom = 5 } declare type eventWithTime = event_2 & { timestamp: number; delay?: number; }; declare type fontCallback = (p: fontParam) => void; declare type fontData = { source: IncrementalSource.Font; } & fontParam; declare type fontParam = { family: string; fontSource: string; buffer: boolean; descriptors?: FontFaceDescriptors; }; declare type fullSnapshotEvent = { type: EventType.FullSnapshot; data: { node: serializedNodeWithId; initialOffset: { top: number; left: number; }; }; }; declare type hooksParam = { mutation?: mutationCallBack; mousemove?: mousemoveCallBack; mouseInteraction?: mouseInteractionCallBack; scroll?: scrollCallback; viewportResize?: viewportResizeCallback; input?: inputCallback; mediaInteaction?: mediaInteractionCallback; styleSheetRule?: styleSheetRuleCallback; canvasMutation?: canvasMutationCallback; font?: fontCallback; log?: logCallback; }; declare type incrementalData = mutationData | mousemoveData | mouseInteractionData | scrollData | viewportResizeData | inputData | mediaInteractionData | styleSheetRuleData | canvasMutationData | fontData | logData; declare type incrementalSnapshotEvent = { type: EventType.IncrementalSnapshot; data: incrementalData; }; declare enum IncrementalSource { Mutation = 0, MouseMove = 1, MouseInteraction = 2, Scroll = 3, ViewportResize = 4, Input = 5, TouchMove = 6, MediaInteraction = 7, StyleSheetRule = 8, CanvasMutation = 9, Font = 10, Log = 11, Drag = 12 } declare type inputCallback = (v: inputValue & { id: number; }) => void; declare type inputData = { source: IncrementalSource.Input; id: number; } & inputValue; declare type inputValue = { text: string; isChecked: boolean; }; declare type loadedEvent = { type: EventType.Load; data: {}; }; declare type logCallback = (p: LogParam) => void; declare type logData = { source: IncrementalSource.Log; } & LogParam; declare type logEvent = { type: EventType.IncrementalSnapshot; data: incrementalData; }; declare type Logger = { assert?: typeof console.assert; clear?: typeof console.clear; count?: typeof console.count; countReset?: typeof console.countReset; debug?: typeof console.debug; dir?: typeof console.dir; dirxml?: typeof console.dirxml; error?: typeof console.error; group?: typeof console.group; groupCollapsed?: typeof console.groupCollapsed; groupEnd?: () => void; info?: typeof console.info; log?: typeof console.log; table?: typeof console.table; time?: typeof console.time; timeEnd?: typeof console.timeEnd; timeLog?: typeof console.timeLog; trace?: typeof console.trace; warn?: typeof console.warn; }; declare type LogLevel = 'assert' | 'clear' | 'count' | 'countReset' | 'debug' | 'dir' | 'dirxml' | 'error' | 'group' | 'groupCollapsed' | 'groupEnd' | 'info' | 'log' | 'table' | 'time' | 'timeEnd' | 'timeLog' | 'trace' | 'warn'; declare type LogParam = { level: LogLevel; trace: string[]; payload: string[]; }; declare type LogRecordOptions = { level?: LogLevel[] | undefined; lengthThreshold?: number; stringifyOptions?: StringifyOptions; logger?: Logger; }; declare type MaskInputFn = (text: string) => string; declare type MaskInputOptions = Partial<{ color: boolean; date: boolean; 'datetime-local': boolean; email: boolean; month: boolean; number: boolean; range: boolean; search: boolean; tel: boolean; text: boolean; time: boolean; url: boolean; week: boolean; textarea: boolean; select: boolean; password: boolean; }>; declare type maskTextClass = string | RegExp; declare type MaskTextFn = (text: string) => string; declare type mediaInteractionCallback = (p: mediaInteractionParam) => void; declare type mediaInteractionData = { source: IncrementalSource.MediaInteraction; } & mediaInteractionParam; declare type mediaInteractionParam = { type: MediaInteractions; id: number; }; declare const enum MediaInteractions { Play = 0, Pause = 1 } declare type metaEvent = { type: EventType.Meta; data: { href: string; width: number; height: number; }; }; declare type mouseInteractionCallBack = (d: mouseInteractionParam) => void; declare type mouseInteractionData = { source: IncrementalSource.MouseInteraction; } & mouseInteractionParam; declare type mouseInteractionParam = { type: MouseInteractions; id: number; x: number; y: number; }; declare enum MouseInteractions { MouseUp = 0, MouseDown = 1, Click = 2, ContextMenu = 3, DblClick = 4, Focus = 5, Blur = 6, TouchStart = 7, TouchMove_Departed = 8, TouchEnd = 9 } declare type mousemoveCallBack = (p: mousePosition[], source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag) => void; declare type mousemoveData = { source: IncrementalSource.MouseMove | IncrementalSource.TouchMove | IncrementalSource.Drag; positions: mousePosition[]; }; declare type mousePosition = { x: number; y: number; id: number; timeOffset: number; }; declare type mutationCallBack = (m: mutationCallbackParam) => void; declare type mutationCallbackParam = { texts: textMutation[]; attributes: attributeMutation[]; removes: removedNodeMutation[]; adds: addedNodeMutation[]; isAttachIframe?: true; }; declare type mutationData = { source: IncrementalSource.Mutation; } & mutationCallbackParam; declare interface NavigatorOpt { userAgent: string; connection: { downlink?: number; effectiveType?: EffectiveType; rtt?: number; saveData?: boolean; [key: string]: unknown; bandwidth?: string; }; } declare enum NodeType { Document = 0, DocumentType = 1, Element = 2, Text = 3, CDATA = 4, Comment = 5 } declare type PackFn = (event: eventWithTime) => string; declare class PerformanceMonitoring { constructor(options: PerformanceMonitoringOptions); } export default PerformanceMonitoring; declare interface PerformanceMonitoringOptions { isObserverResourceTiming?: boolean | undefined; isObserverElementTiming?: boolean | undefined; maxTime?: number | undefined; captureError?: boolean | undefined; reportData?: ReportDataAchieve | undefined; fetchDomain?: string | undefined; errLogRoute?: string | undefined; errEventRoute?: string | undefined; logRoute?: string | undefined; analyticsTracker?: ((options: AnalyticsTrackerOptions) => void) | undefined; recordOptions?: recordOptions | undefined; } declare type recordOptions = { emit?: (e: T, isCheckout?: boolean) => void; checkoutEveryNth?: number; checkoutEveryNms?: number; blockClass?: blockClass; blockSelector?: string; ignoreClass?: string; maskTextClass?: maskTextClass; maskTextSelector?: string; maskAllInputs?: boolean; maskInputOptions?: MaskInputOptions; maskInputFn?: MaskInputFn; maskTextFn?: MaskTextFn; slimDOMOptions?: SlimDOMOptions | 'all' | true; inlineStylesheet?: boolean; hooks?: hooksParam; packFn?: PackFn; sampling?: SamplingStrategy; recordCanvas?: boolean; collectFonts?: boolean; mousemoveWait?: number; recordLog?: boolean | LogRecordOptions; }; declare type removedNodeMutation = { parentId: number; id: number; isShadow?: boolean; }; declare interface ReportDataAchieve { fetch: (label: AskLevel, body: string, uri: string) => void; } declare type SamplingStrategy = Partial<{ /** * false means not to record mouse/touch move events * number is the throttle threshold of recording mouse/touch move */ mousemove: boolean | number; /** * number is the throttle threshold of mouse/touch move callback */ mousemoveCallback: number; /** * false means not to record mouse interaction events * can also specify record some kinds of mouse interactions */ mouseInteraction: boolean | Record; /** * number is the throttle threshold of recording scroll */ scroll: number; /** * 'all' will record all the input events * 'last' will only record the last input value while input a sequence of chars */ input: 'all' | 'last'; }>; declare type scrollCallback = (p: scrollPosition) => void; declare type scrollData = { source: IncrementalSource.Scroll; } & scrollPosition; declare type scrollPosition = { id: number; x: number; y: number; }; declare type serializedNode = (documentNode | documentTypeNode | elementNode | textNode | cdataNode | commentNode) & { rootId?: number; isShadowHost?: boolean; isShadow?: boolean; }; declare type serializedNodeWithId = serializedNode & { id: number; }; declare type SlimDOMOptions = Partial<{ script: boolean; comment: boolean; headFavicon: boolean; headWhitespace: boolean; headMetaDescKeywords: boolean; headMetaSocial: boolean; headMetaRobots: boolean; headMetaHttpEquiv: boolean; headMetaAuthorship: boolean; headMetaVerification: boolean; }>; declare type StringifyOptions = { stringLengthLimit?: number; /** * limit of number of keys in an object * if an object contains more keys than this limit, we would call its toString function directly */ numOfKeysLimit: number; }; declare type styleSheetAddRule = { rule: string; index?: number; }; declare type styleSheetDeleteRule = { index: number; }; declare type styleSheetRuleCallback = (s: styleSheetRuleParam) => void; declare type styleSheetRuleData = { source: IncrementalSource.StyleSheetRule; } & styleSheetRuleParam; declare type styleSheetRuleParam = { id: number; removes?: styleSheetDeleteRule[]; adds?: styleSheetAddRule[]; }; declare type textMutation = { id: number; value: string | null; }; declare type textNode = { type: NodeType.Text; textContent: string; isStyle?: true; }; declare interface TimingOpt { fetchTime: number; workerTime: number; networkTime: number; downloadTime: number; timeToFirstByte: number; headerSize: number; dnsLookupTime: number; tcpTime: number; firstPaintTime: number; domRenderTime: number; onloadTime: number; domParseTime: number; } declare type viewportResizeCallback = (d: viewportResizeDimension) => void; declare type viewportResizeData = { source: IncrementalSource.ViewportResize; } & viewportResizeDimension; declare type viewportResizeDimension = { width: number; height: number; }; declare type VitalsScore = 'good' | 'needsImprovement' | 'poor' | null; export { }