@sentry/replay 11.15.0 → 11.17.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.33.0/node_modules/@sentry/conventions/dist/attributes.mjs
4
- const Ob = "sentry.replay_id";
5
- const qb = "sentry.segment.name.source";
3
+ // ../../node_modules/.pnpm/@sentry+conventions@0.35.0/node_modules/@sentry/conventions/dist/attributes.mjs
4
+ const Qb = "sentry.replay_id";
5
+ const og = "sentry.segment.name.source";
6
6
  // src/constants.ts
7
7
  const WINDOW = GLOBAL_OBJ;
8
8
  const REPLAY_SESSION_KEY = "sentryReplaySession";
@@ -3539,8 +3539,14 @@ var ClickDetector = class {
3539
3539
  const cleanupWindowOpen = onWindowOpen(() => {
3540
3540
  this._lastMutation = nowInSeconds();
3541
3541
  });
3542
+ const onPageHide = () => {
3543
+ this._clicks = [];
3544
+ if (this._checkClickTimeout) clearTimeout(this._checkClickTimeout);
3545
+ };
3546
+ WINDOW.addEventListener("pagehide", onPageHide);
3542
3547
  this._teardown = () => {
3543
3548
  cleanupWindowOpen();
3549
+ WINDOW.removeEventListener("pagehide", onPageHide);
3544
3550
  this._clicks = [];
3545
3551
  this._lastMutation = 0;
3546
3552
  this._lastScroll = 0;
@@ -6243,7 +6249,7 @@ var ReplayContainer = class {
6243
6249
  const lastRootSpan = lastActiveSpan && getRootSpan(lastActiveSpan);
6244
6250
  if (!lastRootSpan) return;
6245
6251
  const spanJson = spanToJSON(lastRootSpan);
6246
- const source = spanJson.attributes[qb];
6252
+ const source = spanJson.attributes[og];
6247
6253
  if (!source || !["route", "custom"].includes(source)) return;
6248
6254
  return spanJson.name;
6249
6255
  }
@@ -6633,6 +6639,9 @@ function _INTERNAL_instrumentRequestInterface() {
6633
6639
  _isRequestInstrumented = true;
6634
6640
  } catch {}
6635
6641
  }
6642
+ const _replayIntegration = ((options) => {
6643
+ return new Replay(options);
6644
+ });
6636
6645
  /**
6637
6646
  * Sentry integration for [Session Replay](https://sentry.io/for/session-replay/).
6638
6647
  *
@@ -6647,9 +6656,7 @@ function _INTERNAL_instrumentRequestInterface() {
6647
6656
  * });
6648
6657
  * ```
6649
6658
  */
6650
- const replayIntegration = ((options) => {
6651
- return new Replay(options);
6652
- });
6659
+ const replayIntegration = defineIntegration(_replayIntegration);
6653
6660
  /**
6654
6661
  * Replay integration
6655
6662
  */
@@ -6823,7 +6830,7 @@ var Replay = class {
6823
6830
  processSpan(span) {
6824
6831
  const replayId = this.getReplayId(true);
6825
6832
  if (replayId) {
6826
- safeSetSpanJSONAttributes(span, { [Ob]: replayId });
6833
+ safeSetSpanJSONAttributes(span, { [Qb]: replayId });
6827
6834
  if (this.getRecordingMode() === "buffer") safeSetSpanJSONAttributes(span, { "sentry._internal.replay_is_buffering": true });
6828
6835
  }
6829
6836
  }