Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(replay-vision): remove watch tab and add replay-off empty state (#119440)

Hayne Ryu24e3a6269ec8
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index df64c77257e4..900aef924d55 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -530,7 +530,7 @@ export const FEATURE_FLAGS = {
REPLAY_TRIGGERS_V2: 'replay-triggers-v2', // owner: #team-replay
REPLAY_UI_REDESIGN_2026: 'replay-ui-redesign-2026', // owner: #team-replay, New UI layout for replay
REPLAY_VISION_SCANNER_DASHBOARD: 'replay-vision-scanner-dashboard', // owner: #team-replay, one-click dashboard offer on the scanner overview and its MCP tool
- REPLAY_VISION_WATCH_IN_LIST_EXPERIMENT: 'replay-vision-watch-in-list-experiment', // owner: #team-replay multivariate=control,in-list,watch-tab,both. Compare the variant string, a truthy check turns on for control too
+ REPLAY_VISION_WATCH_IN_LIST_EXPERIMENT: 'replay-vision-watch-in-list-experiment-v2', // owner: #team-replay multivariate=control,in-list. Compare the variant string, a truthy check turns on for control too
REVAMPED_PY_NOTEBOOKS: 'revamped-py-notebooks', // owner: #team-data-tools
REVENUE_FIELDS_IN_POWER_USERS_TABLE: 'revenue-fields-in-power-users-table', // owner: @arthurdedeus #team-customer-analytics
REVIEW_HOG: 'review-hog', // owner: #team-devex, gates the Code review menu entry, scene, and API access
diff --git a/frontend/src/scenes/session-recordings/SessionRecordings.tsx b/frontend/src/scenes/session-recordings/SessionRecordings.tsx
index 92c3d97975d4..b458998a30f0 100644
--- a/frontend/src/scenes/session-recordings/SessionRecordings.tsx
+++ b/frontend/src/scenes/session-recordings/SessionRecordings.tsx
@@ -32,7 +32,6 @@ import { ProductKey } from '~/queries/schema/schema-general'
import { AccessControlLevel, AccessControlResourceType, ReplayTab, ReplayTabs } from '~/types'
import { sessionReplayEmptyState } from 'products/replay/frontend/emptyState/sessionReplayEmptyState'
-import { WatchPage } from 'products/replay_vision/frontend/replay_scanners/components/WatchPage'
import { SessionRecordingCollections } from './collections/SessionRecordingCollections'
import { SessionRecordingsPlaylistRedesign } from './playlist-redesign/SessionRecordingsPlaylistRedesign'
@@ -181,7 +180,7 @@ function AttachScenePlaylistLogic({
}
function MainPanel(): JSX.Element {
- const { tab, watchPicksVariant, showWatchTab } = useValues(sessionReplaySceneLogic)
+ const { tab, picksInList } = useValues(sessionReplaySceneLogic)
const isRedesignEnabled = useFeatureFlag('REPLAY_UI_REDESIGN_2026', 'test')
return (
@@ -196,20 +195,11 @@ function MainPanel(): JSX.Element {
{isRedesignEnabled ? (
<SessionRecordingsPlaylistRedesign {...SCENE_PLAYLIST_LOGIC_PROPS} />
) : (
- <SessionRecordingsPlaylist
- {...SCENE_PLAYLIST_LOGIC_PROPS}
- watchPicksVariant={watchPicksVariant}
- />
+ <SessionRecordingsPlaylist {...SCENE_PLAYLIST_LOGIC_PROPS} picksInList={picksInList} />
)}
</div>
) : tab === ReplayTabs.Playlists ? (
<SessionRecordingCollections />
- ) : tab === ReplayTabs.WhatToWatch ? (
- showWatchTab ? (
- <WatchPage />
- ) : (
- <Spinner />
- )
) : null}
</div>
)
@@ -231,23 +221,15 @@ const ReplayPageTabs: ReplayTab[] = [
},
]
-const WhatToWatchTab: ReplayTab = {
- label: 'What to watch',
- key: ReplayTabs.WhatToWatch,
- tooltip: 'Recordings that Replay vision scanners picked out for you',
- 'data-attr': 'session-recordings-what-to-watch-tab',
-}
-
export function SessionRecordingsPageTabs(): JSX.Element {
- const { tab, showWatchTab } = useValues(sessionReplaySceneLogic)
- const tabs = showWatchTab ? [WhatToWatchTab, ...ReplayPageTabs] : ReplayPageTabs
+ const { tab } = useValues(sessionReplaySceneLogic)
return (
<LemonTabs
activeKey={tab}
onChange={(t) => router.actions.push(urls.replay(t as ReplayTabs))}
sceneInset
className="-mt-4"
- tabs={tabs.map((replayTab): LemonTab<string> => {
+ tabs={ReplayPageTabs.map((replayTab): LemonTab<string> => {
return {
label: replayTab.label,
key: replayTab.key,
diff --git a/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx b/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx
index b8315593d20b..4760dd73e455 100644
--- a/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx
+++ b/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx
@@ -17,7 +17,6 @@ import { panelLayoutLogic } from '~/layout/panel-layout/panelLayoutLogic'
import { WatchPicksListColumn } from 'products/replay_vision/frontend/replay_scanners/components/WatchPicksListColumn'
import { watchPicksLogic } from 'products/replay_vision/frontend/replay_scanners/watchPicksLogic'
-import { WatchPicksVariant } from 'products/replay_vision/frontend/replay_scanners/watchPicksVariant'
import { RecordingsUniversalFiltersEmbed } from '../filters/RecordingsUniversalFiltersEmbed'
import { playerSettingsLogic } from '../player/playerSettingsLogic'
@@ -33,11 +32,11 @@ type SessionRecordingsPlaylistProps = SessionRecordingPlaylistLogicProps & {
description?: string
/** Replaces the shared replay troubleshooting panel when the list comes back empty. */
listEmptyState?: JSX.Element
- watchPicksVariant?: WatchPicksVariant | null
+ picksInList?: boolean
}
export function SessionRecordingsPlaylist({
- watchPicksVariant,
+ picksInList = false,
...props
}: SessionRecordingsPlaylistProps): JSX.Element {
const logicProps: SessionRecordingPlaylistLogicProps = {
@@ -57,7 +56,6 @@ export function SessionRecordingsPlaylist({
}
const isVerticalLayout = layoutRef.current
- const picksInList = watchPicksVariant === 'in-list' || watchPicksVariant === 'both'
const layout = (
<div className={cn('w-full h-full flex', isVerticalLayout ? 'flex-col' : 'flex-row gap-2')}>
{isVerticalLayout ? (
@@ -84,7 +82,7 @@ export function SessionRecordingsPlaylist({
)
}
-type LayoutProps = Omit<SessionRecordingsPlaylistProps, 'watchPicksVariant'> & { picksInList: boolean }
+type LayoutProps = Omit<SessionRecordingsPlaylistProps, 'picksInList'> & { picksInList: boolean }
function PlaylistColumn({ picksInList, ...props }: LayoutProps): JSX.Element {
const { isPlaylistCollapsed } = useValues(playerSettingsLogic)
diff --git a/frontend/src/scenes/session-recordings/sessionReplaySceneLogic.test.ts b/frontend/src/scenes/session-recordings/sessionReplaySceneLogic.test.ts
index 2ef374373b6f..9589ca49a87b 100644
--- a/frontend/src/scenes/session-recordings/sessionReplaySceneLogic.test.ts
+++ b/frontend/src/scenes/session-recordings/sessionReplaySceneLogic.test.ts
@@ -30,46 +30,34 @@ describe('sessionReplaySceneLogic', () => {
logic.unmount()
})
- describe('landing on the tab arms', () => {
- const land = (
- variant: string,
- path: string,
- params: Record<string, any> = {},
- otherFlags: Record<string, string> = {}
- ): void => {
+ describe('picks in the recordings list', () => {
+ const land = (variant: string, path: string, otherFlags: Record<string, string> = {}): void => {
logic.unmount()
featureFlagLogic.actions.setFeatureFlags([], {
[FEATURE_FLAGS.REPLAY_VISION_WATCH_IN_LIST_EXPERIMENT]: variant,
...otherFlags,
})
- router.actions.push(path, params)
+ router.actions.push(path)
logic = sessionReplaySceneLogic()
logic.mount()
}
it.each([
- ['the tab arm on the bare home route', 'watch-tab', '/replay/home', {}, '/replay/what-to-watch'],
- ['both arms on the bare home route', 'both', '/replay/home', {}, '/replay/what-to-watch'],
- ['the in-list arm', 'in-list', '/replay/home', {}, '/replay/home'],
- ['a deep link to a recording', 'watch-tab', '/replay/home', { sessionRecordingId: 'x' }, '/replay/home'],
- ['a link with filters', 'watch-tab', '/replay/home', { filters: { date_from: '-30d' } }, '/replay/home'],
- ['a saved filter link', 'watch-tab', '/replay/home', { savedFilterId: 'sf-1' }, '/replay/home'],
- ['another tab', 'watch-tab', '/replay/playlists', {}, '/replay/playlists'],
- ['a direct tab link on the tab arm', 'watch-tab', '/replay/what-to-watch', {}, '/replay/what-to-watch'],
- ['a direct tab link on control', 'control', '/replay/what-to-watch', {}, '/replay/home'],
- ['a direct tab link on the in-list arm', 'in-list', '/replay/what-to-watch', {}, '/replay/home'],
- ])('lands %s where expected', (_, variant, path, params, expected) => {
- land(variant, path, params)
- expect(router.values.location.pathname).toMatch(new RegExp(`${expected}$`))
+ ['the in-list arm', 'in-list', true],
+ ['control', 'control', false],
+ ['the watch-tab arm', 'watch-tab', false],
+ ['the both arm', 'both', false],
+ ])('shows picks for %s: %p', (_, variant, expected) => {
+ land(variant, '/replay/home')
+ expect(logic.values.picksInList).toBe(expected)
})
it('leaves users on the replay redesign out of the experiment', () => {
- land('both', '/replay/home', {}, { [FEATURE_FLAGS.REPLAY_UI_REDESIGN_2026]: 'test' })
- expect(logic.values.watchPicksVariant).toBeNull()
- expect(router.values.location.pathname).toMatch(/\/replay\/home$/)
+ land('in-list', '/replay/home', { [FEATURE_FLAGS.REPLAY_UI_REDESIGN_2026]: 'test' })
+ expect(logic.values.picksInList).toBe(false)
})
- it('hides every arm when the organization has not approved AI data processing', () => {
+ it('hides the picks when the organization has not approved AI data processing', () => {
logic.unmount()
playlistLogic.unmount()
initKeaTests(true, undefined, undefined, {
@@ -78,34 +66,18 @@ describe('sessionReplaySceneLogic', () => {
})
playlistLogic = sessionRecordingsPlaylistLogic(SCENE_PLAYLIST_LOGIC_PROPS)
playlistLogic.mount()
- land('both', '/replay/home')
- expect(logic.values.watchPicksVariant).toBeNull()
- expect(router.values.location.pathname).toMatch(/\/replay\/home$/)
+ land('in-list', '/replay/home')
+ expect(logic.values.picksInList).toBe(false)
})
it.each([
['Collections', '/replay/playlists', 'playlists'],
- ['What to watch', '/replay/what-to-watch', 'what-to-watch'],
['Recordings', '/replay/home', 'home'],
- ])('switches to %s after landing', (_, path, tab) => {
- land('both', '/replay/home')
+ ['an unknown route', '/replay/what-to-watch', 'home'],
+ ])('switches to %s', (_, path, tab) => {
+ land('in-list', '/replay/home')
router.actions.push(path)
expect(logic.values.tab).toBe(tab)
- expect(router.values.location.pathname).toMatch(new RegExp(`${path}$`))
- })
-
- it('redirects once per visit, so the Recordings tab stays reachable', () => {
- land('watch-tab', '/replay/home')
- router.actions.push('/replay/home')
- expect(router.values.location.pathname).toMatch(/\/replay\/home$/)
- })
-
- it('tells an automatic landing apart from a tab click', () => {
- land('watch-tab', '/replay/home')
- expect(logic.values.watchTabEntry).toBe('auto_landed')
- router.actions.push('/replay/home')
- router.actions.push('/replay/what-to-watch')
- expect(logic.values.watchTabEntry).toBe('tab')
})
})
diff --git a/frontend/src/scenes/session-recordings/sessionReplaySceneLogic.ts b/frontend/src/scenes/session-recordings/sessionReplaySceneLogic.ts
index e511e26407bf..616012ace760 100644
--- a/frontend/src/scenes/session-recordings/sessionReplaySceneLogic.ts
+++ b/frontend/src/scenes/session-recordings/sessionReplaySceneLogic.ts
@@ -5,7 +5,6 @@ import { FEATURE_FLAGS } from 'lib/constants'
import { FeatureFlagsSet, featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { trackedActionToUrl } from 'lib/logic/scenes/trackedActionToUrl'
import { capitalizeFirstLetter } from 'lib/utils/strings'
-import { organizationLogic } from 'scenes/organizationLogic'
import { sceneConfigurations } from 'scenes/scenes'
import { Scene } from 'scenes/sceneTypes'
import {
@@ -18,49 +17,17 @@ import { urls } from 'scenes/urls'
import { SIDE_PANEL_CONTEXT_KEY, SidePanelSceneContext } from '~/layout/navigation-3000/sidepanel/types'
import { ActivityScope, Breadcrumb, ReplayTabs } from '~/types'
-import {
- WatchPicksVariant,
- watchPicksVariantFromFlag,
-} from 'products/replay_vision/frontend/replay_scanners/watchPicksVariant'
-
-import type { OrganizationType } from '../../types'
+import { picksInListFromFlag } from 'products/replay_vision/frontend/replay_scanners/picksInList'
export const SCENE_PLAYLIST_LOGIC_PROPS: SessionRecordingPlaylistLogicProps = {
logicKey: 'scene',
updateSearchParams: true,
}
-export type WatchTabEntry = 'tab' | 'auto_landed'
-
export function replayUrlPointsSomewhere(searchParams: Record<string, any>, hashParams: Record<string, any>): boolean {
return Object.keys(searchParams).length > 0 || Boolean(hashParams.sessionRecordingId)
}
-function landOnWhatToWatch(
- values: Pick<
- sessionReplaySceneLogicValues,
- 'tab' | 'showWatchTab' | 'receivedFeatureFlags' | 'currentOrganization'
- >,
- cache: Record<string, any>
-): void {
- if (!values.receivedFeatureFlags || !values.currentOrganization) {
- return
- }
- const { searchParams, hashParams } = router.values
- if (values.tab === ReplayTabs.WhatToWatch && !values.showWatchTab) {
- router.actions.replace(urls.replay(ReplayTabs.Home), searchParams, hashParams)
- return
- }
- if (cache.landed) {
- return
- }
- cache.landed = true
- if (values.tab === ReplayTabs.Home && values.showWatchTab && !replayUrlPointsSomewhere(searchParams, hashParams)) {
- cache.autoLanding = true
- router.actions.replace(urls.replay(ReplayTabs.WhatToWatch), searchParams, hashParams)
- }
-}
-
export const humanFriendlyTabName = (tab: ReplayTabs): string => {
switch (tab) {
case ReplayTabs.Home:
@@ -69,8 +36,6 @@ export const humanFriendlyTabName = (tab: ReplayTabs): string => {
return 'Collections'
case ReplayTabs.Settings:
return 'Settings'
- case ReplayTabs.WhatToWatch:
- return 'What to watch'
default:
return capitalizeFirstLetter(tab)
}
@@ -80,49 +45,27 @@ export const humanFriendlyTabName = (tab: ReplayTabs): string => {
export interface sessionReplaySceneLogicValues {
dataProcessingAccepted: boolean // aiConsentLogic
featureFlags: FeatureFlagsSet // featureFlagLogic
- receivedFeatureFlags: boolean // featureFlagLogic
- currentOrganization: OrganizationType | null // organizationLogic
breadcrumbs: Breadcrumb[]
pickSeekSessionId: string | null
- showWatchTab: boolean
+ picksInList: boolean
sidePanelContext: SidePanelSceneContext
tab: ReplayTabs
- watchPicksVariant: WatchPicksVariant | null
- watchTabEntry: WatchTabEntry | null
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface sessionReplaySceneLogicActions {
- setFeatureFlags: (
- flags: string[],
- variants: Record<string, boolean | string>
- ) => {
- flags: string[]
- variants: Record<string, boolean | string>
- } // featureFlagLogic
- loadCurrentOrganizationSuccess: (
- currentOrganization: OrganizationType | null,
- payload?: any
- ) => {
- currentOrganization: OrganizationType | null
- payload?: any
- } // organizationLogic
setPickSeekSessionId: (sessionId: string | null) => {
sessionId: string | null
}
setTab: (tab?: ReplayTabs) => {
tab: ReplayTabs
}
- setWatchTabEntry: (entry: WatchTabEntry) => {
- entry: WatchTabEntry
- }
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface sessionReplaySceneLogicMeta {
__keaTypeGenInternalSelectorTypes: {
- watchPicksVariant: (featureFlags: FeatureFlagsSet, dataProcessingAccepted: boolean) => WatchPicksVariant | null
- showWatchTab: (watchPicksVariant: WatchPicksVariant | null) => boolean
+ picksInList: (featureFlags: FeatureFlagsSet, dataProcessingAccepted: boolean) => boolean
breadcrumbs: (tab: ReplayTabs) => Breadcrumb[]
sidePanelContext: (searchParams: Record<string, any>) => SidePanelSceneContext
}
@@ -138,28 +81,13 @@ export type sessionReplaySceneLogicType = MakeLogicType<
export const sessionReplaySceneLogic = kea<sessionReplaySceneLogicType>([
path(() => ['scenes', 'session-recordings', 'sessionReplaySceneLogic']),
connect(() => ({
- values: [
- featureFlagLogic,
- ['featureFlags', 'receivedFeatureFlags'],
- aiConsentLogic,
- ['dataProcessingAccepted'],
- organizationLogic,
- ['currentOrganization'],
- ],
- actions: [featureFlagLogic, ['setFeatureFlags'], organizationLogic, ['loadCurrentOrganizationSuccess']],
+ values: [featureFlagLogic, ['featureFlags'], aiConsentLogic, ['dataProcessingAccepted']],
})),
actions({
setTab: (tab: ReplayTabs = ReplayTabs.Home) => ({ tab }),
setPickSeekSessionId: (sessionId: string | null) => ({ sessionId }),
- setWatchTabEntry: (entry: WatchTabEntry) => ({ entry }),
}),
reducers(() => ({
- watchTabEntry: [
- null as WatchTabEntry | null,
- {
- setWatchTabEntry: (_, { entry }) => entry,
- },
- ],
tab: [
ReplayTabs.Home as ReplayTabs,
{
@@ -174,13 +102,7 @@ export const sessionReplaySceneLogic = kea<sessionReplaySceneLogicType>([
],
})),
- listeners(({ actions, values, cache }) => ({
- setFeatureFlags: () => {
- landOnWhatToWatch(values, cache)
- },
- loadCurrentOrganizationSuccess: () => {
- landOnWhatToWatch(values, cache)
- },
+ listeners(({ actions, values }) => ({
[sessionRecordingsPlaylistLogic(SCENE_PLAYLIST_LOGIC_PROPS).actionTypes.setSelectedRecordingId]: ({
id,
}: {
@@ -207,17 +129,12 @@ export const sessionReplaySceneLogic = kea<sessionReplaySceneLogicType>([
}),
selectors(() => ({
- watchPicksVariant: [
+ picksInList: [
(s) => [s.featureFlags, s.dataProcessingAccepted],
- (featureFlags: FeatureFlagsSet, dataProcessingAccepted: boolean): WatchPicksVariant | null =>
- dataProcessingAccepted && featureFlags[FEATURE_FLAGS.REPLAY_UI_REDESIGN_2026] !== 'test'
- ? watchPicksVariantFromFlag(featureFlags[FEATURE_FLAGS.REPLAY_VISION_WATCH_IN_LIST_EXPERIMENT])
- : null,
- ],
- showWatchTab: [
- (s) => [s.watchPicksVariant],
- (watchPicksVariant: WatchPicksVariant | null): boolean =>
- watchPicksVariant === 'watch-tab' || watchPicksVariant === 'both',
+ (featureFlags: FeatureFlagsSet, dataProcessingAccepted: boolean): boolean =>
+ dataProcessingAccepted &&
+ featureFlags[FEATURE_FLAGS.REPLAY_UI_REDESIGN_2026] !== 'test' &&
+ picksInListFromFlag(featureFlags[FEATURE_FLAGS.REPLAY_VISION_WATCH_IN_LIST_EXPERIMENT]),
],
breadcrumbs: [
(s) => [s.tab],
@@ -255,7 +172,7 @@ export const sessionReplaySceneLogic = kea<sessionReplaySceneLogicType>([
],
})),
- urlToAction(({ actions, values, cache }) => {
+ urlToAction(({ actions, values }) => {
return {
'/replay/:tab': ({ tab }) => {
// we saw a page get stuck in a redirect loop between recent and home
@@ -263,13 +180,8 @@ export const sessionReplaySceneLogic = kea<sessionReplaySceneLogicType>([
const candidateTab = tab as ReplayTabs
const validTab = Object.values(ReplayTabs).includes(candidateTab) ? candidateTab : ReplayTabs.Home
if (validTab !== values.tab) {
- if (validTab === ReplayTabs.WhatToWatch) {
- actions.setWatchTabEntry(cache.autoLanding ? 'auto_landed' : 'tab')
- }
actions.setTab(validTab)
}
- cache.autoLanding = false
- landOnWhatToWatch({ ...values, tab: validTab }, cache)
},
}
}),
diff --git a/frontend/src/types.ts b/frontend/src/types.ts
index 4e2ebc90523a..47c4e077b2b0 100644
--- a/frontend/src/types.ts
+++ b/frontend/src/types.ts
@@ -1150,7 +1150,6 @@ export enum ReplayTabs {
Home = 'home',
Playlists = 'playlists',
Settings = 'settings',
- WhatToWatch = 'what-to-watch',
}
export type ReplayTab = {
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPage.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchPage.tsx
deleted file mode 100644
index 67074f4a9190..000000000000
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPage.tsx
+++ /dev/null
@@ -1,91 +0,0 @@
-import { BindLogic, useActions, useValues } from 'kea'
-
-import { LemonBanner, LemonSkeleton } from '@posthog/lemon-ui'
-
-import type { WatchFeedItemApi } from '../../generated/api.schemas'
-import { TOP_PICKS_COUNT, watchPicksLogic } from '../watchPicksLogic'
-import { WatchPickRankedCard } from './WatchPickRankedCard'
-import { WatchPicksEmptyState } from './WatchPicksEmptyState'
-
-const WATCH_PAGE_LOGIC_KEY = 'what-to-watch'
-const GRID_CLASS_NAME = 'grid grid-cols-2 gap-x-4 gap-y-6 px-2 @3xl:grid-cols-3 @5xl:grid-cols-4 @6xl:grid-cols-5'
-
-function WatchGrid({
- title,
- items,
- ranked,
- surface,
-}: {
- title: string
- items: WatchFeedItemApi[]
- ranked: boolean
- surface: 'top_10' | 'more'
-}): JSX.Element | null {
- if (items.length === 0) {
- return null
- }
- return (
- <section className="flex flex-col gap-3">
- <h2 className="m-0 text-base font-semibold">{title}</h2>
- <div className={GRID_CLASS_NAME}>
- {items.map((item, index) => (
- <WatchPickRankedCard
- key={item.observation.id}
- item={item}
- position={ranked ? index : TOP_PICKS_COUNT + index}
- surface={surface}
- rank={ranked ? index + 1 : undefined}
- />
- ))}
- </div>
- </section>
- )
-}
-
-function WatchPageContent(): JSX.Element {
- const { picks, picksLoading, picksFailed, topPicks, moreItems } = useValues(watchPicksLogic)
- const { loadPicks } = useActions(watchPicksLogic)
-
- let body: JSX.Element
- if (picksLoading || (picks === null && !picksFailed)) {
- body = (
- <div className={GRID_CLASS_NAME} aria-busy>
- {[0, 1, 2, 3, 4].map((i) => (
- <LemonSkeleton key={i} className="aspect-video w-full rounded" />
- ))}
- </div>
- )
- } else if (picksFailed) {
- body = (
- <LemonBanner
- type="error"
- action={{ children: 'Try again', onClick: loadPicks, 'data-attr': 'vision-watch-page-retry' }}
- >
- Couldn't load what to watch.
- </LemonBanner>
- )
- } else if (topPicks.length === 0) {
- body = <WatchPicksEmptyState size="large" />
- } else {
- body = (
- <>
- <WatchGrid title="Top 10 this week" items={topPicks} ranked surface="top_10" />
- <WatchGrid title="More to watch" items={moreItems} ranked={false} surface="more" />
- </>
- )
- }
-
- return (
- <div className="@container flex flex-col gap-8 pb-16" data-attr="vision-watch-page">
- {body}
- </div>
- )
-}
-
-export function WatchPage(): JSX.Element {
- return (
- <BindLogic logic={watchPicksLogic} props={{ logicKey: WATCH_PAGE_LOGIC_KEY }}>
- <WatchPageContent />
- </BindLogic>
- )
-}
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPickRankedCard.test.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchPickRankedCard.test.tsx
deleted file mode 100644
index a13584442ae1..000000000000
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPickRankedCard.test.tsx
+++ /dev/null
@@ -1,58 +0,0 @@
-import { cleanup, fireEvent, render, screen } from '@testing-library/react'
-import { BindLogic } from 'kea'
-
-import { useMocks } from '~/mocks/jest'
-import { initKeaTests } from '~/test/init'
-
-import type { WatchFeedItemApi } from '../../generated/api.schemas'
-import { watchPicksLogic } from '../watchPicksLogic'
-import { WatchPickRankedCard } from './WatchPickRankedCard'
-
-jest.mock('../../components/ObservationThumbnail', () => ({
- ObservationThumbnail: () => <div data-attr="thumbnail" />,
-}))
-
-jest.mock('./WatchPickPreview', () => ({
- WatchPickPreview: () => <div data-attr="preview" />,
-}))
-
-const item = {
- observation: {
- id: 'observation-1',
- created_at: '2026-10-12T12:00:00Z',
- viewed: false,
- scanner_snapshot: null,
- scanner_result: null,
- },
- reason: { kind: 'recent' },
-} as WatchFeedItemApi
-
-describe('WatchPickRankedCard', () => {
- beforeEach(() => {
- initKeaTests()
- useMocks({ get: { '/api/projects/:team/vision/scanners/watch_feed/': [200, { results: [] }] } })
- })
- afterEach(() => cleanup())
-
- it.each(['mouseEnter', 'focus'] as const)('mounts its preview after %s and keeps it for later use', (event) => {
- const { container } = render(
- <BindLogic logic={watchPicksLogic} props={{ logicKey: 'test' }}>
- <WatchPickRankedCard item={item} position={0} surface="top_10" />
- </BindLogic>
- )
-
- const card = container.querySelector('[data-attr="vision-watch-ranked-card"]')!
- expect(screen.queryByTestId('preview')).toBeNull()
- expect(screen.getAllByTestId('thumbnail')).toHaveLength(1)
-
- if (event === 'focus') {
- fireEvent.focus(card.querySelector('button')!)
- } else {
- fireEvent.mouseEnter(card)
- }
-
- expect(screen.getByTestId('preview')).toBeTruthy()
- fireEvent.mouseLeave(card)
- expect(screen.getByTestId('preview')).toBeTruthy()
- })
-})
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPickRankedCard.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchPickRankedCard.tsx
deleted file mode 100644
index b66dd8602780..000000000000
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPickRankedCard.tsx
+++ /dev/null
@@ -1,123 +0,0 @@
-import { useActions } from 'kea'
-import { useState } from 'react'
-
-import { LemonButton, LemonTag } from '@posthog/lemon-ui'
-
-import { TZLabel } from 'lib/components/TZLabel'
-import { cn } from 'lib/utils/css-classes'
-
-import { ObservationThumbnail } from '../../components/ObservationThumbnail'
-import { scannerTypeIcon } from '../../components/ScannerTypeBadge'
-import { UnviewedObservationTag } from '../../components/UnviewedObservationTag'
-import type { WatchFeedItemApi } from '../../generated/api.schemas'
-import { citedTextToPlainText } from '../../utils/citations'
-import { SCANNER_TYPE_TAG_TYPE } from '../types'
-import { type WatchPickSurface, watchPicksLogic } from '../watchPicksLogic'
-import { watchPickSummary } from '../watchPickSummary'
-import { watchFeedRowWhy } from './WatchFeedCard'
-import { WatchPickPreview } from './WatchPickPreview'
-import { WatchPickRankBadge } from './WatchPickRankBadge'
-
-interface WatchPickRankedCardProps {
- item: WatchFeedItemApi
- position: number
- surface: WatchPickSurface
- rank?: number
-}
-
-const SCORE_DOTS = 5
-
-export function WatchPickRankedCard({ item, position, surface, rank }: WatchPickRankedCardProps): JSX.Element {
- const [hasOpenedPreview, setHasOpenedPreview] = useState(false)
- const { watchPick } = useActions(watchPicksLogic)
- const { observation, reason } = item
- const { title, scannerName, scannerType } = watchPickSummary(observation)
- const signalsCount = reason.signals_count ?? 0
- const notability = typeof reason.notability === 'number' ? reason.notability : null
-
- return (
- <div
- className="group relative"
- data-attr="vision-watch-ranked-card"
- onMouseEnter={() => setHasOpenedPreview(true)}
- onFocusCapture={() => setHasOpenedPreview(true)}
- >
- <LemonButton
- noPadding
- fullWidth
- onClick={() => watchPick(item, position, surface)}
- className="items-stretch"
- data-attr="vision-watch-ranked-poster"
- >
- <span className="flex w-full flex-col gap-1.5 text-left">
- <span className={cn('relative block overflow-hidden rounded', observation.viewed && 'opacity-60')}>
- <ObservationThumbnail observation={observation} className="w-full rounded-none border-0">
- <span className="sr-only">
- {title}. {citedTextToPlainText(watchFeedRowWhy(reason), undefined)}
- </span>
- </ObservationThumbnail>
- {rank !== undefined && <WatchPickRankBadge rank={rank} />}
- {!observation.viewed && (
- <UnviewedObservationTag className="pointer-events-none absolute right-2 top-2 z-10" />
- )}
- {signalsCount > 0 && (
- <span className="pointer-events-none absolute bottom-2 left-2 rounded bg-black/80 px-1.5 text-xxs font-semibold text-white">
- {signalsCount} {signalsCount === 1 ? 'signal' : 'signals'}
- </span>
- )}
- </span>
- <span className="flex gap-2">
- {scannerType && (
- <LemonTag
- type={SCANNER_TYPE_TAG_TYPE[scannerType]}
- className="h-7 w-7 shrink-0 justify-center rounded-full p-0 text-sm"
- title={scannerName}
- >
- {scannerTypeIcon(scannerType)}
- </LemonTag>
- )}
- <span className="flex min-w-0 flex-1 flex-col gap-0.5">
- <span className="truncate text-sm font-semibold">{title}</span>
- <span className="truncate text-xs font-normal text-secondary">
- <span>{scannerName}</span>
- <span> · </span>
- <TZLabel
- time={observation.created_at}
- showPopover={false}
- noStyles
- className="whitespace-nowrap"
- />
- </span>
- {notability !== null && (
- <span className="flex items-center gap-1" aria-label={`Score ${notability.toFixed(2)}`}>
- {Array.from({ length: SCORE_DOTS }, (_, dot) => (
- <span
- key={dot}
- className={cn(
- 'h-1.5 w-1.5 rounded-full',
- dot < Math.round(notability * SCORE_DOTS) ? 'bg-accent' : 'bg-border'
- )}
- />
- ))}
- <span className="ml-1 text-xxs font-normal text-secondary">
- {notability.toFixed(2)}
- </span>
- </span>
- )}
- </span>
- </span>
- </span>
- </LemonButton>
- <div
- aria-hidden
- className={cn(
- 'pointer-events-none absolute inset-x-0 top-0 z-20 origin-top scale-95 opacity-0',
- 'rounded border bg-bg-light p-2 shadow-lg transition motion-reduce:transition-none',
- 'group-hover:scale-105 group-hover:opacity-100 group-focus-within:scale-105 group-focus-within:opacity-100'
- )}
- >
- {hasOpenedPreview && <WatchPickPreview item={item} className="w-full" />}
- </div>
- </div>
- )
-}
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPickRow.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchPickRow.tsx
index 120c0be6d9f0..fb2a73cfcfe1 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPickRow.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/WatchPickRow.tsx
@@ -8,7 +8,7 @@ import { cn } from 'lib/utils/css-classes'
import { ObservationThumbnail } from '../../components/ObservationThumbnail'
import type { WatchFeedItemApi } from '../../generated/api.schemas'
import { citedTextToPlainText } from '../../utils/citations'
-import { type WatchPickSurface, watchPicksLogic } from '../watchPicksLogic'
+import { watchPicksLogic } from '../watchPicksLogic'
import { watchPickSummary } from '../watchPickSummary'
import { watchFeedRowWhy } from './WatchFeedCard'
import { WatchPickPreview } from './WatchPickPreview'
@@ -17,12 +17,11 @@ import { WatchPickRankBadge } from './WatchPickRankBadge'
interface WatchPickRowProps {
item: WatchFeedItemApi
position: number
- surface: WatchPickSurface
isActive: boolean
rank?: number
}
-export function WatchPickRow({ item, position, surface, isActive, rank }: WatchPickRowProps): JSX.Element {
+export function WatchPickRow({ item, position, isActive, rank }: WatchPickRowProps): JSX.Element {
const { watchPick } = useActions(watchPicksLogic)
const { observation, reason } = item
const { title, scannerName } = watchPickSummary(observation)
@@ -32,7 +31,7 @@ export function WatchPickRow({ item, position, surface, isActive, rank }: WatchP
fullWidth
size="small"
active={isActive}
- onClick={() => watchPick(item, position, surface)}
+ onClick={() => watchPick(item, position)}
tooltip={<WatchPickPreview item={item} />}
tooltipPlacement="right"
className="min-w-0"
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPicksEmptyState.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchPicksEmptyState.tsx
index 9bfd0f46f244..ef764e8088b2 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPicksEmptyState.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/WatchPicksEmptyState.tsx
@@ -3,24 +3,35 @@ import { useValues } from 'kea'
import { LemonSkeleton } from '@posthog/lemon-ui'
import { cn } from 'lib/utils/css-classes'
+import { teamLogic } from 'scenes/teamLogic'
import { visionQuotaLogic } from '../../logics/visionQuotaLogic'
import { visionScannersListLogic } from '../../logics/visionScannersListLogic'
import { resolveWatchFeedEmptyReason } from '../watchFeedEmptyState'
import { WatchPicksBlockedState } from './WatchPicksBlockedState'
import { WatchPicksQuietState } from './WatchPicksQuietState'
+import { WatchPicksReplayOffState } from './WatchPicksReplayOffState'
import { WatchPicksStarter } from './WatchPicksStarter'
export function WatchPicksEmptyState({ size }: { size: 'small' | 'large' }): JSX.Element {
const { scanners, scannersLoading } = useValues(visionScannersListLogic)
const { quota, quotaLoading } = useValues(visionQuotaLogic)
+ const { currentTeam } = useValues(teamLogic)
const large = size === 'large'
if (scannersLoading || quotaLoading) {
return <LemonSkeleton className={cn('w-full rounded', large ? 'h-64' : 'h-40')} />
}
- const reason = resolveWatchFeedEmptyReason({ scanners, quota, hasFeedFilters: false })
+ const reason = resolveWatchFeedEmptyReason({
+ scanners,
+ quota,
+ sessionRecordingOptIn: currentTeam?.session_recording_opt_in ?? null,
+ hasFeedFilters: false,
+ })
+ if (reason === 'replay-off') {
+ return <WatchPicksReplayOffState size={size} />
+ }
if (reason === 'no-scanners') {
return <WatchPicksStarter size={size} />
}
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPicksExtraRows.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchPicksExtraRows.tsx
index e2ede7c47aa9..a9a234d938e6 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPicksExtraRows.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/WatchPicksExtraRows.tsx
@@ -36,7 +36,6 @@ export function WatchPicksExtraRows(): JSX.Element | null {
key={observation.id}
item={{ observation, reason: { kind: 'recent' } } as WatchFeedItemApi}
position={index}
- surface="list"
isActive={false}
/>
))
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPicksList.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchPicksList.tsx
index ed762649fde0..a1369c7ceb48 100644
--- a/products/replay_vision/frontend/replay_scanners/components/WatchPicksList.tsx
+++ b/products/replay_vision/frontend/replay_scanners/components/WatchPicksList.tsx
@@ -67,7 +67,6 @@ export function WatchPicksList(): JSX.Element {
key={item.observation.id}
item={item}
position={index}
- surface="list"
rank={index < LIST_TOP_COUNT ? index + 1 : undefined}
isActive={item.observation.session_id === activeSessionId}
/>
diff --git a/products/replay_vision/frontend/replay_scanners/components/WatchPicksReplayOffState.tsx b/products/replay_vision/frontend/replay_scanners/components/WatchPicksReplayOffState.tsx
new file mode 100644
index 000000000000..59ca010476e3
--- /dev/null
+++ b/products/replay_vision/frontend/replay_scanners/components/WatchPicksReplayOffState.tsx
@@ -0,0 +1,56 @@
+import { useActions, useValues } from 'kea'
+
+import * as directorPng from '@posthog/brand/hoggies/png/director'
+import { LemonButton, Link } from '@posthog/lemon-ui'
+
+import { pngHoggie } from 'lib/brand/hoggies'
+import { RestrictionScope, useRestrictedArea } from 'lib/components/RestrictedArea'
+import { TeamMembershipLevel } from 'lib/constants'
+import { teamLogic } from 'scenes/teamLogic'
+import { urls } from 'scenes/urls'
+
+import { WatchPicksStateFrame } from './WatchPicksStateFrame'
+
+const HedgehogDirector = pngHoggie(directorPng)
+
+export function WatchPicksReplayOffState({ size }: { size: 'small' | 'large' }): JSX.Element {
+ const { currentTeamLoading } = useValues(teamLogic)
+ const { updateCurrentTeam } = useActions(teamLogic)
+ // Same gate as the settings toggle that writes this field (`ReplayGeneral`).
+ const restrictedReason = useRestrictedArea({
+ scope: RestrictionScope.Project,
+ minimumAccessLevel: TeamMembershipLevel.Admin,
+ })
+
+ return (
+ <WatchPicksStateFrame
+ size={size}
+ image={HedgehogDirector}
+ title="Session replay is off"
+ body="Scanners watch recordings, so there is nothing for them to see until recording is on. Recordings you already have stay available."
+ dataAttr="vision-watch-picks-replay-off"
+ footer={
+ <Link
+ to={urls.settings('environment-replay')}
+ className="mt-1"
+ data-attr="vision-watch-picks-replay-off-settings"
+ >
+ Replay settings
+ </Link>
+ }
+ >
+ <LemonButton
+ type="primary"
+ size={size === 'large' ? 'medium' : 'small'}
+ fullWidth
+ center
+ loading={currentTeamLoading}
+ disabledReason={restrictedReason ? 'Ask a project admin to turn on session replay' : null}
+ onClick={() => updateCurrentTeam({ session_recording_opt_in: true })}
+ data-attr="vision-watch-picks-replay-off-enable"
+ >
+ Turn on session replay
+ </LemonButton>
+ </WatchPicksStateFrame>
+ )
+}
diff --git a/products/replay_vision/frontend/replay_scanners/picksInList.ts b/products/replay_vision/frontend/replay_scanners/picksInList.ts
new file mode 100644
index 000000000000..8b794107e509
--- /dev/null
+++ b/products/replay_vision/frontend/replay_scanners/picksInList.ts
@@ -0,0 +1,3 @@
+export function picksInListFromFlag(value: string | boolean | undefined): boolean {
+ return value === 'in-list'
+}
diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedEmptyState.test.ts b/products/replay_vision/frontend/replay_scanners/watchFeedEmptyState.test.ts
index 9b7a718fd767..7ec8acae4b77 100644
--- a/products/replay_vision/frontend/replay_scanners/watchFeedEmptyState.test.ts
+++ b/products/replay_vision/frontend/replay_scanners/watchFeedEmptyState.test.ts
@@ -9,8 +9,10 @@ const quota = (exhausted: boolean): VisionQuotaApi => ({ exhausted }) as unknown
describe('resolveWatchFeedEmptyReason', () => {
// The precedence between these is the behavior under test: a reader told to clear their filters
// while every scanner is off would clear them and still face an empty feed.
- it.each<[string, ReplayScannerApi[], VisionQuotaApi | null, boolean, WatchFeedEmptyReason]>([
+ it.each<[string, ReplayScannerApi[], VisionQuotaApi | null, boolean, WatchFeedEmptyReason, (boolean | null)?]>([
['no scanners at all', [], quota(false), false, 'no-scanners'],
+ ['recording turned off, even with no scanners', [], quota(false), false, 'replay-off', false],
+ ['recording turned off, even with an exhausted budget', [scanner()], quota(true), false, 'replay-off', false],
[
'an exhausted budget, even with every scanner off',
[scanner({ enabled: false })],
@@ -53,7 +55,9 @@ describe('resolveWatchFeedEmptyReason', () => {
],
// Falls through rather than claiming a block it cannot see.
['a quiet window when the quota snapshot never answered', [scanner()], null, false, 'quiet-window'],
- ])('blames %s', (_name, scanners, quotaValue, hasFeedFilters, expected) => {
- expect(resolveWatchFeedEmptyReason({ scanners, quota: quotaValue, hasFeedFilters })).toBe(expected)
+ ])('blames %s', (_name, scanners, quotaValue, hasFeedFilters, expected, sessionRecordingOptIn = null) => {
+ expect(
+ resolveWatchFeedEmptyReason({ scanners, quota: quotaValue, sessionRecordingOptIn, hasFeedFilters })
+ ).toBe(expected)
})
})
diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedEmptyState.ts b/products/replay_vision/frontend/replay_scanners/watchFeedEmptyState.ts
index 19e09e02199a..88c7a47bac4c 100644
--- a/products/replay_vision/frontend/replay_scanners/watchFeedEmptyState.ts
+++ b/products/replay_vision/frontend/replay_scanners/watchFeedEmptyState.ts
@@ -5,6 +5,7 @@ import type { ReplayScannerApi, VisionQuotaApi } from '../generated/api.schemas'
* reader, so they get different copy and a different next step.
*/
export type WatchFeedEmptyReason =
+ | 'replay-off'
| 'no-scanners'
| 'quota-exhausted'
| 'all-disabled'
@@ -16,6 +17,8 @@ export interface WatchFeedEmptyInput {
scanners: ReplayScannerApi[]
/** Null when the snapshot has not answered, which reads here as "no block seen". */
quota: VisionQuotaApi | null
+ /** Null while the team has not loaded, which also reads as "no block seen". */
+ sessionRecordingOptIn: boolean | null
hasFeedFilters: boolean
}
@@ -26,8 +29,12 @@ export interface WatchFeedEmptyInput {
export function resolveWatchFeedEmptyReason({
scanners,
quota,
+ sessionRecordingOptIn,
hasFeedFilters,
}: WatchFeedEmptyInput): WatchFeedEmptyReason {
+ if (sessionRecordingOptIn === false) {
+ return 'replay-off'
+ }
if (scanners.length === 0) {
// The scene gate answers this one first, so the feed sees it only when the setup probe
// failed open. The tab still has to offer the way in.
diff --git a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts
index fd3046e96124..7e456905b411 100644
--- a/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/watchFeedLogic.ts
@@ -409,7 +409,8 @@ export const watchFeedLogic = kea<watchFeedLogicType>([
): WatchFeedEmptyReason | null =>
scannersLoading || quotaLoading
? null
- : resolveWatchFeedEmptyReason({ scanners, quota, hasFeedFilters }),
+ : // The feed does not say anything about recording being off; that card lives in the picks column.
+ resolveWatchFeedEmptyReason({ scanners, quota, sessionRecordingOptIn: null, hasFeedFilters }),
],
hasFeedFilters: [
(s) => [s.scannerIdsFilter, s.tagsFilter, s.createdByFilter, s.scannerTypeFilter, s.search],
diff --git a/products/replay_vision/frontend/replay_scanners/watchPicksLogic.test.ts b/products/replay_vision/frontend/replay_scanners/watchPicksLogic.test.ts
index 2f1602f8d24d..3bee442f9ce3 100644
--- a/products/replay_vision/frontend/replay_scanners/watchPicksLogic.test.ts
+++ b/products/replay_vision/frontend/replay_scanners/watchPicksLogic.test.ts
@@ -7,8 +7,8 @@ import { sessionRecordingsPlaylistLogic } from 'scenes/session-recordings/playli
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
+import { picksInListFromFlag } from './picksInList'
import { emptyImpressionsStorageKey, picksShownCountStorageKey, watchPicksLogic } from './watchPicksLogic'
-import { watchPicksVariantFromFlag } from './watchPicksVariant'
describe('watchPicksLogic', () => {
let feedSpy: jest.Mock
@@ -42,13 +42,13 @@ describe('watchPicksLogic', () => {
})
it.each([
- ['in-list', 'in-list'],
- ['watch-tab', 'watch-tab'],
- ['both', 'both'],
- ['control', null],
- [undefined, null],
- ])('maps flag value %p to variant %p', (flagValue, variant) => {
- expect(watchPicksVariantFromFlag(flagValue)).toBe(variant)
+ ['in-list', true],
+ ['control', false],
+ ['watch-tab', false],
+ ['both', false],
+ [undefined, false],
+ ])('maps flag value %p to picks in the list: %p', (flagValue, expected) => {
+ expect(picksInListFromFlag(flagValue)).toBe(expected)
})
describe('inside a recordings list', () => {
@@ -164,7 +164,7 @@ describe('watchPicksLogic', () => {
it('selects the pick, seeks ahead of its key moment, and marks it viewed for this person', async () => {
expect(logic.values.unwatchedCount).toBe(3)
await expectLogic(logic, () => {
- logic.actions.watchPick(logic.values.picks![0], 0, 'list')
+ logic.actions.watchPick(logic.values.picks![0], 0)
})
.toDispatchActions([playlistLogic.actionCreators.setSelectedRecordingId('session-a')])
.toFinishAllListeners()
@@ -176,34 +176,4 @@ describe('watchPicksLogic', () => {
expect(viewedSpy.mock.calls[0][0].request.url).toContain('/vision/observations/o1/viewed/')
})
})
-
- describe('on the What to watch page', () => {
- let logic: ReturnType<typeof watchPicksLogic.build>
-
- beforeEach(async () => {
- logic = watchPicksLogic({ logicKey: 'test-page' })
- logic.mount()
- await expectLogic(logic).toDispatchActions(['loadPicksSuccess']).toFinishAllListeners()
- })
-
- afterEach(() => {
- logic.unmount()
- })
-
- it.each([
- ['with a key moment', 0, 'session-a', 42],
- ['without one', 2, 'session-b', undefined],
- ])('opens the pick on the Recordings tab %s', async (_, index, sessionId, t) => {
- await expectLogic(logic, () => {
- logic.actions.watchPick(logic.values.picks![index], index, 'top_10')
- }).toFinishAllListeners()
- expect(router.values.location.pathname).toMatch(/\/replay\/home$/)
- expect(router.values.searchParams).toMatchObject({
- sessionRecordingId: sessionId,
- sidebarTab: 'observations',
- showInspector: true,
- })
- expect(router.values.searchParams.t).toBe(t)
- })
- })
})
diff --git a/products/replay_vision/frontend/replay_scanners/watchPicksLogic.ts b/products/replay_vision/frontend/replay_scanners/watchPicksLogic.ts
index f01f27e56b45..da176b9255c0 100644
--- a/products/replay_vision/frontend/replay_scanners/watchPicksLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/watchPicksLogic.ts
@@ -25,29 +25,26 @@ import {
} from 'scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic'
import { replayUrlPointsSomewhere, sessionReplaySceneLogic } from 'scenes/session-recordings/sessionReplaySceneLogic'
import { teamLogic } from 'scenes/teamLogic'
-import { urls } from 'scenes/urls'
-import { ReplayTabs, SessionRecordingSidebarTab } from '~/types'
+import { SessionRecordingSidebarTab } from '~/types'
import { visionObservationsViewedCreate, visionScannersWatchFeedRetrieve } from '../generated/api'
import type { WatchFeedItemApi } from '../generated/api.schemas'
import { observationKeyMomentMs, watchStartSeconds } from './components/WatchFeedCard'
export type WatchPicksListMode = 'recordings' | 'picks'
-export type WatchPickSurface = 'list' | 'top_10' | 'more'
export interface WatchPicksLogicProps {
logicKey: string
- playlistLogicProps?: SessionRecordingPlaylistLogicProps
+ playlistLogicProps: SessionRecordingPlaylistLogicProps
}
-export const TOP_PICKS_COUNT = 10
const PICKS_LIMIT = 50
const PICKS_DATE_FROM = '-7d'
// Survey display conditions can only trigger on an event name, so the third
-// impression of the picks (on the Watch tab or the in-list toggle) is reported
-// as its own event. The impression count lives in this browser only
+// impression of the picks in the list is reported as its own event. The
+// impression count lives in this browser only
export const PICKS_SHOWN_SURVEY_IMPRESSION = 3
const teamStorageKey = (key: string) => (): string =>
`${key}.${teamLogic.findMounted()?.values.currentTeamId ?? 'unknown'}`
@@ -65,12 +62,10 @@ export interface watchPicksLogicValues {
effectiveListMode: WatchPicksListMode
emptyImpressionsAtMount: number
listMode: WatchPicksListMode | null
- moreItems: WatchFeedItemApi[]
openedOnDeepLink: boolean
picks: WatchFeedItemApi[] | null
picksFailed: boolean
picksLoading: boolean
- topPicks: WatchFeedItemApi[]
unwatchedCount: number
}
@@ -111,12 +106,10 @@ export interface watchPicksLogicActions {
}
watchPick: (
item: WatchFeedItemApi,
- position: number,
- surface: WatchPickSurface
+ position: number
) => {
item: WatchFeedItemApi
position: number
- surface: WatchPickSurface
}
}
@@ -130,9 +123,7 @@ export interface watchPicksLogicMeta {
picksFailed: boolean,
emptyImpressionsAtMount: number
) => WatchPicksListMode
- topPicks: (picks: WatchFeedItemApi[] | null) => WatchFeedItemApi[]
unwatchedCount: (picks: WatchFeedItemApi[] | null) => number
- moreItems: (picks: WatchFeedItemApi[] | null) => WatchFeedItemApi[]
}
}
@@ -156,11 +147,7 @@ export const watchPicksLogic: LogicWrapper<watchPicksLogicType> = kea<watchPicks
loadPicks: true,
setListMode: (mode: WatchPicksListMode) => ({ mode }),
adoptPicksMode: true,
- watchPick: (item: WatchFeedItemApi, position: number, surface: WatchPickSurface) => ({
- item,
- position,
- surface,
- }),
+ watchPick: (item: WatchFeedItemApi, position: number) => ({ item, position }),
setActiveSessionId: (sessionId: string | null) => ({ sessionId }),
markPickViewed: (observationId: string) => ({ observationId }),
}),
@@ -184,7 +171,7 @@ export const watchPicksLogic: LogicWrapper<watchPicksLogicType> = kea<watchPicks
],
})),
- reducers(({ props }) => ({
+ reducers(() => ({
picks: {
markPickViewed: (state, { observationId }) =>
state?.map((pick) =>
@@ -202,13 +189,7 @@ export const watchPicksLogic: LogicWrapper<watchPicksLogicType> = kea<watchPicks
},
],
emptyImpressionsAtMount: [emptyImpressions.get() ?? 0, {}],
- openedOnDeepLink: [
- Boolean(
- props.playlistLogicProps &&
- replayUrlPointsSomewhere(router.values.searchParams, router.values.hashParams)
- ),
- {},
- ],
+ openedOnDeepLink: [replayUrlPointsSomewhere(router.values.searchParams, router.values.hashParams), {}],
picksFailed: [
false,
{
@@ -238,47 +219,35 @@ export const watchPicksLogic: LogicWrapper<watchPicksLogicType> = kea<watchPicks
? 'recordings'
: 'picks'),
],
- topPicks: [
- (s) => [s.picks],
- (picks: WatchFeedItemApi[] | null): WatchFeedItemApi[] => (picks ?? []).slice(0, TOP_PICKS_COUNT),
- ],
unwatchedCount: [
(s) => [s.picks],
(picks: WatchFeedItemApi[] | null): number =>
(picks ?? []).filter((pick) => !pick.observation.viewed).length,
],
- moreItems: [
- (s) => [s.picks],
- (picks: WatchFeedItemApi[] | null): WatchFeedItemApi[] => (picks ?? []).slice(TOP_PICKS_COUNT),
- ],
}),
listeners(({ actions, props, values, cache }) => {
const reportPicksShown = (): void => {
- if (!values.picks || (props.playlistLogicProps && values.effectiveListMode !== 'picks')) {
+ if (!values.picks || values.effectiveListMode !== 'picks') {
return
}
if (values.picks.length === 0) {
- if (props.playlistLogicProps && values.listMode === null && !cache.emptyImpressionNoted) {
+ if (values.listMode === null && !cache.emptyImpressionNoted) {
cache.emptyImpressionNoted = true
emptyImpressions.set((emptyImpressions.get() ?? 0) + 1)
}
return
}
- const view = props.playlistLogicProps ? 'list' : 'page'
const shownCount = (picksShownCount.get() ?? 0) + 1
picksShownCount.set(shownCount)
posthog.capture('replay_vision_watch_picks_shown', {
- view,
- entry: props.playlistLogicProps
- ? undefined
- : sessionReplaySceneLogic.findMounted()?.values.watchTabEntry,
+ view: 'list',
count: values.picks.length,
unwatched_count: values.unwatchedCount,
shown_count: shownCount,
})
if (shownCount === PICKS_SHOWN_SURVEY_IMPRESSION) {
- posthog.capture('replay_vision_watch_picks_shown_third_time', { view })
+ posthog.capture('replay_vision_watch_picks_shown_third_time', { view: 'list' })
}
}
return {
@@ -295,7 +264,7 @@ export const watchPicksLogic: LogicWrapper<watchPicksLogicType> = kea<watchPicks
reportPicksShown()
}
},
- watchPick: async ({ item, position, surface }) => {
+ watchPick: async ({ item, position }) => {
const { observation, reason } = item
const keyMomentMs = observationKeyMomentMs(observation)
posthog.capture('replay_vision_watch_clip_clicked', {
@@ -306,7 +275,7 @@ export const watchPicksLogic: LogicWrapper<watchPicksLogicType> = kea<watchPicks
reason_kind: reason.kind,
has_key_moment: keyMomentMs !== null,
target: 'replay_page',
- view: surface,
+ view: 'list',
})
const playerParams = {
t: keyMomentMs === null ? undefined : watchStartSeconds(keyMomentMs),
@@ -319,17 +288,10 @@ export const watchPicksLogic: LogicWrapper<watchPicksLogicType> = kea<watchPicks
: null
sessionReplaySceneLogic.findMounted()?.actions.setPickSeekSessionId(observation.session_id)
const { location, searchParams, hashParams } = router.values
- if (props.playlistLogicProps) {
- router.actions.replace(location.pathname, { ...searchParams, ...playerParams }, hashParams)
- sessionRecordingsPlaylistLogic(props.playlistLogicProps).actions.setSelectedRecordingId(
- observation.session_id
- )
- } else {
- router.actions.push(urls.replay(ReplayTabs.Home), {
- sessionRecordingId: observation.session_id,
- ...playerParams,
- })
- }
+ router.actions.replace(location.pathname, { ...searchParams, ...playerParams }, hashParams)
+ sessionRecordingsPlaylistLogic(props.playlistLogicProps).actions.setSelectedRecordingId(
+ observation.session_id
+ )
if (!markViewed) {
return
}
@@ -343,9 +305,11 @@ export const watchPicksLogic: LogicWrapper<watchPicksLogicType> = kea<watchPicks
actions.markPickViewed(observation.id)
}
},
- [props.playlistLogicProps
- ? sessionRecordingsPlaylistLogic(props.playlistLogicProps).actionTypes.setSelectedRecordingId
- : 'watchPicksLogic/noPlaylist']: ({ id }: { id: string | null }) => {
+ [sessionRecordingsPlaylistLogic(props.playlistLogicProps).actionTypes.setSelectedRecordingId]: ({
+ id,
+ }: {
+ id: string | null
+ }) => {
actions.setActiveSessionId(id)
},
}
diff --git a/products/replay_vision/frontend/replay_scanners/watchPicksStaleLogic.ts b/products/replay_vision/frontend/replay_scanners/watchPicksStaleLogic.ts
index 4eb0ae839c5f..ba424cdac8e3 100644
--- a/products/replay_vision/frontend/replay_scanners/watchPicksStaleLogic.ts
+++ b/products/replay_vision/frontend/replay_scanners/watchPicksStaleLogic.ts
@@ -19,6 +19,8 @@ import posthog from 'lib/posthog-typed'
import { SessionRecordingPlaylistLogicProps } from 'scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic'
import { teamLogic } from 'scenes/teamLogic'
+import type { TeamPublicType, TeamType } from '~/types'
+
import {
visionScannersBackfillsCreate,
visionScannersBackfillsEstimateCreate,
@@ -61,11 +63,12 @@ export interface QuietWeekStats {
export interface WatchPicksStaleLogicProps {
logicKey: string
- playlistLogicProps?: SessionRecordingPlaylistLogicProps
+ playlistLogicProps: SessionRecordingPlaylistLogicProps
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
export interface watchPicksStaleLogicValues {
+ currentTeam: TeamPublicType | TeamType | null // teamLogic
currentTeamId: number | null // teamLogic
quota: VisionQuotaApi | null // visionQuotaLogic
scanners: ReplayScannerApi[] // visionScannersListLogic
@@ -246,7 +249,11 @@ export interface watchPicksStaleLogicActions {
export interface watchPicksStaleLogicMeta {
key: string
__keaTypeGenInternalSelectorTypes: {
- blockReason: (scanners: ReplayScannerApi[], quota: VisionQuotaApi | null) => WatchFeedEmptyReason
+ blockReason: (
+ scanners: ReplayScannerApi[],
+ quota: VisionQuotaApi | null,
+ currentTeam: TeamPublicType | TeamType | null
+ ) => WatchFeedEmptyReason
staleReason: (
picks: WatchFeedItemApi[] | null,
blockReason: WatchFeedEmptyReason,
@@ -278,7 +285,7 @@ export const watchPicksStaleLogic: LogicWrapper<watchPicksStaleLogicType> = kea<
connect((props: WatchPicksStaleLogicProps) => ({
values: [
teamLogic,
- ['currentTeamId'],
+ ['currentTeamId', 'currentTeam'],
visionScannersListLogic,
['scanners'],
visionQuotaLogic,
@@ -446,9 +453,18 @@ export const watchPicksStaleLogic: LogicWrapper<watchPicksStaleLogicType> = kea<
selectors({
blockReason: [
- (s) => [s.scanners, s.quota],
- (scanners: ReplayScannerApi[], quota: VisionQuotaApi | null): WatchFeedEmptyReason =>
- resolveWatchFeedEmptyReason({ scanners, quota, hasFeedFilters: false }),
+ (s) => [s.scanners, s.quota, s.currentTeam],
+ (
+ scanners: ReplayScannerApi[],
+ quota: VisionQuotaApi | null,
+ currentTeam: TeamPublicType | TeamType | null
+ ): WatchFeedEmptyReason =>
+ resolveWatchFeedEmptyReason({
+ scanners,
+ quota,
+ sessionRecordingOptIn: currentTeam?.session_recording_opt_in ?? null,
+ hasFeedFilters: false,
+ }),
],
staleReason: [
(s) => [s.picks, s.blockReason, s.droughtScannerIds, s.now],
diff --git a/products/replay_vision/frontend/replay_scanners/watchPicksVariant.ts b/products/replay_vision/frontend/replay_scanners/watchPicksVariant.ts
deleted file mode 100644
index fcba2014167d..000000000000
--- a/products/replay_vision/frontend/replay_scanners/watchPicksVariant.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-export type WatchPicksVariant = 'in-list' | 'watch-tab' | 'both'
-
-export function watchPicksVariantFromFlag(value: string | boolean | undefined): WatchPicksVariant | null {
- return value === 'in-list' || value === 'watch-tab' || value === 'both' ? value : null
-}