: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(replay-vision): single-column scanner goal flow with starter chips (#125436)
Tue Haulundcbb7b0195976
diff --git a/frontend/snapshots.yml b/frontend/snapshots.ymlindex 4bf56017a44e..52dd430ac6a6 100644--- a/frontend/snapshots.yml+++ b/frontend/snapshots.yml@@ -14915,21 +14915,21 @@ snapshots:scenes-app-replay-vision--scanner-editor-details--light:hash: v1.k794b7964.19a64be73e7d959d5ee9b27e7283435a586c5a9b2e88b744e280faa422bba8e8.-Mf1tjDk0h59T6Rc8FgC27_NU1gprPxENsDtU5j7DOcscenes-app-replay-vision--scanner-editor-goal-flow--dark:- hash: v1.k794b7964.54704e12a4eb28c568f1d7341371eb85b8626b88258f316cf635286ebb4e0eb8.JtMuT9-1OV64NzYC-PcNEqIErarlvklO9kSY4o3N37g+ hash: v1.k794b7964.cd984590beeaee923ccb7c402862eb50d4227a1a5fd906404941bdc6b55b2a5c.c7ZpjZGutjvHxVj2CJM4lr-j7S36Hg1KE0QzO0kRrUoscenes-app-replay-vision--scanner-editor-goal-flow--light:- hash: v1.k794b7964.25084193b6d9cab0c0a3dc32fd6c37e7016558e4c3fba4c86b1131fcc289957f.A9CGMyFwJTyhWBfMhdee4G0z9xIA6TKpRSzXPzQy4c0+ hash: v1.k794b7964.23b4b830381c8b7cf3ce1b1515b77fa6ab573f483d3ce41e90a141e4e776d4c3.8JIELuOgXTxa6b24Qx6lY4EtEq4x3TVlpqZ6Zy04vQYscenes-app-replay-vision--scanner-editor-goal-flow-budget--dark:- hash: v1.k794b7964.e2705e239e1a6672e94eb02fc950d2094aa95cffee45e35e33f3559f8d9b2b93.OsYebZ5z1RH9ZtCu7qzPpTF-B4K6F9V0RIHC2rCciBw+ hash: v1.k794b7964.b333d78584cd878fa8cefb3bba4157326e54816e4ca4d9d8e512fda098237f47.kkuzSjpFTIpGWAV93v64bHDDvacbodFzHmvn9NtDiQ8scenes-app-replay-vision--scanner-editor-goal-flow-budget--light:- hash: v1.k794b7964.ca24f01a3effee13d19793a4b4fd605fc0f8a5854a2b0e3b5baa178a6b633525.MHIx1hcEg293rab3A9jdDui_roCGkI0fx2tXe9IatJo+ hash: v1.k794b7964.34307b830997324937d9420b8769c2e2ea6e8cd3145a1bcd878abb5835402c94.X51sNtFf_G-ZmQwcDfN4sv48aLw7AXwUYwPII_XK9Xsscenes-app-replay-vision--scanner-editor-goal-flow-experiment-picker--dark:- hash: v1.k794b7964.f1247b2971a6ab8374f9f13621c6f0b0cf485d236c9a558e30810b0b36878e2f.W7uleyArqU6QfEOkfcKNLZc5uDvq1EoNdInoFhgU9n4+ hash: v1.k794b7964.eeda310d01e282c752430430a4b972ec179c23a7b53e629992d452ec69aaa79f.V0cm1AmuVp6cS1XBiyUoW3K6S8p6cTroMYMTqencHt0scenes-app-replay-vision--scanner-editor-goal-flow-experiment-picker--light:- hash: v1.k794b7964.b3b45ed3eddd8ec2e840bd2b104c53ba1cfe6a87b47a6317c9a17ecc0b334e6b.9vETW_3OtRofQAYJGFZTAl8eoKbObJYoYjgTXNyP_is+ hash: v1.k794b7964.5b2b3c0cc84424998d40a4903f4dc059583a8e984e67f6a738e1b9992bc07820.najKTcYqucA14Edj8GFa6y0CR9-Z5j1U8zRAeLN8TJ0scenes-app-replay-vision--scanner-editor-goal-flow-free-credits-used--dark:- hash: v1.k794b7964.d2db049b60b3bcb759a3138690b42f282f9ae3078581d4599dddf12a53075a72.GPwi_5NVsaumACfLGDzoDIcLhWHlPVOrOS_94Hq0kr0+ hash: v1.k794b7964.b735162aeef859da36f4d482aa407dc151032ba360e153099a5d6fb288e10a22.ml1LcXoRnZ5ZX2NMsAuGV_C24TLVaIDyv0bxM_FBIHgscenes-app-replay-vision--scanner-editor-goal-flow-free-credits-used--light:- hash: v1.k794b7964.65f60feba780547af4bb28bc645480b51ac7c8542e0b229e45549aee3f138ddf.N4bplBQaXdxjuGW9DwU9X5HLZe9_Lh6Dy7FkjzQA6a0+ hash: v1.k794b7964.09ae31022ce412751e72f9759a55c65b54cec8f63e9eaa120a12db3e1fe98270.iXOnpVNGw2S547KjZXDZXUNYzV1BiTgDJIElkoHQ84Uscenes-app-replay-vision--scanner-editor-goal-overview--dark:hash: v1.k794b7964.550f2fc3a84920af0ffbf9a2f19a4cc714855750c2605507cbfa2b05d275e298.iI1fBr0ozGusjUuDT7lSeuXATIMcWpX34HnIhOT5bOEscenes-app-replay-vision--scanner-editor-goal-overview--light:diff --git a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsxindex 8400975fa575..26eed316d7e1 100644--- a/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx+++ b/products/replay_vision/frontend/replay_scanners/ReplayScannersScene.stories.tsx@@ -1984,7 +1984,7 @@ export const StartupProgramCap: StoryObj = {],}-// The goal step: a typed goal and budget on the left, one-click starting points on the right.+// The goal step: one goal box with starters that fill it, a budget, and a single draft button.export const ScannerEditorGoalFlow: StoryObj = {parameters: {pageUrl: urls.replayVisionScannerGoal('new'),@@ -2308,21 +2308,19 @@ export const ScannerEditorGoalFlowBudget: StoryObj = {],}-// "Track an experiment" opened and an experiment picked: the starter lists running experiments and drafts an-// experiment scanner on the one picked.+// An experiment picked from the "Track an experiment" chip: the pick fills the goal box, links the experiment+// to the draft, and the chip shows its name.export const ScannerEditorGoalFlowExperimentPicker: StoryObj = {parameters: {pageUrl: urls.replayVisionScannerGoal('new'),},play: async ({ canvasElement }) => {- const canvas = within(canvasElement)- await userEvent.click(await canvas.findByText('Track an experiment'))- const picker = await waitFor(() => {- const button = canvasElement.querySelector('[data-attr="vision-goal-starter-experiment-picker"]')+ const chip = await waitFor(() => {+ const button = canvasElement.querySelector('[data-attr="vision-goal-starter-experiment"]')expect(button).not.toHaveClass('LemonButton--loading')return button as HTMLElement})- await userEvent.click(picker)+ await userEvent.click(chip)await userEvent.click(await within(document.body).findByText('AI creation flow'))},}diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerGoalExperimentStarter.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerGoalExperimentStarter.tsxindex a4125407dd7d..3eb350c374ba 100644--- a/products/replay_vision/frontend/replay_scanners/components/ScannerGoalExperimentStarter.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerGoalExperimentStarter.tsx@@ -1,30 +1,28 @@import { useActions, useValues } from 'kea'-import { useEffect, useState } from 'react'+import { useEffect } from 'react'-import { IconChevronRight, IconFlask } from '@posthog/icons'-import { LemonButton, LemonInput, LemonSelect } from '@posthog/lemon-ui'--import { cn } from 'lib/utils/css-classes'+import { IconFlask } from '@posthog/icons'+import { LemonInput, LemonSelect } from '@posthog/lemon-ui'import type { ExperimentBasicApi } from 'products/experiments/frontend/generated/api.schemas'import { experimentScannerPickerLogic } from '../experimentScannerPickerLogic'export interface ScannerGoalExperimentStarterProps {+ experiment: ExperimentBasicApi | nulldisabledReason: string | null- onDraft: (goal: string, experimentId: number) => void+ onChange: (experiment: ExperimentBasicApi | null) => void}export function ScannerGoalExperimentStarter({+ experiment,disabledReason,- onDraft,+ onChange,}: ScannerGoalExperimentStarterProps): JSX.Element | null {const { experimentOptions, experimentOptionsLoading, hasLoadedOptions, loadFailed, search } =useValues(experimentScannerPickerLogic)const { ensureOptionsLoaded, setSearch } = useActions(experimentScannerPickerLogic)- const [open, setOpen] = useState(false)- // Kept as the object because a later search can drop the picked experiment from the options.- const [experiment, setExperiment] = useState<ExperimentBasicApi | null>(null)+ // The picked experiment is kept as the object because a later search can drop it from the options.const options =experiment && !experimentOptions.some((option) => option.id === experiment.id)? [experiment, ...experimentOptions]@@ -35,98 +33,68 @@ export function ScannerGoalExperimentStarter({}, [ensureOptionsLoaded])// Hidden until the first load answers, and when the project runs no experiment to pick. A failed load- // still shows the starter so that opening the menu can retry.- if (!loadFailed && (!hasLoadedOptions || (!search && options.length === 0))) {+ // still shows the starter so that opening the menu can retry. A picked experiment always shows, so that+ // the user can clear it.+ if (!experiment && !loadFailed && (!hasLoadedOptions || (!search && options.length === 0))) {return null}return (- <div className="flex flex-col gap-2">- <LemonButton- fullWidth- icon={<IconFlask />}- sideIcon={<IconChevronRight className={cn('transition-transform', open && 'rotate-90')} />}- tooltip="Pick a running experiment and see how people experience each variant"- disabledReason={disabledReason}- onClick={() => setOpen(!open)}- data-attr="vision-goal-starter-experiment"- >- Track an experiment- </LemonButton>- {open ? (- <div className="flex flex-col gap-2 pl-8">- <div className="flex flex-col gap-0.5">- <span className="text-sm font-semibold">Pick an experiment</span>- <span className="text-xs text-muted">- The agent drafts a scanner that watches the people in this experiment and describes how each- variant plays out for them.- </span>- </div>- <LemonSelect<number>- fullWidth- placeholder="Select a running experiment"- loading={experimentOptionsLoading}- value={experiment?.id}- menu={{ onVisibilityChange: (visible) => visible && ensureOptionsLoaded() }}- options={[- {- title: (- // The menu closes on any click inside it, which would dismiss it when the search box is clicked.- <div onClick={(e) => e.stopPropagation()}>- <LemonInput- type="search"- size="small"- fullWidth- autoFocus- placeholder="Search experiments"- value={search}- onChange={setSearch}- data-attr="vision-goal-starter-experiment-search"- />- </div>- ),- // LemonSelect drops a section with no options, and the search box with it.- options:- options.length > 0- ? options.map((option) => ({ value: option.id, label: option.name }))- : [- {- value: 0,- label: experimentOptionsLoading- ? 'Searching...'- : loadFailed- ? "Couldn't load running experiments"- : 'No running experiments match your search',- disabledReason: loadFailed- ? 'Close and reopen this menu to try again'- : 'Try a different search',- },- ],- },- ]}- onChange={(id) => setExperiment(options.find((option) => option.id === id) ?? null)}- data-attr="vision-goal-starter-experiment-picker"- />- <div className="flex justify-end">- <LemonButton- type="primary"- size="small"- disabledReason={disabledReason ?? (experiment ? null : 'Select an experiment first')}- onClick={() => {- if (experiment) {- onDraft(- `Track how people experience the "${experiment.name}" experiment`,- experiment.id- )- }- }}- data-attr="vision-goal-starter-experiment-draft"- >- Draft my scanner- </LemonButton>- </div>- </div>- ) : null}- </div>+ <LemonSelect<number>+ allowClear+ type="secondary"+ size="xsmall"+ icon={<IconFlask />}+ active={!!experiment}+ tooltip="The scanner watches the users in this experiment and describes how each variant plays out for them."+ disabledReason={disabledReason ?? undefined}+ loading={experimentOptionsLoading}+ value={experiment?.id ?? null}+ renderButtonContent={() => (experiment ? `Experiment: ${experiment.name}` : 'Track an experiment')}+ dropdownMatchSelectWidth={false}+ dropdownPlacement="bottom-start"+ menu={{+ className: 'min-w-80',+ onVisibilityChange: (visible) => visible && ensureOptionsLoaded(),+ }}+ options={[+ {+ title: (+ // The menu closes on any click inside it, which would dismiss it when the search box is clicked.+ <div onClick={(e) => e.stopPropagation()}>+ <LemonInput+ type="search"+ size="small"+ fullWidth+ autoFocus+ placeholder="Search running experiments"+ value={search}+ onChange={setSearch}+ data-attr="vision-goal-starter-experiment-search"+ />+ </div>+ ),+ // LemonSelect drops a section with no options, and the search box with it.+ options:+ options.length > 0+ ? options.map((option) => ({ value: option.id, label: option.name }))+ : [+ {+ value: 0,+ label: experimentOptionsLoading+ ? 'Searching...'+ : loadFailed+ ? "Couldn't load running experiments"+ : 'No running experiments match your search',+ disabledReason: loadFailed+ ? 'Close and reopen this menu to try again'+ : 'Try a different search',+ },+ ],+ },+ ]}+ onChange={(id) => onChange(options.find((option) => option.id === id) ?? null)}+ data-attr="vision-goal-starter-experiment"+ />)}diff --git a/products/replay_vision/frontend/replay_scanners/components/ScannerGoalFlow.tsx b/products/replay_vision/frontend/replay_scanners/components/ScannerGoalFlow.tsxindex 620a552aedc5..c38db35b0c6a 100644--- a/products/replay_vision/frontend/replay_scanners/components/ScannerGoalFlow.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/ScannerGoalFlow.tsx@@ -1,19 +1,21 @@import { useActions, useValues } from 'kea'import { useState } from 'react'-import { IconChevronRight, IconPlus, IconSparkles } from '@posthog/icons'+import { IconPlus, IconSparkles } from '@posthog/icons'import { LemonButton, LemonInput, LemonSegmentedButton, LemonTextArea } from '@posthog/lemon-ui'import { PopoverReferenceContext } from 'lib/lemon-ui/Popover/Popover'import { aiConsentLogic } from 'scenes/settings/organization/aiConsentLogic'import { AIConsentPopoverWrapper } from 'scenes/settings/organization/AIConsentPopoverWrapper'+import type { ExperimentBasicApi } from 'products/experiments/frontend/generated/api.schemas'+import { visionQuotaLogic } from '../../logics/visionQuotaLogic'import { getReplayVisionEditDisabledReason } from '../../utils/accessControl'import { creditsToUsd, formatCreditCount } from '../../utils/credits'import { GoalDraftRequest, GoalSpendMode, goalSpendChoice, replayScannerLogic } from '../replayScannerLogic'import { ScannerGoalExperimentStarter } from './ScannerGoalExperimentStarter'-import { SCANNER_GOAL_STARTERS, ScannerGoalStarter } from './scannerGoalStarters'+import { SCANNER_GOAL_STARTERS } from './scannerGoalStarters'import { ScannerResumeDraftBanner } from './ScannerResumeDraftBanner'import { startScannerFromScratch } from './startScannerFromScratch'@@ -22,14 +24,23 @@ import { startScannerFromScratch } from './startScannerFromScratch'const MIN_SCAN_BUDGET = 1const MAX_SCAN_BUDGET = 100000000-/** The goal-based creation flow: a typed goal and a monthly budget on the left, one-click starting- * points on the right. Both draft a full scanner through the agent and land the user on the overview- * step to review it, so a one-click start still gets a scanner fitted to the project. */+const experimentGoal = (experiment: ExperimentBasicApi): string =>+ `Track how users experience the "${experiment.name}" experiment`++/** The goal-based creation flow: one goal box, starters that fill it, a monthly budget, and a single+ * button that drafts the scanner through the agent and lands the user on the overview step to review it. */export function ScannerGoalFlow(): JSX.Element {const logic = replayScannerLogic({ id: 'new' })- const { goalDraftInput, goalBudgetInput, goalSpendMode, goalDraftLoading, linkedExperimentContext } =- useValues(logic)- const { draftScannerFromGoal, setGoalDraftInput, setGoalBudgetInput, setGoalSpendMode } = useActions(logic)+ const {+ goalDraftInput,+ goalBudgetInput,+ goalSpendMode,+ goalDraftLoading,+ goalExperiment: experiment,+ linkedExperimentContext,+ } = useValues(logic)+ const { draftScannerFromGoal, setGoalDraftInput, setGoalBudgetInput, setGoalSpendMode, setGoalExperiment } =+ useActions(logic)const { dataProcessingAccepted } = useValues(aiConsentLogic)const { freeCreditsLeft } = useValues(visionQuotaLogic)// The spend choice is captured with the goal, so a quota that loads while consent is open cannot change it.@@ -42,18 +53,36 @@ export function ScannerGoalFlow(): JSX.Element {const budgetValid =spendMode === 'free' ||(goalBudgetInput != null && goalBudgetInput >= MIN_SCAN_BUDGET && goalBudgetInput <= MAX_SCAN_BUDGET)- const startDisabledReason =- editDisabledReason ??- (!budgetValid ? 'Enter a monthly credit budget' : goalDraftLoading ? 'Drafting your scanner' : null)-- const typedGoalDisabledReason =- startDisabledReason ?? (!goalDraftInput.trim() ? 'Describe what you want to find out' : null)+ const starterDisabledReason = editDisabledReason ?? (goalDraftLoading ? 'Drafting your scanner' : null)+ const submitDisabledReason =+ starterDisabledReason ??+ (!goalDraftInput.trim()+ ? 'Describe what you want to find out'+ : !budgetValid+ ? 'Enter a monthly credit budget'+ : null)+ // A starter counts only while its goal is unedited, so the funnel can split typed goals from starter ones.+ const activeStarter = SCANNER_GOAL_STARTERS.find((starter) => starter.goal === goalDraftInput.trim())- const start = (goal: string, templateKey?: string, experimentId?: number): void => {- if (!spendChoice.spend) {+ const changeExperiment = (picked: ExperimentBasicApi | null): void => {+ if (picked) {+ setGoalDraftInput(experimentGoal(picked))+ } else if (experiment && goalDraftInput.trim() === experimentGoal(experiment)) {+ setGoalDraftInput('')+ }+ setGoalExperiment(picked)+ }+ const submit = (): void => {+ const goal = goalDraftInput.trim()+ if (submitDisabledReason || !spendChoice.spend) {return}- const request: GoalDraftRequest = { goal, spend: spendChoice.spend, templateKey, experimentId }+ const request: GoalDraftRequest = {+ goal,+ spend: spendChoice.spend,+ templateKey: experiment ? 'track_experiment' : activeStarter?.key,+ experimentId: experiment?.id,+ }// Drafting calls an AI endpoint the backend rejects without org consent; interpose the// popover instead of letting the request 400.if (!dataProcessingAccepted) {@@ -62,19 +91,9 @@ export function ScannerGoalFlow(): JSX.Element {}draftScannerFromGoal(request)}- const startFromTypedGoal = (): void => {- if (!typedGoalDisabledReason) {- start(goalDraftInput.trim())- }- }- const startFromStarter = (starter: ScannerGoalStarter): void => {- if (!startDisabledReason) {- start(starter.goal, starter.key)- }- }return (- <div className="@container flex flex-col gap-4">+ <div className="flex flex-col gap-4 w-full max-w-3xl mx-auto"><ScannerResumeDraftBanner /><AIConsentPopoverWrapperplacement="bottom"@@ -90,11 +109,12 @@ export function ScannerGoalFlow(): JSX.Element {}}onDismiss={() => setPendingDraft(null)}>- <div className="grid grid-cols-1 @3xl:grid-cols-2 gap-4">- <div className="rounded-lg border-2 border-[var(--color-ai)] p-4 flex flex-col gap-4">+ <div className="rounded-lg border-2 border-[var(--color-ai)] p-4 flex flex-col gap-4">+ {/* The card is the consent popover's reference, which would give its buttons dropdown arrows. */}+ <PopoverReferenceContext.Provider value={null}><div className="flex flex-col gap-1"><label htmlFor="vision-goal-flow-goal" className="text-sm font-semibold">- Which sessions should the scanner watch for you and what should it find out?+ Describe your goal</label><LemonTextAreaid="vision-goal-flow-goal"@@ -106,42 +126,67 @@ export function ScannerGoalFlow(): JSX.Element {data-attr="vision-goal-flow-goal"/><div className="text-xs text-muted">- Say what to learn and which part of the product to watch. The agent maps it onto your+ Say which sessions to watch and what to learn from them. The agent maps it onto yourreal pages.</div>{/* A draft restored from an earlier experiment-scoped session keeps its targeting- through this flow, so say whose sessions the scanner ends up watching. */}- {linkedExperimentContext ? (+ through this flow, so say whose sessions the scanner ends up watching. */}+ {linkedExperimentContext && !experiment ? (<div className="text-xs text-muted">- This scanner keeps watching people exposed to{' '}+ This scanner keeps watching users exposed to{' '}{linkedExperimentContext.experiment.name}. You don't have to mention the experiment.</div>) : null}</div><div className="flex flex-col gap-2">- <span className="text-sm font-semibold">How much should this scanner use?</span>- {/* The card sits inside the consent popover's reference, which would give these buttons dropdown arrows. */}- <PopoverReferenceContext.Provider value={null}>- <LemonSegmentedButton<GoalSpendMode>- size="small"- value={spendMode}- onChange={setGoalSpendMode}- options={[- {- value: 'free',- label: 'Free',- disabledReason: spendChoice.freeDisabledReason ?? undefined,- 'data-attr': 'vision-goal-flow-spend-free',- },- {- value: 'budget',- label: 'Set a budget',- 'data-attr': 'vision-goal-flow-spend-budget',- },- ]}+ <span className="text-sm font-semibold">Or start from a common question</span>+ <div className="flex flex-wrap gap-2">+ {SCANNER_GOAL_STARTERS.map((starter) => (+ <LemonButton+ key={starter.key}+ type="secondary"+ size="xsmall"+ icon={starter.icon}+ active={!experiment && activeStarter?.key === starter.key}+ disabledReason={starterDisabledReason}+ onClick={() => {+ setGoalExperiment(null)+ setGoalDraftInput(starter.goal)+ }}+ data-attr={`vision-goal-starter-${starter.key}`}+ >+ {starter.question}+ </LemonButton>+ ))}+ <ScannerGoalExperimentStarter+ experiment={experiment}+ disabledReason={starterDisabledReason}+ onChange={changeExperiment}/>- </PopoverReferenceContext.Provider>+ </div>+ </div>++ <div className="flex flex-col gap-2">+ <span className="text-sm font-semibold">How much should this scanner use?</span>+ <LemonSegmentedButton<GoalSpendMode>+ size="small"+ value={spendMode}+ onChange={setGoalSpendMode}+ options={[+ {+ value: 'free',+ label: 'Free',+ disabledReason: spendChoice.freeDisabledReason ?? undefined,+ 'data-attr': 'vision-goal-flow-spend-free',+ },+ {+ value: 'budget',+ label: 'Set a budget',+ 'data-attr': 'vision-goal-flow-spend-budget',+ },+ ]}+ />{spendMode === 'free' ? (<div className="text-xs text-muted">The scanner only uses your free monthly credits@@ -179,7 +224,7 @@ export function ScannerGoalFlow(): JSX.Element {)}</div>- <div className="flex items-center justify-between mt-auto">+ <div className="flex items-center justify-between"><div className="flex items-center gap-1.5 text-xs text-tertiary"><IconSparkles className="text-ai size-3.5" /><span>PostHog AI</span>@@ -187,44 +232,14 @@ export function ScannerGoalFlow(): JSX.Element {<LemonButtontype="primary"loading={goalDraftLoading}- // Inside the consent popover's reference, so Lemon would add a dropdown chevron.- sideIcon={null}- disabledReason={typedGoalDisabledReason}- onClick={startFromTypedGoal}+ disabledReason={submitDisabledReason}+ onClick={submit}data-attr="vision-goal-flow-submit">Draft my scanner</LemonButton></div>- </div>-- <div className="rounded-lg border border-border bg-bg-light p-4 flex flex-col gap-2">- <span className="text-sm font-semibold">Common starting points</span>- <span className="text-xs text-muted">One click drafts a scanner fitted to your project.</span>- <div className="flex flex-col gap-1">- {SCANNER_GOAL_STARTERS.map((starter) => (- <LemonButton- key={starter.key}- fullWidth- icon={starter.icon}- sideIcon={<IconChevronRight />}- tooltip={starter.goal}- disabledReason={startDisabledReason}- onClick={() => startFromStarter(starter)}- data-attr={`vision-goal-starter-${starter.key}`}- >- {starter.question}- </LemonButton>- ))}- {/* Inside the consent popover's reference, which would give its buttons dropdown arrows. */}- <PopoverReferenceContext.Provider value={null}>- <ScannerGoalExperimentStarter- disabledReason={startDisabledReason}- onDraft={(goal, experimentId) => start(goal, 'track_experiment', experimentId)}- />- </PopoverReferenceContext.Provider>- </div>- </div>+ </PopoverReferenceContext.Provider></div></AIConsentPopoverWrapper>diff --git a/products/replay_vision/frontend/replay_scanners/components/scannerGoalStarters.tsx b/products/replay_vision/frontend/replay_scanners/components/scannerGoalStarters.tsxindex 9c7dca196e46..98eb0c240b48 100644--- a/products/replay_vision/frontend/replay_scanners/components/scannerGoalStarters.tsx+++ b/products/replay_vision/frontend/replay_scanners/components/scannerGoalStarters.tsx@@ -12,32 +12,32 @@ export interface ScannerGoalStarter {export const SCANNER_GOAL_STARTERS: readonly ScannerGoalStarter[] = [{key: 'dead_end',- goal: 'Find sessions where people get stuck on a page with no clear next step',- question: 'Where do people get stuck?',+ goal: 'Find sessions where users get stuck on a page with no clear next step',+ question: 'Where do users get stuck?',icon: <IconWarning />,},{key: 'session_summary',- goal: 'Summarize what people do in each session and where they run into trouble',+ goal: 'Summarize what users do in each session and where they run into trouble',question: 'What happens in each session?',icon: <IconNotebook />,},{key: 'user_intent',- goal: 'Find out what people are trying to do when they visit',- question: 'What are people trying to do?',+ goal: 'Find out what users are trying to do when they visit',+ question: 'What are users trying to do?',icon: <IconTarget />,},{key: 'frustration_score',- goal: 'Find out where people get frustrated and how badly',- question: 'Where do people get frustrated?',+ goal: 'Find out where users get frustrated and how badly',+ question: 'Where do users get frustrated?',icon: <IconThumbsDown />,},{key: 'session_outcome',- goal: 'Find out whether people finish what they came to do, give up, or hit an error',- question: 'Do people finish what they came to do?',+ goal: 'Find out whether users finish what they came to do, give up, or hit an error',+ question: 'Do users finish what they came to do?',icon: <IconCheckCircle />,},]diff --git a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.tsindex dd41c34cf76a..ba3aabf511f2 100644--- a/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts+++ b/products/replay_vision/frontend/replay_scanners/replayScannerLogic.ts@@ -35,6 +35,8 @@ import { urls } from 'scenes/urls'import { SIDE_PANEL_CONTEXT_KEY, SidePanelSceneContext } from '~/layout/navigation-3000/sidepanel/types'import { NodeKind, type RecordingsQuery } from '~/queries/schema/schema-general'+import type { ExperimentBasicApi } from 'products/experiments/frontend/generated/api.schemas'+import {visionScannersAffectedCohortCreate,visionScannersCreate,@@ -534,6 +536,7 @@ export interface replayScannerLogicValues {goalDraft: DraftScannerResponseApi | nullgoalDraftInput: stringgoalDraftLoading: boolean+ goalExperiment: ExperimentBasicApi | nullgoalSpendMode: GoalSpendModehasActiveObservationFilters: booleanhasObservationsInFlight: boolean@@ -794,6 +797,9 @@ export interface replayScannerLogicActions {setGoalDraftInput: (goal: string) => {goal: string}+ setGoalExperiment: (experiment: ExperimentBasicApi | null) => {+ experiment: ExperimentBasicApi | null+ }setGoalSpendMode: (mode: GoalSpendMode) => {mode: GoalSpendMode}@@ -1041,6 +1047,7 @@ export const replayScannerLogic = kea<replayScannerLogicType>([clearClassifierTags: true,draftScannerFromGoal: (request: GoalDraftRequest) => ({ request }),setGoalDraftInput: (goal: string) => ({ goal }),+ setGoalExperiment: (experiment: ExperimentBasicApi | null) => ({ experiment }),setGoalBudgetInput: (budget: number | null) => ({ budget }),setGoalSpendMode: (mode: GoalSpendMode) => ({ mode }),loadObservations: (background = false) => ({ background }),@@ -1318,6 +1325,16 @@ export const replayScannerLogic = kea<replayScannerLogicType>([scannerSaved: () => '',},],+ // Picked from the goal flow's experiment starter, and sent with the goal even after the goal is edited.+ goalExperiment: [+ null as ExperimentBasicApi | null,+ {+ setGoalExperiment: (_, { experiment }) => experiment,+ startFromScratch: () => null,+ discardScannerDraft: () => null,+ scannerSaved: () => null,+ },+ ],// The monthly credit budget input on the goal-based creation flow, used when the person sets a budget.goalBudgetInput: [DEFAULT_GOAL_BUDGET as number | null,@@ -2279,7 +2296,8 @@ export const replayScannerLogic = kea<replayScannerLogicType>([draftScannerFromGoal: ({ request: { goal, templateKey, spend } }) => {posthog.capture('replay_vision_scanner_creation_started', {creation_method: 'ai',- // Set when a goal starter card wrote the goal, so the funnel can split typed goals from one-click ones.+ // Set when a starter wrote the goal and it was sent unedited, or when an experiment was picked,+ // so the funnel can split typed goals from starter ones.template_key: templateKey ?? null,spend_mode: 'freeOnly' in spend ? 'free' : 'budget',// The goal is customer text, so only its length is captured.