export type SessionReplayUrlMatcher = string | RegExp | ((url: string) => boolean); export type ReplayEventSampling = Record; export interface SessionReplayConsoleOptions { maxEvents?: number; } export interface SessionReplayNetworkOptions { maxEvents?: number; captureErrorBodies?: boolean; maxErrorBodyLength?: number; } export interface SessionReplayUploadRejectedDetails { status: number; restartAttempted: boolean; restartSucceeded: boolean; restartReason?: SessionReplayStartResult["reason"]; failureReason?: "quota_pause" | "quota_stop" | "oversized_event"; retryAfterSeconds?: number | null; } export interface SessionReplayOptions { enabled?: boolean; shouldStart?: () => boolean; publicKey?: string; endpoint?: string; linkBaseUrl?: string; requireSignedInUser?: boolean; sampleRate?: number; samplingSalt?: string; allowUrls?: SessionReplayUrlMatcher[]; blockUrls?: SessionReplayUrlMatcher[]; /** Extra app-specific query keys to redact from replay URLs at record time. */ sensitiveQueryParams?: string[]; flushIntervalMs?: number; maxDurationMs?: number; maxEventsPerBatch?: number; maxBatchBytes?: number; checkoutEveryNth?: number; checkoutEveryNms?: number; inlineStylesheet?: boolean; blockSelector?: string; ignoreSelector?: string; maskTextClass?: string | RegExp; /** App selectors extend the framework's `data-an-mask` privacy marker. */ maskTextSelector?: string; maskAllInputs?: boolean; recordCanvas?: boolean; recordCrossOriginIframes?: boolean; collectFonts?: boolean; inlineImages?: boolean; eventSampling?: ReplayEventSampling; console?: boolean | SessionReplayConsoleOptions; /** * Capture fetch/XHR requests as `agent-native.network` custom rrweb * events (method, URL, status, timing). Request bodies and headers are * never captured; response bodies are captured only as a bounded, * redacted snippet for 5xx responses (see `captureErrorBodies`). * Defaults to on whenever session replay is enabled. Pass `false` to * disable, or an options object to override caps. */ network?: boolean | SessionReplayNetworkOptions; onUploadRejected?: (details: SessionReplayUploadRejectedDetails) => void; onUploadRejectedWithAttemptId?: (details: SessionReplayUploadRejectedDetails, recordingAttemptId: string) => void; onRecordingStarted?: (recordingAttemptId: string) => void; extraProperties?: Record | (() => Record | undefined); } export interface SessionReplayStartResult { started: boolean; reason?: "disabled" | "not-browser" | "missing-public-key" | "missing-session-id" | "missing-user-id" | "sampled-out" | "url-blocked" | "already-active" | "import-failed" | "record-failed" | "consent-required"; replayId?: string; sessionId?: string; sampled?: boolean; } export declare const SESSION_REPLAY_CONSOLE_EVENT_TAG = "agent-native.console"; export declare const SESSION_REPLAY_NETWORK_EVENT_TAG = "agent-native.network"; export declare const SESSION_REPLAY_AGENT_CHAT_EVENT_TAG = "agent-native.chat"; export declare const SESSION_REPLAY_ANALYTICS_EVENT_TAG = "agent-native.event"; export declare const SESSION_REPLAY_VITALS_EVENT_TAG = "agent-native.vitals"; export declare const SESSION_REPLAY_SLOW_REQUEST_EVENT_TAG = "agent-native.slow_request"; export declare function getSessionReplaySamplingScore(sessionId: string, salt?: string): number; export declare function shouldSampleSessionReplay(sessionId: string, sampleRate?: number, salt?: string): boolean; export declare function flushSessionReplay(reason?: string): Promise; export declare function startSessionReplay(options?: SessionReplayOptions): Promise; export declare function stopSessionReplay(reason?: string): Promise; export declare function maybeStartSessionReplay(options?: SessionReplayOptions): Promise; export declare function isSessionReplayActive(): boolean; export declare function getSessionReplayId(): string | null; export { getSessionReplayContext, getSessionReplayUrl, } from "./session-replay-context.js"; export type { SessionReplayContext, SessionReplayLinkOptions, } from "./session-replay-context.js"; export declare function emitSessionReplayException(input: { type: string; message: string; level?: "fatal" | "error" | "warning" | "info" | "debug"; stack?: string; url?: string; }): void; /** * Mark a tracked analytics event on the replay timeline. Only the event name * is recorded; event properties stay out of the replay. */ export declare function emitSessionReplayAnalyticsEvent(name: string): void; export type SessionReplaySlowRequest = { action?: unknown; method?: unknown; duration_ms?: unknown; status_code?: unknown; outcome?: unknown; page_hidden?: unknown; }; /** * Mark a slow `action.response` on the replay timeline with that event's own * timing, which runs to the end of the body; a network event stops at the * headers. Only these operational fields are recorded, and the marker shares * the analytics marker budget. */ export declare function emitSessionReplaySlowRequest(input: SessionReplaySlowRequest): void; export type SessionReplayWebVitals = { route?: string; navigationType: string; ttfbMs?: number; lcpMs?: number; inpMs?: number; cls?: number; }; /** * Mark a finished page view's Web Vitals on the replay timeline. Shares the * analytics marker budget, since each page view adds one. */ export declare function emitSessionReplayWebVitals(input: SessionReplayWebVitals): void; export type SessionReplayAgentChatEvent = { phase: "surface-mounted" | "run-observed" | "run-stopped"; surface: string | number; threadId?: string | number; runId?: string | number; tabId?: string | number; }; export declare function emitSessionReplayAgentChatEvent(input: SessionReplayAgentChatEvent): void;