diff --git a/packages/replay/src/types.ts b/packages/replay/src/types.ts index 702a7b5d798f..a3d9cafde299 100644 --- a/packages/replay/src/types.ts +++ b/packages/replay/src/types.ts @@ -1,7 +1,7 @@ -import type { eventWithTime, recordOptions } from 'rrweb/typings/types'; +import type { eventWithTime, recordOptions } from './types/rrweb'; export type RecordingEvent = eventWithTime; -export type RecordingOptions = recordOptions; +export type RecordingOptions = recordOptions; export type RecordedEvents = Uint8Array | string; diff --git a/packages/replay/src/types/rrweb.ts b/packages/replay/src/types/rrweb.ts new file mode 100644 index 000000000000..1c6ee198eb33 --- /dev/null +++ b/packages/replay/src/types/rrweb.ts @@ -0,0 +1,38 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +type blockClass = string | RegExp; +type maskTextClass = string | RegExp; + +enum EventType { + DomContentLoaded = 0, + Load = 1, + FullSnapshot = 2, + IncrementalSnapshot = 3, + Meta = 4, + Custom = 5, + Plugin = 6, +} + +/** + * This is a partial copy of rrweb's eventWithTime type which only contains the properties + * we specifcally need in the SDK. + */ +export type eventWithTime = { + type: EventType; + data: unknown; + timestamp: number; + delay?: number; +}; + +/** + * This is a partial copy of rrweb's recording options which only contains the properties + * we specifically us in the SDK. Users can specify additional properties, hence we add the + * Record union type. + */ +export type recordOptions = { + maskAllInputs?: boolean; + blockClass?: blockClass; + ignoreClass?: string; + maskTextClass?: maskTextClass; + blockSelector?: string; +} & Record;