@multiplayer-app/session-recorder-browser 1.2.33 → 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.33" || 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');
@@ -28264,6 +28308,7 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28264
28308
  else {
28265
28309
  (_b = this.buttonDraggabilityObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
28266
28310
  }
28311
+ this.uiManager.setPopoverLoadingState(newState === _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.LOADING);
28267
28312
  this.updateButton(icon, tooltip, excludeClasses, classes);
28268
28313
  }
28269
28314
  set initialPopoverVisible(v) {
@@ -28318,7 +28363,6 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28318
28363
  else {
28319
28364
  this.buttonState = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.CONTINUOUS_DEBUGGING;
28320
28365
  }
28321
- this.uiManager.setPopoverLoadingState(false);
28322
28366
  }
28323
28367
  else {
28324
28368
  this.buttonState = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.IDLE;
@@ -28654,7 +28698,6 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28654
28698
  return;
28655
28699
  if (this._buttonState === _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.LOADING) {
28656
28700
  this.onCancel();
28657
- this.uiManager.setPopoverLoadingState(false);
28658
28701
  }
28659
28702
  this.initialPopoverVisible = false;
28660
28703
  this.buttonState = this._continuousRecording
@@ -28763,13 +28806,12 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28763
28806
  }
28764
28807
  startRecording() {
28765
28808
  this.buttonState = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.LOADING;
28766
- this.uiManager.setPopoverLoadingState(true);
28767
28809
  this.onStart();
28768
28810
  }
28769
28811
  onStart() {
28770
28812
  if (!this.recorderButton)
28771
28813
  return;
28772
- this.emit('toggle', [true]);
28814
+ this.emit('start', []);
28773
28815
  }
28774
28816
  onStop() {
28775
28817
  if (!this.isBrowser)
@@ -28781,11 +28823,11 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
28781
28823
  ? this.commentTextarea
28782
28824
  : this.submitSessionDialog.querySelector('#mp-recording-comment');
28783
28825
  if (commentElement) {
28784
- this.emit('toggle', [false, commentElement.value]);
28826
+ this.emit('stop', [commentElement.value]);
28785
28827
  commentElement.value = '';
28786
28828
  return;
28787
28829
  }
28788
- this.emit('toggle', [false, '']);
28830
+ this.emit('stop', []);
28789
28831
  }
28790
28832
  onPause() {
28791
28833
  this.emit('pause', []);