Skip to content

Commit f432d09

Browse files
authored
ref(replay): Mark all methods & properties as public/private (#6734)
1 parent 7c8844f commit f432d09

11 files changed

+238
-294
lines changed

packages/replay/.eslintrc.js

-2
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ module.exports = {
2323
{
2424
files: ['*.ts', '*.tsx', '*.d.ts'],
2525
rules: {
26-
// TODO (high-prio): Re-enable this after migration
27-
'@typescript-eslint/explicit-member-accessibility': 'off',
2826
// Since we target only es6 here, we can leave this off
2927
'@sentry-internal/sdk/no-async-await': 'off',
3028
},

packages/replay/src/integration.ts

+21-21
Original file line numberDiff line numberDiff line change
@@ -34,13 +34,13 @@ export class Replay implements Integration {
3434
/**
3535
* Options to pass to `rrweb.record()`
3636
*/
37-
readonly recordingOptions: RecordingOptions;
37+
private readonly _recordingOptions: RecordingOptions;
3838

39-
readonly options: ReplayPluginOptions;
39+
private readonly _options: ReplayPluginOptions;
4040

4141
private _replay?: ReplayContainer;
4242

43-
constructor({
43+
public constructor({
4444
flushMinDelay = DEFAULT_FLUSH_MIN_DELAY,
4545
flushMaxDelay = DEFAULT_FLUSH_MAX_DELAY,
4646
initialFlushDelay = INITIAL_FLUSH_DELAY,
@@ -57,19 +57,19 @@ export class Replay implements Integration {
5757
ignoreClass = 'sentry-ignore',
5858
maskTextClass = 'sentry-mask',
5959
blockSelector = '[data-sentry-block]',
60-
...recordingOptions
60+
..._recordingOptions
6161
}: ReplayConfiguration = {}) {
62-
this.recordingOptions = {
62+
this._recordingOptions = {
6363
maskAllInputs,
6464
blockClass,
6565
ignoreClass,
6666
maskTextClass,
6767
maskTextSelector,
6868
blockSelector,
69-
...recordingOptions,
69+
..._recordingOptions,
7070
};
7171

72-
this.options = {
72+
this._options = {
7373
flushMinDelay,
7474
flushMaxDelay,
7575
stickySession,
@@ -91,7 +91,7 @@ Instead, configure \`replaysSessionSampleRate\` directly in the SDK init options
9191
Sentry.init({ replaysSessionSampleRate: ${sessionSampleRate} })`,
9292
);
9393

94-
this.options.sessionSampleRate = sessionSampleRate;
94+
this._options.sessionSampleRate = sessionSampleRate;
9595
}
9696

9797
if (typeof errorSampleRate === 'number') {
@@ -103,22 +103,22 @@ Instead, configure \`replaysOnErrorSampleRate\` directly in the SDK init options
103103
Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
104104
);
105105

106-
this.options.errorSampleRate = errorSampleRate;
106+
this._options.errorSampleRate = errorSampleRate;
107107
}
108108

109-
if (this.options.maskAllText) {
109+
if (this._options.maskAllText) {
110110
// `maskAllText` is a more user friendly option to configure
111111
// `maskTextSelector`. This means that all nodes will have their text
112112
// content masked.
113-
this.recordingOptions.maskTextSelector = MASK_ALL_TEXT_SELECTOR;
113+
this._recordingOptions.maskTextSelector = MASK_ALL_TEXT_SELECTOR;
114114
}
115115

116-
if (this.options.blockAllMedia) {
116+
if (this._options.blockAllMedia) {
117117
// `blockAllMedia` is a more user friendly option to configure blocking
118118
// embedded media elements
119-
this.recordingOptions.blockSelector = !this.recordingOptions.blockSelector
119+
this._recordingOptions.blockSelector = !this._recordingOptions.blockSelector
120120
? MEDIA_SELECTORS
121-
: `${this.recordingOptions.blockSelector},${MEDIA_SELECTORS}`;
121+
: `${this._recordingOptions.blockSelector},${MEDIA_SELECTORS}`;
122122
}
123123

124124
if (this._isInitialized && isBrowser()) {
@@ -148,7 +148,7 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
148148
* global event processors to finish. This is no longer needed, but keeping it
149149
* here to avoid any future issues.
150150
*/
151-
setupOnce(): void {
151+
public setupOnce(): void {
152152
if (!isBrowser()) {
153153
return;
154154
}
@@ -165,7 +165,7 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
165165
* Creates or loads a session, attaches listeners to varying events (DOM,
166166
* PerformanceObserver, Recording, Sentry SDK, etc)
167167
*/
168-
start(): void {
168+
public start(): void {
169169
if (!this._replay) {
170170
return;
171171
}
@@ -177,7 +177,7 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
177177
* Currently, this needs to be manually called (e.g. for tests). Sentry SDK
178178
* does not support a teardown
179179
*/
180-
stop(): void {
180+
public stop(): void {
181181
if (!this._replay) {
182182
return;
183183
}
@@ -191,8 +191,8 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
191191
this._loadReplayOptionsFromClient();
192192

193193
this._replay = new ReplayContainer({
194-
options: this.options,
195-
recordingOptions: this.recordingOptions,
194+
options: this._options,
195+
recordingOptions: this._recordingOptions,
196196
});
197197
}
198198

@@ -202,11 +202,11 @@ Sentry.init({ replaysOnErrorSampleRate: ${errorSampleRate} })`,
202202
const opt = client && (client.getOptions() as BrowserClientReplayOptions | undefined);
203203

204204
if (opt && typeof opt.replaysSessionSampleRate === 'number') {
205-
this.options.sessionSampleRate = opt.replaysSessionSampleRate;
205+
this._options.sessionSampleRate = opt.replaysSessionSampleRate;
206206
}
207207

208208
if (opt && typeof opt.replaysOnErrorSampleRate === 'number') {
209-
this.options.errorSampleRate = opt.replaysOnErrorSampleRate;
209+
this._options.errorSampleRate = opt.replaysOnErrorSampleRate;
210210
}
211211
}
212212
}

0 commit comments

Comments
 (0)