@multiplayer-app/session-recorder-browser 1.3.10 → 1.3.11

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.js CHANGED
@@ -23716,7 +23716,7 @@ const CONTINUOUS_DEBUGGING_TIMEOUT = 60000; // 1 minutes
23716
23716
  const DEBUG_SESSION_MAX_DURATION_SECONDS = 10 * 60 + 30; // TODO: move to shared config otel core
23717
23717
  const REMOTE_SESSION_RECORDING_START = 'remote-session-recording:start';
23718
23718
  const REMOTE_SESSION_RECORDING_STOP = 'remote-session-recording:stop';
23719
- const PACKAGE_VERSION_EXPORT = "1.3.10" || 0;
23719
+ const PACKAGE_VERSION_EXPORT = "1.3.11" || 0;
23720
23720
  // Regex patterns for OpenTelemetry ignore URLs
23721
23721
  const OTEL_IGNORE_URLS = [
23722
23722
  // Traces endpoint
@@ -25741,11 +25741,10 @@ class SocketService extends lib0_observable__WEBPACK_IMPORTED_MODULE_3__.Observa
25741
25741
  _services_messaging_service__WEBPACK_IMPORTED_MODULE_1__["default"].sendMessage(action, data);
25742
25742
  }
25743
25743
  emitSocketEvent(name, data) {
25744
- var _a;
25745
25744
  if (this.usePostMessage) {
25746
25745
  this.sendViaPostMessage(name, data);
25747
25746
  }
25748
- else if ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.connected) {
25747
+ else if (this.socket && this.isConnected) {
25749
25748
  this.socket.emit(name, data);
25750
25749
  }
25751
25750
  else {
@@ -25754,15 +25753,14 @@ class SocketService extends lib0_observable__WEBPACK_IMPORTED_MODULE_3__.Observa
25754
25753
  }
25755
25754
  }
25756
25755
  flushQueue() {
25757
- var _a, _b;
25758
- while (this.queue.length > 0 && (this.usePostMessage || ((_a = this.socket) === null || _a === void 0 ? void 0 : _a.connected))) {
25756
+ while (this.queue.length > 0 && (this.usePostMessage || this.isConnected)) {
25759
25757
  const event = this.queue.shift();
25760
25758
  if (!event)
25761
25759
  continue;
25762
25760
  if (this.usePostMessage) {
25763
25761
  this.sendViaPostMessage(event.name, event.data);
25764
25762
  }
25765
- else if ((_b = this.socket) === null || _b === void 0 ? void 0 : _b.connected) {
25763
+ else if (this.socket && this.isConnected) {
25766
25764
  this.socket.emit(event.name, event.data);
25767
25765
  }
25768
25766
  }
@@ -25911,6 +25909,12 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_14__.Obse
25911
25909
  set sessionAttributes(attributes) {
25912
25910
  this._sessionAttributes = attributes;
25913
25911
  }
25912
+ get userAttributes() {
25913
+ return this._userAttributes;
25914
+ }
25915
+ set userAttributes(userAttributes) {
25916
+ this._userAttributes = userAttributes;
25917
+ }
25914
25918
  get error() {
25915
25919
  return this._error;
25916
25920
  }
@@ -25941,7 +25945,6 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_14__.Obse
25941
25945
  this._recorder = new _rrweb__WEBPACK_IMPORTED_MODULE_1__.RecorderBrowserSDK();
25942
25946
  this._sessionWidget = new _sessionWidget__WEBPACK_IMPORTED_MODULE_8__.SessionWidget();
25943
25947
  this._navigationRecorder = new _navigation__WEBPACK_IMPORTED_MODULE_13__.NavigationRecorder();
25944
- this._userAttributes = undefined;
25945
25948
  this._startRequestController = null;
25946
25949
  this._isInitialized = false;
25947
25950
  // Session ID and state are stored in localStorage
@@ -25950,6 +25953,7 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_14__.Obse
25950
25953
  this._sessionState = null;
25951
25954
  this._session = null;
25952
25955
  this._sessionAttributes = null;
25956
+ this._userAttributes = null;
25953
25957
  /**
25954
25958
  * Error message getter and setter
25955
25959
  */
@@ -26158,6 +26162,9 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_14__.Obse
26158
26162
  * @param userAttributes - the user attributes to set
26159
26163
  */
26160
26164
  setUserAttributes(userAttributes) {
26165
+ if (!this._userAttributes && !userAttributes) {
26166
+ return;
26167
+ }
26161
26168
  this._userAttributes = userAttributes;
26162
26169
  this._socketService.setUser(this._userAttributes);
26163
26170
  }
@@ -26356,8 +26363,8 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_14__.Obse
26356
26363
  const payload = {
26357
26364
  sessionAttributes: this.sessionAttributes,
26358
26365
  resourceAttributes: (0,_utils__WEBPACK_IMPORTED_MODULE_2__.getNavigatorInfo)(),
26359
- userAttributes: this._userAttributes,
26360
- name: this._getSessionName()
26366
+ name: this._getSessionName(),
26367
+ ...(this._userAttributes ? { userAttributes: this._userAttributes } : {}),
26361
26368
  };
26362
26369
  const request = !this.continuousRecording ?
26363
26370
  payload : { debugSessionData: payload };