/** * @name Puppr Signals Library * @description A TypeScript library to detect multiple types of user engagement signals, * including confusion and frustration patterns. * @version 0.0.1 */ import { RageClickOptions } from './signals/rageClick'; import { ErraticMouseOptions } from './signals/erraticMouse'; import { ScrollThrashOptions } from './signals/scrollThrash'; import { RapidNavigationOptions } from './signals/rapidNavigation'; import { RevisitingOptions } from './signals/revisiting'; import { IEngagementEventBus, EngagementType } from './signals/utils'; export interface PupprOptions { rageClick?: boolean | RageClickOptions; erraticMouse?: boolean | ErraticMouseOptions; scrollThrash?: boolean | ScrollThrashOptions; rapidNavigation?: boolean | RapidNavigationOptions; revisiting?: boolean | RevisitingOptions; globalCooldown?: number; dedupWindow?: number; } export interface PupprStats { totalEvents: number; blockedEvents: number; engagements: number; } export declare class Puppr { private detectors; private stats; private statSubscribers; private engagementSubscribers; private _eventBus; private _onConsoleLog; private _isStarted; constructor(options?: PupprOptions); /** Starts all configured detectors. */ start(): void; /** Stops all running detectors. */ stop(): void; /** Check if Puppr is currently running. */ isRunning(): boolean; /** Get the engagement event bus for advanced configuration. */ getEventBus(): IEngagementEventBus; /** Set the global cooldown for engagement events. */ setGlobalCooldown(ms: number): void; /** Set a specific cooldown for an event type. */ setEventTypeCooldown(eventType: string, ms: number): void; /** Clear all cooldowns for engagement events. */ clearAllCooldowns(): void; /** Set the deduplication window for engagement events. */ setDedupWindow(windowMs: number): void; /** Clear the deduplication cache. */ clearDedupCache(): void; /** Get the current deduplication window time. */ getDedupWindow(): number; /** Get a copy of the current stats. */ getStats(): PupprStats; /** Subscribe to stat changes. Returns an unsubscribe function. */ onStatsChange(cb: (stats: PupprStats) => void): () => void; /** Subscribe to engagement events. Returns an unsubscribe function. */ onEngagement(cb: (detail: any) => void): () => void; /** Manually trigger an engagement event. */ triggerEngagement(engagementType: EngagementType, eventType: string, message: string, data?: any): void; private _notifyStats; private _notifyEngagement; private _patchEventBusForStats; private _patchConsoleForCooldownStats; }