Skip to content

Commit 591f9cb

Browse files
authored
ref(replay): Split replay integration & container class (#6407)
1 parent 7e05eb4 commit 591f9cb

File tree

12 files changed

+1375
-1299
lines changed

12 files changed

+1375
-1299
lines changed

packages/replay/MIGRATION.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,14 @@ Unless you manually imported this and used it somewhere in your codebase, this w
6262

6363
The `Session` object exported from Replay is now a plain object, instead of a class.
6464
This should not affect you unless you specifically accessed this class & did custom things with it.
65+
66+
## Reduce public API of Replay integration (https://github.com/getsentry/sentry-javascript/pull/6407)
67+
68+
The result of `new Replay()` now has a much more limited public API. Only the following methods are exposed:
69+
70+
```js
71+
const replay = new Replay();
72+
73+
replay.start();
74+
replay.stop();
75+
```

packages/replay/jest.setup.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { getCurrentHub } from '@sentry/core';
33
import { Transport } from '@sentry/types';
44

5-
import { Replay } from './src';
5+
import { ReplayContainer } from './src/replay';
66
import { Session } from './src/session/Session';
77

88
// @ts-ignore TS error, this is replaced in prod builds bc of rollup
@@ -54,7 +54,7 @@ type SentReplayExpected = {
5454
};
5555

5656
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
57-
const toHaveSameSession = function (received: jest.Mocked<Replay>, expected: undefined | Session) {
57+
const toHaveSameSession = function (received: jest.Mocked<ReplayContainer>, expected: undefined | Session) {
5858
const pass = this.equals(received.session?.id, expected?.id) as boolean;
5959

6060
const options = {
@@ -77,7 +77,7 @@ const toHaveSameSession = function (received: jest.Mocked<Replay>, expected: und
7777
*/
7878
// eslint-disable-next-line @typescript-eslint/explicit-function-return-type
7979
const toHaveSentReplay = function (
80-
_received: jest.Mocked<Replay>,
80+
_received: jest.Mocked<ReplayContainer>,
8181
expected?: SentReplayExpected | { sample: SentReplayExpected; inverse: boolean },
8282
) {
8383
const { calls } = (getCurrentHub().getClient()?.getTransport()?.send as MockTransport).mock;

0 commit comments

Comments
 (0)