import { type ClientPage, type ClientRequestAction, type ClientRequestFailureReason, type ClientStream, type ClientStreamEvent, type ClientWebVitalMetric } from "@opengeni/contracts/client-error-report"; /** * Classify a same-origin API request as one of the closed key actions, or * null. Only the method and the path shape are read; ids in the path are * matched, never reported. */ export declare function clientRequestAction(pathname: string, method: string): ClientRequestAction | null; /** * Why a request produced no HTTP response, or null when it should not be * counted. An `AbortError` is a cancellation the user or the app initiated * (navigation, account change, a superseded request) and is never counted. */ export declare function clientRequestFailureReason(error: unknown, online: boolean): ClientRequestFailureReason | null; export type ClientSignalReporter = { requestFailure(action: ClientRequestAction, reason: ClientRequestFailureReason): boolean; stream(stream: ClientStream, event: ClientStreamEvent): boolean; webVital(metric: ClientWebVitalMetric, page: ClientPage, value: number): boolean; }; export type ClientSignalReporterOptions = { send: (body: string) => void; revision: string; routePattern: () => string; now?: (() => number) | undefined; /** Suppress a repeat of the same request-failure or stream signal within this window. */ dedupeWindowMs?: number | undefined; /** At most this many request-failure and stream reports per `rateWindowMs`. */ maxReportsPerWindow?: number | undefined; rateWindowMs?: number | undefined; }; /** * Client-side bounds. A flapping network can fail every request and drop * every stream many times a minute; one report per signal key per 30 seconds * and twenty per ten minutes is enough for a counter. Each web vital is * reported at most once per document. */ export declare function createClientSignalReporter(options: ClientSignalReporterOptions): ClientSignalReporter; /** Install the process-wide reporter. Tests and non-browser hosts leave it unset. */ export declare function setClientSignalReporter(reporter: ClientSignalReporter | null): void; /** * Count a key request that failed before any HTTP response. Called by the * console's fetch boundary with the request's path and method; requests that * are not key actions and cancellations are ignored. */ export declare function noteClientRequestFailure(pathname: string | null, method: string, error: unknown, online?: boolean): void; export declare function reportClientStreamEvent(stream: ClientStream, event: ClientStreamEvent): void; export declare function reportClientWebVital(metric: ClientWebVitalMetric, page: ClientPage, value: number): void;