import type { DeflateEncoder, HttpRequest } from '@flashcatcloud/browser-core'; import type { LifeCycle, ViewHistory, RumSessionManager, RumConfiguration } from '@flashcatcloud/browser-rum-core'; import type { BrowserRecord, SegmentContext } from '../../types'; export declare const SEGMENT_DURATION_LIMIT: number; /** * beacon payload max queue size implementation is 64kb * ensure that we leave room for logs, rum and potential other users */ export declare let SEGMENT_BYTES_LIMIT: number; /** * Lets a session record without uploading anything until it reports an error. Sessions drawn by * `sessionReplayOnError` record from the start, but every segment is withheld: dropped on * checkout while no error has happened, sent normally from the moment one has. */ export interface SegmentBuffering { /** * The id of the current session if it is withholding its replay, `undefined` otherwise. A segment * remembers this at creation, so that what happens to it later is decided by the session that * actually produced its records. */ getWithholdingSessionId: () => string | undefined; /** * Whether that same session has since reported its error. Anything else — the session expired, or * was renewed into a different one — means the records were never released and must be dropped: * uploading them would bill a session for a replay nobody asked for and nobody can explain. */ isReleased: (sessionId: string) => boolean; /** Restarts the buffer from a fresh full snapshot, after the previous one was dropped. */ restartFromFullSnapshot: () => void; } export declare function startSegmentCollection(lifeCycle: LifeCycle, configuration: RumConfiguration, sessionManager: RumSessionManager, viewHistory: ViewHistory, httpRequest: HttpRequest, encoder: DeflateEncoder, buffering: SegmentBuffering): { addRecord: (record: BrowserRecord) => void; stop: () => void; }; export declare function doStartSegmentCollection(lifeCycle: LifeCycle, getSegmentContext: () => SegmentContext | undefined, httpRequest: HttpRequest, encoder: DeflateEncoder, buffering: SegmentBuffering): { addRecord: (record: BrowserRecord) => void; stop: () => void; }; export declare function computeSegmentContext(applicationId: string, sessionManager: RumSessionManager, viewHistory: ViewHistory): { application: { id: string; }; session: { id: string; }; view: { id: string; }; } | undefined; export declare function setSegmentBytesLimit(newSegmentBytesLimit?: number): void;