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.

feat(experiments): test the wizard's Replay Vision option as a card (#108107)

ruby childs60f5a4403278
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index ac7bbb149132..9d400b53d879 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -3360,6 +3360,14 @@ snapshots:
hash: v1.k794b7964.030c95e50318c77d8010cb0a0fa7829cfba90270045068a0db974e232504f9ad.iP86lD1msdXZjVXPQ1hzjV9tizv3xhQfntQDguO8GLg
experiments-howtoreadtooltip--tooltip-frequentist--light:
hash: v1.k794b7964.06d76f5dd20d9afc251e95a391666454d01199bf6a587ed1443c19540bd92f57.qvlIJTJCzqS5DL7nVn55PYJujlSmxLxgPDYwA8a5wWo
+ experiments-replayvisionscannercard--off--dark:
+ hash: v1.k794b7964.c9fb173cda38d075177709adc2b01144d835ca606362b9c701a596199a755158.nWxgtqo2ZyNfFq0RRmHmy78q7Hu_ZRbjSM5Q70inZKs
+ experiments-replayvisionscannercard--off--light:
+ hash: v1.k794b7964.29b3f4aabf9a8b4278f376eb215e9a0b9cd790b0dc71d45f883d9de0ab3c1b00.2EJQM-yi0aTNj2xCm0WTg4Ghpn6ltHzErpZH17f-4N0
+ experiments-replayvisionscannercard--on--dark:
+ hash: v1.k794b7964.2310779b5f45ffee6c85f3df1b1cf40d52c32233890d210d3a41378df0f304ff.eQoOTer1duveivghgGouT2veQHXRZdN3wcdrnMqzJcU
+ experiments-replayvisionscannercard--on--light:
+ hash: v1.k794b7964.d6ec4b22a942e76937533228a48b0b9c2b96fd91e59490b73d288d79e5484bf8.-jm9LXPCfKi4WA8TdwuacvyPmG_VO1e7HGUY8Nct_8Q
experiments-varianttimeseriestooltip--pending-day--dark:
hash: v1.k794b7964.f97da973c97eab91ecdcbecedb9a1065107791def08411296c66f656cf021914.QvKHBwki9F0yI62j134QSU7jkV2sUlHq6SHddrzmRNo
experiments-varianttimeseriestooltip--pending-day--light:
diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx
index 1bee0f8a750b..b022c0f25136 100644
--- a/frontend/src/lib/constants.tsx
+++ b/frontend/src/lib/constants.tsx
@@ -328,6 +328,7 @@ export const FEATURE_FLAGS = {
EXPERIMENT_METRIC_EVENT_BREAKDOWNS: 'experiment-metric-event-breakdowns', // owner: @rodrigoi #team-experiments
EXPERIMENT_MULTIPLE_RECALCULATION_TIMES: 'experiment-multiple-recalculation-times', // owner: @jurajmajerik #team-experiments, gates the second daily recalculation time picker in environment settings
EXPERIMENT_SETUP_CONTEXT: 'experiment-setup-context', // owner: @mp-hog #team-experiments, gates the experiment-setup-context MCP tool, its endpoint and the staff setup context drawer on the experiments list
+ EXPERIMENT_WIZARD_REPLAY_VISION_CARD: 'experiment-wizard-replay-vision-card', // owner: #team-experiments multivariate=control,test, shows the create wizard's Replay Vision option as a card with a toggle instead of a checkbox; gate on === 'test'
EXPERIMENTS_DW_AA_TEST: 'experiments-dw-aa-test', // owner: @rodrigoi #team-experiments
EXPERIMENTS_EXCLUDED_VARIANTS: 'experiments-excluded-variants', // owner: @rodrigoi #team-experiments
EXPERIMENTS_FREEZE_EXPOSURE_AA_TEST: 'experiments-freeze-exposure-aa-test', // owner: @mp-hog #team-experiments multivariate=control,test, dogfood A/A used to validate the freeze-exposure lifecycle action
diff --git a/frontend/src/scenes/experiments/ExperimentWizard/experimentWizardLogic.test.tsx b/frontend/src/scenes/experiments/ExperimentWizard/experimentWizardLogic.test.tsx
index cb77102423db..dc2b132a719b 100644
--- a/frontend/src/scenes/experiments/ExperimentWizard/experimentWizardLogic.test.tsx
+++ b/frontend/src/scenes/experiments/ExperimentWizard/experimentWizardLogic.test.tsx
@@ -901,7 +901,7 @@ describe('experimentWizardLogic', () => {
sessionStorage.clear()
useMocks(apiMocks)
initKeaTests()
- // The checkbox's disabledReason fails closed when the app context carries no access
+ // The toggle's disabledReason fails closed when the app context carries no access
// levels, which would swallow every click; grant what the backend grants an editor.
appContextBeforeGrant = window.POSTHOG_APP_CONTEXT
window.POSTHOG_APP_CONTEXT = {
@@ -944,49 +944,100 @@ describe('experimentWizardLogic', () => {
)
}
+ const setArm = (arm: 'control' | 'test'): void => {
+ featureFlagLogic.actions.setFeatureFlags(
+ [FEATURE_FLAGS.EXPERIMENT_WIZARD_REPLAY_VISION_CARD, FEATURE_FLAGS.VISION_EXPERIMENT_SCANNER],
+ {
+ [FEATURE_FLAGS.EXPERIMENT_WIZARD_REPLAY_VISION_CARD]: arm,
+ [FEATURE_FLAGS.VISION_EXPERIMENT_SCANNER]: true,
+ }
+ )
+ }
+
+ // `control` keeps the checkbox, `test` shows the card with a toggle
+ const turnOn = async (arm: 'control' | 'test'): Promise<void> => {
+ await userEvent.click(
+ arm === 'test'
+ ? screen.getByLabelText('Compare what users do in each variant')
+ : screen.getByText('Compare what users do in each variant')
+ )
+ }
+
it.each([
- {
- desc: 'a tick without org AI consent opens the consent popover instead of arming the scanner',
- accepted: false,
- expectedArmed: false,
- },
- {
- desc: 'a tick with org AI consent arms the scanner without the popover',
- accepted: true,
- expectedArmed: true,
- },
- ])('$desc', async ({ accepted, expectedArmed }) => {
- ;(global as any).__consentAccepted = accepted
+ { arm: 'control' as const, accepted: false, expectedArmed: false },
+ { arm: 'control' as const, accepted: true, expectedArmed: true },
+ { arm: 'test' as const, accepted: false, expectedArmed: false },
+ { arm: 'test' as const, accepted: true, expectedArmed: true },
+ ])(
+ 'in $arm, turning it on with org AI consent $accepted arms the scanner: $expectedArmed',
+ async ({ arm, accepted, expectedArmed }) => {
+ ;(global as any).__consentAccepted = accepted
+ setArm(arm)
+
+ renderAnalyticsStep()
+ await turnOn(arm)
+
+ // Without the gate the unconsented click lands in the logic, and the save path then
+ // creates a scanner the backend refuses with the consent 400.
+ expect(logic.values.createReplayVisionScanner).toBe(expectedArmed)
+ const popoverPrompt = screen.queryByText(/needs your approval/)
+ if (accepted) {
+ expect(popoverPrompt).not.toBeInTheDocument()
+ } else {
+ expect(popoverPrompt).toBeInTheDocument()
+ }
+ }
+ )
- renderAnalyticsStep()
- await userEvent.click(screen.getByText('Compare what users do in each variant'))
-
- // Without the gate the unconsented tick lands in the logic, and the save path then
- // creates a scanner the backend refuses with the consent 400.
- expect(logic.values.createReplayVisionScanner).toBe(expectedArmed)
- const popoverPrompt = screen.queryByText(/needs your approval/)
- if (accepted) {
- expect(popoverPrompt).not.toBeInTheDocument()
- } else {
- expect(popoverPrompt).toBeInTheDocument()
+ it.each(['control' as const, 'test' as const])(
+ 'anchors the consent popover to the option in %s',
+ async (arm) => {
+ ;(global as any).__consentAccepted = false
+ setArm(arm)
+
+ renderAnalyticsStep()
+ await turnOn(arm)
+
+ // The popover anchors to its child through a ref. Without one it never gets a position,
+ // so it sits at the top left of the page and its arrow points at nothing.
+ await waitFor(() =>
+ expect(document.querySelector<HTMLElement>('.Popover__arrow')?.style.left).toMatch(/px$/)
+ )
}
- })
+ )
- it('shows the per-session price next to the checkbox', () => {
+ it.each(['control' as const, 'test' as const])('shows the per-session price in %s', (arm) => {
;(global as any).__consentAccepted = true
+ setArm(arm)
renderAnalyticsStep()
expect(screen.getByText(/Each scanned session costs/)).toBeInTheDocument()
})
- it('offers no scanner without the experiment-scanner flag', () => {
+ it('shows the card with a toggle only in the test arm', () => {
;(global as any).__consentAccepted = true
- featureFlagLogic.actions.setFeatureFlags([], {})
+ setArm('test')
renderAnalyticsStep()
- expect(screen.queryByText(/Each scanned session costs/)).not.toBeInTheDocument()
+ expect(screen.getByLabelText('Compare what users do in each variant')).toHaveAttribute('role', 'switch')
+ expect(screen.queryByRole('checkbox')).not.toBeInTheDocument()
+ expect(screen.getByText('Learn more about Replay Vision')).toBeInTheDocument()
})
+
+ it.each(['control' as const, 'test' as const])(
+ 'offers no scanner without the experiment-scanner flag in %s',
+ (arm) => {
+ ;(global as any).__consentAccepted = true
+ featureFlagLogic.actions.setFeatureFlags([FEATURE_FLAGS.EXPERIMENT_WIZARD_REPLAY_VISION_CARD], {
+ [FEATURE_FLAGS.EXPERIMENT_WIZARD_REPLAY_VISION_CARD]: arm,
+ })
+
+ renderAnalyticsStep()
+
+ expect(screen.queryByText(/Each scanned session costs/)).not.toBeInTheDocument()
+ }
+ )
})
})
diff --git a/frontend/src/scenes/experiments/ExperimentWizard/steps/AnalyticsStep.tsx b/frontend/src/scenes/experiments/ExperimentWizard/steps/AnalyticsStep.tsx
index b366d26ce17c..9981bf70dc72 100644
--- a/frontend/src/scenes/experiments/ExperimentWizard/steps/AnalyticsStep.tsx
+++ b/frontend/src/scenes/experiments/ExperimentWizard/steps/AnalyticsStep.tsx
@@ -1,21 +1,14 @@
import { useActions, useValues } from 'kea'
-import { useState } from 'react'
-import { IconInfo, IconSparkles } from '@posthog/icons'
-import { LemonButton, LemonCheckbox, Tooltip } from '@posthog/lemon-ui'
+import { IconInfo } from '@posthog/icons'
+import { LemonButton, Tooltip } from '@posthog/lemon-ui'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
-import { aiConsentLogic } from 'scenes/settings/organization/aiConsentLogic'
-import { AIConsentPopoverWrapper } from 'scenes/settings/organization/AIConsentPopoverWrapper'
-
-import { DEFAULT_MODEL, OBSERVATION_CREDITS_BY_MODEL } from 'products/replay_vision/frontend/replay_scanners/types'
-import { getReplayVisionEditDisabledReason } from 'products/replay_vision/frontend/utils/accessControl'
-import { formatCredits } from 'products/replay_vision/frontend/utils/credits'
import { ExposureCriteriaPanel } from '../../ExperimentForm/ExposureCriteriaPanel'
import { MetricsPanel } from '../../ExperimentForm/MetricsPanel'
-import { flagAggregatesByGroup } from '../../replayVisionScanner'
import { experimentWizardLogic } from '../experimentWizardLogic'
+import { ReplayVisionScannerOption } from './ReplayVisionScannerOption'
export function AnalyticsStep(): JSX.Element {
const { experiment, sharedMetrics } = useValues(experimentWizardLogic)
@@ -95,83 +88,7 @@ export function AnalyticsStep(): JSX.Element {
</div>
</div>
- {experimentScanners && <ReplayVisionScannerCheckbox />}
+ {experimentScanners && <ReplayVisionScannerOption />}
</div>
)
}
-
-/** Ticking this opts the experiment into a Replay Vision scanner, created at save. The scanner
- * endpoint refuses without org AI approval, so an unconsented tick opens the consent popover
- * instead of letting the experiment save and the scanner fail after the fact. */
-function ReplayVisionScannerCheckbox(): JSX.Element {
- const { createReplayVisionScanner, linkedFeatureFlag } = useValues(experimentWizardLogic)
- const { setCreateReplayVisionScanner } = useActions(experimentWizardLogic)
- const { dataProcessingAccepted } = useValues(aiConsentLogic)
- const [consentRequested, setConsentRequested] = useState(false)
- const groupAggregated = flagAggregatesByGroup(linkedFeatureFlag)
-
- const checkbox = (
- <LemonCheckbox
- bordered
- fullWidth
- checked={createReplayVisionScanner && !groupAggregated}
- onChange={(checked) => {
- if (checked && !dataProcessingAccepted) {
- setConsentRequested(true)
- } else {
- setCreateReplayVisionScanner(checked)
- }
- }}
- disabledReason={
- getReplayVisionEditDisabledReason() ??
- (groupAggregated
- ? "This experiment's feature flag aggregates by group. Replay Vision can only watch experiments that aggregate by person."
- : undefined)
- }
- data-attr="experiment-create-replay-vision-scanner"
- label={
- <div className="py-3">
- <div className="flex items-center gap-2 font-semibold">
- <IconSparkles className="text-ai" />
- Compare what users do in each variant
- </div>
- <div className="mt-1 font-normal text-sm text-muted">
- Set up an experiment scanner. It uses Replay vision to summarize the recordings of exposed users
- and shows each variant side by side. It turns on when you launch the experiment and stops when
- the experiment ends. Until launch, nothing is scanned and no credits are used.
- </div>
- {/* Per-session price only: a monthly projection needs the 30-day recording history the
- * estimate endpoint reads, and an unstarted experiment has no exposed sessions yet, so
- * any monthly figure computed here would be a misleading zero. The scanner page shows
- * the projection once participant sessions exist. Priced at the model
- * experimentScannerBody pins, so this matches the scanner the save path creates. */}
- <div className="font-normal text-sm text-muted mt-1">
- Each scanned session costs {formatCredits(OBSERVATION_CREDITS_BY_MODEL[DEFAULT_MODEL])}. The
- scanner shows a projected monthly cost once the experiment has participants.
- </div>
- </div>
- }
- />
- )
-
- if (dataProcessingAccepted) {
- return checkbox
- }
-
- return (
- <AIConsentPopoverWrapper
- placement="top"
- showArrow
- ignoreDismissal
- hideTrainingDisclaimer
- hidden={!consentRequested}
- onApprove={() => {
- setConsentRequested(false)
- setCreateReplayVisionScanner(true)
- }}
- onDismiss={() => setConsentRequested(false)}
- >
- {checkbox}
- </AIConsentPopoverWrapper>
- )
-}
diff --git a/frontend/src/scenes/experiments/ExperimentWizard/steps/ReplayVisionScannerCard.stories.tsx b/frontend/src/scenes/experiments/ExperimentWizard/steps/ReplayVisionScannerCard.stories.tsx
new file mode 100644
index 000000000000..564aea2a4cf1
--- /dev/null
+++ b/frontend/src/scenes/experiments/ExperimentWizard/steps/ReplayVisionScannerCard.stories.tsx
@@ -0,0 +1,26 @@
+import type { Meta, StoryObj } from '@storybook/react'
+
+import { DEFAULT_MODEL, OBSERVATION_CREDITS_BY_MODEL } from 'products/replay_vision/frontend/replay_scanners/types'
+import { formatCredits } from 'products/replay_vision/frontend/utils/credits'
+
+import { ReplayVisionScannerCard } from './ReplayVisionScannerCard'
+
+const meta: Meta<typeof ReplayVisionScannerCard> = {
+ title: 'Experiments/ReplayVisionScannerCard',
+ component: ReplayVisionScannerCard,
+ args: {
+ onChange: () => {},
+ sessionPrice: formatCredits(OBSERVATION_CREDITS_BY_MODEL[DEFAULT_MODEL]),
+ },
+}
+export default meta
+
+type Story = StoryObj<typeof ReplayVisionScannerCard>
+
+export const Off: Story = {
+ args: { checked: false },
+}
+
+export const On: Story = {
+ args: { checked: true },
+}
diff --git a/frontend/src/scenes/experiments/ExperimentWizard/steps/ReplayVisionScannerCard.tsx b/frontend/src/scenes/experiments/ExperimentWizard/steps/ReplayVisionScannerCard.tsx
new file mode 100644
index 000000000000..7f255db187c6
--- /dev/null
+++ b/frontend/src/scenes/experiments/ExperimentWizard/steps/ReplayVisionScannerCard.tsx
@@ -0,0 +1,59 @@
+import * as xRayPng from '@posthog/brand/hoggies/png/x-ray'
+import { IconEye } from '@posthog/icons'
+import { LemonCard, LemonSwitch } from '@posthog/lemon-ui'
+
+import { pngHoggie } from 'lib/brand/hoggies'
+
+import { VisionDocsLink } from 'products/replay_vision/frontend/components/DocsLink'
+
+import type { ReplayVisionScannerOptionProps } from './types'
+
+const HedgehogXRay = pngHoggie(xRayPng)
+
+export function ReplayVisionScannerCard({
+ checked,
+ onChange,
+ disabledReason,
+ sessionPrice,
+}: ReplayVisionScannerOptionProps): JSX.Element {
+ const title = 'Compare what users do in each variant'
+
+ return (
+ <LemonCard hoverEffect={false} className="@container flex items-start gap-4 p-4">
+ <HedgehogXRay className="hidden @md:block w-20 shrink-0" />
+ <div className="flex min-w-0 flex-1 flex-col gap-2">
+ <div className="flex items-start justify-between gap-3">
+ <div className="min-w-0">
+ <div className="flex items-center gap-1.5 font-semibold">
+ <IconEye
+ className="size-4 shrink-0"
+ style={{ color: 'var(--color-product-session-replay-light)' }}
+ />
+ {title}
+ </div>
+ <p className="m-0 mt-1 text-sm text-secondary">
+ Replay vision summarizes the recordings of people in this experiment and shows each variant
+ side by side.
+ </p>
+ </div>
+ <LemonSwitch
+ checked={checked}
+ onChange={onChange}
+ disabledReason={disabledReason}
+ aria-label={title}
+ data-attr="experiment-create-replay-vision-scanner"
+ />
+ </div>
+ <p className="m-0 text-xs text-muted">
+ It turns on when you launch the experiment and stops when the experiment ends. Each scanned session
+ costs {sessionPrice}.
+ </p>
+ <div className="text-sm">
+ <VisionDocsLink dataAttr="experiment-create-replay-vision-docs">
+ Learn more about Replay Vision
+ </VisionDocsLink>
+ </div>
+ </div>
+ </LemonCard>
+ )
+}
diff --git a/frontend/src/scenes/experiments/ExperimentWizard/steps/ReplayVisionScannerCheckbox.tsx b/frontend/src/scenes/experiments/ExperimentWizard/steps/ReplayVisionScannerCheckbox.tsx
new file mode 100644
index 000000000000..31fffbd48ecb
--- /dev/null
+++ b/frontend/src/scenes/experiments/ExperimentWizard/steps/ReplayVisionScannerCheckbox.tsx
@@ -0,0 +1,39 @@
+import { IconSparkles } from '@posthog/icons'
+import { LemonCheckbox } from '@posthog/lemon-ui'
+
+import type { ReplayVisionScannerOptionProps } from './types'
+
+export function ReplayVisionScannerCheckbox({
+ checked,
+ onChange,
+ disabledReason,
+ sessionPrice,
+}: ReplayVisionScannerOptionProps): JSX.Element {
+ return (
+ <LemonCheckbox
+ bordered
+ fullWidth
+ checked={checked}
+ onChange={onChange}
+ disabledReason={disabledReason}
+ data-attr="experiment-create-replay-vision-scanner"
+ label={
+ <div className="py-3">
+ <div className="flex items-center gap-2 font-semibold">
+ <IconSparkles className="text-ai" />
+ Compare what users do in each variant
+ </div>
+ <div className="mt-1 font-normal text-sm text-muted">
+ Set up an experiment scanner. It uses Replay vision to summarize the recordings of exposed users
+ and shows each variant side by side. It turns on when you launch the experiment and stops when
+ the experiment ends. Until launch, nothing is scanned and no credits are used.
+ </div>
+ <div className="font-normal text-sm text-muted mt-1">
+ Each scanned session costs {sessionPrice}. The scanner shows a projected monthly cost once the
+ experiment has participants.
+ </div>
+ </div>
+ }
+ />
+ )
+}
diff --git a/frontend/src/scenes/experiments/ExperimentWizard/steps/ReplayVisionScannerOption.tsx b/frontend/src/scenes/experiments/ExperimentWizard/steps/ReplayVisionScannerOption.tsx
new file mode 100644
index 000000000000..634094645e05
--- /dev/null
+++ b/frontend/src/scenes/experiments/ExperimentWizard/steps/ReplayVisionScannerOption.tsx
@@ -0,0 +1,85 @@
+import { useActions, useValues } from 'kea'
+import { useState } from 'react'
+
+import { FEATURE_FLAGS } from 'lib/constants'
+import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
+import { aiConsentLogic } from 'scenes/settings/organization/aiConsentLogic'
+import { AIConsentPopoverWrapper } from 'scenes/settings/organization/AIConsentPopoverWrapper'
+
+import { DEFAULT_MODEL, OBSERVATION_CREDITS_BY_MODEL } from 'products/replay_vision/frontend/replay_scanners/types'
+import { getReplayVisionEditDisabledReason } from 'products/replay_vision/frontend/utils/accessControl'
+import { formatCredits } from 'products/replay_vision/frontend/utils/credits'
+
+import { flagAggregatesByGroup } from '../../replayVisionScanner'
+import { experimentWizardLogic } from '../experimentWizardLogic'
+import { ReplayVisionScannerCard } from './ReplayVisionScannerCard'
+import { ReplayVisionScannerCheckbox } from './ReplayVisionScannerCheckbox'
+import type { ReplayVisionScannerOptionProps } from './types'
+
+/** Turning this on opts the experiment into a Replay Vision scanner, created at save. The scanner
+ * endpoint refuses without org AI approval, so turning it on without consent opens the consent popover
+ * instead of letting the experiment save and the scanner fail after the fact.
+ *
+ * The `test` arm of EXPERIMENT_WIZARD_REPLAY_VISION_CARD shows it as a card with a toggle, `control` keeps the
+ * checkbox. The flag is read here, at the end of the analytics step, so only people who see the option are
+ * exposed. */
+export function ReplayVisionScannerOption(): JSX.Element {
+ const { createReplayVisionScanner, linkedFeatureFlag } = useValues(experimentWizardLogic)
+ const { setCreateReplayVisionScanner } = useActions(experimentWizardLogic)
+ const { dataProcessingAccepted } = useValues(aiConsentLogic)
+ const { featureFlags } = useValues(featureFlagLogic)
+ const [consentRequested, setConsentRequested] = useState(false)
+ const groupAggregated = flagAggregatesByGroup(linkedFeatureFlag)
+
+ const optionProps: ReplayVisionScannerOptionProps = {
+ checked: createReplayVisionScanner && !groupAggregated,
+ onChange: (checked) => {
+ if (checked && !dataProcessingAccepted) {
+ setConsentRequested(true)
+ } else {
+ setCreateReplayVisionScanner(checked)
+ }
+ },
+ disabledReason:
+ getReplayVisionEditDisabledReason() ??
+ (groupAggregated
+ ? "This experiment's feature flag aggregates by group. Replay Vision can only watch experiments that aggregate by person."
+ : undefined),
+ // Per-session price only: a monthly projection needs the 30-day recording history the
+ // estimate endpoint reads, and an unstarted experiment has no exposed sessions yet, so
+ // any monthly figure computed here would be a misleading zero. The scanner page shows
+ // the projection once participant sessions exist. Priced at the model
+ // experimentScannerBody pins, so this matches the scanner the save path creates.
+ sessionPrice: formatCredits(OBSERVATION_CREDITS_BY_MODEL[DEFAULT_MODEL]),
+ }
+
+ const showCard = featureFlags[FEATURE_FLAGS.EXPERIMENT_WIZARD_REPLAY_VISION_CARD] === 'test'
+ const option = showCard ? (
+ <ReplayVisionScannerCard {...optionProps} />
+ ) : (
+ <ReplayVisionScannerCheckbox {...optionProps} />
+ )
+
+ if (dataProcessingAccepted) {
+ return option
+ }
+
+ return (
+ <AIConsentPopoverWrapper
+ placement="top"
+ showArrow
+ ignoreDismissal
+ hideTrainingDisclaimer
+ hidden={!consentRequested}
+ onApprove={() => {
+ setConsentRequested(false)
+ setCreateReplayVisionScanner(true)
+ }}
+ onDismiss={() => setConsentRequested(false)}
+ >
+ {/* The popover anchors to its child through a ref, which the card and checkbox don't forward.
+ w-fit keeps the arrow on the checkbox, which is only as wide as its label. */}
+ <div className={showCard ? undefined : 'w-fit'}>{option}</div>
+ </AIConsentPopoverWrapper>
+ )
+}
diff --git a/frontend/src/scenes/experiments/ExperimentWizard/steps/types.ts b/frontend/src/scenes/experiments/ExperimentWizard/steps/types.ts
new file mode 100644
index 000000000000..6cd657f6767e
--- /dev/null
+++ b/frontend/src/scenes/experiments/ExperimentWizard/steps/types.ts
@@ -0,0 +1,7 @@
+/** Shared by the two arms of the Replay Vision option: the card and the checkbox. */
+export interface ReplayVisionScannerOptionProps {
+ checked: boolean
+ onChange: (checked: boolean) => void
+ disabledReason?: string
+ sessionPrice: string
+}