UNPKG

posthog-js

Version:

Posthog-js allows you to automatically capture usage and send events to PostHog.

50 lines (49 loc) • 2.27 kB
import type { Client, Extension } from '@posthog/browser-common'; import RageClick from './extensions/rageclick'; import { Properties, RemoteConfigResult } from './types'; import type { AutocaptureConfigSource } from './autocapture-config'; export declare function getAugmentPropertiesFromElement(elem: Element): Properties; export declare function previousElementSibling(el: Element): Element | null; export declare function getDefaultProperties(eventType: string): Properties; export declare function getPropertiesFromElement(elem: Element, maskAllAttributes: boolean, maskText: boolean, elementAttributeIgnorelist: string[] | undefined, disableCaptureUrlHashes?: boolean): Properties; export declare function autocapturePropertiesForElement(target: Element, { e, maskAllElementAttributes, maskAllText, elementAttributeIgnoreList, elementsChainAsString, disableCaptureUrlHashes, }: { e: Event; maskAllElementAttributes: boolean; maskAllText: boolean; elementAttributeIgnoreList?: string[] | undefined; elementsChainAsString: boolean; disableCaptureUrlHashes: boolean; }): { props: Properties; explicitNoCapture?: boolean; }; export declare class Autocapture implements Extension { private readonly _configSource; readonly name: import("@posthog/browser-common").ExtensionToken<Autocapture>; _initialized: boolean; _isDisabledServerSide: boolean | null; _hasReceivedConfigResponse: boolean; _elementSelectors: Set<string> | null; rageclicks: RageClick; _elementsChainAsString: boolean; private _client?; private readonly _config; private _remoteConfigSubscription?; private _domEventHandler?; private _copiedTextHandler?; private _disposed; constructor(_configSource: AutocaptureConfigSource); setup(client: Client): void; dispose(): void; private _refreshConfig; private _compileUrlPatterns; _addDomEventHandlers(): void; private _removeDomEventHandlers; startIfEnabled(): void; onRemoteConfig(result: RemoteConfigResult): void; setElementSelectors(selectors: Set<string>): void; getElementSelectors(element: Element | null): string[] | null; get isEnabled(): boolean; private _captureEvent; isBrowserSupported(): boolean; }