Skip to content

Commit 95fc8a3

Browse files
committed
feat(replay): Deprecate Replay, ReplayCanvas, Feedback classes
Instead, users should use the new functional styles. Note that we'll probably actually un-deprecate `Replay` in some form in v8, as we'll be keeping the class around there for sure (as there is a lot of logic in there...). But users should not use it, so deprecating this now!
1 parent 6868256 commit 95fc8a3

36 files changed

+279
-66
lines changed

MIGRATION.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ The following list shows how integrations should be migrated:
3636
| `new ModuleMetadata()` | `moduleMetadataIntegration()` | `@sentry/core`, `@sentry/browser` |
3737
| `new RequestData()` | `requestDataIntegration()` | `@sentry/core`, `@sentry/node`, `@sentry/deno`, `@sentry/bun`, `@sentry/vercel-edge` |
3838
| `new Wasm() ` | `wasmIntegration()` | `@sentry/wasm` |
39+
| `new Replay()` | `replayIntegration()` | `@sentry/browser` |
40+
| `new ReplayCanvas()` | `replayCanvasIntegration()` | `@sentry/browser` |
41+
| `new Feedback()` | `feedbackIntegration()` | `@sentry/browser` |
3942

4043
## Deprecate `hub.bindClient()` and `makeMain()`
4144

dev-packages/browser-integration-tests/suites/replay/bufferMode/test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ sentryTest(
6767
// Start buffering and assert that it is enabled
6868
expect(
6969
await page.evaluate(() => {
70+
// eslint-disable-next-line deprecation/deprecation
7071
const replayIntegration = (window as unknown as Window & { Replay: InstanceType<typeof Replay> }).Replay;
7172
// @ts-expect-error private
7273
const replay = replayIntegration._replay;
@@ -87,6 +88,7 @@ sentryTest(
8788
const [req0] = await Promise.all([
8889
reqPromise0,
8990
page.evaluate(async () => {
91+
// eslint-disable-next-line deprecation/deprecation
9092
const replayIntegration = (window as unknown as Window & { Replay: Replay }).Replay;
9193
await replayIntegration.flush();
9294
}),
@@ -210,6 +212,7 @@ sentryTest(
210212
// Start buffering and assert that it is enabled
211213
expect(
212214
await page.evaluate(() => {
215+
// eslint-disable-next-line deprecation/deprecation
213216
const replayIntegration = (window as unknown as Window & { Replay: InstanceType<typeof Replay> }).Replay;
214217
// @ts-expect-error private
215218
const replay = replayIntegration._replay;
@@ -230,6 +233,7 @@ sentryTest(
230233
const [req0] = await Promise.all([
231234
reqPromise0,
232235
page.evaluate(async () => {
236+
// eslint-disable-next-line deprecation/deprecation
233237
const replayIntegration = (window as unknown as Window & { Replay: Replay }).Replay;
234238
await replayIntegration.flush({ continueRecording: false });
235239
}),
@@ -324,6 +328,7 @@ sentryTest(
324328
// Start buffering and assert that it is enabled
325329
expect(
326330
await page.evaluate(() => {
331+
// eslint-disable-next-line deprecation/deprecation
327332
const replayIntegration = (window as unknown as Window & { Replay: InstanceType<typeof Replay> }).Replay;
328333
const replay = replayIntegration['_replay'];
329334
replayIntegration.startBuffering();
@@ -342,6 +347,7 @@ sentryTest(
342347
expect(errorEvent0.tags?.replayId).toBeUndefined();
343348

344349
await page.evaluate(async () => {
350+
// eslint-disable-next-line deprecation/deprecation
345351
const replayIntegration = (window as unknown as Window & { Replay: Replay }).Replay;
346352
replayIntegration['_replay'].getOptions().errorSampleRate = 1.0;
347353
});

dev-packages/browser-integration-tests/suites/replay/dsc/test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ import { sentryTest } from '../../../utils/fixtures';
66
import { envelopeRequestParser, shouldSkipTracingTest, waitForTransactionRequest } from '../../../utils/helpers';
77
import { getReplaySnapshot, shouldSkipReplayTest, waitForReplayRunning } from '../../../utils/replayHelpers';
88

9-
type TestWindow = Window & { Sentry: typeof Sentry; Replay: Sentry.Replay };
9+
type TestWindow = Window & {
10+
Sentry: typeof Sentry;
11+
// eslint-disable-next-line deprecation/deprecation
12+
Replay: Sentry.Replay;
13+
};
1014

1115
sentryTest(
1216
'should add replay_id to dsc of transactions when in session mode',
Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,24 @@
11
// This is exported so the loader does not fail when switching off Replay/Tracing
2-
import { Feedback } from '@sentry-internal/feedback';
3-
import { BrowserTracing, Replay, addTracingExtensions } from '@sentry-internal/integration-shims';
2+
import { Feedback, feedbackIntegration } from '@sentry-internal/feedback';
3+
import { BrowserTracing, Replay, addTracingExtensions, replayIntegration } from '@sentry-internal/integration-shims';
44

55
import * as Sentry from './index.bundle.base';
66

77
// TODO (v8): Remove this as it was only needed for backwards compatibility
8+
// eslint-disable-next-line deprecation/deprecation
89
Sentry.Integrations.Replay = Replay;
910

1011
Sentry.Integrations.BrowserTracing = BrowserTracing;
1112

1213
export * from './index.bundle.base';
13-
export { BrowserTracing, addTracingExtensions, Replay, Feedback };
14+
export {
15+
BrowserTracing,
16+
addTracingExtensions,
17+
// eslint-disable-next-line deprecation/deprecation
18+
Replay,
19+
replayIntegration,
20+
// eslint-disable-next-line deprecation/deprecation
21+
Feedback,
22+
feedbackIntegration,
23+
};
1424
// Note: We do not export a shim for `Span` here, as that is quite complex and would blow up the bundle
Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,29 @@
11
// This is exported so the loader does not fail when switching off Replay/Tracing
2-
import { BrowserTracing, Feedback, addTracingExtensions } from '@sentry-internal/integration-shims';
3-
import { Replay } from '@sentry/replay';
2+
import {
3+
BrowserTracing,
4+
Feedback,
5+
addTracingExtensions,
6+
feedbackIntegration,
7+
} from '@sentry-internal/integration-shims';
8+
import { Replay, replayIntegration } from '@sentry/replay';
49

510
import * as Sentry from './index.bundle.base';
611

712
// TODO (v8): Remove this as it was only needed for backwards compatibility
13+
// eslint-disable-next-line deprecation/deprecation
814
Sentry.Integrations.Replay = Replay;
915

1016
Sentry.Integrations.BrowserTracing = BrowserTracing;
1117

1218
export * from './index.bundle.base';
13-
export { BrowserTracing, addTracingExtensions, Replay, Feedback };
19+
export {
20+
BrowserTracing,
21+
addTracingExtensions,
22+
// eslint-disable-next-line deprecation/deprecation
23+
Replay,
24+
replayIntegration,
25+
// eslint-disable-next-line deprecation/deprecation
26+
Feedback,
27+
feedbackIntegration,
28+
};
1429
// Note: We do not export a shim for `Span` here, as that is quite complex and would blow up the bundle
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
1-
import { Feedback } from '@sentry-internal/feedback';
1+
import { Feedback, feedbackIntegration } from '@sentry-internal/feedback';
22
import { BrowserTracing, Span, addExtensionMethods } from '@sentry-internal/tracing';
3-
import { Replay } from '@sentry/replay';
3+
import { Replay, replayIntegration } from '@sentry/replay';
44

55
import * as Sentry from './index.bundle.base';
66

77
// TODO (v8): Remove this as it was only needed for backwards compatibility
88
// We want replay to be available under Sentry.Replay, to be consistent
99
// with the NPM package version.
10+
// eslint-disable-next-line deprecation/deprecation
1011
Sentry.Integrations.Replay = Replay;
1112

1213
Sentry.Integrations.BrowserTracing = BrowserTracing;
1314

1415
// We are patching the global object with our hub extension methods
1516
addExtensionMethods();
1617

17-
export { Feedback, Replay, BrowserTracing, Span, addExtensionMethods };
18+
export {
19+
// eslint-disable-next-line deprecation/deprecation
20+
Feedback,
21+
// eslint-disable-next-line deprecation/deprecation
22+
Replay,
23+
feedbackIntegration,
24+
replayIntegration,
25+
BrowserTracing,
26+
Span,
27+
addExtensionMethods,
28+
};
1829
export * from './index.bundle.base';
Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
1-
import { Feedback } from '@sentry-internal/integration-shims';
1+
import { Feedback, feedbackIntegration } from '@sentry-internal/integration-shims';
22
import { BrowserTracing, Span, addExtensionMethods } from '@sentry-internal/tracing';
3-
import { Replay } from '@sentry/replay';
3+
import { Replay, replayIntegration } from '@sentry/replay';
44

55
import * as Sentry from './index.bundle.base';
66

77
// TODO (v8): Remove this as it was only needed for backwards compatibility
88
// We want replay to be available under Sentry.Replay, to be consistent
99
// with the NPM package version.
10+
// eslint-disable-next-line deprecation/deprecation
1011
Sentry.Integrations.Replay = Replay;
1112

1213
Sentry.Integrations.BrowserTracing = BrowserTracing;
1314

1415
// We are patching the global object with our hub extension methods
1516
addExtensionMethods();
1617

17-
export { Feedback, Replay, BrowserTracing, Span, addExtensionMethods };
18+
export {
19+
// eslint-disable-next-line deprecation/deprecation
20+
Feedback,
21+
// eslint-disable-next-line deprecation/deprecation
22+
Replay,
23+
replayIntegration,
24+
feedbackIntegration,
25+
BrowserTracing,
26+
Span,
27+
addExtensionMethods,
28+
};
1829
export * from './index.bundle.base';
Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,29 @@
11
// This is exported so the loader does not fail when switching off Replay
2-
import { Feedback, Replay } from '@sentry-internal/integration-shims';
2+
import { Feedback, Replay, feedbackIntegration, replayIntegration } from '@sentry-internal/integration-shims';
33
import { BrowserTracing, Span, addExtensionMethods } from '@sentry-internal/tracing';
44

55
import * as Sentry from './index.bundle.base';
66

77
// TODO (v8): Remove this as it was only needed for backwards compatibility
88
// We want replay to be available under Sentry.Replay, to be consistent
99
// with the NPM package version.
10+
// eslint-disable-next-line deprecation/deprecation
1011
Sentry.Integrations.Replay = Replay;
1112

1213
Sentry.Integrations.BrowserTracing = BrowserTracing;
1314

1415
// We are patching the global object with our hub extension methods
1516
addExtensionMethods();
1617

17-
export { Feedback, Replay, BrowserTracing, Span, addExtensionMethods };
18+
export {
19+
// eslint-disable-next-line deprecation/deprecation
20+
Feedback,
21+
// eslint-disable-next-line deprecation/deprecation
22+
Replay,
23+
feedbackIntegration,
24+
replayIntegration,
25+
BrowserTracing,
26+
Span,
27+
addExtensionMethods,
28+
};
1829
export * from './index.bundle.base';

packages/browser/src/index.bundle.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,30 @@
11
// This is exported so the loader does not fail when switching off Replay/Tracing
2-
import { BrowserTracing, Feedback, Replay, addTracingExtensions } from '@sentry-internal/integration-shims';
2+
import {
3+
BrowserTracing,
4+
Feedback,
5+
Replay,
6+
addTracingExtensions,
7+
feedbackIntegration,
8+
replayIntegration,
9+
} from '@sentry-internal/integration-shims';
310

411
import * as Sentry from './index.bundle.base';
512

613
// TODO (v8): Remove this as it was only needed for backwards compatibility
14+
// eslint-disable-next-line deprecation/deprecation
715
Sentry.Integrations.Replay = Replay;
816

917
Sentry.Integrations.BrowserTracing = BrowserTracing;
1018

1119
export * from './index.bundle.base';
12-
export { BrowserTracing, addTracingExtensions, Replay, Feedback };
20+
export {
21+
BrowserTracing,
22+
addTracingExtensions,
23+
// eslint-disable-next-line deprecation/deprecation
24+
Replay,
25+
// eslint-disable-next-line deprecation/deprecation
26+
Feedback,
27+
feedbackIntegration,
28+
replayIntegration,
29+
};
1330
// Note: We do not export a shim for `Span` here, as that is quite complex and would blow up the bundle

packages/browser/src/index.ts

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,11 @@ const INTEGRATIONS = {
2121

2222
export { INTEGRATIONS as Integrations };
2323

24-
export { Replay } from '@sentry/replay';
24+
export {
25+
// eslint-disable-next-line deprecation/deprecation
26+
Replay,
27+
replayIntegration,
28+
} from '@sentry/replay';
2529
export type {
2630
ReplayEventType,
2731
ReplayEventWithTime,
@@ -34,9 +38,18 @@ export type {
3438
ReplaySpanFrameEvent,
3539
} from '@sentry/replay';
3640

37-
export { ReplayCanvas } from '@sentry-internal/replay-canvas';
41+
export {
42+
// eslint-disable-next-line deprecation/deprecation
43+
ReplayCanvas,
44+
replayCanvasIntegration,
45+
} from '@sentry-internal/replay-canvas';
3846

39-
export { Feedback, sendFeedback } from '@sentry-internal/feedback';
47+
export {
48+
// eslint-disable-next-line deprecation/deprecation
49+
Feedback,
50+
feedbackIntegration,
51+
sendFeedback,
52+
} from '@sentry-internal/feedback';
4053

4154
export {
4255
BrowserTracing,

packages/browser/test/unit/index.bundle.feedback.test.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
import { BrowserTracing as BrowserTracingShim, Replay as ReplayShim } from '@sentry-internal/integration-shims';
2-
import { Feedback } from '@sentry/browser';
1+
/* eslint-disable deprecation/deprecation */
2+
import {
3+
BrowserTracing as BrowserTracingShim,
4+
Replay as ReplayShim,
5+
replayIntegration as replayIntegrationShim,
6+
} from '@sentry-internal/integration-shims';
7+
import { Feedback, feedbackIntegration } from '@sentry/browser';
38

49
import * as TracingReplayBundle from '../../src/index.bundle.feedback';
510

@@ -16,10 +21,12 @@ describe('index.bundle.feedback', () => {
1621

1722
expect(TracingReplayBundle.Integrations.Replay).toBe(ReplayShim);
1823
expect(TracingReplayBundle.Replay).toBe(ReplayShim);
24+
expect(TracingReplayBundle.replayIntegration).toBe(replayIntegrationShim);
1925

2026
expect(TracingReplayBundle.Integrations.BrowserTracing).toBe(BrowserTracingShim);
2127
expect(TracingReplayBundle.BrowserTracing).toBe(BrowserTracingShim);
2228

2329
expect(TracingReplayBundle.Feedback).toBe(Feedback);
30+
expect(TracingReplayBundle.feedbackIntegration).toBe(feedbackIntegration);
2431
});
2532
});

packages/browser/test/unit/index.bundle.replay.test.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1-
import { BrowserTracing as BrowserTracingShim, Feedback as FeedbackShim } from '@sentry-internal/integration-shims';
2-
import { Replay } from '@sentry/browser';
1+
/* eslint-disable deprecation/deprecation */
2+
import {
3+
BrowserTracing as BrowserTracingShim,
4+
Feedback as FeedbackShim,
5+
feedbackIntegration as feedbackIntegrationShim,
6+
} from '@sentry-internal/integration-shims';
7+
import { Replay, replayIntegration } from '@sentry/browser';
38

49
import * as TracingReplayBundle from '../../src/index.bundle.replay';
510

@@ -16,10 +21,12 @@ describe('index.bundle.replay', () => {
1621

1722
expect(TracingReplayBundle.Integrations.Replay).toBe(Replay);
1823
expect(TracingReplayBundle.Replay).toBe(Replay);
24+
expect(TracingReplayBundle.replayIntegration).toBe(replayIntegration);
1925

2026
expect(TracingReplayBundle.Integrations.BrowserTracing).toBe(BrowserTracingShim);
2127
expect(TracingReplayBundle.BrowserTracing).toBe(BrowserTracingShim);
2228

2329
expect(TracingReplayBundle.Feedback).toBe(FeedbackShim);
30+
expect(TracingReplayBundle.feedbackIntegration).toBe(feedbackIntegrationShim);
2431
});
2532
});

packages/browser/test/unit/index.bundle.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1+
/* eslint-disable deprecation/deprecation */
12
import {
23
BrowserTracing as BrowserTracingShim,
34
Feedback as FeedbackShim,
45
Replay as ReplayShim,
6+
feedbackIntegration as feedbackIntegrationShim,
7+
replayIntegration as replayIntegrationShim,
58
} from '@sentry-internal/integration-shims';
69

710
import * as TracingBundle from '../../src/index.bundle';
@@ -19,10 +22,12 @@ describe('index.bundle', () => {
1922

2023
expect(TracingBundle.Integrations.Replay).toBe(ReplayShim);
2124
expect(TracingBundle.Replay).toBe(ReplayShim);
25+
expect(TracingBundle.replayIntegration).toBe(replayIntegrationShim);
2226

2327
expect(TracingBundle.Integrations.BrowserTracing).toBe(BrowserTracingShim);
2428
expect(TracingBundle.BrowserTracing).toBe(BrowserTracingShim);
2529

2630
expect(TracingBundle.Feedback).toBe(FeedbackShim);
31+
expect(TracingBundle.feedbackIntegration).toBe(feedbackIntegrationShim);
2732
});
2833
});

packages/browser/test/unit/index.bundle.tracing.replay.feedback.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
/* eslint-disable deprecation/deprecation */
12
import { BrowserTracing } from '@sentry-internal/tracing';
2-
import { Feedback, Replay } from '@sentry/browser';
3+
import { Feedback, Replay, feedbackIntegration, replayIntegration } from '@sentry/browser';
34

45
import * as TracingReplayFeedbackBundle from '../../src/index.bundle.tracing.replay.feedback';
56

@@ -16,10 +17,12 @@ describe('index.bundle.tracing.replay.feedback', () => {
1617

1718
expect(TracingReplayFeedbackBundle.Integrations.Replay).toBe(Replay);
1819
expect(TracingReplayFeedbackBundle.Replay).toBe(Replay);
20+
expect(TracingReplayFeedbackBundle.replayIntegration).toBe(replayIntegration);
1921

2022
expect(TracingReplayFeedbackBundle.Integrations.BrowserTracing).toBe(BrowserTracing);
2123
expect(TracingReplayFeedbackBundle.BrowserTracing).toBe(BrowserTracing);
2224

2325
expect(TracingReplayFeedbackBundle.Feedback).toBe(Feedback);
26+
expect(TracingReplayFeedbackBundle.feedbackIntegration).toBe(feedbackIntegration);
2427
});
2528
});

0 commit comments

Comments
 (0)