import { AnalyticsConfig } from '@plitzi/sdk-shared'; export type ReporterEvent = { id: string; type: 'render' | 'interaction' | 'custom'; ts: number; page: { path: string; title?: string; }; ref?: { referrer?: string; utm?: Record; }; name?: string; props?: Record; }; export type Reporter = { /** A page came into view — the first paint of a client-side render, or an SPA route change. */ trackRender: () => void; /** A named thing the visitor did. */ track: (name: string, props?: Record) => void; /** Sends whatever is queued. Called on a full batch, on a timer, and when the page goes away. */ flush: () => void; /** Stops the timer and sends what is left. */ stop: () => void; }; /** * The browser's half of analytics: SPA route changes, named interactions, and the first view of a render the * server never saw. It reports what only the browser knows, and it is trusted with nothing else — the page * views behind an invoice are counted server-side, at the SSR render and the schema fetch, where a visitor * has no say. So a hostile client here can pollute a dashboard, never a bill. * * Events are batched and sent with `sendBeacon`, which survives the page going away — the flush on * `visibilitychange` is the only one that reliably runs on a real navigation, and it is exactly the one that * `fetch` would have lost. */ export declare const createReporter: (config: AnalyticsConfig, batchSize?: number, flushIntervalMs?: number) => Reporter;