Skip to content

Commit b163f54

Browse files
committed
WIP
1 parent 0f2d390 commit b163f54

25 files changed

+497
-815
lines changed

packages/replay/jest.setup.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,21 +129,23 @@ function checkCallForSentReplay(
129129
}
130130

131131
/**
132-
* Only want calls that send replay events, i.e. ignore error events
133-
*/
132+
* Only want calls that send replay events, i.e. ignore error events
133+
*/
134134
function getReplayCalls(calls: any[][][]): any[][][] {
135-
return calls.map(call => {
136-
const arg = call[0];
135+
return calls
136+
.map(call => {
137+
const arg = call[0];
137138
if (arg.length !== 2) {
138139
return [];
139140
}
140141

141-
if (!arg[1][0].find(({type}: {type: string}) => ['replay_event', 'replay_recording'].includes(type))) {
142+
if (!arg[1][0].find(({ type }: { type: string }) => ['replay_event', 'replay_recording'].includes(type))) {
142143
return [];
143144
}
144145

145-
return [ arg ];
146-
}).filter(Boolean);
146+
return [arg];
147+
})
148+
.filter(Boolean);
147149
}
148150

149151
/**
@@ -159,9 +161,11 @@ const toHaveSentReplay = function (
159161

160162
let result: CheckCallForSentReplayResult;
161163

162-
const expectedKeysLength = expected ? ('sample' in expected ? Object.keys(expected.sample) : Object.keys(expected)).length : 0;
164+
const expectedKeysLength = expected
165+
? ('sample' in expected ? Object.keys(expected.sample) : Object.keys(expected)).length
166+
: 0;
163167

164-
const replayCalls = getReplayCalls(calls)
168+
const replayCalls = getReplayCalls(calls);
165169

166170
for (const currentCall of replayCalls) {
167171
result = checkCallForSentReplay.call(this, currentCall[0], expected);
@@ -213,7 +217,7 @@ const toHaveLastSentReplay = function (
213217
expected?: SentReplayExpected | { sample: SentReplayExpected; inverse: boolean },
214218
) {
215219
const { calls } = (getCurrentHub().getClient()?.getTransport()?.send as MockTransport).mock;
216-
const replayCalls = getReplayCalls(calls)
220+
const replayCalls = getReplayCalls(calls);
217221

218222
const lastCall = replayCalls[calls.length - 1]?.[0];
219223

packages/replay/src/constants.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,6 @@ export const UNABLE_TO_SEND_REPLAY = 'Unable to send Replay';
1414
// The idle limit for a session after which recording is paused.
1515
export const SESSION_IDLE_PAUSE_DURATION = 300_000; // 5 minutes in ms
1616

17-
// The idle limit for a session after which the session expires.
18-
export const SESSION_IDLE_EXPIRE_DURATION = 900_000; // 15 minutes in ms
19-
2017
// The maximum length of a session
2118
export const MAX_SESSION_LIFE = 3_600_000; // 60 minutes in ms
2219

packages/replay/src/coreHandlers/util/addBreadcrumbEvent.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ export function addBreadcrumbEvent(replay: ReplayContainer, breadcrumb: Breadcru
1515
if (['ui.click', 'ui.input'].includes(breadcrumb.category as string)) {
1616
replay.triggerUserActivity();
1717
} else {
18-
replay.checkAndHandleExpiredSession();
18+
replay.checkSessionState(() => {
19+
// noop
20+
});
1921
}
2022

2123
replay.addUpdate(() => {

0 commit comments

Comments
 (0)