/** * Browser auth utilities for @sentry/api. * * Provides a fetch wrapper that handles cookie-based session auth and * CSRF token injection, allowing the SDK to be used inside the Sentry * frontend without a Bearer token. */ /** Matches the standard fetch signature without Bun/Node runtime extensions. */ export type FetchFn = (input: RequestInfo | URL, init?: RequestInit) => Promise; export type BrowserClientOptions = { /** Cookie name to read the CSRF token from. Defaults to 'sc' (Sentry's Django default). */ csrfCookieName?: string; /** Override the CSRF token getter — useful for testing. */ getCsrfToken?: () => string; /** Base URL for all requests. Defaults to '' (same-origin relative URLs). */ baseUrl?: string; }; /** * Returns a fetch wrapper that injects X-CSRFToken on state-changing requests * and sends session cookies via credentials: 'include'. * * Sentry's Django backend reads the CSRF token from the 'sc' cookie by default * (configurable via window.csrfCookieName in the frontend). * * Note: always sets credentials: 'include'; any credentials value in init is overridden. */ export declare function createBrowserFetch(opts?: BrowserClientOptions): FetchFn; /** * Returns options to spread into any @sentry/api SDK call from a browser context. * Configures relative base URL and cookie+CSRF auth automatically. * * @example * import {client} from '@sentry/api'; * import {createBrowserSdkConfig} from '@sentry/api/browser'; * client.setConfig(createBrowserSdkConfig()); */ export declare function createBrowserSdkConfig(opts?: BrowserClientOptions): { readonly baseUrl: string; readonly fetch: FetchFn; };