import { TimestampedEvent } from './helpers'; import { type ShadowGate } from './shadow-mode'; import { Observable } from '@amplitude/analytics-core'; /** * Observe mutations across the main document and any open shadow roots. * * A single `MutationObserver` cannot see into shadow trees — `subtree: true` * stops at each boundary — so one observer is attached to every open shadow root * separately. Roots are discovered from two places: a recursive scan of the * existing DOM, and the observer's own callback, which checks each mutation's * `addedNodes` for roots that mount later. Both are bounded by the mode's depth * budget. Closed roots report `shadowRoot === null` and are skipped. * * The scan of existing DOM runs from `shadowGate.onArm` rather than inline, * because the gate is typically still off when the plugin builds its * observables and arms once remote config arrives. `onArm` fires on that arming * call, or synchronously if the gate is already armed, so the set of observed * roots does not depend on which happened first. * * When the mode is off, only `document.body` is observed. * * Known limitation: discovery is scan-based (DFS via `collectOpenShadowRoots` * on `addedNodes`), so a shadow root attached via `attachShadow` to an element * already in the DOM is not observed — that call emits no mutation record. * Mitigations and follow-ups: `packages/plugin-autocapture-browser/SHADOW-DOM.md`. */ export declare const createMutationObservable: (shadowGate?: ShadowGate) => Observable; /** * Creates an observable that tracks click events on the document. * @param clickType - The type of click event to track (click or pointerdown) */ export declare const createClickObservable: (clickType?: 'click' | 'pointerdown') => Observable; export declare const createScrollObservable: () => Observable; export declare const createExposureObservable: (mutationObservable: Observable>, selectorAllowlist: string[], registerRescanOrShadowGate?: ShadowGate | ((rescan: (() => void) | undefined) => void) | undefined, maybeShadowGate?: ShadowGate) => Observable; export type BrowserErrorEvent = { kind: 'error' | 'unhandledrejection' | 'console'; message?: string; filename?: string; lineNumber?: number; columnNumber?: number; stack?: string; }; export declare const createErrorObservable: () => Observable; export declare const createMouseMoveObservable: () => Observable; //# sourceMappingURL=observables.d.ts.map