From 9ae5790bab860abe708ff1c26204eb57a82fc9d6 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Mon, 26 Feb 2024 12:38:25 -0500 Subject: [PATCH 01/10] feat(v8): Remove deprecated Replay, Feedback, ReplayCanvas exports --- .size-limit.js | 8 +- CHANGELOG.md | 4 +- .../suites/feedback/captureFeedback/init.js | 3 +- .../hasSampling/init.js | 5 +- .../suites/replay/bufferMode/init.js | 2 +- .../suites/replay/bufferModeReload/init.js | 2 +- .../replay/canvas/manualSnapshot/init.js | 4 +- .../suites/replay/canvas/records/init.js | 4 +- .../canvas/withCanvasIntegrationFirst/init.js | 4 +- .../withCanvasIntegrationSecond/init.js | 4 +- .../canvas/withoutCanvasIntegration/init.js | 2 +- .../replay/captureComponentName/init.js | 2 +- .../captureReplayFromReplayPackage/init.js | 4 +- .../suites/replay/compressionDisabled/init.js | 2 +- .../suites/replay/compressionEnabled/init.js | 2 +- .../replay/compressionWorkerUrl/init.js | 2 +- .../suites/replay/customEvents/init.js | 2 +- .../suites/replay/dsc/init.js | 2 +- .../suites/replay/dsc/test.ts | 3 +- .../replay/errors/beforeErrorSampling/init.js | 2 +- .../suites/replay/errors/droppedError/init.js | 2 +- .../errors/errorModeCustomTransport/init.js | 23 +++++ .../suites/replay/errors/errorNotSent/init.js | 2 +- .../replay/errors/errorsInSession/init.js | 2 +- .../suites/replay/errors/init.js | 2 +- .../fetch/captureRequestBody/init.js | 2 +- .../fetch/captureRequestHeaders/init.js | 2 +- .../fetch/captureResponseBody/init.js | 2 +- .../fetch/captureResponseHeaders/init.js | 2 +- .../fetch/captureTimestamps/init.js | 2 +- .../extendNetworkBreadcrumbs/fetch/init.js | 2 +- .../xhr/captureRequestBody/init.js | 2 +- .../xhr/captureRequestHeaders/init.js | 2 +- .../xhr/captureResponseBody/init.js | 2 +- .../xhr/captureResponseHeaders/init.js | 2 +- .../xhr/captureTimestamps/init.js | 2 +- .../extendNetworkBreadcrumbs/xhr/init.js | 2 +- .../suites/replay/fileInput/init.js | 2 +- .../suites/replay/flushing/init.js | 2 +- .../suites/replay/init.js | 2 +- .../suites/replay/keyboardEvents/init.js | 2 +- .../largeMutations/defaultOptions/init.js | 2 +- .../largeMutations/mutationLimit/init.js | 2 +- .../suites/replay/maxReplayDuration/init.js | 2 +- .../suites/replay/minReplayDuration/init.js | 2 +- .../suites/replay/multiple-pages/init.js | 2 +- .../suites/replay/privacyBlock/init.js | 2 +- .../suites/replay/privacyDefault/init.js | 2 +- .../suites/replay/privacyInput/init.js | 2 +- .../suites/replay/privacyInputMaskAll/init.js | 2 +- .../replay/replayIntegrationShim/test.ts | 4 +- .../suites/replay/replayShim/init.js | 2 +- .../suites/replay/replayShim/test.ts | 4 +- .../suites/replay/requests/init.js | 2 +- .../suites/replay/sampling/init.js | 2 +- .../suites/replay/sessionExpiry/init.js | 2 +- .../suites/replay/sessionInactive/init.js | 2 +- .../suites/replay/sessionMaxAge/init.js | 2 +- .../suites/replay/slowClick/disable/init.js | 2 +- .../suites/replay/slowClick/error/init.js | 2 +- .../suites/replay/slowClick/init.js | 2 +- .../suites/replay/throttleBreadcrumbs/init.js | 2 +- .../suites/replay/unicode/compressed/init.js | 2 +- .../replay/unicode/uncompressed/init.js | 2 +- .../app/entry.client.tsx | 2 +- .../create-remix-app-v2/app/entry.client.tsx | 2 +- .../create-remix-app/app/entry.client.tsx | 2 +- .../react-create-hash-router/src/index.tsx | 2 +- .../react-router-6-use-routes/src/index.tsx | 2 +- .../standard-frontend-react/src/index.tsx | 2 +- .../test-apps/booking-app/with-replay.html | 2 +- .../test-apps/jank/with-replay.html | 2 +- packages/browser/src/index.bundle.feedback.ts | 13 +-- packages/browser/src/index.bundle.replay.ts | 13 +-- .../index.bundle.tracing.replay.feedback.ts | 24 +---- .../src/index.bundle.tracing.replay.ts | 17 +--- packages/browser/src/index.bundle.tracing.ts | 20 +--- packages/browser/src/index.bundle.ts | 12 --- packages/browser/src/index.ts | 10 +- .../test/unit/index.bundle.feedback.test.ts | 9 +- .../test/unit/index.bundle.replay.test.ts | 9 +- .../browser/test/unit/index.bundle.test.ts | 12 +-- ...dex.bundle.tracing.replay.feedback.test.ts | 8 +- .../unit/index.bundle.tracing.replay.test.ts | 8 +- .../test/unit/index.bundle.tracing.test.ts | 13 +-- packages/feedback/src/integration.ts | 15 ++- packages/integration-shims/src/Feedback.ts | 94 +++++-------------- packages/integration-shims/src/Replay.ts | 67 ++++--------- packages/integration-shims/src/common.ts | 1 + packages/integration-shims/src/index.ts | 16 +--- packages/replay-canvas/README.md | 6 +- packages/replay-canvas/src/canvas.ts | 14 +-- packages/replay-canvas/src/index.ts | 6 +- packages/replay/README.md | 10 +- packages/replay/src/index.ts | 6 +- packages/replay/src/integration.ts | 22 +++-- packages/sveltekit/README.md | 2 +- 97 files changed, 210 insertions(+), 409 deletions(-) create mode 100644 dev-packages/browser-integration-tests/suites/replay/errors/errorModeCustomTransport/init.js create mode 100644 packages/integration-shims/src/common.ts diff --git a/.size-limit.js b/.size-limit.js index 739c3f62aae1..fee3509d629c 100644 --- a/.size-limit.js +++ b/.size-limit.js @@ -3,28 +3,28 @@ module.exports = [ { name: '@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped)', path: 'packages/browser/build/npm/esm/index.js', - import: '{ init, Replay, browserTracingIntegration, Feedback }', + import: '{ init, replayIntegration, browserTracingIntegration, Feedback }', gzip: true, limit: '90 KB', }, { name: '@sentry/browser (incl. Tracing, Replay) - Webpack (gzipped)', path: 'packages/browser/build/npm/esm/index.js', - import: '{ init, Replay, browserTracingIntegration }', + import: '{ init, replayIntegration, browserTracingIntegration }', gzip: true, limit: '75 KB', }, { name: '@sentry/browser (incl. Tracing, Replay with Canvas) - Webpack (gzipped)', path: 'packages/browser/build/npm/esm/index.js', - import: '{ init, Replay, browserTracingIntegration, ReplayCanvas }', + import: '{ init, replayIntegration, browserTracingIntegration, replayCanvasIntegration }', gzip: true, limit: '90 KB', }, { name: '@sentry/browser (incl. Tracing, Replay) - Webpack with treeshaking flags (gzipped)', path: 'packages/browser/build/npm/esm/index.js', - import: '{ init, Replay, browserTracingIntegration }', + import: '{ init, replayIntegration, browserTracingIntegration }', gzip: true, limit: '75 KB', modifyWebpackConfig: function (config) { diff --git a/CHANGELOG.md b/CHANGELOG.md index bfb8eacad610..9c337d7dd6b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -531,7 +531,7 @@ import * as Sentry from '@sentry/browser'; Sentry.init({ integrations: [ // Instead of - new Sentry.Replay(), + Sentry.replayIntegration(), new Sentry.Feedback(), // Use the functional replacement: Sentry.replayIntegration(), @@ -601,7 +601,7 @@ Just add it _in addition_ to the regular replay integration: ```js Sentry.init({ - integrations: [new Sentry.Replay(), new Sentry.ReplayCanvas()], + integrations: [Sentry.replayIntegration(), new Sentry.ReplayCanvas()], }); ``` diff --git a/dev-packages/browser-integration-tests/suites/feedback/captureFeedback/init.js b/dev-packages/browser-integration-tests/suites/feedback/captureFeedback/init.js index e64314facd79..9a6b7643d10a 100644 --- a/dev-packages/browser-integration-tests/suites/feedback/captureFeedback/init.js +++ b/dev-packages/browser-integration-tests/suites/feedback/captureFeedback/init.js @@ -1,9 +1,8 @@ -import { Feedback } from '@sentry-internal/feedback'; import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; Sentry.init({ dsn: 'https://public@dsn.ingest.sentry.io/1337', - integrations: [new Feedback()], + integrations: [Sentry.feedbackIntegration], }); diff --git a/dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/init.js b/dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/init.js index 9428907f51e7..46441bdf2538 100644 --- a/dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/init.js +++ b/dev-packages/browser-integration-tests/suites/feedback/captureFeedbackAndReplay/hasSampling/init.js @@ -1,4 +1,3 @@ -import { Feedback } from '@sentry-internal/feedback'; import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; @@ -8,11 +7,11 @@ Sentry.init({ replaysOnErrorSampleRate: 1.0, replaysSessionSampleRate: 0, integrations: [ - new Sentry.Replay({ + Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, }), - new Feedback(), + Sentry.feedbackIntegration(), ], }); diff --git a/dev-packages/browser-integration-tests/suites/replay/bufferMode/init.js b/dev-packages/browser-integration-tests/suites/replay/bufferMode/init.js index 2453efcfbe1d..dfc142feaa09 100644 --- a/dev-packages/browser-integration-tests/suites/replay/bufferMode/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/bufferMode/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/bufferModeReload/init.js b/dev-packages/browser-integration-tests/suites/replay/bufferModeReload/init.js index 89c185dacc7f..7024a6574324 100644 --- a/dev-packages/browser-integration-tests/suites/replay/bufferModeReload/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/bufferModeReload/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/canvas/manualSnapshot/init.js b/dev-packages/browser-integration-tests/suites/replay/canvas/manualSnapshot/init.js index 244f951588c6..4c00009fc635 100644 --- a/dev-packages/browser-integration-tests/suites/replay/canvas/manualSnapshot/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/canvas/manualSnapshot/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 50, flushMaxDelay: 50, minReplayDuration: 0, @@ -14,5 +14,5 @@ Sentry.init({ replaysOnErrorSampleRate: 0.0, debug: true, - integrations: [window.Replay, new Sentry.ReplayCanvas({ enableManualSnapshot: true })], + integrations: [window.Replay, Sentry.replayCanvasIntegration({ enableManualSnapshot: true })], }); diff --git a/dev-packages/browser-integration-tests/suites/replay/canvas/records/init.js b/dev-packages/browser-integration-tests/suites/replay/canvas/records/init.js index 296245b01c26..38c0110f5929 100644 --- a/dev-packages/browser-integration-tests/suites/replay/canvas/records/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/canvas/records/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 50, flushMaxDelay: 50, minReplayDuration: 0, @@ -14,5 +14,5 @@ Sentry.init({ replaysOnErrorSampleRate: 0.0, debug: true, - integrations: [window.Replay, new Sentry.ReplayCanvas()], + integrations: [window.Replay, Sentry.replayCanvasIntegration()], }); diff --git a/dev-packages/browser-integration-tests/suites/replay/canvas/withCanvasIntegrationFirst/init.js b/dev-packages/browser-integration-tests/suites/replay/canvas/withCanvasIntegrationFirst/init.js index fa3248066150..3c31c823a43f 100644 --- a/dev-packages/browser-integration-tests/suites/replay/canvas/withCanvasIntegrationFirst/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/canvas/withCanvasIntegrationFirst/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, @@ -14,5 +14,5 @@ Sentry.init({ replaysOnErrorSampleRate: 0.0, debug: true, - integrations: [new Sentry.ReplayCanvas(), window.Replay], + integrations: [Sentry.replayCanvasIntegration(), window.Replay], }); diff --git a/dev-packages/browser-integration-tests/suites/replay/canvas/withCanvasIntegrationSecond/init.js b/dev-packages/browser-integration-tests/suites/replay/canvas/withCanvasIntegrationSecond/init.js index 1a9d5d179c4a..4233201fb271 100644 --- a/dev-packages/browser-integration-tests/suites/replay/canvas/withCanvasIntegrationSecond/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/canvas/withCanvasIntegrationSecond/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, @@ -14,5 +14,5 @@ Sentry.init({ replaysOnErrorSampleRate: 0.0, debug: true, - integrations: [window.Replay, new Sentry.ReplayCanvas()], + integrations: [window.Replay, Sentry.replayCanvasIntegration()], }); diff --git a/dev-packages/browser-integration-tests/suites/replay/canvas/withoutCanvasIntegration/init.js b/dev-packages/browser-integration-tests/suites/replay/canvas/withoutCanvasIntegration/init.js index 92a463a4bc84..195be16ddad3 100644 --- a/dev-packages/browser-integration-tests/suites/replay/canvas/withoutCanvasIntegration/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/canvas/withoutCanvasIntegration/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/captureComponentName/init.js b/dev-packages/browser-integration-tests/suites/replay/captureComponentName/init.js index 040fb88ab2bd..f8ffa20ceb8f 100644 --- a/dev-packages/browser-integration-tests/suites/replay/captureComponentName/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/captureComponentName/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/captureReplayFromReplayPackage/init.js b/dev-packages/browser-integration-tests/suites/replay/captureReplayFromReplayPackage/init.js index be0f9cab95d5..f71ddfdaaa9b 100644 --- a/dev-packages/browser-integration-tests/suites/replay/captureReplayFromReplayPackage/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/captureReplayFromReplayPackage/init.js @@ -1,8 +1,8 @@ import * as Sentry from '@sentry/browser'; -import { Replay } from '@sentry/replay'; +import { replayIntegration } from '@sentry/replay'; window.Sentry = Sentry; -window.Replay = new Replay({ +window.Replay = replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/compressionDisabled/init.js b/dev-packages/browser-integration-tests/suites/replay/compressionDisabled/init.js index db9828fe889e..30fdb3198b62 100644 --- a/dev-packages/browser-integration-tests/suites/replay/compressionDisabled/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/compressionDisabled/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/compressionEnabled/init.js b/dev-packages/browser-integration-tests/suites/replay/compressionEnabled/init.js index c2dd47ab0c25..ab1e26f4490a 100644 --- a/dev-packages/browser-integration-tests/suites/replay/compressionEnabled/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/compressionEnabled/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/compressionWorkerUrl/init.js b/dev-packages/browser-integration-tests/suites/replay/compressionWorkerUrl/init.js index 0d0e7ac0e71e..973a0ae3efdc 100644 --- a/dev-packages/browser-integration-tests/suites/replay/compressionWorkerUrl/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/compressionWorkerUrl/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/customEvents/init.js b/dev-packages/browser-integration-tests/suites/replay/customEvents/init.js index f76a1207243b..47b24555a669 100644 --- a/dev-packages/browser-integration-tests/suites/replay/customEvents/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/customEvents/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/dsc/init.js b/dev-packages/browser-integration-tests/suites/replay/dsc/init.js index a686fdc78205..6411031d12b5 100644 --- a/dev-packages/browser-integration-tests/suites/replay/dsc/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/dsc/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/dsc/test.ts b/dev-packages/browser-integration-tests/suites/replay/dsc/test.ts index c6483e2cdea0..e46c958497f6 100644 --- a/dev-packages/browser-integration-tests/suites/replay/dsc/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/dsc/test.ts @@ -8,8 +8,7 @@ import { getReplaySnapshot, shouldSkipReplayTest, waitForReplayRunning } from '. type TestWindow = Window & { Sentry: typeof Sentry; - // eslint-disable-next-line deprecation/deprecation - Replay: Sentry.Replay; + Replay: ReturnType; }; sentryTest( diff --git a/dev-packages/browser-integration-tests/suites/replay/errors/beforeErrorSampling/init.js b/dev-packages/browser-integration-tests/suites/replay/errors/beforeErrorSampling/init.js index a4d39ad78e7e..83e514016c1b 100644 --- a/dev-packages/browser-integration-tests/suites/replay/errors/beforeErrorSampling/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/errors/beforeErrorSampling/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/errors/droppedError/init.js b/dev-packages/browser-integration-tests/suites/replay/errors/droppedError/init.js index 2c9cd8b23147..c24b8e1daca8 100644 --- a/dev-packages/browser-integration-tests/suites/replay/errors/droppedError/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/errors/droppedError/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/errors/errorModeCustomTransport/init.js b/dev-packages/browser-integration-tests/suites/replay/errors/errorModeCustomTransport/init.js new file mode 100644 index 000000000000..5e71c58fc0aa --- /dev/null +++ b/dev-packages/browser-integration-tests/suites/replay/errors/errorModeCustomTransport/init.js @@ -0,0 +1,23 @@ +import * as Sentry from '@sentry/browser'; + +window.Sentry = Sentry; +window.Replay = Sentry.replayIntegration({ + flushMinDelay: 200, + flushMaxDelay: 200, + minReplayDuration: 0, +}); + +Sentry.init({ + dsn: 'https://public@dsn.ingest.sentry.io/1337', + sampleRate: 1, + replaysSessionSampleRate: 0.0, + replaysOnErrorSampleRate: 1.0, + integrations: [window.Replay], + transport: options => { + const transport = new Sentry.makeFetchTransport(options); + + delete transport.send.__sentry__baseTransport__; + + return transport; + }, +}); diff --git a/dev-packages/browser-integration-tests/suites/replay/errors/errorNotSent/init.js b/dev-packages/browser-integration-tests/suites/replay/errors/errorNotSent/init.js index 49d938b15060..7ab704b50d6a 100644 --- a/dev-packages/browser-integration-tests/suites/replay/errors/errorNotSent/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/errors/errorNotSent/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/errors/errorsInSession/init.js b/dev-packages/browser-integration-tests/suites/replay/errors/errorsInSession/init.js index 3bc87bdd0be4..a765fc48c67b 100644 --- a/dev-packages/browser-integration-tests/suites/replay/errors/errorsInSession/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/errors/errorsInSession/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/errors/init.js b/dev-packages/browser-integration-tests/suites/replay/errors/init.js index 89c185dacc7f..7024a6574324 100644 --- a/dev-packages/browser-integration-tests/suites/replay/errors/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/errors/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureRequestBody/init.js b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureRequestBody/init.js index 21c548a5e349..c43d5713f173 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureRequestBody/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureRequestBody/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureRequestHeaders/init.js b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureRequestHeaders/init.js index 4c3f0a7969c6..8e8006759bee 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureRequestHeaders/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureRequestHeaders/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseBody/init.js b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseBody/init.js index 3aa81d299ae2..f2eb62b8c051 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseBody/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseBody/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseHeaders/init.js b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseHeaders/init.js index ff1e66e53411..a2a7a1680123 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseHeaders/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseHeaders/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureTimestamps/init.js b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureTimestamps/init.js index 52c219e99dc9..caca8e2d317e 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureTimestamps/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureTimestamps/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/init.js b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/init.js index 52c219e99dc9..caca8e2d317e 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureRequestBody/init.js b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureRequestBody/init.js index 21c548a5e349..c43d5713f173 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureRequestBody/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureRequestBody/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureRequestHeaders/init.js b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureRequestHeaders/init.js index 4c3f0a7969c6..8e8006759bee 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureRequestHeaders/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureRequestHeaders/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureResponseBody/init.js b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureResponseBody/init.js index 3aa81d299ae2..f2eb62b8c051 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureResponseBody/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureResponseBody/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureResponseHeaders/init.js b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureResponseHeaders/init.js index ff1e66e53411..a2a7a1680123 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureResponseHeaders/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureResponseHeaders/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureTimestamps/init.js b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureTimestamps/init.js index 52c219e99dc9..caca8e2d317e 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureTimestamps/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/captureTimestamps/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/init.js b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/init.js index 52c219e99dc9..caca8e2d317e 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/xhr/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/fileInput/init.js b/dev-packages/browser-integration-tests/suites/replay/fileInput/init.js index 0e08fdfaa6d0..c973a578baae 100644 --- a/dev-packages/browser-integration-tests/suites/replay/fileInput/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/fileInput/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/flushing/init.js b/dev-packages/browser-integration-tests/suites/replay/flushing/init.js index db9828fe889e..30fdb3198b62 100644 --- a/dev-packages/browser-integration-tests/suites/replay/flushing/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/flushing/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/init.js b/dev-packages/browser-integration-tests/suites/replay/init.js index dac512988b9a..e52033fd464e 100644 --- a/dev-packages/browser-integration-tests/suites/replay/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/keyboardEvents/init.js b/dev-packages/browser-integration-tests/suites/replay/keyboardEvents/init.js index dac512988b9a..e52033fd464e 100644 --- a/dev-packages/browser-integration-tests/suites/replay/keyboardEvents/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/keyboardEvents/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/largeMutations/defaultOptions/init.js b/dev-packages/browser-integration-tests/suites/replay/largeMutations/defaultOptions/init.js index dac512988b9a..e52033fd464e 100644 --- a/dev-packages/browser-integration-tests/suites/replay/largeMutations/defaultOptions/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/largeMutations/defaultOptions/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/largeMutations/mutationLimit/init.js b/dev-packages/browser-integration-tests/suites/replay/largeMutations/mutationLimit/init.js index ed46fe5974dc..d09fe6530e9c 100644 --- a/dev-packages/browser-integration-tests/suites/replay/largeMutations/mutationLimit/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/largeMutations/mutationLimit/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/maxReplayDuration/init.js b/dev-packages/browser-integration-tests/suites/replay/maxReplayDuration/init.js index 140b486c5755..7bab07447b3a 100644 --- a/dev-packages/browser-integration-tests/suites/replay/maxReplayDuration/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/maxReplayDuration/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/minReplayDuration/init.js b/dev-packages/browser-integration-tests/suites/replay/minReplayDuration/init.js index cff168651bea..2a3dae73541d 100644 --- a/dev-packages/browser-integration-tests/suites/replay/minReplayDuration/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/minReplayDuration/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 2000, diff --git a/dev-packages/browser-integration-tests/suites/replay/multiple-pages/init.js b/dev-packages/browser-integration-tests/suites/replay/multiple-pages/init.js index a856a0d13c3e..f5a01ece0a37 100644 --- a/dev-packages/browser-integration-tests/suites/replay/multiple-pages/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/multiple-pages/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/privacyBlock/init.js b/dev-packages/browser-integration-tests/suites/replay/privacyBlock/init.js index f5360c53561b..0004ab705e56 100644 --- a/dev-packages/browser-integration-tests/suites/replay/privacyBlock/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/privacyBlock/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/privacyDefault/init.js b/dev-packages/browser-integration-tests/suites/replay/privacyDefault/init.js index db9828fe889e..30fdb3198b62 100644 --- a/dev-packages/browser-integration-tests/suites/replay/privacyDefault/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/privacyDefault/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/privacyInput/init.js b/dev-packages/browser-integration-tests/suites/replay/privacyInput/init.js index 0e08fdfaa6d0..c973a578baae 100644 --- a/dev-packages/browser-integration-tests/suites/replay/privacyInput/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/privacyInput/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/privacyInputMaskAll/init.js b/dev-packages/browser-integration-tests/suites/replay/privacyInputMaskAll/init.js index 1657e879ef87..b0dbc95aa018 100644 --- a/dev-packages/browser-integration-tests/suites/replay/privacyInputMaskAll/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/privacyInputMaskAll/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/replayIntegrationShim/test.ts b/dev-packages/browser-integration-tests/suites/replay/replayIntegrationShim/test.ts index 6817367ee68d..952c841b253e 100644 --- a/dev-packages/browser-integration-tests/suites/replay/replayIntegrationShim/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/replayIntegrationShim/test.ts @@ -30,6 +30,8 @@ sentryTest( await forceFlushReplay(); expect(requestCount).toBe(0); - expect(consoleMessages).toEqual(['You are using new Replay() even though this bundle does not include replay.']); + expect(consoleMessages).toEqual([ + 'You are using replayIntegration() even though this bundle does not include replay.', + ]); }, ); diff --git a/dev-packages/browser-integration-tests/suites/replay/replayShim/init.js b/dev-packages/browser-integration-tests/suites/replay/replayShim/init.js index a89c744e7480..77fc89c70a25 100644 --- a/dev-packages/browser-integration-tests/suites/replay/replayShim/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/replayShim/init.js @@ -3,7 +3,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; // Replay should not actually work, but still not error out -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/replayShim/test.ts b/dev-packages/browser-integration-tests/suites/replay/replayShim/test.ts index 5cb297551dfe..b906deefb71b 100644 --- a/dev-packages/browser-integration-tests/suites/replay/replayShim/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/replayShim/test.ts @@ -30,6 +30,8 @@ sentryTest( await forceFlushReplay(); expect(requestCount).toBe(0); - expect(consoleMessages).toEqual(['You are using new Replay() even though this bundle does not include replay.']); + expect(consoleMessages).toEqual([ + 'You are using replayIntegration() even though this bundle does not include replay.', + ]); }, ); diff --git a/dev-packages/browser-integration-tests/suites/replay/requests/init.js b/dev-packages/browser-integration-tests/suites/replay/requests/init.js index db9828fe889e..30fdb3198b62 100644 --- a/dev-packages/browser-integration-tests/suites/replay/requests/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/requests/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/sampling/init.js b/dev-packages/browser-integration-tests/suites/replay/sampling/init.js index 8a98bb9c45de..6405faaf741b 100644 --- a/dev-packages/browser-integration-tests/suites/replay/sampling/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/sampling/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/sessionExpiry/init.js b/dev-packages/browser-integration-tests/suites/replay/sessionExpiry/init.js index 6fa2c80cbe9c..ee55b5cca2c4 100644 --- a/dev-packages/browser-integration-tests/suites/replay/sessionExpiry/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/sessionExpiry/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/sessionInactive/init.js b/dev-packages/browser-integration-tests/suites/replay/sessionInactive/init.js index c37968bc654a..874580a83eff 100644 --- a/dev-packages/browser-integration-tests/suites/replay/sessionInactive/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/sessionInactive/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/sessionMaxAge/init.js b/dev-packages/browser-integration-tests/suites/replay/sessionMaxAge/init.js index 4b1e948f534e..214340ba12c5 100644 --- a/dev-packages/browser-integration-tests/suites/replay/sessionMaxAge/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/sessionMaxAge/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/slowClick/disable/init.js b/dev-packages/browser-integration-tests/suites/replay/slowClick/disable/init.js index aa5be4406824..b21921ae5726 100644 --- a/dev-packages/browser-integration-tests/suites/replay/slowClick/disable/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/slowClick/disable/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/slowClick/error/init.js b/dev-packages/browser-integration-tests/suites/replay/slowClick/error/init.js index b253a8bca6e9..77b6bf6b67e4 100644 --- a/dev-packages/browser-integration-tests/suites/replay/slowClick/error/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/slowClick/error/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/slowClick/init.js b/dev-packages/browser-integration-tests/suites/replay/slowClick/init.js index 575e490b2927..5083bd48c745 100644 --- a/dev-packages/browser-integration-tests/suites/replay/slowClick/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/slowClick/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/throttleBreadcrumbs/init.js b/dev-packages/browser-integration-tests/suites/replay/throttleBreadcrumbs/init.js index 3146e64131fd..6f2a54514433 100644 --- a/dev-packages/browser-integration-tests/suites/replay/throttleBreadcrumbs/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/throttleBreadcrumbs/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 5000, flushMaxDelay: 5000, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/unicode/compressed/init.js b/dev-packages/browser-integration-tests/suites/replay/unicode/compressed/init.js index 2fe6781ee15e..4d4476012c0d 100644 --- a/dev-packages/browser-integration-tests/suites/replay/unicode/compressed/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/unicode/compressed/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/browser-integration-tests/suites/replay/unicode/uncompressed/init.js b/dev-packages/browser-integration-tests/suites/replay/unicode/uncompressed/init.js index 956586937a19..cc0094a0366b 100644 --- a/dev-packages/browser-integration-tests/suites/replay/unicode/uncompressed/init.js +++ b/dev-packages/browser-integration-tests/suites/replay/unicode/uncompressed/init.js @@ -1,7 +1,7 @@ import * as Sentry from '@sentry/browser'; window.Sentry = Sentry; -window.Replay = new Sentry.Replay({ +window.Replay = Sentry.replayIntegration({ flushMinDelay: 200, flushMaxDelay: 200, minReplayDuration: 0, diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/app/entry.client.tsx b/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/app/entry.client.tsx index d71aaa5cd286..a43de2e086de 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/app/entry.client.tsx +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-express-vite-dev/app/entry.client.tsx @@ -12,7 +12,7 @@ Sentry.init({ useLocation, useMatches, }), - new Sentry.Replay(), + Sentry.replayIntegration(), ], // Performance Monitoring tracesSampleRate: 1.0, // Capture 100% of the transactions, reduce in production! diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app-v2/app/entry.client.tsx b/dev-packages/e2e-tests/test-applications/create-remix-app-v2/app/entry.client.tsx index 1f1a48d28fbd..361d2ab9935b 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app-v2/app/entry.client.tsx +++ b/dev-packages/e2e-tests/test-applications/create-remix-app-v2/app/entry.client.tsx @@ -18,7 +18,7 @@ Sentry.init({ useLocation, useMatches, }), - new Sentry.Replay(), + Sentry.replayIntegration(), ], // Performance Monitoring tracesSampleRate: 1.0, // Capture 100% of the transactions, reduce in production! diff --git a/dev-packages/e2e-tests/test-applications/create-remix-app/app/entry.client.tsx b/dev-packages/e2e-tests/test-applications/create-remix-app/app/entry.client.tsx index d5a8978376a4..5cf3bb788d6b 100644 --- a/dev-packages/e2e-tests/test-applications/create-remix-app/app/entry.client.tsx +++ b/dev-packages/e2e-tests/test-applications/create-remix-app/app/entry.client.tsx @@ -12,7 +12,7 @@ import { hydrateRoot } from 'react-dom/client'; Sentry.init({ environment: 'qa', // dynamic sampling bias to keep transactions dsn: window.ENV.SENTRY_DSN, - integrations: [Sentry.browserTracingIntegration({ useEffect, useMatches, useLocation }), new Sentry.Replay()], + integrations: [Sentry.browserTracingIntegration({ useEffect, useMatches, useLocation }), Sentry.replayIntegration()], // Performance Monitoring tracesSampleRate: 1.0, // Capture 100% of the transactions, reduce in production! // Session Replay diff --git a/dev-packages/e2e-tests/test-applications/react-create-hash-router/src/index.tsx b/dev-packages/e2e-tests/test-applications/react-create-hash-router/src/index.tsx index 73c5e024539f..579b6f8e1cfd 100644 --- a/dev-packages/e2e-tests/test-applications/react-create-hash-router/src/index.tsx +++ b/dev-packages/e2e-tests/test-applications/react-create-hash-router/src/index.tsx @@ -12,7 +12,7 @@ import { import Index from './pages/Index'; import User from './pages/User'; -const replay = new Sentry.Replay(); +const replay = Sentry.replayIntegration(); Sentry.init({ // environment: 'qa', // dynamic sampling bias to keep transactions diff --git a/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/src/index.tsx b/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/src/index.tsx index b8a036fc5340..bf68d694d0f7 100644 --- a/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/src/index.tsx +++ b/dev-packages/e2e-tests/test-applications/react-router-6-use-routes/src/index.tsx @@ -12,7 +12,7 @@ import { import Index from './pages/Index'; import User from './pages/User'; -const replay = new Sentry.Replay(); +const replay = Sentry.replayIntegration(); Sentry.init({ environment: 'qa', // dynamic sampling bias to keep transactions diff --git a/dev-packages/e2e-tests/test-applications/standard-frontend-react/src/index.tsx b/dev-packages/e2e-tests/test-applications/standard-frontend-react/src/index.tsx index 8cf0e8462e16..3a87a53ffdfa 100644 --- a/dev-packages/e2e-tests/test-applications/standard-frontend-react/src/index.tsx +++ b/dev-packages/e2e-tests/test-applications/standard-frontend-react/src/index.tsx @@ -13,7 +13,7 @@ import { import Index from './pages/Index'; import User from './pages/User'; -const replay = new Sentry.Replay(); +const replay = Sentry.replayIntegration(); Sentry.init({ environment: 'qa', // dynamic sampling bias to keep transactions diff --git a/dev-packages/overhead-metrics/test-apps/booking-app/with-replay.html b/dev-packages/overhead-metrics/test-apps/booking-app/with-replay.html index 21f19f6260be..ae99a6171f0c 100644 --- a/dev-packages/overhead-metrics/test-apps/booking-app/with-replay.html +++ b/dev-packages/overhead-metrics/test-apps/booking-app/with-replay.html @@ -224,7 +224,7 @@

This is a test app.

enableTracing: true, integrations: [ Sentry.browserTracingIntegration(), - new Sentry.Integrations.Replay({ + Sentry.replayIntegration({ useCompression: true, flushMinDelay: 2000, flushMaxDelay: 2000, diff --git a/dev-packages/overhead-metrics/test-apps/jank/with-replay.html b/dev-packages/overhead-metrics/test-apps/jank/with-replay.html index 16e1a6a6ea47..6c5f32cc7e8d 100644 --- a/dev-packages/overhead-metrics/test-apps/jank/with-replay.html +++ b/dev-packages/overhead-metrics/test-apps/jank/with-replay.html @@ -31,7 +31,7 @@ dsn: 'https://d16ae2d36f9249849c7964e9a3a8a608@o447951.ingest.sentry.io/5429213', replaysSessionSampleRate: 1.0, replaysOnErrorSampleRate: 1.0, - integrations: [new Sentry.Integrations.Replay({})], + integrations: [Sentry.replayIntegration({})], }); diff --git a/packages/browser/src/index.bundle.feedback.ts b/packages/browser/src/index.bundle.feedback.ts index 7cb0501e1a92..887cc2e864ac 100644 --- a/packages/browser/src/index.bundle.feedback.ts +++ b/packages/browser/src/index.bundle.feedback.ts @@ -1,27 +1,16 @@ // This is exported so the loader does not fail when switching off Replay/Tracing -import { Feedback, feedbackIntegration } from '@sentry-internal/feedback'; +import { feedbackIntegration } from '@sentry-internal/feedback'; import { - ReplayShim, addTracingExtensionsShim, browserTracingIntegrationShim, replayIntegrationShim, } from '@sentry-internal/integration-shims'; -import * as Sentry from './index.bundle.base'; - -// TODO (v8): Remove this as it was only needed for backwards compatibility -// eslint-disable-next-line deprecation/deprecation -Sentry.Integrations.Replay = ReplayShim; - export * from './index.bundle.base'; export { browserTracingIntegrationShim as browserTracingIntegration, addTracingExtensionsShim as addTracingExtensions, - // eslint-disable-next-line deprecation/deprecation - ReplayShim as Replay, replayIntegrationShim as replayIntegration, - // eslint-disable-next-line deprecation/deprecation - Feedback, feedbackIntegration, }; // Note: We do not export a shim for `Span` here, as that is quite complex and would blow up the bundle diff --git a/packages/browser/src/index.bundle.replay.ts b/packages/browser/src/index.bundle.replay.ts index 71baed234eba..29bf0b320dea 100644 --- a/packages/browser/src/index.bundle.replay.ts +++ b/packages/browser/src/index.bundle.replay.ts @@ -1,27 +1,16 @@ // This is exported so the loader does not fail when switching off Replay/Tracing import { - FeedbackShim, addTracingExtensionsShim, browserTracingIntegrationShim, feedbackIntegrationShim, } from '@sentry-internal/integration-shims'; -import { Replay, replayIntegration } from '@sentry/replay'; - -import * as Sentry from './index.bundle.base'; - -// TODO (v8): Remove this as it was only needed for backwards compatibility -// eslint-disable-next-line deprecation/deprecation -Sentry.Integrations.Replay = Replay; +import { replayIntegration } from '@sentry/replay'; export * from './index.bundle.base'; export { browserTracingIntegrationShim as browserTracingIntegration, addTracingExtensionsShim as addTracingExtensions, - // eslint-disable-next-line deprecation/deprecation - Replay, replayIntegration, - // eslint-disable-next-line deprecation/deprecation - FeedbackShim as Feedback, feedbackIntegrationShim as feedbackIntegration, }; // Note: We do not export a shim for `Span` here, as that is quite complex and would blow up the bundle diff --git a/packages/browser/src/index.bundle.tracing.replay.feedback.ts b/packages/browser/src/index.bundle.tracing.replay.feedback.ts index 2ccc69a8456f..b22ab16c896c 100644 --- a/packages/browser/src/index.bundle.tracing.replay.feedback.ts +++ b/packages/browser/src/index.bundle.tracing.replay.feedback.ts @@ -1,15 +1,7 @@ -import { Feedback, feedbackIntegration } from '@sentry-internal/feedback'; +import { feedbackIntegration } from '@sentry-internal/feedback'; import { browserTracingIntegration } from '@sentry-internal/tracing'; import { addTracingExtensions } from '@sentry/core'; -import { Replay, replayIntegration } from '@sentry/replay'; - -import * as Sentry from './index.bundle.base'; - -// TODO (v8): Remove this as it was only needed for backwards compatibility -// We want replay to be available under Sentry.Replay, to be consistent -// with the NPM package version. -// eslint-disable-next-line deprecation/deprecation -Sentry.Integrations.Replay = Replay; +import { replayIntegration } from '@sentry/replay'; // We are patching the global object with our hub extension methods addTracingExtensions(); @@ -22,14 +14,6 @@ export { withActiveSpan, } from '@sentry/core'; -export { - // eslint-disable-next-line deprecation/deprecation - Feedback, - // eslint-disable-next-line deprecation/deprecation - Replay, - feedbackIntegration, - replayIntegration, - browserTracingIntegration, - addTracingExtensions, -}; +export { feedbackIntegration, replayIntegration, browserTracingIntegration, addTracingExtensions }; + export * from './index.bundle.base'; diff --git a/packages/browser/src/index.bundle.tracing.replay.ts b/packages/browser/src/index.bundle.tracing.replay.ts index 8c7ac5bb917f..bae493ce571a 100644 --- a/packages/browser/src/index.bundle.tracing.replay.ts +++ b/packages/browser/src/index.bundle.tracing.replay.ts @@ -1,15 +1,7 @@ -import { FeedbackShim, feedbackIntegrationShim } from '@sentry-internal/integration-shims'; +import { feedbackIntegrationShim } from '@sentry-internal/integration-shims'; import { browserTracingIntegration } from '@sentry-internal/tracing'; import { addTracingExtensions } from '@sentry/core'; -import { Replay, replayIntegration } from '@sentry/replay'; - -import * as Sentry from './index.bundle.base'; - -// TODO (v8): Remove this as it was only needed for backwards compatibility -// We want replay to be available under Sentry.Replay, to be consistent -// with the NPM package version. -// eslint-disable-next-line deprecation/deprecation -Sentry.Integrations.Replay = Replay; +import { replayIntegration } from '@sentry/replay'; // We are patching the global object with our hub extension methods addTracingExtensions(); @@ -23,13 +15,10 @@ export { } from '@sentry/core'; export { - // eslint-disable-next-line deprecation/deprecation - FeedbackShim as Feedback, - // eslint-disable-next-line deprecation/deprecation - Replay, replayIntegration, feedbackIntegrationShim as feedbackIntegration, browserTracingIntegration, addTracingExtensions, }; + export * from './index.bundle.base'; diff --git a/packages/browser/src/index.bundle.tracing.ts b/packages/browser/src/index.bundle.tracing.ts index c457db356d67..50c33292ece1 100644 --- a/packages/browser/src/index.bundle.tracing.ts +++ b/packages/browser/src/index.bundle.tracing.ts @@ -1,21 +1,8 @@ // This is exported so the loader does not fail when switching off Replay -import { - FeedbackShim, - ReplayShim, - feedbackIntegrationShim, - replayIntegrationShim, -} from '@sentry-internal/integration-shims'; +import { feedbackIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims'; import { browserTracingIntegration } from '@sentry-internal/tracing'; import { addTracingExtensions } from '@sentry/core'; -import * as Sentry from './index.bundle.base'; - -// TODO(v8): Remove this as it was only needed for backwards compatibility -// We want replay to be available under Sentry.Replay, to be consistent -// with the NPM package version. -// eslint-disable-next-line deprecation/deprecation -Sentry.Integrations.Replay = ReplayShim; - // We are patching the global object with our hub extension methods addTracingExtensions(); @@ -28,13 +15,10 @@ export { } from '@sentry/core'; export { - // eslint-disable-next-line deprecation/deprecation - FeedbackShim as Feedback, - // eslint-disable-next-line deprecation/deprecation - ReplayShim as Replay, feedbackIntegrationShim as feedbackIntegration, replayIntegrationShim as replayIntegration, browserTracingIntegration, addTracingExtensions, }; + export * from './index.bundle.base'; diff --git a/packages/browser/src/index.bundle.ts b/packages/browser/src/index.bundle.ts index b113bd56d142..b27672414b20 100644 --- a/packages/browser/src/index.bundle.ts +++ b/packages/browser/src/index.bundle.ts @@ -1,26 +1,14 @@ // This is exported so the loader does not fail when switching off Replay/Tracing import { - FeedbackShim, - ReplayShim, addTracingExtensionsShim, browserTracingIntegrationShim, feedbackIntegrationShim, replayIntegrationShim, } from '@sentry-internal/integration-shims'; -import * as Sentry from './index.bundle.base'; - -// TODO (v8): Remove this as it was only needed for backwards compatibility -// eslint-disable-next-line deprecation/deprecation -Sentry.Integrations.Replay = ReplayShim; - export * from './index.bundle.base'; export { addTracingExtensionsShim as addTracingExtensions, - // eslint-disable-next-line deprecation/deprecation - ReplayShim as Replay, - // eslint-disable-next-line deprecation/deprecation - FeedbackShim as Feedback, browserTracingIntegrationShim as browserTracingIntegration, feedbackIntegrationShim as feedbackIntegration, replayIntegrationShim as replayIntegration, diff --git a/packages/browser/src/index.ts b/packages/browser/src/index.ts index c6270e521188..311dc078d8b6 100644 --- a/packages/browser/src/index.ts +++ b/packages/browser/src/index.ts @@ -30,8 +30,6 @@ export { } from '@sentry/core'; export { - // eslint-disable-next-line deprecation/deprecation - Replay, replayIntegration, getReplay, } from '@sentry/replay'; @@ -47,15 +45,9 @@ export type { ReplaySpanFrameEvent, } from '@sentry/replay'; -export { - // eslint-disable-next-line deprecation/deprecation - ReplayCanvas, - replayCanvasIntegration, -} from '@sentry-internal/replay-canvas'; +export { replayCanvasIntegration } from '@sentry-internal/replay-canvas'; export { - // eslint-disable-next-line deprecation/deprecation - Feedback, feedbackIntegration, sendFeedback, } from '@sentry-internal/feedback'; diff --git a/packages/browser/test/unit/index.bundle.feedback.test.ts b/packages/browser/test/unit/index.bundle.feedback.test.ts index 91475a34bb02..4ccb6a9dc458 100644 --- a/packages/browser/test/unit/index.bundle.feedback.test.ts +++ b/packages/browser/test/unit/index.bundle.feedback.test.ts @@ -1,6 +1,5 @@ -/* eslint-disable deprecation/deprecation */ -import { ReplayShim, replayIntegrationShim } from '@sentry-internal/integration-shims'; -import { Feedback, feedbackIntegration } from '@sentry/browser'; +import { replayIntegrationShim } from '@sentry-internal/integration-shims'; +import { feedbackIntegration } from '@sentry/browser'; import * as TracingReplayBundle from '../../src/index.bundle.feedback'; @@ -10,11 +9,7 @@ describe('index.bundle.feedback', () => { expect((TracingReplayBundle.Integrations[key] as any).id).toStrictEqual(expect.any(String)); }); - expect(TracingReplayBundle.Integrations.Replay).toBe(ReplayShim); - expect(TracingReplayBundle.Replay).toBe(ReplayShim); expect(TracingReplayBundle.replayIntegration).toBe(replayIntegrationShim); - - expect(TracingReplayBundle.Feedback).toBe(Feedback); expect(TracingReplayBundle.feedbackIntegration).toBe(feedbackIntegration); }); }); diff --git a/packages/browser/test/unit/index.bundle.replay.test.ts b/packages/browser/test/unit/index.bundle.replay.test.ts index a40daa2ea0d6..56356e262eea 100644 --- a/packages/browser/test/unit/index.bundle.replay.test.ts +++ b/packages/browser/test/unit/index.bundle.replay.test.ts @@ -1,6 +1,5 @@ -/* eslint-disable deprecation/deprecation */ -import { FeedbackShim, feedbackIntegrationShim } from '@sentry-internal/integration-shims'; -import { Replay, replayIntegration } from '@sentry/browser'; +import { feedbackIntegrationShim } from '@sentry-internal/integration-shims'; +import { replayIntegration } from '@sentry/browser'; import * as TracingReplayBundle from '../../src/index.bundle.replay'; @@ -10,11 +9,7 @@ describe('index.bundle.replay', () => { expect((TracingReplayBundle.Integrations[key] as any).id).toStrictEqual(expect.any(String)); }); - expect(TracingReplayBundle.Integrations.Replay).toBe(Replay); - expect(TracingReplayBundle.Replay).toBe(Replay); expect(TracingReplayBundle.replayIntegration).toBe(replayIntegration); - - expect(TracingReplayBundle.Feedback).toBe(FeedbackShim); expect(TracingReplayBundle.feedbackIntegration).toBe(feedbackIntegrationShim); }); }); diff --git a/packages/browser/test/unit/index.bundle.test.ts b/packages/browser/test/unit/index.bundle.test.ts index a081c21a1e59..91cc4dea5229 100644 --- a/packages/browser/test/unit/index.bundle.test.ts +++ b/packages/browser/test/unit/index.bundle.test.ts @@ -1,10 +1,4 @@ -/* eslint-disable deprecation/deprecation */ -import { - FeedbackShim, - ReplayShim, - feedbackIntegrationShim, - replayIntegrationShim, -} from '@sentry-internal/integration-shims'; +import { feedbackIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims'; import * as TracingBundle from '../../src/index.bundle'; @@ -14,11 +8,7 @@ describe('index.bundle', () => { expect((TracingBundle.Integrations[key] as any).name).toStrictEqual(expect.any(String)); }); - expect(TracingBundle.Integrations.Replay).toBe(ReplayShim); - expect(TracingBundle.Replay).toBe(ReplayShim); expect(TracingBundle.replayIntegration).toBe(replayIntegrationShim); - - expect(TracingBundle.Feedback).toBe(FeedbackShim); expect(TracingBundle.feedbackIntegration).toBe(feedbackIntegrationShim); }); }); diff --git a/packages/browser/test/unit/index.bundle.tracing.replay.feedback.test.ts b/packages/browser/test/unit/index.bundle.tracing.replay.feedback.test.ts index 962934f064f8..49c23d9685bb 100644 --- a/packages/browser/test/unit/index.bundle.tracing.replay.feedback.test.ts +++ b/packages/browser/test/unit/index.bundle.tracing.replay.feedback.test.ts @@ -1,6 +1,5 @@ -/* eslint-disable deprecation/deprecation */ import { browserTracingIntegration } from '@sentry-internal/tracing'; -import { Feedback, Replay, feedbackIntegration, replayIntegration } from '@sentry/browser'; +import { feedbackIntegration, replayIntegration } from '@sentry/browser'; import * as TracingReplayFeedbackBundle from '../../src/index.bundle.tracing.replay.feedback'; @@ -10,13 +9,8 @@ describe('index.bundle.tracing.replay.feedback', () => { expect((TracingReplayFeedbackBundle.Integrations[key] as any).id).toStrictEqual(expect.any(String)); }); - expect(TracingReplayFeedbackBundle.Integrations.Replay).toBe(Replay); - expect(TracingReplayFeedbackBundle.Replay).toBe(Replay); expect(TracingReplayFeedbackBundle.replayIntegration).toBe(replayIntegration); - expect(TracingReplayFeedbackBundle.browserTracingIntegration).toBe(browserTracingIntegration); - - expect(TracingReplayFeedbackBundle.Feedback).toBe(Feedback); expect(TracingReplayFeedbackBundle.feedbackIntegration).toBe(feedbackIntegration); }); }); diff --git a/packages/browser/test/unit/index.bundle.tracing.replay.test.ts b/packages/browser/test/unit/index.bundle.tracing.replay.test.ts index a90eac6cbe60..bdbb744f7873 100644 --- a/packages/browser/test/unit/index.bundle.tracing.replay.test.ts +++ b/packages/browser/test/unit/index.bundle.tracing.replay.test.ts @@ -1,7 +1,6 @@ -/* eslint-disable deprecation/deprecation */ -import { FeedbackShim, feedbackIntegrationShim } from '@sentry-internal/integration-shims'; +import { feedbackIntegrationShim } from '@sentry-internal/integration-shims'; import { browserTracingIntegration } from '@sentry-internal/tracing'; -import { Replay, replayIntegration } from '@sentry/browser'; +import { replayIntegration } from '@sentry/browser'; import * as TracingReplayBundle from '../../src/index.bundle.tracing.replay'; @@ -11,13 +10,10 @@ describe('index.bundle.tracing.replay', () => { expect((TracingReplayBundle.Integrations[key] as any).id).toStrictEqual(expect.any(String)); }); - expect(TracingReplayBundle.Integrations.Replay).toBe(Replay); - expect(TracingReplayBundle.Replay).toBe(Replay); expect(TracingReplayBundle.replayIntegration).toBe(replayIntegration); expect(TracingReplayBundle.browserTracingIntegration).toBe(browserTracingIntegration); - expect(TracingReplayBundle.Feedback).toBe(FeedbackShim); expect(TracingReplayBundle.feedbackIntegration).toBe(feedbackIntegrationShim); }); }); diff --git a/packages/browser/test/unit/index.bundle.tracing.test.ts b/packages/browser/test/unit/index.bundle.tracing.test.ts index 0f8257ee4ad0..4c8c37008fc4 100644 --- a/packages/browser/test/unit/index.bundle.tracing.test.ts +++ b/packages/browser/test/unit/index.bundle.tracing.test.ts @@ -1,10 +1,4 @@ -/* eslint-disable deprecation/deprecation */ -import { - FeedbackShim, - ReplayShim, - feedbackIntegrationShim, - replayIntegrationShim, -} from '@sentry-internal/integration-shims'; +import { feedbackIntegrationShim, replayIntegrationShim } from '@sentry-internal/integration-shims'; import { browserTracingIntegration } from '@sentry-internal/tracing'; import * as TracingBundle from '../../src/index.bundle.tracing'; @@ -15,13 +9,8 @@ describe('index.bundle.tracing', () => { expect((TracingBundle.Integrations[key] as any).id).toStrictEqual(expect.any(String)); }); - expect(TracingBundle.Integrations.Replay).toBe(ReplayShim); - expect(TracingBundle.Replay).toBe(ReplayShim); expect(TracingBundle.replayIntegration).toBe(replayIntegrationShim); - expect(TracingBundle.browserTracingIntegration).toBe(browserTracingIntegration); - - expect(TracingBundle.Feedback).toBe(FeedbackShim); expect(TracingBundle.feedbackIntegration).toBe(feedbackIntegrationShim); }); }); diff --git a/packages/feedback/src/integration.ts b/packages/feedback/src/integration.ts index b70bf008d24d..91a5da323212 100644 --- a/packages/feedback/src/integration.ts +++ b/packages/feedback/src/integration.ts @@ -25,19 +25,17 @@ import { createWidget } from './widget/createWidget'; const doc = WINDOW.document; -export const feedbackIntegration = ((options?: OptionalFeedbackConfiguration) => { - // eslint-disable-next-line deprecation/deprecation - return new Feedback(options); -}) satisfies IntegrationFn; - /** * Feedback integration. When added as an integration to the SDK, it will * inject a button in the bottom-right corner of the window that opens a * feedback modal when clicked. - * - * @deprecated Use `feedbackIntegration()` instead. */ -export class Feedback implements Integration { +export const feedbackIntegration = ((options?: OptionalFeedbackConfiguration) => { + return new Feedback(options); +}) satisfies IntegrationFn; + +// TODO: Rewrite this to be functional integration +class Feedback implements Integration { /** * @inheritDoc */ @@ -112,7 +110,6 @@ export class Feedback implements Integration { onSubmitError, onSubmitSuccess, }: OptionalFeedbackConfiguration = {}) { - // eslint-disable-next-line deprecation/deprecation this.name = Feedback.id; // tsc fails if these are not initialized explicitly constructor, e.g. can't call `_initialize()` diff --git a/packages/integration-shims/src/Feedback.ts b/packages/integration-shims/src/Feedback.ts index 419071d2bd26..e6bf1607927b 100644 --- a/packages/integration-shims/src/Feedback.ts +++ b/packages/integration-shims/src/Feedback.ts @@ -1,81 +1,37 @@ import type { Integration } from '@sentry/types'; import { consoleSandbox } from '@sentry/utils'; +import { FAKE_FUNCTION } from './common'; -/** - * This is a shim for the Feedback integration. - * It is needed in order for the CDN bundles to continue working when users add/remove feedback - * from it, without changing their config. This is necessary for the loader mechanism. - * - * @deprecated Use `feedbackIntegration()` instead. - */ -export class FeedbackShim implements Integration { - /** - * @inheritDoc - */ - public static id: string = 'Feedback'; - - /** - * @inheritDoc - */ - public name: string; - - // eslint-disable-next-line @typescript-eslint/no-explicit-any - public constructor(_options: any) { - // eslint-disable-next-line deprecation/deprecation - this.name = FeedbackShim.id; +const FEEDBACK_INTEGRATION_METHODS = [ + 'openDialog', + 'closeDialog', + 'attachTo', + 'createWidget', + 'removeWidget', + 'getWidget', + 'remove', +] as const; - consoleSandbox(() => { - // eslint-disable-next-line no-console - console.warn('You are using new Feedback() even though this bundle does not include Feedback.'); - }); - } +type FeedbackSpecificMethods = Record<(typeof FEEDBACK_INTEGRATION_METHODS)[number], () => void>; - /** jsdoc */ - public setupOnce(): void { - // noop - } - - /** jsdoc */ - public openDialog(): void { - // noop - } - - /** jsdoc */ - public closeDialog(): void { - // noop - } - - /** jsdoc */ - public attachTo(): void { - // noop - } - - /** jsdoc */ - public createWidget(): void { - // noop - } - - /** jsdoc */ - public removeWidget(): void { - // noop - } - - /** jsdoc */ - public getWidget(): void { - // noop - } - /** jsdoc */ - public remove(): void { - // noop - } -} +interface FeedbackIntegration extends Integration, FeedbackSpecificMethods {} /** * This is a shim for the Feedback integration. * It is needed in order for the CDN bundles to continue working when users add/remove feedback * from it, without changing their config. This is necessary for the loader mechanism. */ -export function feedbackIntegrationShim(_options: unknown): Integration { - // eslint-disable-next-line deprecation/deprecation - return new FeedbackShim({}); +export function feedbackIntegrationShim(_options: unknown): FeedbackIntegration { + consoleSandbox(() => { + // eslint-disable-next-line no-console + console.warn('You are using feedbackIntegration() even though this bundle does not include feedback.'); + }); + + return { + name: 'Feedback', + ...(FEEDBACK_INTEGRATION_METHODS.reduce((acc, method) => { + acc[method] = FAKE_FUNCTION; + return acc; + }, {} as FeedbackSpecificMethods) as FeedbackSpecificMethods), + }; } diff --git a/packages/integration-shims/src/Replay.ts b/packages/integration-shims/src/Replay.ts index ddebdbb14402..1f44fdf6bb3a 100644 --- a/packages/integration-shims/src/Replay.ts +++ b/packages/integration-shims/src/Replay.ts @@ -1,62 +1,29 @@ import type { Integration } from '@sentry/types'; import { consoleSandbox } from '@sentry/utils'; +import { FAKE_FUNCTION } from './common'; -/** - * This is a shim for the Replay integration. - * It is needed in order for the CDN bundles to continue working when users add/remove replay - * from it, without changing their config. This is necessary for the loader mechanism. - * - * @deprecated Use `replayIntegration()` instead. - */ -export class ReplayShim implements Integration { - /** - * @inheritDoc - */ - public static id: string = 'Replay'; - - /** - * @inheritDoc - */ - public name: string; +const REPLAY_INTEGRATION_METHODS = ['start', 'stop', 'flush'] as const; - // eslint-disable-next-line @typescript-eslint/no-explicit-any - public constructor(_options: any) { - // eslint-disable-next-line deprecation/deprecation - this.name = ReplayShim.id; +type ReplaySpecificMethods = Record<(typeof REPLAY_INTEGRATION_METHODS)[number], () => void>; - consoleSandbox(() => { - // eslint-disable-next-line no-console - console.warn('You are using new Replay() even though this bundle does not include replay.'); - }); - } - - /** jsdoc */ - public setupOnce(): void { - // noop - } - - /** jsdoc */ - public start(): void { - // noop - } - - /** jsdoc */ - public stop(): void { - // noop - } - - /** jsdoc */ - public flush(): void { - // noop - } -} +interface ReplayIntegration extends Integration, ReplaySpecificMethods {} /** * This is a shim for the Replay integration. * It is needed in order for the CDN bundles to continue working when users add/remove replay * from it, without changing their config. This is necessary for the loader mechanism. */ -export function replayIntegrationShim(_options: unknown): Integration { - // eslint-disable-next-line deprecation/deprecation - return new ReplayShim({}); +export function replayIntegrationShim(_options: unknown): ReplayIntegration { + consoleSandbox(() => { + // eslint-disable-next-line no-console + console.warn('You are using replayIntegration() even though this bundle does not include replay.'); + }); + + return { + name: 'Replay', + ...(REPLAY_INTEGRATION_METHODS.reduce((acc, method) => { + acc[method] = FAKE_FUNCTION; + return acc; + }, {} as ReplaySpecificMethods) as ReplaySpecificMethods), + }; } diff --git a/packages/integration-shims/src/common.ts b/packages/integration-shims/src/common.ts new file mode 100644 index 000000000000..48fe24ac124f --- /dev/null +++ b/packages/integration-shims/src/common.ts @@ -0,0 +1 @@ +export const FAKE_FUNCTION = (): undefined => undefined; diff --git a/packages/integration-shims/src/index.ts b/packages/integration-shims/src/index.ts index 64124f4a93cc..6b747478fc3a 100644 --- a/packages/integration-shims/src/index.ts +++ b/packages/integration-shims/src/index.ts @@ -1,16 +1,6 @@ -export { - // eslint-disable-next-line deprecation/deprecation - FeedbackShim, - feedbackIntegrationShim, -} from './Feedback'; - -export { - // eslint-disable-next-line deprecation/deprecation - ReplayShim, - replayIntegrationShim, -} from './Replay'; - +export { feedbackIntegrationShim } from './feedback'; +export { replayIntegrationShim } from './replay'; export { browserTracingIntegrationShim, addTracingExtensionsShim, -} from './BrowserTracing'; +} from './browsertracing'; diff --git a/packages/replay-canvas/README.md b/packages/replay-canvas/README.md index 21af46bf2512..8102f12d9575 100644 --- a/packages/replay-canvas/README.md +++ b/packages/replay-canvas/README.md @@ -22,7 +22,7 @@ For details on using Replay when using Sentry via the CDN bundles, see [CDN bund To set up the canvas integration, add the following to your Sentry integrations: ```javascript -new Sentry.ReplayCanvas(), +Sentry.replayCanvasIntegration(), ``` ### Full Example @@ -43,8 +43,8 @@ Sentry.init({ replaysOnErrorSampleRate: 1.0, integrations: [ - new Sentry.Replay(), - new Sentry.ReplayCanvas(), + Sentry.replayIntegration(), + Sentry.replayCanvasIntegration(), ], // ... }); diff --git a/packages/replay-canvas/src/canvas.ts b/packages/replay-canvas/src/canvas.ts index 5da590a162d7..1a2ae0126be9 100644 --- a/packages/replay-canvas/src/canvas.ts +++ b/packages/replay-canvas/src/canvas.ts @@ -1,7 +1,7 @@ import { CanvasManager } from '@sentry-internal/rrweb'; -import { convertIntegrationFnToClass, defineIntegration } from '@sentry/core'; +import { defineIntegration } from '@sentry/core'; import type { CanvasManagerInterface, CanvasManagerOptions } from '@sentry/replay'; -import type { Integration, IntegrationClass, IntegrationFn } from '@sentry/types'; +import type { IntegrationFn } from '@sentry/types'; interface ReplayCanvasOptions { enableManualSnapshot?: boolean; @@ -104,13 +104,3 @@ export const _replayCanvasIntegration = ((options: Partial * Add this in addition to `replayIntegration()` to enable canvas recording. */ export const replayCanvasIntegration = defineIntegration(_replayCanvasIntegration); - -/** - * @deprecated Use `replayCanvasIntegration()` instead - */ -// eslint-disable-next-line deprecation/deprecation -export const ReplayCanvas = convertIntegrationFnToClass(INTEGRATION_NAME, replayCanvasIntegration) as IntegrationClass< - Integration & { - getOptions: () => ReplayCanvasIntegrationOptions; - } ->; diff --git a/packages/replay-canvas/src/index.ts b/packages/replay-canvas/src/index.ts index b9dc20a69f53..ef5331d48b78 100644 --- a/packages/replay-canvas/src/index.ts +++ b/packages/replay-canvas/src/index.ts @@ -1,6 +1,2 @@ -export { - // eslint-disable-next-line deprecation/deprecation - ReplayCanvas, - replayCanvasIntegration, -} from './canvas'; +export { replayCanvasIntegration } from './canvas'; export type { ReplayCanvasIntegrationOptions } from './canvas'; diff --git a/packages/replay/README.md b/packages/replay/README.md index e87aa7861b94..751ed2e9870c 100644 --- a/packages/replay/README.md +++ b/packages/replay/README.md @@ -42,7 +42,7 @@ Sentry.init({ replaysOnErrorSampleRate: 1.0, integrations: [ - new Sentry.Replay({ + Sentry.replayIntegration({ // Additional SDK configuration goes in here, for example: maskAllText: true, blockAllMedia: true @@ -73,7 +73,7 @@ const { Replay } = await import('@sentry/browser'); const client = Sentry.getCurrentHub().getClient(); // Client can be undefined -client?.addIntegration(new Replay()); +client?.addIntegration(Sentry.replayIntegration()); ``` ### Identifying Users @@ -94,7 +94,7 @@ Replay recording only starts when it is included in the `integrations` array whe import * as Sentry from "@sentry/react"; import { BrowserClient } from "@sentry/browser"; -const replay = new Replay(); +const replay = Sentry.replayIntegration(); Sentry.init({ integrations: [replay] @@ -184,7 +184,7 @@ The following options can be configured on the root level of your browser-based ### General Integration Configuration -The following options can be configured as options to the integration, in `new Replay({})`: +The following options can be configured as options to the integration, in `Sentry.replayIntegration({})`: | key | type | default | description | | ------------------- | ------- | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | @@ -193,7 +193,7 @@ The following options can be configured as options to the integration, in `new R ### Privacy Configuration -The following options can be configured as options to the integration, in `new Replay({})`: +The following options can be configured as options to the integration, in `Sentry.replayIntegration({})`: | key | type | default | description | | ---------------- | ------------------------ | --------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------- | diff --git a/packages/replay/src/index.ts b/packages/replay/src/index.ts index d16fd7733c20..e57ca98915a3 100644 --- a/packages/replay/src/index.ts +++ b/packages/replay/src/index.ts @@ -1,8 +1,4 @@ -export { - // eslint-disable-next-line deprecation/deprecation - Replay, - replayIntegration, -} from './integration'; +export { replayIntegration } from './integration'; export type { ReplayConfiguration, diff --git a/packages/replay/src/integration.ts b/packages/replay/src/integration.ts index c52cccd51dd2..7f6f42dd356c 100644 --- a/packages/replay/src/integration.ts +++ b/packages/replay/src/integration.ts @@ -30,16 +30,26 @@ let _initialized = false; type InitialReplayPluginOptions = Omit & Partial>; +/** + * Sentry integration for [Session Replay](https://sentry.io/for/session-replay/). + * + * See the [Replay documentation](https://docs.sentry.io/platforms/javascript/guides/session-replay/) for more information. + * + * @example + * + * ``` + * Sentry.init({ + * dsn: '__DSN__', + * integrations: [Sentry.replayIntegration()], + * }); + * ``` + */ export const replayIntegration = ((options?: ReplayConfiguration) => { - // eslint-disable-next-line deprecation/deprecation return new Replay(options); }) satisfies IntegrationFn; -/** - * The main replay integration class, to be passed to `init({ integrations: [] })`. - * @deprecated Use `replayIntegration()` instead. - */ -export class Replay implements Integration { +// TODO: Rewrite this to be functional integration +class Replay implements Integration { /** * @inheritDoc */ diff --git a/packages/sveltekit/README.md b/packages/sveltekit/README.md index 477d9181b8a5..84970cca7954 100644 --- a/packages/sveltekit/README.md +++ b/packages/sveltekit/README.md @@ -77,7 +77,7 @@ The Sentry SvelteKit SDK mostly relies on [SvelteKit Hooks](https://kit.svelte.d // For instance, initialize Session Replay: replaysSessionSampleRate: 0.1, replaysOnErrorSampleRate: 1.0, - integrations: [new Sentry.Replay()], + integrations: [Sentry.replayIntegration()], }); ``` From 7121af3ea8c7cbfa1f10838077366ed1795a840d Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Mon, 26 Feb 2024 12:45:20 -0500 Subject: [PATCH 02/10] fix imports --- packages/feedback/src/index.ts | 6 +----- packages/integration-shims/src/index.ts | 6 +++--- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/packages/feedback/src/index.ts b/packages/feedback/src/index.ts index 8fcba29c5d0f..9d14c45ab186 100644 --- a/packages/feedback/src/index.ts +++ b/packages/feedback/src/index.ts @@ -1,6 +1,2 @@ export { sendFeedback } from './sendFeedback'; -export { - // eslint-disable-next-line deprecation/deprecation - Feedback, - feedbackIntegration, -} from './integration'; +export { feedbackIntegration } from './integration'; diff --git a/packages/integration-shims/src/index.ts b/packages/integration-shims/src/index.ts index 6b747478fc3a..5dfb2caabea1 100644 --- a/packages/integration-shims/src/index.ts +++ b/packages/integration-shims/src/index.ts @@ -1,6 +1,6 @@ -export { feedbackIntegrationShim } from './feedback'; -export { replayIntegrationShim } from './replay'; +export { feedbackIntegrationShim } from './Feedback'; +export { replayIntegrationShim } from './Replay'; export { browserTracingIntegrationShim, addTracingExtensionsShim, -} from './browsertracing'; +} from './BrowserTracing'; From bca0bc2415150e54c9eb93fcae40d2c39bdbc22b Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Mon, 26 Feb 2024 12:46:37 -0500 Subject: [PATCH 03/10] fix size limit feedback import --- .size-limit.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.size-limit.js b/.size-limit.js index fee3509d629c..bc1dfef23f9f 100644 --- a/.size-limit.js +++ b/.size-limit.js @@ -57,7 +57,7 @@ module.exports = [ { name: '@sentry/browser (incl. Feedback) - Webpack (gzipped)', path: 'packages/browser/build/npm/esm/index.js', - import: '{ init, Feedback }', + import: '{ init, feedbackIntegration }', gzip: true, limit: '50 KB', }, @@ -168,7 +168,7 @@ module.exports = [ { name: '@sentry-internal/feedback - Webpack (gzipped)', path: 'packages/feedback/build/npm/esm/index.js', - import: '{ Feedback }', + import: '{ feedbackIntegration }', gzip: true, limit: '25 KB', }, From 8050f86973ead945f1f7bab8de062a22342bb21e Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Mon, 26 Feb 2024 12:53:28 -0500 Subject: [PATCH 04/10] another size limit fix --- .size-limit.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.size-limit.js b/.size-limit.js index bc1dfef23f9f..129071e791da 100644 --- a/.size-limit.js +++ b/.size-limit.js @@ -3,7 +3,7 @@ module.exports = [ { name: '@sentry/browser (incl. Tracing, Replay, Feedback) - Webpack (gzipped)', path: 'packages/browser/build/npm/esm/index.js', - import: '{ init, replayIntegration, browserTracingIntegration, Feedback }', + import: '{ init, replayIntegration, browserTracingIntegration, feedbackIntegration }', gzip: true, limit: '90 KB', }, @@ -138,7 +138,7 @@ module.exports = [ { name: '@sentry/react (incl. Tracing, Replay) - Webpack (gzipped)', path: 'packages/react/build/esm/index.js', - import: '{ init, browserTracingIntegration, Replay }', + import: '{ init, browserTracingIntegration, replayIntegration }', gzip: true, limit: '75 KB', }, From 812f8404ec4492c3d000949cca32ef6625425b43 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Tue, 27 Feb 2024 15:52:32 -0500 Subject: [PATCH 05/10] fix PR reviews --- CHANGELOG.md | 4 ++-- .../suites/feedback/captureFeedback/init.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c337d7dd6b8..bfb8eacad610 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -531,7 +531,7 @@ import * as Sentry from '@sentry/browser'; Sentry.init({ integrations: [ // Instead of - Sentry.replayIntegration(), + new Sentry.Replay(), new Sentry.Feedback(), // Use the functional replacement: Sentry.replayIntegration(), @@ -601,7 +601,7 @@ Just add it _in addition_ to the regular replay integration: ```js Sentry.init({ - integrations: [Sentry.replayIntegration(), new Sentry.ReplayCanvas()], + integrations: [new Sentry.Replay(), new Sentry.ReplayCanvas()], }); ``` diff --git a/dev-packages/browser-integration-tests/suites/feedback/captureFeedback/init.js b/dev-packages/browser-integration-tests/suites/feedback/captureFeedback/init.js index 9a6b7643d10a..6455e8d8851a 100644 --- a/dev-packages/browser-integration-tests/suites/feedback/captureFeedback/init.js +++ b/dev-packages/browser-integration-tests/suites/feedback/captureFeedback/init.js @@ -4,5 +4,5 @@ window.Sentry = Sentry; Sentry.init({ dsn: 'https://public@dsn.ingest.sentry.io/1337', - integrations: [Sentry.feedbackIntegration], + integrations: [Sentry.feedbackIntegration()], }); From f69b87fbfc89fecefce7457a5f7529ad6301130e Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Mon, 4 Mar 2024 18:16:13 -0500 Subject: [PATCH 06/10] fix tests for real --- packages/replay/src/integration.ts | 10 +++++++--- .../test/integration/beforeAddRecordingEvent.test.ts | 3 +-- packages/replay/test/integration/stop.test.ts | 3 +-- packages/replay/test/mocks/mockSdk.ts | 6 ++---- packages/replay/test/mocks/resetSdkMock.ts | 3 +-- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/packages/replay/src/integration.ts b/packages/replay/src/integration.ts index 7f6f42dd356c..688808e0ccf1 100644 --- a/packages/replay/src/integration.ts +++ b/packages/replay/src/integration.ts @@ -48,8 +48,13 @@ export const replayIntegration = ((options?: ReplayConfiguration) => { return new Replay(options); }) satisfies IntegrationFn; -// TODO: Rewrite this to be functional integration -class Replay implements Integration { +/** + * Replay integration + * + * TODO: Rewrite this to be functional integration + * Exported for tests. + */ +export class Replay implements Integration { /** * @inheritDoc */ @@ -127,7 +132,6 @@ class Replay implements Integration { // eslint-disable-next-line deprecation/deprecation ignoreClass, }: ReplayConfiguration = {}) { - // eslint-disable-next-line deprecation/deprecation this.name = Replay.id; const privacyOptions = getPrivacyOptions({ diff --git a/packages/replay/test/integration/beforeAddRecordingEvent.test.ts b/packages/replay/test/integration/beforeAddRecordingEvent.test.ts index e8076875386b..c6b14d1f1bb8 100644 --- a/packages/replay/test/integration/beforeAddRecordingEvent.test.ts +++ b/packages/replay/test/integration/beforeAddRecordingEvent.test.ts @@ -2,7 +2,7 @@ import * as SentryCore from '@sentry/core'; import type { Transport } from '@sentry/types'; import * as SentryUtils from '@sentry/utils'; -import type { Replay } from '../../src'; +import type { Replay } from '../../src/integration'; import type { ReplayContainer } from '../../src/replay'; import { clearSession } from '../../src/session/clearSession'; import { createPerformanceEntries } from '../../src/util/createPerformanceEntries'; @@ -23,7 +23,6 @@ type MockTransportSend = jest.MockedFunction; describe('Integration | beforeAddRecordingEvent', () => { let replay: ReplayContainer; - // eslint-disable-next-line deprecation/deprecation let integration: Replay; let mockTransportSend: MockTransportSend; let mockSendReplayRequest: jest.SpyInstance; diff --git a/packages/replay/test/integration/stop.test.ts b/packages/replay/test/integration/stop.test.ts index 75faef8f0d04..d1af26e74776 100644 --- a/packages/replay/test/integration/stop.test.ts +++ b/packages/replay/test/integration/stop.test.ts @@ -1,7 +1,7 @@ import * as SentryUtils from '@sentry/utils'; -import type { Replay } from '../../src'; import { WINDOW } from '../../src/constants'; +import type { Replay } from '../../src/integration'; import type { ReplayContainer } from '../../src/replay'; import { clearSession } from '../../src/session/clearSession'; import { addEvent } from '../../src/util/addEvent'; @@ -17,7 +17,6 @@ type MockRunFlush = jest.MockedFunction; describe('Integration | stop', () => { let replay: ReplayContainer; - // eslint-disable-next-line deprecation/deprecation let integration: Replay; const prevLocation = WINDOW.location; diff --git a/packages/replay/test/mocks/mockSdk.ts b/packages/replay/test/mocks/mockSdk.ts index 2ada7cec506f..f57ef8c51d71 100644 --- a/packages/replay/test/mocks/mockSdk.ts +++ b/packages/replay/test/mocks/mockSdk.ts @@ -1,6 +1,6 @@ import type { Envelope, Transport, TransportMakeRequestResponse } from '@sentry/types'; -import type { Replay as ReplayIntegration } from '../../src'; +import type { Replay as ReplayIntegration } from '../../src/integration'; import type { ReplayContainer } from '../../src/replay'; import type { ReplayConfiguration } from '../../src/types'; import type { TestClientOptions } from '../utils/TestClient'; @@ -46,11 +46,9 @@ class MockTransport implements Transport { export async function mockSdk({ replayOptions, sentryOptions, autoStart = true }: MockSdkParams = {}): Promise<{ replay: ReplayContainer; - // eslint-disable-next-line deprecation/deprecation integration: ReplayIntegration; }> { - // eslint-disable-next-line deprecation/deprecation - const { Replay } = await import('../../src'); + const { Replay } = await import('../../src/integration'); // Scope this to the test, instead of the module let _initialized = false; diff --git a/packages/replay/test/mocks/resetSdkMock.ts b/packages/replay/test/mocks/resetSdkMock.ts index 8c60f6d1c742..a8fdd97ef5ac 100644 --- a/packages/replay/test/mocks/resetSdkMock.ts +++ b/packages/replay/test/mocks/resetSdkMock.ts @@ -1,7 +1,7 @@ import type { EventProcessor } from '@sentry/types'; import { getGlobalSingleton, resetInstrumentationHandlers } from '@sentry/utils'; -import type { Replay as ReplayIntegration } from '../../src'; +import type { Replay as ReplayIntegration } from '../../src/integration'; import type { ReplayContainer } from '../../src/replay'; import type { RecordMock } from './../index'; import { BASE_TIMESTAMP } from './../index'; @@ -13,7 +13,6 @@ export async function resetSdkMock({ replayOptions, sentryOptions, autoStart }: domHandler: DomHandler; mockRecord: RecordMock; replay: ReplayContainer; - // eslint-disable-next-line deprecation/deprecation integration: ReplayIntegration; }> { let domHandler: DomHandler; From 43cbd5eb9e383f5cd4f6906e9df5f9e463f91cab Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Mon, 4 Mar 2024 18:17:13 -0500 Subject: [PATCH 07/10] custom replay --- .../loader-suites/loader/onLoad/customReplay/init.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-packages/browser-integration-tests/loader-suites/loader/onLoad/customReplay/init.js b/dev-packages/browser-integration-tests/loader-suites/loader/onLoad/customReplay/init.js index 921209ce14dc..8a676c4a160c 100644 --- a/dev-packages/browser-integration-tests/loader-suites/loader/onLoad/customReplay/init.js +++ b/dev-packages/browser-integration-tests/loader-suites/loader/onLoad/customReplay/init.js @@ -2,7 +2,7 @@ Sentry.onLoad(function () { Sentry.init({ integrations: [ // Without this syntax, this will be re-written by the test framework - new window['Sentry'].Replay({ + new window['Sentry'].replayIntegration({ useCompression: false, }), ], From a2eb16e866e1e6e6a348b846c7179ad5f790486f Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Tue, 5 Mar 2024 17:11:12 -0500 Subject: [PATCH 08/10] fix syntax --- .../loader-suites/loader/onLoad/customReplay/init.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dev-packages/browser-integration-tests/loader-suites/loader/onLoad/customReplay/init.js b/dev-packages/browser-integration-tests/loader-suites/loader/onLoad/customReplay/init.js index 8a676c4a160c..150a9f6a20ae 100644 --- a/dev-packages/browser-integration-tests/loader-suites/loader/onLoad/customReplay/init.js +++ b/dev-packages/browser-integration-tests/loader-suites/loader/onLoad/customReplay/init.js @@ -2,7 +2,7 @@ Sentry.onLoad(function () { Sentry.init({ integrations: [ // Without this syntax, this will be re-written by the test framework - new window['Sentry'].replayIntegration({ + window['Sentry'].replayIntegration({ useCompression: false, }), ], From 0e24970048cdaae6c7b5113b1345151fc550fc64 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Tue, 5 Mar 2024 17:42:35 -0500 Subject: [PATCH 09/10] fix test import --- .../suites/replay/bufferMode/test.ts | 37 +++++++++---------- .../fetch/captureResponseHeaders/test.ts | 6 --- 2 files changed, 18 insertions(+), 25 deletions(-) diff --git a/dev-packages/browser-integration-tests/suites/replay/bufferMode/test.ts b/dev-packages/browser-integration-tests/suites/replay/bufferMode/test.ts index 1ed90b81b37a..9c10b6777d67 100644 --- a/dev-packages/browser-integration-tests/suites/replay/bufferMode/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/bufferMode/test.ts @@ -1,5 +1,5 @@ import { expect } from '@playwright/test'; -import type { Replay } from '@sentry/replay'; +import type { replayIntegration as actualReplayIntegration } from '@sentry/replay'; import type { ReplayContainer } from '@sentry/replay/build/npm/types/types'; import { sentryTest } from '../../../utils/fixtures'; @@ -58,8 +58,9 @@ sentryTest( expect( await page.evaluate(() => { - const replayIntegration = (window as unknown as Window & { Replay: { _replay: ReplayContainer } }).Replay; - const replay = replayIntegration._replay; + const replayIntegration = (window as unknown as Window & { Replay: ReturnType }) + .Replay; + const replay = replayIntegration['_replay']; return replay.isEnabled(); }), ).toBe(false); @@ -67,10 +68,9 @@ sentryTest( // Start buffering and assert that it is enabled expect( await page.evaluate(() => { - // eslint-disable-next-line deprecation/deprecation - const replayIntegration = (window as unknown as Window & { Replay: InstanceType }).Replay; - // @ts-expect-error private - const replay = replayIntegration._replay; + const replayIntegration = (window as unknown as Window & { Replay: ReturnType }) + .Replay; + const replay = replayIntegration['_replay']; replayIntegration.startBuffering(); return replay.isEnabled(); }), @@ -88,8 +88,8 @@ sentryTest( const [req0] = await Promise.all([ reqPromise0, page.evaluate(async () => { - // eslint-disable-next-line deprecation/deprecation - const replayIntegration = (window as unknown as Window & { Replay: Replay }).Replay; + const replayIntegration = (window as unknown as Window & { Replay: ReturnType }) + .Replay; await replayIntegration.flush(); }), ]); @@ -212,10 +212,9 @@ sentryTest( // Start buffering and assert that it is enabled expect( await page.evaluate(() => { - // eslint-disable-next-line deprecation/deprecation - const replayIntegration = (window as unknown as Window & { Replay: InstanceType }).Replay; - // @ts-expect-error private - const replay = replayIntegration._replay; + const replayIntegration = (window as unknown as Window & { Replay: ReturnType }) + .Replay; + const replay = replayIntegration['_replay']; replayIntegration.startBuffering(); return replay.isEnabled(); }), @@ -233,8 +232,8 @@ sentryTest( const [req0] = await Promise.all([ reqPromise0, page.evaluate(async () => { - // eslint-disable-next-line deprecation/deprecation - const replayIntegration = (window as unknown as Window & { Replay: Replay }).Replay; + const replayIntegration = (window as unknown as Window & { Replay: ReturnType }) + .Replay; await replayIntegration.flush({ continueRecording: false }); }), ]); @@ -328,8 +327,8 @@ sentryTest( // Start buffering and assert that it is enabled expect( await page.evaluate(() => { - // eslint-disable-next-line deprecation/deprecation - const replayIntegration = (window as unknown as Window & { Replay: InstanceType }).Replay; + const replayIntegration = (window as unknown as Window & { Replay: ReturnType }) + .Replay; const replay = replayIntegration['_replay']; replayIntegration.startBuffering(); return replay.isEnabled(); @@ -347,8 +346,8 @@ sentryTest( expect(errorEvent0.tags?.replayId).toBeUndefined(); await page.evaluate(async () => { - // eslint-disable-next-line deprecation/deprecation - const replayIntegration = (window as unknown as Window & { Replay: Replay }).Replay; + const replayIntegration = (window as unknown as Window & { Replay: ReturnType }) + .Replay; replayIntegration['_replay'].getOptions().errorSampleRate = 1.0; }); diff --git a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseHeaders/test.ts b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseHeaders/test.ts index c587db401e4f..8f098627c120 100644 --- a/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseHeaders/test.ts +++ b/dev-packages/browser-integration-tests/suites/replay/extendNetworkBreadcrumbs/fetch/captureResponseHeaders/test.ts @@ -38,12 +38,10 @@ sentryTest('handles empty headers', async ({ getLocalTestPath, page, browserName await page.goto(url); await page.evaluate(() => { - /* eslint-disable */ fetch('http://localhost:7654/foo').then(() => { // @ts-expect-error Sentry is a global Sentry.captureException('test error'); }); - /* eslint-enable */ }); const request = await requestPromise; @@ -114,12 +112,10 @@ sentryTest('captures response headers', async ({ getLocalTestPath, page }) => { await page.goto(url); await page.evaluate(() => { - /* eslint-disable */ fetch('http://localhost:7654/foo').then(() => { // @ts-expect-error Sentry is a global Sentry.captureException('test error'); }); - /* eslint-enable */ }); const request = await requestPromise; @@ -196,12 +192,10 @@ sentryTest('does not capture response headers if URL does not match', async ({ g await page.goto(url); await page.evaluate(() => { - /* eslint-disable */ fetch('http://localhost:7654/bar').then(() => { // @ts-expect-error Sentry is a global Sentry.captureException('test error'); }); - /* eslint-enable */ }); const request = await requestPromise; From 17e8b9fd160c3b873f2d4b55edd872af0cbefa41 Mon Sep 17 00:00:00 2001 From: Abhijeet Prasad Date: Tue, 5 Mar 2024 17:46:33 -0500 Subject: [PATCH 10/10] fix size limit again --- .size-limit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.size-limit.js b/.size-limit.js index 129071e791da..f2d883a3b0cb 100644 --- a/.size-limit.js +++ b/.size-limit.js @@ -154,7 +154,7 @@ module.exports = [ { name: '@sentry/nextjs Client (incl. Tracing, Replay) - Webpack (gzipped)', path: 'packages/nextjs/build/esm/client/index.js', - import: '{ init, browserTracingIntegration, Replay }', + import: '{ init, browserTracingIntegration, replayIntegration }', gzip: true, limit: '110 KB', },