import { F as FeedbackApi } from './types-CfSqqfkw.js'; import './types-CRbb2Pp0.js'; /** * Always-on debugger module. Hooks `window.error` and `unhandledrejection`, * then ships each fresh runtime error as a synthetic FeedbackReport via * the existing widget submit pipeline. * * Same opt-in pattern as `withReplay` / `withWebVitals` — host apps that * want curated-feedback-only simply don't import it. * * Design choices (see PR description): * - Per-fingerprint cooldown (default 5 min) absorbs render loops without * flooding the operator dashboard or burning the per-key write throttle. * - Server-side fingerprinting groups across sessions; the client-side * fingerprint exists only to dedup within a single page lifetime, so * it doesn't need to match the server's hash. * - Recursion guard: an error thrown *inside* the submit pipeline must * not re-enter the handler. * - Description is the error message truncated at 200 chars — the full * stack lives in technical_context.errors[]. * - No screenshot is taken (buildAndSubmit honors `synthetic: true`): * html2canvas is slow + the DOM is unreliable mid-error. */ interface ErrorTrackingOptions { /** Opt-out kill switch without removing the import. Default `true`. */ enabled?: boolean; /** * Drop repeats of the same fingerprint within this window. * Default 300_000 ms (5 minutes). Set to 0 to disable dedup * (every fired error becomes a report — useful only for tests). */ perFingerprintCooldownMs?: number; /** * Probabilistic head sampling: 1.0 captures everything, 0.5 drops half. * Default 1.0. Sampled-out errors don't count toward the cooldown — if * you sample at 0.1, you'll still see ~10% of the volume per fingerprint. */ sampleRate?: number; /** Max characters in the auto-generated description. Default 200. */ maxDescriptionLen?: number; /** * Global ceiling on synthetic submissions per minute, regardless of * fingerprint. Defends against a hostile / buggy page that throws * errors with attacker-varying `message` strings (counter, nonce) — * each unique message creates a fresh fingerprint, bypassing the * per-fingerprint cooldown, and would otherwise burn the project's * backend write quota. * Default 30. Set to 0 to disable the global cap (not recommended). */ globalRatePerMinute?: number; /** * Max number of distinct fingerprints emitted per page lifetime. Once * exceeded, NEW fingerprints are dropped (the cooldown still applies * to already-seen ones, so legitimate repeating errors keep cycling). * Defense against a page that synthesizes an unbounded number of * unique error shapes. * Default 200. Set to 0 to disable. */ maxDistinctFingerprints?: number; } declare function withErrorTracking(fb: FeedbackApi, options?: ErrorTrackingOptions): FeedbackApi; export { type ErrorTrackingOptions, withErrorTracking };