import { Result } from "@hexclave/shared/dist/utils/results";
//#region src/lib/hexclave-app/apps/implementations/session-replay.d.ts
type AnalyticsReplayOptions = {
/**
* Whether session replays are enabled.
*
* @default true
*/
enabled?: boolean;
/**
* Whether to mask the content of all `` elements.
*
* @default true
*/
maskAllInputs?: boolean;
/**
* A CSS class name or RegExp. Elements with a matching class will be blocked
* (replaced with a placeholder in the recording).
*
* @default undefined
*/
blockClass?: string | RegExp;
/**
* A CSS selector string. Elements matching this selector will be blocked
* (replaced with a placeholder in the recording).
*
* @default undefined
*/
blockSelector?: string;
};
type AnalyticsOptions = {
/**
* Whether SDK-managed analytics capture is enabled.
*
* @default true
*/
enabled?: boolean;
/**
* Options for session replay recording. Replays are enabled by default;
* set `enabled: false` to opt out.
*/
replays?: AnalyticsReplayOptions;
};
declare function getSessionReplayOptions(analyticsOptions: AnalyticsOptions | undefined): AnalyticsReplayOptions;
/**
* Converts AnalyticsOptions to a JSON-safe representation.
* RegExp blockClass values are serialized as `{ __regexp, __flags }` objects.
* The return type is AnalyticsOptions to keep StackClientAppJson simple;
* the actual runtime value is JSON-safe.
*/
declare function analyticsOptionsToJson(options: AnalyticsOptions | undefined): AnalyticsOptions | undefined;
/**
* Reconstructs AnalyticsOptions from a JSON-deserialized value.
* Converts `{ __regexp, __flags }` objects back to RegExp instances.
*/
declare function analyticsOptionsFromJson(json: AnalyticsOptions | undefined): AnalyticsOptions | undefined;
type StoredSession = {
session_id: string;
created_at_ms: number;
last_activity_ms: number;
};
declare function safeParseStoredSession(raw: string | null): StoredSession | null;
declare function makeStorageKey(projectId: string): string;
declare function makeLegacyStorageKey(projectId: string): string;
declare function generateUuid(): `${string}-${string}-${string}-${string}-${string}`;
declare function getOrRotateSession(options: {
key: string;
legacyKey?: string;
nowMs: number;
}): StoredSession;
type SessionRecorderDeps = {
projectId: string;
sendBatch: (body: string, options: {
keepalive: boolean;
}) => Promise>;
};
declare function isAnalyticsNotEnabledError(error: unknown): boolean;
/**
* Whether the error looks like a network failure caused by an ad blocker or
* similar extension blocking analytics requests. These are expected in
* production and should be silently ignored rather than logged as warnings.
*/
declare function isAdBlockerNetworkError(error: unknown): boolean;
declare class SessionRecorder {
private _started;
private _cancelled;
private _disabled;
private _stopRecording;
private _detachListeners;
private _flushTimer;
private _events;
private _eventSizes;
private _approxBytes;
private _lastPersistActivity;
private _recording;
private _rrwebModule;
private _lastBrowserSessionId;
private _takingSnapshot;
private _flushInProgress;
private readonly _sessionReplaySegmentId;
private readonly _storageKey;
private readonly _legacyStorageKey;
private readonly _deps;
private readonly _replayOptions;
constructor(deps: SessionRecorderDeps, replayOptions: AnalyticsReplayOptions);
/**
* Starts recording. Idempotent — calling multiple times is safe.
*/
start(): void;
stop(): void;
clearBuffer(): void;
private _persistActivity;
private _flush;
private _disable;
private _startRecording;
private _stopCurrentRecording;
private _tick;
}
//#endregion
export { StoredSession as a, generateUuid as c, isAdBlockerNetworkError as d, isAnalyticsNotEnabledError as f, safeParseStoredSession as h, SessionRecorderDeps as i, getOrRotateSession as l, makeStorageKey as m, AnalyticsReplayOptions as n, analyticsOptionsFromJson as o, makeLegacyStorageKey as p, SessionRecorder as r, analyticsOptionsToJson as s, AnalyticsOptions as t, getSessionReplayOptions as u };
//# sourceMappingURL=session-replay-8_3WCrsZ.d.ts.map