@@ -75,9 +75,9 @@ export class ReplayContainer implements ReplayContainerInterface {
7575 /**
7676 * Options to pass to `rrweb.record()`
7777 */
78- readonly recordingOptions : RecordingOptions ;
78+ private readonly _recordingOptions : RecordingOptions ;
7979
80- readonly options : ReplayPluginOptions ;
80+ private readonly _options : ReplayPluginOptions ;
8181
8282 private _performanceObserver : PerformanceObserver | null = null ;
8383
@@ -125,11 +125,11 @@ export class ReplayContainer implements ReplayContainerInterface {
125125 } ;
126126
127127 constructor ( { options, recordingOptions } : { options : ReplayPluginOptions ; recordingOptions : RecordingOptions } ) {
128- this . recordingOptions = recordingOptions ;
129- this . options = options ;
128+ this . _recordingOptions = recordingOptions ;
129+ this . _options = options ;
130130
131- this . _debouncedFlush = debounce ( ( ) => this . flush ( ) , this . options . flushMinDelay , {
132- maxWait : this . options . flushMaxDelay ,
131+ this . _debouncedFlush = debounce ( ( ) => this . flush ( ) , this . _options . flushMinDelay , {
132+ maxWait : this . _options . flushMaxDelay ,
133133 } ) ;
134134 }
135135
@@ -148,6 +148,11 @@ export class ReplayContainer implements ReplayContainerInterface {
148148 return this . _isPaused ;
149149 }
150150
151+ /** Get the replay integration options. */
152+ public getOptions ( ) : ReplayPluginOptions {
153+ return this . _options ;
154+ }
155+
151156 /**
152157 * Initializes the plugin.
153158 *
@@ -183,7 +188,7 @@ export class ReplayContainer implements ReplayContainerInterface {
183188 this . updateSessionActivity ( ) ;
184189
185190 this . eventBuffer = createEventBuffer ( {
186- useCompression : Boolean ( this . options . useCompression ) ,
191+ useCompression : Boolean ( this . _options . useCompression ) ,
187192 } ) ;
188193
189194 this . addListeners ( ) ;
@@ -201,7 +206,7 @@ export class ReplayContainer implements ReplayContainerInterface {
201206 startRecording ( ) : void {
202207 try {
203208 this . _stopRecording = record ( {
204- ...this . recordingOptions ,
209+ ...this . _recordingOptions ,
205210 // When running in error sampling mode, we need to overwrite `checkoutEveryNth`
206211 // Without this, it would record forever, until an error happens, which we don't want
207212 // instead, we'll always keep the last 60 seconds of replay before an error happened
@@ -275,7 +280,7 @@ export class ReplayContainer implements ReplayContainerInterface {
275280 handleException ( error : unknown ) : void {
276281 __DEBUG_BUILD__ && logger . error ( '[Replay]' , error ) ;
277282
278- if ( this . options . _experiments && this . options . _experiments . captureExceptions ) {
283+ if ( __DEBUG_BUILD__ && this . _options . _experiments && this . _options . _experiments . captureExceptions ) {
279284 captureException ( error ) ;
280285 }
281286 }
@@ -297,10 +302,10 @@ export class ReplayContainer implements ReplayContainerInterface {
297302 loadSession ( { expiry } : { expiry : number } ) : void {
298303 const { type, session } = getSession ( {
299304 expiry,
300- stickySession : Boolean ( this . options . stickySession ) ,
305+ stickySession : Boolean ( this . _options . stickySession ) ,
301306 currentSession : this . session ,
302- sessionSampleRate : this . options . sessionSampleRate ,
303- errorSampleRate : this . options . errorSampleRate ,
307+ sessionSampleRate : this . _options . sessionSampleRate ,
308+ errorSampleRate : this . _options . errorSampleRate ,
304309 } ) ;
305310
306311 // If session was newly created (i.e. was not loaded from storage), then
@@ -482,7 +487,7 @@ export class ReplayContainer implements ReplayContainerInterface {
482487 // a previous session ID. In this case, we want to buffer events
483488 // for a set amount of time before flushing. This can help avoid
484489 // capturing replays of users that immediately close the window.
485- setTimeout ( ( ) => this . conditionalFlush ( ) , this . options . initialFlushDelay ) ;
490+ setTimeout ( ( ) => this . conditionalFlush ( ) , this . _options . initialFlushDelay ) ;
486491
487492 // Cancel any previously debounced flushes to ensure there are no [near]
488493 // simultaneous flushes happening. The latter request should be
@@ -955,8 +960,8 @@ export class ReplayContainer implements ReplayContainerInterface {
955960
956961 preparedEvent . tags = {
957962 ...preparedEvent . tags ,
958- sessionSampleRate : this . options . sessionSampleRate ,
959- errorSampleRate : this . options . errorSampleRate ,
963+ sessionSampleRate : this . _options . sessionSampleRate ,
964+ errorSampleRate : this . _options . errorSampleRate ,
960965 replayType : this . session ?. sampled ,
961966 } ;
962967
@@ -1061,7 +1066,7 @@ export class ReplayContainer implements ReplayContainerInterface {
10611066
10621067 /** Save the session, if it is sticky */
10631068 private _maybeSaveSession ( ) : void {
1064- if ( this . session && this . options . stickySession ) {
1069+ if ( this . session && this . _options . stickySession ) {
10651070 saveSession ( this . session ) ;
10661071 }
10671072 }
0 commit comments