Skip to content

Commit 601512d

Browse files
committed
feat(inbox): track first session-recording video play per signal card
Fires Inbox report action with action_type: play_session_recording the first time a user clicks play on the inline session replay inside an Evidence card. Per-card guard via ref so repeat plays during the same open don't spam the event stream.
1 parent 17d8dc0 commit 601512d

3 files changed

Lines changed: 11 additions & 2 deletions

File tree

apps/code/src/renderer/features/inbox/components/detail/SignalCard.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,8 @@ function SessionRecordingVideo({
679679
}) {
680680
const projectId = useAuthStateValue((state) => state.projectId);
681681
const videoRef = useRef<HTMLVideoElement>(null);
682+
const hasFiredPlayRef = useRef(false);
683+
const interaction = useSignalInteraction();
682684
const videoQuery = useAuthenticatedQuery<string | null>(
683685
["export-video", projectId, exportedAssetId, sessionId],
684686
async (client) => {
@@ -718,6 +720,11 @@ function SessionRecordingVideo({
718720
muted
719721
preload="metadata"
720722
className="max-h-[300px] w-full rounded"
723+
onPlay={() => {
724+
if (hasFiredPlayRef.current) return;
725+
hasFiredPlayRef.current = true;
726+
interaction?.onInteraction({ type: "play_session_recording" });
727+
}}
721728
/>
722729
</Box>
723730
);

apps/code/src/renderer/features/inbox/components/detail/signalInteractionContext.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ export type SignalInteractionAction =
88
type: "expand_signal_section";
99
section: "relevant_code" | "data_queried";
1010
}
11-
| { type: "view_signal_external" };
11+
| { type: "view_signal_external" }
12+
| { type: "play_session_recording" };
1213

1314
export interface SignalInteractionContextValue {
1415
signal: Signal;

apps/code/src/shared/types/analytics.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,8 @@ export type InboxReportActionType =
374374
| "view_signal_external"
375375
| "expand_why"
376376
| "click_suggested_reviewer"
377-
| "expand_task_section";
377+
| "expand_task_section"
378+
| "play_session_recording";
378379

379380
export type InboxReportActionSurface =
380381
| "detail_pane"

0 commit comments

Comments
 (0)