@sentry/replay 7.80.2-alpha.0 → 7.81.0

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/cjs/index.js CHANGED
@@ -4412,7 +4412,7 @@ function getDomTarget(handlerData) {
4412
4412
  // Accessing event.target can throw (see getsentry/raven-js#838, #768)
4413
4413
  try {
4414
4414
  target = isClick ? getClickTargetNode(handlerData.event) : getTargetNode(handlerData.event);
4415
- message = utils.getElementIdentifier(target, { maxStringLength: 200 }) || '<unknown>';
4415
+ message = utils.htmlTreeAsString(target, { maxStringLength: 200 }) || '<unknown>';
4416
4416
  } catch (e) {
4417
4417
  message = '<unknown>';
4418
4418
  }
@@ -4463,7 +4463,7 @@ function getKeyboardBreadcrumb(event) {
4463
4463
  return null;
4464
4464
  }
4465
4465
 
4466
- const message = utils.getElementIdentifier(target, { maxStringLength: 200 }) || '<unknown>';
4466
+ const message = utils.htmlTreeAsString(target, { maxStringLength: 200 }) || '<unknown>';
4467
4467
  const baseBreadcrumb = getBaseDomBreadcrumb(target , message);
4468
4468
 
4469
4469
  return createBreadcrumb({
@@ -5739,6 +5739,8 @@ function handleGlobalEventListener(
5739
5739
  }
5740
5740
 
5741
5741
  if (isFeedbackEvent(event)) {
5742
+ void replay.flush();
5743
+ event.contexts.feedback.replay_id = replay.getSessionId();
5742
5744
  // Add a replay breadcrumb for this piece of feedback
5743
5745
  addFeedbackBreadcrumb(replay, event);
5744
5746
  return event;
@@ -6036,6 +6038,8 @@ function getBodyString(body) {
6036
6038
  (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && utils.logger.warn('[Replay] Failed to serialize body', body);
6037
6039
  }
6038
6040
 
6041
+ (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && utils.logger.info('[Replay] Skipping network body because of body type', body);
6042
+
6039
6043
  return undefined;
6040
6044
  }
6041
6045
 
@@ -6555,15 +6559,24 @@ function getResponseHeaders(xhr) {
6555
6559
  }
6556
6560
 
6557
6561
  function _getXhrResponseBody(xhr) {
6562
+ // We collect errors that happen, but only log them if we can't get any response body
6563
+ const errors = [];
6564
+
6558
6565
  try {
6559
6566
  return xhr.responseText;
6560
- } catch (e) {} // eslint-disable-line no-empty
6567
+ } catch (e) {
6568
+ errors.push(e);
6569
+ }
6561
6570
 
6562
6571
  // Try to manually parse the response body, if responseText fails
6563
6572
  try {
6564
6573
  const response = xhr.response;
6565
6574
  return getBodyString(response);
6566
- } catch (e2) {} // eslint-disable-line no-empty
6575
+ } catch (e) {
6576
+ errors.push(e);
6577
+ }
6578
+
6579
+ (typeof __SENTRY_DEBUG__ === 'undefined' || __SENTRY_DEBUG__) && utils.logger.warn('[Replay] Failed to get xhr response body', ...errors);
6567
6580
 
6568
6581
  return undefined;
6569
6582
  }