chore: add dpa, update terms and privacy

This commit is contained in:
Carl-Gerhard Lindesvärd
2026-03-03 10:59:45 +01:00
parent 83761638f2
commit 9e46099246
9 changed files with 751 additions and 80 deletions

View File

@@ -11,7 +11,17 @@ export type SessionReplayOptions = {
enabled: boolean;
sampleRate?: number;
maskAllInputs?: boolean;
maskTextSelector?: string;
/**
* Mask all text content in the recording. Defaults to true.
* When true, all text is replaced with asterisks.
*/
maskAllText?: boolean;
/**
* CSS selector for elements whose text should NOT be masked,
* even when maskAllText is true.
* Example: '[data-openpanel-unmask]'
*/
unmaskTextSelector?: string;
blockSelector?: string;
blockClass?: string;
ignoreSelector?: string;

View File

@@ -3,7 +3,8 @@ import { record } from 'rrweb';
export type ReplayRecorderConfig = {
maskAllInputs?: boolean;
maskTextSelector?: string;
maskAllText?: boolean;
unmaskTextSelector?: string;
blockSelector?: string;
blockClass?: string;
ignoreSelector?: string;
@@ -99,6 +100,9 @@ export function startReplayRecorder(
}
}
const maskAllText = config.maskAllText !== false;
const unmaskTextSelector = config.unmaskTextSelector;
const stopFn = record({
emit(event: eventWithTime, isCheckout?: boolean) {
buffer.push(event);
@@ -106,7 +110,13 @@ export function startReplayRecorder(
},
checkoutEveryNms: flushIntervalMs,
maskAllInputs: config.maskAllInputs ?? true,
maskTextSelector: config.maskTextSelector ?? '[data-openpanel-replay-mask]',
maskTextSelector: maskAllText ? '*' : '[data-openpanel-replay-mask]',
maskTextFn: maskAllText && unmaskTextSelector
? (text, element) => {
if (element?.closest(unmaskTextSelector)) return text;
return text.replace(/\S/g, '*');
}
: undefined,
blockSelector: config.blockSelector ?? '[data-openpanel-replay-block]',
blockClass: config.blockClass,
ignoreSelector: config.ignoreSelector,