@multiplayer-app/session-recorder-browser 1.3.21 → 1.3.23

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
@@ -24326,7 +24326,7 @@ const CONTINUOUS_DEBUGGING_TIMEOUT = 60000; // 1 minutes
24326
24326
  const DEBUG_SESSION_MAX_DURATION_SECONDS = 10 * 60 + 30; // TODO: move to shared config otel core
24327
24327
  const REMOTE_SESSION_RECORDING_START = 'remote-session-recording:start';
24328
24328
  const REMOTE_SESSION_RECORDING_STOP = 'remote-session-recording:stop';
24329
- const PACKAGE_VERSION_EXPORT = "1.3.21" || 0;
24329
+ const PACKAGE_VERSION_EXPORT = "1.3.23" || 0;
24330
24330
  // Regex patterns for OpenTelemetry ignore URLs
24331
24331
  const OTEL_IGNORE_URLS = [
24332
24332
  // Traces endpoint
@@ -25306,13 +25306,14 @@ const getElementTextContent = (element) => {
25306
25306
 
25307
25307
 
25308
25308
 
25309
+ const clientIdGenerator = _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderSdk.getIdGenerator(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.MULTIPLAYER_TRACE_CLIENT_ID_LENGTH);
25309
25310
  class TracerBrowserSDK {
25310
25311
  constructor() {
25311
25312
  this.clientId = '';
25312
25313
  this.sessionId = '';
25313
25314
  this.globalErrorListenersRegistered = false;
25314
25315
  }
25315
- setSessionId(sessionId, sessionType = _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionType.MANUAL) {
25316
+ _setSessionId(sessionId, sessionType = _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionType.MANUAL) {
25316
25317
  this.sessionId = sessionId;
25317
25318
  if (!this.idGenerator) {
25318
25319
  throw new Error('Id generator not initialized');
@@ -25321,9 +25322,10 @@ class TracerBrowserSDK {
25321
25322
  }
25322
25323
  init(options) {
25323
25324
  this.config = options;
25324
- this.clientId = _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderSdk.getIdGenerator(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.MULTIPLAYER_TRACE_CLIENT_ID_LENGTH)();
25325
+ this.clientId = clientIdGenerator();
25325
25326
  const { application, version, environment } = this.config;
25326
25327
  this.idGenerator = new _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderIdGenerator();
25328
+ this._setSessionId('', _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionType.SESSION_CACHE);
25327
25329
  this.exporter = new _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionRecorderBrowserTraceExporter({
25328
25330
  apiKey: options.apiKey,
25329
25331
  url: (0,_helpers__WEBPACK_IMPORTED_MODULE_3__.getExporterEndpoint)(options.exporterEndpoint),
@@ -25457,13 +25459,13 @@ class TracerBrowserSDK {
25457
25459
  if (!this.tracerProvider) {
25458
25460
  throw new Error('Configuration not initialized. Call init() before start().');
25459
25461
  }
25460
- this.setSessionId(sessionId, sessionType);
25462
+ this._setSessionId(sessionId, sessionType);
25461
25463
  }
25462
25464
  stop() {
25463
25465
  if (!this.tracerProvider) {
25464
25466
  throw new Error('Configuration not initialized. Call init() before start().');
25465
25467
  }
25466
- this.setSessionId('');
25468
+ this._setSessionId('', _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_1__.SessionType.SESSION_CACHE);
25467
25469
  }
25468
25470
  setApiKey(apiKey) {
25469
25471
  if (!this.exporter) {
@@ -25471,6 +25473,14 @@ class TracerBrowserSDK {
25471
25473
  }
25472
25474
  this.exporter.setApiKey(apiKey);
25473
25475
  }
25476
+ async exportTraces(spans) {
25477
+ var _a;
25478
+ if ((_a = this === null || this === void 0 ? void 0 : this.batchSpanProcessor) === null || _a === void 0 ? void 0 : _a.onEnd) {
25479
+ spans.map((span) => { var _a; return (_a = this === null || this === void 0 ? void 0 : this.batchSpanProcessor) === null || _a === void 0 ? void 0 : _a.onEnd(span); });
25480
+ // return this.batchSpanProcessor.onEnd()
25481
+ }
25482
+ throw new Error('Buffer span processor not initialized');
25483
+ }
25474
25484
  /**
25475
25485
  * Capture an exception as an error span/event.
25476
25486
  * If there is an active span, the exception will be recorded on it.
@@ -25502,14 +25512,6 @@ class TracerBrowserSDK {
25502
25512
  }
25503
25513
  catch (_ignored) { }
25504
25514
  }
25505
- async exportTraces(spans) {
25506
- var _a;
25507
- if ((_a = this === null || this === void 0 ? void 0 : this.batchSpanProcessor) === null || _a === void 0 ? void 0 : _a.onEnd) {
25508
- spans.map((span) => { var _a; return (_a = this === null || this === void 0 ? void 0 : this.batchSpanProcessor) === null || _a === void 0 ? void 0 : _a.onEnd(span); });
25509
- // return this.batchSpanProcessor.onEnd()
25510
- }
25511
- throw new Error('Buffer span processor not initialized');
25512
- }
25513
25515
  _recordException(span, error, errorInfo) {
25514
25516
  span.recordException(error);
25515
25517
  span.setStatus({ code: _opentelemetry_api__WEBPACK_IMPORTED_MODULE_13__.SpanStatusCode.ERROR, message: error.message });
@@ -27912,13 +27914,11 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_16__.Obse
27912
27914
  }, 5000);
27913
27915
  });
27914
27916
  this._socketService.on(_config__WEBPACK_IMPORTED_MODULE_5__.REMOTE_SESSION_RECORDING_START, (payload) => {
27915
- console.log('REMOTE_SESSION_RECORDING_START', payload);
27916
27917
  if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_4__.SessionState.stopped) {
27917
27918
  this.start();
27918
27919
  }
27919
27920
  });
27920
27921
  this._socketService.on(_config__WEBPACK_IMPORTED_MODULE_5__.REMOTE_SESSION_RECORDING_STOP, (payload) => {
27921
- console.log('REMOTE_SESSION_RECORDING_STOP', payload);
27922
27922
  if (this.sessionState !== _types__WEBPACK_IMPORTED_MODULE_4__.SessionState.stopped) {
27923
27923
  this.stop();
27924
27924
  }
@@ -30201,7 +30201,9 @@ var SessionRecorderIdGenerator = /** @class */ (function () {
30201
30201
  }
30202
30202
  SessionRecorderIdGenerator.prototype.generateTraceId = function () {
30203
30203
  var traceId = this.generateLongId();
30204
- if (!this.sessionShortId && !this.sessionType) {
30204
+ if (!this.sessionShortId
30205
+ && !this.sessionType
30206
+ && !this.clientId) {
30205
30207
  return traceId;
30206
30208
  }
30207
30209
  var sessionTypePrefix = _constants_constants_base__WEBPACK_IMPORTED_MODULE_2__.MULTIPLAYER_TRACE_PREFIX_MAP[this.sessionType];