@sentry/replay 11.16.0 → 11.18.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.
@@ -1,8 +1,8 @@
1
- import { GLOBAL_OBJ, _INTERNAL_performanceTimeToSeconds, addBreadcrumb, addEventProcessor, captureException, consoleSandbox, createEnvelope, createEventEnvelopeHeaders, debounce as debounce$1, debug as debug$1, fill, getActiveSpan, getClient, getCurrentScope, getDynamicSamplingContextFromSpan, getIsolationScope, getRootSpan, getSdkMetadataForEnvelopeHeader, isBrowser, isObjectLike, isRateLimited, isSentryRequestUrl, normalize, parseSampleRate, prepareEvent, safeSetSpanJSONAttributes, setContext, severityLevelFromString, spanToJSON, stringMatchesSomePattern, updateRateLimits, uuid4 } from "@sentry/core";
1
+ import { GLOBAL_OBJ, _INTERNAL_performanceTimeToSeconds, addBreadcrumb, addEventProcessor, captureException, consoleSandbox, createEnvelope, createEventEnvelopeHeaders, debounce as debounce$1, debug as debug$1, defineIntegration, fill, getActiveSpan, getClient, getCurrentScope, getDynamicSamplingContextFromSpan, getIsolationScope, getRootSpan, getSdkMetadataForEnvelopeHeader, isBrowser, isObjectLike, isRateLimited, isSentryRequestUrl, normalize, parseSampleRate, prepareEvent, safeSetSpanJSONAttributes, setContext, severityLevelFromString, spanToJSON, stringMatchesSomePattern, updateRateLimits, uuid4 } from "@sentry/core";
2
2
  import { SENTRY_XHR_DATA_KEY, addClickKeypressInstrumentationHandler, addClsInstrumentationHandler, addHistoryInstrumentationHandler, addInpInstrumentationHandler, addLcpInstrumentationHandler, addPerformanceInstrumentationHandler, getBodyString, getFetchRequestArgBody, getLocationHref, htmlTreeAsString, parseXhrResponseHeaders, serializeFormData, setTimeout as setTimeout$3 } from "@sentry/browser-utils";
3
- // ../../node_modules/.pnpm/@sentry+conventions@0.34.0/node_modules/@sentry/conventions/dist/attributes.mjs
4
- const Ab = "sentry.replay_id";
5
- const Mb = "sentry.segment.name.source";
3
+ // ../../node_modules/.pnpm/@sentry+conventions@0.36.0/node_modules/@sentry/conventions/dist/attributes.mjs
4
+ const Xb = "sentry.replay_id";
5
+ const pg = "sentry.segment.name.source";
6
6
  // src/constants.ts
7
7
  const WINDOW = GLOBAL_OBJ;
8
8
  const REPLAY_SESSION_KEY = "sentryReplaySession";
@@ -25,7 +25,7 @@ const MIN_REPLAY_DURATION = 4999;
25
25
  const MIN_REPLAY_DURATION_LIMIT = 5e4;
26
26
  /** The max. length of a replay. */
27
27
  const MAX_REPLAY_DURATION = 36e5;
28
- // ../../node_modules/.pnpm/@sentry+rrweb@2.46.0/node_modules/@sentry/rrweb/dist/canvas-manager-BUXy0PTw.js
28
+ // ../../node_modules/.pnpm/@sentry+rrweb@2.47.0/node_modules/@sentry/rrweb/dist/canvas-manager-Cdmr3z03.js
29
29
  var __defProp = Object.defineProperty;
30
30
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
31
31
  enumerable: true,
@@ -628,6 +628,7 @@ function serializeTextNode(n, options) {
628
628
  rootId
629
629
  };
630
630
  }
631
+ const warnedTaintedCanvases = /* @__PURE__ */ new WeakSet();
631
632
  function serializeElementNode(n, options) {
632
633
  const { doc, blockClass, blockSelector, unblockSelector, inlineStylesheet, maskInputOptions = {}, maskAttributeFn, maskInputFn, dataURLOptions = {}, inlineImages, recordCanvas, keepIframeSrcFn, newlyAddedElement = false, rootId, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector, ignoreCSSAttributes } = options;
633
634
  const needBlock = _isBlockedElement(n, blockClass, blockSelector, unblockSelector);
@@ -679,7 +680,7 @@ function serializeElementNode(n, options) {
679
680
  if (n.selected && !maskInputOptions["select"]) attributes.selected = true;
680
681
  else delete attributes.selected;
681
682
  }
682
- if (tagName === "canvas" && recordCanvas) {
683
+ if (tagName === "canvas" && recordCanvas) try {
683
684
  if (n.__context === "2d") {
684
685
  if (!is2DCanvasBlank(n)) attributes.rr_dataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);
685
686
  } else if (!("__context" in n)) {
@@ -689,6 +690,11 @@ function serializeElementNode(n, options) {
689
690
  blankCanvas.height = n.height;
690
691
  if (canvasDataURL !== blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality)) attributes.rr_dataURL = canvasDataURL;
691
692
  }
693
+ } catch (err) {
694
+ if (!warnedTaintedCanvases.has(n)) {
695
+ warnedTaintedCanvases.add(n);
696
+ console.warn(`Cannot record canvas pixels! Error: ${err}`);
697
+ }
692
698
  }
693
699
  if (tagName === "img" && inlineImages) {
694
700
  if (!canvasService) {
@@ -1370,7 +1376,7 @@ var CanvasManagerNoop = class {
1370
1376
  addShadowRoot() {}
1371
1377
  resetShadowRoots() {}
1372
1378
  };
1373
- // ../../node_modules/.pnpm/@sentry+rrweb@2.46.0/node_modules/@sentry/rrweb/dist/rrweb.js
1379
+ // ../../node_modules/.pnpm/@sentry+rrweb@2.47.0/node_modules/@sentry/rrweb/dist/rrweb.js
1374
1380
  function getIFrameContentDocument(iframe) {
1375
1381
  try {
1376
1382
  return iframe.contentDocument;
@@ -3539,8 +3545,14 @@ var ClickDetector = class {
3539
3545
  const cleanupWindowOpen = onWindowOpen(() => {
3540
3546
  this._lastMutation = nowInSeconds();
3541
3547
  });
3548
+ const onPageHide = () => {
3549
+ this._clicks = [];
3550
+ if (this._checkClickTimeout) clearTimeout(this._checkClickTimeout);
3551
+ };
3552
+ WINDOW.addEventListener("pagehide", onPageHide);
3542
3553
  this._teardown = () => {
3543
3554
  cleanupWindowOpen();
3555
+ WINDOW.removeEventListener("pagehide", onPageHide);
3544
3556
  this._clicks = [];
3545
3557
  this._lastMutation = 0;
3546
3558
  this._lastScroll = 0;
@@ -3705,7 +3717,7 @@ function createBreadcrumb(breadcrumb) {
3705
3717
  ...breadcrumb
3706
3718
  };
3707
3719
  }
3708
- // ../../node_modules/.pnpm/@sentry+rrweb-snapshot@2.46.0/node_modules/@sentry/rrweb-snapshot/dist/rrweb-snapshot.js
3720
+ // ../../node_modules/.pnpm/@sentry+rrweb-snapshot@2.47.0/node_modules/@sentry/rrweb-snapshot/dist/rrweb-snapshot.js
3709
3721
  var NodeType = /* @__PURE__ */ ((NodeType2) => {
3710
3722
  NodeType2[NodeType2["Document"] = 0] = "Document";
3711
3723
  NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
@@ -6243,7 +6255,7 @@ var ReplayContainer = class {
6243
6255
  const lastRootSpan = lastActiveSpan && getRootSpan(lastActiveSpan);
6244
6256
  if (!lastRootSpan) return;
6245
6257
  const spanJson = spanToJSON(lastRootSpan);
6246
- const source = spanJson.attributes[Mb];
6258
+ const source = spanJson.attributes[pg];
6247
6259
  if (!source || !["route", "custom"].includes(source)) return;
6248
6260
  return spanJson.name;
6249
6261
  }
@@ -6633,6 +6645,9 @@ function _INTERNAL_instrumentRequestInterface() {
6633
6645
  _isRequestInstrumented = true;
6634
6646
  } catch {}
6635
6647
  }
6648
+ const _replayIntegration = ((options) => {
6649
+ return new Replay(options);
6650
+ });
6636
6651
  /**
6637
6652
  * Sentry integration for [Session Replay](https://sentry.io/for/session-replay/).
6638
6653
  *
@@ -6647,9 +6662,7 @@ function _INTERNAL_instrumentRequestInterface() {
6647
6662
  * });
6648
6663
  * ```
6649
6664
  */
6650
- const replayIntegration = ((options) => {
6651
- return new Replay(options);
6652
- });
6665
+ const replayIntegration = defineIntegration(_replayIntegration);
6653
6666
  /**
6654
6667
  * Replay integration
6655
6668
  */
@@ -6823,7 +6836,7 @@ var Replay = class {
6823
6836
  processSpan(span) {
6824
6837
  const replayId = this.getReplayId(true);
6825
6838
  if (replayId) {
6826
- safeSetSpanJSONAttributes(span, { [Ab]: replayId });
6839
+ safeSetSpanJSONAttributes(span, { [Xb]: replayId });
6827
6840
  if (this.getRecordingMode() === "buffer") safeSetSpanJSONAttributes(span, { "sentry._internal.replay_is_buffering": true });
6828
6841
  }
6829
6842
  }