import { BrowserPlugin } from "@snowplow/browser-tracker-core"; import { CommonEventProperties, DynamicContext } from "@snowplow/tracker-core"; /** A list of CSS classes that will have their clicks tracked */ type AllowList = { allowlist: string[]; }; /** A list of CSS classes that will _not_ have their clicks tracked */ type DenyList = { denylist: string[]; }; /** A function which determines whether a button click should be tracked */ type FilterFunction = (element: HTMLElement) => boolean; /** A filter for button click tracking */ type Filter = AllowList | DenyList | FilterFunction; /** The configuration for automatic button click tracking */ interface ButtonClickTrackingConfiguration { /** The filter options for the button click tracking */ filter?: Filter; /** The dynamic context which will be evaluated for each button click event */ context?: DynamicContext; /** A default label to use if one can not be determined by the content or data attributes */ defaultLabel?: string | ((element: HTMLElement) => string); } /** * A Button Click event * * Used when a user clicks on a ` * * will result in `{ label: 'show-modal' }` */ label: string; /** The ID of the button clicked, if present */ id?: string; /** An array of class names from the button clicked */ classes?: Array; /** The name of the button, if present */ name?: string; } /** * Button click tracking * * Will automatically tracking button clicks once enabled with 'enableButtonClickTracking' * or you can manually track button clicks with 'trackButtonClick' */ declare function ButtonClickTrackingPlugin(): BrowserPlugin; /** * Manually log a click * * @param event - The event information * @param trackers - The tracker identifiers which the event will be sent to */ declare function trackButtonClick(event: ButtonClickEvent & CommonEventProperties, trackers?: Array): void; /** * Enable automatic click tracking for all `