Skip to content

Commit 8c44483

Browse files
committed
fix interface + tests
1 parent 9770043 commit 8c44483

File tree

5 files changed

+11
-20
lines changed

5 files changed

+11
-20
lines changed

packages/replay/src/integration.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ export class Replay implements Integration {
7979
}: ReplayConfiguration = {}) {
8080
this._recordingOptions = {
8181
maskAllInputs,
82+
maskAllText,
8283
maskInputOptions: { ...(maskInputOptions || {}), password: true },
8384
maskTextFn: maskFn,
8485
maskInputFn: maskFn,
@@ -113,7 +114,6 @@ export class Replay implements Integration {
113114
sessionSampleRate,
114115
errorSampleRate,
115116
useCompression,
116-
maskAllText,
117117
blockAllMedia,
118118
_experiments,
119119
};

packages/replay/src/types.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,11 +90,6 @@ export interface ReplayPluginOptions extends SessionOptions {
9090
*/
9191
useCompression: boolean;
9292

93-
/**
94-
* Mask all text in recordings. All text will be replaced with asterisks by default.
95-
*/
96-
maskAllText: boolean;
97-
9893
/**
9994
* Block all media (e.g. images, svg, video) in recordings.
10095
*/
@@ -180,7 +175,7 @@ export interface ReplayConfiguration
180175
extends ReplayIntegrationPrivacyOptions,
181176
OptionalReplayPluginOptions,
182177
DeprecatedPrivacyOptions,
183-
Pick<RecordingOptions, 'maskAllInputs'> {}
178+
Pick<RecordingOptions, 'maskAllText'|'maskAllInputs'> {}
184179

185180
interface CommonEventContext {
186181
/**

packages/replay/src/types/rrweb.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ export type eventWithTime = {
3030
* Record<string, unknown> union type.
3131
*/
3232
export type recordOptions = {
33+
maskAllText?: boolean;
3334
maskAllInputs?: boolean;
3435
blockClass?: blockClass;
3536
ignoreClass?: string;

packages/replay/test/integration/integrationSettings.test.ts

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { MASK_ALL_TEXT_SELECTOR } from '../../src/constants';
21
import { mockSdk } from '../index';
32

43
describe('Integration | integrationSettings', () => {
@@ -191,33 +190,28 @@ describe('Integration | integrationSettings', () => {
191190
it('works with default value', async () => {
192191
const { replay } = await mockSdk({ replayOptions: {} });
193192

194-
// Default is true
195-
expect(replay['_recordingOptions'].maskTextSelector).toBe(MASK_ALL_TEXT_SELECTOR);
193+
expect(replay['_recordingOptions'].maskAllText).toBe(true);
196194
});
197195

198196
it('works with true', async () => {
199197
const { replay } = await mockSdk({ replayOptions: { maskAllText: true } });
200198

201-
expect(replay['_recordingOptions'].maskTextSelector).toBe(MASK_ALL_TEXT_SELECTOR);
199+
expect(replay['_recordingOptions'].maskAllText).toBe(true);
202200
});
203201

204202
it('works with false', async () => {
205203
const { replay } = await mockSdk({ replayOptions: { maskAllText: false } });
206204

207-
expect(replay['_recordingOptions'].maskTextSelector).toBe('.sentry-mask,[data-sentry-mask]');
205+
expect(replay['_recordingOptions'].maskAllText).toBe(false);
208206
});
207+
});
209208

210-
it('maskTextSelector takes precedence over maskAllText when not specifiying maskAllText:true', async () => {
209+
describe('maskTextSelector', () => {
210+
it('can have custom mask selector', async () => {
211211
const { replay } = await mockSdk({ replayOptions: { maskTextSelector: '[custom]' } });
212212

213213
expect(replay['_recordingOptions'].maskTextSelector).toBe('[custom],.sentry-mask,[data-sentry-mask]');
214214
});
215-
216-
it('maskAllText takes precedence over maskTextSelector when specifiying maskAllText:true', async () => {
217-
const { replay } = await mockSdk({ replayOptions: { maskAllText: true, maskTextSelector: '[custom]' } });
218-
219-
expect(replay['_recordingOptions'].maskTextSelector).toBe(MASK_ALL_TEXT_SELECTOR);
220-
});
221215
});
222216

223217
describe('_experiments', () => {

packages/replay/test/integration/rrweb.test.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ describe('Integration | rrweb', () => {
2424
"inlineImages": false,
2525
"inlineStylesheet": true,
2626
"maskAllInputs": true,
27+
"maskAllText": true,
2728
"maskInputFn": undefined,
2829
"maskInputOptions": Object {
2930
"password": true,
3031
},
3132
"maskInputSelector": ".sentry-mask,[data-sentry-mask]",
3233
"maskTextFn": undefined,
33-
"maskTextSelector": "body *:not(style), body *:not(script)",
34+
"maskTextSelector": ".sentry-mask,[data-sentry-mask]",
3435
"slimDOMOptions": "all",
3536
"unblockSelector": ".sentry-unblock,[data-sentry-unblock]",
3637
"unmaskInputSelector": ".sentry-unmask,[data-sentry-unmask]",

0 commit comments

Comments
 (0)