/** * Browser entry — `gh-issue-tracker/browser`. * * Client-side helpers for collecting a bug report (screenshot + metadata) and * POSTing it to your own API route, which then calls `captureBugReport` on the * server (so the GitHub token never reaches the browser). * * `captureScreenshot` dynamically imports `modern-screenshot`, which is an * OPTIONAL peer dependency — install it only if you use screenshots. The server * entry (`gh-issue-tracker`) stays dependency-free. */ interface CaptureScreenshotOptions { /** * Element to capture. Defaults to `[data-screenshot-target]` if present, * otherwise `document.body`. */ target?: HTMLElement; /** Downscale factor (0–1). Default 0.5 keeps payloads small. */ scale?: number; /** JPEG quality (0–1). Default 0.75. */ quality?: number; /** * Selectors hidden during capture (e.g. the bug widget itself) so they don't * appear in the screenshot. Restored afterwards. */ hideSelectors?: string[]; } interface CapturedScreenshot { /** JPEG file ready to append to FormData. */ file: File; /** Data URL for an inline preview. */ preview: string; } /** * Capture the current page (including any open modal/dialog) as a JPEG using * `modern-screenshot`. Returns null if capture fails or runs outside a browser. */ declare function captureScreenshot(options?: CaptureScreenshotOptions): Promise; interface SubmitBugReportInput { /** Endpoint that calls `captureBugReport` on the server. */ endpoint: string; message: string; screenshot?: File | null; /** Pin location as a percentage of the viewport (0–100). */ pin?: { x: number; y: number; }; /** Extra fields appended to the multipart form. */ extra?: Record; /** Passed to fetch (e.g. credentials, headers). */ fetchInit?: RequestInit; } interface SubmitBugReportResult { ok: boolean; status: number; issueNumber?: number; issueUrl?: string; error?: string; } /** * Build the multipart form for a bug report, auto-collecting browser/environment * metadata (viewport, screen, UA, language, timezone, connection, referrer). */ declare function buildBugReportFormData(input: SubmitBugReportInput): FormData; /** Build the form and POST it to your bug-report endpoint. */ declare function submitBugReport(input: SubmitBugReportInput): Promise; export { type CaptureScreenshotOptions, type CapturedScreenshot, type SubmitBugReportInput, type SubmitBugReportResult, buildBugReportFormData, captureScreenshot, submitBugReport };