export type ExceptionLevel = "fatal" | "error" | "warning" | "info" | "debug"; /** Extra Sentry-style context accepted by `captureException`. */ export interface CaptureExceptionContext { /** Low-cardinality searchable tags. Values are coerced to strings. */ tags?: Record; /** Structured, higher-cardinality detail shown on the event. */ extra?: Record; /** Severity; defaults to "error". */ level?: ExceptionLevel; } export interface ExceptionBreadcrumb { timestamp: string; category: string; message: string; level?: ExceptionLevel; } /** * Compact exception payload emitted to transport. Field names are the wire * contract the analytics server ingest reads — keep them stable. */ export interface CapturedExceptionEvent { /** Error class/name, e.g. "TypeError". "Message" for `captureMessage`. */ type: string; message: string; /** Raw (bounded, redacted) stack string; server parses it into frames. */ stack?: string; /** False for uncaught/global errors, true for manually handled ones. */ handled: boolean; level: ExceptionLevel; /** ISO timestamp of the occurrence. */ occurredAt: string; url?: string; release?: string; environment?: string; sessionId?: string; /** Client session replay id (localStorage) for replay linkage. */ sessionReplayId?: string; anonymousId?: string; breadcrumbs: ExceptionBreadcrumb[]; tags?: Record; extra?: Record; } export interface InstallErrorCaptureOptions { /** Transport for a captured exception. Must not throw. */ send: (event: CapturedExceptionEvent) => void; /** Resolve current analytics/session-replay identifiers at capture time. */ getSessionContext?: () => { sessionId?: string; anonymousId?: string; replayId?: string; }; /** * Optional hook to also surface a manual capture on the session replay * timeline. Only invoked for manual `captureException`/`captureMessage`; * auto-captured global errors are already recorded by the replay recorder. */ emitReplayEvent?: (event: CapturedExceptionEvent) => void; release?: string; environment?: string; /** Auto-capture `window.onerror`. Defaults to true. */ captureGlobalErrors?: boolean; /** Auto-capture `unhandledrejection`. Defaults to true. */ captureUnhandledRejections?: boolean; /** Breadcrumb ring buffer size. Defaults to 20. */ maxBreadcrumbs?: number; /** Dedupe window (ms) for identical signatures. Defaults to 3000. */ dedupeWindowMs?: number; } /** Normalize any thrown value into a stable `{ type, message, stack }`. */ export declare function normalizeCapturedError(error: unknown): { type: string; message: string; stack?: string; }; /** Append a privacy-safe breadcrumb to the bounded ring buffer. */ export declare function addErrorBreadcrumb(breadcrumb: { category: string; message: string; level?: ExceptionLevel; }): void; /** * Capture a handled exception. Mirrors Sentry's `captureException(err, ctx)`. * Safe to call before `configureTracking` has run — it simply no-ops if no * transport is installed yet. */ export declare function captureException(error: unknown, context?: CaptureExceptionContext): void; /** * Capture a message string as an exception-like event. Mirrors Sentry's * `captureMessage(message, level?)`. */ export declare function captureMessage(message: string, level?: ExceptionLevel): void; /** * Install auto-capture + wire the transport. Idempotent: re-invoking updates * the config (and (re)installs global handlers) without duplicating listeners. * Returns a disposer that removes the global handlers. */ export declare function installErrorCapture(options: InstallErrorCaptureOptions): () => void; export declare function isErrorCaptureInstalled(): boolean; //# sourceMappingURL=error-capture.d.ts.map