From 15a0a27697444a1d09f589e50fa9587ad8ca025e Mon Sep 17 00:00:00 2001 From: Vadim Korolik Date: Tue, 2 Aug 2022 13:13:45 -0700 Subject: [PATCH] obfuscate text for highlight-mask class --- packages/rrweb/package.json | 2 +- packages/rrweb/src/record/index.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/rrweb/package.json b/packages/rrweb/package.json index 6f858b5d..2c9e09ed 100644 --- a/packages/rrweb/package.json +++ b/packages/rrweb/package.json @@ -1,6 +1,6 @@ { "name": "@highlight-run/rrweb", - "version": "2.1.0", + "version": "2.1.1", "description": "record and replay the web", "scripts": { "prepare": "npm run prepack", diff --git a/packages/rrweb/src/record/index.ts b/packages/rrweb/src/record/index.ts index fe4d9509..fc7f55f8 100644 --- a/packages/rrweb/src/record/index.ts +++ b/packages/rrweb/src/record/index.ts @@ -29,6 +29,7 @@ import { IframeManager } from './iframe-manager'; import { ShadowDomManager } from './shadow-dom-manager'; import { CanvasManager } from './observers/canvas/canvas-manager'; import { StylesheetManager } from './stylesheet-manager'; +import { obfuscateText } from '@highlight-run/rrweb-snapshot'; function wrapEvent(e: event): eventWithTime { return { @@ -59,7 +60,7 @@ function record( maskInputOptions: _maskInputOptions, slimDOMOptions: _slimDOMOptions, maskInputFn, - maskTextFn, + maskTextFn = obfuscateText, hooks, packFn, sampling = {}, @@ -251,7 +252,7 @@ function record( stylesheetManager, canvasManager, keepIframeSrcFn, - enableStrictPrivacy + enableStrictPrivacy, }, mirror, }); @@ -522,7 +523,7 @@ record.addCustomEvent = (tag: string, payload: T) => { if (!wrappedEmit) { /* Highlight Code - disable this warning */ // throw new Error('please add custom event after start recording'); - return + return; } wrappedEmit( wrapEvent({