import { InjectionKey, Plugin } from 'vue'; /** * Public configuration passed to `createTigr()` / the Vue plugin. */ interface TigrConfig { /** Project API key (e.g. `tigr_pk_live_8f2a`). Identifies the project. */ apiKey: string; /** * Where events are sent. Defaults to tigr's hosted ingestion endpoint; * override it to target a local ingestion service in development. An empty * string forces console-only mode (logs events, sends nothing). */ host?: string; /** * Auto-capture toggles. `true`/omitted = everything on, `false` = nothing, * or an object to switch individual signals on/off. */ autoCapture?: boolean | Partial; /** Flush the queue this many ms after the first buffered event. Default: 2000. */ flushInterval?: number; /** Force a flush once the queue reaches this many events. Default: 20. */ batchSize?: number; /** Log every event + flush to the console. Default: false. */ debug?: boolean; /** * Dev mode. When `true` the SDK does nothing — no auto-capture, no events, * no network. Turn it on in development so your own activity doesn't pollute * your analytics. Default: false. */ devMode?: boolean; } /** Which automatic signals the SDK captures with zero extra code. */ interface AutoCaptureOptions { pageview: boolean; scrollDepth: boolean; error: boolean; pageLeave: boolean; } /** `auto` = captured by the SDK; `manual` = sent via `track()` by the dev. */ type TigrEventType = 'auto' | 'manual'; /** A single captured event. */ interface TigrEvent { name: string; type: TigrEventType; properties: Record; timestamp: number; } /** Environment context, sent once per batch rather than per event. */ interface TigrContext { url: string; path: string; referrer: string; userAgent: string; locale: string; screen: { w: number; h: number; }; } /** * The wire format sent to the ingestion endpoint. NOTE: provisional — the * exact shape is finalised when the backend `/events` endpoint is built. * Kept in one place so changing it later is a one-file edit. */ interface TigrPayload { apiKey: string; visitorId: string; sessionId: string; userId: string | null; events: TigrEvent[]; context: TigrContext; sentAt: number; } /** * The minimal surface the capture functions need from the client. * Depending on this interface (instead of the `TigrClient` class) keeps the * dependency one-directional: client → auto-capture, never back. */ interface Capturer { track(name: string, properties?: Record, type?: TigrEventType): void; flush(useBeacon?: boolean): void; } /** * The framework-agnostic heart of the SDK. Knows nothing about Vue, React or * any framework — it only speaks browser. The Vue/React layers are thin * wrappers around an instance of this class. * * On the server (SSR) `enabled` is false and every method is a safe no-op. */ declare class TigrClient implements Capturer { private readonly config; /** False during SSR / non-browser → all methods become no-ops. */ readonly enabled: boolean; private readonly identity; private readonly transport; private stopAutoCapture; private readonly attribution; constructor(config: TigrConfig); /** * Record an event. Public manual API (`type` defaults to `manual`); the * auto-capture layer calls this with `type: 'auto'`. */ track(name: string, properties?: Record, type?: TigrEventType): void; /** Attach a real user id to the anonymous visitor (call on login). */ identify(userId: string, traits?: Record): void; /** * Set the current user and their profile traits (name, email, plan, …). * A friendlier alias for {@link identify} — both do the same thing. */ setUser(userId: string, traits?: Record): void; /** Forget the logged-in user and start a fresh session (call on logout). */ reset(): void; /** Send queued events now. Pass `true` to use sendBeacon (on unload). */ flush(useBeacon?: boolean): void; /** Detach all listeners and flush. Mainly for tests / hot-reload. */ shutdown(): void; private enqueue; private buildPayload; private getContext; } /** Convenience factory — `createTigr({ apiKey })`. */ declare function createTigr(config: TigrConfig): TigrClient; /** Injection key for retrieving the client via `useTigr()`. */ declare const TIGR_KEY: InjectionKey; /** * Vue plugin. Creates one TigrClient for the app and makes it available * through `useTigr()` and `this.$tigr`. * * app.use(TigrPlugin, { apiKey: 'tigr_pk_live_8f2a' }) * * SSR-safe: on the server the client is a no-op, so this is fine to install * unconditionally — though in Nuxt you'd register it as a `.client` plugin. */ declare const TigrPlugin: Plugin; /** * Composable: grab the tigr client inside `