@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,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  let _sentry_core = require("@sentry/core");
3
3
  let _sentry_browser_utils = require("@sentry/browser-utils");
4
- // ../../node_modules/.pnpm/@sentry+conventions@0.34.0/node_modules/@sentry/conventions/dist/attributes.mjs
5
- const Ab = "sentry.replay_id";
6
- const Mb = "sentry.segment.name.source";
4
+ // ../../node_modules/.pnpm/@sentry+conventions@0.36.0/node_modules/@sentry/conventions/dist/attributes.mjs
5
+ const Xb = "sentry.replay_id";
6
+ const pg = "sentry.segment.name.source";
7
7
  // src/constants.ts
8
8
  const WINDOW = _sentry_core.GLOBAL_OBJ;
9
9
  const REPLAY_SESSION_KEY = "sentryReplaySession";
@@ -26,7 +26,7 @@ const MIN_REPLAY_DURATION = 4999;
26
26
  const MIN_REPLAY_DURATION_LIMIT = 5e4;
27
27
  /** The max. length of a replay. */
28
28
  const MAX_REPLAY_DURATION = 36e5;
29
- // ../../node_modules/.pnpm/@sentry+rrweb@2.46.0/node_modules/@sentry/rrweb/dist/canvas-manager-BUXy0PTw.js
29
+ // ../../node_modules/.pnpm/@sentry+rrweb@2.47.0/node_modules/@sentry/rrweb/dist/canvas-manager-Cdmr3z03.js
30
30
  var __defProp = Object.defineProperty;
31
31
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, {
32
32
  enumerable: true,
@@ -629,6 +629,7 @@ function serializeTextNode(n, options) {
629
629
  rootId
630
630
  };
631
631
  }
632
+ const warnedTaintedCanvases = /* @__PURE__ */ new WeakSet();
632
633
  function serializeElementNode(n, options) {
633
634
  const { doc, blockClass, blockSelector, unblockSelector, inlineStylesheet, maskInputOptions = {}, maskAttributeFn, maskInputFn, dataURLOptions = {}, inlineImages, recordCanvas, keepIframeSrcFn, newlyAddedElement = false, rootId, maskTextClass, unmaskTextClass, maskTextSelector, unmaskTextSelector, ignoreCSSAttributes } = options;
634
635
  const needBlock = _isBlockedElement(n, blockClass, blockSelector, unblockSelector);
@@ -680,7 +681,7 @@ function serializeElementNode(n, options) {
680
681
  if (n.selected && !maskInputOptions["select"]) attributes.selected = true;
681
682
  else delete attributes.selected;
682
683
  }
683
- if (tagName === "canvas" && recordCanvas) {
684
+ if (tagName === "canvas" && recordCanvas) try {
684
685
  if (n.__context === "2d") {
685
686
  if (!is2DCanvasBlank(n)) attributes.rr_dataURL = n.toDataURL(dataURLOptions.type, dataURLOptions.quality);
686
687
  } else if (!("__context" in n)) {
@@ -690,6 +691,11 @@ function serializeElementNode(n, options) {
690
691
  blankCanvas.height = n.height;
691
692
  if (canvasDataURL !== blankCanvas.toDataURL(dataURLOptions.type, dataURLOptions.quality)) attributes.rr_dataURL = canvasDataURL;
692
693
  }
694
+ } catch (err) {
695
+ if (!warnedTaintedCanvases.has(n)) {
696
+ warnedTaintedCanvases.add(n);
697
+ console.warn(`Cannot record canvas pixels! Error: ${err}`);
698
+ }
693
699
  }
694
700
  if (tagName === "img" && inlineImages) {
695
701
  if (!canvasService) {
@@ -1371,7 +1377,7 @@ var CanvasManagerNoop = class {
1371
1377
  addShadowRoot() {}
1372
1378
  resetShadowRoots() {}
1373
1379
  };
1374
- // ../../node_modules/.pnpm/@sentry+rrweb@2.46.0/node_modules/@sentry/rrweb/dist/rrweb.js
1380
+ // ../../node_modules/.pnpm/@sentry+rrweb@2.47.0/node_modules/@sentry/rrweb/dist/rrweb.js
1375
1381
  function getIFrameContentDocument(iframe) {
1376
1382
  try {
1377
1383
  return iframe.contentDocument;
@@ -3540,8 +3546,14 @@ var ClickDetector = class {
3540
3546
  const cleanupWindowOpen = onWindowOpen(() => {
3541
3547
  this._lastMutation = nowInSeconds();
3542
3548
  });
3549
+ const onPageHide = () => {
3550
+ this._clicks = [];
3551
+ if (this._checkClickTimeout) clearTimeout(this._checkClickTimeout);
3552
+ };
3553
+ WINDOW.addEventListener("pagehide", onPageHide);
3543
3554
  this._teardown = () => {
3544
3555
  cleanupWindowOpen();
3556
+ WINDOW.removeEventListener("pagehide", onPageHide);
3545
3557
  this._clicks = [];
3546
3558
  this._lastMutation = 0;
3547
3559
  this._lastScroll = 0;
@@ -3706,7 +3718,7 @@ function createBreadcrumb(breadcrumb) {
3706
3718
  ...breadcrumb
3707
3719
  };
3708
3720
  }
3709
- // ../../node_modules/.pnpm/@sentry+rrweb-snapshot@2.46.0/node_modules/@sentry/rrweb-snapshot/dist/rrweb-snapshot.js
3721
+ // ../../node_modules/.pnpm/@sentry+rrweb-snapshot@2.47.0/node_modules/@sentry/rrweb-snapshot/dist/rrweb-snapshot.js
3710
3722
  var NodeType = /* @__PURE__ */ ((NodeType2) => {
3711
3723
  NodeType2[NodeType2["Document"] = 0] = "Document";
3712
3724
  NodeType2[NodeType2["DocumentType"] = 1] = "DocumentType";
@@ -6244,7 +6256,7 @@ var ReplayContainer = class {
6244
6256
  const lastRootSpan = lastActiveSpan && (0, _sentry_core.getRootSpan)(lastActiveSpan);
6245
6257
  if (!lastRootSpan) return;
6246
6258
  const spanJson = (0, _sentry_core.spanToJSON)(lastRootSpan);
6247
- const source = spanJson.attributes[Mb];
6259
+ const source = spanJson.attributes[pg];
6248
6260
  if (!source || !["route", "custom"].includes(source)) return;
6249
6261
  return spanJson.name;
6250
6262
  }
@@ -6634,6 +6646,9 @@ function _INTERNAL_instrumentRequestInterface() {
6634
6646
  _isRequestInstrumented = true;
6635
6647
  } catch {}
6636
6648
  }
6649
+ const _replayIntegration = ((options) => {
6650
+ return new Replay(options);
6651
+ });
6637
6652
  /**
6638
6653
  * Sentry integration for [Session Replay](https://sentry.io/for/session-replay/).
6639
6654
  *
@@ -6648,9 +6663,7 @@ function _INTERNAL_instrumentRequestInterface() {
6648
6663
  * });
6649
6664
  * ```
6650
6665
  */
6651
- const replayIntegration = ((options) => {
6652
- return new Replay(options);
6653
- });
6666
+ const replayIntegration = (0, _sentry_core.defineIntegration)(_replayIntegration);
6654
6667
  /**
6655
6668
  * Replay integration
6656
6669
  */
@@ -6824,7 +6837,7 @@ var Replay = class {
6824
6837
  processSpan(span) {
6825
6838
  const replayId = this.getReplayId(true);
6826
6839
  if (replayId) {
6827
- (0, _sentry_core.safeSetSpanJSONAttributes)(span, { [Ab]: replayId });
6840
+ (0, _sentry_core.safeSetSpanJSONAttributes)(span, { [Xb]: replayId });
6828
6841
  if (this.getRecordingMode() === "buffer") (0, _sentry_core.safeSetSpanJSONAttributes)(span, { "sentry._internal.replay_is_buffering": true });
6829
6842
  }
6830
6843
  }