@sentry/replay 7.88.0 → 7.89.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/esm/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { getCurrentHub, getClient, isSentryRequestUrl, addEventProcessor, prepareEvent, setContext, captureException } from '@sentry/core';
1
+ import { addBreadcrumb, getClient, isSentryRequestUrl, getCurrentScope, addEventProcessor, prepareEvent, setContext, captureException } from '@sentry/core';
2
2
  import { GLOBAL_OBJ, normalize, fill, htmlTreeAsString, browserPerformanceTimeOrigin, logger, uuid4, SENTRY_XHR_DATA_KEY, dropUndefinedKeys, stringMatchesSomePattern, addFetchInstrumentationHandler, addXhrInstrumentationHandler, addClickKeypressInstrumentationHandler, addHistoryInstrumentationHandler, createEnvelope, createEventEnvelopeHeaders, getSdkMetadataForEnvelopeHeader, updateRateLimits, isRateLimited, consoleSandbox, isBrowser } from '@sentry/utils';
3
3
  import { addPerformanceInstrumentationHandler, addLcpInstrumentationHandler } from '@sentry-internal/tracing';
4
4
 
@@ -4737,7 +4737,7 @@ function logInfo(message, shouldAddBreadcrumb) {
4737
4737
  logger.info(message);
4738
4738
 
4739
4739
  if (shouldAddBreadcrumb) {
4740
- addBreadcrumb(message);
4740
+ addLogBreadcrumb(message);
4741
4741
  }
4742
4742
  }
4743
4743
 
@@ -4756,14 +4756,13 @@ function logInfoNextTick(message, shouldAddBreadcrumb) {
4756
4756
  // Wait a tick here to avoid race conditions for some initial logs
4757
4757
  // which may be added before replay is initialized
4758
4758
  setTimeout(() => {
4759
- addBreadcrumb(message);
4759
+ addLogBreadcrumb(message);
4760
4760
  }, 0);
4761
4761
  }
4762
4762
  }
4763
4763
 
4764
- function addBreadcrumb(message) {
4765
- const hub = getCurrentHub();
4766
- hub.addBreadcrumb(
4764
+ function addLogBreadcrumb(message) {
4765
+ addBreadcrumb(
4767
4766
  {
4768
4767
  category: 'console',
4769
4768
  data: {
@@ -5943,7 +5942,7 @@ function shouldFilterRequest(replay, url) {
5943
5942
  return false;
5944
5943
  }
5945
5944
 
5946
- return isSentryRequestUrl(url, getCurrentHub());
5945
+ return isSentryRequestUrl(url, getClient());
5947
5946
  }
5948
5947
 
5949
5948
  /** Add a performance entry breadcrumb */
@@ -7021,7 +7020,7 @@ function normalizeConsoleBreadcrumb(
7021
7020
  */
7022
7021
  function addGlobalListeners(replay) {
7023
7022
  // Listeners from core SDK //
7024
- const scope = getCurrentHub().getScope();
7023
+ const scope = getCurrentScope();
7025
7024
  const client = getClient();
7026
7025
 
7027
7026
  scope.addScopeListener(handleScopeListener(replay));
@@ -7454,9 +7453,8 @@ async function sendReplayRequest({
7454
7453
 
7455
7454
  const { urls, errorIds, traceIds, initialTimestamp } = eventContext;
7456
7455
 
7457
- const hub = getCurrentHub();
7458
- const client = hub.getClient();
7459
- const scope = hub.getScope();
7456
+ const client = getClient();
7457
+ const scope = getCurrentScope();
7460
7458
  const transport = client && client.getTransport();
7461
7459
  const dsn = client && client.getDsn();
7462
7460
 
@@ -7960,7 +7958,10 @@ class ReplayContainer {
7960
7958
  ...(canvas && {
7961
7959
  recordCanvas: true,
7962
7960
  sampling: { canvas: canvas.fps || 4 },
7963
- dataURLOptions: { quality: canvas.quality || 0.6 },
7961
+ dataURLOptions: {
7962
+ type: canvas.type || 'image/webp',
7963
+ quality: canvas.quality || 0.6,
7964
+ },
7964
7965
  getCanvasManager: canvas.manager,
7965
7966
  }),
7966
7967
  });
@@ -8315,7 +8316,7 @@ class ReplayContainer {
8315
8316
  * This is only available if performance is enabled, and if an instrumented router is used.
8316
8317
  */
8317
8318
  getCurrentRoute() {
8318
- const lastTransaction = this.lastTransaction || getCurrentHub().getScope().getTransaction();
8319
+ const lastTransaction = this.lastTransaction || getCurrentScope().getTransaction();
8319
8320
  if (!lastTransaction || !['route', 'custom'].includes(lastTransaction.metadata.source)) {
8320
8321
  return undefined;
8321
8322
  }