/** * RRWebPlugin — Session replay plugin for CloudWatch RUM. * * Records DOM mutations and user interactions using rrweb, then batches * and forwards them as RRWebEvent payloads to the RUM data plane. * * @prerelease This plugin is in prerelease state. It is NOT exposed in the * top-level telemetry configuration and is NOT built into the default bundle. * Users must manually import and install it via `eventPluginsToLoad`: * * ```ts * import { RRWebPlugin } from 'aws-rum-web/plugins/event-plugins/RRWebPlugin'; * * const config = { * eventPluginsToLoad: [new RRWebPlugin({ batchSize: 25 })] * }; * ``` */ import { InternalPlugin } from '../InternalPlugin'; import type { recordOptions } from 'rrweb/typings/types'; export declare const RRWEB_PLUGIN_ID = "rrweb"; /** * Privacy-related rrweb options that are enforced and cannot be overridden. * These are always set to mask all text and inputs in the recording. */ type EnforcedPrivacyKeys = 'maskAllInputs' | 'maskTextSelector' | 'maskInputOptions'; /** Configuration options for {@link RRWebPlugin}. */ export type RRWebPluginConfig = { /** Probability (0–1) of recording replay for a session, applied on top of sessionSampleRate. */ additionalSampleRate: number; /** Number of rrweb events to buffer before automatically flushing a batch. */ batchSize: number; /** Milliseconds between automatic flushes of buffered events. */ flushInterval: number; /** Options forwarded directly to the rrweb `record()` function. Privacy masking options are enforced and cannot be overridden. */ recordOptions: Omit, EnforcedPrivacyKeys>; }; /** * Production-safe defaults. Privacy masking is enforced; heavy options * (inlineImages, cross-origin iframes) are disabled. */ export declare const RRWEB_CONFIG_PROD: RRWebPluginConfig; /** * Session replay plugin that records DOM snapshots and mutations via rrweb. * * @prerelease Not included in the default bundle. Must be imported and * installed manually via `eventPluginsToLoad`. * * Lifecycle: * 1. `load()` — receives PluginContext (inherited from InternalPlugin) * 2. `enable()` — starts rrweb recording if session is sampled * 3. Buffered events are flushed on batchSize threshold, flushInterval timer, * or page unload (via the `flush()` lifecycle hook) * 4. `disable()` — stops recording and flushes remaining events */ export declare class RRWebPlugin extends InternalPlugin { private config; /** Buffer of rrweb events waiting to be flushed. */ private recordingEvents; private isRecording; private recordingStartTime; private flushTimer; private stopRecording; enabled: boolean; constructor(config?: Partial); /** Start rrweb recording if the session passes both sample-rate checks. */ enable(): void; /** Stop rrweb recording and flush any remaining buffered events. */ disable(): void; /** * Handle manual start/stop commands. * @param data - Object with `{ action: 'start' | 'stop' }`. */ record(data: unknown): void; protected onload(): void; /** Initialize rrweb recording and start the periodic flush timer. */ private startRecording; /** Stop rrweb, clear the flush timer, and drain remaining events. */ private stopCurrentRecording; /** Buffer an incoming rrweb event; auto-flush when batchSize is reached. */ private handleRRWebEvent; /** * Drain the event buffer into a single {@link RRWebEventPayload} and * record it via `context.record()`. No-op when the buffer is empty. * * Called automatically by the web client during page unload * (via EventCache → PluginManager → flush lifecycle) so that * buffered replay data is not lost. Also called internally on * batchSize threshold, flushInterval timer, and disable(). */ flush(): void; } export {};