@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.
package/dist/index.umd.js CHANGED
@@ -24317,7 +24317,7 @@ const DEFAULT_MAX_HTTP_CAPTURING_PAYLOAD_SIZE = 100000;
24317
24317
  const SESSION_RESPONSE = 'multiplayer-debug-session-response';
24318
24318
  const CONTINUOUS_DEBUGGING_TIMEOUT = 60000; // 1 minutes
24319
24319
  const DEBUG_SESSION_MAX_DURATION_SECONDS = 10 * 60 + 30; // TODO: move to shared config otel core
24320
- const PACKAGE_VERSION_EXPORT = "1.2.32" || 0;
24320
+ const PACKAGE_VERSION_EXPORT = "1.2.34" || 0;
24321
24321
  // Regex patterns for OpenTelemetry ignore URLs
24322
24322
  const OTEL_IGNORE_URLS = [
24323
24323
  // Traces endpoint
@@ -26756,41 +26756,75 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_14__.Obse
26756
26756
  * Register session widget event listeners for controlling session actions
26757
26757
  */
26758
26758
  _registerWidgetEvents() {
26759
- this._sessionWidget.on('toggle', (state, comment) => {
26759
+ this._sessionWidget.on('start', () => {
26760
26760
  this.error = '';
26761
- if (state) {
26762
- this.start(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_11__.SessionType.MANUAL);
26763
- }
26764
- else {
26765
- this.stop(comment === null || comment === void 0 ? void 0 : comment.trim());
26766
- }
26761
+ this._handleStart();
26762
+ });
26763
+ this._sessionWidget.on('stop', (comment) => {
26764
+ this.error = '';
26765
+ this._handleStop(comment);
26767
26766
  });
26768
26767
  this._sessionWidget.on('pause', () => {
26769
26768
  this.error = '';
26770
- this.pause();
26769
+ this._handlePause();
26771
26770
  });
26772
26771
  this._sessionWidget.on('resume', () => {
26773
26772
  this.error = '';
26774
- this.resume();
26773
+ this._handleResume();
26775
26774
  });
26776
26775
  this._sessionWidget.on('cancel', () => {
26777
26776
  this.error = '';
26778
- this.cancel();
26777
+ this._handleCancel();
26779
26778
  });
26780
26779
  this._sessionWidget.on('continuous-debugging', (enabled) => {
26781
26780
  this.error = '';
26782
26781
  if (enabled) {
26783
- this.start(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_11__.SessionType.CONTINUOUS);
26782
+ this._handleContinuousDebugging();
26784
26783
  }
26785
26784
  else {
26786
- this.stop();
26785
+ this._handleStop();
26787
26786
  }
26788
26787
  });
26789
26788
  this._sessionWidget.on('save', () => {
26790
26789
  this.error = '';
26791
- this.save();
26790
+ this._handleSave();
26792
26791
  });
26793
26792
  }
26793
+ _handleStart() {
26794
+ if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.stopped) {
26795
+ this.start(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_11__.SessionType.MANUAL);
26796
+ }
26797
+ }
26798
+ _handleStop(comment) {
26799
+ if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.started || this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.paused) {
26800
+ this.stop(comment);
26801
+ }
26802
+ }
26803
+ _handlePause() {
26804
+ if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.started) {
26805
+ this.pause();
26806
+ }
26807
+ }
26808
+ _handleResume() {
26809
+ if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.paused) {
26810
+ this.resume();
26811
+ }
26812
+ }
26813
+ _handleCancel() {
26814
+ if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.started || this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.paused) {
26815
+ this.cancel();
26816
+ }
26817
+ }
26818
+ _handleSave() {
26819
+ if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.started && this.continuousRecording) {
26820
+ this.save();
26821
+ }
26822
+ }
26823
+ _handleContinuousDebugging() {
26824
+ if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.stopped) {
26825
+ this.start(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_11__.SessionType.CONTINUOUS);
26826
+ }
26827
+ }
26794
26828
  /**
26795
26829
  * Register session limit reaching listeners for controlling session end
26796
26830
  */
@@ -26847,6 +26881,7 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_14__.Obse
26847
26881
  }
26848
26882
  catch (error) {
26849
26883
  this.error = error.message;
26884
+ this.sessionState = _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.stopped;
26850
26885
  if (this.continuousRecording) {
26851
26886
  this.sessionType = _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_11__.SessionType.MANUAL;
26852
26887
  }
@@ -27290,6 +27325,7 @@ class DragManager {
27290
27325
  this.isDragging = false;
27291
27326
  this.dragStarted = false;
27292
27327
  this.isOnLeftHalfOfScreen = false;
27328
+ this.isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
27293
27329
  this.recorderButton = recorderButton;
27294
27330
  this.recorderPlacement = recorderPlacement;
27295
27331
  this.onDragEnd = onDragEnd;
@@ -27297,10 +27333,14 @@ class DragManager {
27297
27333
  this.onRecordingButtonClick = onRecordingButtonClick;
27298
27334
  }
27299
27335
  init() {
27336
+ if (!this.isBrowser)
27337
+ return;
27300
27338
  this.loadStoredPosition();
27301
27339
  this.setupDragListeners();
27302
27340
  }
27303
27341
  loadStoredPosition() {
27342
+ if (!this.isBrowser || typeof window === 'undefined' || typeof localStorage === 'undefined')
27343
+ return;
27304
27344
  const savedPosition = localStorage.getItem(_constants__WEBPACK_IMPORTED_MODULE_0__.POSITION_STATE_KEY);
27305
27345
  if (!savedPosition) {
27306
27346
  return;
@@ -27331,11 +27371,15 @@ class DragManager {
27331
27371
  });
27332
27372
  }
27333
27373
  savePosition(r, b) {
27374
+ if (!this.isBrowser || typeof window === 'undefined' || typeof localStorage === 'undefined')
27375
+ return;
27334
27376
  const right = (r / window.innerWidth) * 100;
27335
27377
  const bottom = (b / window.innerHeight) * 100;
27336
27378
  localStorage.setItem(_constants__WEBPACK_IMPORTED_MODULE_0__.POSITION_STATE_KEY, JSON.stringify({ right, bottom }));
27337
27379
  }
27338
27380
  setupDragListeners() {
27381
+ if (!this.isBrowser || typeof document === 'undefined' || typeof window === 'undefined')
27382
+ return;
27339
27383
  this.recorderButton.addEventListener('mousedown', (e) => {
27340
27384
  const onMouseUp = () => {
27341
27385
  const isDraggable = !this.recorderButton.classList.contains('no-draggable');
@@ -27430,29 +27474,37 @@ class DragManager {
27430
27474
 
27431
27475
  class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observable {
27432
27476
  set buttonState(newState) {
27477
+ var _a, _b;
27433
27478
  this._buttonState = newState;
27479
+ if (!this.isBrowser)
27480
+ return;
27434
27481
  const { icon, tooltip, classes, excludeClasses } = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.buttonStates[newState];
27435
27482
  if (newState === _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.CANCEL) {
27436
- this.buttonDraggabilityObserver.observe(this.recorderButton, {
27483
+ (_a = this.buttonDraggabilityObserver) === null || _a === void 0 ? void 0 : _a.observe(this.recorderButton, {
27437
27484
  attributes: true,
27438
27485
  attributeOldValue: true,
27439
27486
  attributeFilter: ['class'],
27440
27487
  });
27441
27488
  }
27442
27489
  else {
27443
- this.buttonDraggabilityObserver.disconnect();
27490
+ (_b = this.buttonDraggabilityObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
27444
27491
  }
27492
+ this.uiManager.setPopoverLoadingState(newState === _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.LOADING);
27445
27493
  this.updateButton(icon, tooltip, excludeClasses, classes);
27446
27494
  }
27447
27495
  set initialPopoverVisible(v) {
27448
27496
  var _a;
27449
27497
  this._initialPopoverVisible = v;
27450
- (_a = this.initialPopover) === null || _a === void 0 ? void 0 : _a.classList.toggle('hidden', !v);
27498
+ if (this.isBrowser) {
27499
+ (_a = this.initialPopover) === null || _a === void 0 ? void 0 : _a.classList.toggle('hidden', !v);
27500
+ }
27451
27501
  }
27452
27502
  set finalPopoverVisible(v) {
27453
27503
  var _a;
27454
27504
  this._finalPopoverVisible = v;
27455
- (_a = this.finalPopover) === null || _a === void 0 ? void 0 : _a.classList.toggle('hidden', !v);
27505
+ if (this.isBrowser) {
27506
+ (_a = this.finalPopover) === null || _a === void 0 ? void 0 : _a.classList.toggle('hidden', !v);
27507
+ }
27456
27508
  }
27457
27509
  get error() {
27458
27510
  return this._error;
@@ -27471,6 +27523,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
27471
27523
  }
27472
27524
  set isStarted(v) {
27473
27525
  this._isStarted = v;
27526
+ if (!this.isBrowser)
27527
+ return;
27474
27528
  if (!this.showRecorderButton && v && !this._continuousRecording) {
27475
27529
  this.overlay.classList.remove('hidden');
27476
27530
  this.makeOverlayDraggable();
@@ -27490,7 +27544,6 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
27490
27544
  else {
27491
27545
  this.buttonState = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.CONTINUOUS_DEBUGGING;
27492
27546
  }
27493
- this.uiManager.setPopoverLoadingState(false);
27494
27547
  }
27495
27548
  else {
27496
27549
  this.buttonState = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.IDLE;
@@ -27498,6 +27551,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
27498
27551
  }
27499
27552
  set isPaused(v) {
27500
27553
  this._isPaused = v;
27554
+ if (!this.isBrowser)
27555
+ return;
27501
27556
  if (this._isInitialized && !this.showRecorderButton && v && !this._continuousRecording) {
27502
27557
  this.overlay.classList.add('hidden');
27503
27558
  this.submitSessionDialog.classList.remove('hidden');
@@ -27541,6 +27596,18 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
27541
27596
  }
27542
27597
  }
27543
27598
  };
27599
+ this.isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
27600
+ if (!this.isBrowser) {
27601
+ // Create dummy elements for SSR to prevent crashes
27602
+ this.recorderButton = {};
27603
+ this.initialPopover = {};
27604
+ this.finalPopover = {};
27605
+ this.overlay = {};
27606
+ this.toast = {};
27607
+ this.submitSessionDialog = {};
27608
+ this.uiManager = {};
27609
+ return;
27610
+ }
27544
27611
  this.recorderButton = document.createElement('button');
27545
27612
  this.initialPopover = document.createElement('div');
27546
27613
  this.finalPopover = document.createElement('div');
@@ -27579,6 +27646,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
27579
27646
  }
27580
27647
  }
27581
27648
  updateContinuousRecordingState(checked, disabled = false) {
27649
+ if (!this.isBrowser)
27650
+ return;
27582
27651
  const toggleCheckbox = this.initialPopover.querySelector('#mp-session-debugger-continuous-debugging-checkbox');
27583
27652
  if (toggleCheckbox) {
27584
27653
  toggleCheckbox.checked = checked;
@@ -27586,6 +27655,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
27586
27655
  }
27587
27656
  }
27588
27657
  updateSaveContinuousDebugSessionState(state) {
27658
+ if (!this.isBrowser)
27659
+ return;
27589
27660
  const saveButton = this.initialPopover.querySelector('#mp-save-continuous-debug-session');
27590
27661
  if (saveButton) {
27591
27662
  const { textContent, disabled } = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.continuousRecordingSaveButtonStates[state];
@@ -27599,15 +27670,21 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
27599
27670
  * @param duration - Duration in milliseconds to show the toast (default: 10000ms)
27600
27671
  */
27601
27672
  showToast(config, duration = 10000) {
27673
+ if (!this.isBrowser)
27674
+ return;
27602
27675
  this.uiManager.showToast(config, duration);
27603
27676
  }
27604
27677
  /**
27605
27678
  * Hides the currently displayed toast message
27606
27679
  */
27607
27680
  hideToast() {
27681
+ if (!this.isBrowser)
27682
+ return;
27608
27683
  this.uiManager.hideToast();
27609
27684
  }
27610
27685
  observeButtonDraggableMode() {
27686
+ if (!this.isBrowser)
27687
+ return;
27611
27688
  this.buttonDraggabilityObserver = new MutationObserver((mutationsList) => {
27612
27689
  for (const mutation of mutationsList) {
27613
27690
  if (mutation.type === 'attributes' &&
@@ -27629,6 +27706,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
27629
27706
  init(options) {
27630
27707
  if (this._isInitialized)
27631
27708
  return;
27709
+ if (!this.isBrowser)
27710
+ return;
27632
27711
  this._isInitialized = true;
27633
27712
  this.showRecorderButton = options.showWidget;
27634
27713
  this._showContinuousRecording = options.showContinuousRecording;
@@ -27668,6 +27747,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
27668
27747
  this.addEventListeners();
27669
27748
  }
27670
27749
  appendElements(elements) {
27750
+ if (!this.isBrowser || typeof document === 'undefined')
27751
+ return;
27671
27752
  const rootWrapper = document.createElement('mp-root');
27672
27753
  rootWrapper.classList.add('mp-root-wrapper');
27673
27754
  rootWrapper.setAttribute('data-rr-ignore', 'true');
@@ -27675,6 +27756,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
27675
27756
  document.body.appendChild(rootWrapper);
27676
27757
  }
27677
27758
  addRecorderDragFunctionality() {
27759
+ if (!this.isBrowser)
27760
+ return;
27678
27761
  this.dragManager = new _dragManager__WEBPACK_IMPORTED_MODULE_2__.DragManager(this.recorderButton, this._recorderPlacement, () => {
27679
27762
  if (this._isPaused) {
27680
27763
  this.finalPopoverVisible = true;
@@ -27683,6 +27766,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
27683
27766
  this.dragManager.init();
27684
27767
  }
27685
27768
  updatePopoverPosition() {
27769
+ if (!this.isBrowser || typeof window === 'undefined')
27770
+ return;
27686
27771
  const { top, right, bottom, left } = this.recorderButton.getBoundingClientRect();
27687
27772
  const isDraggable = !this.recorderButton.classList.contains('no-draggable');
27688
27773
  const POPOVER_HEIGHT = this._isStarted ? 400 : 300;
@@ -27719,6 +27804,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
27719
27804
  });
27720
27805
  }
27721
27806
  addEventListeners() {
27807
+ if (!this.isBrowser)
27808
+ return;
27722
27809
  const events = [];
27723
27810
  if (this.showRecorderButton) {
27724
27811
  events.push({
@@ -27776,34 +27863,47 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
27776
27863
  });
27777
27864
  }
27778
27865
  handleStopRecording() {
27866
+ if (!this.isBrowser)
27867
+ return;
27779
27868
  this.onStop();
27780
27869
  this.handleUIReseting();
27781
27870
  }
27782
27871
  handleUIReseting() {
27872
+ if (!this.isBrowser)
27873
+ return;
27783
27874
  this.finalPopoverVisible = false;
27784
27875
  this.resetRecordingButton();
27785
27876
  }
27786
27877
  handleCloseInitialPopover() {
27878
+ if (!this.isBrowser)
27879
+ return;
27787
27880
  if (this._buttonState === _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.LOADING) {
27788
27881
  this.onCancel();
27789
- this.uiManager.setPopoverLoadingState(false);
27790
27882
  }
27791
27883
  this.initialPopoverVisible = false;
27792
27884
  this.buttonState = this._continuousRecording
27793
27885
  ? _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.CONTINUOUS_DEBUGGING
27794
27886
  : _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.IDLE;
27795
- document.removeEventListener('click', this.handleClickOutside);
27887
+ if (typeof document !== 'undefined') {
27888
+ document.removeEventListener('click', this.handleClickOutside);
27889
+ }
27796
27890
  }
27797
27891
  handleCloseFinalPopover() {
27798
27892
  this.onResume();
27799
27893
  }
27800
27894
  onRequestError() {
27895
+ if (!this.isBrowser)
27896
+ return;
27801
27897
  this.initialPopoverVisible = false;
27802
27898
  this.finalPopoverVisible = false;
27803
27899
  this.buttonState = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.IDLE;
27804
- document.removeEventListener('click', this.handleClickOutside);
27900
+ if (typeof document !== 'undefined') {
27901
+ document.removeEventListener('click', this.handleClickOutside);
27902
+ }
27805
27903
  }
27806
27904
  handleDismissRecording() {
27905
+ if (!this.isBrowser)
27906
+ return;
27807
27907
  this.onCancel();
27808
27908
  this.finalPopoverVisible = !this._finalPopoverVisible;
27809
27909
  this.buttonState = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.IDLE;
@@ -27822,6 +27922,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
27822
27922
  (_a = element === null || element === void 0 ? void 0 : element.querySelector(selector)) === null || _a === void 0 ? void 0 : _a.addEventListener(event, handler);
27823
27923
  }
27824
27924
  onRecordingButtonClick(e) {
27925
+ if (!this.isBrowser)
27926
+ return;
27825
27927
  if (this.buttonClickExternalHandler) {
27826
27928
  const shouldPropagate = this.buttonClickExternalHandler();
27827
27929
  if (shouldPropagate === false) {
@@ -27853,15 +27955,17 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
27853
27955
  : _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.CANCEL;
27854
27956
  this.initialPopoverVisible = !this._initialPopoverVisible;
27855
27957
  }
27856
- if (this._initialPopoverVisible || this._finalPopoverVisible) {
27857
- document.addEventListener('click', this.handleClickOutside);
27858
- }
27859
- else {
27860
- document.removeEventListener('click', this.handleClickOutside);
27958
+ if (typeof document !== 'undefined') {
27959
+ if (this._initialPopoverVisible || this._finalPopoverVisible) {
27960
+ document.addEventListener('click', this.handleClickOutside);
27961
+ }
27962
+ else {
27963
+ document.removeEventListener('click', this.handleClickOutside);
27964
+ }
27861
27965
  }
27862
27966
  }
27863
27967
  updateButton(innerHTML, tooltip, excludeClasses, classes) {
27864
- if (!this.recorderButton)
27968
+ if (!this.isBrowser || !this.recorderButton)
27865
27969
  return;
27866
27970
  (0,_utils__WEBPACK_IMPORTED_MODULE_0__.insertTrustedHTML)(this.recorderButton, `${innerHTML}`);
27867
27971
  this.recorderButton.dataset['tooltip'] = tooltip;
@@ -27883,15 +27987,16 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
27883
27987
  }
27884
27988
  startRecording() {
27885
27989
  this.buttonState = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.LOADING;
27886
- this.uiManager.setPopoverLoadingState(true);
27887
27990
  this.onStart();
27888
27991
  }
27889
27992
  onStart() {
27890
27993
  if (!this.recorderButton)
27891
27994
  return;
27892
- this.emit('toggle', [true]);
27995
+ this.emit('start', []);
27893
27996
  }
27894
27997
  onStop() {
27998
+ if (!this.isBrowser)
27999
+ return;
27895
28000
  if (this.showRecorderButton && !this.recorderButton)
27896
28001
  return;
27897
28002
  this.submitSessionDialog.classList.add('hidden');
@@ -27899,16 +28004,18 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
27899
28004
  ? this.commentTextarea
27900
28005
  : this.submitSessionDialog.querySelector('#mp-recording-comment');
27901
28006
  if (commentElement) {
27902
- this.emit('toggle', [false, commentElement.value]);
28007
+ this.emit('stop', [commentElement.value]);
27903
28008
  commentElement.value = '';
27904
28009
  return;
27905
28010
  }
27906
- this.emit('toggle', [false, '']);
28011
+ this.emit('stop', []);
27907
28012
  }
27908
28013
  onPause() {
27909
28014
  this.emit('pause', []);
27910
28015
  }
27911
28016
  onResume() {
28017
+ if (!this.isBrowser)
28018
+ return;
27912
28019
  this.finalPopoverVisible = false;
27913
28020
  if (!this._continuousRecording) {
27914
28021
  this.buttonState = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.RECORDING;
@@ -27919,28 +28026,35 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
27919
28026
  }
27920
28027
  }
27921
28028
  onCancel() {
28029
+ if (!this.isBrowser)
28030
+ return;
27922
28031
  this.submitSessionDialog.classList.add('hidden');
27923
28032
  this.emit('cancel', []);
27924
28033
  }
27925
28034
  enable() {
27926
- if (!this.recorderButton)
28035
+ if (!this.isBrowser || !this.recorderButton)
27927
28036
  return;
27928
28037
  this.recorderButton.disabled = false;
27929
28038
  this.recorderButton.style.opacity = '1';
27930
28039
  }
27931
28040
  disable() {
27932
- if (!this.recorderButton)
28041
+ if (!this.isBrowser || !this.recorderButton)
27933
28042
  return;
27934
28043
  this.recorderButton.disabled = true;
27935
28044
  this.recorderButton.style.opacity = '0.5';
27936
28045
  }
27937
28046
  destroy() {
27938
- if (!this.recorderButton)
28047
+ if (!this.isBrowser || !this.recorderButton || typeof document === 'undefined')
27939
28048
  return;
27940
- document.body.removeChild(this.recorderButton);
28049
+ const rootWrapper = document.querySelector('.mp-root-wrapper');
28050
+ if (rootWrapper && rootWrapper.contains(this.recorderButton)) {
28051
+ document.body.removeChild(rootWrapper);
28052
+ }
27941
28053
  document.removeEventListener('click', this.handleClickOutside);
27942
28054
  }
27943
28055
  startTimer() {
28056
+ if (!this.isBrowser)
28057
+ return;
27944
28058
  if (this.timerInterval) {
27945
28059
  clearInterval(this.timerInterval);
27946
28060
  this.timerInterval = null;
@@ -27959,6 +28073,8 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
27959
28073
  }
27960
28074
  }
27961
28075
  makeOverlayDraggable() {
28076
+ if (!this.isBrowser || typeof document === 'undefined')
28077
+ return;
27962
28078
  const element = this.overlay;
27963
28079
  const dragHandle = element.querySelector('.mp-drag-handle');
27964
28080
  if (!dragHandle)