@multiplayer-app/session-recorder-browser 1.2.32 → 1.2.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -25094,7 +25094,7 @@ const DEFAULT_MAX_HTTP_CAPTURING_PAYLOAD_SIZE = 100000;
25094
25094
  const SESSION_RESPONSE = 'multiplayer-debug-session-response';
25095
25095
  const CONTINUOUS_DEBUGGING_TIMEOUT = 60000; // 1 minutes
25096
25096
  const DEBUG_SESSION_MAX_DURATION_SECONDS = 10 * 60 + 30; // TODO: move to shared config otel core
25097
- const PACKAGE_VERSION_EXPORT = "1.2.32" || 0;
25097
+ const PACKAGE_VERSION_EXPORT = "1.2.34" || 0;
25098
25098
  // Regex patterns for OpenTelemetry ignore URLs
25099
25099
  const OTEL_IGNORE_URLS = [
25100
25100
  // Traces endpoint
@@ -27570,41 +27570,75 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_14__.Obse
27570
27570
  * Register session widget event listeners for controlling session actions
27571
27571
  */
27572
27572
  _registerWidgetEvents() {
27573
- this._sessionWidget.on('toggle', (state, comment) => {
27573
+ this._sessionWidget.on('start', () => {
27574
27574
  this.error = '';
27575
- if (state) {
27576
- this.start(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_11__.SessionType.MANUAL);
27577
- }
27578
- else {
27579
- this.stop(comment === null || comment === void 0 ? void 0 : comment.trim());
27580
- }
27575
+ this._handleStart();
27576
+ });
27577
+ this._sessionWidget.on('stop', (comment) => {
27578
+ this.error = '';
27579
+ this._handleStop(comment);
27581
27580
  });
27582
27581
  this._sessionWidget.on('pause', () => {
27583
27582
  this.error = '';
27584
- this.pause();
27583
+ this._handlePause();
27585
27584
  });
27586
27585
  this._sessionWidget.on('resume', () => {
27587
27586
  this.error = '';
27588
- this.resume();
27587
+ this._handleResume();
27589
27588
  });
27590
27589
  this._sessionWidget.on('cancel', () => {
27591
27590
  this.error = '';
27592
- this.cancel();
27591
+ this._handleCancel();
27593
27592
  });
27594
27593
  this._sessionWidget.on('continuous-debugging', (enabled) => {
27595
27594
  this.error = '';
27596
27595
  if (enabled) {
27597
- this.start(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_11__.SessionType.CONTINUOUS);
27596
+ this._handleContinuousDebugging();
27598
27597
  }
27599
27598
  else {
27600
- this.stop();
27599
+ this._handleStop();
27601
27600
  }
27602
27601
  });
27603
27602
  this._sessionWidget.on('save', () => {
27604
27603
  this.error = '';
27605
- this.save();
27604
+ this._handleSave();
27606
27605
  });
27607
27606
  }
27607
+ _handleStart() {
27608
+ if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.stopped) {
27609
+ this.start(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_11__.SessionType.MANUAL);
27610
+ }
27611
+ }
27612
+ _handleStop(comment) {
27613
+ if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.started || this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.paused) {
27614
+ this.stop(comment);
27615
+ }
27616
+ }
27617
+ _handlePause() {
27618
+ if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.started) {
27619
+ this.pause();
27620
+ }
27621
+ }
27622
+ _handleResume() {
27623
+ if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.paused) {
27624
+ this.resume();
27625
+ }
27626
+ }
27627
+ _handleCancel() {
27628
+ if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.started || this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.paused) {
27629
+ this.cancel();
27630
+ }
27631
+ }
27632
+ _handleSave() {
27633
+ if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.started && this.continuousRecording) {
27634
+ this.save();
27635
+ }
27636
+ }
27637
+ _handleContinuousDebugging() {
27638
+ if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.stopped) {
27639
+ this.start(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_11__.SessionType.CONTINUOUS);
27640
+ }
27641
+ }
27608
27642
  /**
27609
27643
  * Register session limit reaching listeners for controlling session end
27610
27644
  */
@@ -27661,6 +27695,7 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_14__.Obse
27661
27695
  }
27662
27696
  catch (error) {
27663
27697
  this.error = error.message;
27698
+ this.sessionState = _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.stopped;
27664
27699
  if (this.continuousRecording) {
27665
27700
  this.sessionType = _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_11__.SessionType.MANUAL;
27666
27701
  }
@@ -28108,6 +28143,7 @@ class DragManager {
28108
28143
  this.isDragging = false;
28109
28144
  this.dragStarted = false;
28110
28145
  this.isOnLeftHalfOfScreen = false;
28146
+ this.isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
28111
28147
  this.recorderButton = recorderButton;
28112
28148
  this.recorderPlacement = recorderPlacement;
28113
28149
  this.onDragEnd = onDragEnd;
@@ -28115,10 +28151,14 @@ class DragManager {
28115
28151
  this.onRecordingButtonClick = onRecordingButtonClick;
28116
28152
  }
28117
28153
  init() {
28154
+ if (!this.isBrowser)
28155
+ return;
28118
28156
  this.loadStoredPosition();
28119
28157
  this.setupDragListeners();
28120
28158
  }
28121
28159
  loadStoredPosition() {
28160
+ if (!this.isBrowser || typeof window === 'undefined' || typeof localStorage === 'undefined')
28161
+ return;
28122
28162
  const savedPosition = localStorage.getItem(_constants__WEBPACK_IMPORTED_MODULE_0__.POSITION_STATE_KEY);
28123
28163
  if (!savedPosition) {
28124
28164
  return;
@@ -28149,11 +28189,15 @@ class DragManager {
28149
28189
  });
28150
28190
  }
28151
28191
  savePosition(r, b) {
28192
+ if (!this.isBrowser || typeof window === 'undefined' || typeof localStorage === 'undefined')
28193
+ return;
28152
28194
  const right = (r / window.innerWidth) * 100;
28153
28195
  const bottom = (b / window.innerHeight) * 100;
28154
28196
  localStorage.setItem(_constants__WEBPACK_IMPORTED_MODULE_0__.POSITION_STATE_KEY, JSON.stringify({ right, bottom }));
28155
28197
  }
28156
28198
  setupDragListeners() {
28199
+ if (!this.isBrowser || typeof document === 'undefined' || typeof window === 'undefined')
28200
+ return;
28157
28201
  this.recorderButton.addEventListener('mousedown', (e) => {
28158
28202
  const onMouseUp = () => {
28159
28203
  const isDraggable = !this.recorderButton.classList.contains('no-draggable');
@@ -28249,29 +28293,37 @@ __webpack_require__.r(__webpack_exports__);
28249
28293
 
28250
28294
  class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observable {
28251
28295
  set buttonState(newState) {
28296
+ var _a, _b;
28252
28297
  this._buttonState = newState;
28298
+ if (!this.isBrowser)
28299
+ return;
28253
28300
  const { icon, tooltip, classes, excludeClasses } = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.buttonStates[newState];
28254
28301
  if (newState === _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.CANCEL) {
28255
- this.buttonDraggabilityObserver.observe(this.recorderButton, {
28302
+ (_a = this.buttonDraggabilityObserver) === null || _a === void 0 ? void 0 : _a.observe(this.recorderButton, {
28256
28303
  attributes: true,
28257
28304
  attributeOldValue: true,
28258
28305
  attributeFilter: ['class'],
28259
28306
  });
28260
28307
  }
28261
28308
  else {
28262
- this.buttonDraggabilityObserver.disconnect();
28309
+ (_b = this.buttonDraggabilityObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
28263
28310
  }
28311
+ this.uiManager.setPopoverLoadingState(newState === _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.LOADING);
28264
28312
  this.updateButton(icon, tooltip, excludeClasses, classes);
28265
28313
  }
28266
28314
  set initialPopoverVisible(v) {
28267
28315
  var _a;
28268
28316
  this._initialPopoverVisible = v;
28269
- (_a = this.initialPopover) === null || _a === void 0 ? void 0 : _a.classList.toggle('hidden', !v);
28317
+ if (this.isBrowser) {
28318
+ (_a = this.initialPopover) === null || _a === void 0 ? void 0 : _a.classList.toggle('hidden', !v);
28319
+ }
28270
28320
  }
28271
28321
  set finalPopoverVisible(v) {
28272
28322
  var _a;
28273
28323
  this._finalPopoverVisible = v;
28274
- (_a = this.finalPopover) === null || _a === void 0 ? void 0 : _a.classList.toggle('hidden', !v);
28324
+ if (this.isBrowser) {
28325
+ (_a = this.finalPopover) === null || _a === void 0 ? void 0 : _a.classList.toggle('hidden', !v);
28326
+ }
28275
28327
  }
28276
28328
  get error() {
28277
28329
  return this._error;
@@ -28290,6 +28342,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28290
28342
  }
28291
28343
  set isStarted(v) {
28292
28344
  this._isStarted = v;
28345
+ if (!this.isBrowser)
28346
+ return;
28293
28347
  if (!this.showRecorderButton && v && !this._continuousRecording) {
28294
28348
  this.overlay.classList.remove('hidden');
28295
28349
  this.makeOverlayDraggable();
@@ -28309,7 +28363,6 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28309
28363
  else {
28310
28364
  this.buttonState = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.CONTINUOUS_DEBUGGING;
28311
28365
  }
28312
- this.uiManager.setPopoverLoadingState(false);
28313
28366
  }
28314
28367
  else {
28315
28368
  this.buttonState = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.IDLE;
@@ -28317,6 +28370,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28317
28370
  }
28318
28371
  set isPaused(v) {
28319
28372
  this._isPaused = v;
28373
+ if (!this.isBrowser)
28374
+ return;
28320
28375
  if (this._isInitialized && !this.showRecorderButton && v && !this._continuousRecording) {
28321
28376
  this.overlay.classList.add('hidden');
28322
28377
  this.submitSessionDialog.classList.remove('hidden');
@@ -28360,6 +28415,18 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28360
28415
  }
28361
28416
  }
28362
28417
  };
28418
+ this.isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
28419
+ if (!this.isBrowser) {
28420
+ // Create dummy elements for SSR to prevent crashes
28421
+ this.recorderButton = {};
28422
+ this.initialPopover = {};
28423
+ this.finalPopover = {};
28424
+ this.overlay = {};
28425
+ this.toast = {};
28426
+ this.submitSessionDialog = {};
28427
+ this.uiManager = {};
28428
+ return;
28429
+ }
28363
28430
  this.recorderButton = document.createElement('button');
28364
28431
  this.initialPopover = document.createElement('div');
28365
28432
  this.finalPopover = document.createElement('div');
@@ -28398,6 +28465,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28398
28465
  }
28399
28466
  }
28400
28467
  updateContinuousRecordingState(checked, disabled = false) {
28468
+ if (!this.isBrowser)
28469
+ return;
28401
28470
  const toggleCheckbox = this.initialPopover.querySelector('#mp-session-debugger-continuous-debugging-checkbox');
28402
28471
  if (toggleCheckbox) {
28403
28472
  toggleCheckbox.checked = checked;
@@ -28405,6 +28474,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28405
28474
  }
28406
28475
  }
28407
28476
  updateSaveContinuousDebugSessionState(state) {
28477
+ if (!this.isBrowser)
28478
+ return;
28408
28479
  const saveButton = this.initialPopover.querySelector('#mp-save-continuous-debug-session');
28409
28480
  if (saveButton) {
28410
28481
  const { textContent, disabled } = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.continuousRecordingSaveButtonStates[state];
@@ -28418,15 +28489,21 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28418
28489
  * @param duration - Duration in milliseconds to show the toast (default: 10000ms)
28419
28490
  */
28420
28491
  showToast(config, duration = 10000) {
28492
+ if (!this.isBrowser)
28493
+ return;
28421
28494
  this.uiManager.showToast(config, duration);
28422
28495
  }
28423
28496
  /**
28424
28497
  * Hides the currently displayed toast message
28425
28498
  */
28426
28499
  hideToast() {
28500
+ if (!this.isBrowser)
28501
+ return;
28427
28502
  this.uiManager.hideToast();
28428
28503
  }
28429
28504
  observeButtonDraggableMode() {
28505
+ if (!this.isBrowser)
28506
+ return;
28430
28507
  this.buttonDraggabilityObserver = new MutationObserver((mutationsList) => {
28431
28508
  for (const mutation of mutationsList) {
28432
28509
  if (mutation.type === 'attributes' &&
@@ -28448,6 +28525,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28448
28525
  init(options) {
28449
28526
  if (this._isInitialized)
28450
28527
  return;
28528
+ if (!this.isBrowser)
28529
+ return;
28451
28530
  this._isInitialized = true;
28452
28531
  this.showRecorderButton = options.showWidget;
28453
28532
  this._showContinuousRecording = options.showContinuousRecording;
@@ -28487,6 +28566,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28487
28566
  this.addEventListeners();
28488
28567
  }
28489
28568
  appendElements(elements) {
28569
+ if (!this.isBrowser || typeof document === 'undefined')
28570
+ return;
28490
28571
  const rootWrapper = document.createElement('mp-root');
28491
28572
  rootWrapper.classList.add('mp-root-wrapper');
28492
28573
  rootWrapper.setAttribute('data-rr-ignore', 'true');
@@ -28494,6 +28575,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28494
28575
  document.body.appendChild(rootWrapper);
28495
28576
  }
28496
28577
  addRecorderDragFunctionality() {
28578
+ if (!this.isBrowser)
28579
+ return;
28497
28580
  this.dragManager = new _dragManager__WEBPACK_IMPORTED_MODULE_2__.DragManager(this.recorderButton, this._recorderPlacement, () => {
28498
28581
  if (this._isPaused) {
28499
28582
  this.finalPopoverVisible = true;
@@ -28502,6 +28585,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28502
28585
  this.dragManager.init();
28503
28586
  }
28504
28587
  updatePopoverPosition() {
28588
+ if (!this.isBrowser || typeof window === 'undefined')
28589
+ return;
28505
28590
  const { top, right, bottom, left } = this.recorderButton.getBoundingClientRect();
28506
28591
  const isDraggable = !this.recorderButton.classList.contains('no-draggable');
28507
28592
  const POPOVER_HEIGHT = this._isStarted ? 400 : 300;
@@ -28538,6 +28623,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28538
28623
  });
28539
28624
  }
28540
28625
  addEventListeners() {
28626
+ if (!this.isBrowser)
28627
+ return;
28541
28628
  const events = [];
28542
28629
  if (this.showRecorderButton) {
28543
28630
  events.push({
@@ -28595,34 +28682,47 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28595
28682
  });
28596
28683
  }
28597
28684
  handleStopRecording() {
28685
+ if (!this.isBrowser)
28686
+ return;
28598
28687
  this.onStop();
28599
28688
  this.handleUIReseting();
28600
28689
  }
28601
28690
  handleUIReseting() {
28691
+ if (!this.isBrowser)
28692
+ return;
28602
28693
  this.finalPopoverVisible = false;
28603
28694
  this.resetRecordingButton();
28604
28695
  }
28605
28696
  handleCloseInitialPopover() {
28697
+ if (!this.isBrowser)
28698
+ return;
28606
28699
  if (this._buttonState === _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.LOADING) {
28607
28700
  this.onCancel();
28608
- this.uiManager.setPopoverLoadingState(false);
28609
28701
  }
28610
28702
  this.initialPopoverVisible = false;
28611
28703
  this.buttonState = this._continuousRecording
28612
28704
  ? _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.CONTINUOUS_DEBUGGING
28613
28705
  : _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.IDLE;
28614
- document.removeEventListener('click', this.handleClickOutside);
28706
+ if (typeof document !== 'undefined') {
28707
+ document.removeEventListener('click', this.handleClickOutside);
28708
+ }
28615
28709
  }
28616
28710
  handleCloseFinalPopover() {
28617
28711
  this.onResume();
28618
28712
  }
28619
28713
  onRequestError() {
28714
+ if (!this.isBrowser)
28715
+ return;
28620
28716
  this.initialPopoverVisible = false;
28621
28717
  this.finalPopoverVisible = false;
28622
28718
  this.buttonState = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.IDLE;
28623
- document.removeEventListener('click', this.handleClickOutside);
28719
+ if (typeof document !== 'undefined') {
28720
+ document.removeEventListener('click', this.handleClickOutside);
28721
+ }
28624
28722
  }
28625
28723
  handleDismissRecording() {
28724
+ if (!this.isBrowser)
28725
+ return;
28626
28726
  this.onCancel();
28627
28727
  this.finalPopoverVisible = !this._finalPopoverVisible;
28628
28728
  this.buttonState = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.IDLE;
@@ -28641,6 +28741,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28641
28741
  (_a = element === null || element === void 0 ? void 0 : element.querySelector(selector)) === null || _a === void 0 ? void 0 : _a.addEventListener(event, handler);
28642
28742
  }
28643
28743
  onRecordingButtonClick(e) {
28744
+ if (!this.isBrowser)
28745
+ return;
28644
28746
  if (this.buttonClickExternalHandler) {
28645
28747
  const shouldPropagate = this.buttonClickExternalHandler();
28646
28748
  if (shouldPropagate === false) {
@@ -28672,15 +28774,17 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28672
28774
  : _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.CANCEL;
28673
28775
  this.initialPopoverVisible = !this._initialPopoverVisible;
28674
28776
  }
28675
- if (this._initialPopoverVisible || this._finalPopoverVisible) {
28676
- document.addEventListener('click', this.handleClickOutside);
28677
- }
28678
- else {
28679
- document.removeEventListener('click', this.handleClickOutside);
28777
+ if (typeof document !== 'undefined') {
28778
+ if (this._initialPopoverVisible || this._finalPopoverVisible) {
28779
+ document.addEventListener('click', this.handleClickOutside);
28780
+ }
28781
+ else {
28782
+ document.removeEventListener('click', this.handleClickOutside);
28783
+ }
28680
28784
  }
28681
28785
  }
28682
28786
  updateButton(innerHTML, tooltip, excludeClasses, classes) {
28683
- if (!this.recorderButton)
28787
+ if (!this.isBrowser || !this.recorderButton)
28684
28788
  return;
28685
28789
  (0,_utils__WEBPACK_IMPORTED_MODULE_0__.insertTrustedHTML)(this.recorderButton, `${innerHTML}`);
28686
28790
  this.recorderButton.dataset['tooltip'] = tooltip;
@@ -28702,15 +28806,16 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28702
28806
  }
28703
28807
  startRecording() {
28704
28808
  this.buttonState = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.LOADING;
28705
- this.uiManager.setPopoverLoadingState(true);
28706
28809
  this.onStart();
28707
28810
  }
28708
28811
  onStart() {
28709
28812
  if (!this.recorderButton)
28710
28813
  return;
28711
- this.emit('toggle', [true]);
28814
+ this.emit('start', []);
28712
28815
  }
28713
28816
  onStop() {
28817
+ if (!this.isBrowser)
28818
+ return;
28714
28819
  if (this.showRecorderButton && !this.recorderButton)
28715
28820
  return;
28716
28821
  this.submitSessionDialog.classList.add('hidden');
@@ -28718,16 +28823,18 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28718
28823
  ? this.commentTextarea
28719
28824
  : this.submitSessionDialog.querySelector('#mp-recording-comment');
28720
28825
  if (commentElement) {
28721
- this.emit('toggle', [false, commentElement.value]);
28826
+ this.emit('stop', [commentElement.value]);
28722
28827
  commentElement.value = '';
28723
28828
  return;
28724
28829
  }
28725
- this.emit('toggle', [false, '']);
28830
+ this.emit('stop', []);
28726
28831
  }
28727
28832
  onPause() {
28728
28833
  this.emit('pause', []);
28729
28834
  }
28730
28835
  onResume() {
28836
+ if (!this.isBrowser)
28837
+ return;
28731
28838
  this.finalPopoverVisible = false;
28732
28839
  if (!this._continuousRecording) {
28733
28840
  this.buttonState = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.RECORDING;
@@ -28738,28 +28845,35 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28738
28845
  }
28739
28846
  }
28740
28847
  onCancel() {
28848
+ if (!this.isBrowser)
28849
+ return;
28741
28850
  this.submitSessionDialog.classList.add('hidden');
28742
28851
  this.emit('cancel', []);
28743
28852
  }
28744
28853
  enable() {
28745
- if (!this.recorderButton)
28854
+ if (!this.isBrowser || !this.recorderButton)
28746
28855
  return;
28747
28856
  this.recorderButton.disabled = false;
28748
28857
  this.recorderButton.style.opacity = '1';
28749
28858
  }
28750
28859
  disable() {
28751
- if (!this.recorderButton)
28860
+ if (!this.isBrowser || !this.recorderButton)
28752
28861
  return;
28753
28862
  this.recorderButton.disabled = true;
28754
28863
  this.recorderButton.style.opacity = '0.5';
28755
28864
  }
28756
28865
  destroy() {
28757
- if (!this.recorderButton)
28866
+ if (!this.isBrowser || !this.recorderButton || typeof document === 'undefined')
28758
28867
  return;
28759
- document.body.removeChild(this.recorderButton);
28868
+ const rootWrapper = document.querySelector('.mp-root-wrapper');
28869
+ if (rootWrapper && rootWrapper.contains(this.recorderButton)) {
28870
+ document.body.removeChild(rootWrapper);
28871
+ }
28760
28872
  document.removeEventListener('click', this.handleClickOutside);
28761
28873
  }
28762
28874
  startTimer() {
28875
+ if (!this.isBrowser)
28876
+ return;
28763
28877
  if (this.timerInterval) {
28764
28878
  clearInterval(this.timerInterval);
28765
28879
  this.timerInterval = null;
@@ -28778,6 +28892,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28778
28892
  }
28779
28893
  }
28780
28894
  makeOverlayDraggable() {
28895
+ if (!this.isBrowser || typeof document === 'undefined')
28896
+ return;
28781
28897
  const element = this.overlay;
28782
28898
  const dragHandle = element.querySelector('.mp-drag-handle');
28783
28899
  if (!dragHandle)