@multiplayer-app/session-recorder-browser 1.2.33 → 1.2.35
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/browser/index.js +133 -98
- package/dist/browser/index.js.map +1 -1
- package/dist/exporters/index.js +1 -1
- package/dist/index.js +133 -98
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +133 -98
- package/dist/index.umd.js.map +1 -1
- package/dist/patch/fetch.js +71 -78
- package/dist/patch/fetch.js.map +1 -1
- package/dist/sessionRecorder.d.ts +7 -0
- package/dist/sessionRecorder.d.ts.map +1 -1
- package/dist/sessionRecorder.js +48 -13
- package/dist/sessionRecorder.js.map +1 -1
- package/dist/sessionWidget/dragManager.d.ts +1 -0
- package/dist/sessionWidget/dragManager.d.ts.map +1 -1
- package/dist/sessionWidget/dragManager.js +9 -0
- package/dist/sessionWidget/dragManager.js.map +1 -1
- package/dist/sessionWidget/index.d.ts +1 -1
- package/dist/sessionWidget/index.d.ts.map +1 -1
- package/dist/sessionWidget/index.js +4 -6
- package/dist/sessionWidget/index.js.map +1 -1
- package/package.json +2 -2
package/dist/exporters/index.js
CHANGED
|
@@ -9978,7 +9978,7 @@ const DEFAULT_MAX_HTTP_CAPTURING_PAYLOAD_SIZE = 100000;
|
|
|
9978
9978
|
const SESSION_RESPONSE = 'multiplayer-debug-session-response';
|
|
9979
9979
|
const CONTINUOUS_DEBUGGING_TIMEOUT = 60000; // 1 minutes
|
|
9980
9980
|
const DEBUG_SESSION_MAX_DURATION_SECONDS = 10 * 60 + 30; // TODO: move to shared config otel core
|
|
9981
|
-
const PACKAGE_VERSION_EXPORT = "1.2.
|
|
9981
|
+
const PACKAGE_VERSION_EXPORT = "1.2.35" || 0;
|
|
9982
9982
|
// Regex patterns for OpenTelemetry ignore URLs
|
|
9983
9983
|
const OTEL_IGNORE_URLS = [
|
|
9984
9984
|
// Traces endpoint
|
package/dist/index.js
CHANGED
|
@@ -24143,7 +24143,7 @@ const DEFAULT_MAX_HTTP_CAPTURING_PAYLOAD_SIZE = 100000;
|
|
|
24143
24143
|
const SESSION_RESPONSE = 'multiplayer-debug-session-response';
|
|
24144
24144
|
const CONTINUOUS_DEBUGGING_TIMEOUT = 60000; // 1 minutes
|
|
24145
24145
|
const DEBUG_SESSION_MAX_DURATION_SECONDS = 10 * 60 + 30; // TODO: move to shared config otel core
|
|
24146
|
-
const PACKAGE_VERSION_EXPORT = "1.2.
|
|
24146
|
+
const PACKAGE_VERSION_EXPORT = "1.2.35" || 0;
|
|
24147
24147
|
// Regex patterns for OpenTelemetry ignore URLs
|
|
24148
24148
|
const OTEL_IGNORE_URLS = [
|
|
24149
24149
|
// Traces endpoint
|
|
@@ -25376,91 +25376,84 @@ function _headersInitToObject(headersInit) {
|
|
|
25376
25376
|
return result;
|
|
25377
25377
|
}
|
|
25378
25378
|
if (typeof window !== 'undefined' && typeof window.fetch !== 'undefined') {
|
|
25379
|
-
//
|
|
25380
|
-
|
|
25381
|
-
|
|
25382
|
-
|
|
25383
|
-
|
|
25384
|
-
|
|
25385
|
-
|
|
25386
|
-
|
|
25387
|
-
|
|
25388
|
-
const
|
|
25389
|
-
//
|
|
25390
|
-
|
|
25391
|
-
|
|
25392
|
-
|
|
25393
|
-
|
|
25394
|
-
|
|
25395
|
-
|
|
25396
|
-
|
|
25397
|
-
|
|
25398
|
-
|
|
25399
|
-
|
|
25400
|
-
|
|
25401
|
-
|
|
25402
|
-
networkRequest.requestHeaders = _headersToObject(requestForMetadata.headers);
|
|
25403
|
-
}
|
|
25404
|
-
else if (inputIsRequest) {
|
|
25405
|
-
networkRequest.requestHeaders = _headersToObject(input.headers);
|
|
25406
|
-
}
|
|
25407
|
-
else {
|
|
25408
|
-
networkRequest.requestHeaders = _headersInitToObject(init === null || init === void 0 ? void 0 : init.headers);
|
|
25409
|
-
}
|
|
25410
|
-
}
|
|
25411
|
-
if (_configs__WEBPACK_IMPORTED_MODULE_2__.configs.shouldRecordBody) {
|
|
25412
|
-
// Prefer reading from the safely constructed Request; else fallback to init.body
|
|
25413
|
-
const urlStr = inputIsRequest
|
|
25414
|
-
? input.url
|
|
25415
|
-
: (typeof input === 'string' || input instanceof URL ? String(input) : '');
|
|
25416
|
-
const candidateBody = requestForMetadata
|
|
25417
|
-
? requestForMetadata.body
|
|
25418
|
-
: (inputIsRequest ? init === null || init === void 0 ? void 0 : init.body : init === null || init === void 0 ? void 0 : init.body);
|
|
25419
|
-
if (!(0,_utils_type_utils__WEBPACK_IMPORTED_MODULE_0__.isNullish)(candidateBody)) {
|
|
25420
|
-
const requestBody = _tryReadFetchBody({
|
|
25421
|
-
body: candidateBody,
|
|
25422
|
-
url: urlStr,
|
|
25423
|
-
});
|
|
25424
|
-
if ((requestBody === null || requestBody === void 0 ? void 0 : requestBody.length) &&
|
|
25425
|
-
new Blob([requestBody]).size <= _configs__WEBPACK_IMPORTED_MODULE_2__.configs.maxCapturingHttpPayloadSize) {
|
|
25426
|
-
networkRequest.requestBody = requestBody;
|
|
25379
|
+
// Idempotency guard: avoid double-patching
|
|
25380
|
+
// @ts-ignore
|
|
25381
|
+
if (window.fetch.__mp_session_recorder_patched__) {
|
|
25382
|
+
// Already patched; do nothing
|
|
25383
|
+
}
|
|
25384
|
+
else {
|
|
25385
|
+
// @ts-ignore
|
|
25386
|
+
window.fetch.__mp_session_recorder_patched__ = true;
|
|
25387
|
+
// Store original fetch
|
|
25388
|
+
const originalFetch = window.fetch;
|
|
25389
|
+
// Override fetch
|
|
25390
|
+
window.fetch = async function (input,
|
|
25391
|
+
// eslint-disable-next-line
|
|
25392
|
+
init) {
|
|
25393
|
+
const networkRequest = {};
|
|
25394
|
+
// Capture request data
|
|
25395
|
+
const inputIsRequest = typeof Request !== 'undefined' && input instanceof Request;
|
|
25396
|
+
if (_configs__WEBPACK_IMPORTED_MODULE_2__.configs.recordRequestHeaders) {
|
|
25397
|
+
if (inputIsRequest) {
|
|
25398
|
+
networkRequest.requestHeaders = _headersToObject(input.headers);
|
|
25399
|
+
}
|
|
25400
|
+
else {
|
|
25401
|
+
networkRequest.requestHeaders = _headersInitToObject(init === null || init === void 0 ? void 0 : init.headers);
|
|
25427
25402
|
}
|
|
25428
|
-
}
|
|
25429
|
-
}
|
|
25430
|
-
try {
|
|
25431
|
-
// Make the actual fetch request
|
|
25432
|
-
const response = await originalFetch(input, init);
|
|
25433
|
-
// Capture response data
|
|
25434
|
-
if (_configs__WEBPACK_IMPORTED_MODULE_2__.configs.recordResponseHeaders) {
|
|
25435
|
-
networkRequest.responseHeaders = _headersToObject(response.headers);
|
|
25436
25403
|
}
|
|
25437
25404
|
if (_configs__WEBPACK_IMPORTED_MODULE_2__.configs.shouldRecordBody) {
|
|
25438
|
-
const
|
|
25439
|
-
|
|
25440
|
-
|
|
25441
|
-
|
|
25405
|
+
const urlStr = inputIsRequest
|
|
25406
|
+
? input.url
|
|
25407
|
+
: (typeof input === 'string' || input instanceof URL ? String(input) : '');
|
|
25408
|
+
// Only attempt to read the body from init (safe); avoid constructing/cloning Requests
|
|
25409
|
+
// If the caller passed a Request as input, we do not attempt to read its body here
|
|
25410
|
+
const candidateBody = init === null || init === void 0 ? void 0 : init.body;
|
|
25411
|
+
if (!(0,_utils_type_utils__WEBPACK_IMPORTED_MODULE_0__.isNullish)(candidateBody)) {
|
|
25412
|
+
const requestBody = _tryReadFetchBody({
|
|
25413
|
+
body: candidateBody,
|
|
25414
|
+
url: urlStr,
|
|
25415
|
+
});
|
|
25416
|
+
if ((requestBody === null || requestBody === void 0 ? void 0 : requestBody.length) &&
|
|
25417
|
+
new Blob([requestBody]).size <= _configs__WEBPACK_IMPORTED_MODULE_2__.configs.maxCapturingHttpPayloadSize) {
|
|
25418
|
+
networkRequest.requestBody = requestBody;
|
|
25419
|
+
}
|
|
25442
25420
|
}
|
|
25443
25421
|
}
|
|
25444
|
-
|
|
25445
|
-
|
|
25446
|
-
|
|
25447
|
-
|
|
25448
|
-
|
|
25449
|
-
|
|
25450
|
-
|
|
25451
|
-
|
|
25452
|
-
|
|
25453
|
-
|
|
25422
|
+
try {
|
|
25423
|
+
// Make the actual fetch request
|
|
25424
|
+
const response = await originalFetch(input, init);
|
|
25425
|
+
// Capture response data
|
|
25426
|
+
if (_configs__WEBPACK_IMPORTED_MODULE_2__.configs.recordResponseHeaders) {
|
|
25427
|
+
networkRequest.responseHeaders = _headersToObject(response.headers);
|
|
25428
|
+
}
|
|
25429
|
+
if (_configs__WEBPACK_IMPORTED_MODULE_2__.configs.shouldRecordBody) {
|
|
25430
|
+
const responseBody = await _tryReadResponseBody(response);
|
|
25431
|
+
if ((responseBody === null || responseBody === void 0 ? void 0 : responseBody.length) &&
|
|
25432
|
+
new Blob([responseBody]).size <= _configs__WEBPACK_IMPORTED_MODULE_2__.configs.maxCapturingHttpPayloadSize) {
|
|
25433
|
+
networkRequest.responseBody = responseBody;
|
|
25434
|
+
}
|
|
25435
|
+
}
|
|
25436
|
+
// Attach network request data to the response for later access
|
|
25454
25437
|
// @ts-ignore
|
|
25455
|
-
|
|
25438
|
+
response.networkRequest = networkRequest;
|
|
25439
|
+
return response;
|
|
25456
25440
|
}
|
|
25457
|
-
|
|
25458
|
-
|
|
25459
|
-
|
|
25460
|
-
|
|
25461
|
-
|
|
25462
|
-
|
|
25463
|
-
|
|
25441
|
+
catch (error) {
|
|
25442
|
+
// Even if the fetch fails, we can still capture the request data
|
|
25443
|
+
// Attach captured request data to the thrown error for downstream handling
|
|
25444
|
+
// @ts-ignore
|
|
25445
|
+
if (error && typeof error === 'object') {
|
|
25446
|
+
// @ts-ignore
|
|
25447
|
+
error.networkRequest = networkRequest;
|
|
25448
|
+
}
|
|
25449
|
+
throw error;
|
|
25450
|
+
}
|
|
25451
|
+
};
|
|
25452
|
+
// Preserve the original fetch function's properties
|
|
25453
|
+
Object.setPrototypeOf(window.fetch, originalFetch);
|
|
25454
|
+
Object.defineProperty(window.fetch, 'name', { value: 'fetch' });
|
|
25455
|
+
Object.defineProperty(window.fetch, 'length', { value: originalFetch.length });
|
|
25456
|
+
}
|
|
25464
25457
|
}
|
|
25465
25458
|
|
|
25466
25459
|
|
|
@@ -26561,41 +26554,75 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_14__.Obse
|
|
|
26561
26554
|
* Register session widget event listeners for controlling session actions
|
|
26562
26555
|
*/
|
|
26563
26556
|
_registerWidgetEvents() {
|
|
26564
|
-
this._sessionWidget.on('
|
|
26557
|
+
this._sessionWidget.on('start', () => {
|
|
26565
26558
|
this.error = '';
|
|
26566
|
-
|
|
26567
|
-
|
|
26568
|
-
|
|
26569
|
-
|
|
26570
|
-
|
|
26571
|
-
}
|
|
26559
|
+
this._handleStart();
|
|
26560
|
+
});
|
|
26561
|
+
this._sessionWidget.on('stop', (comment) => {
|
|
26562
|
+
this.error = '';
|
|
26563
|
+
this._handleStop(comment);
|
|
26572
26564
|
});
|
|
26573
26565
|
this._sessionWidget.on('pause', () => {
|
|
26574
26566
|
this.error = '';
|
|
26575
|
-
this.
|
|
26567
|
+
this._handlePause();
|
|
26576
26568
|
});
|
|
26577
26569
|
this._sessionWidget.on('resume', () => {
|
|
26578
26570
|
this.error = '';
|
|
26579
|
-
this.
|
|
26571
|
+
this._handleResume();
|
|
26580
26572
|
});
|
|
26581
26573
|
this._sessionWidget.on('cancel', () => {
|
|
26582
26574
|
this.error = '';
|
|
26583
|
-
this.
|
|
26575
|
+
this._handleCancel();
|
|
26584
26576
|
});
|
|
26585
26577
|
this._sessionWidget.on('continuous-debugging', (enabled) => {
|
|
26586
26578
|
this.error = '';
|
|
26587
26579
|
if (enabled) {
|
|
26588
|
-
this.
|
|
26580
|
+
this._handleContinuousDebugging();
|
|
26589
26581
|
}
|
|
26590
26582
|
else {
|
|
26591
|
-
this.
|
|
26583
|
+
this._handleStop();
|
|
26592
26584
|
}
|
|
26593
26585
|
});
|
|
26594
26586
|
this._sessionWidget.on('save', () => {
|
|
26595
26587
|
this.error = '';
|
|
26596
|
-
this.
|
|
26588
|
+
this._handleSave();
|
|
26597
26589
|
});
|
|
26598
26590
|
}
|
|
26591
|
+
_handleStart() {
|
|
26592
|
+
if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.stopped) {
|
|
26593
|
+
this.start(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_11__.SessionType.MANUAL);
|
|
26594
|
+
}
|
|
26595
|
+
}
|
|
26596
|
+
_handleStop(comment) {
|
|
26597
|
+
if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.started || this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.paused) {
|
|
26598
|
+
this.stop(comment);
|
|
26599
|
+
}
|
|
26600
|
+
}
|
|
26601
|
+
_handlePause() {
|
|
26602
|
+
if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.started) {
|
|
26603
|
+
this.pause();
|
|
26604
|
+
}
|
|
26605
|
+
}
|
|
26606
|
+
_handleResume() {
|
|
26607
|
+
if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.paused) {
|
|
26608
|
+
this.resume();
|
|
26609
|
+
}
|
|
26610
|
+
}
|
|
26611
|
+
_handleCancel() {
|
|
26612
|
+
if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.started || this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.paused) {
|
|
26613
|
+
this.cancel();
|
|
26614
|
+
}
|
|
26615
|
+
}
|
|
26616
|
+
_handleSave() {
|
|
26617
|
+
if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.started && this.continuousRecording) {
|
|
26618
|
+
this.save();
|
|
26619
|
+
}
|
|
26620
|
+
}
|
|
26621
|
+
_handleContinuousDebugging() {
|
|
26622
|
+
if (this.sessionState === _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.stopped) {
|
|
26623
|
+
this.start(_multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_11__.SessionType.CONTINUOUS);
|
|
26624
|
+
}
|
|
26625
|
+
}
|
|
26599
26626
|
/**
|
|
26600
26627
|
* Register session limit reaching listeners for controlling session end
|
|
26601
26628
|
*/
|
|
@@ -26652,6 +26679,7 @@ class SessionRecorder extends lib0_observable__WEBPACK_IMPORTED_MODULE_14__.Obse
|
|
|
26652
26679
|
}
|
|
26653
26680
|
catch (error) {
|
|
26654
26681
|
this.error = error.message;
|
|
26682
|
+
this.sessionState = _types__WEBPACK_IMPORTED_MODULE_3__.SessionState.stopped;
|
|
26655
26683
|
if (this.continuousRecording) {
|
|
26656
26684
|
this.sessionType = _multiplayer_app_session_recorder_common__WEBPACK_IMPORTED_MODULE_11__.SessionType.MANUAL;
|
|
26657
26685
|
}
|
|
@@ -27091,6 +27119,7 @@ class DragManager {
|
|
|
27091
27119
|
this.isDragging = false;
|
|
27092
27120
|
this.dragStarted = false;
|
|
27093
27121
|
this.isOnLeftHalfOfScreen = false;
|
|
27122
|
+
this.isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined';
|
|
27094
27123
|
this.recorderButton = recorderButton;
|
|
27095
27124
|
this.recorderPlacement = recorderPlacement;
|
|
27096
27125
|
this.onDragEnd = onDragEnd;
|
|
@@ -27098,10 +27127,14 @@ class DragManager {
|
|
|
27098
27127
|
this.onRecordingButtonClick = onRecordingButtonClick;
|
|
27099
27128
|
}
|
|
27100
27129
|
init() {
|
|
27130
|
+
if (!this.isBrowser)
|
|
27131
|
+
return;
|
|
27101
27132
|
this.loadStoredPosition();
|
|
27102
27133
|
this.setupDragListeners();
|
|
27103
27134
|
}
|
|
27104
27135
|
loadStoredPosition() {
|
|
27136
|
+
if (!this.isBrowser || typeof window === 'undefined' || typeof localStorage === 'undefined')
|
|
27137
|
+
return;
|
|
27105
27138
|
const savedPosition = localStorage.getItem(_constants__WEBPACK_IMPORTED_MODULE_0__.POSITION_STATE_KEY);
|
|
27106
27139
|
if (!savedPosition) {
|
|
27107
27140
|
return;
|
|
@@ -27132,11 +27165,15 @@ class DragManager {
|
|
|
27132
27165
|
});
|
|
27133
27166
|
}
|
|
27134
27167
|
savePosition(r, b) {
|
|
27168
|
+
if (!this.isBrowser || typeof window === 'undefined' || typeof localStorage === 'undefined')
|
|
27169
|
+
return;
|
|
27135
27170
|
const right = (r / window.innerWidth) * 100;
|
|
27136
27171
|
const bottom = (b / window.innerHeight) * 100;
|
|
27137
27172
|
localStorage.setItem(_constants__WEBPACK_IMPORTED_MODULE_0__.POSITION_STATE_KEY, JSON.stringify({ right, bottom }));
|
|
27138
27173
|
}
|
|
27139
27174
|
setupDragListeners() {
|
|
27175
|
+
if (!this.isBrowser || typeof document === 'undefined' || typeof window === 'undefined')
|
|
27176
|
+
return;
|
|
27140
27177
|
this.recorderButton.addEventListener('mousedown', (e) => {
|
|
27141
27178
|
const onMouseUp = () => {
|
|
27142
27179
|
const isDraggable = !this.recorderButton.classList.contains('no-draggable');
|
|
@@ -27245,6 +27282,7 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
|
|
|
27245
27282
|
else {
|
|
27246
27283
|
(_b = this.buttonDraggabilityObserver) === null || _b === void 0 ? void 0 : _b.disconnect();
|
|
27247
27284
|
}
|
|
27285
|
+
this.uiManager.setPopoverLoadingState(newState === _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.LOADING);
|
|
27248
27286
|
this.updateButton(icon, tooltip, excludeClasses, classes);
|
|
27249
27287
|
}
|
|
27250
27288
|
set initialPopoverVisible(v) {
|
|
@@ -27299,7 +27337,6 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
|
|
|
27299
27337
|
else {
|
|
27300
27338
|
this.buttonState = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.CONTINUOUS_DEBUGGING;
|
|
27301
27339
|
}
|
|
27302
|
-
this.uiManager.setPopoverLoadingState(false);
|
|
27303
27340
|
}
|
|
27304
27341
|
else {
|
|
27305
27342
|
this.buttonState = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.IDLE;
|
|
@@ -27635,7 +27672,6 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
|
|
|
27635
27672
|
return;
|
|
27636
27673
|
if (this._buttonState === _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.LOADING) {
|
|
27637
27674
|
this.onCancel();
|
|
27638
|
-
this.uiManager.setPopoverLoadingState(false);
|
|
27639
27675
|
}
|
|
27640
27676
|
this.initialPopoverVisible = false;
|
|
27641
27677
|
this.buttonState = this._continuousRecording
|
|
@@ -27744,13 +27780,12 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
|
|
|
27744
27780
|
}
|
|
27745
27781
|
startRecording() {
|
|
27746
27782
|
this.buttonState = _buttonStateConfigs__WEBPACK_IMPORTED_MODULE_6__.ButtonState.LOADING;
|
|
27747
|
-
this.uiManager.setPopoverLoadingState(true);
|
|
27748
27783
|
this.onStart();
|
|
27749
27784
|
}
|
|
27750
27785
|
onStart() {
|
|
27751
27786
|
if (!this.recorderButton)
|
|
27752
27787
|
return;
|
|
27753
|
-
this.emit('
|
|
27788
|
+
this.emit('start', []);
|
|
27754
27789
|
}
|
|
27755
27790
|
onStop() {
|
|
27756
27791
|
if (!this.isBrowser)
|
|
@@ -27762,11 +27797,11 @@ class SessionWidget extends lib0_observable__WEBPACK_IMPORTED_MODULE_7__.Observa
|
|
|
27762
27797
|
? this.commentTextarea
|
|
27763
27798
|
: this.submitSessionDialog.querySelector('#mp-recording-comment');
|
|
27764
27799
|
if (commentElement) {
|
|
27765
|
-
this.emit('
|
|
27800
|
+
this.emit('stop', [commentElement.value]);
|
|
27766
27801
|
commentElement.value = '';
|
|
27767
27802
|
return;
|
|
27768
27803
|
}
|
|
27769
|
-
this.emit('
|
|
27804
|
+
this.emit('stop', []);
|
|
27770
27805
|
}
|
|
27771
27806
|
onPause() {
|
|
27772
27807
|
this.emit('pause', []);
|